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

feat: v1.1 #391

Merged
merged 43 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
dad40b7
feat(child): add `GenesisProxy` and dummy deployment scripts
ZeroEkkusu Sep 19, 2023
8de1af2
Merge pull request #383 from 0xPolygon/feat/child-deploy
ZeroEkkusu Sep 19, 2023
c885b12
feat: prepare for 1.1
ZeroEkkusu Sep 19, 2023
b1501df
fix: slither
ZeroEkkusu Sep 19, 2023
15a9fd9
feat: add initial `DeployChildContracts.s.sol`
ZeroEkkusu Sep 21, 2023
0e48b0f
fix: clean up 2/3
ZeroEkkusu Sep 25, 2023
5c87287
docs: update docs
ZeroEkkusu Sep 25, 2023
4f9e769
fix: restore `EPOCH_SIZE` in VS
ZeroEkkusu Sep 26, 2023
a71891d
fix: rm `NetworkParams` and `ForkParams`
ZeroEkkusu Sep 26, 2023
e219ebe
fix: clean up 3/3
ZeroEkkusu Sep 26, 2023
5c2a00f
fix: sliter
ZeroEkkusu Sep 26, 2023
7393eef
Merge pull request #384 from 0xPolygon/feat/1-1-clean-up
ZeroEkkusu Sep 26, 2023
8a81a5b
fix: low-info
ZeroEkkusu Oct 3, 2023
441334b
fix: disable initializers
ZeroEkkusu Oct 19, 2023
3bca8ef
test: update tests
ZeroEkkusu Oct 19, 2023
df0722c
fix: update config
ZeroEkkusu Oct 19, 2023
1ef54f1
docs: generate docs
ZeroEkkusu Oct 19, 2023
a3ab051
revert: custom errors
ZeroEkkusu Oct 20, 2023
9abed0c
docs: generate docs
ZeroEkkusu Oct 20, 2023
02c5bba
test: update hh tests 1/2
ZeroEkkusu Oct 20, 2023
c8ba7d0
test: update hh tests 2/2
ZeroEkkusu Oct 20, 2023
366c197
Premine function implementation
Stefan-Ethernal Oct 23, 2023
bd06c5b
Fix slither
Stefan-Ethernal Oct 24, 2023
6baee8d
Unit tests
Stefan-Ethernal Oct 25, 2023
579029f
Use correct forge-std revision
Stefan-Ethernal Oct 25, 2023
96f761f
Address comments (part 1)
Stefan-Ethernal Oct 26, 2023
ffc6b22
Remove blank line
Stefan-Ethernal Oct 26, 2023
5f491bf
Pass tests again
Stefan-Ethernal Oct 28, 2023
9f63d58
Introduce genesisBalances field for storing premine balances
Stefan-Ethernal Oct 28, 2023
308282e
Rename premine to addGenesisBalance
Stefan-Ethernal Oct 30, 2023
49f8f02
Remove nativeTokenRoot function and make field public
Stefan-Ethernal Oct 30, 2023
32e63d4
Track genesis balances in the CustomSupernetManager
Stefan-Ethernal Oct 30, 2023
2d1dcc0
Rename event
Stefan-Ethernal Oct 30, 2023
485e3c6
Remove getGenesisBalance function
Stefan-Ethernal Oct 30, 2023
206a2e5
Minor fix
Stefan-Ethernal Oct 31, 2023
813c1b8
Merge pull request #411 from Stefan-Ethernal/EVM-865-unable-to-fund-r…
ZeroEkkusu Oct 31, 2023
7f64f3f
Merge branch 'dev' into fix/low-info
ZeroEkkusu Dec 1, 2023
0df6120
Merge pull request #400 from 0xPolygon/fix/low-info
ZeroEkkusu Dec 1, 2023
018e087
fix: slither
ZeroEkkusu Dec 1, 2023
5cb180d
test: update tests
ZeroEkkusu Dec 1, 2023
ae6e58a
fix: slither
ZeroEkkusu Dec 1, 2023
586ad45
build: fix ci
ZeroEkkusu Dec 1, 2023
2e19df9
fix: slither
ZeroEkkusu Dec 1, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
cache: "npm"
- run: npm ci
- run: npx hardhat compile --show-stack-traces
- run: TS_NODE_TRANSPILE_ONLY=1 npx hardhat test --parallel
- run: TS_NODE_TRANSPILE_ONLY=1 npx hardhat test
forge_tests:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ Some contracts in the Edge suite need be deployed only once on root. These contr

Other contracts are deployed on root once per Supernet. These contracts can deployed using the [`DeployNewRootContractSet.s.sol`](script/deployment/DeployNewRootContractSet.s.sol) script, after [`rootContractSetConfig.json`](script/deployment/rootContractSetConfig.json) has been filled with appropriate values.

Note that the script does not initialize `CheckpointManager`. Instead protects it to be initializable only by the `INITIALIZER` address later.
Note that the script does not initialize `CheckpointManager`. Instead, it protects it to be initializable only by the `INITIATOR` address later.

Not all root contracts are deployed at this point, however. There are parts of the bridge that need the addresses of various child contracts in order to be initialized. These contracts can deployed using the [`DeployRootTokenContracts.s.sol`](script/deployment/DeployRootTokenContracts.s.sol) script, after [`rootTokenContractsConfig.json`](script/deployment/rootTokenContractsConfig.json) has been filled with appropriate values.

Expand Down
4 changes: 4 additions & 0 deletions contracts/child/ChildERC1155.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

pragma solidity ^0.8.19;

import "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol";

Check warning on line 6 in contracts/child/ChildERC1155.sol

View workflow job for this annotation

GitHub Actions / lint

global import of path @openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)

Check warning on line 6 in contracts/child/ChildERC1155.sol

View workflow job for this annotation

GitHub Actions / lint

global import of path @openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)
import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";

Check warning on line 7 in contracts/child/ChildERC1155.sol

View workflow job for this annotation

GitHub Actions / lint

global import of path @openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)

Check warning on line 7 in contracts/child/ChildERC1155.sol

View workflow job for this annotation

GitHub Actions / lint

global import of path @openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)
import "../lib/EIP712MetaTransaction.sol";

Check warning on line 8 in contracts/child/ChildERC1155.sol

View workflow job for this annotation

GitHub Actions / lint

global import of path ../lib/EIP712MetaTransaction.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)

Check warning on line 8 in contracts/child/ChildERC1155.sol

View workflow job for this annotation

GitHub Actions / lint

global import of path ../lib/EIP712MetaTransaction.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)
import "../interfaces/child/IChildERC1155.sol";

Check warning on line 9 in contracts/child/ChildERC1155.sol

View workflow job for this annotation

GitHub Actions / lint

global import of path ../interfaces/child/IChildERC1155.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)

Check warning on line 9 in contracts/child/ChildERC1155.sol

View workflow job for this annotation

GitHub Actions / lint

global import of path ../interfaces/child/IChildERC1155.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)

/**
@title ChildERC1155
Expand All @@ -20,15 +20,19 @@
address private _rootToken;

modifier onlyPredicate() {
require(msg.sender == _predicate, "ChildERC1155: Only predicate can call");

Check warning on line 23 in contracts/child/ChildERC1155.sol

View workflow job for this annotation

GitHub Actions / lint

Error message for require is too long: 37 counted / 32 allowed

Check warning on line 23 in contracts/child/ChildERC1155.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements

Check warning on line 23 in contracts/child/ChildERC1155.sol

View workflow job for this annotation

GitHub Actions / lint

Error message for require is too long: 37 counted / 32 allowed

Check warning on line 23 in contracts/child/ChildERC1155.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements
_;
}

constructor() {
_disableInitializers();
}

/**
* @inheritdoc IChildERC1155
*/
function initialize(address rootToken_, string calldata uri_) external initializer {
require(rootToken_ != address(0), "ChildERC1155: BAD_INITIALIZATION");

Check warning on line 35 in contracts/child/ChildERC1155.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements

Check warning on line 35 in contracts/child/ChildERC1155.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements
_rootToken = rootToken_;
_predicate = msg.sender;
__ERC1155_init(uri_);
Expand Down Expand Up @@ -67,7 +71,7 @@
uint256[] calldata amounts
) external onlyPredicate returns (bool) {
uint256 length = accounts.length;
require(length == tokenIds.length && length == amounts.length, "ChildERC1155: array len mismatch");

Check warning on line 74 in contracts/child/ChildERC1155.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements

Check warning on line 74 in contracts/child/ChildERC1155.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements
for (uint256 i = 0; i < length; ) {
_mint(accounts[i], tokenIds[i], amounts[i], "");
unchecked {
Expand Down
4 changes: 4 additions & 0 deletions contracts/child/ChildERC1155Predicate.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

Check warning on line 4 in contracts/child/ChildERC1155Predicate.sol

View workflow job for this annotation

GitHub Actions / lint

global import of path @openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)

Check warning on line 4 in contracts/child/ChildERC1155Predicate.sol

View workflow job for this annotation

GitHub Actions / lint

global import of path @openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";

Check warning on line 5 in contracts/child/ChildERC1155Predicate.sol

View workflow job for this annotation

GitHub Actions / lint

global import of path @openzeppelin/contracts/token/ERC1155/IERC1155.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)

Check warning on line 5 in contracts/child/ChildERC1155Predicate.sol

View workflow job for this annotation

GitHub Actions / lint

global import of path @openzeppelin/contracts/token/ERC1155/IERC1155.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)
import "@openzeppelin/contracts/proxy/Clones.sol";
import "../interfaces/child/IChildERC1155Predicate.sol";
import "../interfaces/child/IChildERC1155.sol";
Expand Down Expand Up @@ -71,6 +71,10 @@
_;
}

constructor() {
_disableInitializers();
}

/**
* @notice Initialization function for ChildERC1155Predicate
* @param newL2StateSender Address of L2StateSender to send exit information to
Expand Down
4 changes: 4 additions & 0 deletions contracts/child/ChildERC1155PredicateAccessList.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ import {AccessList} from "../lib/AccessList.sol";
*/
// solhint-disable reason-string
contract ChildERC1155PredicateAccessList is AccessList, ChildERC1155Predicate {
constructor() {
_disableInitializers();
}

function initialize(
address newL2StateSender,
address newStateReceiver,
Expand Down
4 changes: 4 additions & 0 deletions contracts/child/ChildERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ contract ChildERC20 is EIP712MetaTransaction, ERC20Upgradeable, IChildERC20 {
_;
}

constructor() {
_disableInitializers();
}

/**
* @inheritdoc IChildERC20
*/
Expand Down
4 changes: 4 additions & 0 deletions contracts/child/ChildERC20Predicate.sol
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ contract ChildERC20Predicate is IChildERC20Predicate, Initializable, System {
);
event L2TokenMapped(address indexed rootToken, address indexed childToken);

constructor() {
_disableInitializers();
}

/**
* @notice Initialization function for ChildERC20Predicate
* @param newL2StateSender Address of L2StateSender to send exit information to
Expand Down
4 changes: 4 additions & 0 deletions contracts/child/ChildERC20PredicateAccessList.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ import {AccessList} from "../lib/AccessList.sol";
*/
// solhint-disable reason-string
contract ChildERC20PredicateAccessList is AccessList, ChildERC20Predicate {
constructor() {
_disableInitializers();
}

function initialize(
address newL2StateSender,
address newStateReceiver,
Expand Down
4 changes: 4 additions & 0 deletions contracts/child/ChildERC721.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ contract ChildERC721 is EIP712MetaTransaction, ERC721Upgradeable, IChildERC721 {
_;
}

constructor() {
_disableInitializers();
}

/**
* @inheritdoc IChildERC721
*/
Expand Down
4 changes: 4 additions & 0 deletions contracts/child/ChildERC721Predicate.sol
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ contract ChildERC721Predicate is IChildERC721Predicate, Initializable, System {
_;
}

constructor() {
_disableInitializers();
}

/**
* @notice Initialization function for ChildERC721Predicate
* @param newL2StateSender Address of L2StateSender to send exit information to
Expand Down
4 changes: 4 additions & 0 deletions contracts/child/ChildERC721PredicateAccessList.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ import {AccessList} from "../lib/AccessList.sol";
*/
// solhint-disable reason-string
contract ChildERC721PredicateAccessList is AccessList, ChildERC721Predicate {
constructor() {
_disableInitializers();
}

function initialize(
address newL2StateSender,
address newStateReceiver,
Expand Down
4 changes: 4 additions & 0 deletions contracts/child/EIP1559Burn.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ contract EIP1559Burn is Initializable {
// slither-disable-next-line locked-ether
receive() external payable {} // solhint-disable-line no-empty-blocks

constructor() {
_disableInitializers();
}

/**
* @notice Initialization function for EIP1559 burn contract
* @param newChildERC20Predicate Address of the ERC20 predicate on child chain
Expand Down
71 changes: 0 additions & 71 deletions contracts/child/ForkParams.sol

This file was deleted.

4 changes: 4 additions & 0 deletions contracts/child/NativeERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ contract NativeERC20 is Context, Initializable, System, INativeERC20 {
_;
}

constructor() {
_disableInitializers();
}

/**
* @dev Sets the values for {predicate}, {name} and {symbol}.
*
Expand Down
4 changes: 4 additions & 0 deletions contracts/child/NativeERC20Mintable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ contract NativeERC20Mintable is Context, Initializable, System, Ownable2Step, IE
_;
}

constructor() {
_disableInitializers();
}

/**
* @dev Sets the values for {predicate}, {name} and {symbol}.
*
Expand Down
Loading
Loading