Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Namespace storage #420

Merged
merged 21 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
branch = v1.3.0
[submodule "contracts/lib/openzeppelin-contracts"]
path = contracts/lib/openzeppelin-contracts
url = https://github.com/openzeppelin/openzeppelin-contracts
[submodule "lib/openzeppelin-contracts"]
branch = v4.8.1
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "contracts/lib/subnet-evm"]
path = contracts/lib/subnet-evm
url = https://github.com/ava-labs/subnet-evm
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Setup

To start developing on Teleporter, you'll need Solidity >= v0.8.18. [Foundry](https://book.getfoundry.sh/getting-started/installation) is the recommended development toolkit for working with Teleporter, and it comes bundled with the required Solidity version. To run the tests and linter locally, you'll need the dependencies described in [Setup](./README.md#setup), as well as [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
To start developing on Teleporter, you'll need Solidity >= v0.8.20. [Foundry](https://book.getfoundry.sh/getting-started/installation) is the recommended development toolkit for working with Teleporter, and it comes bundled with the required Solidity version. To run the tests and linter locally, you'll need the dependencies described in [Setup](./README.md#setup), as well as [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)

## Issues

Expand All @@ -13,7 +13,7 @@ To start developing on Teleporter, you'll need Solidity >= v0.8.18. [Foundry](ht
### Making an Issue

- Check that the issue you're filing doesn't already exist by searching under [issues](https://github.com/ava-labs/teleporter/issues).
- If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/ava-labs/teleporter/issues/new/choose). Be sure to include a *title and clear description* with as much relevant information as possible.
- If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/ava-labs/teleporter/issues/new/choose). Be sure to include a _title and clear description_ with as much relevant information as possible.

## Features

Expand Down
4 changes: 2 additions & 2 deletions abi-bindings/go/governance/ValidatorSetSig/ValidatorSetSig.go

Large diffs are not rendered by default.

136 changes: 47 additions & 89 deletions abi-bindings/go/mocks/ExampleERC20/ExampleERC20.go

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

49 changes: 9 additions & 40 deletions abi-bindings/go/teleporter/tests/TestMessenger/TestMessenger.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
src = 'src'
out = 'out'
libs = ['lib']
solc_version = '0.8.18'
solc_version = '0.8.20'
test = 'tests'

[fmt]
Expand Down
2 changes: 1 addition & 1 deletion contracts/lib/openzeppelin-contracts
4 changes: 2 additions & 2 deletions contracts/remappings.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@avalabs/[email protected]/=lib/subnet-evm/contracts/
@openzeppelin/contracts@4.8.1=lib/openzeppelin-contracts/contracts/
@openzeppelin/contracts-upgradeable@4.9.6=lib/openzeppelin-contracts-upgradeable/contracts/
@openzeppelin/contracts@5.0.2=lib/openzeppelin-contracts/contracts/
@openzeppelin/contracts-upgradeable@5.0.2=lib/openzeppelin-contracts-upgradeable/contracts/
@teleporter/=src/teleporter/
@mocks/=src/mocks/
@utilities/=src/utilities/
Expand Down
72 changes: 33 additions & 39 deletions contracts/src/.solhint.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,35 @@
{
"extends": "solhint:recommended",
"rules": {
"compiler-version": [
"error",
"0.8.18"
],
"no-unused-vars": "error",
"func-visibility": [
"error",
{
"ignoreConstructors": true
}
],
"private-vars-leading-underscore": [
"warn",
{
"strict": true
}
],
"reason-string": [
"warn",
{
"maxLength": 75
}
],
"gas-custom-errors": "off",
"ordering": "error",
"immutable-vars-naming": [
"warn",
{
"immutablesAsConstants": false
}
],
"func-named-parameters": [
"error",
5
],
"one-contract-per-file": "off"
}
"extends": "solhint:recommended",
"rules": {
"compiler-version": ["error", "0.8.20"],
"no-unused-vars": "error",
"func-visibility": [
"error",
{
"ignoreConstructors": true
}
],
"private-vars-leading-underscore": [
"warn",
{
"strict": true
}
],
"reason-string": [
"warn",
{
"maxLength": 75
}
],
"gas-custom-errors": "off",
"ordering": "error",
"immutable-vars-naming": [
"warn",
{
"immutablesAsConstants": false
}
],
"func-named-parameters": ["error", 5],
"one-contract-per-file": "off"
}
}
4 changes: 2 additions & 2 deletions contracts/src/governance/ValidatorSetSig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

// SPDX-License-Identifier: Ecosystem

pragma solidity 0.8.18;
pragma solidity 0.8.20;

import {
WarpMessage,
IWarpMessenger
} from "@avalabs/[email protected]/contracts/interfaces/IWarpMessenger.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts@4.8.1/security/ReentrancyGuard.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts@5.0.2/utils/ReentrancyGuard.sol";

/**
* THIS IS AN EXAMPLE CONTRACT THAT USES UN-AUDITED CODE.
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/governance/tests/ValidatorSetSigTests.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// SPDX-License-Identifier: Ecosystem

pragma solidity 0.8.18;
pragma solidity 0.8.20;

import {Test} from "forge-std/Test.sol";
import {
Expand Down
4 changes: 2 additions & 2 deletions contracts/src/mocks/ExampleERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// SPDX-License-Identifier: Ecosystem

pragma solidity 0.8.18;
pragma solidity 0.8.20;

/**
* THIS IS AN EXAMPLE CONTRACT THAT USES UN-AUDITED CODE.
Expand All @@ -13,7 +13,7 @@ pragma solidity 0.8.18;
import {
ERC20Burnable,
ERC20
} from "@openzeppelin/contracts@4.8.1/token/ERC20/extensions/ERC20Burnable.sol";
} from "@openzeppelin/contracts@5.0.2/token/ERC20/extensions/ERC20Burnable.sol";

contract ExampleERC20 is ERC20Burnable {
string private constant _TOKEN_NAME = "Mock Token";
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/mocks/UnitTestMockERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// SPDX-License-Identifier: Ecosystem

pragma solidity 0.8.18;
pragma solidity 0.8.20;

/**
* THIS IS AN EXAMPLE CONTRACT THAT USES UN-AUDITED CODE.
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/teleporter/ITeleporterMessenger.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// SPDX-License-Identifier: Ecosystem

pragma solidity 0.8.18;
pragma solidity 0.8.20;

// A message receipt identifies the message that was delivered by its nonce,
// and the address that can redeem the reward for that message.
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/teleporter/ITeleporterReceiver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// SPDX-License-Identifier: Ecosystem

pragma solidity 0.8.18;
pragma solidity 0.8.20;

/**
* @dev Interface that cross-chain applications must implement to receive messages from Teleporter.
Expand Down
4 changes: 2 additions & 2 deletions contracts/src/teleporter/ReceiptQueue.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

// SPDX-License-Identifier: Ecosystem

pragma solidity 0.8.18;
pragma solidity 0.8.20;

import {Math} from "@openzeppelin/contracts@4.8.1/utils/math/Math.sol";
import {Math} from "@openzeppelin/contracts@5.0.2/utils/math/Math.sol";
import {TeleporterMessageReceipt} from "./ITeleporterMessenger.sol";

/**
Expand Down
11 changes: 5 additions & 6 deletions contracts/src/teleporter/TeleporterMessenger.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

// SPDX-License-Identifier: Ecosystem

pragma solidity 0.8.18;
pragma solidity 0.8.20;

import {IERC20} from "@openzeppelin/contracts@4.8.1/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts@4.8.1/token/ERC20/utils/SafeERC20.sol";
import {IERC20} from "@openzeppelin/contracts@5.0.2/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts@5.0.2/token/ERC20/utils/SafeERC20.sol";
import {
WarpMessage,
IWarpMessenger
Expand Down Expand Up @@ -424,9 +424,8 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards {
bytes32 blockchainID_ = blockchainID;

// Iterate through the specified message IDs and create teleporter receipts to send back.
TeleporterMessageReceipt[] memory receiptsToSend = new TeleporterMessageReceipt[](
messageIDs.length
);
TeleporterMessageReceipt[] memory receiptsToSend =
new TeleporterMessageReceipt[](messageIDs.length);
uint256 length = messageIDs.length;
for (uint256 i; i < length; ++i) {
bytes32 receivedMessageID = messageIDs[i];
Expand Down
10 changes: 6 additions & 4 deletions contracts/src/teleporter/registry/TeleporterOwnerUpgradeable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

// SPDX-License-Identifier: Ecosystem

pragma solidity 0.8.18;
pragma solidity 0.8.20;

import {TeleporterUpgradeable} from "./TeleporterUpgradeable.sol";
import {OwnableUpgradeable} from
"@openzeppelin/contracts-upgradeable@4.9.6/access/OwnableUpgradeable.sol";
"@openzeppelin/contracts-upgradeable@5.0.2/access/OwnableUpgradeable.sol";

/**
* @dev Contract that inherits {TeleporterUpgradeable} and allows
Expand All @@ -22,10 +22,12 @@ abstract contract TeleporterOwnerUpgradeable is TeleporterUpgradeable, OwnableUp
address initialOwner
) internal onlyInitializing {
__TeleporterUpgradeable_init(teleporterRegistryAddress);
__Ownable_init();
transferOwnership(initialOwner);
__Ownable_init_unchained(initialOwner);
}

// solhint-disable-next-line func-name-mixedcase, no-empty-blocks, func-name-mixedcase
function _TeleporterOwnerUpgradeable_init_unchained() internal onlyInitializing {}

/**
* @dev See {TeleporterUpgradeable-_checkTeleporterUpgradeAccess}
*
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/teleporter/registry/TeleporterRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// SPDX-License-Identifier: Ecosystem

pragma solidity 0.8.18;
pragma solidity 0.8.20;

import {ITeleporterMessenger} from "@teleporter/ITeleporterMessenger.sol";
import {
Expand Down
Loading