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

fix: low-info #400

Merged
merged 10 commits into from
Dec 1, 2023
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: 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)
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)
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)
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)

/**
@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
_;
}

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
_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
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)
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)
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
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
4 changes: 4 additions & 0 deletions contracts/child/RootMintableERC1155Predicate.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ contract RootMintableERC1155Predicate is Initializable, ERC1155Holder, IRootMint
bytes32 public constant MAP_TOKEN_SIG = keccak256("MAP_TOKEN");
mapping(address => address) public rootTokenToChildToken;

constructor() {
_disableInitializers();
}

/**
* @notice Initialization function for RootMintableERC1155Predicate
* @param newL2StateSender Address of L2StateSender to send deposit information to
Expand Down
4 changes: 4 additions & 0 deletions contracts/child/RootMintableERC1155PredicateAccessList.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 RootMintableERC1155PredicateAccessList is AccessList, RootMintableERC1155Predicate {
constructor() {
_disableInitializers();
}

function initialize(
address newL2StateSender,
address newStateReceiver,
Expand Down
4 changes: 4 additions & 0 deletions contracts/child/RootMintableERC20Predicate.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ contract RootMintableERC20Predicate is IRootMintableERC20Predicate, Initializabl
bytes32 public constant MAP_TOKEN_SIG = keccak256("MAP_TOKEN");
mapping(address => address) public rootTokenToChildToken;

constructor() {
_disableInitializers();
}

/**
* @notice Initialization function for RootMintableERC20Predicate
* @param newL2StateSender Address of L2StateSender to send exit information to
Expand Down
4 changes: 4 additions & 0 deletions contracts/child/RootMintableERC20PredicateAccessList.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 RootMintableERC20PredicateAccessList is AccessList, RootMintableERC20Predicate {
constructor() {
_disableInitializers();
}

function initialize(
address newL2StateSender,
address newStateReceiver,
Expand Down
4 changes: 4 additions & 0 deletions contracts/child/RootMintableERC721Predicate.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ contract RootMintableERC721Predicate is Initializable, ERC721Holder, System, IRo
bytes32 public constant MAP_TOKEN_SIG = keccak256("MAP_TOKEN");
mapping(address => address) public rootTokenToChildToken;

constructor() {
_disableInitializers();
}

/**
* @notice Initialization function for RootMintableERC721Predicate
* @param newL2StateSender Address of L2StateSender to send deposit information to
Expand Down
4 changes: 4 additions & 0 deletions contracts/child/RootMintableERC721PredicateAccessList.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 RootMintableERC721PredicateAccessList is AccessList, RootMintableERC721Predicate {
constructor() {
_disableInitializers();
}

function initialize(
address newL2StateSender,
address newStateReceiver,
Expand Down
4 changes: 4 additions & 0 deletions contracts/child/validator/RewardPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ contract RewardPool is IRewardPool, System, Initializable {
mapping(uint256 => uint256) public paidRewardPerEpoch;
mapping(address => uint256) public pendingRewards;

constructor() {
_disableInitializers();
}

function initialize(
address newRewardToken,
address newRewardWallet,
Expand Down
4 changes: 4 additions & 0 deletions contracts/child/validator/ValidatorSet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ contract ValidatorSet is IValidatorSet, ERC20SnapshotUpgradeable, System {
uint256[] public epochEndBlocks;
mapping(address => WithdrawalQueue) private _withdrawals;

constructor() {
_disableInitializers();
}

function initialize(
address newStateSender,
address newStateReceiver,
Expand Down
2 changes: 2 additions & 0 deletions contracts/root/CheckpointManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ contract CheckpointManager is ICheckpointManager, Initializable {
constructor(address initiator) {
// slither-disable-next-line missing-zero-check
_INITIATOR = initiator;

_disableInitializers();
}

/**
Expand Down
5 changes: 4 additions & 1 deletion contracts/root/ChildMintableERC1155Predicate.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
pragma solidity 0.8.19;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/proxy/Clones.sol";
import "../interfaces/root/IChildMintableERC1155Predicate.sol";
import "../interfaces/child/IChildERC1155.sol";
Expand Down Expand Up @@ -32,6 +31,10 @@ contract ChildMintableERC1155Predicate is Initializable, IChildMintableERC1155Pr
_;
}

constructor() {
_disableInitializers();
}

/**
* @notice Initialization function for ChildMintableERC1155Predicate
* @param newStateSender Address of StateSender to send exit information to
Expand Down
4 changes: 4 additions & 0 deletions contracts/root/ChildMintableERC20Predicate.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ contract ChildMintableERC20Predicate is Initializable, IChildMintableERC20Predic

mapping(address => address) public rootTokenToChildToken;

constructor() {
_disableInitializers();
}

/**
* @notice Initialization function for ChildMintableERC20Predicate
* @param newStateSender Address of StateSender to send deposit information to
Expand Down
5 changes: 4 additions & 1 deletion contracts/root/ChildMintableERC721Predicate.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
pragma solidity 0.8.19;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/proxy/Clones.sol";
import "../interfaces/root/IChildMintableERC721Predicate.sol";
import "../interfaces/child/IChildERC721.sol";
Expand Down Expand Up @@ -32,6 +31,10 @@ contract ChildMintableERC721Predicate is Initializable, IChildMintableERC721Pred
_;
}

constructor() {
_disableInitializers();
}

/**
* @notice Initialization function for ChildMintableERC721Predicate
* @param newStateSender Address of StateSender to send exit information to
Expand Down
4 changes: 4 additions & 0 deletions contracts/root/ExitHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ contract ExitHelper is IExitHelper, Initializable {
_;
}

constructor() {
_disableInitializers();
}

/**
* @notice Initialize the contract with the checkpoint manager address
* @dev The checkpoint manager contract must be deployed first
Expand Down
4 changes: 4 additions & 0 deletions contracts/root/RootERC1155Predicate.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ contract RootERC1155Predicate is Initializable, ERC1155Holder, IRootERC1155Predi
bytes32 public constant MAP_TOKEN_SIG = keccak256("MAP_TOKEN");
mapping(address => address) public rootTokenToChildToken;

constructor() {
_disableInitializers();
}

/**
* @notice Initialization function for RootERC1155Predicate
* @param newStateSender Address of StateSender to send deposit information to
Expand Down
4 changes: 4 additions & 0 deletions contracts/root/RootERC20Predicate.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ contract RootERC20Predicate is Initializable, IRootERC20Predicate {
mapping(address => address) public rootTokenToChildToken;
address public nativeTokenRoot;

constructor() {
_disableInitializers();
}

/**
* @notice Initialization function for RootERC20Predicate
* @param newStateSender Address of StateSender to send deposit information to
Expand Down
4 changes: 4 additions & 0 deletions contracts/root/RootERC721Predicate.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ contract RootERC721Predicate is Initializable, ERC721Holder, IRootERC721Predicat
bytes32 public constant MAP_TOKEN_SIG = keccak256("MAP_TOKEN");
mapping(address => address) public rootTokenToChildToken;

constructor() {
_disableInitializers();
}

/**
* @notice Initialization function for RootERC721Predicate
* @param newStateSender Address of StateSender to send deposit information to
Expand Down
5 changes: 4 additions & 1 deletion contracts/root/staking/CustomSupernetManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import "./SupernetManager.sol";
import "../../interfaces/common/IBLS.sol";
import "../../interfaces/IStateSender.sol";
import "../../interfaces/root/staking/ICustomSupernetManager.sol";
import "../../interfaces/root/IExitHelper.sol";
import "../../interfaces/root/IRootERC20Predicate.sol";

contract CustomSupernetManager is ICustomSupernetManager, Ownable2StepUpgradeable, SupernetManager {
Expand Down Expand Up @@ -36,6 +35,10 @@ contract CustomSupernetManager is ICustomSupernetManager, Ownable2StepUpgradeabl
_;
}

constructor() {
_disableInitializers();
}

function initialize(
address newStakeManager,
address newBls,
Expand Down
4 changes: 4 additions & 0 deletions contracts/root/staking/StakeManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ contract StakeManager is IStakeManager, Initializable, StakeManagerChildData, St

IERC20 private _stakingToken;

constructor() {
_disableInitializers();
}

function initialize(address newStakingToken) public initializer {
_stakingToken = IERC20(newStakingToken);
}
Expand Down
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fs_permissions = [
{ access = "read", path = "script/deployment/sharedRootContractsConfig.json" },
{ access = "read", path = "script/deployment/rootContractSetConfig.json" },
{ access = "read", path = "script/deployment/rootTokenContractsConfig.json" },
{ access = "read", path = "out/GenesisProxy.sol/GenesisProxy.json" }
{ access = "read", path = "out/" }
]

# do not use for computationally expensive tests
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"coverage": "npx hardhat coverage",
"coverage:foundry": "forge coverage --report lcov && genhtml -o forge-coverage lcov.info",
"prepare": "husky install",
"husky:pre-commit": "npm run prettier && git add ."
"husky:pre-commit": ""
},
"dependencies": {
"@openzeppelin/contracts": "^4.9.3",
Expand Down
Loading
Loading