From 78704d36d88a0f73b3a88f8fd748431ccce76b3d Mon Sep 17 00:00:00 2001 From: Andrej Date: Tue, 19 Nov 2024 16:15:38 +0100 Subject: [PATCH 1/7] CCIP-4288 Refactor MockCCIPRouter to support EVMExtraArgsV2 (#15301) * feat: refactor MockCCIPRouter to support EVMExtraArgsV2 * chore: commit changeset * CCIP-4288 add changeset --- contracts/.changeset/wet-eyes-accept.md | 7 ++++++ contracts/gas-snapshots/ccip.gas-snapshot | 11 ++++++---- .../src/v0.8/ccip/test/mocks/MockRouter.sol | 17 ++++++++++---- .../ccip/test/mocks/test/MockRouterTest.t.sol | 22 ++++++++++++++++++- 4 files changed, 48 insertions(+), 9 deletions(-) create mode 100644 contracts/.changeset/wet-eyes-accept.md diff --git a/contracts/.changeset/wet-eyes-accept.md b/contracts/.changeset/wet-eyes-accept.md new file mode 100644 index 0000000000..ea78336622 --- /dev/null +++ b/contracts/.changeset/wet-eyes-accept.md @@ -0,0 +1,7 @@ +--- +'@chainlink/contracts': patch +--- + +Refactor MockCCIPRouter to support EVMExtraArgsV2 + +PR issue : CCIP-4288 diff --git a/contracts/gas-snapshots/ccip.gas-snapshot b/contracts/gas-snapshots/ccip.gas-snapshot index 1d3bb7b294..b3d324b0e5 100644 --- a/contracts/gas-snapshots/ccip.gas-snapshot +++ b/contracts/gas-snapshots/ccip.gas-snapshot @@ -482,11 +482,14 @@ MerkleMultiProofTest:test_EmptyLeaf_Revert() (gas: 3585) MerkleMultiProofTest:test_MerkleRoot256() (gas: 394891) MerkleMultiProofTest:test_MerkleRootSingleLeaf_Success() (gas: 3661) MerkleMultiProofTest:test_SpecSync_gas() (gas: 34129) +MockRouterTest:test_ccipSendWithEVMExtraArgsV1_Success() (gas: 110073) +MockRouterTest:test_ccipSendWithEVMExtraArgsV2_Success() (gas: 132614) MockRouterTest:test_ccipSendWithInsufficientNativeTokens_Revert() (gas: 34037) -MockRouterTest:test_ccipSendWithInvalidMsgValue_Revert() (gas: 60842) -MockRouterTest:test_ccipSendWithLinkFeeTokenAndValidMsgValue_Success() (gas: 126576) -MockRouterTest:test_ccipSendWithLinkFeeTokenbutInsufficientAllowance_Revert() (gas: 63455) -MockRouterTest:test_ccipSendWithSufficientNativeFeeTokens_Success() (gas: 44012) +MockRouterTest:test_ccipSendWithInvalidEVMExtraArgs_Revert() (gas: 106684) +MockRouterTest:test_ccipSendWithInvalidMsgValue_Revert() (gas: 60886) +MockRouterTest:test_ccipSendWithLinkFeeTokenAndValidMsgValue_Success() (gas: 126640) +MockRouterTest:test_ccipSendWithLinkFeeTokenButInsufficientAllowance_Revert() (gas: 63478) +MockRouterTest:test_ccipSendWithSufficientNativeFeeTokens_Success() (gas: 44048) MultiAggregateRateLimiter_applyRateLimiterConfigUpdates:test_MultipleConfigsBothLanes_Success() (gas: 133528) MultiAggregateRateLimiter_applyRateLimiterConfigUpdates:test_MultipleConfigs_Success() (gas: 315630) MultiAggregateRateLimiter_applyRateLimiterConfigUpdates:test_OnlyCallableByOwner_Revert() (gas: 17864) diff --git a/contracts/src/v0.8/ccip/test/mocks/MockRouter.sol b/contracts/src/v0.8/ccip/test/mocks/MockRouter.sol index 88a1740886..5e4c39dc19 100644 --- a/contracts/src/v0.8/ccip/test/mocks/MockRouter.sol +++ b/contracts/src/v0.8/ccip/test/mocks/MockRouter.sol @@ -119,12 +119,21 @@ contract MockCCIPRouter is IRouter, IRouterClient { return mockMsgId; } - function _fromBytes(bytes calldata extraArgs) internal pure returns (Client.EVMExtraArgsV1 memory) { + function _fromBytes( + bytes calldata extraArgs + ) internal pure returns (Client.EVMExtraArgsV2 memory) { if (extraArgs.length == 0) { - return Client.EVMExtraArgsV1({gasLimit: DEFAULT_GAS_LIMIT}); + return Client.EVMExtraArgsV2({gasLimit: DEFAULT_GAS_LIMIT, allowOutOfOrderExecution: false}); } - if (bytes4(extraArgs) != Client.EVM_EXTRA_ARGS_V1_TAG) revert InvalidExtraArgsTag(); - return abi.decode(extraArgs[4:], (Client.EVMExtraArgsV1)); + + bytes4 extraArgsTag = bytes4(extraArgs); + if (extraArgsTag == Client.EVM_EXTRA_ARGS_V2_TAG) { + return abi.decode(extraArgs[4:], (Client.EVMExtraArgsV2)); + } else if (extraArgsTag == Client.EVM_EXTRA_ARGS_V1_TAG) { + return Client.EVMExtraArgsV2({gasLimit: abi.decode(extraArgs[4:], (uint256)), allowOutOfOrderExecution: false}); + } + + revert InvalidExtraArgsTag(); } /// @notice Always returns true to make sure this check can be performed on any chain. diff --git a/contracts/src/v0.8/ccip/test/mocks/test/MockRouterTest.t.sol b/contracts/src/v0.8/ccip/test/mocks/test/MockRouterTest.t.sol index 6cbe7bf58f..9acfd9b1ce 100644 --- a/contracts/src/v0.8/ccip/test/mocks/test/MockRouterTest.t.sol +++ b/contracts/src/v0.8/ccip/test/mocks/test/MockRouterTest.t.sol @@ -49,7 +49,7 @@ contract MockRouterTest is TokenSetup { mockRouter.ccipSend{value: 0.1 ether}(mockChainSelector, message); } - function test_ccipSendWithLinkFeeTokenbutInsufficientAllowance_Revert() public { + function test_ccipSendWithLinkFeeTokenButInsufficientAllowance_Revert() public { message.feeToken = s_sourceFeeToken; vm.expectRevert(bytes("ERC20: insufficient allowance")); @@ -65,4 +65,24 @@ contract MockRouterTest is TokenSetup { mockRouter.ccipSend(mockChainSelector, message); } + + function test_ccipSendWithEVMExtraArgsV1_Success() public { + Client.EVMExtraArgsV1 memory extraArgs = Client.EVMExtraArgsV1({gasLimit: 500_000}); + message.extraArgs = Client._argsToBytes(extraArgs); + mockRouter.ccipSend{value: 0.1 ether}(mockChainSelector, message); + } + + function test_ccipSendWithEVMExtraArgsV2_Success() public { + Client.EVMExtraArgsV2 memory extraArgs = Client.EVMExtraArgsV2({gasLimit: 500_000, allowOutOfOrderExecution: true}); + message.extraArgs = Client._argsToBytes(extraArgs); + mockRouter.ccipSend{value: 0.1 ether}(mockChainSelector, message); + } + + function test_ccipSendWithInvalidEVMExtraArgs_Revert() public { + uint256 gasLimit = 500_000; + bytes4 invalidExtraArgsTag = bytes4(keccak256("CCIP EVMExtraArgsInvalid")); + message.extraArgs = abi.encodeWithSelector(invalidExtraArgsTag, gasLimit); + vm.expectRevert(MockCCIPRouter.InvalidExtraArgsTag.selector); + mockRouter.ccipSend{value: 0.1 ether}(mockChainSelector, message); + } } From 4b0c72e70bc63f2dec42650a6ce71a5e3eef747d Mon Sep 17 00:00:00 2001 From: Rens Rooimans Date: Tue, 5 Nov 2024 15:25:52 +0100 Subject: [PATCH 2/7] CCIP-4105: adds OZ AccessControl support to the registry module (#15067) * adds OZ AccessControl support to the registry module * [Bot] Update changeset file with jira issues * fix snap * update version --------- Co-Authored-By: app-token-issuer-infra-releng[bot] <120227048+app-token-issuer-infra-releng[bot]@users.noreply.github.com> --- contracts/.changeset/metal-ducks-hunt.md | 10 ++++ contracts/gas-snapshots/ccip.gas-snapshot | 12 +++-- .../RegistryModuleOwnerCustom.t.sol | 52 +++++++++++++++++++ .../RegistryModuleOwnerCustom.sol | 19 ++++++- .../registry_module_owner_custom.go | 18 ++++++- 5 files changed, 103 insertions(+), 8 deletions(-) create mode 100644 contracts/.changeset/metal-ducks-hunt.md diff --git a/contracts/.changeset/metal-ducks-hunt.md b/contracts/.changeset/metal-ducks-hunt.md new file mode 100644 index 0000000000..caba481925 --- /dev/null +++ b/contracts/.changeset/metal-ducks-hunt.md @@ -0,0 +1,10 @@ +--- +'@chainlink/contracts': patch +--- + +#feature adds OZ AccessControl support to the registry module + + +PR issue: CCIP-4105 + +Solidity Review issue: CCIP-3966 \ No newline at end of file diff --git a/contracts/gas-snapshots/ccip.gas-snapshot b/contracts/gas-snapshots/ccip.gas-snapshot index b3d324b0e5..47daada4da 100644 --- a/contracts/gas-snapshots/ccip.gas-snapshot +++ b/contracts/gas-snapshots/ccip.gas-snapshot @@ -920,11 +920,13 @@ RateLimiter_consume:test_TokenRateLimitReached_Revert() (gas: 24886) RateLimiter_currentTokenBucketState:test_CurrentTokenBucketState_Success() (gas: 38944) RateLimiter_currentTokenBucketState:test_Refill_Success() (gas: 46849) RateLimiter_setTokenBucketConfig:test_SetRateLimiterConfig_Success() (gas: 38506) -RegistryModuleOwnerCustom_constructor:test_constructor_Revert() (gas: 36033) -RegistryModuleOwnerCustom_registerAdminViaGetCCIPAdmin:test_registerAdminViaGetCCIPAdmin_Revert() (gas: 19739) -RegistryModuleOwnerCustom_registerAdminViaGetCCIPAdmin:test_registerAdminViaGetCCIPAdmin_Success() (gas: 130086) -RegistryModuleOwnerCustom_registerAdminViaOwner:test_registerAdminViaOwner_Revert() (gas: 19559) -RegistryModuleOwnerCustom_registerAdminViaOwner:test_registerAdminViaOwner_Success() (gas: 129905) +RegistryModuleOwnerCustom_constructor:test_constructor_Revert() (gas: 36107) +RegistryModuleOwnerCustom_registerAccessControlDefaultAdmin:test_registerAccessControlDefaultAdmin_Revert() (gas: 20206) +RegistryModuleOwnerCustom_registerAccessControlDefaultAdmin:test_registerAccessControlDefaultAdmin_Success() (gas: 130628) +RegistryModuleOwnerCustom_registerAdminViaGetCCIPAdmin:test_registerAdminViaGetCCIPAdmin_Revert() (gas: 19773) +RegistryModuleOwnerCustom_registerAdminViaGetCCIPAdmin:test_registerAdminViaGetCCIPAdmin_Success() (gas: 130108) +RegistryModuleOwnerCustom_registerAdminViaOwner:test_registerAdminViaOwner_Revert() (gas: 19593) +RegistryModuleOwnerCustom_registerAdminViaOwner:test_registerAdminViaOwner_Success() (gas: 129927) Router_applyRampUpdates:test_OffRampMismatch_Revert() (gas: 89366) Router_applyRampUpdates:test_OffRampUpdatesWithRouting() (gas: 10662612) Router_applyRampUpdates:test_OnRampDisable() (gas: 56007) diff --git a/contracts/src/v0.8/ccip/test/tokenAdminRegistry/RegistryModuleOwnerCustom.t.sol b/contracts/src/v0.8/ccip/test/tokenAdminRegistry/RegistryModuleOwnerCustom.t.sol index dfb599bd30..cf40fb62d2 100644 --- a/contracts/src/v0.8/ccip/test/tokenAdminRegistry/RegistryModuleOwnerCustom.t.sol +++ b/contracts/src/v0.8/ccip/test/tokenAdminRegistry/RegistryModuleOwnerCustom.t.sol @@ -8,6 +8,7 @@ import {RegistryModuleOwnerCustom} from "../../tokenAdminRegistry/RegistryModule import {TokenAdminRegistry} from "../../tokenAdminRegistry/TokenAdminRegistry.sol"; import {BurnMintERC677Helper} from "../helpers/BurnMintERC677Helper.sol"; +import {AccessControl} from "../../../vendor/openzeppelin-solidity/v5.0.2/contracts/access/AccessControl.sol"; import {Test} from "forge-std/Test.sol"; contract RegistryModuleOwnerCustomSetup is Test { @@ -102,3 +103,54 @@ contract RegistryModuleOwnerCustom_registerAdminViaOwner is RegistryModuleOwnerC s_registryModuleOwnerCustom.registerAdminViaOwner(s_token); } } + +contract AccessController is AccessControl { + constructor( + address admin + ) { + _grantRole(DEFAULT_ADMIN_ROLE, admin); + } +} + +contract RegistryModuleOwnerCustom_registerAccessControlDefaultAdmin is RegistryModuleOwnerCustomSetup { + function setUp() public override { + super.setUp(); + + s_token = address(new AccessController(OWNER)); + } + + function test_registerAccessControlDefaultAdmin_Success() public { + assertEq(s_tokenAdminRegistry.getTokenConfig(s_token).administrator, address(0)); + + bytes32 defaultAdminRole = AccessController(s_token).DEFAULT_ADMIN_ROLE(); + + vm.expectCall(address(s_token), abi.encodeWithSelector(AccessControl.hasRole.selector, defaultAdminRole, OWNER), 1); + vm.expectCall( + address(s_tokenAdminRegistry), + abi.encodeWithSelector(TokenAdminRegistry.proposeAdministrator.selector, s_token, OWNER), + 1 + ); + + vm.expectEmit(); + emit RegistryModuleOwnerCustom.AdministratorRegistered(s_token, OWNER); + + s_registryModuleOwnerCustom.registerAccessControlDefaultAdmin(s_token); + + assertEq(s_tokenAdminRegistry.getTokenConfig(s_token).pendingAdministrator, OWNER); + } + + function test_registerAccessControlDefaultAdmin_Revert() public { + bytes32 defaultAdminRole = AccessController(s_token).DEFAULT_ADMIN_ROLE(); + + address wrongSender = makeAddr("Not_expected_owner"); + vm.startPrank(wrongSender); + + vm.expectRevert( + abi.encodeWithSelector( + RegistryModuleOwnerCustom.RequiredRoleNotFound.selector, wrongSender, defaultAdminRole, s_token + ) + ); + + s_registryModuleOwnerCustom.registerAccessControlDefaultAdmin(s_token); + } +} diff --git a/contracts/src/v0.8/ccip/tokenAdminRegistry/RegistryModuleOwnerCustom.sol b/contracts/src/v0.8/ccip/tokenAdminRegistry/RegistryModuleOwnerCustom.sol index a794d68c9e..549963ff4a 100644 --- a/contracts/src/v0.8/ccip/tokenAdminRegistry/RegistryModuleOwnerCustom.sol +++ b/contracts/src/v0.8/ccip/tokenAdminRegistry/RegistryModuleOwnerCustom.sol @@ -6,13 +6,16 @@ import {IGetCCIPAdmin} from "../interfaces/IGetCCIPAdmin.sol"; import {IOwner} from "../interfaces/IOwner.sol"; import {ITokenAdminRegistry} from "../interfaces/ITokenAdminRegistry.sol"; +import {AccessControl} from "../../vendor/openzeppelin-solidity/v5.0.2/contracts/access/AccessControl.sol"; + contract RegistryModuleOwnerCustom is ITypeAndVersion { error CanOnlySelfRegister(address admin, address token); + error RequiredRoleNotFound(address msgSender, bytes32 role, address token); error AddressZero(); event AdministratorRegistered(address indexed token, address indexed administrator); - string public constant override typeAndVersion = "RegistryModuleOwnerCustom 1.5.0"; + string public constant override typeAndVersion = "RegistryModuleOwnerCustom 1.6.0"; // The TokenAdminRegistry contract ITokenAdminRegistry internal immutable i_tokenAdminRegistry; @@ -38,6 +41,20 @@ contract RegistryModuleOwnerCustom is ITypeAndVersion { _registerAdmin(token, IOwner(token).owner()); } + /// @notice Registers the admin of the token using OZ's AccessControl DEFAULT_ADMIN_ROLE. + /// @param token The token to register the admin for. + /// @dev The caller must have the DEFAULT_ADMIN_ROLE as defined by the contract itself. + function registerAccessControlDefaultAdmin( + address token + ) external { + bytes32 defaultAdminRole = AccessControl(token).DEFAULT_ADMIN_ROLE(); + if (!AccessControl(token).hasRole(defaultAdminRole, msg.sender)) { + revert RequiredRoleNotFound(msg.sender, defaultAdminRole, token); + } + + _registerAdmin(token, msg.sender); + } + /// @notice Registers the admin of the token to msg.sender given that the /// admin is equal to msg.sender. /// @param token The token to register the admin for. diff --git a/core/gethwrappers/ccip/generated/registry_module_owner_custom/registry_module_owner_custom.go b/core/gethwrappers/ccip/generated/registry_module_owner_custom/registry_module_owner_custom.go index 121135075d..315d75121b 100644 --- a/core/gethwrappers/ccip/generated/registry_module_owner_custom/registry_module_owner_custom.go +++ b/core/gethwrappers/ccip/generated/registry_module_owner_custom/registry_module_owner_custom.go @@ -31,8 +31,8 @@ var ( ) var RegistryModuleOwnerCustomMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenAdminRegistry\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AddressZero\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"CanOnlySelfRegister\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"administrator\",\"type\":\"address\"}],\"name\":\"AdministratorRegistered\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"registerAdminViaGetCCIPAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"registerAdminViaOwner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"typeAndVersion\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", - Bin: "0x60a060405234801561001057600080fd5b5060405161047e38038061047e83398101604081905261002f91610067565b6001600160a01b03811661005657604051639fabe1c160e01b815260040160405180910390fd5b6001600160a01b0316608052610097565b60006020828403121561007957600080fd5b81516001600160a01b038116811461009057600080fd5b9392505050565b6080516103cc6100b2600039600061024a01526103cc6000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063181f5a771461004657806396ea2f7a14610098578063ff12c354146100ad575b600080fd5b6100826040518060400160405280601f81526020017f52656769737472794d6f64756c654f776e6572437573746f6d20312e352e300081525081565b60405161008f91906102ef565b60405180910390f35b6100ab6100a636600461037e565b6100c0565b005b6100ab6100bb36600461037e565b61013b565b610138818273ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561010f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061013391906103a2565b61018a565b50565b610138818273ffffffffffffffffffffffffffffffffffffffff16638fd6a6ac6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561010f573d6000803e3d6000fd5b73ffffffffffffffffffffffffffffffffffffffff811633146101fd576040517fc454d18200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff80831660048301528316602482015260440160405180910390fd5b6040517fe677ae3700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff838116600483015282811660248301527f0000000000000000000000000000000000000000000000000000000000000000169063e677ae3790604401600060405180830381600087803b15801561028e57600080fd5b505af11580156102a2573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff8085169350851691507f09590fb70af4b833346363965e043a9339e8c7d378b8a2b903c75c277faec4f990600090a35050565b60006020808352835180602085015260005b8181101561031d57858101830151858201604001528201610301565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b73ffffffffffffffffffffffffffffffffffffffff8116811461013857600080fd5b60006020828403121561039057600080fd5b813561039b8161035c565b9392505050565b6000602082840312156103b457600080fd5b815161039b8161035c56fea164736f6c6343000818000a", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenAdminRegistry\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AddressZero\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"CanOnlySelfRegister\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"msgSender\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"RequiredRoleNotFound\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"administrator\",\"type\":\"address\"}],\"name\":\"AdministratorRegistered\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"registerAccessControlDefaultAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"registerAdminViaGetCCIPAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"registerAdminViaOwner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"typeAndVersion\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + Bin: "0x60a060405234801561001057600080fd5b5060405161064a38038061064a83398101604081905261002f91610067565b6001600160a01b03811661005657604051639fabe1c160e01b815260040160405180910390fd5b6001600160a01b0316608052610097565b60006020828403121561007957600080fd5b81516001600160a01b038116811461009057600080fd5b9392505050565b6080516105986100b260003960006103db01526105986000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c8063181f5a771461005157806369c0081e146100a357806396ea2f7a146100b8578063ff12c354146100cb575b600080fd5b61008d6040518060400160405280601f81526020017f52656769737472794d6f64756c654f776e6572437573746f6d20312e362e300081525081565b60405161009a9190610480565b60405180910390f35b6100b66100b136600461050f565b6100de565b005b6100b66100c636600461050f565b610255565b6100b66100d936600461050f565b6102d0565b60008173ffffffffffffffffffffffffffffffffffffffff1663a217fddf6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561012b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061014f9190610533565b6040517f91d148540000000000000000000000000000000000000000000000000000000081526004810182905233602482015290915073ffffffffffffffffffffffffffffffffffffffff8316906391d1485490604401602060405180830381865afa1580156101c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101e7919061054c565b610247576040517f86e0b3440000000000000000000000000000000000000000000000000000000081523360048201526024810182905273ffffffffffffffffffffffffffffffffffffffff831660448201526064015b60405180910390fd5b610251823361031f565b5050565b6102cd818273ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c8919061056e565b61031f565b50565b6102cd818273ffffffffffffffffffffffffffffffffffffffff16638fd6a6ac6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102a4573d6000803e3d6000fd5b73ffffffffffffffffffffffffffffffffffffffff8116331461038e576040517fc454d18200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff80831660048301528316602482015260440161023e565b6040517fe677ae3700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff838116600483015282811660248301527f0000000000000000000000000000000000000000000000000000000000000000169063e677ae3790604401600060405180830381600087803b15801561041f57600080fd5b505af1158015610433573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff8085169350851691507f09590fb70af4b833346363965e043a9339e8c7d378b8a2b903c75c277faec4f990600090a35050565b60006020808352835180602085015260005b818110156104ae57858101830151858201604001528201610492565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b73ffffffffffffffffffffffffffffffffffffffff811681146102cd57600080fd5b60006020828403121561052157600080fd5b813561052c816104ed565b9392505050565b60006020828403121561054557600080fd5b5051919050565b60006020828403121561055e57600080fd5b8151801515811461052c57600080fd5b60006020828403121561058057600080fd5b815161052c816104ed56fea164736f6c6343000818000a", } var RegistryModuleOwnerCustomABI = RegistryModuleOwnerCustomMetaData.ABI @@ -193,6 +193,18 @@ func (_RegistryModuleOwnerCustom *RegistryModuleOwnerCustomCallerSession) TypeAn return _RegistryModuleOwnerCustom.Contract.TypeAndVersion(&_RegistryModuleOwnerCustom.CallOpts) } +func (_RegistryModuleOwnerCustom *RegistryModuleOwnerCustomTransactor) RegisterAccessControlDefaultAdmin(opts *bind.TransactOpts, token common.Address) (*types.Transaction, error) { + return _RegistryModuleOwnerCustom.contract.Transact(opts, "registerAccessControlDefaultAdmin", token) +} + +func (_RegistryModuleOwnerCustom *RegistryModuleOwnerCustomSession) RegisterAccessControlDefaultAdmin(token common.Address) (*types.Transaction, error) { + return _RegistryModuleOwnerCustom.Contract.RegisterAccessControlDefaultAdmin(&_RegistryModuleOwnerCustom.TransactOpts, token) +} + +func (_RegistryModuleOwnerCustom *RegistryModuleOwnerCustomTransactorSession) RegisterAccessControlDefaultAdmin(token common.Address) (*types.Transaction, error) { + return _RegistryModuleOwnerCustom.Contract.RegisterAccessControlDefaultAdmin(&_RegistryModuleOwnerCustom.TransactOpts, token) +} + func (_RegistryModuleOwnerCustom *RegistryModuleOwnerCustomTransactor) RegisterAdminViaGetCCIPAdmin(opts *bind.TransactOpts, token common.Address) (*types.Transaction, error) { return _RegistryModuleOwnerCustom.contract.Transact(opts, "registerAdminViaGetCCIPAdmin", token) } @@ -374,6 +386,8 @@ func (_RegistryModuleOwnerCustom *RegistryModuleOwnerCustom) Address() common.Ad type RegistryModuleOwnerCustomInterface interface { TypeAndVersion(opts *bind.CallOpts) (string, error) + RegisterAccessControlDefaultAdmin(opts *bind.TransactOpts, token common.Address) (*types.Transaction, error) + RegisterAdminViaGetCCIPAdmin(opts *bind.TransactOpts, token common.Address) (*types.Transaction, error) RegisterAdminViaOwner(opts *bind.TransactOpts, token common.Address) (*types.Transaction, error) From a0dfd3a84a946f8812d33a89ac3ee0bde15b4cc0 Mon Sep 17 00:00:00 2001 From: Rens Rooimans Date: Wed, 30 Oct 2024 00:00:48 +0100 Subject: [PATCH 3/7] add ownable2step (#14989) --- contracts/foundry.toml | 2 +- contracts/gas-snapshots/shared.gas-snapshot | 58 +++++++------ .../v0.8/shared/access/AuthorizedCallers.sol | 2 +- .../src/v0.8/shared/access/Ownable2Step.sol | 84 ++++++++++++++++++ .../shared/access/Ownable2StepMsgSender.sol | 9 ++ contracts/src/v0.8/shared/test/BaseTest.t.sol | 2 +- .../test/access/AuthorizedCallers.t.sol | 2 +- .../shared/test/access/Ownable2Step.t.sol | 87 +++++++++++++++++++ .../shared/test/call/CallWithExactGas.t.sol | 2 +- .../test/call/CallWithExactGasHelper.sol | 2 +- .../enumerable/EnumerableMapAddresses.t.sol | 2 +- .../test/token/ERC677/BurnMintERC677.t.sol | 2 +- 12 files changed, 221 insertions(+), 33 deletions(-) create mode 100644 contracts/src/v0.8/shared/access/Ownable2Step.sol create mode 100644 contracts/src/v0.8/shared/access/Ownable2StepMsgSender.sol create mode 100644 contracts/src/v0.8/shared/test/access/Ownable2Step.t.sol diff --git a/contracts/foundry.toml b/contracts/foundry.toml index 781e875eb6..e1399964dd 100644 --- a/contracts/foundry.toml +++ b/contracts/foundry.toml @@ -95,7 +95,7 @@ test = 'src/v0.8/transmission/test' optimizer_runs = 1_000_000 src = 'src/v0.8/shared' test = 'src/v0.8/shared/test' -solc_version = '0.8.19' +solc_version = '0.8.24' # See more config options https://github.com/foundry-rs/foundry/tree/master/config diff --git a/contracts/gas-snapshots/shared.gas-snapshot b/contracts/gas-snapshots/shared.gas-snapshot index dda850089c..e2163b9981 100644 --- a/contracts/gas-snapshots/shared.gas-snapshot +++ b/contracts/gas-snapshots/shared.gas-snapshot @@ -1,15 +1,15 @@ -AuthorizedCallers_applyAuthorizedCallerUpdates:test_AddAndRemove_Success() (gas: 125205) -AuthorizedCallers_applyAuthorizedCallerUpdates:test_OnlyAdd_Success() (gas: 133100) -AuthorizedCallers_applyAuthorizedCallerUpdates:test_OnlyCallableByOwner_Revert() (gas: 12350) -AuthorizedCallers_applyAuthorizedCallerUpdates:test_OnlyRemove_Success() (gas: 45064) -AuthorizedCallers_applyAuthorizedCallerUpdates:test_RemoveThenAdd_Success() (gas: 57241) -AuthorizedCallers_applyAuthorizedCallerUpdates:test_SkipRemove_Success() (gas: 32121) -AuthorizedCallers_applyAuthorizedCallerUpdates:test_ZeroAddressNotAllowed_Revert() (gas: 64473) -AuthorizedCallers_constructor:test_ZeroAddressNotAllowed_Revert() (gas: 64473) -AuthorizedCallers_constructor:test_constructor_Success() (gas: 720513) +AuthorizedCallers_applyAuthorizedCallerUpdates:test_AddAndRemove_Success() (gas: 125022) +AuthorizedCallers_applyAuthorizedCallerUpdates:test_OnlyAdd_Success() (gas: 132980) +AuthorizedCallers_applyAuthorizedCallerUpdates:test_OnlyCallableByOwner_Revert() (gas: 12356) +AuthorizedCallers_applyAuthorizedCallerUpdates:test_OnlyRemove_Success() (gas: 45007) +AuthorizedCallers_applyAuthorizedCallerUpdates:test_RemoveThenAdd_Success() (gas: 57121) +AuthorizedCallers_applyAuthorizedCallerUpdates:test_SkipRemove_Success() (gas: 32064) +AuthorizedCallers_applyAuthorizedCallerUpdates:test_ZeroAddressNotAllowed_Revert() (gas: 64440) +AuthorizedCallers_constructor:test_ZeroAddressNotAllowed_Revert() (gas: 64440) +AuthorizedCallers_constructor:test_constructor_Success() (gas: 704809) BurnMintERC677_approve:testApproveSuccess() (gas: 55512) BurnMintERC677_approve:testInvalidAddressReverts() (gas: 10663) -BurnMintERC677_burn:testBasicBurnSuccess() (gas: 173939) +BurnMintERC677_burn:testBasicBurnSuccess() (gas: 172100) BurnMintERC677_burn:testBurnFromZeroAddressReverts() (gas: 47201) BurnMintERC677_burn:testExceedsBalanceReverts() (gas: 21841) BurnMintERC677_burn:testSenderNotBurnerReverts() (gas: 13359) @@ -21,7 +21,7 @@ BurnMintERC677_burnFromAlias:testBurnFromSuccess() (gas: 57949) BurnMintERC677_burnFromAlias:testExceedsBalanceReverts() (gas: 35880) BurnMintERC677_burnFromAlias:testInsufficientAllowanceReverts() (gas: 21869) BurnMintERC677_burnFromAlias:testSenderNotBurnerReverts() (gas: 13379) -BurnMintERC677_constructor:testConstructorSuccess() (gas: 1672809) +BurnMintERC677_constructor:testConstructorSuccess() (gas: 1672812) BurnMintERC677_decreaseApproval:testDecreaseApprovalSuccess() (gas: 31069) BurnMintERC677_grantMintAndBurnRoles:testGrantMintAndBurnRolesSuccess() (gas: 121324) BurnMintERC677_grantRole:testGrantBurnAccessSuccess() (gas: 53460) @@ -34,14 +34,14 @@ BurnMintERC677_mint:testSenderNotMinterReverts() (gas: 11195) BurnMintERC677_supportsInterface:testConstructorSuccess() (gas: 12476) BurnMintERC677_transfer:testInvalidAddressReverts() (gas: 10639) BurnMintERC677_transfer:testTransferSuccess() (gas: 42299) -CallWithExactGas__callWithExactGas:test_CallWithExactGasReceiverErrorSuccess() (gas: 67209) +CallWithExactGas__callWithExactGas:test_CallWithExactGasReceiverErrorSuccess() (gas: 65949) CallWithExactGas__callWithExactGas:test_CallWithExactGasSafeReturnDataExactGas() (gas: 18324) CallWithExactGas__callWithExactGas:test_NoContractReverts() (gas: 11559) CallWithExactGas__callWithExactGas:test_NoGasForCallExactCheckReverts() (gas: 15788) CallWithExactGas__callWithExactGas:test_NotEnoughGasForCallReverts() (gas: 16241) CallWithExactGas__callWithExactGas:test_callWithExactGasSuccess(bytes,bytes4) (runs: 256, μ: 15766, ~: 15719) CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract:test_CallWithExactGasEvenIfTargetIsNoContractExactGasSuccess() (gas: 20116) -CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract:test_CallWithExactGasEvenIfTargetIsNoContractReceiverErrorSuccess() (gas: 67721) +CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract:test_CallWithExactGasEvenIfTargetIsNoContractReceiverErrorSuccess() (gas: 66461) CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract:test_CallWithExactGasEvenIfTargetIsNoContractSuccess(bytes,bytes4) (runs: 256, μ: 16276, ~: 16229) CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract:test_NoContractSuccess() (gas: 12962) CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract:test_NoGasForCallExactCheckReturnFalseSuccess() (gas: 13005) @@ -75,20 +75,28 @@ EnumerableMapAddresses_tryGet:testBytes32TryGetSuccess() (gas: 94622) EnumerableMapAddresses_tryGet:testBytesTryGetSuccess() (gas: 96279) EnumerableMapAddresses_tryGet:testTryGetSuccess() (gas: 94893) OpStackBurnMintERC677_constructor:testConstructorSuccess() (gas: 1743649) -OpStackBurnMintERC677_interfaceCompatibility:testBurnCompatibility() (gas: 298649) +OpStackBurnMintERC677_interfaceCompatibility:testBurnCompatibility() (gas: 291393) OpStackBurnMintERC677_interfaceCompatibility:testMintCompatibility() (gas: 137957) OpStackBurnMintERC677_interfaceCompatibility:testStaticFunctionsCompatibility() (gas: 13781) OpStackBurnMintERC677_supportsInterface:testConstructorSuccess() (gas: 12752) -SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_EmptySubset_Reverts() (gas: 5460) -SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_EmptySuperset_Reverts() (gas: 4661) -SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_HasDuplicates_Reverts() (gas: 8265) -SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_NotASubset_Reverts() (gas: 12487) -SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_SingleElementSubset() (gas: 4489) +Ownable2Step_acceptOwnership:test_acceptOwnership_MustBeProposedOwner_reverts() (gas: 10360) +Ownable2Step_acceptOwnership:test_acceptOwnership_success() (gas: 31088) +Ownable2Step_constructor:test_constructor_OwnerCannotBeZero_reverts() (gas: 35858) +Ownable2Step_constructor:test_constructor_success() (gas: 10428) +Ownable2Step_onlyOwner:test_onlyOwner_OnlyCallableByOwner_reverts() (gas: 10754) +Ownable2Step_onlyOwner:test_onlyOwner_success() (gas: 7506) +Ownable2Step_transferOwnership:test_transferOwnership_CannotTransferToSelf_reverts() (gas: 10501) +Ownable2Step_transferOwnership:test_transferOwnership_success() (gas: 30140) +SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_EmptySubset_Reverts() (gas: 5208) +SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_EmptySuperset_Reverts() (gas: 4535) +SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_HasDuplicates_Reverts() (gas: 7761) +SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_NotASubset_Reverts() (gas: 11668) +SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_SingleElementSubset() (gas: 3922) SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_SingleElementSubsetAndSuperset_Equal() (gas: 1464) SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_SingleElementSubsetAndSuperset_NotEqual_Reverts() (gas: 6172) -SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_SubsetEqualsSuperset_NoRevert() (gas: 8867) -SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_SubsetLargerThanSuperset_Reverts() (gas: 16544) -SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_SupersetHasDuplicates_Reverts() (gas: 9420) -SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_UnsortedSubset_Reverts() (gas: 7380) -SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_UnsortedSuperset_Reverts() (gas: 9600) -SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_ValidSubset_Success() (gas: 6490) \ No newline at end of file +SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_SubsetEqualsSuperset_NoRevert() (gas: 7859) +SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_SubsetLargerThanSuperset_Reverts() (gas: 15410) +SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_SupersetHasDuplicates_Reverts() (gas: 8790) +SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_UnsortedSubset_Reverts() (gas: 7128) +SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_UnsortedSuperset_Reverts() (gas: 8970) +SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_ValidSubset_Success() (gas: 5671) \ No newline at end of file diff --git a/contracts/src/v0.8/shared/access/AuthorizedCallers.sol b/contracts/src/v0.8/shared/access/AuthorizedCallers.sol index 93102d1a97..8c54d7bac8 100644 --- a/contracts/src/v0.8/shared/access/AuthorizedCallers.sol +++ b/contracts/src/v0.8/shared/access/AuthorizedCallers.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BUSL-1.1 -pragma solidity ^0.8.0; +pragma solidity ^0.8.4; import {OwnerIsCreator} from "./OwnerIsCreator.sol"; import {EnumerableSet} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/utils/structs/EnumerableSet.sol"; diff --git a/contracts/src/v0.8/shared/access/Ownable2Step.sol b/contracts/src/v0.8/shared/access/Ownable2Step.sol new file mode 100644 index 0000000000..5eac576072 --- /dev/null +++ b/contracts/src/v0.8/shared/access/Ownable2Step.sol @@ -0,0 +1,84 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import {IOwnable} from "../interfaces/IOwnable.sol"; + +/// @notice A minimal contract that implements 2-step ownership transfer and nothing more. It's made to be minimal +/// to reduce the impact of the bytecode size on any contract that inherits from it. +contract Ownable2Step is IOwnable { + /// @notice The pending owner is the address to which ownership may be transferred. + address private s_pendingOwner; + /// @notice The owner is the current owner of the contract. + /// @dev The owner is the second storage variable so any implementing contract could pack other state with it + /// instead of the much less used s_pendingOwner. + address private s_owner; + + error OwnerCannotBeZero(); + error MustBeProposedOwner(); + error CannotTransferToSelf(); + error OnlyCallableByOwner(); + + event OwnershipTransferRequested(address indexed from, address indexed to); + event OwnershipTransferred(address indexed from, address indexed to); + + constructor(address newOwner, address pendingOwner) { + if (newOwner == address(0)) { + revert OwnerCannotBeZero(); + } + + s_owner = newOwner; + if (pendingOwner != address(0)) { + _transferOwnership(pendingOwner); + } + } + + /// @notice Get the current owner + function owner() public view override returns (address) { + return s_owner; + } + + /// @notice Allows an owner to begin transferring ownership to a new address. The new owner needs to call + /// `acceptOwnership` to accept the transfer before any permissions are changed. + /// @param to The address to which ownership will be transferred. + function transferOwnership(address to) public override onlyOwner { + _transferOwnership(to); + } + + /// @notice validate, transfer ownership, and emit relevant events + /// @param to The address to which ownership will be transferred. + function _transferOwnership(address to) private { + if (to == msg.sender) { + revert CannotTransferToSelf(); + } + + s_pendingOwner = to; + + emit OwnershipTransferRequested(s_owner, to); + } + + /// @notice Allows an ownership transfer to be completed by the recipient. + function acceptOwnership() external override { + if (msg.sender != s_pendingOwner) { + revert MustBeProposedOwner(); + } + + address oldOwner = s_owner; + s_owner = msg.sender; + s_pendingOwner = address(0); + + emit OwnershipTransferred(oldOwner, msg.sender); + } + + /// @notice validate access + function _validateOwnership() internal view { + if (msg.sender != s_owner) { + revert OnlyCallableByOwner(); + } + } + + /// @notice Reverts if called by anyone other than the contract owner. + modifier onlyOwner() { + _validateOwnership(); + _; + } +} diff --git a/contracts/src/v0.8/shared/access/Ownable2StepMsgSender.sol b/contracts/src/v0.8/shared/access/Ownable2StepMsgSender.sol new file mode 100644 index 0000000000..b3de785a70 --- /dev/null +++ b/contracts/src/v0.8/shared/access/Ownable2StepMsgSender.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import {Ownable2Step} from "./Ownable2Step.sol"; + +/// @notice Sets the msg.sender to be the owner of the contract and does not set a pending owner. +contract Ownable2StepMsgSender is Ownable2Step { + constructor() Ownable2Step(msg.sender, address(0)) {} +} diff --git a/contracts/src/v0.8/shared/test/BaseTest.t.sol b/contracts/src/v0.8/shared/test/BaseTest.t.sol index 4d8ef60eb2..b2e9afcd35 100644 --- a/contracts/src/v0.8/shared/test/BaseTest.t.sol +++ b/contracts/src/v0.8/shared/test/BaseTest.t.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.19; +pragma solidity 0.8.24; import "forge-std/Test.sol"; diff --git a/contracts/src/v0.8/shared/test/access/AuthorizedCallers.t.sol b/contracts/src/v0.8/shared/test/access/AuthorizedCallers.t.sol index 34ae6848a4..54f74fbf16 100644 --- a/contracts/src/v0.8/shared/test/access/AuthorizedCallers.t.sol +++ b/contracts/src/v0.8/shared/test/access/AuthorizedCallers.t.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.19; +pragma solidity 0.8.24; import {AuthorizedCallers} from "../../access/AuthorizedCallers.sol"; import {BaseTest} from "../BaseTest.t.sol"; diff --git a/contracts/src/v0.8/shared/test/access/Ownable2Step.t.sol b/contracts/src/v0.8/shared/test/access/Ownable2Step.t.sol new file mode 100644 index 0000000000..0421d647c5 --- /dev/null +++ b/contracts/src/v0.8/shared/test/access/Ownable2Step.t.sol @@ -0,0 +1,87 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.24; + +import {BaseTest} from "../BaseTest.t.sol"; +import {Ownable2Step} from "../../access/Ownable2Step.sol"; + +contract Ownable2Step_setup is BaseTest { + Ownable2StepHelper internal s_ownable2Step; + + function setUp() public override { + super.setUp(); + s_ownable2Step = new Ownable2StepHelper(OWNER, address(0)); + } +} + +contract Ownable2Step_constructor is Ownable2Step_setup { + function test_constructor_success() public view { + assertEq(OWNER, s_ownable2Step.owner()); + } + + function test_constructor_OwnerCannotBeZero_reverts() public { + vm.expectRevert(Ownable2Step.OwnerCannotBeZero.selector); + new Ownable2Step(address(0), address(0)); + } +} + +contract Ownable2Step_transferOwnership is Ownable2Step_setup { + function test_transferOwnership_success() public { + vm.expectEmit(); + emit Ownable2Step.OwnershipTransferRequested(OWNER, STRANGER); + + s_ownable2Step.transferOwnership(STRANGER); + + assertTrue(STRANGER != s_ownable2Step.owner()); + + vm.startPrank(STRANGER); + s_ownable2Step.acceptOwnership(); + } + + function test_transferOwnership_CannotTransferToSelf_reverts() public { + vm.expectRevert(Ownable2Step.CannotTransferToSelf.selector); + s_ownable2Step.transferOwnership(OWNER); + } +} + +contract Ownable2Step_acceptOwnership is Ownable2Step_setup { + function test_acceptOwnership_success() public { + s_ownable2Step.transferOwnership(STRANGER); + + assertTrue(STRANGER != s_ownable2Step.owner()); + + vm.startPrank(STRANGER); + + vm.expectEmit(); + emit Ownable2Step.OwnershipTransferred(OWNER, STRANGER); + + s_ownable2Step.acceptOwnership(); + + assertEq(STRANGER, s_ownable2Step.owner()); + } + + function test_acceptOwnership_MustBeProposedOwner_reverts() public { + vm.expectRevert(Ownable2Step.MustBeProposedOwner.selector); + s_ownable2Step.acceptOwnership(); + } +} + +contract Ownable2StepHelper is Ownable2Step { + constructor(address newOwner, address pendingOwner) Ownable2Step(newOwner, pendingOwner) {} + + function validateOwnership() external view { + _validateOwnership(); + } +} + +contract Ownable2Step_onlyOwner is Ownable2Step_setup { + function test_onlyOwner_success() public view { + s_ownable2Step.validateOwnership(); + } + + function test_onlyOwner_OnlyCallableByOwner_reverts() public { + vm.stopPrank(); + + vm.expectRevert(Ownable2Step.OnlyCallableByOwner.selector); + s_ownable2Step.validateOwnership(); + } +} diff --git a/contracts/src/v0.8/shared/test/call/CallWithExactGas.t.sol b/contracts/src/v0.8/shared/test/call/CallWithExactGas.t.sol index 3623cb8b12..b432de58a5 100644 --- a/contracts/src/v0.8/shared/test/call/CallWithExactGas.t.sol +++ b/contracts/src/v0.8/shared/test/call/CallWithExactGas.t.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.19; +pragma solidity 0.8.24; import {CallWithExactGas} from "../../call/CallWithExactGas.sol"; import {CallWithExactGasHelper} from "./CallWithExactGasHelper.sol"; diff --git a/contracts/src/v0.8/shared/test/call/CallWithExactGasHelper.sol b/contracts/src/v0.8/shared/test/call/CallWithExactGasHelper.sol index 932315639b..0ba8602e08 100644 --- a/contracts/src/v0.8/shared/test/call/CallWithExactGasHelper.sol +++ b/contracts/src/v0.8/shared/test/call/CallWithExactGasHelper.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.19; +pragma solidity ^0.8.4; import {CallWithExactGas} from "../../call/CallWithExactGas.sol"; diff --git a/contracts/src/v0.8/shared/test/enumerable/EnumerableMapAddresses.t.sol b/contracts/src/v0.8/shared/test/enumerable/EnumerableMapAddresses.t.sol index 097e79e372..689657105e 100644 --- a/contracts/src/v0.8/shared/test/enumerable/EnumerableMapAddresses.t.sol +++ b/contracts/src/v0.8/shared/test/enumerable/EnumerableMapAddresses.t.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.19; +pragma solidity 0.8.24; import {BaseTest} from "../BaseTest.t.sol"; import {EnumerableMapAddresses} from "../../enumerable/EnumerableMapAddresses.sol"; diff --git a/contracts/src/v0.8/shared/test/token/ERC677/BurnMintERC677.t.sol b/contracts/src/v0.8/shared/test/token/ERC677/BurnMintERC677.t.sol index 2815f99256..a778a1ada2 100644 --- a/contracts/src/v0.8/shared/test/token/ERC677/BurnMintERC677.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC677/BurnMintERC677.t.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.19; +pragma solidity 0.8.24; import {IBurnMintERC20} from "../../../token/ERC20/IBurnMintERC20.sol"; import {IERC677} from "../../../token/ERC677/IERC677.sol"; From e37f3790e82e8a71357353fb1cd0a258c03fbb3f Mon Sep 17 00:00:00 2001 From: Rens Rooimans Date: Fri, 22 Nov 2024 18:32:34 +0100 Subject: [PATCH 4/7] bump Foundry and forge-std (#15360) forge-std v1.9.4 ran `make snapshot-all` --- contracts/GNUmakefile | 2 +- contracts/gas-snapshots/l2ep.gas-snapshot | 284 +++++------ contracts/gas-snapshots/shared.gas-snapshot | 213 ++++---- contracts/gas-snapshots/workflow.gas-snapshot | 53 ++ .../src/v0.8/ccip/test/mocks/MockRouter.sol | 4 +- .../RegistryModuleOwnerCustom.t.sol | 4 +- .../RegistryModuleOwnerCustom.sol | 4 +- .../src/v0.8/vendor/forge-std/src/Vm.sol | 471 +++++++++++++++--- 8 files changed, 709 insertions(+), 326 deletions(-) create mode 100644 contracts/gas-snapshots/workflow.gas-snapshot diff --git a/contracts/GNUmakefile b/contracts/GNUmakefile index 862d75a432..5f50fb8ad0 100644 --- a/contracts/GNUmakefile +++ b/contracts/GNUmakefile @@ -43,7 +43,7 @@ mockery: $(mockery) ## Install mockery. .PHONY: foundry foundry: ## Install foundry. - foundryup --version nightly-515a4cc8aba1627a717a1057ff4f09c8cd3bf51f + foundryup --version nightly-fb5f0e1c4d9b9b0861be3e3bd07963524c5ac08e .PHONY: foundry-refresh foundry-refresh: foundry diff --git a/contracts/gas-snapshots/l2ep.gas-snapshot b/contracts/gas-snapshots/l2ep.gas-snapshot index e793f8ce54..643127b621 100644 --- a/contracts/gas-snapshots/l2ep.gas-snapshot +++ b/contracts/gas-snapshots/l2ep.gas-snapshot @@ -1,142 +1,142 @@ -ArbitrumCrossDomainForwarder_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 37568) -ArbitrumCrossDomainForwarder_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 12963) -ArbitrumCrossDomainForwarder_Constructor:test_InitialState() (gas: 22163) -ArbitrumCrossDomainForwarder_Forward:test_Forward() (gas: 47867) -ArbitrumCrossDomainForwarder_Forward:test_ForwardRevert() (gas: 22181) -ArbitrumCrossDomainForwarder_Forward:test_NotCallableByUnknownAddress() (gas: 16056) -ArbitrumCrossDomainForwarder_TransferL1Ownership:test_CallableByL1Owner() (gas: 41453) -ArbitrumCrossDomainForwarder_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 19290) -ArbitrumCrossDomainForwarder_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 18637) -ArbitrumCrossDomainForwarder_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 13242) -ArbitrumCrossDomainGovernor_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 37568) -ArbitrumCrossDomainGovernor_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 12963) -ArbitrumCrossDomainGovernor_Constructor:test_InitialState() (gas: 22186) -ArbitrumCrossDomainGovernor_Forward:test_CallableByL2Owner() (gas: 50003) -ArbitrumCrossDomainGovernor_Forward:test_Forward() (gas: 47896) -ArbitrumCrossDomainGovernor_Forward:test_ForwardRevert() (gas: 24326) -ArbitrumCrossDomainGovernor_Forward:test_NotCallableByUnknownAddress() (gas: 18233) -ArbitrumCrossDomainGovernor_ForwardDelegate:test_BubbleUpRevert() (gas: 19386) -ArbitrumCrossDomainGovernor_ForwardDelegate:test_CallableByCrossDomainMessengerAddressOrL1Owner() (gas: 60874) -ArbitrumCrossDomainGovernor_ForwardDelegate:test_CallableByL2Owner() (gas: 63003) -ArbitrumCrossDomainGovernor_ForwardDelegate:test_NotCallableByUnknownAddress() (gas: 18245) -ArbitrumCrossDomainGovernor_ForwardDelegate:test_RevertsBatchWhenOneCallFails() (gas: 64368) -ArbitrumCrossDomainGovernor_TransferL1Ownership:test_CallableByL1Owner() (gas: 41453) -ArbitrumCrossDomainGovernor_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 19290) -ArbitrumCrossDomainGovernor_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 18637) -ArbitrumCrossDomainGovernor_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 13242) -ArbitrumSequencerUptimeFeed_AggregatorV3Interface:test_AggregatorV3Interface() (gas: 104862) -ArbitrumSequencerUptimeFeed_AggregatorV3Interface:test_Return0WhenRoundDoesNotExistYet() (gas: 19967) -ArbitrumSequencerUptimeFeed_Constants:test_InitialState() (gas: 8518) -ArbitrumSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceAllowReadsIfConsumingContractIsWhitelisted() (gas: 604370) -ArbitrumSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceDisallowReadsIfConsumingContractIsNotWhitelisted() (gas: 574432) -ArbitrumSequencerUptimeFeed_UpdateStatus:test_IgnoreOutOfOrderUpdates() (gas: 99629) -ArbitrumSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddr() (gas: 15447) -ArbitrumSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndNoTimeChange() (gas: 114625) -ArbitrumSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndTimeChange() (gas: 114708) -ArbitrumValidator_Validate:test_PostSequencerOffline() (gas: 69086) -OptimismCrossDomainForwarder_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 47160) -OptimismCrossDomainForwarder_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 22160) -OptimismCrossDomainForwarder_Constructor:test_InitialState() (gas: 21998) -OptimismCrossDomainForwarder_Forward:test_Forward() (gas: 58281) -OptimismCrossDomainForwarder_Forward:test_ForwardRevert() (gas: 32560) -OptimismCrossDomainForwarder_Forward:test_NotCallableByUnknownAddress() (gas: 13867) -OptimismCrossDomainForwarder_TransferL1Ownership:test_CallableByL1Owner() (gas: 48933) -OptimismCrossDomainForwarder_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 28753) -OptimismCrossDomainForwarder_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 16448) -OptimismCrossDomainForwarder_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 11053) -OptimismCrossDomainGovernor_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 47160) -OptimismCrossDomainGovernor_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 22160) -OptimismCrossDomainGovernor_Constructor:test_InitialState() (gas: 22021) -OptimismCrossDomainGovernor_Forward:test_CallableByL2Owner() (gas: 47846) -OptimismCrossDomainGovernor_Forward:test_Forward() (gas: 58330) -OptimismCrossDomainGovernor_Forward:test_ForwardRevert() (gas: 32619) -OptimismCrossDomainGovernor_Forward:test_NotCallableByUnknownAddress() (gas: 16047) -OptimismCrossDomainGovernor_ForwardDelegate:test_BubbleUpRevert() (gas: 29189) -OptimismCrossDomainGovernor_ForwardDelegate:test_CallableByCrossDomainMessengerAddressOrL1Owner() (gas: 72942) -OptimismCrossDomainGovernor_ForwardDelegate:test_CallableByL2Owner() (gas: 72947) -OptimismCrossDomainGovernor_ForwardDelegate:test_NotCallableByUnknownAddress() (gas: 16059) -OptimismCrossDomainGovernor_ForwardDelegate:test_RevertsBatchWhenOneCallFails() (gas: 76156) -OptimismCrossDomainGovernor_TransferL1Ownership:test_CallableByL1Owner() (gas: 48933) -OptimismCrossDomainGovernor_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 28753) -OptimismCrossDomainGovernor_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 16448) -OptimismCrossDomainGovernor_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 11053) -OptimismSequencerUptimeFeed_AggregatorV3Interface:test_AggregatorV3Interface() (gas: 72400) -OptimismSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetAnswerWhenRoundDoesNotExistYet() (gas: 17653) -OptimismSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetRoundDataWhenRoundDoesNotExistYet() (gas: 17893) -OptimismSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetTimestampWhenRoundDoesNotExistYet() (gas: 17642) -OptimismSequencerUptimeFeed_Constructor:test_InitialState() (gas: 22050) -OptimismSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceAllowReadsIfConsumingContractIsWhitelisted() (gas: 601594) -OptimismSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceDisallowReadsIfConsumingContractIsNotWhitelisted() (gas: 574437) -OptimismSequencerUptimeFeed_UpdateStatus:test_IgnoreOutOfOrderUpdates() (gas: 67873) -OptimismSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddr() (gas: 13079) -OptimismSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddrAndNotL1SenderAddr() (gas: 23542) -OptimismSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenNoChange() (gas: 77322) -OptimismSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndNoTimeChange() (gas: 96182) -OptimismSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndTimeChange() (gas: 96265) -OptimismValidator_SetGasLimit:test_CorrectlyUpdatesTheGasLimit() (gas: 18671) -OptimismValidator_Validate:test_PostSequencerOffline() (gas: 74790) -OptimismValidator_Validate:test_PostSequencerStatusWhenThereIsNotStatusChange() (gas: 74869) -OptimismValidator_Validate:test_RevertsIfCalledByAnAccountWithNoAccess() (gas: 15571) -ScrollCrossDomainForwarder_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 47255) -ScrollCrossDomainForwarder_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 22212) -ScrollCrossDomainForwarder_Constructor:test_InitialState() (gas: 21674) -ScrollCrossDomainForwarder_Forward:test_Forward() (gas: 58348) -ScrollCrossDomainForwarder_Forward:test_ForwardRevert() (gas: 32618) -ScrollCrossDomainForwarder_Forward:test_NotCallableByUnknownAddress() (gas: 13867) -ScrollCrossDomainForwarder_TransferL1Ownership:test_CallableByL1Owner() (gas: 48999) -ScrollCrossDomainForwarder_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 28819) -ScrollCrossDomainForwarder_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 16448) -ScrollCrossDomainForwarder_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 11053) -ScrollCrossDomainGovernor_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 47255) -ScrollCrossDomainGovernor_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 22212) -ScrollCrossDomainGovernor_Constructor:test_InitialState() (gas: 21697) -ScrollCrossDomainGovernor_Forward:test_CallableByL2Owner() (gas: 47841) -ScrollCrossDomainGovernor_Forward:test_Forward() (gas: 58392) -ScrollCrossDomainGovernor_Forward:test_ForwardRevert() (gas: 32674) -ScrollCrossDomainGovernor_Forward:test_NotCallableByUnknownAddress() (gas: 16044) -ScrollCrossDomainGovernor_ForwardDelegate:test_BubbleUpRevert() (gas: 29250) -ScrollCrossDomainGovernor_ForwardDelegate:test_CallableByCrossDomainMessengerAddressOrL1Owner() (gas: 73009) -ScrollCrossDomainGovernor_ForwardDelegate:test_CallableByL2Owner() (gas: 73014) -ScrollCrossDomainGovernor_ForwardDelegate:test_NotCallableByUnknownAddress() (gas: 16056) -ScrollCrossDomainGovernor_ForwardDelegate:test_RevertsBatchWhenOneCallFails() (gas: 76224) -ScrollCrossDomainGovernor_TransferL1Ownership:test_CallableByL1Owner() (gas: 48999) -ScrollCrossDomainGovernor_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 28819) -ScrollCrossDomainGovernor_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 16448) -ScrollCrossDomainGovernor_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 11053) -ScrollSequencerUptimeFeed_AggregatorV3Interface:test_AggregatorV3Interface() (gas: 72423) -ScrollSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetAnswerWhenRoundDoesNotExistYet() (gas: 17653) -ScrollSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetRoundDataWhenRoundDoesNotExistYet() (gas: 17893) -ScrollSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetTimestampWhenRoundDoesNotExistYet() (gas: 17642) -ScrollSequencerUptimeFeed_Constructor:test_InitialState() (gas: 173935) -ScrollSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceAllowReadsIfConsumingContractIsWhitelisted() (gas: 601594) -ScrollSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceDisallowReadsIfConsumingContractIsNotWhitelisted() (gas: 574437) -ScrollSequencerUptimeFeed_UpdateStatus:test_IgnoreOutOfOrderUpdates() (gas: 67919) -ScrollSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddr() (gas: 13079) -ScrollSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddrAndNotL1SenderAddr() (gas: 23542) -ScrollSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenNoChange() (gas: 77368) -ScrollSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndNoTimeChange() (gas: 96228) -ScrollSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndTimeChange() (gas: 96311) -ScrollValidator_SetGasLimit:test_CorrectlyUpdatesTheGasLimit() (gas: 18805) -ScrollValidator_Validate:test_PostSequencerOffline() (gas: 78326) -ScrollValidator_Validate:test_PostSequencerStatusWhenThereIsNotStatusChange() (gas: 78411) -ScrollValidator_Validate:test_RevertsIfCalledByAnAccountWithNoAccess() (gas: 15571) -ZKSyncSequencerUptimeFeed_AggregatorV3Interface:test_AggregatorV3Interface() (gas: 67166) -ZKSyncSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetAnswerWhenRoundDoesNotExistYet() (gas: 17653) -ZKSyncSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetRoundDataWhenRoundDoesNotExistYet() (gas: 17893) -ZKSyncSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetTimestampWhenRoundDoesNotExistYet() (gas: 17642) -ZKSyncSequencerUptimeFeed_Constructor:test_InitialState() (gas: 22054) -ZKSyncSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceAllowReadsIfConsumingContractIsWhitelisted() (gas: 601614) -ZKSyncSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceDisallowReadsIfConsumingContractIsNotWhitelisted() (gas: 574443) -ZKSyncSequencerUptimeFeed_UpdateStatus:test_IgnoreOutOfOrderUpdates() (gas: 61924) -ZKSyncSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddr() (gas: 13035) -ZKSyncSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenNoChange() (gas: 71379) -ZKSyncSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndNoTimeChange() (gas: 90241) -ZKSyncSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndTimeChange() (gas: 90324) -ZKSyncValidator_Constructor:test_ConstructingRevertedWithInvalidChainId() (gas: 103725) -ZKSyncValidator_Constructor:test_ConstructingRevertedWithZeroL1BridgeAddress() (gas: 81440) -ZKSyncValidator_Constructor:test_ConstructingRevertedWithZeroL2UpdateFeedAddress() (gas: 81497) -ZKSyncValidator_GetChainId:test_CorrectlyGetsTheChainId() (gas: 8350) -ZKSyncValidator_GetSetL2GasPerPubdataByteLimit:test_CorrectlyGetsAndUpdatesTheGasPerPubdataByteLimit() (gas: 18915) -ZKSyncValidator_Validate:test_PostSequencerOffline() (gas: 52255) -ZKSyncValidator_Validate:test_PostSequencerStatusWhenThereIsNotStatusChange() (gas: 52355) -ZKSyncValidator_Validate:test_RevertsIfCalledByAnAccountWithNoAccess() (gas: 15644) \ No newline at end of file +ArbitrumCrossDomainForwarder_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 37567) +ArbitrumCrossDomainForwarder_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 12954) +ArbitrumCrossDomainForwarder_Constructor:test_InitialState() (gas: 22111) +ArbitrumCrossDomainForwarder_Forward:test_Forward() (gas: 47818) +ArbitrumCrossDomainForwarder_Forward:test_ForwardRevert() (gas: 22147) +ArbitrumCrossDomainForwarder_Forward:test_NotCallableByUnknownAddress() (gas: 16083) +ArbitrumCrossDomainForwarder_TransferL1Ownership:test_CallableByL1Owner() (gas: 41439) +ArbitrumCrossDomainForwarder_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 19274) +ArbitrumCrossDomainForwarder_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 18644) +ArbitrumCrossDomainForwarder_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 13232) +ArbitrumCrossDomainGovernor_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 37567) +ArbitrumCrossDomainGovernor_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 12954) +ArbitrumCrossDomainGovernor_Constructor:test_InitialState() (gas: 22134) +ArbitrumCrossDomainGovernor_Forward:test_CallableByL2Owner() (gas: 49953) +ArbitrumCrossDomainGovernor_Forward:test_Forward() (gas: 47869) +ArbitrumCrossDomainGovernor_Forward:test_ForwardRevert() (gas: 24268) +ArbitrumCrossDomainGovernor_Forward:test_NotCallableByUnknownAddress() (gas: 18216) +ArbitrumCrossDomainGovernor_ForwardDelegate:test_BubbleUpRevert() (gas: 19338) +ArbitrumCrossDomainGovernor_ForwardDelegate:test_CallableByCrossDomainMessengerAddressOrL1Owner() (gas: 60787) +ArbitrumCrossDomainGovernor_ForwardDelegate:test_CallableByL2Owner() (gas: 62915) +ArbitrumCrossDomainGovernor_ForwardDelegate:test_NotCallableByUnknownAddress() (gas: 18271) +ArbitrumCrossDomainGovernor_ForwardDelegate:test_RevertsBatchWhenOneCallFails() (gas: 64276) +ArbitrumCrossDomainGovernor_TransferL1Ownership:test_CallableByL1Owner() (gas: 41439) +ArbitrumCrossDomainGovernor_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 19274) +ArbitrumCrossDomainGovernor_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 18644) +ArbitrumCrossDomainGovernor_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 13232) +ArbitrumSequencerUptimeFeed_AggregatorV3Interface:test_AggregatorV3Interface() (gas: 104766) +ArbitrumSequencerUptimeFeed_AggregatorV3Interface:test_Return0WhenRoundDoesNotExistYet() (gas: 19945) +ArbitrumSequencerUptimeFeed_Constants:test_InitialState() (gas: 8492) +ArbitrumSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceAllowReadsIfConsumingContractIsWhitelisted() (gas: 592246) +ArbitrumSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceDisallowReadsIfConsumingContractIsNotWhitelisted() (gas: 562331) +ArbitrumSequencerUptimeFeed_UpdateStatus:test_IgnoreOutOfOrderUpdates() (gas: 99593) +ArbitrumSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddr() (gas: 15442) +ArbitrumSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndNoTimeChange() (gas: 114527) +ArbitrumSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndTimeChange() (gas: 114610) +ArbitrumValidator_Validate:test_PostSequencerOffline() (gas: 69009) +OptimismCrossDomainForwarder_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 47110) +OptimismCrossDomainForwarder_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 22135) +OptimismCrossDomainForwarder_Constructor:test_InitialState() (gas: 21947) +OptimismCrossDomainForwarder_Forward:test_Forward() (gas: 58213) +OptimismCrossDomainForwarder_Forward:test_ForwardRevert() (gas: 32533) +OptimismCrossDomainForwarder_Forward:test_NotCallableByUnknownAddress() (gas: 13895) +OptimismCrossDomainForwarder_TransferL1Ownership:test_CallableByL1Owner() (gas: 48912) +OptimismCrossDomainForwarder_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 28733) +OptimismCrossDomainForwarder_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 16456) +OptimismCrossDomainForwarder_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 11044) +OptimismCrossDomainGovernor_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 47110) +OptimismCrossDomainGovernor_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 22135) +OptimismCrossDomainGovernor_Constructor:test_InitialState() (gas: 21970) +OptimismCrossDomainGovernor_Forward:test_CallableByL2Owner() (gas: 47797) +OptimismCrossDomainGovernor_Forward:test_Forward() (gas: 58284) +OptimismCrossDomainGovernor_Forward:test_ForwardRevert() (gas: 32569) +OptimismCrossDomainGovernor_Forward:test_NotCallableByUnknownAddress() (gas: 16031) +OptimismCrossDomainGovernor_ForwardDelegate:test_BubbleUpRevert() (gas: 29128) +OptimismCrossDomainGovernor_ForwardDelegate:test_CallableByCrossDomainMessengerAddressOrL1Owner() (gas: 72836) +OptimismCrossDomainGovernor_ForwardDelegate:test_CallableByL2Owner() (gas: 72841) +OptimismCrossDomainGovernor_ForwardDelegate:test_NotCallableByUnknownAddress() (gas: 16086) +OptimismCrossDomainGovernor_ForwardDelegate:test_RevertsBatchWhenOneCallFails() (gas: 76045) +OptimismCrossDomainGovernor_TransferL1Ownership:test_CallableByL1Owner() (gas: 48912) +OptimismCrossDomainGovernor_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 28733) +OptimismCrossDomainGovernor_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 16456) +OptimismCrossDomainGovernor_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 11044) +OptimismSequencerUptimeFeed_AggregatorV3Interface:test_AggregatorV3Interface() (gas: 72286) +OptimismSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetAnswerWhenRoundDoesNotExistYet() (gas: 17639) +OptimismSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetRoundDataWhenRoundDoesNotExistYet() (gas: 17875) +OptimismSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetTimestampWhenRoundDoesNotExistYet() (gas: 17628) +OptimismSequencerUptimeFeed_Constructor:test_InitialState() (gas: 22002) +OptimismSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceAllowReadsIfConsumingContractIsWhitelisted() (gas: 589475) +OptimismSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceDisallowReadsIfConsumingContractIsNotWhitelisted() (gas: 562336) +OptimismSequencerUptimeFeed_UpdateStatus:test_IgnoreOutOfOrderUpdates() (gas: 67804) +OptimismSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddr() (gas: 13109) +OptimismSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddrAndNotL1SenderAddr() (gas: 23523) +OptimismSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenNoChange() (gas: 77205) +OptimismSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndNoTimeChange() (gas: 96089) +OptimismSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndTimeChange() (gas: 96172) +OptimismValidator_SetGasLimit:test_CorrectlyUpdatesTheGasLimit() (gas: 18636) +OptimismValidator_Validate:test_PostSequencerOffline() (gas: 74764) +OptimismValidator_Validate:test_PostSequencerStatusWhenThereIsNotStatusChange() (gas: 74798) +OptimismValidator_Validate:test_RevertsIfCalledByAnAccountWithNoAccess() (gas: 15556) +ScrollCrossDomainForwarder_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 47196) +ScrollCrossDomainForwarder_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 22185) +ScrollCrossDomainForwarder_Constructor:test_InitialState() (gas: 21623) +ScrollCrossDomainForwarder_Forward:test_Forward() (gas: 58277) +ScrollCrossDomainForwarder_Forward:test_ForwardRevert() (gas: 32589) +ScrollCrossDomainForwarder_Forward:test_NotCallableByUnknownAddress() (gas: 13895) +ScrollCrossDomainForwarder_TransferL1Ownership:test_CallableByL1Owner() (gas: 48975) +ScrollCrossDomainForwarder_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 28791) +ScrollCrossDomainForwarder_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 16456) +ScrollCrossDomainForwarder_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 11044) +ScrollCrossDomainGovernor_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 47196) +ScrollCrossDomainGovernor_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 22185) +ScrollCrossDomainGovernor_Constructor:test_InitialState() (gas: 21646) +ScrollCrossDomainGovernor_Forward:test_CallableByL2Owner() (gas: 47792) +ScrollCrossDomainGovernor_Forward:test_Forward() (gas: 58343) +ScrollCrossDomainGovernor_Forward:test_ForwardRevert() (gas: 32622) +ScrollCrossDomainGovernor_Forward:test_NotCallableByUnknownAddress() (gas: 16028) +ScrollCrossDomainGovernor_ForwardDelegate:test_BubbleUpRevert() (gas: 29186) +ScrollCrossDomainGovernor_ForwardDelegate:test_CallableByCrossDomainMessengerAddressOrL1Owner() (gas: 72900) +ScrollCrossDomainGovernor_ForwardDelegate:test_CallableByL2Owner() (gas: 72905) +ScrollCrossDomainGovernor_ForwardDelegate:test_NotCallableByUnknownAddress() (gas: 16083) +ScrollCrossDomainGovernor_ForwardDelegate:test_RevertsBatchWhenOneCallFails() (gas: 76110) +ScrollCrossDomainGovernor_TransferL1Ownership:test_CallableByL1Owner() (gas: 48975) +ScrollCrossDomainGovernor_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 28791) +ScrollCrossDomainGovernor_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 16456) +ScrollCrossDomainGovernor_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 11044) +ScrollSequencerUptimeFeed_AggregatorV3Interface:test_AggregatorV3Interface() (gas: 72309) +ScrollSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetAnswerWhenRoundDoesNotExistYet() (gas: 17639) +ScrollSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetRoundDataWhenRoundDoesNotExistYet() (gas: 17875) +ScrollSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetTimestampWhenRoundDoesNotExistYet() (gas: 17628) +ScrollSequencerUptimeFeed_Constructor:test_InitialState() (gas: 174353) +ScrollSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceAllowReadsIfConsumingContractIsWhitelisted() (gas: 589475) +ScrollSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceDisallowReadsIfConsumingContractIsNotWhitelisted() (gas: 562336) +ScrollSequencerUptimeFeed_UpdateStatus:test_IgnoreOutOfOrderUpdates() (gas: 67850) +ScrollSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddr() (gas: 13109) +ScrollSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddrAndNotL1SenderAddr() (gas: 23523) +ScrollSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenNoChange() (gas: 77251) +ScrollSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndNoTimeChange() (gas: 96135) +ScrollSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndTimeChange() (gas: 96218) +ScrollValidator_SetGasLimit:test_CorrectlyUpdatesTheGasLimit() (gas: 18770) +ScrollValidator_Validate:test_PostSequencerOffline() (gas: 78299) +ScrollValidator_Validate:test_PostSequencerStatusWhenThereIsNotStatusChange() (gas: 78339) +ScrollValidator_Validate:test_RevertsIfCalledByAnAccountWithNoAccess() (gas: 15556) +ZKSyncSequencerUptimeFeed_AggregatorV3Interface:test_AggregatorV3Interface() (gas: 67090) +ZKSyncSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetAnswerWhenRoundDoesNotExistYet() (gas: 17639) +ZKSyncSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetRoundDataWhenRoundDoesNotExistYet() (gas: 17875) +ZKSyncSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetTimestampWhenRoundDoesNotExistYet() (gas: 17628) +ZKSyncSequencerUptimeFeed_Constructor:test_InitialState() (gas: 22006) +ZKSyncSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceAllowReadsIfConsumingContractIsWhitelisted() (gas: 589495) +ZKSyncSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceDisallowReadsIfConsumingContractIsNotWhitelisted() (gas: 562342) +ZKSyncSequencerUptimeFeed_UpdateStatus:test_IgnoreOutOfOrderUpdates() (gas: 61883) +ZKSyncSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddr() (gas: 13055) +ZKSyncSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenNoChange() (gas: 71321) +ZKSyncSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndNoTimeChange() (gas: 90176) +ZKSyncSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndTimeChange() (gas: 90259) +ZKSyncValidator_Constructor:test_ConstructingRevertedWithInvalidChainId() (gas: 104069) +ZKSyncValidator_Constructor:test_ConstructingRevertedWithZeroL1BridgeAddress() (gas: 81784) +ZKSyncValidator_Constructor:test_ConstructingRevertedWithZeroL2UpdateFeedAddress() (gas: 81796) +ZKSyncValidator_GetChainId:test_CorrectlyGetsTheChainId() (gas: 8346) +ZKSyncValidator_GetSetL2GasPerPubdataByteLimit:test_CorrectlyGetsAndUpdatesTheGasPerPubdataByteLimit() (gas: 18896) +ZKSyncValidator_Validate:test_PostSequencerOffline() (gas: 52210) +ZKSyncValidator_Validate:test_PostSequencerStatusWhenThereIsNotStatusChange() (gas: 52279) +ZKSyncValidator_Validate:test_RevertsIfCalledByAnAccountWithNoAccess() (gas: 15623) \ No newline at end of file diff --git a/contracts/gas-snapshots/shared.gas-snapshot b/contracts/gas-snapshots/shared.gas-snapshot index e2163b9981..5447570173 100644 --- a/contracts/gas-snapshots/shared.gas-snapshot +++ b/contracts/gas-snapshots/shared.gas-snapshot @@ -1,102 +1,111 @@ -AuthorizedCallers_applyAuthorizedCallerUpdates:test_AddAndRemove_Success() (gas: 125022) -AuthorizedCallers_applyAuthorizedCallerUpdates:test_OnlyAdd_Success() (gas: 132980) -AuthorizedCallers_applyAuthorizedCallerUpdates:test_OnlyCallableByOwner_Revert() (gas: 12356) -AuthorizedCallers_applyAuthorizedCallerUpdates:test_OnlyRemove_Success() (gas: 45007) -AuthorizedCallers_applyAuthorizedCallerUpdates:test_RemoveThenAdd_Success() (gas: 57121) -AuthorizedCallers_applyAuthorizedCallerUpdates:test_SkipRemove_Success() (gas: 32064) -AuthorizedCallers_applyAuthorizedCallerUpdates:test_ZeroAddressNotAllowed_Revert() (gas: 64440) -AuthorizedCallers_constructor:test_ZeroAddressNotAllowed_Revert() (gas: 64440) -AuthorizedCallers_constructor:test_constructor_Success() (gas: 704809) -BurnMintERC677_approve:testApproveSuccess() (gas: 55512) -BurnMintERC677_approve:testInvalidAddressReverts() (gas: 10663) -BurnMintERC677_burn:testBasicBurnSuccess() (gas: 172100) -BurnMintERC677_burn:testBurnFromZeroAddressReverts() (gas: 47201) -BurnMintERC677_burn:testExceedsBalanceReverts() (gas: 21841) -BurnMintERC677_burn:testSenderNotBurnerReverts() (gas: 13359) -BurnMintERC677_burnFrom:testBurnFromSuccess() (gas: 57923) -BurnMintERC677_burnFrom:testExceedsBalanceReverts() (gas: 35864) -BurnMintERC677_burnFrom:testInsufficientAllowanceReverts() (gas: 21849) -BurnMintERC677_burnFrom:testSenderNotBurnerReverts() (gas: 13359) -BurnMintERC677_burnFromAlias:testBurnFromSuccess() (gas: 57949) -BurnMintERC677_burnFromAlias:testExceedsBalanceReverts() (gas: 35880) -BurnMintERC677_burnFromAlias:testInsufficientAllowanceReverts() (gas: 21869) -BurnMintERC677_burnFromAlias:testSenderNotBurnerReverts() (gas: 13379) -BurnMintERC677_constructor:testConstructorSuccess() (gas: 1672812) -BurnMintERC677_decreaseApproval:testDecreaseApprovalSuccess() (gas: 31069) -BurnMintERC677_grantMintAndBurnRoles:testGrantMintAndBurnRolesSuccess() (gas: 121324) -BurnMintERC677_grantRole:testGrantBurnAccessSuccess() (gas: 53460) -BurnMintERC677_grantRole:testGrantManySuccess() (gas: 937759) -BurnMintERC677_grantRole:testGrantMintAccessSuccess() (gas: 94340) -BurnMintERC677_increaseApproval:testIncreaseApprovalSuccess() (gas: 44076) -BurnMintERC677_mint:testBasicMintSuccess() (gas: 149699) -BurnMintERC677_mint:testMaxSupplyExceededReverts() (gas: 50385) -BurnMintERC677_mint:testSenderNotMinterReverts() (gas: 11195) -BurnMintERC677_supportsInterface:testConstructorSuccess() (gas: 12476) -BurnMintERC677_transfer:testInvalidAddressReverts() (gas: 10639) -BurnMintERC677_transfer:testTransferSuccess() (gas: 42299) -CallWithExactGas__callWithExactGas:test_CallWithExactGasReceiverErrorSuccess() (gas: 65949) -CallWithExactGas__callWithExactGas:test_CallWithExactGasSafeReturnDataExactGas() (gas: 18324) -CallWithExactGas__callWithExactGas:test_NoContractReverts() (gas: 11559) -CallWithExactGas__callWithExactGas:test_NoGasForCallExactCheckReverts() (gas: 15788) -CallWithExactGas__callWithExactGas:test_NotEnoughGasForCallReverts() (gas: 16241) -CallWithExactGas__callWithExactGas:test_callWithExactGasSuccess(bytes,bytes4) (runs: 256, μ: 15766, ~: 15719) -CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract:test_CallWithExactGasEvenIfTargetIsNoContractExactGasSuccess() (gas: 20116) -CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract:test_CallWithExactGasEvenIfTargetIsNoContractReceiverErrorSuccess() (gas: 66461) -CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract:test_CallWithExactGasEvenIfTargetIsNoContractSuccess(bytes,bytes4) (runs: 256, μ: 16276, ~: 16229) -CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract:test_NoContractSuccess() (gas: 12962) -CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract:test_NoGasForCallExactCheckReturnFalseSuccess() (gas: 13005) -CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract:test_NotEnoughGasForCallReturnsFalseSuccess() (gas: 13317) -CallWithExactGas__callWithExactGasSafeReturnData:test_CallWithExactGasSafeReturnDataExactGas() (gas: 20331) -CallWithExactGas__callWithExactGasSafeReturnData:test_NoContractReverts() (gas: 13917) -CallWithExactGas__callWithExactGasSafeReturnData:test_NoGasForCallExactCheckReverts() (gas: 16139) -CallWithExactGas__callWithExactGasSafeReturnData:test_NotEnoughGasForCallReverts() (gas: 16569) -CallWithExactGas__callWithExactGasSafeReturnData:test_callWithExactGasSafeReturnData_ThrowOOGError_Revert() (gas: 36708) -EnumerableMapAddresses_at:testAtSuccess() (gas: 95086) -EnumerableMapAddresses_at:testBytes32AtSuccess() (gas: 94877) -EnumerableMapAddresses_at:testBytesAtSuccess() (gas: 96564) -EnumerableMapAddresses_contains:testBytes32ContainsSuccess() (gas: 93518) -EnumerableMapAddresses_contains:testBytesContainsSuccess() (gas: 94012) -EnumerableMapAddresses_contains:testContainsSuccess() (gas: 93696) -EnumerableMapAddresses_get:testBytes32GetSuccess() (gas: 94278) -EnumerableMapAddresses_get:testBytesGetSuccess() (gas: 95879) -EnumerableMapAddresses_get:testGetSuccess() (gas: 94453) -EnumerableMapAddresses_get_errorMessage:testBytesGetErrorMessageSuccess() (gas: 95878) -EnumerableMapAddresses_get_errorMessage:testGetErrorMessageSuccess() (gas: 94489) -EnumerableMapAddresses_length:testBytes32LengthSuccess() (gas: 72445) -EnumerableMapAddresses_length:testBytesLengthSuccess() (gas: 73011) -EnumerableMapAddresses_length:testLengthSuccess() (gas: 72640) -EnumerableMapAddresses_remove:testBytes32RemoveSuccess() (gas: 73462) -EnumerableMapAddresses_remove:testBytesRemoveSuccess() (gas: 74249) -EnumerableMapAddresses_remove:testRemoveSuccess() (gas: 73686) -EnumerableMapAddresses_set:testBytes32SetSuccess() (gas: 94496) -EnumerableMapAddresses_set:testBytesSetSuccess() (gas: 95428) -EnumerableMapAddresses_set:testSetSuccess() (gas: 94685) -EnumerableMapAddresses_tryGet:testBytes32TryGetSuccess() (gas: 94622) -EnumerableMapAddresses_tryGet:testBytesTryGetSuccess() (gas: 96279) -EnumerableMapAddresses_tryGet:testTryGetSuccess() (gas: 94893) -OpStackBurnMintERC677_constructor:testConstructorSuccess() (gas: 1743649) -OpStackBurnMintERC677_interfaceCompatibility:testBurnCompatibility() (gas: 291393) -OpStackBurnMintERC677_interfaceCompatibility:testMintCompatibility() (gas: 137957) -OpStackBurnMintERC677_interfaceCompatibility:testStaticFunctionsCompatibility() (gas: 13781) -OpStackBurnMintERC677_supportsInterface:testConstructorSuccess() (gas: 12752) -Ownable2Step_acceptOwnership:test_acceptOwnership_MustBeProposedOwner_reverts() (gas: 10360) -Ownable2Step_acceptOwnership:test_acceptOwnership_success() (gas: 31088) -Ownable2Step_constructor:test_constructor_OwnerCannotBeZero_reverts() (gas: 35858) -Ownable2Step_constructor:test_constructor_success() (gas: 10428) -Ownable2Step_onlyOwner:test_onlyOwner_OnlyCallableByOwner_reverts() (gas: 10754) -Ownable2Step_onlyOwner:test_onlyOwner_success() (gas: 7506) -Ownable2Step_transferOwnership:test_transferOwnership_CannotTransferToSelf_reverts() (gas: 10501) -Ownable2Step_transferOwnership:test_transferOwnership_success() (gas: 30140) -SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_EmptySubset_Reverts() (gas: 5208) -SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_EmptySuperset_Reverts() (gas: 4535) -SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_HasDuplicates_Reverts() (gas: 7761) -SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_NotASubset_Reverts() (gas: 11668) -SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_SingleElementSubset() (gas: 3922) -SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_SingleElementSubsetAndSuperset_Equal() (gas: 1464) -SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_SingleElementSubsetAndSuperset_NotEqual_Reverts() (gas: 6172) -SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_SubsetEqualsSuperset_NoRevert() (gas: 7859) -SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_SubsetLargerThanSuperset_Reverts() (gas: 15410) -SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_SupersetHasDuplicates_Reverts() (gas: 8790) -SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_UnsortedSubset_Reverts() (gas: 7128) -SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_UnsortedSuperset_Reverts() (gas: 8970) -SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_ValidSubset_Success() (gas: 5671) \ No newline at end of file +AuthorizedCallers_applyAuthorizedCallerUpdates:test_AddAndRemove_Success() (gas: 124848) +AuthorizedCallers_applyAuthorizedCallerUpdates:test_OnlyAdd_Success() (gas: 132793) +AuthorizedCallers_applyAuthorizedCallerUpdates:test_OnlyCallableByOwner_Revert() (gas: 12218) +AuthorizedCallers_applyAuthorizedCallerUpdates:test_OnlyRemove_Success() (gas: 44833) +AuthorizedCallers_applyAuthorizedCallerUpdates:test_RemoveThenAdd_Success() (gas: 56901) +AuthorizedCallers_applyAuthorizedCallerUpdates:test_SkipRemove_Success() (gas: 31911) +AuthorizedCallers_applyAuthorizedCallerUpdates:test_ZeroAddressNotAllowed_Revert() (gas: 64612) +AuthorizedCallers_constructor:test_ZeroAddressNotAllowed_Revert() (gas: 64589) +AuthorizedCallers_constructor:test_constructor_Success() (gas: 663486) +BurnMintERC20_approve:test_approve() (gas: 57609) +BurnMintERC20_burn:test_BasicBurn() (gas: 153528) +BurnMintERC20_burnFrom:test_BurnFrom() (gas: 57965) +BurnMintERC20_burnFromAlias:test_burn() (gas: 58009) +BurnMintERC20_constructor:test_Constructor() (gas: 1680059) +BurnMintERC20_getCCIPAdmin:test_getCCIPAdmin() (gas: 10544) +BurnMintERC20_getCCIPAdmin:test_setCCIPAdmin() (gas: 21562) +BurnMintERC20_grantMintAndBurnRoles:test_GrantMintAndBurnRoles() (gas: 79089) +BurnMintERC20_mint:test_mint() (gas: 101815) +BurnMintERC20_supportsInterface:test_SupportsInterface() (gas: 11202) +BurnMintERC20_transfer:test_transfer() (gas: 42318) +BurnMintERC677_approve:testApproveSuccess() (gas: 55477) +BurnMintERC677_approve:testInvalidAddressReverts() (gas: 10653) +BurnMintERC677_burn:testBasicBurnSuccess() (gas: 172022) +BurnMintERC677_burn:testBurnFromZeroAddressReverts() (gas: 47166) +BurnMintERC677_burn:testExceedsBalanceReverts() (gas: 21816) +BurnMintERC677_burn:testSenderNotBurnerReverts() (gas: 13346) +BurnMintERC677_burnFrom:testBurnFromSuccess() (gas: 57928) +BurnMintERC677_burnFrom:testExceedsBalanceReverts() (gas: 35838) +BurnMintERC677_burnFrom:testInsufficientAllowanceReverts() (gas: 21824) +BurnMintERC677_burnFrom:testSenderNotBurnerReverts() (gas: 13346) +BurnMintERC677_burnFromAlias:testBurnFromSuccess() (gas: 57955) +BurnMintERC677_burnFromAlias:testExceedsBalanceReverts() (gas: 35854) +BurnMintERC677_burnFromAlias:testInsufficientAllowanceReverts() (gas: 21844) +BurnMintERC677_burnFromAlias:testSenderNotBurnerReverts() (gas: 13366) +BurnMintERC677_constructor:testConstructorSuccess() (gas: 1651040) +BurnMintERC677_decreaseApproval:testDecreaseApprovalSuccess() (gas: 31049) +BurnMintERC677_grantMintAndBurnRoles:testGrantMintAndBurnRolesSuccess() (gas: 121279) +BurnMintERC677_grantRole:testGrantBurnAccessSuccess() (gas: 53402) +BurnMintERC677_grantRole:testGrantManySuccess() (gas: 937593) +BurnMintERC677_grantRole:testGrantMintAccessSuccess() (gas: 94280) +BurnMintERC677_increaseApproval:testIncreaseApprovalSuccess() (gas: 44052) +BurnMintERC677_mint:testBasicMintSuccess() (gas: 149664) +BurnMintERC677_mint:testMaxSupplyExceededReverts() (gas: 50323) +BurnMintERC677_mint:testSenderNotMinterReverts() (gas: 11182) +BurnMintERC677_supportsInterface:testConstructorSuccess() (gas: 12455) +BurnMintERC677_transfer:testInvalidAddressReverts() (gas: 10629) +BurnMintERC677_transfer:testTransferSuccess() (gas: 42279) +CallWithExactGas__callWithExactGas:test_CallWithExactGasReceiverErrorSuccess() (gas: 65883) +CallWithExactGas__callWithExactGas:test_CallWithExactGasSafeReturnDataExactGas() (gas: 18293) +CallWithExactGas__callWithExactGas:test_NoContractReverts() (gas: 11544) +CallWithExactGas__callWithExactGas:test_NoGasForCallExactCheckReverts() (gas: 15760) +CallWithExactGas__callWithExactGas:test_NotEnoughGasForCallReverts() (gas: 16210) +CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract:test_CallWithExactGasEvenIfTargetIsNoContractExactGasSuccess() (gas: 20033) +CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract:test_CallWithExactGasEvenIfTargetIsNoContractReceiverErrorSuccess() (gas: 66394) +CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract:test_NoContractSuccess() (gas: 12942) +CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract:test_NoGasForCallExactCheckReturnFalseSuccess() (gas: 12984) +CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract:test_NotEnoughGasForCallReturnsFalseSuccess() (gas: 13293) +CallWithExactGas__callWithExactGasSafeReturnData:test_CallWithExactGasSafeReturnDataExactGas() (gas: 20287) +CallWithExactGas__callWithExactGasSafeReturnData:test_NoContractReverts() (gas: 13915) +CallWithExactGas__callWithExactGasSafeReturnData:test_NoGasForCallExactCheckReverts() (gas: 16108) +CallWithExactGas__callWithExactGasSafeReturnData:test_NotEnoughGasForCallReverts() (gas: 16513) +CallWithExactGas__callWithExactGasSafeReturnData:test_callWithExactGasSafeReturnData_ThrowOOGError_Revert() (gas: 36713) +EnumerableMapAddresses_at:testAtSuccess() (gas: 95055) +EnumerableMapAddresses_at:testBytes32AtSuccess() (gas: 94828) +EnumerableMapAddresses_at:testBytesAtSuccess() (gas: 96507) +EnumerableMapAddresses_contains:testBytes32ContainsSuccess() (gas: 93503) +EnumerableMapAddresses_contains:testBytesContainsSuccess() (gas: 93974) +EnumerableMapAddresses_contains:testContainsSuccess() (gas: 93678) +EnumerableMapAddresses_get:testBytes32GetSuccess() (gas: 94238) +EnumerableMapAddresses_get:testBytesGetSuccess() (gas: 95919) +EnumerableMapAddresses_get:testGetSuccess() (gas: 94409) +EnumerableMapAddresses_get_errorMessage:testBytesGetErrorMessageSuccess() (gas: 95852) +EnumerableMapAddresses_get_errorMessage:testGetErrorMessageSuccess() (gas: 94467) +EnumerableMapAddresses_length:testBytes32LengthSuccess() (gas: 72418) +EnumerableMapAddresses_length:testBytesLengthSuccess() (gas: 73035) +EnumerableMapAddresses_length:testLengthSuccess() (gas: 72592) +EnumerableMapAddresses_remove:testBytes32RemoveSuccess() (gas: 73432) +EnumerableMapAddresses_remove:testBytesRemoveSuccess() (gas: 74216) +EnumerableMapAddresses_remove:testRemoveSuccess() (gas: 73651) +EnumerableMapAddresses_set:testBytes32SetSuccess() (gas: 94475) +EnumerableMapAddresses_set:testBytesSetSuccess() (gas: 95405) +EnumerableMapAddresses_set:testSetSuccess() (gas: 94638) +EnumerableMapAddresses_tryGet:testBytes32TryGetSuccess() (gas: 94602) +EnumerableMapAddresses_tryGet:testBytesTryGetSuccess() (gas: 96316) +EnumerableMapAddresses_tryGet:testTryGetSuccess() (gas: 94869) +OpStackBurnMintERC677_constructor:testConstructorSuccess() (gas: 1721342) +OpStackBurnMintERC677_interfaceCompatibility:testBurnCompatibility() (gas: 291244) +OpStackBurnMintERC677_interfaceCompatibility:testMintCompatibility() (gas: 137917) +OpStackBurnMintERC677_interfaceCompatibility:testStaticFunctionsCompatibility() (gas: 13773) +OpStackBurnMintERC677_supportsInterface:testConstructorSuccess() (gas: 12728) +Ownable2Step_acceptOwnership:test_acceptOwnership_MustBeProposedOwner_reverts() (gas: 10353) +Ownable2Step_acceptOwnership:test_acceptOwnership_success() (gas: 31070) +Ownable2Step_constructor:test_constructor_OwnerCannotBeZero_reverts() (gas: 35924) +Ownable2Step_constructor:test_constructor_success() (gas: 10424) +Ownable2Step_onlyOwner:test_onlyOwner_OnlyCallableByOwner_reverts() (gas: 10746) +Ownable2Step_onlyOwner:test_onlyOwner_success() (gas: 7503) +Ownable2Step_transferOwnership:test_transferOwnership_CannotTransferToSelf_reverts() (gas: 10494) +Ownable2Step_transferOwnership:test_transferOwnership_success() (gas: 30124) +SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_EmptySubset_Reverts() (gas: 5191) +SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_EmptySuperset_Reverts() (gas: 4522) +SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_HasDuplicates_Reverts() (gas: 7738) +SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_NotASubset_Reverts() (gas: 11700) +SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_SingleElementSubset() (gas: 3908) +SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_SingleElementSubsetAndSuperset_Equal() (gas: 1459) +SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_SingleElementSubsetAndSuperset_NotEqual_Reverts() (gas: 6149) +SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_SubsetEqualsSuperset_NoRevert() (gas: 7830) +SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_SubsetLargerThanSuperset_Reverts() (gas: 15363) +SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_SupersetHasDuplicates_Reverts() (gas: 8767) +SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_UnsortedSubset_Reverts() (gas: 7106) +SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_UnsortedSuperset_Reverts() (gas: 8947) +SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_ValidSubset_Success() (gas: 5653) \ No newline at end of file diff --git a/contracts/gas-snapshots/workflow.gas-snapshot b/contracts/gas-snapshots/workflow.gas-snapshot new file mode 100644 index 0000000000..0a29158c2a --- /dev/null +++ b/contracts/gas-snapshots/workflow.gas-snapshot @@ -0,0 +1,53 @@ +WorkflowRegistryManager_activateVersion:test_WhenTheVersionNumberIsNotActive() (gas: 419) +WorkflowRegistryManageraddVersion:test_WhenAutoActivateIsFalse() (gas: 164) +WorkflowRegistryManageraddVersion:test_WhenAutoActivateIsTrue() (gas: 120) +WorkflowRegistryManagergetActiveVersion:test_WhenAnActiveVersionExists() (gas: 120) +WorkflowRegistryManagergetActiveVersion:test_WhenNoActiveVersionIsAvailable() (gas: 139) +WorkflowRegistryManagergetAllVersions:test_WhenLimitExceedsMaximumPaginationLimit() (gas: 161) +WorkflowRegistryManagergetAllVersions:test_WhenRequestingWithInvalidStartIndex() (gas: 142) +WorkflowRegistryManagergetAllVersions:test_WhenRequestingWithValidStartIndexAndLimitWithinBounds() (gas: 120) +WorkflowRegistryManagergetLatestVersion:test_WhenNoVersionsHaveBeenRegistered() (gas: 120) +WorkflowRegistryManagergetLatestVersion:test_WhenVersionsHaveBeenRegistered() (gas: 139) +WorkflowRegistryManagergetVersion:test_WhenVersionNumberIsNotRegistered() (gas: 120) +WorkflowRegistryManagergetVersion:test_WhenVersionNumberIsRegistered() (gas: 139) +WorkflowRegistryManagergetVersionNumber:test_WhenAVersionIsRegisteredForTheContractAddressAndChainIDCombination() (gas: 161) +WorkflowRegistryManagergetVersionNumber:test_WhenNoVersionIsRegisteredForTheContractAddressAndChainIDCombination() (gas: 120) +WorkflowRegistryManagergetVersionNumber:test_WhenTheContractAddressIsInvalid() (gas: 142) +WorkflowRegistry_activateWorkflow:test_WhenTheCallerIsAnAuthorizedAddress() (gas: 491327) +WorkflowRegistry_deleteWorkflow:test_WhenTheCallerIsAnAuthorizedAddress_AndTheDonIDIsAllowed() (gas: 400597) +WorkflowRegistry_deleteWorkflow:test_WhenTheCallerIsAnAuthorizedAddress_AndTheDonIDIsNotAllowed() (gas: 418579) +WorkflowRegistry_getAllAllowedDONs:test_WhenTheSetOfAllowedDONsIsEmpty() (gas: 25780) +WorkflowRegistry_getAllAllowedDONs:test_WhenThereAreMultipleAllowedDONs() (gas: 75437) +WorkflowRegistry_getAllAllowedDONs:test_WhenThereIsASingleAllowedDON() (gas: 16566) +WorkflowRegistry_getWorkflowMetadata:test_WhenTheWorkflowDoesNotExist() (gas: 17521) +WorkflowRegistry_getWorkflowMetadata:test_WhenTheWorkflowExistsWithTheOwnerAndName() (gas: 490176) +WorkflowRegistry_getWorkflowMetadataListByDON:test_WhenLimitExceedsTotalWorkflows() (gas: 127660) +WorkflowRegistry_getWorkflowMetadataListByDON:test_WhenLimitIsEqualToTotalWorkflows() (gas: 128013) +WorkflowRegistry_getWorkflowMetadataListByDON:test_WhenLimitIsLessThanTotalWorkflows() (gas: 90119) +WorkflowRegistry_getWorkflowMetadataListByDON:test_WhenStartIs0() (gas: 127572) +WorkflowRegistry_getWorkflowMetadataListByDON:test_WhenStartIsGreaterThan0() (gas: 90076) +WorkflowRegistry_getWorkflowMetadataListByDON:test_WhenStartIsGreaterThanOrEqualToTotalWorkflows() (gas: 13454) +WorkflowRegistry_getWorkflowMetadataListByDON:test_WhenTheDONHasNoWorkflows() (gas: 13410) +WorkflowRegistry_getWorkflowMetadataListByOwner:test_WhenLimitExceedsTotalWorkflows() (gas: 128221) +WorkflowRegistry_getWorkflowMetadataListByOwner:test_WhenLimitIsEqualToTotalWorkflows() (gas: 128320) +WorkflowRegistry_getWorkflowMetadataListByOwner:test_WhenLimitIsLessThanTotalWorkflows() (gas: 90404) +WorkflowRegistry_getWorkflowMetadataListByOwner:test_WhenStartIs0_AndLimitIs0() (gas: 128118) +WorkflowRegistry_getWorkflowMetadataListByOwner:test_WhenStartIsGreaterThan0() (gas: 90361) +WorkflowRegistry_getWorkflowMetadataListByOwner:test_WhenStartIsGreaterThanOrEqualToTotalWorkflows() (gas: 13764) +WorkflowRegistry_getWorkflowMetadataListByOwner:test_WhenTheOwnerHasNoWorkflows() (gas: 13984) +WorkflowRegistry_pauseWorkflow:test_WhenTheDonIDIsAllowed_AndTheCallerIsAnAuthorizedAddress() (gas: 491299) +WorkflowRegistry_pauseWorkflow:test_WhenTheDonIDIsAllowed_AndTheCallerIsAnUnauthorizedAddress() (gas: 499097) +WorkflowRegistry_pauseWorkflow:test_WhenTheDonIDIsNotAllowed_AndTheCallerIsAnAuthorizedAddress() (gas: 498850) +WorkflowRegistry_pauseWorkflow:test_WhenTheDonIDIsNotAllowed_AndTheCallerIsAnUnauthorizedAddress() (gas: 503264) +WorkflowRegistry_registerWorkflow:test_WhenTheWorkflowInputsAreAllValid() (gas: 549829) +WorkflowRegistry_requestForceUpdateSecrets:test_WhenTheCallerIsAnAuthorizedAddress_AndTheWorkflowIsInAnAllowedDON() (gas: 891242) +WorkflowRegistry_requestForceUpdateSecrets:test_WhenTheCallerIsAnAuthorizedAddress_AndTheWorkflowIsNotInAnAllowedDON() (gas: 488397) +WorkflowRegistry_requestForceUpdateSecrets:test_WhenTheCallerIsNotAnAuthorizedAddress() (gas: 486751) +WorkflowRegistry_updateAllowedDONs:test_WhenTheBoolInputIsFalse() (gas: 29811) +WorkflowRegistry_updateAllowedDONs:test_WhenTheBoolInputIsTrue() (gas: 170386) +WorkflowRegistry_updateAuthorizedAddresses:test_WhenTheBoolInputIsFalse() (gas: 30350) +WorkflowRegistry_updateAuthorizedAddresses:test_WhenTheBoolInputIsTrue() (gas: 175605) +WorkflowRegistry_updateWorkflow:test_WhenTheWorkflowInputsAreAllValid() (gas: 501589) +WorkflowRegistrygetAllAuthorizedAddresses:test_WhenTheSetOfAuthorizedAddressesIsEmpty() (gas: 26152) +WorkflowRegistrygetAllAuthorizedAddresses:test_WhenThereAreMultipleAuthorizedAddresses() (gas: 78270) +WorkflowRegistrygetAllAuthorizedAddresses:test_WhenThereIsASingleAuthorizedAddress() (gas: 16814) \ No newline at end of file diff --git a/contracts/src/v0.8/ccip/test/mocks/MockRouter.sol b/contracts/src/v0.8/ccip/test/mocks/MockRouter.sol index 5e4c39dc19..6ca0bc073a 100644 --- a/contracts/src/v0.8/ccip/test/mocks/MockRouter.sol +++ b/contracts/src/v0.8/ccip/test/mocks/MockRouter.sol @@ -119,9 +119,7 @@ contract MockCCIPRouter is IRouter, IRouterClient { return mockMsgId; } - function _fromBytes( - bytes calldata extraArgs - ) internal pure returns (Client.EVMExtraArgsV2 memory) { + function _fromBytes(bytes calldata extraArgs) internal pure returns (Client.EVMExtraArgsV2 memory) { if (extraArgs.length == 0) { return Client.EVMExtraArgsV2({gasLimit: DEFAULT_GAS_LIMIT, allowOutOfOrderExecution: false}); } diff --git a/contracts/src/v0.8/ccip/test/tokenAdminRegistry/RegistryModuleOwnerCustom.t.sol b/contracts/src/v0.8/ccip/test/tokenAdminRegistry/RegistryModuleOwnerCustom.t.sol index cf40fb62d2..fab044d60d 100644 --- a/contracts/src/v0.8/ccip/test/tokenAdminRegistry/RegistryModuleOwnerCustom.t.sol +++ b/contracts/src/v0.8/ccip/test/tokenAdminRegistry/RegistryModuleOwnerCustom.t.sol @@ -105,9 +105,7 @@ contract RegistryModuleOwnerCustom_registerAdminViaOwner is RegistryModuleOwnerC } contract AccessController is AccessControl { - constructor( - address admin - ) { + constructor(address admin) { _grantRole(DEFAULT_ADMIN_ROLE, admin); } } diff --git a/contracts/src/v0.8/ccip/tokenAdminRegistry/RegistryModuleOwnerCustom.sol b/contracts/src/v0.8/ccip/tokenAdminRegistry/RegistryModuleOwnerCustom.sol index 549963ff4a..799875b758 100644 --- a/contracts/src/v0.8/ccip/tokenAdminRegistry/RegistryModuleOwnerCustom.sol +++ b/contracts/src/v0.8/ccip/tokenAdminRegistry/RegistryModuleOwnerCustom.sol @@ -44,9 +44,7 @@ contract RegistryModuleOwnerCustom is ITypeAndVersion { /// @notice Registers the admin of the token using OZ's AccessControl DEFAULT_ADMIN_ROLE. /// @param token The token to register the admin for. /// @dev The caller must have the DEFAULT_ADMIN_ROLE as defined by the contract itself. - function registerAccessControlDefaultAdmin( - address token - ) external { + function registerAccessControlDefaultAdmin(address token) external { bytes32 defaultAdminRole = AccessControl(token).DEFAULT_ADMIN_ROLE(); if (!AccessControl(token).hasRole(defaultAdminRole, msg.sender)) { revert RequiredRoleNotFound(msg.sender, defaultAdminRole, token); diff --git a/contracts/src/v0.8/vendor/forge-std/src/Vm.sol b/contracts/src/v0.8/vendor/forge-std/src/Vm.sol index 6b1f2913cf..0f2dc50ff7 100644 --- a/contracts/src/v0.8/vendor/forge-std/src/Vm.sol +++ b/contracts/src/v0.8/vendor/forge-std/src/Vm.sol @@ -235,7 +235,7 @@ interface VmSafe { uint64 gasLimit; // The total gas used. uint64 gasTotalUsed; - // The amount of gas used for memory expansion. + // DEPRECATED: The amount of gas used for memory expansion. Ref: uint64 gasMemoryUsed; // The amount of gas refunded. int64 gasRefunded; @@ -243,6 +243,135 @@ interface VmSafe { uint64 gasRemaining; } + /// The result of the `stopDebugTraceRecording` call + struct DebugStep { + // The stack before executing the step of the run. + // stack\[0\] represents the top of the stack. + // and only stack data relevant to the opcode execution is contained. + uint256[] stack; + // The memory input data before executing the step of the run. + // only input data relevant to the opcode execution is contained. + // e.g. for MLOAD, it will have memory\[offset:offset+32\] copied here. + // the offset value can be get by the stack data. + bytes memoryInput; + // The opcode that was accessed. + uint8 opcode; + // The call depth of the step. + uint64 depth; + // Whether the call end up with out of gas error. + bool isOutOfGas; + // The contract address where the opcode is running + address contractAddr; + } + + // ======== Crypto ======== + + /// Derives a private key from the name, labels the account with that name, and returns the wallet. + function createWallet(string calldata walletLabel) external returns (Wallet memory wallet); + + /// Generates a wallet from the private key and returns the wallet. + function createWallet(uint256 privateKey) external returns (Wallet memory wallet); + + /// Generates a wallet from the private key, labels the account with that name, and returns the wallet. + function createWallet(uint256 privateKey, string calldata walletLabel) external returns (Wallet memory wallet); + + /// Derive a private key from a provided mnenomic string (or mnenomic file path) + /// at the derivation path `m/44'/60'/0'/0/{index}`. + function deriveKey(string calldata mnemonic, uint32 index) external pure returns (uint256 privateKey); + + /// Derive a private key from a provided mnenomic string (or mnenomic file path) + /// at `{derivationPath}{index}`. + function deriveKey(string calldata mnemonic, string calldata derivationPath, uint32 index) + external + pure + returns (uint256 privateKey); + + /// Derive a private key from a provided mnenomic string (or mnenomic file path) in the specified language + /// at the derivation path `m/44'/60'/0'/0/{index}`. + function deriveKey(string calldata mnemonic, uint32 index, string calldata language) + external + pure + returns (uint256 privateKey); + + /// Derive a private key from a provided mnenomic string (or mnenomic file path) in the specified language + /// at `{derivationPath}{index}`. + function deriveKey(string calldata mnemonic, string calldata derivationPath, uint32 index, string calldata language) + external + pure + returns (uint256 privateKey); + + /// Derives secp256r1 public key from the provided `privateKey`. + function publicKeyP256(uint256 privateKey) external pure returns (uint256 publicKeyX, uint256 publicKeyY); + + /// Adds a private key to the local forge wallet and returns the address. + function rememberKey(uint256 privateKey) external returns (address keyAddr); + + /// Derive a set number of wallets from a mnemonic at the derivation path `m/44'/60'/0'/0/{0..count}`. + /// + /// The respective private keys are saved to the local forge wallet for later use and their addresses are returned. + function rememberKeys(string calldata mnemonic, string calldata derivationPath, uint32 count) + external + returns (address[] memory keyAddrs); + + /// Derive a set number of wallets from a mnemonic in the specified language at the derivation path `m/44'/60'/0'/0/{0..count}`. + /// + /// The respective private keys are saved to the local forge wallet for later use and their addresses are returned. + function rememberKeys( + string calldata mnemonic, + string calldata derivationPath, + string calldata language, + uint32 count + ) external returns (address[] memory keyAddrs); + + /// Signs data with a `Wallet`. + /// Returns a compact signature (`r`, `vs`) as per EIP-2098, where `vs` encodes both the + /// signature's `s` value, and the recovery id `v` in a single bytes32. + /// This format reduces the signature size from 65 to 64 bytes. + function signCompact(Wallet calldata wallet, bytes32 digest) external returns (bytes32 r, bytes32 vs); + + /// Signs `digest` with `privateKey` using the secp256k1 curve. + /// Returns a compact signature (`r`, `vs`) as per EIP-2098, where `vs` encodes both the + /// signature's `s` value, and the recovery id `v` in a single bytes32. + /// This format reduces the signature size from 65 to 64 bytes. + function signCompact(uint256 privateKey, bytes32 digest) external pure returns (bytes32 r, bytes32 vs); + + /// Signs `digest` with signer provided to script using the secp256k1 curve. + /// Returns a compact signature (`r`, `vs`) as per EIP-2098, where `vs` encodes both the + /// signature's `s` value, and the recovery id `v` in a single bytes32. + /// This format reduces the signature size from 65 to 64 bytes. + /// If `--sender` is provided, the signer with provided address is used, otherwise, + /// if exactly one signer is provided to the script, that signer is used. + /// Raises error if signer passed through `--sender` does not match any unlocked signers or + /// if `--sender` is not provided and not exactly one signer is passed to the script. + function signCompact(bytes32 digest) external pure returns (bytes32 r, bytes32 vs); + + /// Signs `digest` with signer provided to script using the secp256k1 curve. + /// Returns a compact signature (`r`, `vs`) as per EIP-2098, where `vs` encodes both the + /// signature's `s` value, and the recovery id `v` in a single bytes32. + /// This format reduces the signature size from 65 to 64 bytes. + /// Raises error if none of the signers passed into the script have provided address. + function signCompact(address signer, bytes32 digest) external pure returns (bytes32 r, bytes32 vs); + + /// Signs `digest` with `privateKey` using the secp256r1 curve. + function signP256(uint256 privateKey, bytes32 digest) external pure returns (bytes32 r, bytes32 s); + + /// Signs data with a `Wallet`. + function sign(Wallet calldata wallet, bytes32 digest) external returns (uint8 v, bytes32 r, bytes32 s); + + /// Signs `digest` with `privateKey` using the secp256k1 curve. + function sign(uint256 privateKey, bytes32 digest) external pure returns (uint8 v, bytes32 r, bytes32 s); + + /// Signs `digest` with signer provided to script using the secp256k1 curve. + /// If `--sender` is provided, the signer with provided address is used, otherwise, + /// if exactly one signer is provided to the script, that signer is used. + /// Raises error if signer passed through `--sender` does not match any unlocked signers or + /// if `--sender` is not provided and not exactly one signer is passed to the script. + function sign(bytes32 digest) external pure returns (uint8 v, bytes32 r, bytes32 s); + + /// Signs `digest` with signer provided to script using the secp256k1 curve. + /// Raises error if none of the signers passed into the script have provided address. + function sign(address signer, bytes32 digest) external pure returns (uint8 v, bytes32 r, bytes32 s); + // ======== Environment ======== /// Gets the environment variable `name` and parses it as `address`. @@ -447,10 +576,13 @@ interface VmSafe { /// Gets the nonce of an account. function getNonce(address account) external view returns (uint64 nonce); + /// Get the nonce of a `Wallet`. + function getNonce(Wallet calldata wallet) external returns (uint64 nonce); + /// Gets all the recorded logs. function getRecordedLogs() external returns (Log[] memory logs); - /// Gets the gas used in the last call. + /// Gets the gas used in the last call from the callee perspective. function lastCallGas() external view returns (Gas memory gas); /// Loads a storage slot from an address. @@ -465,28 +597,22 @@ interface VmSafe { /// Record all the transaction logs. function recordLogs() external; + /// Reset gas metering (i.e. gas usage is set to gas limit). + function resetGasMetering() external; + /// Resumes gas metering (i.e. gas usage is counted again). Noop if already on. function resumeGasMetering() external; /// Performs an Ethereum JSON-RPC request to the current fork URL. function rpc(string calldata method, string calldata params) external returns (bytes memory data); - /// Signs `digest` with `privateKey` using the secp256r1 curve. - function signP256(uint256 privateKey, bytes32 digest) external pure returns (bytes32 r, bytes32 s); - - /// Signs `digest` with `privateKey` using the secp256k1 curve. - function sign(uint256 privateKey, bytes32 digest) external pure returns (uint8 v, bytes32 r, bytes32 s); - - /// Signs `digest` with signer provided to script using the secp256k1 curve. - /// If `--sender` is provided, the signer with provided address is used, otherwise, - /// if exactly one signer is provided to the script, that signer is used. - /// Raises error if signer passed through `--sender` does not match any unlocked signers or - /// if `--sender` is not provided and not exactly one signer is passed to the script. - function sign(bytes32 digest) external pure returns (uint8 v, bytes32 r, bytes32 s); + /// Performs an Ethereum JSON-RPC request to the given endpoint. + function rpc(string calldata urlOrAlias, string calldata method, string calldata params) + external + returns (bytes memory data); - /// Signs `digest` with signer provided to script using the secp256k1 curve. - /// Raises error if none of the signers passed into the script have provided address. - function sign(address signer, bytes32 digest) external pure returns (uint8 v, bytes32 r, bytes32 s); + /// Records the debug trace during the run. + function startDebugTraceRecording() external; /// Starts recording all map SSTOREs for later retrieval. function startMappingRecording() external; @@ -495,6 +621,9 @@ interface VmSafe { /// along with the context of the calls function startStateDiffRecording() external; + /// Stop debug trace recording and returns the recorded debug trace. + function stopAndReturnDebugTraceRecording() external returns (DebugStep[] memory step); + /// Returns an ordered array of all account accesses from a `vm.startStateDiffRecording` session. function stopAndReturnStateDiff() external returns (AccountAccess[] memory accountAccesses); @@ -520,6 +649,17 @@ interface VmSafe { /// `path` is relative to the project root. function createDir(string calldata path, bool recursive) external; + /// Deploys a contract from an artifact file. Takes in the relative path to the json file or the path to the + /// artifact in the form of :: where and parts are optional. + function deployCode(string calldata artifactPath) external returns (address deployedAddress); + + /// Deploys a contract from an artifact file. Takes in the relative path to the json file or the path to the + /// artifact in the form of :: where and parts are optional. + /// Additionally accepts abi-encoded constructor arguments. + function deployCode(string calldata artifactPath, bytes calldata constructorArgs) + external + returns (address deployedAddress); + /// Returns true if the given path points to an existing entity, else returns false. function exists(string calldata path) external returns (bool result); @@ -529,6 +669,12 @@ interface VmSafe { /// Given a path, query the file system to get information about a file, directory, etc. function fsMetadata(string calldata path) external view returns (FsMetadata memory metadata); + /// Gets the artifact path from code (aka. creation code). + function getArtifactPathByCode(bytes calldata code) external view returns (string memory path); + + /// Gets the artifact path from deployed code (aka. runtime code). + function getArtifactPathByDeployedCode(bytes calldata deployedCode) external view returns (string memory path); + /// Gets the creation bytecode from an artifact file. Takes in the relative path to the json file or the path to the /// artifact in the form of :: where and parts are optional. function getCode(string calldata artifactPath) external view returns (bytes memory creationBytecode); @@ -555,6 +701,9 @@ interface VmSafe { /// Prompts the user for a hidden string value in the terminal. function promptSecret(string calldata promptText) external returns (string memory input); + /// Prompts the user for hidden uint256 in the terminal (usually pk). + function promptSecretUint(string calldata promptText) external returns (uint256); + /// Prompts the user for uint256 in the terminal. function promptUint(string calldata promptText) external returns (uint256); @@ -624,10 +773,6 @@ interface VmSafe { // ======== JSON ======== - /// Checks if `key` exists in a JSON object - /// `keyExists` is being deprecated in favor of `keyExistsJson`. It will be removed in future versions. - function keyExists(string calldata json, string calldata key) external view returns (bool); - /// Checks if `key` exists in a JSON object. function keyExistsJson(string calldata json, string calldata key) external view returns (bool); @@ -676,6 +821,24 @@ interface VmSafe { /// Parses a string of JSON data at `key` and coerces it to `string[]`. function parseJsonStringArray(string calldata json, string calldata key) external pure returns (string[] memory); + /// Parses a string of JSON data at `key` and coerces it to type array corresponding to `typeDescription`. + function parseJsonTypeArray(string calldata json, string calldata key, string calldata typeDescription) + external + pure + returns (bytes memory); + + /// Parses a string of JSON data and coerces it to type corresponding to `typeDescription`. + function parseJsonType(string calldata json, string calldata typeDescription) + external + pure + returns (bytes memory); + + /// Parses a string of JSON data at `key` and coerces it to type corresponding to `typeDescription`. + function parseJsonType(string calldata json, string calldata key, string calldata typeDescription) + external + pure + returns (bytes memory); + /// Parses a string of JSON data at `key` and coerces it to `uint256`. function parseJsonUint(string calldata json, string calldata key) external pure returns (uint256); @@ -742,6 +905,20 @@ interface VmSafe { /// Returns the stringified version of the specific JSON file up to that moment. function serializeJson(string calldata objectKey, string calldata value) external returns (string memory json); + /// See `serializeJson`. + function serializeJsonType(string calldata typeDescription, bytes calldata value) + external + pure + returns (string memory json); + + /// See `serializeJson`. + function serializeJsonType( + string calldata objectKey, + string calldata valueKey, + string calldata typeDescription, + bytes calldata value + ) external returns (string memory json); + /// See `serializeJson`. function serializeString(string calldata objectKey, string calldata valueKey, string calldata value) external @@ -774,8 +951,15 @@ interface VmSafe { /// This is useful to replace a specific value of a JSON file, without having to parse the entire thing. function writeJson(string calldata json, string calldata path, string calldata valueKey) external; + /// Checks if `key` exists in a JSON object + /// `keyExists` is being deprecated in favor of `keyExistsJson`. It will be removed in future versions. + function keyExists(string calldata json, string calldata key) external view returns (bool); + // ======== Scripting ======== + /// Takes a signed transaction and broadcasts it to the network. + function broadcastRawTransaction(bytes calldata data) external; + /// Has the next call (at this call depth only) create transactions that can later be signed and sent onchain. /// Broadcasting address is determined by checking the following in order: /// 1. If `--sender` argument was provided, that address is used. @@ -791,6 +975,9 @@ interface VmSafe { /// provided as the sender that can later be signed and sent onchain. function broadcast(uint256 privateKey) external; + /// Returns addresses of available unlocked wallets in the script environment. + function getScriptWallets() external returns (address[] memory wallets); + /// Has all subsequent calls (at this call depth only) create transactions that can later be signed and sent onchain. /// Broadcasting address is determined by checking the following in order: /// 1. If `--sender` argument was provided, that address is used. @@ -809,6 +996,9 @@ interface VmSafe { /// Stops collecting onchain transactions. function stopBroadcast() external; + /// Returns addresses of available unlocked wallets in the script environment. + function getWallets() external returns (address[] memory wallets); + // ======== String ======== /// Returns the index of the first occurrence of a `key` in an `input` string. @@ -1303,11 +1493,22 @@ interface VmSafe { /// If the condition is false, discard this run's fuzz inputs and generate new ones. function assume(bool condition) external pure; + /// Discard this run's fuzz inputs and generate new ones if next call reverted. + function assumeNoRevert() external pure; + /// Writes a breakpoint to jump to in the debugger. - function breakpoint(string calldata char) external; + function breakpoint(string calldata char) external pure; /// Writes a conditional breakpoint to jump to in the debugger. - function breakpoint(string calldata char, bool value) external; + function breakpoint(string calldata char, bool value) external pure; + + /// Returns the Foundry version. + /// Format: ++ + /// Sample output: 0.2.0+faa94c384+202407110019 + /// Note: Build timestamps may vary slightly across platforms due to separate CI jobs. + /// For reliable version comparisons, use YYYYMMDD0000 format (e.g., >= 202407110000) + /// to compare timestamps while ignoring minor time differences. + function getFoundryVersion() external view returns (string memory version); /// Returns the RPC url for the given alias. function rpcUrl(string calldata rpcAlias) external view returns (string memory json); @@ -1371,6 +1572,24 @@ interface VmSafe { /// Parses a string of TOML data at `key` and coerces it to `string[]`. function parseTomlStringArray(string calldata toml, string calldata key) external pure returns (string[] memory); + /// Parses a string of TOML data at `key` and coerces it to type array corresponding to `typeDescription`. + function parseTomlTypeArray(string calldata toml, string calldata key, string calldata typeDescription) + external + pure + returns (bytes memory); + + /// Parses a string of TOML data and coerces it to type corresponding to `typeDescription`. + function parseTomlType(string calldata toml, string calldata typeDescription) + external + pure + returns (bytes memory); + + /// Parses a string of TOML data at `key` and coerces it to type corresponding to `typeDescription`. + function parseTomlType(string calldata toml, string calldata key, string calldata typeDescription) + external + pure + returns (bytes memory); + /// Parses a string of TOML data at `key` and coerces it to `uint256`. function parseTomlUint(string calldata toml, string calldata key) external pure returns (uint256); @@ -1404,57 +1623,57 @@ interface VmSafe { /// Compute the address a contract will be deployed at for a given deployer address and nonce. function computeCreateAddress(address deployer, uint256 nonce) external pure returns (address); - /// Derives a private key from the name, labels the account with that name, and returns the wallet. - function createWallet(string calldata walletLabel) external returns (Wallet memory wallet); + /// Utility cheatcode to copy storage of `from` contract to another `to` contract. + function copyStorage(address from, address to) external; - /// Generates a wallet from the private key and returns the wallet. - function createWallet(uint256 privateKey) external returns (Wallet memory wallet); + /// Returns ENS namehash for provided string. + function ensNamehash(string calldata name) external pure returns (bytes32); - /// Generates a wallet from the private key, labels the account with that name, and returns the wallet. - function createWallet(uint256 privateKey, string calldata walletLabel) external returns (Wallet memory wallet); + /// Gets the label for the specified address. + function getLabel(address account) external view returns (string memory currentLabel); - /// Derive a private key from a provided mnenomic string (or mnenomic file path) - /// at the derivation path `m/44'/60'/0'/0/{index}`. - function deriveKey(string calldata mnemonic, uint32 index) external pure returns (uint256 privateKey); + /// Labels an address in call traces. + function label(address account, string calldata newLabel) external; - /// Derive a private key from a provided mnenomic string (or mnenomic file path) - /// at `{derivationPath}{index}`. - function deriveKey(string calldata mnemonic, string calldata derivationPath, uint32 index) - external - pure - returns (uint256 privateKey); + /// Pauses collection of call traces. Useful in cases when you want to skip tracing of + /// complex calls which are not useful for debugging. + function pauseTracing() external view; - /// Derive a private key from a provided mnenomic string (or mnenomic file path) in the specified language - /// at the derivation path `m/44'/60'/0'/0/{index}`. - function deriveKey(string calldata mnemonic, uint32 index, string calldata language) - external - pure - returns (uint256 privateKey); + /// Returns a random `address`. + function randomAddress() external returns (address); - /// Derive a private key from a provided mnenomic string (or mnenomic file path) in the specified language - /// at `{derivationPath}{index}`. - function deriveKey(string calldata mnemonic, string calldata derivationPath, uint32 index, string calldata language) - external - pure - returns (uint256 privateKey); + /// Returns a random `bool`. + function randomBool() external view returns (bool); - /// Returns ENS namehash for provided string. - function ensNamehash(string calldata name) external pure returns (bytes32); + /// Returns a random byte array value of the given length. + function randomBytes(uint256 len) external view returns (bytes memory); - /// Gets the label for the specified address. - function getLabel(address account) external view returns (string memory currentLabel); + /// Returns a random fixed-size byte array of length 4. + function randomBytes4() external view returns (bytes4); - /// Get a `Wallet`'s nonce. - function getNonce(Wallet calldata wallet) external returns (uint64 nonce); + /// Returns a random fixed-size byte array of length 8. + function randomBytes8() external view returns (bytes8); - /// Labels an address in call traces. - function label(address account, string calldata newLabel) external; + /// Returns a random `int256` value. + function randomInt() external view returns (int256); - /// Adds a private key to the local forge wallet and returns the address. - function rememberKey(uint256 privateKey) external returns (address keyAddr); + /// Returns a random `int256` value of given bits. + function randomInt(uint256 bits) external view returns (int256); - /// Signs data with a `Wallet`. - function sign(Wallet calldata wallet, bytes32 digest) external returns (uint8 v, bytes32 r, bytes32 s); + /// Returns a random uint256 value. + function randomUint() external returns (uint256); + + /// Returns random uint256 value between the provided range (=min..=max). + function randomUint(uint256 min, uint256 max) external returns (uint256); + + /// Returns a random `uint256` value of given bits. + function randomUint(uint256 bits) external view returns (uint256); + + /// Unpauses collection of call traces. + function resumeTracing() external view; + + /// Utility cheatcode to set arbitrary storage for given target address. + function setArbitraryStorage(address target) external; /// Encodes a `bytes` value to a base64url string. function toBase64URL(bytes calldata data) external pure returns (string memory); @@ -1494,6 +1713,9 @@ interface Vm is VmSafe { /// Clears all mocked calls. function clearMockedCalls() external; + /// Clones a source account code, state, balance and nonce to a target account and updates in-memory EVM state. + function cloneAccount(address source, address target) external; + /// Sets `block.coinbase`. function coinbase(address newCoinbase) external; @@ -1524,10 +1746,10 @@ interface Vm is VmSafe { /// Takes the snapshot ID to delete. /// Returns `true` if the snapshot was successfully deleted. /// Returns `false` if the snapshot does not exist. - function deleteSnapshot(uint256 snapshotId) external returns (bool success); + function deleteStateSnapshot(uint256 snapshotId) external returns (bool success); /// Removes _all_ snapshots previously created by `snapshot`. - function deleteSnapshots() external; + function deleteStateSnapshots() external; /// Sets `block.difficulty`. /// Not available on EVM versions from Paris onwards. Use `prevrandao` instead. @@ -1551,7 +1773,7 @@ interface Vm is VmSafe { /// Returns true if the account is marked as persistent. function isPersistent(address account) external view returns (bool persistent); - /// Load a genesis JSON file's `allocs` into the in-memory revm state. + /// Load a genesis JSON file's `allocs` into the in-memory EVM state. function loadAllocs(string calldata pathToAllocsJson) external; /// Marks that the account(s) should use persistent storage across fork swaps in a multifork setup @@ -1584,6 +1806,20 @@ interface Vm is VmSafe { /// Calldata match takes precedence over `msg.value` in case of ambiguity. function mockCall(address callee, uint256 msgValue, bytes calldata data, bytes calldata returnData) external; + /// Mocks multiple calls to an address, returning specified data for each call. + function mockCalls(address callee, bytes calldata data, bytes[] calldata returnData) external; + + /// Mocks multiple calls to an address with a specific `msg.value`, returning specified data for each call. + function mockCalls(address callee, uint256 msgValue, bytes calldata data, bytes[] calldata returnData) external; + + /// Whenever a call is made to `callee` with calldata `data`, this cheatcode instead calls + /// `target` with the same calldata. This functionality is similar to a delegate call made to + /// `target` contract from `callee`. + /// Can be used to substitute a call to a function with another implementation that captures + /// the primary logic of the original function but is easier to reason about. + /// If calldata is not a strict match then partial match by selector is attempted. + function mockFunction(address callee, address target, bytes calldata data) external; + /// Sets the *next* call's `msg.sender` to be the input address. function prank(address msgSender) external; @@ -1610,14 +1846,14 @@ interface Vm is VmSafe { /// Takes the snapshot ID to revert to. /// Returns `true` if the snapshot was successfully reverted. /// Returns `false` if the snapshot does not exist. - /// **Note:** This does not automatically delete the snapshot. To delete the snapshot use `deleteSnapshot`. - function revertTo(uint256 snapshotId) external returns (bool success); + /// **Note:** This does not automatically delete the snapshot. To delete the snapshot use `deleteStateSnapshot`. + function revertToState(uint256 snapshotId) external returns (bool success); /// Revert the state of the EVM to a previous snapshot and automatically deletes the snapshots /// Takes the snapshot ID to revert to. /// Returns `true` if the snapshot was successfully reverted and deleted. /// Returns `false` if the snapshot does not exist. - function revertToAndDelete(uint256 snapshotId) external returns (bool success); + function revertToStateAndDelete(uint256 snapshotId) external returns (bool success); /// Revokes persistent status from the address, previously added via `makePersistent`. function revokePersistent(address account) external; @@ -1645,16 +1881,33 @@ interface Vm is VmSafe { /// Takes a fork identifier created by `createFork` and sets the corresponding forked state as active. function selectFork(uint256 forkId) external; + /// Set blockhash for the current block. + /// It only sets the blockhash for blocks where `block.number - 256 <= number < block.number`. + function setBlockhash(uint256 blockNumber, bytes32 blockHash) external; + /// Sets the nonce of an account. Must be higher than the current nonce of the account. function setNonce(address account, uint64 newNonce) external; /// Sets the nonce of an account to an arbitrary value. function setNonceUnsafe(address account, uint64 newNonce) external; + /// Snapshot capture the gas usage of the last call by name from the callee perspective. + function snapshotGasLastCall(string calldata name) external returns (uint256 gasUsed); + + /// Snapshot capture the gas usage of the last call by name in a group from the callee perspective. + function snapshotGasLastCall(string calldata group, string calldata name) external returns (uint256 gasUsed); + /// Snapshot the current state of the evm. /// Returns the ID of the snapshot that was created. - /// To revert a snapshot use `revertTo`. - function snapshot() external returns (uint256 snapshotId); + /// To revert a snapshot use `revertToState`. + function snapshotState() external returns (uint256 snapshotId); + + /// Snapshot capture an arbitrary numerical value by name. + /// The group name is derived from the contract name. + function snapshotValue(string calldata name, uint256 value) external; + + /// Snapshot capture an arbitrary numerical value by name in a group. + function snapshotValue(string calldata group, string calldata name, uint256 value) external; /// Sets all subsequent calls' `msg.sender` to be the input address until `stopPrank` is called. function startPrank(address msgSender) external; @@ -1662,9 +1915,26 @@ interface Vm is VmSafe { /// Sets all subsequent calls' `msg.sender` to be the input address until `stopPrank` is called, and the `tx.origin` to be the second input. function startPrank(address msgSender, address txOrigin) external; + /// Start a snapshot capture of the current gas usage by name. + /// The group name is derived from the contract name. + function startSnapshotGas(string calldata name) external; + + /// Start a snapshot capture of the current gas usage by name in a group. + function startSnapshotGas(string calldata group, string calldata name) external; + /// Resets subsequent calls' `msg.sender` to be `address(this)`. function stopPrank() external; + /// Stop the snapshot capture of the current gas by latest snapshot name, capturing the gas used since the start. + function stopSnapshotGas() external returns (uint256 gasUsed); + + /// Stop the snapshot capture of the current gas usage by name, capturing the gas used since the start. + /// The group name is derived from the contract name. + function stopSnapshotGas(string calldata name) external returns (uint256 gasUsed); + + /// Stop the snapshot capture of the current gas usage by name in a group, capturing the gas used since the start. + function stopSnapshotGas(string calldata group, string calldata name) external returns (uint256 gasUsed); + /// Stores a value to an address' storage slot. function store(address target, bytes32 slot, bytes32 value) external; @@ -1680,6 +1950,21 @@ interface Vm is VmSafe { /// Sets `block.timestamp`. function warp(uint256 newTimestamp) external; + /// `deleteSnapshot` is being deprecated in favor of `deleteStateSnapshot`. It will be removed in future versions. + function deleteSnapshot(uint256 snapshotId) external returns (bool success); + + /// `deleteSnapshots` is being deprecated in favor of `deleteStateSnapshots`. It will be removed in future versions. + function deleteSnapshots() external; + + /// `revertToAndDelete` is being deprecated in favor of `revertToStateAndDelete`. It will be removed in future versions. + function revertToAndDelete(uint256 snapshotId) external returns (bool success); + + /// `revertTo` is being deprecated in favor of `revertToState`. It will be removed in future versions. + function revertTo(uint256 snapshotId) external returns (bool success); + + /// `snapshot` is being deprecated in favor of `snapshotState`. It will be removed in future versions. + function snapshot() external returns (uint256 snapshotId); + // ======== Testing ======== /// Expect a call to an address with the specified `msg.value` and calldata, and a *minimum* amount of gas. @@ -1708,6 +1993,30 @@ interface Vm is VmSafe { /// Expects given number of calls to an address with the specified `msg.value`, gas, and calldata. function expectCall(address callee, uint256 msgValue, uint64 gas, bytes calldata data, uint64 count) external; + /// Prepare an expected anonymous log with (bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData.). + /// Call this function, then emit an anonymous event, then call a function. Internally after the call, we check if + /// logs were emitted in the expected order with the expected topics and data (as specified by the booleans). + function expectEmitAnonymous(bool checkTopic0, bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData) + external; + + /// Same as the previous method, but also checks supplied address against emitting contract. + function expectEmitAnonymous( + bool checkTopic0, + bool checkTopic1, + bool checkTopic2, + bool checkTopic3, + bool checkData, + address emitter + ) external; + + /// Prepare an expected anonymous log with all topic and data checks enabled. + /// Call this function, then emit an anonymous event, then call a function. Internally after the call, we check if + /// logs were emitted in the expected order with the expected topics and data. + function expectEmitAnonymous() external; + + /// Same as the previous method, but also checks supplied address against emitting contract. + function expectEmitAnonymous(address emitter) external; + /// Prepare an expected log with (bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData.). /// Call this function, then emit an event, then call a function. Internally after the call, we check if /// logs were emitted in the expected order with the expected topics and data (as specified by the booleans). @@ -1725,15 +2034,30 @@ interface Vm is VmSafe { /// Same as the previous method, but also checks supplied address against emitting contract. function expectEmit(address emitter) external; + /// Expects an error on next call that starts with the revert data. + function expectPartialRevert(bytes4 revertData) external; + + /// Expects an error on next call to reverter address, that starts with the revert data. + function expectPartialRevert(bytes4 revertData, address reverter) external; + /// Expects an error on next call with any revert data. function expectRevert() external; - /// Expects an error on next call that starts with the revert data. + /// Expects an error on next call that exactly matches the revert data. function expectRevert(bytes4 revertData) external; /// Expects an error on next call that exactly matches the revert data. function expectRevert(bytes calldata revertData) external; + /// Expects an error with any revert data on next call to reverter address. + function expectRevert(address reverter) external; + + /// Expects an error from reverter address on next call, with any revert data. + function expectRevert(bytes4 revertData, address reverter) external; + + /// Expects an error from reverter address on next call, that exactly matches the revert data. + function expectRevert(bytes calldata revertData, address reverter) external; + /// Only allows memory writes to offsets [0x00, 0x60) ∪ [min, max) in the current subcontext. If any other /// memory is written to, the test will fail. Can be called multiple times to add more ranges to the set. function expectSafeMemory(uint64 min, uint64 max) external; @@ -1743,9 +2067,12 @@ interface Vm is VmSafe { /// to the set. function expectSafeMemoryCall(uint64 min, uint64 max) external; - /// Marks a test as skipped. Must be called at the top of the test. + /// Marks a test as skipped. Must be called at the top level of a test. function skip(bool skipTest) external; + /// Marks a test as skipped with a reason. Must be called at the top level of a test. + function skip(bool skipTest, string calldata reason) external; + /// Stops all safe memory expectation in the current subcontext. function stopExpectSafeMemory() external; } From 5e7b2096586bc32c6e975fc13f4c411eb687f833 Mon Sep 17 00:00:00 2001 From: Rens Rooimans Date: Thu, 28 Nov 2024 15:39:22 +0100 Subject: [PATCH 5/7] new forge fmt --- contracts/src/v0.8/ccip/ARMProxy.sol | 8 ++- .../src/v0.8/ccip/AggregateRateLimiter.sol | 16 ++++-- contracts/src/v0.8/ccip/CommitStore.sol | 28 +++++++--- contracts/src/v0.8/ccip/FeeQuoter.sol | 48 ++++++++++++----- .../v0.8/ccip/MultiAggregateRateLimiter.sol | 20 +++++-- contracts/src/v0.8/ccip/NonceManager.sol | 12 +++-- contracts/src/v0.8/ccip/RMN.sol | 52 ++++++++++++++----- contracts/src/v0.8/ccip/Router.sol | 16 ++++-- .../ccip/applications/CCIPClientExample.sol | 12 +++-- .../v0.8/ccip/applications/CCIPReceiver.sol | 16 ++++-- .../ccip/applications/DefensiveExample.sol | 4 +- .../ccip/applications/EtherSenderReceiver.sol | 12 +++-- .../v0.8/ccip/applications/PingPongDemo.sol | 24 ++++++--- .../ccip/applications/SelfFundedPingPong.sol | 12 +++-- .../src/v0.8/ccip/applications/TokenProxy.sol | 4 +- .../src/v0.8/ccip/capability/CCIPHome.sol | 20 +++++-- .../interfaces/IAny2EVMMessageReceiver.sol | 4 +- .../v0.8/ccip/interfaces/IAny2EVMOffRamp.sol | 4 +- .../ccip/interfaces/ICapabilitiesRegistry.sol | 4 +- .../v0.8/ccip/interfaces/IEVM2AnyOnRamp.sol | 4 +- .../ccip/interfaces/IEVM2AnyOnRampClient.sol | 4 +- .../ccip/interfaces/IMessageInterceptor.sol | 4 +- contracts/src/v0.8/ccip/interfaces/IPool.sol | 8 ++- .../v0.8/ccip/interfaces/IPriceRegistry.sol | 16 ++++-- contracts/src/v0.8/ccip/interfaces/IRMN.sol | 8 ++- .../src/v0.8/ccip/interfaces/IRMNRemote.sol | 4 +- .../src/v0.8/ccip/interfaces/IRouter.sol | 4 +- .../v0.8/ccip/interfaces/IRouterClient.sol | 4 +- .../ccip/interfaces/ITokenAdminRegistry.sol | 4 +- .../v0.8/ccip/interfaces/IWrappedNative.sol | 4 +- .../encodingutils/ICCIPEncodingUtils.sol | 4 +- contracts/src/v0.8/ccip/libraries/Client.sol | 8 ++- .../src/v0.8/ccip/libraries/Internal.sol | 4 +- .../src/v0.8/ccip/libraries/RateLimiter.sol | 4 +- contracts/src/v0.8/ccip/ocr/MultiOCR3Base.sol | 16 ++++-- contracts/src/v0.8/ccip/ocr/OCR2Base.sol | 8 ++- .../src/v0.8/ccip/ocr/OCR2BaseNoChecks.sol | 8 ++- .../src/v0.8/ccip/offRamp/EVM2EVMOffRamp.sol | 24 ++++++--- contracts/src/v0.8/ccip/offRamp/OffRamp.sol | 32 +++++++++--- .../src/v0.8/ccip/onRamp/EVM2EVMOnRamp.sol | 40 ++++++++++---- contracts/src/v0.8/ccip/onRamp/OnRamp.sol | 36 +++++++++---- .../v0.8/ccip/pools/BurnFromMintTokenPool.sol | 4 +- .../src/v0.8/ccip/pools/BurnMintTokenPool.sol | 4 +- .../ccip/pools/BurnMintTokenPoolAbstract.sol | 4 +- .../ccip/pools/BurnWithFromMintTokenPool.sol | 4 +- .../src/v0.8/ccip/pools/LegacyPoolWrapper.sol | 16 ++++-- .../v0.8/ccip/pools/LockReleaseTokenPool.sol | 16 ++++-- .../pools/LockReleaseTokenPoolAndProxy.sol | 16 ++++-- contracts/src/v0.8/ccip/pools/TokenPool.sol | 52 ++++++++++++++----- .../USDC/HybridLockReleaseUSDCTokenPool.sol | 8 ++- .../ccip/pools/USDC/USDCBridgeMigrator.sol | 16 ++++-- .../v0.8/ccip/pools/USDC/USDCTokenPool.sol | 8 ++- contracts/src/v0.8/ccip/rmn/RMNHome.sol | 8 ++- contracts/src/v0.8/ccip/rmn/RMNRemote.sol | 28 +++++++--- contracts/src/v0.8/ccip/test/BaseTest.t.sol | 4 +- contracts/src/v0.8/ccip/test/WETH9.sol | 4 +- .../applications/EtherSenderReceiver.t.sol | 12 +++-- .../ccip/test/applications/PingPongDemo.t.sol | 12 +++-- contracts/src/v0.8/ccip/test/arm/RMN.t.sol | 4 +- .../src/v0.8/ccip/test/arm/RMNSetup.t.sol | 32 +++++++++--- .../v0.8/ccip/test/arm/RMN_benchmark.t.sol | 8 ++- .../ccip/test/attacks/onRamp/FacadeClient.sol | 4 +- .../v0.8/ccip/test/capability/CCIPHome.t.sol | 12 +++-- .../ccip/test/commitStore/CommitStore.t.sol | 8 ++- .../src/v0.8/ccip/test/e2e/End2End.t.sol | 4 +- .../ccip/test/feeQuoter/FeeQuoterSetup.t.sol | 8 ++- .../helpers/AggregateRateLimiterHelper.sol | 8 ++- .../test/helpers/BurnMintERC677Helper.sol | 4 +- .../v0.8/ccip/test/helpers/CCIPHomeHelper.sol | 12 +++-- .../ccip/test/helpers/CCIPReaderTester.sol | 12 +++-- .../ccip/test/helpers/CommitStoreHelper.sol | 4 +- .../ccip/test/helpers/ERC20RebasingHelper.sol | 8 ++- .../test/helpers/EVM2EVMOffRampHelper.sol | 8 ++- .../helpers/EtherSenderReceiverHelper.sol | 16 ++++-- .../MaybeRevertingBurnMintTokenPool.sol | 12 +++-- .../v0.8/ccip/test/helpers/MerkleHelper.sol | 8 ++- .../v0.8/ccip/test/helpers/MessageHasher.sol | 12 +++-- .../test/helpers/MessageInterceptorHelper.sol | 4 +- .../MultiAggregateRateLimiterHelper.sol | 4 +- .../ccip/test/helpers/MultiOCR3Helper.sol | 8 ++- .../v0.8/ccip/test/helpers/MultiTokenPool.sol | 36 +++++++++---- .../src/v0.8/ccip/test/helpers/OCR2Helper.sol | 4 +- .../ccip/test/helpers/OCR2NoChecksHelper.sol | 8 ++- .../ccip/test/helpers/RateLimiterHelper.sol | 8 ++- .../v0.8/ccip/test/helpers/ReportCodec.sol | 8 ++- .../ccip/test/helpers/TokenPoolHelper.sol | 8 ++- .../helpers/receivers/ConformingReceiver.sol | 4 +- .../receivers/MaybeRevertMessageReceiver.sol | 20 +++++-- .../MaybeRevertMessageReceiverNo165.sol | 12 +++-- .../helpers/receivers/ReentrancyAbuser.sol | 8 ++- .../receivers/ReentrancyAbuserMultiRamp.sol | 8 ++- .../ccip/test/legacy/BurnMintTokenPool1_2.sol | 32 +++++++++--- .../ccip/test/legacy/BurnMintTokenPool1_4.sol | 36 +++++++++---- .../ccip/test/legacy/TokenPoolAndProxy.t.sol | 12 +++-- .../v0.8/ccip/test/mocks/MockCommitStore.sol | 4 +- .../test/mocks/MockE2EUSDCTransmitter.sol | 4 +- .../src/v0.8/ccip/test/mocks/MockRMN.sol | 16 ++++-- .../src/v0.8/ccip/test/mocks/MockRMN1_0.sol | 20 +++++-- .../src/v0.8/ccip/test/mocks/MockRouter.sol | 20 +++++-- .../ccip/test/ocr/MultiOCR3BaseSetup.t.sol | 4 +- .../ccip/test/offRamp/EVM2EVMOffRamp.t.sol | 24 ++++++--- .../src/v0.8/ccip/test/offRamp/OffRamp.t.sol | 12 +++-- .../v0.8/ccip/test/offRamp/OffRampSetup.t.sol | 16 ++++-- .../v0.8/ccip/test/onRamp/EVM2EVMOnRamp.t.sol | 8 ++- .../src/v0.8/ccip/test/onRamp/OnRamp.t.sol | 4 +- .../v0.8/ccip/test/onRamp/OnRampSetup.t.sol | 12 +++-- .../v0.8/ccip/test/pools/BurnMintSetup.t.sol | 4 +- .../BurnWithFromMintRebasingTokenPool.t.sol | 8 ++- .../HybridLockReleaseUSDCTokenPool.t.sol | 4 +- .../test/pools/LockReleaseTokenPool.t.sol | 16 ++++-- .../src/v0.8/ccip/test/pools/TokenPool.t.sol | 4 +- .../v0.8/ccip/test/pools/USDCTokenPool.t.sol | 4 +- .../v0.8/ccip/test/rmn/RMNRemoteSetup.t.sol | 8 ++- .../src/v0.8/ccip/test/router/Router.t.sol | 36 +++++++++---- .../v0.8/ccip/test/router/RouterSetup.t.sol | 4 +- .../RegistryModuleOwnerCustom.t.sol | 4 +- .../TokenAdminRegistry.t.sol | 4 +- .../RegistryModuleOwnerCustom.sol | 16 ++++-- .../tokenAdminRegistry/TokenAdminRegistry.sol | 32 +++++++++--- 119 files changed, 1104 insertions(+), 368 deletions(-) diff --git a/contracts/src/v0.8/ccip/ARMProxy.sol b/contracts/src/v0.8/ccip/ARMProxy.sol index e9ccde8680..c37899c83c 100644 --- a/contracts/src/v0.8/ccip/ARMProxy.sol +++ b/contracts/src/v0.8/ccip/ARMProxy.sol @@ -22,13 +22,17 @@ contract ARMProxy is OwnerIsCreator, ITypeAndVersion { // DYNAMIC CONFIG address private s_arm; - constructor(address arm) { + constructor( + address arm + ) { setARM(arm); } /// @notice SetARM sets the ARM implementation contract address. /// @param arm The address of the arm implementation contract. - function setARM(address arm) public onlyOwner { + function setARM( + address arm + ) public onlyOwner { if (arm == address(0)) revert ZeroAddressNotAllowed(); s_arm = arm; emit ARMSet(arm); diff --git a/contracts/src/v0.8/ccip/AggregateRateLimiter.sol b/contracts/src/v0.8/ccip/AggregateRateLimiter.sol index 7401df2ed4..7a210e7c20 100644 --- a/contracts/src/v0.8/ccip/AggregateRateLimiter.sol +++ b/contracts/src/v0.8/ccip/AggregateRateLimiter.sol @@ -26,7 +26,9 @@ contract AggregateRateLimiter is OwnerIsCreator { RateLimiter.TokenBucket private s_rateLimiter; /// @param config The RateLimiter.Config - constructor(RateLimiter.Config memory config) { + constructor( + RateLimiter.Config memory config + ) { s_rateLimiter = RateLimiter.TokenBucket({ rate: config.rate, capacity: config.capacity, @@ -37,7 +39,9 @@ contract AggregateRateLimiter is OwnerIsCreator { } /// @notice Consumes value from the rate limiter bucket based on the token value given. - function _rateLimitValue(uint256 value) internal { + function _rateLimitValue( + uint256 value + ) internal { s_rateLimiter._consume(value, address(0)); } @@ -61,7 +65,9 @@ contract AggregateRateLimiter is OwnerIsCreator { /// @notice Sets the rate limited config. /// @param config The new rate limiter config. /// @dev should only be callable by the owner or token limit admin. - function setRateLimiterConfig(RateLimiter.Config memory config) external onlyAdminOrOwner { + function setRateLimiterConfig( + RateLimiter.Config memory config + ) external onlyAdminOrOwner { s_rateLimiter._setTokenBucketConfig(config); } @@ -78,7 +84,9 @@ contract AggregateRateLimiter is OwnerIsCreator { /// @notice Sets the token limit admin address. /// @param newAdmin the address of the new admin. /// @dev setting this to address(0) indicates there is no active admin. - function setAdmin(address newAdmin) external onlyAdminOrOwner { + function setAdmin( + address newAdmin + ) external onlyAdminOrOwner { s_admin = newAdmin; emit AdminSet(newAdmin); } diff --git a/contracts/src/v0.8/ccip/CommitStore.sol b/contracts/src/v0.8/ccip/CommitStore.sol index 77c2864d4f..4df251f63a 100644 --- a/contracts/src/v0.8/ccip/CommitStore.sol +++ b/contracts/src/v0.8/ccip/CommitStore.sol @@ -89,7 +89,9 @@ contract CommitStore is ICommitStore, ITypeAndVersion, OCR2Base { /// only if one must strictly ensure that for a given round there is only one valid report ever generated by /// the DON. In our case additional valid reports (i.e. approved by >= f+1 oracles) are not a problem, as they will /// will either be ignored (reverted as an invalid interval) or will be accepted as an additional valid price update. - constructor(StaticConfig memory staticConfig) OCR2Base(false) { + constructor( + StaticConfig memory staticConfig + ) OCR2Base(false) { if ( staticConfig.onRamp == address(0) || staticConfig.chainSelector == 0 || staticConfig.sourceChainSelector == 0 || staticConfig.rmnProxy == address(0) @@ -113,7 +115,9 @@ contract CommitStore is ICommitStore, ITypeAndVersion, OCR2Base { /// @notice Sets the minimum sequence number. /// @param minSeqNr The new minimum sequence number. - function setMinSeqNr(uint64 minSeqNr) external onlyOwner { + function setMinSeqNr( + uint64 minSeqNr + ) external onlyOwner { uint64 oldSeqNum = s_minSeqNr; s_minSeqNr = minSeqNr; @@ -129,7 +133,9 @@ contract CommitStore is ICommitStore, ITypeAndVersion, OCR2Base { /// @notice Sets the latest epoch and round for price update. /// @param latestPriceEpochAndRound The new epoch and round for prices. - function setLatestPriceEpochAndRound(uint40 latestPriceEpochAndRound) external onlyOwner { + function setLatestPriceEpochAndRound( + uint40 latestPriceEpochAndRound + ) external onlyOwner { uint40 oldEpochAndRound = s_latestPriceEpochAndRound; s_latestPriceEpochAndRound = latestPriceEpochAndRound; @@ -142,14 +148,18 @@ contract CommitStore is ICommitStore, ITypeAndVersion, OCR2Base { /// @param root The merkle root to check the commit status for. /// @return the timestamp of the committed root or zero in the case that it was never /// committed. - function getMerkleRoot(bytes32 root) external view returns (uint256) { + function getMerkleRoot( + bytes32 root + ) external view returns (uint256) { return s_roots[root]; } /// @notice Returns if a root is blessed or not. /// @param root The merkle root to check the blessing status for. /// @return whether the root is blessed or not. - function isBlessed(bytes32 root) public view returns (bool) { + function isBlessed( + bytes32 root + ) public view returns (bool) { return IRMN(i_rmnProxy).isBlessed(IRMN.TaggedRoot({commitStore: address(this), root: root})); } @@ -157,7 +167,9 @@ contract CommitStore is ICommitStore, ITypeAndVersion, OCR2Base { /// posted and needs to be removed. The interval in the report is trusted. /// @param rootToReset The roots that will be reset. This function will only /// reset roots that are not blessed. - function resetUnblessedRoots(bytes32[] calldata rootToReset) external onlyOwner { + function resetUnblessedRoots( + bytes32[] calldata rootToReset + ) external onlyOwner { for (uint256 i = 0; i < rootToReset.length; ++i) { bytes32 root = rootToReset[i]; if (!isBlessed(root)) { @@ -255,7 +267,9 @@ contract CommitStore is ICommitStore, ITypeAndVersion, OCR2Base { } /// @notice Sets the dynamic config. This function is called during `setOCR2Config` flow - function _beforeSetConfig(bytes memory onchainConfig) internal override { + function _beforeSetConfig( + bytes memory onchainConfig + ) internal override { DynamicConfig memory dynamicConfig = abi.decode(onchainConfig, (DynamicConfig)); if (dynamicConfig.priceRegistry == address(0)) revert InvalidCommitStoreConfig(); diff --git a/contracts/src/v0.8/ccip/FeeQuoter.sol b/contracts/src/v0.8/ccip/FeeQuoter.sol index 9c6d6a5331..efb0a420f2 100644 --- a/contracts/src/v0.8/ccip/FeeQuoter.sol +++ b/contracts/src/v0.8/ccip/FeeQuoter.sol @@ -238,7 +238,9 @@ contract FeeQuoter is AuthorizedCallers, IFeeQuoter, ITypeAndVersion, IReceiver, // ================================================================ /// @inheritdoc IPriceRegistry - function getTokenPrice(address token) public view override returns (Internal.TimestampedPackedUint224 memory) { + function getTokenPrice( + address token + ) public view override returns (Internal.TimestampedPackedUint224 memory) { Internal.TimestampedPackedUint224 memory tokenPrice = s_usdPerToken[token]; // If the token price is not stale, return it @@ -261,14 +263,18 @@ contract FeeQuoter is AuthorizedCallers, IFeeQuoter, ITypeAndVersion, IReceiver, /// @notice Get the `tokenPrice` for a given token, checks if the price is valid. /// @param token The token to get the price for. /// @return tokenPrice The tokenPrice for the given token if it exists and is valid. - function getValidatedTokenPrice(address token) external view returns (uint224) { + function getValidatedTokenPrice( + address token + ) external view returns (uint224) { return _getValidatedTokenPrice(token); } /// @notice Get the `tokenPrice` for an array of tokens. /// @param tokens The tokens to get prices for. /// @return tokenPrices The tokenPrices for the given tokens. - function getTokenPrices(address[] calldata tokens) external view returns (Internal.TimestampedPackedUint224[] memory) { + function getTokenPrices( + address[] calldata tokens + ) external view returns (Internal.TimestampedPackedUint224[] memory) { uint256 length = tokens.length; Internal.TimestampedPackedUint224[] memory tokenPrices = new Internal.TimestampedPackedUint224[](length); for (uint256 i = 0; i < length; ++i) { @@ -280,7 +286,9 @@ contract FeeQuoter is AuthorizedCallers, IFeeQuoter, ITypeAndVersion, IReceiver, /// @notice Returns the token price data feed configuration /// @param token The token to retrieve the feed config for /// @return tokenPriceFeedConfig The token price data feed config (if feed address is 0, the feed config is disabled) - function getTokenPriceFeedConfig(address token) external view returns (TokenPriceFeedConfig memory) { + function getTokenPriceFeedConfig( + address token + ) external view returns (TokenPriceFeedConfig memory) { return s_usdPriceFeedsPerToken[token]; } @@ -338,7 +346,9 @@ contract FeeQuoter is AuthorizedCallers, IFeeQuoter, ITypeAndVersion, IReceiver, /// @notice Gets the token price for a given token and reverts if the token is not supported /// @param token The address of the token to get the price for /// @return tokenPriceValue The token price - function _getValidatedTokenPrice(address token) internal view returns (uint224) { + function _getValidatedTokenPrice( + address token + ) internal view returns (uint224) { Internal.TimestampedPackedUint224 memory tokenPrice = getTokenPrice(token); // Token price must be set at least once if (tokenPrice.timestamp == 0 || tokenPrice.value == 0) revert TokenNotSupported(token); @@ -436,7 +446,9 @@ contract FeeQuoter is AuthorizedCallers, IFeeQuoter, ITypeAndVersion, IReceiver, // ================================================================ /// @inheritdoc IPriceRegistry - function updatePrices(Internal.PriceUpdates calldata priceUpdates) external override { + function updatePrices( + Internal.PriceUpdates calldata priceUpdates + ) external override { // The caller must be the fee updater _validateCaller(); @@ -461,13 +473,17 @@ contract FeeQuoter is AuthorizedCallers, IFeeQuoter, ITypeAndVersion, IReceiver, /// @notice Updates the USD token price feeds for given tokens /// @param tokenPriceFeedUpdates Token price feed updates to apply - function updateTokenPriceFeeds(TokenPriceFeedUpdate[] memory tokenPriceFeedUpdates) external onlyOwner { + function updateTokenPriceFeeds( + TokenPriceFeedUpdate[] memory tokenPriceFeedUpdates + ) external onlyOwner { _updateTokenPriceFeeds(tokenPriceFeedUpdates); } /// @notice Updates the USD token price feeds for given tokens /// @param tokenPriceFeedUpdates Token price feed updates to apply - function _updateTokenPriceFeeds(TokenPriceFeedUpdate[] memory tokenPriceFeedUpdates) private { + function _updateTokenPriceFeeds( + TokenPriceFeedUpdate[] memory tokenPriceFeedUpdates + ) private { for (uint256 i; i < tokenPriceFeedUpdates.length; ++i) { TokenPriceFeedUpdate memory update = tokenPriceFeedUpdates[i]; address sourceToken = update.sourceToken; @@ -607,7 +623,9 @@ contract FeeQuoter is AuthorizedCallers, IFeeQuoter, ITypeAndVersion, IReceiver, /// @notice Gets the fee configuration for a token. /// @param token The token to get the fee configuration for. /// @return premiumMultiplierWeiPerEth The multiplier for destination chain specific premiums. - function getPremiumMultiplierWeiPerEth(address token) external view returns (uint64 premiumMultiplierWeiPerEth) { + function getPremiumMultiplierWeiPerEth( + address token + ) external view returns (uint64 premiumMultiplierWeiPerEth) { return s_premiumMultiplierWeiPerEth[token]; } @@ -967,18 +985,24 @@ contract FeeQuoter is AuthorizedCallers, IFeeQuoter, ITypeAndVersion, IReceiver, /// @notice Returns the configured config for the dest chain selector. /// @param destChainSelector Destination chain selector to fetch config for. /// @return destChainConfig Config for the destination chain. - function getDestChainConfig(uint64 destChainSelector) external view returns (DestChainConfig memory) { + function getDestChainConfig( + uint64 destChainSelector + ) external view returns (DestChainConfig memory) { return s_destChainConfigs[destChainSelector]; } /// @notice Updates the destination chain specific config. /// @param destChainConfigArgs Array of source chain specific configs. - function applyDestChainConfigUpdates(DestChainConfigArgs[] memory destChainConfigArgs) external onlyOwner { + function applyDestChainConfigUpdates( + DestChainConfigArgs[] memory destChainConfigArgs + ) external onlyOwner { _applyDestChainConfigUpdates(destChainConfigArgs); } /// @notice Internal version of applyDestChainConfigUpdates. - function _applyDestChainConfigUpdates(DestChainConfigArgs[] memory destChainConfigArgs) internal { + function _applyDestChainConfigUpdates( + DestChainConfigArgs[] memory destChainConfigArgs + ) internal { for (uint256 i = 0; i < destChainConfigArgs.length; ++i) { DestChainConfigArgs memory destChainConfigArg = destChainConfigArgs[i]; uint64 destChainSelector = destChainConfigArgs[i].destChainSelector; diff --git a/contracts/src/v0.8/ccip/MultiAggregateRateLimiter.sol b/contracts/src/v0.8/ccip/MultiAggregateRateLimiter.sol index 3935d6fab9..7dfcc0ef60 100644 --- a/contracts/src/v0.8/ccip/MultiAggregateRateLimiter.sol +++ b/contracts/src/v0.8/ccip/MultiAggregateRateLimiter.sol @@ -75,7 +75,9 @@ contract MultiAggregateRateLimiter is IMessageInterceptor, AuthorizedCallers, IT } /// @inheritdoc IMessageInterceptor - function onInboundMessage(Client.Any2EVMMessage memory message) external onlyAuthorizedCallers { + function onInboundMessage( + Client.Any2EVMMessage memory message + ) external onlyAuthorizedCallers { _applyRateLimit(message.sourceChainSelector, message.destTokenAmounts, false); } @@ -130,7 +132,9 @@ contract MultiAggregateRateLimiter is IMessageInterceptor, AuthorizedCallers, IT /// @notice Retrieves the token value for a token using the FeeQuoter. /// @param tokenAmount The token and amount to get the value for. /// @return tokenValue USD value in 18 decimals. - function _getTokenValue(Client.EVMTokenAmount memory tokenAmount) internal view returns (uint256) { + function _getTokenValue( + Client.EVMTokenAmount memory tokenAmount + ) internal view returns (uint256) { // not fetching validated price, as price staleness is not important for value-based rate limiting // we only need to verify the price is not 0 uint224 pricePerToken = IFeeQuoter(s_feeQuoter).getTokenPrice(tokenAmount.token).value; @@ -154,7 +158,9 @@ contract MultiAggregateRateLimiter is IMessageInterceptor, AuthorizedCallers, IT /// @notice Applies the provided rate limiter config updates. /// @param rateLimiterUpdates Rate limiter updates. /// @dev Only callable by the owner. - function applyRateLimiterConfigUpdates(RateLimiterConfigArgs[] memory rateLimiterUpdates) external onlyOwner { + function applyRateLimiterConfigUpdates( + RateLimiterConfigArgs[] memory rateLimiterUpdates + ) external onlyOwner { for (uint256 i = 0; i < rateLimiterUpdates.length; ++i) { RateLimiterConfigArgs memory updateArgs = rateLimiterUpdates[i]; RateLimiter.Config memory configUpdate = updateArgs.rateLimiterConfig; @@ -253,14 +259,18 @@ contract MultiAggregateRateLimiter is IMessageInterceptor, AuthorizedCallers, IT /// @notice Sets the FeeQuoter address. /// @param newFeeQuoter the address of the new FeeQuoter. /// @dev precondition The address must be a non-zero address. - function setFeeQuoter(address newFeeQuoter) external onlyOwner { + function setFeeQuoter( + address newFeeQuoter + ) external onlyOwner { _setFeeQuoter(newFeeQuoter); } /// @notice Sets the FeeQuoter address. /// @param newFeeQuoter the address of the new FeeQuoter. /// @dev precondition The address must be a non-zero address. - function _setFeeQuoter(address newFeeQuoter) internal { + function _setFeeQuoter( + address newFeeQuoter + ) internal { if (newFeeQuoter == address(0)) { revert ZeroAddressNotAllowed(); } diff --git a/contracts/src/v0.8/ccip/NonceManager.sol b/contracts/src/v0.8/ccip/NonceManager.sol index 5932e88b9c..a1db80aa7c 100644 --- a/contracts/src/v0.8/ccip/NonceManager.sol +++ b/contracts/src/v0.8/ccip/NonceManager.sol @@ -39,7 +39,9 @@ contract NonceManager is INonceManager, AuthorizedCallers, ITypeAndVersion { /// executed in the same order they are sent (assuming they are DON) mapping(uint64 sourceChainSelector => mapping(bytes sender => uint64 inboundNonce)) private s_inboundNonces; - constructor(address[] memory authorizedCallers) AuthorizedCallers(authorizedCallers) {} + constructor( + address[] memory authorizedCallers + ) AuthorizedCallers(authorizedCallers) {} /// @inheritdoc INonceManager function getIncrementedOutboundNonce( @@ -123,7 +125,9 @@ contract NonceManager is INonceManager, AuthorizedCallers, ITypeAndVersion { /// @notice Updates the previous ramps addresses. /// @param previousRampsArgs The previous on/off ramps addresses. - function applyPreviousRampsUpdates(PreviousRampsArgs[] calldata previousRampsArgs) external onlyOwner { + function applyPreviousRampsUpdates( + PreviousRampsArgs[] calldata previousRampsArgs + ) external onlyOwner { for (uint256 i = 0; i < previousRampsArgs.length; ++i) { PreviousRampsArgs calldata previousRampsArg = previousRampsArgs[i]; @@ -146,7 +150,9 @@ contract NonceManager is INonceManager, AuthorizedCallers, ITypeAndVersion { /// @notice Gets the previous onRamp address for the given chain selector /// @param chainSelector The chain selector /// @return previousRamps The previous on/offRamp addresses - function getPreviousRamps(uint64 chainSelector) external view returns (PreviousRamps memory) { + function getPreviousRamps( + uint64 chainSelector + ) external view returns (PreviousRamps memory) { return s_previousRamps[chainSelector]; } } diff --git a/contracts/src/v0.8/ccip/RMN.sol b/contracts/src/v0.8/ccip/RMN.sol index 3b9af7e0ce..fd1746f3fd 100644 --- a/contracts/src/v0.8/ccip/RMN.sol +++ b/contracts/src/v0.8/ccip/RMN.sol @@ -190,7 +190,9 @@ contract RMN is IRMN, OwnerIsCreator, ITypeAndVersion { /// 1. Cursedness is retained from a prior config. /// 2. The curse weight threshold was met at some point, which activated a curse, and enough voters unvoted to curse /// such that the curse weight threshold is no longer met. - function _shouldCurseBeActive(CurseVoteProgress storage sptr_upToDateCurseVoteProgress) internal view returns (bool) { + function _shouldCurseBeActive( + CurseVoteProgress storage sptr_upToDateCurseVoteProgress + ) internal view returns (bool) { return sptr_upToDateCurseVoteProgress.latestVoteToCurseByCurseVoteAddr[OWNER_CURSE_VOTE_ADDR].cursesHash != NO_VOTES_CURSES_HASH || sptr_upToDateCurseVoteProgress.accumulatedWeight >= sptr_upToDateCurseVoteProgress.curseWeightThreshold; @@ -291,7 +293,9 @@ contract RMN is IRMN, OwnerIsCreator, ITypeAndVersion { // Prevents a subject from receiving multiple votes to curse with the same curse id. error SubjectsMustBeStrictlyIncreasing(); - constructor(Config memory config) { + constructor( + Config memory config + ) { { // Ensure that the bitmap is large enough to hold MAX_NUM_VOTERS. // We do this in the constructor because MAX_NUM_VOTERS is constant. @@ -316,7 +320,9 @@ contract RMN is IRMN, OwnerIsCreator, ITypeAndVersion { return bitmap | (uint200(1) << index); } - function _bitmapCount(uint200 bitmap) internal pure returns (uint8 oneBits) { + function _bitmapCount( + uint200 bitmap + ) internal pure returns (uint8 oneBits) { assert(bitmap < 1 << MAX_NUM_VOTERS); // https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetKernighan for (; bitmap != 0; ++oneBits) { @@ -324,7 +330,9 @@ contract RMN is IRMN, OwnerIsCreator, ITypeAndVersion { } } - function _taggedRootHash(IRMN.TaggedRoot memory taggedRoot) internal pure returns (bytes32) { + function _taggedRootHash( + IRMN.TaggedRoot memory taggedRoot + ) internal pure returns (bytes32) { return keccak256(abi.encode(taggedRoot.commitStore, taggedRoot.root)); } @@ -340,7 +348,9 @@ contract RMN is IRMN, OwnerIsCreator, ITypeAndVersion { /// /* address */, taggedRoot.root /* bytes32 */))`. /// @notice Tagged roots which are already (voted to be) blessed are skipped and emit corresponding events. In case /// the call has no effect, i.e., all passed tagged roots are skipped, the function reverts with a `VoteToBlessNoop`. - function voteToBless(IRMN.TaggedRoot[] calldata taggedRoots) external { + function voteToBless( + IRMN.TaggedRoot[] calldata taggedRoots + ) external { // If we have an active global curse, something is really wrong. Let's err on the // side of caution and not accept further blessings during this time of // uncertainty. @@ -402,7 +412,9 @@ contract RMN is IRMN, OwnerIsCreator, ITypeAndVersion { /// scenario. The owner must ensure that there are no in-flight transactions by RMN nodes voting for any of the /// taggedRoots before calling this function, as such in-flight transactions could lead to the roots becoming /// re-blessed shortly after the call to this function, contrary to the original intention. - function ownerResetBlessVotes(IRMN.TaggedRoot[] calldata taggedRoots) external onlyOwner { + function ownerResetBlessVotes( + IRMN.TaggedRoot[] calldata taggedRoots + ) external onlyOwner { uint32 configVersion = s_versionedConfig.configVersion; for (uint256 i = 0; i < taggedRoots.length; ++i) { IRMN.TaggedRoot memory taggedRoot = taggedRoots[i]; @@ -510,7 +522,9 @@ contract RMN is IRMN, OwnerIsCreator, ITypeAndVersion { /// We expect this to be called very rarely, e.g. in case of a bug in the /// offchain code causing false voteToCurse calls. /// @notice Should be called from curser's corresponding curseVoteAddr. - function unvoteToCurse(UnvoteToCurseRequest[] memory unvoteToCurseRequests) external { + function unvoteToCurse( + UnvoteToCurseRequest[] memory unvoteToCurseRequests + ) external { address curseVoteAddr = msg.sender; CurserRecord storage sptr_curserRecord = s_curserRecords[curseVoteAddr]; @@ -635,7 +649,9 @@ contract RMN is IRMN, OwnerIsCreator, ITypeAndVersion { /// @notice Enables the owner to remove curse votes. After the curse votes are removed, /// this function will check whether the curse is still valid and restore the uncursed state if possible. /// This function also enables the owner to lift a curse created through ownerCurse. - function ownerUnvoteToCurse(OwnerUnvoteToCurseRequest[] memory ownerUnvoteToCurseRequests) external onlyOwner { + function ownerUnvoteToCurse( + OwnerUnvoteToCurseRequest[] memory ownerUnvoteToCurseRequests + ) external onlyOwner { bool anyCurseWasLifted = false; bool anyVoteWasUnvoted = false; uint32 configVersion = s_versionedConfig.configVersion; @@ -667,7 +683,9 @@ contract RMN is IRMN, OwnerIsCreator, ITypeAndVersion { } } - function setConfig(Config memory config) external onlyOwner { + function setConfig( + Config memory config + ) external onlyOwner { _setConfig(config); } @@ -695,7 +713,9 @@ contract RMN is IRMN, OwnerIsCreator, ITypeAndVersion { } /// @inheritdoc IRMN - function isBlessed(IRMN.TaggedRoot calldata taggedRoot) external view returns (bool) { + function isBlessed( + IRMN.TaggedRoot calldata taggedRoot + ) external view returns (bool) { return s_blessVoteProgressByTaggedRootHash[_taggedRootHash(taggedRoot)].weightThresholdMet || s_permaBlessedCommitStores.contains(taggedRoot.commitStore); } @@ -711,7 +731,9 @@ contract RMN is IRMN, OwnerIsCreator, ITypeAndVersion { } /// @inheritdoc IRMN - function isCursed(bytes16 subject) public view returns (bool) { + function isCursed( + bytes16 subject + ) public view returns (bool) { if (s_curseHotVars.numSubjectsCursed == 0) { return false; // happy path costs a single SLOAD } else { @@ -864,7 +886,9 @@ contract RMN is IRMN, OwnerIsCreator, ITypeAndVersion { return page; } - function _validateConfig(Config memory config) internal pure returns (bool) { + function _validateConfig( + Config memory config + ) internal pure returns (bool) { if ( config.voters.length == 0 || config.voters.length > MAX_NUM_VOTERS || config.blessWeightThreshold == 0 || config.curseWeightThreshold == 0 @@ -905,7 +929,9 @@ contract RMN is IRMN, OwnerIsCreator, ITypeAndVersion { return totalBlessWeight >= config.blessWeightThreshold && totalCurseWeight >= config.curseWeightThreshold; } - function _setConfig(Config memory config) private { + function _setConfig( + Config memory config + ) private { if (!_validateConfig(config)) revert InvalidConfig(); // We can't directly assign s_versionedConfig.config to config diff --git a/contracts/src/v0.8/ccip/Router.sol b/contracts/src/v0.8/ccip/Router.sol index a5474fdd04..d83216fb6f 100644 --- a/contracts/src/v0.8/ccip/Router.sol +++ b/contracts/src/v0.8/ccip/Router.sol @@ -89,7 +89,9 @@ contract Router is IRouter, IRouterClient, ITypeAndVersion, OwnerIsCreator { } /// @notice This functionality has been removed and will revert when called. - function getSupportedTokens(uint64 chainSelector) external view returns (address[] memory) { + function getSupportedTokens( + uint64 chainSelector + ) external view returns (address[] memory) { if (!isChainSupported(chainSelector)) { return new address[](0); } @@ -97,7 +99,9 @@ contract Router is IRouter, IRouterClient, ITypeAndVersion, OwnerIsCreator { } /// @inheritdoc IRouterClient - function isChainSupported(uint64 chainSelector) public view returns (bool) { + function isChainSupported( + uint64 chainSelector + ) public view returns (bool) { return s_onRamps[chainSelector] != address(0); } @@ -192,7 +196,9 @@ contract Router is IRouter, IRouterClient, ITypeAndVersion, OwnerIsCreator { /// @notice Sets a new wrapped native token. /// @param wrappedNative The address of the new wrapped native ERC20 token. - function setWrappedNative(address wrappedNative) external onlyOwner { + function setWrappedNative( + address wrappedNative + ) external onlyOwner { s_wrappedNative = wrappedNative; } @@ -203,7 +209,9 @@ contract Router is IRouter, IRouterClient, ITypeAndVersion, OwnerIsCreator { } /// @inheritdoc IRouter - function getOnRamp(uint64 destChainSelector) external view returns (address) { + function getOnRamp( + uint64 destChainSelector + ) external view returns (address) { return s_onRamps[destChainSelector]; } diff --git a/contracts/src/v0.8/ccip/applications/CCIPClientExample.sol b/contracts/src/v0.8/ccip/applications/CCIPClientExample.sol index 82de08ea64..56f3cd1fe8 100644 --- a/contracts/src/v0.8/ccip/applications/CCIPClientExample.sol +++ b/contracts/src/v0.8/ccip/applications/CCIPClientExample.sol @@ -53,7 +53,9 @@ contract CCIPClientExample is CCIPReceiver, OwnerIsCreator { s_chains[chainSelector] = extraArgs; } - function disableChain(uint64 chainSelector) external onlyOwner { + function disableChain( + uint64 chainSelector + ) external onlyOwner { delete s_chains[chainSelector]; } @@ -66,7 +68,9 @@ contract CCIPClientExample is CCIPReceiver, OwnerIsCreator { _ccipReceive(message); } - function _ccipReceive(Client.Any2EVMMessage memory message) internal override { + function _ccipReceive( + Client.Any2EVMMessage memory message + ) internal override { emit MessageReceived(message.messageId); } @@ -162,7 +166,9 @@ contract CCIPClientExample is CCIPReceiver, OwnerIsCreator { emit MessageSent(messageId); } - modifier validChain(uint64 chainSelector) { + modifier validChain( + uint64 chainSelector + ) { if (s_chains[chainSelector].length == 0) revert InvalidChain(chainSelector); _; } diff --git a/contracts/src/v0.8/ccip/applications/CCIPReceiver.sol b/contracts/src/v0.8/ccip/applications/CCIPReceiver.sol index 208c4e47ce..8caeb3fcca 100644 --- a/contracts/src/v0.8/ccip/applications/CCIPReceiver.sol +++ b/contracts/src/v0.8/ccip/applications/CCIPReceiver.sol @@ -11,7 +11,9 @@ import {IERC165} from "../../vendor/openzeppelin-solidity/v5.0.2/contracts/utils abstract contract CCIPReceiver is IAny2EVMMessageReceiver, IERC165 { address internal immutable i_ccipRouter; - constructor(address router) { + constructor( + address router + ) { if (router == address(0)) revert InvalidRouter(address(0)); i_ccipRouter = router; } @@ -26,18 +28,24 @@ abstract contract CCIPReceiver is IAny2EVMMessageReceiver, IERC165 { /// If this returns true, tokens are transferred and ccipReceive is called atomically. /// Additionally, if the receiver address does not have code associated with /// it at the time of execution (EXTCODESIZE returns 0), only tokens will be transferred. - function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) public view virtual override returns (bool) { return interfaceId == type(IAny2EVMMessageReceiver).interfaceId || interfaceId == type(IERC165).interfaceId; } /// @inheritdoc IAny2EVMMessageReceiver - function ccipReceive(Client.Any2EVMMessage calldata message) external virtual override onlyRouter { + function ccipReceive( + Client.Any2EVMMessage calldata message + ) external virtual override onlyRouter { _ccipReceive(message); } /// @notice Override this function in your implementation. /// @param message Any2EVMMessage - function _ccipReceive(Client.Any2EVMMessage memory message) internal virtual; + function _ccipReceive( + Client.Any2EVMMessage memory message + ) internal virtual; ///////////////////////////////////////////////////////////////////// // Plumbing diff --git a/contracts/src/v0.8/ccip/applications/DefensiveExample.sol b/contracts/src/v0.8/ccip/applications/DefensiveExample.sol index f0501b5d90..dbe8550933 100644 --- a/contracts/src/v0.8/ccip/applications/DefensiveExample.sol +++ b/contracts/src/v0.8/ccip/applications/DefensiveExample.sol @@ -101,7 +101,9 @@ contract DefensiveExample is CCIPClientExample { } // An example function to demonstrate recovery - function setSimRevert(bool simRevert) external onlyOwner { + function setSimRevert( + bool simRevert + ) external onlyOwner { s_simRevert = simRevert; } diff --git a/contracts/src/v0.8/ccip/applications/EtherSenderReceiver.sol b/contracts/src/v0.8/ccip/applications/EtherSenderReceiver.sol index 05d604d9c1..5bb0193c33 100644 --- a/contracts/src/v0.8/ccip/applications/EtherSenderReceiver.sol +++ b/contracts/src/v0.8/ccip/applications/EtherSenderReceiver.sol @@ -43,7 +43,9 @@ contract EtherSenderReceiver is CCIPReceiver, ITypeAndVersion { IWrappedNative public immutable i_weth; /// @param router The CCIP router address. - constructor(address router) CCIPReceiver(router) { + constructor( + address router + ) CCIPReceiver(router) { i_weth = IWrappedNative(CCIPRouter(router).getWrappedNative()); i_weth.approve(router, type(uint256).max); } @@ -130,7 +132,9 @@ contract EtherSenderReceiver is CCIPReceiver, ITypeAndVersion { return validatedMessage; } - function _validateFeeToken(Client.EVM2AnyMessage calldata message) internal view { + function _validateFeeToken( + Client.EVM2AnyMessage calldata message + ) internal view { uint256 tokenAmount = message.tokenAmounts[0].amount; if (message.feeToken != address(0)) { @@ -146,7 +150,9 @@ contract EtherSenderReceiver is CCIPReceiver, ITypeAndVersion { /// @param message The CCIP message containing the wrapped ether amount and the final receiver. /// @dev The code below should never revert if the message being is valid according /// to the above _validatedMessage and _validateFeeToken functions. - function _ccipReceive(Client.Any2EVMMessage memory message) internal override { + function _ccipReceive( + Client.Any2EVMMessage memory message + ) internal override { address receiver = abi.decode(message.data, (address)); if (message.destTokenAmounts.length != 1) { diff --git a/contracts/src/v0.8/ccip/applications/PingPongDemo.sol b/contracts/src/v0.8/ccip/applications/PingPongDemo.sol index 567ad3c27d..3fd3eec6ee 100644 --- a/contracts/src/v0.8/ccip/applications/PingPongDemo.sol +++ b/contracts/src/v0.8/ccip/applications/PingPongDemo.sol @@ -50,7 +50,9 @@ contract PingPongDemo is CCIPReceiver, OwnerIsCreator, ITypeAndVersion { _respond(1); } - function _respond(uint256 pingPongCount) internal virtual { + function _respond( + uint256 pingPongCount + ) internal virtual { if (pingPongCount & 1 == 1) { emit Ping(pingPongCount); } else { @@ -68,7 +70,9 @@ contract PingPongDemo is CCIPReceiver, OwnerIsCreator, ITypeAndVersion { IRouterClient(getRouter()).ccipSend(s_counterpartChainSelector, message); } - function _ccipReceive(Client.Any2EVMMessage memory message) internal override { + function _ccipReceive( + Client.Any2EVMMessage memory message + ) internal override { uint256 pingPongCount = abi.decode(message.data, (uint256)); if (!s_isPaused) { _respond(pingPongCount + 1); @@ -83,7 +87,9 @@ contract PingPongDemo is CCIPReceiver, OwnerIsCreator, ITypeAndVersion { return s_counterpartChainSelector; } - function setCounterpartChainSelector(uint64 chainSelector) external onlyOwner { + function setCounterpartChainSelector( + uint64 chainSelector + ) external onlyOwner { s_counterpartChainSelector = chainSelector; } @@ -95,7 +101,9 @@ contract PingPongDemo is CCIPReceiver, OwnerIsCreator, ITypeAndVersion { return s_feeToken; } - function setCounterpartAddress(address addr) external onlyOwner { + function setCounterpartAddress( + address addr + ) external onlyOwner { s_counterpartAddress = addr; } @@ -103,7 +111,9 @@ contract PingPongDemo is CCIPReceiver, OwnerIsCreator, ITypeAndVersion { return s_isPaused; } - function setPaused(bool pause) external onlyOwner { + function setPaused( + bool pause + ) external onlyOwner { s_isPaused = pause; } @@ -111,7 +121,9 @@ contract PingPongDemo is CCIPReceiver, OwnerIsCreator, ITypeAndVersion { return s_outOfOrderExecution; } - function setOutOfOrderExecution(bool outOfOrderExecution) external onlyOwner { + function setOutOfOrderExecution( + bool outOfOrderExecution + ) external onlyOwner { s_outOfOrderExecution = outOfOrderExecution; emit OutOfOrderExecutionChange(outOfOrderExecution); } diff --git a/contracts/src/v0.8/ccip/applications/SelfFundedPingPong.sol b/contracts/src/v0.8/ccip/applications/SelfFundedPingPong.sol index 09c81ad5de..fe807a7cfa 100644 --- a/contracts/src/v0.8/ccip/applications/SelfFundedPingPong.sol +++ b/contracts/src/v0.8/ccip/applications/SelfFundedPingPong.sol @@ -23,7 +23,9 @@ contract SelfFundedPingPong is PingPongDemo { s_countIncrBeforeFunding = roundTripsBeforeFunding * 2; } - function _respond(uint256 pingPongCount) internal override { + function _respond( + uint256 pingPongCount + ) internal override { if (pingPongCount & 1 == 1) { emit Ping(pingPongCount); } else { @@ -45,7 +47,9 @@ contract SelfFundedPingPong is PingPongDemo { /// @notice A function that is responsible for funding this contract. /// The contract can only be funded if it is set as a nop in the target onRamp. /// In case your contract is not a nop you can prevent this function from being called by setting s_countIncrBeforeFunding=0. - function fundPingPong(uint256 pingPongCount) public { + function fundPingPong( + uint256 pingPongCount + ) public { // If selfFunding is disabled, or ping pong count has not reached s_countIncrPerFunding, do not attempt funding. if (s_countIncrBeforeFunding == 0 || pingPongCount < s_countIncrBeforeFunding) return; @@ -60,7 +64,9 @@ contract SelfFundedPingPong is PingPongDemo { return s_countIncrBeforeFunding; } - function setCountIncrBeforeFunding(uint8 countIncrBeforeFunding) external onlyOwner { + function setCountIncrBeforeFunding( + uint8 countIncrBeforeFunding + ) external onlyOwner { s_countIncrBeforeFunding = countIncrBeforeFunding; emit CountIncrBeforeFundingSet(countIncrBeforeFunding); } diff --git a/contracts/src/v0.8/ccip/applications/TokenProxy.sol b/contracts/src/v0.8/ccip/applications/TokenProxy.sol index 6fd26c076b..01d5b31430 100644 --- a/contracts/src/v0.8/ccip/applications/TokenProxy.sol +++ b/contracts/src/v0.8/ccip/applications/TokenProxy.sol @@ -64,7 +64,9 @@ contract TokenProxy is OwnerIsCreator { /// @notice Validates the message content. /// @dev Only allows a single token to be sent, and no data. - function _validateMessage(Client.EVM2AnyMessage calldata message) internal view { + function _validateMessage( + Client.EVM2AnyMessage calldata message + ) internal view { if (message.tokenAmounts.length != 1 || message.tokenAmounts[0].token != i_token) revert InvalidToken(); if (message.data.length > 0) revert NoDataAllowed(); diff --git a/contracts/src/v0.8/ccip/capability/CCIPHome.sol b/contracts/src/v0.8/ccip/capability/CCIPHome.sol index e387558946..e66e2f56ec 100644 --- a/contracts/src/v0.8/ccip/capability/CCIPHome.sol +++ b/contracts/src/v0.8/ccip/capability/CCIPHome.sol @@ -181,7 +181,9 @@ contract CCIPHome is OwnerIsCreator, ITypeAndVersion, ICapabilityConfiguration, /// @notice Constructor for the CCIPHome contract takes in the address of the capabilities registry. This address /// is the only allowed caller to mutate the configuration through beforeCapabilityConfigSet. - constructor(address capabilitiesRegistry) { + constructor( + address capabilitiesRegistry + ) { if (capabilitiesRegistry == address(0)) { revert ZeroAddressNotAllowed(); } @@ -200,7 +202,9 @@ contract CCIPHome is OwnerIsCreator, ITypeAndVersion, ICapabilityConfiguration, /// @inheritdoc IERC165 /// @dev Required for the capabilities registry to recognize this contract. - function supportsInterface(bytes4 interfaceId) external pure override returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) external pure override returns (bool) { return interfaceId == type(ICapabilityConfiguration).interfaceId || interfaceId == type(IERC165).interfaceId; } @@ -246,7 +250,9 @@ contract CCIPHome is OwnerIsCreator, ITypeAndVersion, ICapabilityConfiguration, /// @inheritdoc ICapabilityConfiguration /// @dev The CCIP capability will fetch the configuration needed directly from this contract. /// The offchain syncer will call this function, so its important that it doesn't revert. - function getCapabilityConfiguration(uint32 /* donId */ ) external pure override returns (bytes memory configuration) { + function getCapabilityConfiguration( + uint32 /* donId */ + ) external pure override returns (bytes memory configuration) { return bytes(""); } @@ -457,7 +463,9 @@ contract CCIPHome is OwnerIsCreator, ITypeAndVersion, ICapabilityConfiguration, // │ Validation │ // ================================================================ - function _validateConfig(OCR3Config memory cfg) internal view { + function _validateConfig( + OCR3Config memory cfg + ) internal view { if (cfg.chainSelector == 0) revert ChainSelectorNotSet(); if (cfg.pluginType != Internal.OCRPluginType.Commit && cfg.pluginType != Internal.OCRPluginType.Execution) { revert InvalidPluginType(); @@ -603,7 +611,9 @@ contract CCIPHome is OwnerIsCreator, ITypeAndVersion, ICapabilityConfiguration, /// @notice Helper function to ensure that a node is in the capabilities registry. /// @param p2pIds The P2P IDs of the node to check. - function _ensureInRegistry(bytes32[] memory p2pIds) internal view { + function _ensureInRegistry( + bytes32[] memory p2pIds + ) internal view { for (uint256 i = 0; i < p2pIds.length; ++i) { // TODO add a method that does the validation in the ICapabilitiesRegistry contract if (ICapabilitiesRegistry(i_capabilitiesRegistry).getNode(p2pIds[i]).p2pId == bytes32("")) { diff --git a/contracts/src/v0.8/ccip/interfaces/IAny2EVMMessageReceiver.sol b/contracts/src/v0.8/ccip/interfaces/IAny2EVMMessageReceiver.sol index 6305311050..2a38d82739 100644 --- a/contracts/src/v0.8/ccip/interfaces/IAny2EVMMessageReceiver.sol +++ b/contracts/src/v0.8/ccip/interfaces/IAny2EVMMessageReceiver.sol @@ -11,5 +11,7 @@ interface IAny2EVMMessageReceiver { /// will move to a FAILED state and become available for manual execution. /// @param message CCIP Message /// @dev Note ensure you check the msg.sender is the OffRampRouter - function ccipReceive(Client.Any2EVMMessage calldata message) external; + function ccipReceive( + Client.Any2EVMMessage calldata message + ) external; } diff --git a/contracts/src/v0.8/ccip/interfaces/IAny2EVMOffRamp.sol b/contracts/src/v0.8/ccip/interfaces/IAny2EVMOffRamp.sol index 1881dede2e..f18c6a73f5 100644 --- a/contracts/src/v0.8/ccip/interfaces/IAny2EVMOffRamp.sol +++ b/contracts/src/v0.8/ccip/interfaces/IAny2EVMOffRamp.sol @@ -5,5 +5,7 @@ interface IAny2EVMOffRamp { /// @notice Returns the the current nonce for a receiver. /// @param sender The sender address /// @return nonce The nonce value belonging to the sender address. - function getSenderNonce(address sender) external view returns (uint64 nonce); + function getSenderNonce( + address sender + ) external view returns (uint64 nonce); } diff --git a/contracts/src/v0.8/ccip/interfaces/ICapabilitiesRegistry.sol b/contracts/src/v0.8/ccip/interfaces/ICapabilitiesRegistry.sol index dac7317e41..e8bba76d42 100644 --- a/contracts/src/v0.8/ccip/interfaces/ICapabilitiesRegistry.sol +++ b/contracts/src/v0.8/ccip/interfaces/ICapabilitiesRegistry.sol @@ -27,5 +27,7 @@ interface ICapabilitiesRegistry { /// @notice Gets a node's data /// @param p2pId The P2P ID of the node to query for /// @return NodeInfo The node data - function getNode(bytes32 p2pId) external view returns (NodeInfo memory); + function getNode( + bytes32 p2pId + ) external view returns (NodeInfo memory); } diff --git a/contracts/src/v0.8/ccip/interfaces/IEVM2AnyOnRamp.sol b/contracts/src/v0.8/ccip/interfaces/IEVM2AnyOnRamp.sol index d657e148cb..c2d0d6cdb2 100644 --- a/contracts/src/v0.8/ccip/interfaces/IEVM2AnyOnRamp.sol +++ b/contracts/src/v0.8/ccip/interfaces/IEVM2AnyOnRamp.sol @@ -11,5 +11,7 @@ interface IEVM2AnyOnRamp is IEVM2AnyOnRampClient { /// @notice Get the next nonce for a given sender /// @param sender The sender to get the nonce for /// @return nonce The next nonce for the sender - function getSenderNonce(address sender) external view returns (uint64 nonce); + function getSenderNonce( + address sender + ) external view returns (uint64 nonce); } diff --git a/contracts/src/v0.8/ccip/interfaces/IEVM2AnyOnRampClient.sol b/contracts/src/v0.8/ccip/interfaces/IEVM2AnyOnRampClient.sol index 1dfae1abbc..d2fe34721b 100644 --- a/contracts/src/v0.8/ccip/interfaces/IEVM2AnyOnRampClient.sol +++ b/contracts/src/v0.8/ccip/interfaces/IEVM2AnyOnRampClient.sol @@ -23,7 +23,9 @@ interface IEVM2AnyOnRampClient { /// @notice Gets a list of all supported source chain tokens. /// @param destChainSelector The destination chain selector /// @return tokens The addresses of all tokens that this onRamp supports the given destination chain - function getSupportedTokens(uint64 destChainSelector) external view returns (address[] memory tokens); + function getSupportedTokens( + uint64 destChainSelector + ) external view returns (address[] memory tokens); /// @notice Send a message to the remote chain /// @dev only callable by the Router diff --git a/contracts/src/v0.8/ccip/interfaces/IMessageInterceptor.sol b/contracts/src/v0.8/ccip/interfaces/IMessageInterceptor.sol index c2b432426b..0432a222df 100644 --- a/contracts/src/v0.8/ccip/interfaces/IMessageInterceptor.sol +++ b/contracts/src/v0.8/ccip/interfaces/IMessageInterceptor.sol @@ -13,7 +13,9 @@ interface IMessageInterceptor { /// @notice Intercepts & validates the given OffRamp message. Reverts on validation failure /// @param message to validate - function onInboundMessage(Client.Any2EVMMessage memory message) external; + function onInboundMessage( + Client.Any2EVMMessage memory message + ) external; /// @notice Intercepts & validates the given OnRamp message. Reverts on validation failure /// @param destChainSelector remote destination chain selector where the message is being sent to diff --git a/contracts/src/v0.8/ccip/interfaces/IPool.sol b/contracts/src/v0.8/ccip/interfaces/IPool.sol index a2b9281228..3545e57fa4 100644 --- a/contracts/src/v0.8/ccip/interfaces/IPool.sol +++ b/contracts/src/v0.8/ccip/interfaces/IPool.sol @@ -28,10 +28,14 @@ interface IPoolV1 is IERC165 { /// @notice Checks whether a remote chain is supported in the token pool. /// @param remoteChainSelector The selector of the remote chain. /// @return true if the given chain is a permissioned remote chain. - function isSupportedChain(uint64 remoteChainSelector) external view returns (bool); + function isSupportedChain( + uint64 remoteChainSelector + ) external view returns (bool); /// @notice Returns if the token pool supports the given token. /// @param token The address of the token. /// @return true if the token is supported by the pool. - function isSupportedToken(address token) external view returns (bool); + function isSupportedToken( + address token + ) external view returns (bool); } diff --git a/contracts/src/v0.8/ccip/interfaces/IPriceRegistry.sol b/contracts/src/v0.8/ccip/interfaces/IPriceRegistry.sol index 583a2e890b..b20c1b7229 100644 --- a/contracts/src/v0.8/ccip/interfaces/IPriceRegistry.sol +++ b/contracts/src/v0.8/ccip/interfaces/IPriceRegistry.sol @@ -6,22 +6,30 @@ import {Internal} from "../libraries/Internal.sol"; interface IPriceRegistry { /// @notice Update the price for given tokens and gas prices for given chains. /// @param priceUpdates The price updates to apply. - function updatePrices(Internal.PriceUpdates memory priceUpdates) external; + function updatePrices( + Internal.PriceUpdates memory priceUpdates + ) external; /// @notice Get the `tokenPrice` for a given token. /// @param token The token to get the price for. /// @return tokenPrice The tokenPrice for the given token. - function getTokenPrice(address token) external view returns (Internal.TimestampedPackedUint224 memory); + function getTokenPrice( + address token + ) external view returns (Internal.TimestampedPackedUint224 memory); /// @notice Get the `tokenPrice` for a given token, checks if the price is valid. /// @param token The token to get the price for. /// @return tokenPrice The tokenPrice for the given token if it exists and is valid. - function getValidatedTokenPrice(address token) external view returns (uint224); + function getValidatedTokenPrice( + address token + ) external view returns (uint224); /// @notice Get the `tokenPrice` for an array of tokens. /// @param tokens The tokens to get prices for. /// @return tokenPrices The tokenPrices for the given tokens. - function getTokenPrices(address[] calldata tokens) external view returns (Internal.TimestampedPackedUint224[] memory); + function getTokenPrices( + address[] calldata tokens + ) external view returns (Internal.TimestampedPackedUint224[] memory); /// @notice Get an encoded `gasPrice` for a given destination chain ID. /// The 224-bit result encodes necessary gas price components. diff --git a/contracts/src/v0.8/ccip/interfaces/IRMN.sol b/contracts/src/v0.8/ccip/interfaces/IRMN.sol index a409731549..4bd8f8348f 100644 --- a/contracts/src/v0.8/ccip/interfaces/IRMN.sol +++ b/contracts/src/v0.8/ccip/interfaces/IRMN.sol @@ -10,12 +10,16 @@ interface IRMN { } /// @notice Callers MUST NOT cache the return value as a blessed tagged root could become unblessed. - function isBlessed(TaggedRoot calldata taggedRoot) external view returns (bool); + function isBlessed( + TaggedRoot calldata taggedRoot + ) external view returns (bool); /// @notice Iff there is an active global or legacy curse, this function returns true. function isCursed() external view returns (bool); /// @notice Iff there is an active global curse, or an active curse for `subject`, this function returns true. /// @param subject To check whether a particular chain is cursed, set to bytes16(uint128(chainSelector)). - function isCursed(bytes16 subject) external view returns (bool); + function isCursed( + bytes16 subject + ) external view returns (bool); } diff --git a/contracts/src/v0.8/ccip/interfaces/IRMNRemote.sol b/contracts/src/v0.8/ccip/interfaces/IRMNRemote.sol index 536a823720..3754a2fe91 100644 --- a/contracts/src/v0.8/ccip/interfaces/IRMNRemote.sol +++ b/contracts/src/v0.8/ccip/interfaces/IRMNRemote.sol @@ -35,5 +35,7 @@ interface IRMNRemote { /// @notice If there is an active global curse, or an active curse for `subject`, this function returns true. /// @param subject To check whether a particular chain is cursed, set to bytes16(uint128(chainSelector)). /// @return bool true if the provided subject is cured *or* if there is an active global curse - function isCursed(bytes16 subject) external view returns (bool); + function isCursed( + bytes16 subject + ) external view returns (bool); } diff --git a/contracts/src/v0.8/ccip/interfaces/IRouter.sol b/contracts/src/v0.8/ccip/interfaces/IRouter.sol index 7f4544fd0f..d8f19bf5df 100644 --- a/contracts/src/v0.8/ccip/interfaces/IRouter.sol +++ b/contracts/src/v0.8/ccip/interfaces/IRouter.sol @@ -26,7 +26,9 @@ interface IRouter { /// @notice Returns the configured onramp for a specific destination chain. /// @param destChainSelector The destination chain Id to get the onRamp for. /// @return onRampAddress The address of the onRamp. - function getOnRamp(uint64 destChainSelector) external view returns (address onRampAddress); + function getOnRamp( + uint64 destChainSelector + ) external view returns (address onRampAddress); /// @notice Return true if the given offRamp is a configured offRamp for the given source chain. /// @param sourceChainSelector The source chain selector to check. diff --git a/contracts/src/v0.8/ccip/interfaces/IRouterClient.sol b/contracts/src/v0.8/ccip/interfaces/IRouterClient.sol index 27913b597d..36218b36b3 100644 --- a/contracts/src/v0.8/ccip/interfaces/IRouterClient.sol +++ b/contracts/src/v0.8/ccip/interfaces/IRouterClient.sol @@ -11,7 +11,9 @@ interface IRouterClient { /// @notice Checks if the given chain ID is supported for sending/receiving. /// @param destChainSelector The chain to check. /// @return supported is true if it is supported, false if not. - function isChainSupported(uint64 destChainSelector) external view returns (bool supported); + function isChainSupported( + uint64 destChainSelector + ) external view returns (bool supported); /// @param destinationChainSelector The destination chainSelector /// @param message The cross-chain CCIP message including data and/or tokens diff --git a/contracts/src/v0.8/ccip/interfaces/ITokenAdminRegistry.sol b/contracts/src/v0.8/ccip/interfaces/ITokenAdminRegistry.sol index 0e44122901..04bacbac5a 100644 --- a/contracts/src/v0.8/ccip/interfaces/ITokenAdminRegistry.sol +++ b/contracts/src/v0.8/ccip/interfaces/ITokenAdminRegistry.sol @@ -3,7 +3,9 @@ pragma solidity ^0.8.0; interface ITokenAdminRegistry { /// @notice Returns the pool for the given token. - function getPool(address token) external view returns (address); + function getPool( + address token + ) external view returns (address); /// @notice Proposes an administrator for the given token as pending administrator. /// @param localToken The token to register the administrator for. diff --git a/contracts/src/v0.8/ccip/interfaces/IWrappedNative.sol b/contracts/src/v0.8/ccip/interfaces/IWrappedNative.sol index 4225827a61..f4f824361e 100644 --- a/contracts/src/v0.8/ccip/interfaces/IWrappedNative.sol +++ b/contracts/src/v0.8/ccip/interfaces/IWrappedNative.sol @@ -6,5 +6,7 @@ import {IERC20} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ interface IWrappedNative is IERC20 { function deposit() external payable; - function withdraw(uint256 wad) external; + function withdraw( + uint256 wad + ) external; } diff --git a/contracts/src/v0.8/ccip/interfaces/encodingutils/ICCIPEncodingUtils.sol b/contracts/src/v0.8/ccip/interfaces/encodingutils/ICCIPEncodingUtils.sol index 026c5fa50b..5cba49bc7f 100644 --- a/contracts/src/v0.8/ccip/interfaces/encodingutils/ICCIPEncodingUtils.sol +++ b/contracts/src/v0.8/ccip/interfaces/encodingutils/ICCIPEncodingUtils.sol @@ -12,5 +12,7 @@ interface ICCIPEncodingUtils { function exposeRmnReport(bytes32 rmnReportVersion, RMNRemote.Report memory rmnReport) external; /// @dev the OCR3Config Config struct is used in integration / E2E tests - function exposeOCR3Config(CCIPHome.OCR3Config[] calldata config) external view returns (bytes memory); + function exposeOCR3Config( + CCIPHome.OCR3Config[] calldata config + ) external view returns (bytes memory); } diff --git a/contracts/src/v0.8/ccip/libraries/Client.sol b/contracts/src/v0.8/ccip/libraries/Client.sol index a985371bef..de1f6f1580 100644 --- a/contracts/src/v0.8/ccip/libraries/Client.sol +++ b/contracts/src/v0.8/ccip/libraries/Client.sol @@ -33,7 +33,9 @@ library Client { uint256 gasLimit; } - function _argsToBytes(EVMExtraArgsV1 memory extraArgs) internal pure returns (bytes memory bts) { + function _argsToBytes( + EVMExtraArgsV1 memory extraArgs + ) internal pure returns (bytes memory bts) { return abi.encodeWithSelector(EVM_EXTRA_ARGS_V1_TAG, extraArgs); } @@ -49,7 +51,9 @@ library Client { bool allowOutOfOrderExecution; } - function _argsToBytes(EVMExtraArgsV2 memory extraArgs) internal pure returns (bytes memory bts) { + function _argsToBytes( + EVMExtraArgsV2 memory extraArgs + ) internal pure returns (bytes memory bts) { return abi.encodeWithSelector(EVM_EXTRA_ARGS_V2_TAG, extraArgs); } } diff --git a/contracts/src/v0.8/ccip/libraries/Internal.sol b/contracts/src/v0.8/ccip/libraries/Internal.sol index 90b36adb7b..31f107592e 100644 --- a/contracts/src/v0.8/ccip/libraries/Internal.sol +++ b/contracts/src/v0.8/ccip/libraries/Internal.sol @@ -249,7 +249,9 @@ library Internal { /// address is within the EVM address space. If it isn't it will revert with an InvalidEVMAddress error, which /// we can catch and handle more gracefully than a revert from abi.decode. /// @return The address if it is valid, the function will revert otherwise. - function _validateEVMAddress(bytes memory encodedAddress) internal pure returns (address) { + function _validateEVMAddress( + bytes memory encodedAddress + ) internal pure returns (address) { if (encodedAddress.length != 32) revert InvalidEVMAddress(encodedAddress); uint256 encodedAddressUint = abi.decode(encodedAddress, (uint256)); if (encodedAddressUint > type(uint160).max || encodedAddressUint < PRECOMPILE_SPACE) { diff --git a/contracts/src/v0.8/ccip/libraries/RateLimiter.sol b/contracts/src/v0.8/ccip/libraries/RateLimiter.sol index 84914749e0..431b772816 100644 --- a/contracts/src/v0.8/ccip/libraries/RateLimiter.sol +++ b/contracts/src/v0.8/ccip/libraries/RateLimiter.sol @@ -85,7 +85,9 @@ library RateLimiter { /// @notice Gets the token bucket with its values for the block it was requested at. /// @return The token bucket. - function _currentTokenBucketState(TokenBucket memory bucket) internal view returns (TokenBucket memory) { + function _currentTokenBucketState( + TokenBucket memory bucket + ) internal view returns (TokenBucket memory) { // We update the bucket to reflect the status at the exact time of the // call. This means we might need to refill a part of the bucket based // on the time that has passed since the last update. diff --git a/contracts/src/v0.8/ccip/ocr/MultiOCR3Base.sol b/contracts/src/v0.8/ccip/ocr/MultiOCR3Base.sol index 2e698cd230..ba1dc1e32c 100644 --- a/contracts/src/v0.8/ccip/ocr/MultiOCR3Base.sol +++ b/contracts/src/v0.8/ccip/ocr/MultiOCR3Base.sol @@ -128,7 +128,9 @@ abstract contract MultiOCR3Base is ITypeAndVersion, OwnerIsCreator { /// @dev precondition number of transmitters should match the expected F/fChain relationship. /// For transmitters, the function only validates that len(transmitters) > 0 && len(transmitters) <= MAX_NUM_ORACLES /// && len(transmitters) <= len(signers) [if sig verification is enabled] - function setOCR3Configs(OCRConfigArgs[] memory ocrConfigArgs) external onlyOwner { + function setOCR3Configs( + OCRConfigArgs[] memory ocrConfigArgs + ) external onlyOwner { for (uint256 i; i < ocrConfigArgs.length; ++i) { _setOCR3Config(ocrConfigArgs[i]); } @@ -136,7 +138,9 @@ abstract contract MultiOCR3Base is ITypeAndVersion, OwnerIsCreator { /// @notice Sets offchain reporting protocol configuration incl. participating oracles for a single OCR plugin type. /// @param ocrConfigArgs OCR config update args. - function _setOCR3Config(OCRConfigArgs memory ocrConfigArgs) internal { + function _setOCR3Config( + OCRConfigArgs memory ocrConfigArgs + ) internal { if (ocrConfigArgs.F == 0) revert InvalidConfig(InvalidConfigErrorType.F_MUST_BE_POSITIVE); uint8 ocrPluginType = ocrConfigArgs.ocrPluginType; @@ -187,7 +191,9 @@ abstract contract MultiOCR3Base is ITypeAndVersion, OwnerIsCreator { /// @notice Hook that is called after a plugin's OCR3 config changes. /// @param ocrPluginType Plugin type for which the config changed. - function _afterOCR3ConfigSet(uint8 ocrPluginType) internal virtual; + function _afterOCR3ConfigSet( + uint8 ocrPluginType + ) internal virtual; /// @notice Clears oracle roles for the provided oracle addresses. /// @param ocrPluginType OCR plugin type to clear roles for. @@ -321,7 +327,9 @@ abstract contract MultiOCR3Base is ITypeAndVersion, OwnerIsCreator { /// @notice Information about current offchain reporting protocol configuration. /// @param ocrPluginType OCR plugin type to return config details for. /// @return ocrConfig OCR config for the plugin type. - function latestConfigDetails(uint8 ocrPluginType) external view returns (OCRConfig memory ocrConfig) { + function latestConfigDetails( + uint8 ocrPluginType + ) external view returns (OCRConfig memory ocrConfig) { return s_ocrConfigs[ocrPluginType]; } } diff --git a/contracts/src/v0.8/ccip/ocr/OCR2Base.sol b/contracts/src/v0.8/ccip/ocr/OCR2Base.sol index 74c8e47917..3cd10f2c55 100644 --- a/contracts/src/v0.8/ccip/ocr/OCR2Base.sol +++ b/contracts/src/v0.8/ccip/ocr/OCR2Base.sol @@ -89,7 +89,9 @@ abstract contract OCR2Base is OwnerIsCreator, OCR2Abstract { bool internal immutable i_uniqueReports; uint256 internal immutable i_chainID; - constructor(bool uniqueReports) { + constructor( + bool uniqueReports + ) { i_uniqueReports = uniqueReports; i_chainID = block.chainid; } @@ -176,7 +178,9 @@ abstract contract OCR2Base is OwnerIsCreator, OCR2Abstract { /// @dev Hook that is run from setOCR2Config() right after validating configuration. /// Empty by default, please provide an implementation in a child contract if you need additional configuration processing - function _beforeSetConfig(bytes memory _onchainConfig) internal virtual; + function _beforeSetConfig( + bytes memory _onchainConfig + ) internal virtual; /// @return list of addresses permitted to transmit reports to this contract /// @dev The list will match the order used to specify the transmitter during setConfig diff --git a/contracts/src/v0.8/ccip/ocr/OCR2BaseNoChecks.sol b/contracts/src/v0.8/ccip/ocr/OCR2BaseNoChecks.sol index 8bada2c378..b9a2b31ef2 100644 --- a/contracts/src/v0.8/ccip/ocr/OCR2BaseNoChecks.sol +++ b/contracts/src/v0.8/ccip/ocr/OCR2BaseNoChecks.sol @@ -158,7 +158,9 @@ abstract contract OCR2BaseNoChecks is OwnerIsCreator, OCR2Abstract { /// @dev Hook that is run from setOCR2Config() right after validating configuration. /// Empty by default, please provide an implementation in a child contract if you need additional configuration processing - function _beforeSetConfig(bytes memory _onchainConfig) internal virtual; + function _beforeSetConfig( + bytes memory _onchainConfig + ) internal virtual; /// @return list of addresses permitted to transmit reports to this contract /// @dev The list will match the order used to specify the transmitter during setConfig @@ -238,5 +240,7 @@ abstract contract OCR2BaseNoChecks is OwnerIsCreator, OCR2Abstract { return (true, bytes32(0), uint32(0)); } - function _report(bytes calldata report) internal virtual; + function _report( + bytes calldata report + ) internal virtual; } diff --git a/contracts/src/v0.8/ccip/offRamp/EVM2EVMOffRamp.sol b/contracts/src/v0.8/ccip/offRamp/EVM2EVMOffRamp.sol index 0be7fe7511..c1fd117de6 100644 --- a/contracts/src/v0.8/ccip/offRamp/EVM2EVMOffRamp.sol +++ b/contracts/src/v0.8/ccip/offRamp/EVM2EVMOffRamp.sol @@ -187,7 +187,9 @@ contract EVM2EVMOffRamp is IAny2EVMOffRamp, AggregateRateLimiter, ITypeAndVersio /// @param sequenceNumber The sequence number of the message to get the execution state for. /// @return The current execution state of the message. /// @dev we use the literal number 128 because using a constant increased gas usage. - function getExecutionState(uint64 sequenceNumber) public view returns (Internal.MessageExecutionState) { + function getExecutionState( + uint64 sequenceNumber + ) public view returns (Internal.MessageExecutionState) { return Internal.MessageExecutionState( (s_executionStates[sequenceNumber / 128] >> ((sequenceNumber % 128) * MESSAGE_EXECUTION_STATE_BIT_WIDTH)) & MESSAGE_EXECUTION_STATE_MASK @@ -211,7 +213,9 @@ contract EVM2EVMOffRamp is IAny2EVMOffRamp, AggregateRateLimiter, ITypeAndVersio } /// @inheritdoc IAny2EVMOffRamp - function getSenderNonce(address sender) external view returns (uint64 nonce) { + function getSenderNonce( + address sender + ) external view returns (uint64 nonce) { uint256 senderNonce = s_senderNonce[sender]; if (senderNonce == 0) { @@ -276,7 +280,9 @@ contract EVM2EVMOffRamp is IAny2EVMOffRamp, AggregateRateLimiter, ITypeAndVersio /// @notice Entrypoint for execution, called by the OCR network /// @dev Expects an encoded ExecutionReport /// @dev Supplies no GasLimitOverrides as the DON will only execute with the original gas limits. - function _report(bytes calldata report) internal override { + function _report( + bytes calldata report + ) internal override { _execute(abi.decode(report, (Internal.ExecutionReport)), new GasLimitOverride[](0)); } @@ -540,7 +546,9 @@ contract EVM2EVMOffRamp is IAny2EVMOffRamp, AggregateRateLimiter, ITypeAndVersio } /// @notice creates a unique hash to be used in message hashing. - function _metadataHash(bytes32 prefix) internal view returns (bytes32) { + function _metadataHash( + bytes32 prefix + ) internal view returns (bytes32) { return keccak256(abi.encode(prefix, i_sourceChainSelector, i_chainSelector, i_onRamp)); } @@ -570,7 +578,9 @@ contract EVM2EVMOffRamp is IAny2EVMOffRamp, AggregateRateLimiter, ITypeAndVersio } /// @notice Sets the dynamic config. This function is called during `setOCR2Config` flow - function _beforeSetConfig(bytes memory onchainConfig) internal override { + function _beforeSetConfig( + bytes memory onchainConfig + ) internal override { DynamicConfig memory dynamicConfig = abi.decode(onchainConfig, (DynamicConfig)); if (dynamicConfig.router == address(0)) revert ZeroAddressNotAllowed(); @@ -789,7 +799,9 @@ contract EVM2EVMOffRamp is IAny2EVMOffRamp, AggregateRateLimiter, ITypeAndVersio // ================================================================ /// @notice Reverts as this contract should not access CCIP messages - function ccipReceive(Client.Any2EVMMessage calldata) external pure { + function ccipReceive( + Client.Any2EVMMessage calldata + ) external pure { // solhint-disable-next-line revert(); } diff --git a/contracts/src/v0.8/ccip/offRamp/OffRamp.sol b/contracts/src/v0.8/ccip/offRamp/OffRamp.sol index 14d5ae5c75..63232c038e 100644 --- a/contracts/src/v0.8/ccip/offRamp/OffRamp.sol +++ b/contracts/src/v0.8/ccip/offRamp/OffRamp.sol @@ -880,7 +880,9 @@ contract OffRamp is ITypeAndVersion, MultiOCR3Base { } /// @inheritdoc MultiOCR3Base - function _afterOCR3ConfigSet(uint8 ocrPluginType) internal override { + function _afterOCR3ConfigSet( + uint8 ocrPluginType + ) internal override { if (ocrPluginType == uint8(Internal.OCRPluginType.Commit)) { // Signature verification must be enabled for commit plugin if (!s_ocrConfigs[ocrPluginType].configInfo.isSignatureVerificationEnabled) { @@ -920,7 +922,9 @@ contract OffRamp is ITypeAndVersion, MultiOCR3Base { /// @notice Returns the source chain config for the provided source chain selector /// @param sourceChainSelector chain to retrieve configuration for /// @return sourceChainConfig The config for the source chain - function getSourceChainConfig(uint64 sourceChainSelector) external view returns (SourceChainConfig memory) { + function getSourceChainConfig( + uint64 sourceChainSelector + ) external view returns (SourceChainConfig memory) { return s_sourceChainConfigs[sourceChainSelector]; } @@ -938,13 +942,17 @@ contract OffRamp is ITypeAndVersion, MultiOCR3Base { /// @notice Updates source configs /// @param sourceChainConfigUpdates Source chain configs - function applySourceChainConfigUpdates(SourceChainConfigArgs[] memory sourceChainConfigUpdates) external onlyOwner { + function applySourceChainConfigUpdates( + SourceChainConfigArgs[] memory sourceChainConfigUpdates + ) external onlyOwner { _applySourceChainConfigUpdates(sourceChainConfigUpdates); } /// @notice Updates source configs /// @param sourceChainConfigUpdates Source chain configs - function _applySourceChainConfigUpdates(SourceChainConfigArgs[] memory sourceChainConfigUpdates) internal { + function _applySourceChainConfigUpdates( + SourceChainConfigArgs[] memory sourceChainConfigUpdates + ) internal { for (uint256 i = 0; i < sourceChainConfigUpdates.length; ++i) { SourceChainConfigArgs memory sourceConfigUpdate = sourceChainConfigUpdates[i]; uint64 sourceChainSelector = sourceConfigUpdate.sourceChainSelector; @@ -988,13 +996,17 @@ contract OffRamp is ITypeAndVersion, MultiOCR3Base { /// @notice Sets the dynamic config. /// @param dynamicConfig The new dynamic config. - function setDynamicConfig(DynamicConfig memory dynamicConfig) external onlyOwner { + function setDynamicConfig( + DynamicConfig memory dynamicConfig + ) external onlyOwner { _setDynamicConfig(dynamicConfig); } /// @notice Sets the dynamic config. /// @param dynamicConfig The dynamic config. - function _setDynamicConfig(DynamicConfig memory dynamicConfig) internal { + function _setDynamicConfig( + DynamicConfig memory dynamicConfig + ) internal { if (dynamicConfig.feeQuoter == address(0)) { revert ZeroAddressNotAllowed(); } @@ -1007,7 +1019,9 @@ contract OffRamp is ITypeAndVersion, MultiOCR3Base { /// @notice Returns a source chain config with a check that the config is enabled /// @param sourceChainSelector Source chain selector to check for cursing /// @return sourceChainConfig The source chain config storage pointer - function _getEnabledSourceChainConfig(uint64 sourceChainSelector) internal view returns (SourceChainConfig storage) { + function _getEnabledSourceChainConfig( + uint64 sourceChainSelector + ) internal view returns (SourceChainConfig storage) { SourceChainConfig storage sourceChainConfig = s_sourceChainConfigs[sourceChainSelector]; if (!sourceChainConfig.isEnabled) { revert SourceChainNotEnabled(sourceChainSelector); @@ -1021,7 +1035,9 @@ contract OffRamp is ITypeAndVersion, MultiOCR3Base { // ================================================================ /// @notice Reverts as this contract should not be able to receive CCIP messages - function ccipReceive(Client.Any2EVMMessage calldata) external pure { + function ccipReceive( + Client.Any2EVMMessage calldata + ) external pure { // solhint-disable-next-line revert(); } diff --git a/contracts/src/v0.8/ccip/onRamp/EVM2EVMOnRamp.sol b/contracts/src/v0.8/ccip/onRamp/EVM2EVMOnRamp.sol index 0c48b10e64..99bc27e80a 100644 --- a/contracts/src/v0.8/ccip/onRamp/EVM2EVMOnRamp.sol +++ b/contracts/src/v0.8/ccip/onRamp/EVM2EVMOnRamp.sol @@ -246,7 +246,9 @@ contract EVM2EVMOnRamp is IEVM2AnyOnRamp, ILinkAvailable, AggregateRateLimiter, } /// @inheritdoc IEVM2AnyOnRamp - function getSenderNonce(address sender) external view returns (uint64) { + function getSenderNonce( + address sender + ) external view returns (uint64) { uint256 senderNonce = s_senderNonce[sender]; if (i_prevOnRamp != address(0)) { @@ -399,7 +401,9 @@ contract EVM2EVMOnRamp is IEVM2AnyOnRamp, ILinkAvailable, AggregateRateLimiter, /// @dev Convert the extra args bytes into a struct /// @param extraArgs The extra args bytes /// @return The extra args struct - function _fromBytes(bytes calldata extraArgs) internal view returns (Client.EVMExtraArgsV2 memory) { + function _fromBytes( + bytes calldata extraArgs + ) internal view returns (Client.EVMExtraArgsV2 memory) { if (extraArgs.length == 0) { return Client.EVMExtraArgsV2({gasLimit: i_defaultTxGasLimit, allowOutOfOrderExecution: false}); } @@ -467,12 +471,16 @@ contract EVM2EVMOnRamp is IEVM2AnyOnRamp, ILinkAvailable, AggregateRateLimiter, /// @notice Sets the dynamic configuration. /// @param dynamicConfig The configuration. - function setDynamicConfig(DynamicConfig memory dynamicConfig) external onlyOwner { + function setDynamicConfig( + DynamicConfig memory dynamicConfig + ) external onlyOwner { _setDynamicConfig(dynamicConfig); } /// @notice Internal version of setDynamicConfig to allow for reuse in the constructor. - function _setDynamicConfig(DynamicConfig memory dynamicConfig) internal { + function _setDynamicConfig( + DynamicConfig memory dynamicConfig + ) internal { // We permit router to be set to zero as a way to pause the contract. if (dynamicConfig.priceRegistry == address(0)) revert InvalidConfig(); s_dynamicConfig = dynamicConfig; @@ -502,7 +510,9 @@ contract EVM2EVMOnRamp is IEVM2AnyOnRamp, ILinkAvailable, AggregateRateLimiter, } /// @inheritdoc IEVM2AnyOnRampClient - function getSupportedTokens(uint64) external pure returns (address[] memory) { + function getSupportedTokens( + uint64 + ) external pure returns (address[] memory) { revert GetSupportedTokensFunctionalityRemovedCheckAdminRegistry(); } @@ -688,20 +698,26 @@ contract EVM2EVMOnRamp is IEVM2AnyOnRamp, ILinkAvailable, AggregateRateLimiter, /// @notice Gets the fee configuration for a token /// @param token The token to get the fee configuration for /// @return feeTokenConfig FeeTokenConfig struct - function getFeeTokenConfig(address token) external view returns (FeeTokenConfig memory feeTokenConfig) { + function getFeeTokenConfig( + address token + ) external view returns (FeeTokenConfig memory feeTokenConfig) { return s_feeTokenConfig[token]; } /// @notice Sets the fee configuration for a token /// @param feeTokenConfigArgs Array of FeeTokenConfigArgs structs. - function setFeeTokenConfig(FeeTokenConfigArgs[] memory feeTokenConfigArgs) external { + function setFeeTokenConfig( + FeeTokenConfigArgs[] memory feeTokenConfigArgs + ) external { _onlyOwnerOrAdmin(); _setFeeTokenConfig(feeTokenConfigArgs); } /// @dev Set the fee config /// @param feeTokenConfigArgs The fee token configs. - function _setFeeTokenConfig(FeeTokenConfigArgs[] memory feeTokenConfigArgs) internal { + function _setFeeTokenConfig( + FeeTokenConfigArgs[] memory feeTokenConfigArgs + ) internal { for (uint256 i = 0; i < feeTokenConfigArgs.length; ++i) { FeeTokenConfigArgs memory configArg = feeTokenConfigArgs[i]; @@ -791,7 +807,9 @@ contract EVM2EVMOnRamp is IEVM2AnyOnRamp, ILinkAvailable, AggregateRateLimiter, /// @notice Sets the Nops and their weights /// @param nopsAndWeights Array of NopAndWeight structs - function setNops(NopAndWeight[] calldata nopsAndWeights) external { + function setNops( + NopAndWeight[] calldata nopsAndWeights + ) external { _onlyOwnerOrAdmin(); _setNops(nopsAndWeights); } @@ -800,7 +818,9 @@ contract EVM2EVMOnRamp is IEVM2AnyOnRamp, ILinkAvailable, AggregateRateLimiter, /// @dev Clears existing nops, sets new nops and weights /// @dev We permit fees to accrue before nops are configured, in which case /// they will go to the first set of configured nops. - function _setNops(NopAndWeight[] memory nopsAndWeights) internal { + function _setNops( + NopAndWeight[] memory nopsAndWeights + ) internal { uint256 numberOfNops = nopsAndWeights.length; if (numberOfNops > MAX_NUMBER_OF_NOPS) revert TooManyNops(); diff --git a/contracts/src/v0.8/ccip/onRamp/OnRamp.sol b/contracts/src/v0.8/ccip/onRamp/OnRamp.sol index e053baf507..d7af0d9eb2 100644 --- a/contracts/src/v0.8/ccip/onRamp/OnRamp.sol +++ b/contracts/src/v0.8/ccip/onRamp/OnRamp.sol @@ -155,7 +155,9 @@ contract OnRamp is IEVM2AnyOnRampClient, ITypeAndVersion, OwnerIsCreator { /// @notice Gets the next sequence number to be used in the onRamp /// @param destChainSelector The destination chain selector /// @return nextSequenceNumber The next sequence number to be used - function getExpectedNextSequenceNumber(uint64 destChainSelector) external view returns (uint64) { + function getExpectedNextSequenceNumber( + uint64 destChainSelector + ) external view returns (uint64) { return s_destChainConfigs[destChainSelector].sequenceNumber + 1; } @@ -329,19 +331,25 @@ contract OnRamp is IEVM2AnyOnRampClient, ITypeAndVersion, OwnerIsCreator { /// @notice Sets the dynamic configuration. /// @param dynamicConfig The configuration. - function setDynamicConfig(DynamicConfig memory dynamicConfig) external onlyOwner { + function setDynamicConfig( + DynamicConfig memory dynamicConfig + ) external onlyOwner { _setDynamicConfig(dynamicConfig); } /// @notice Gets the source router for a destination chain /// @param destChainSelector The destination chain selector /// @return router the router for the provided destination chain - function getRouter(uint64 destChainSelector) external view returns (IRouter) { + function getRouter( + uint64 destChainSelector + ) external view returns (IRouter) { return s_destChainConfigs[destChainSelector].router; } /// @notice Internal version of setDynamicConfig to allow for reuse in the constructor. - function _setDynamicConfig(DynamicConfig memory dynamicConfig) internal { + function _setDynamicConfig( + DynamicConfig memory dynamicConfig + ) internal { if ( dynamicConfig.feeQuoter == address(0) || dynamicConfig.feeAggregator == address(0) || dynamicConfig.reentrancyGuardEntered @@ -362,12 +370,16 @@ contract OnRamp is IEVM2AnyOnRampClient, ITypeAndVersion, OwnerIsCreator { /// @notice Updates destination chains specific configs. /// @param destChainConfigArgs Array of destination chain specific configs. - function applyDestChainConfigUpdates(DestChainConfigArgs[] memory destChainConfigArgs) external onlyOwner { + function applyDestChainConfigUpdates( + DestChainConfigArgs[] memory destChainConfigArgs + ) external onlyOwner { _applyDestChainConfigUpdates(destChainConfigArgs); } /// @notice Internal version of applyDestChainConfigUpdates. - function _applyDestChainConfigUpdates(DestChainConfigArgs[] memory destChainConfigArgs) internal { + function _applyDestChainConfigUpdates( + DestChainConfigArgs[] memory destChainConfigArgs + ) internal { for (uint256 i = 0; i < destChainConfigArgs.length; ++i) { DestChainConfigArgs memory destChainConfigArg = destChainConfigArgs[i]; uint64 destChainSelector = destChainConfigArgs[i].destChainSelector; @@ -404,7 +416,9 @@ contract OnRamp is IEVM2AnyOnRampClient, ITypeAndVersion, OwnerIsCreator { /// @notice get allowedSenders List configured for the DestinationChainSelector /// @param destChainSelector The destination chain selector /// @return array of allowedList of Senders - function getAllowedSendersList(uint64 destChainSelector) public view returns (address[] memory) { + function getAllowedSendersList( + uint64 destChainSelector + ) public view returns (address[] memory) { return s_destChainConfigs[destChainSelector].allowedSendersList.values(); } @@ -415,7 +429,9 @@ contract OnRamp is IEVM2AnyOnRampClient, ITypeAndVersion, OwnerIsCreator { /// @notice Updates allowListConfig for Senders /// @dev configuration used to set the list of senders who are authorized to send messages /// @param allowListConfigArgsItems Array of AllowListConfigArguments where each item is for a destChainSelector - function applyAllowListUpdates(AllowListConfigArgs[] calldata allowListConfigArgsItems) external { + function applyAllowListUpdates( + AllowListConfigArgs[] calldata allowListConfigArgsItems + ) external { if (msg.sender != owner()) { if (msg.sender != s_dynamicConfig.allowListAdmin) { revert OnlyCallableByOwnerOrAllowlistAdmin(); @@ -466,7 +482,9 @@ contract OnRamp is IEVM2AnyOnRampClient, ITypeAndVersion, OwnerIsCreator { } /// @inheritdoc IEVM2AnyOnRampClient - function getSupportedTokens(uint64 /*destChainSelector*/ ) external pure returns (address[] memory) { + function getSupportedTokens( + uint64 /*destChainSelector*/ + ) external pure returns (address[] memory) { revert GetSupportedTokensFunctionalityRemovedCheckAdminRegistry(); } diff --git a/contracts/src/v0.8/ccip/pools/BurnFromMintTokenPool.sol b/contracts/src/v0.8/ccip/pools/BurnFromMintTokenPool.sol index 4ea6664a5c..1ba13a4974 100644 --- a/contracts/src/v0.8/ccip/pools/BurnFromMintTokenPool.sol +++ b/contracts/src/v0.8/ccip/pools/BurnFromMintTokenPool.sol @@ -32,7 +32,9 @@ contract BurnFromMintTokenPool is BurnMintTokenPoolAbstract, ITypeAndVersion { } /// @inheritdoc BurnMintTokenPoolAbstract - function _burn(uint256 amount) internal virtual override { + function _burn( + uint256 amount + ) internal virtual override { IBurnMintERC20(address(i_token)).burnFrom(address(this), amount); } } diff --git a/contracts/src/v0.8/ccip/pools/BurnMintTokenPool.sol b/contracts/src/v0.8/ccip/pools/BurnMintTokenPool.sol index c48c8e51fb..33026cf005 100644 --- a/contracts/src/v0.8/ccip/pools/BurnMintTokenPool.sol +++ b/contracts/src/v0.8/ccip/pools/BurnMintTokenPool.sol @@ -24,7 +24,9 @@ contract BurnMintTokenPool is BurnMintTokenPoolAbstract, ITypeAndVersion { ) TokenPool(token, allowlist, rmnProxy, router) {} /// @inheritdoc BurnMintTokenPoolAbstract - function _burn(uint256 amount) internal virtual override { + function _burn( + uint256 amount + ) internal virtual override { IBurnMintERC20(address(i_token)).burn(amount); } } diff --git a/contracts/src/v0.8/ccip/pools/BurnMintTokenPoolAbstract.sol b/contracts/src/v0.8/ccip/pools/BurnMintTokenPoolAbstract.sol index 99908c91d0..6d743ed4a9 100644 --- a/contracts/src/v0.8/ccip/pools/BurnMintTokenPoolAbstract.sol +++ b/contracts/src/v0.8/ccip/pools/BurnMintTokenPoolAbstract.sol @@ -10,7 +10,9 @@ abstract contract BurnMintTokenPoolAbstract is TokenPool { /// @notice Contains the specific burn call for a pool. /// @dev overriding this method allows us to create pools with different burn signatures /// without duplicating the underlying logic. - function _burn(uint256 amount) internal virtual; + function _burn( + uint256 amount + ) internal virtual; /// @notice Burn the token in the pool /// @dev The _validateLockOrBurn check is an essential security check diff --git a/contracts/src/v0.8/ccip/pools/BurnWithFromMintTokenPool.sol b/contracts/src/v0.8/ccip/pools/BurnWithFromMintTokenPool.sol index b999be6981..37541bb827 100644 --- a/contracts/src/v0.8/ccip/pools/BurnWithFromMintTokenPool.sol +++ b/contracts/src/v0.8/ccip/pools/BurnWithFromMintTokenPool.sol @@ -30,7 +30,9 @@ contract BurnWithFromMintTokenPool is BurnMintTokenPoolAbstract, ITypeAndVersion } /// @inheritdoc BurnMintTokenPoolAbstract - function _burn(uint256 amount) internal virtual override { + function _burn( + uint256 amount + ) internal virtual override { IBurnMintERC20(address(i_token)).burn(address(this), amount); } diff --git a/contracts/src/v0.8/ccip/pools/LegacyPoolWrapper.sol b/contracts/src/v0.8/ccip/pools/LegacyPoolWrapper.sol index 43326681e5..90c90369d8 100644 --- a/contracts/src/v0.8/ccip/pools/LegacyPoolWrapper.sol +++ b/contracts/src/v0.8/ccip/pools/LegacyPoolWrapper.sol @@ -36,7 +36,9 @@ abstract contract LegacyPoolWrapper is TokenPool { // Legacy fallbacks for older token pools that do not implement the new interface. /// @notice Legacy fallback for the 1.4 token pools. - function getOnRamp(uint64) external view returns (address onRampAddress) { + function getOnRamp( + uint64 + ) external view returns (address onRampAddress) { return address(this); } @@ -48,7 +50,9 @@ abstract contract LegacyPoolWrapper is TokenPool { /// @notice Configures the legacy fallback option. If the previous pool is set, this pool will act as a proxy for /// the legacy pool. /// @param prevPool The address of the previous pool. - function setPreviousPool(IPoolPriorTo1_5 prevPool) external onlyOwner { + function setPreviousPool( + IPoolPriorTo1_5 prevPool + ) external onlyOwner { IPoolPriorTo1_5 oldPrevPool = s_previousPool; s_previousPool = prevPool; @@ -64,7 +68,9 @@ abstract contract LegacyPoolWrapper is TokenPool { return address(s_previousPool) != address(0); } - function _lockOrBurnLegacy(Pool.LockOrBurnInV1 memory lockOrBurnIn) internal { + function _lockOrBurnLegacy( + Pool.LockOrBurnInV1 memory lockOrBurnIn + ) internal { i_token.safeTransfer(address(s_previousPool), lockOrBurnIn.amount); s_previousPool.lockOrBurn( lockOrBurnIn.originalSender, lockOrBurnIn.receiver, lockOrBurnIn.amount, lockOrBurnIn.remoteChainSelector, "" @@ -78,7 +84,9 @@ abstract contract LegacyPoolWrapper is TokenPool { /// offRamp. This is due to the older pools sending funds directly to the receiver, while the new pools do a hop /// through the offRamp to ensure the correct tokens are sent. /// @dev Since extraData has never been used in LockRelease or MintBurn token pools, we can safely ignore it. - function _releaseOrMintLegacy(Pool.ReleaseOrMintInV1 memory releaseOrMintIn) internal { + function _releaseOrMintLegacy( + Pool.ReleaseOrMintInV1 memory releaseOrMintIn + ) internal { s_previousPool.releaseOrMint( releaseOrMintIn.originalSender, releaseOrMintIn.receiver, diff --git a/contracts/src/v0.8/ccip/pools/LockReleaseTokenPool.sol b/contracts/src/v0.8/ccip/pools/LockReleaseTokenPool.sol index 3a4a4aef6d..0f77304b18 100644 --- a/contracts/src/v0.8/ccip/pools/LockReleaseTokenPool.sol +++ b/contracts/src/v0.8/ccip/pools/LockReleaseTokenPool.sol @@ -70,7 +70,9 @@ contract LockReleaseTokenPool is TokenPool, ILiquidityContainer, ITypeAndVersion } // @inheritdoc IERC165 - function supportsInterface(bytes4 interfaceId) public pure virtual override returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) public pure virtual override returns (bool) { return interfaceId == type(ILiquidityContainer).interfaceId || super.supportsInterface(interfaceId); } @@ -82,7 +84,9 @@ contract LockReleaseTokenPool is TokenPool, ILiquidityContainer, ITypeAndVersion /// @notice Sets the LiquidityManager address. /// @dev Only callable by the owner. - function setRebalancer(address rebalancer) external onlyOwner { + function setRebalancer( + address rebalancer + ) external onlyOwner { s_rebalancer = rebalancer; } @@ -94,7 +98,9 @@ contract LockReleaseTokenPool is TokenPool, ILiquidityContainer, ITypeAndVersion /// @notice Adds liquidity to the pool. The tokens should be approved first. /// @param amount The amount of liquidity to provide. - function provideLiquidity(uint256 amount) external { + function provideLiquidity( + uint256 amount + ) external { if (!i_acceptLiquidity) revert LiquidityNotAccepted(); if (s_rebalancer != msg.sender) revert Unauthorized(msg.sender); @@ -104,7 +110,9 @@ contract LockReleaseTokenPool is TokenPool, ILiquidityContainer, ITypeAndVersion /// @notice Removed liquidity to the pool. The tokens will be sent to msg.sender. /// @param amount The amount of liquidity to remove. - function withdrawLiquidity(uint256 amount) external { + function withdrawLiquidity( + uint256 amount + ) external { if (s_rebalancer != msg.sender) revert Unauthorized(msg.sender); if (i_token.balanceOf(address(this)) < amount) revert InsufficientLiquidity(); diff --git a/contracts/src/v0.8/ccip/pools/LockReleaseTokenPoolAndProxy.sol b/contracts/src/v0.8/ccip/pools/LockReleaseTokenPoolAndProxy.sol index e8c39127de..1671b9650f 100644 --- a/contracts/src/v0.8/ccip/pools/LockReleaseTokenPoolAndProxy.sol +++ b/contracts/src/v0.8/ccip/pools/LockReleaseTokenPoolAndProxy.sol @@ -76,7 +76,9 @@ contract LockReleaseTokenPoolAndProxy is LegacyPoolWrapper, ILiquidityContainer, } // @inheritdoc IERC165 - function supportsInterface(bytes4 interfaceId) public pure virtual override returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) public pure virtual override returns (bool) { return interfaceId == type(ILiquidityContainer).interfaceId || super.supportsInterface(interfaceId); } @@ -88,7 +90,9 @@ contract LockReleaseTokenPoolAndProxy is LegacyPoolWrapper, ILiquidityContainer, /// @notice Sets the LiquidityManager address. /// @dev Only callable by the owner. - function setRebalancer(address rebalancer) external onlyOwner { + function setRebalancer( + address rebalancer + ) external onlyOwner { s_rebalancer = rebalancer; } @@ -100,7 +104,9 @@ contract LockReleaseTokenPoolAndProxy is LegacyPoolWrapper, ILiquidityContainer, /// @notice Adds liquidity to the pool. The tokens should be approved first. /// @param amount The amount of liquidity to provide. - function provideLiquidity(uint256 amount) external { + function provideLiquidity( + uint256 amount + ) external { if (!i_acceptLiquidity) revert LiquidityNotAccepted(); if (s_rebalancer != msg.sender) revert Unauthorized(msg.sender); @@ -110,7 +116,9 @@ contract LockReleaseTokenPoolAndProxy is LegacyPoolWrapper, ILiquidityContainer, /// @notice Removed liquidity to the pool. The tokens will be sent to msg.sender. /// @param amount The amount of liquidity to remove. - function withdrawLiquidity(uint256 amount) external { + function withdrawLiquidity( + uint256 amount + ) external { if (s_rebalancer != msg.sender) revert Unauthorized(msg.sender); if (i_token.balanceOf(address(this)) < amount) revert InsufficientLiquidity(); diff --git a/contracts/src/v0.8/ccip/pools/TokenPool.sol b/contracts/src/v0.8/ccip/pools/TokenPool.sol index ebd613134a..e3b4e92055 100644 --- a/contracts/src/v0.8/ccip/pools/TokenPool.sol +++ b/contracts/src/v0.8/ccip/pools/TokenPool.sol @@ -112,7 +112,9 @@ abstract contract TokenPool is IPoolV1, OwnerIsCreator { } /// @inheritdoc IPoolV1 - function isSupportedToken(address token) public view virtual returns (bool) { + function isSupportedToken( + address token + ) public view virtual returns (bool) { return token == address(i_token); } @@ -130,7 +132,9 @@ abstract contract TokenPool is IPoolV1, OwnerIsCreator { /// @notice Sets the pool's Router /// @param newRouter The new Router - function setRouter(address newRouter) public onlyOwner { + function setRouter( + address newRouter + ) public onlyOwner { if (newRouter == address(0)) revert ZeroAddressNotAllowed(); address oldRouter = address(s_router); s_router = IRouter(newRouter); @@ -139,7 +143,9 @@ abstract contract TokenPool is IPoolV1, OwnerIsCreator { } /// @notice Signals which version of the pool interface is supported - function supportsInterface(bytes4 interfaceId) public pure virtual override returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) public pure virtual override returns (bool) { return interfaceId == Pool.CCIP_POOL_V1 || interfaceId == type(IPoolV1).interfaceId || interfaceId == type(IERC165).interfaceId; } @@ -157,7 +163,9 @@ abstract contract TokenPool is IPoolV1, OwnerIsCreator { /// @param lockOrBurnIn The input to validate. /// @dev This function should always be called before executing a lock or burn. Not doing so would allow /// for various exploits. - function _validateLockOrBurn(Pool.LockOrBurnInV1 memory lockOrBurnIn) internal { + function _validateLockOrBurn( + Pool.LockOrBurnInV1 memory lockOrBurnIn + ) internal { if (!isSupportedToken(lockOrBurnIn.localToken)) revert InvalidToken(lockOrBurnIn.localToken); if (IRMN(i_rmnProxy).isCursed(bytes16(uint128(lockOrBurnIn.remoteChainSelector)))) revert CursedByRMN(); _checkAllowList(lockOrBurnIn.originalSender); @@ -175,7 +183,9 @@ abstract contract TokenPool is IPoolV1, OwnerIsCreator { /// @param releaseOrMintIn The input to validate. /// @dev This function should always be called before executing a release or mint. Not doing so would allow /// for various exploits. - function _validateReleaseOrMint(Pool.ReleaseOrMintInV1 memory releaseOrMintIn) internal { + function _validateReleaseOrMint( + Pool.ReleaseOrMintInV1 memory releaseOrMintIn + ) internal { if (!isSupportedToken(releaseOrMintIn.localToken)) revert InvalidToken(releaseOrMintIn.localToken); if (IRMN(i_rmnProxy).isCursed(bytes16(uint128(releaseOrMintIn.remoteChainSelector)))) revert CursedByRMN(); _onlyOffRamp(releaseOrMintIn.remoteChainSelector); @@ -198,14 +208,18 @@ abstract contract TokenPool is IPoolV1, OwnerIsCreator { /// @notice Gets the pool address on the remote chain. /// @param remoteChainSelector Remote chain selector. /// @dev To support non-evm chains, this value is encoded into bytes - function getRemotePool(uint64 remoteChainSelector) public view returns (bytes memory) { + function getRemotePool( + uint64 remoteChainSelector + ) public view returns (bytes memory) { return s_remoteChainConfigs[remoteChainSelector].remotePoolAddress; } /// @notice Gets the token address on the remote chain. /// @param remoteChainSelector Remote chain selector. /// @dev To support non-evm chains, this value is encoded into bytes - function getRemoteToken(uint64 remoteChainSelector) public view returns (bytes memory) { + function getRemoteToken( + uint64 remoteChainSelector + ) public view returns (bytes memory) { return s_remoteChainConfigs[remoteChainSelector].remoteTokenAddress; } @@ -222,7 +236,9 @@ abstract contract TokenPool is IPoolV1, OwnerIsCreator { } /// @inheritdoc IPoolV1 - function isSupportedChain(uint64 remoteChainSelector) public view returns (bool) { + function isSupportedChain( + uint64 remoteChainSelector + ) public view returns (bool) { return s_remoteChainSelectors.contains(remoteChainSelector); } @@ -243,7 +259,9 @@ abstract contract TokenPool is IPoolV1, OwnerIsCreator { /// @dev Only callable by the owner /// @param chains A list of chains and their new permission status & rate limits. Rate limits /// are only used when the chain is being added through `allowed` being true. - function applyChainUpdates(ChainUpdate[] calldata chains) external virtual onlyOwner { + function applyChainUpdates( + ChainUpdate[] calldata chains + ) external virtual onlyOwner { for (uint256 i = 0; i < chains.length; ++i) { ChainUpdate memory update = chains[i]; RateLimiter._validateTokenBucketConfig(update.outboundRateLimiterConfig, !update.allowed); @@ -304,7 +322,9 @@ abstract contract TokenPool is IPoolV1, OwnerIsCreator { /// @notice Sets the rate limiter admin address. /// @dev Only callable by the owner. /// @param rateLimitAdmin The new rate limiter admin address. - function setRateLimitAdmin(address rateLimitAdmin) external onlyOwner { + function setRateLimitAdmin( + address rateLimitAdmin + ) external onlyOwner { s_rateLimitAdmin = rateLimitAdmin; } @@ -372,14 +392,18 @@ abstract contract TokenPool is IPoolV1, OwnerIsCreator { /// @notice Checks whether remote chain selector is configured on this contract, and if the msg.sender /// is a permissioned onRamp for the given chain on the Router. - function _onlyOnRamp(uint64 remoteChainSelector) internal view { + function _onlyOnRamp( + uint64 remoteChainSelector + ) internal view { if (!isSupportedChain(remoteChainSelector)) revert ChainNotAllowed(remoteChainSelector); if (!(msg.sender == s_router.getOnRamp(remoteChainSelector))) revert CallerIsNotARampOnRouter(msg.sender); } /// @notice Checks whether remote chain selector is configured on this contract, and if the msg.sender /// is a permissioned offRamp for the given chain on the Router. - function _onlyOffRamp(uint64 remoteChainSelector) internal view { + function _onlyOffRamp( + uint64 remoteChainSelector + ) internal view { if (!isSupportedChain(remoteChainSelector)) revert ChainNotAllowed(remoteChainSelector); if (!s_router.isOffRamp(remoteChainSelector, msg.sender)) revert CallerIsNotARampOnRouter(msg.sender); } @@ -388,7 +412,9 @@ abstract contract TokenPool is IPoolV1, OwnerIsCreator { // │ Allowlist │ // ================================================================ - function _checkAllowList(address sender) internal view { + function _checkAllowList( + address sender + ) internal view { if (i_allowlistEnabled) { if (!s_allowList.contains(sender)) { revert SenderNotAllowed(sender); diff --git a/contracts/src/v0.8/ccip/pools/USDC/HybridLockReleaseUSDCTokenPool.sol b/contracts/src/v0.8/ccip/pools/USDC/HybridLockReleaseUSDCTokenPool.sol index 5fbd71bb2c..3691ef1c7b 100644 --- a/contracts/src/v0.8/ccip/pools/USDC/HybridLockReleaseUSDCTokenPool.sol +++ b/contracts/src/v0.8/ccip/pools/USDC/HybridLockReleaseUSDCTokenPool.sol @@ -145,7 +145,9 @@ contract HybridLockReleaseUSDCTokenPool is USDCTokenPool, USDCBridgeMigrator { /// @notice Gets LiquidityManager, can be address(0) if none is configured. /// @return The current liquidity manager for the given chain selector - function getLiquidityProvider(uint64 remoteChainSelector) external view returns (address) { + function getLiquidityProvider( + uint64 remoteChainSelector + ) external view returns (address) { return s_liquidityProvider[remoteChainSelector]; } @@ -236,7 +238,9 @@ contract HybridLockReleaseUSDCTokenPool is USDCTokenPool, USDCBridgeMigrator { /// @notice Return whether a lane should use the alternative L/R mechanism in the token pool. /// @param remoteChainSelector the remote chain the lane is interacting with /// @return bool Return true if the alternative L/R mechanism should be used - function shouldUseLockRelease(uint64 remoteChainSelector) public view virtual returns (bool) { + function shouldUseLockRelease( + uint64 remoteChainSelector + ) public view virtual returns (bool) { return s_shouldUseLockRelease[remoteChainSelector]; } diff --git a/contracts/src/v0.8/ccip/pools/USDC/USDCBridgeMigrator.sol b/contracts/src/v0.8/ccip/pools/USDC/USDCBridgeMigrator.sol index 98616cd79f..4737a83344 100644 --- a/contracts/src/v0.8/ccip/pools/USDC/USDCBridgeMigrator.sol +++ b/contracts/src/v0.8/ccip/pools/USDC/USDCBridgeMigrator.sol @@ -80,7 +80,9 @@ abstract contract USDCBridgeMigrator is OwnerIsCreator { /// non-canonical form of USDC which they wish to update to canonical. Function will revert if an existing migration /// proposal is already in progress. /// @dev This function can only be called by the owner - function proposeCCTPMigration(uint64 remoteChainSelector) external onlyOwner { + function proposeCCTPMigration( + uint64 remoteChainSelector + ) external onlyOwner { // Prevent overwriting existing migration proposals until the current one is finished if (s_proposedUSDCMigrationChain != 0) revert ExistingMigrationProposal(); @@ -114,7 +116,9 @@ abstract contract USDCBridgeMigrator is OwnerIsCreator { /// @notice Set the address of the circle-controlled wallet which will execute a CCTP lane migration /// @dev The function should only be invoked once the address has been confirmed by Circle prior to /// chain expansion. - function setCircleMigratorAddress(address migrator) external onlyOwner { + function setCircleMigratorAddress( + address migrator + ) external onlyOwner { s_circleUSDCMigrator = migrator; emit CircleMigratorAddressSet(migrator); @@ -125,7 +129,9 @@ abstract contract USDCBridgeMigrator is OwnerIsCreator { /// non-canonical form of USDC at present. /// @return uint256 the amount of USDC locked into the specified lane. If non-zero, the number /// should match the current circulating supply of USDC on the destination chain - function getLockedTokensForChain(uint64 remoteChainSelector) public view returns (uint256) { + function getLockedTokensForChain( + uint64 remoteChainSelector + ) public view returns (uint256) { return s_lockedTokensByChainSelector[remoteChainSelector]; } @@ -148,7 +154,9 @@ abstract contract USDCBridgeMigrator is OwnerIsCreator { /// @dev The sum of locked tokens and excluded tokens should equal the supply of the token on the remote chain /// @param remoteChainSelector The chain for which the excluded tokens are being queried /// @return uint256 amount of tokens excluded from being burned in a CCTP-migration - function getExcludedTokensByChain(uint64 remoteChainSelector) public view returns (uint256) { + function getExcludedTokensByChain( + uint64 remoteChainSelector + ) public view returns (uint256) { return s_tokensExcludedFromBurn[remoteChainSelector]; } } diff --git a/contracts/src/v0.8/ccip/pools/USDC/USDCTokenPool.sol b/contracts/src/v0.8/ccip/pools/USDC/USDCTokenPool.sol index 56ab40c9b5..addfe06da0 100644 --- a/contracts/src/v0.8/ccip/pools/USDC/USDCTokenPool.sol +++ b/contracts/src/v0.8/ccip/pools/USDC/USDCTokenPool.sol @@ -206,13 +206,17 @@ contract USDCTokenPool is TokenPool, ITypeAndVersion { // ================================================================ /// @notice Gets the CCTP domain for a given CCIP chain selector. - function getDomain(uint64 chainSelector) external view returns (Domain memory) { + function getDomain( + uint64 chainSelector + ) external view returns (Domain memory) { return s_chainToDomain[chainSelector]; } /// @notice Sets the CCTP domain for a CCIP chain selector. /// @dev Must verify mapping of selectors -> (domain, caller) offchain. - function setDomains(DomainUpdate[] calldata domains) external onlyOwner { + function setDomains( + DomainUpdate[] calldata domains + ) external onlyOwner { for (uint256 i = 0; i < domains.length; ++i) { DomainUpdate memory domain = domains[i]; if (domain.allowedCaller == bytes32(0) || domain.destChainSelector == 0) revert InvalidDomain(domain); diff --git a/contracts/src/v0.8/ccip/rmn/RMNHome.sol b/contracts/src/v0.8/ccip/rmn/RMNHome.sol index d13385aed8..978b200213 100644 --- a/contracts/src/v0.8/ccip/rmn/RMNHome.sol +++ b/contracts/src/v0.8/ccip/rmn/RMNHome.sol @@ -161,7 +161,9 @@ contract RMNHome is OwnerIsCreator, ITypeAndVersion { /// @param configDigest The digest of the config to fetch. /// @return versionedConfig The config and its version. /// @return ok True if the config was found, false otherwise. - function getConfig(bytes32 configDigest) external view returns (VersionedConfig memory versionedConfig, bool ok) { + function getConfig( + bytes32 configDigest + ) external view returns (VersionedConfig memory versionedConfig, bool ok) { for (uint256 i = 0; i < MAX_CONCURRENT_CONFIGS; ++i) { // We never want to return true for a zero digest, even if the caller is asking for it, as this can expose old // config state that is invalid. @@ -236,7 +238,9 @@ contract RMNHome is OwnerIsCreator, ITypeAndVersion { /// remove it without it ever having to be promoted. It's also possible to revoke the candidate config by setting a /// newer candidate config using `setCandidate`. /// @param configDigest The digest of the config to revoke. This is done to prevent accidental revokes. - function revokeCandidate(bytes32 configDigest) external onlyOwner { + function revokeCandidate( + bytes32 configDigest + ) external onlyOwner { if (configDigest == ZERO_DIGEST) { revert RevokingZeroDigestNotAllowed(); } diff --git a/contracts/src/v0.8/ccip/rmn/RMNRemote.sol b/contracts/src/v0.8/ccip/rmn/RMNRemote.sol index 0d38da22b3..6a4366e29f 100644 --- a/contracts/src/v0.8/ccip/rmn/RMNRemote.sol +++ b/contracts/src/v0.8/ccip/rmn/RMNRemote.sol @@ -76,7 +76,9 @@ contract RMNRemote is OwnerIsCreator, ITypeAndVersion, IRMNRemote { mapping(address signer => bool exists) private s_signers; // for more gas efficient verify /// @param localChainSelector the chain selector of the chain this contract is deployed to - constructor(uint64 localChainSelector) { + constructor( + uint64 localChainSelector + ) { if (localChainSelector == 0) revert ZeroValueNotAllowed(); i_localChainSelector = localChainSelector; } @@ -130,7 +132,9 @@ contract RMNRemote is OwnerIsCreator, ITypeAndVersion, IRMNRemote { /// @notice Sets the configuration of the contract /// @param newConfig the new configuration /// @dev setting config is atomic; we delete all pre-existing config and set everything from scratch - function setConfig(Config calldata newConfig) external onlyOwner { + function setConfig( + Config calldata newConfig + ) external onlyOwner { // signers are in ascending order of nodeIndex for (uint256 i = 1; i < newConfig.signers.length; ++i) { if (!(newConfig.signers[i - 1].nodeIndex < newConfig.signers[i].nodeIndex)) { @@ -186,7 +190,9 @@ contract RMNRemote is OwnerIsCreator, ITypeAndVersion, IRMNRemote { /// @notice Curse a single subject /// @param subject the subject to curse - function curse(bytes16 subject) external { + function curse( + bytes16 subject + ) external { bytes16[] memory subjects = new bytes16[](1); subjects[0] = subject; curse(subjects); @@ -195,7 +201,9 @@ contract RMNRemote is OwnerIsCreator, ITypeAndVersion, IRMNRemote { /// @notice Curse an array of subjects /// @param subjects the subjects to curse /// @dev reverts if any of the subjects are already cursed or if there is a duplicate - function curse(bytes16[] memory subjects) public onlyOwner { + function curse( + bytes16[] memory subjects + ) public onlyOwner { for (uint256 i = 0; i < subjects.length; ++i) { if (!s_cursedSubjects.add(subjects[i])) { revert AlreadyCursed(subjects[i]); @@ -206,7 +214,9 @@ contract RMNRemote is OwnerIsCreator, ITypeAndVersion, IRMNRemote { /// @notice Uncurse a single subject /// @param subject the subject to uncurse - function uncurse(bytes16 subject) external { + function uncurse( + bytes16 subject + ) external { bytes16[] memory subjects = new bytes16[](1); subjects[0] = subject; uncurse(subjects); @@ -215,7 +225,9 @@ contract RMNRemote is OwnerIsCreator, ITypeAndVersion, IRMNRemote { /// @notice Uncurse an array of subjects /// @param subjects the subjects to uncurse /// @dev reverts if any of the subjects are not cursed or if there is a duplicate - function uncurse(bytes16[] memory subjects) public onlyOwner { + function uncurse( + bytes16[] memory subjects + ) public onlyOwner { for (uint256 i = 0; i < subjects.length; ++i) { if (!s_cursedSubjects.remove(subjects[i])) { revert NotCursed(subjects[i]); @@ -238,7 +250,9 @@ contract RMNRemote is OwnerIsCreator, ITypeAndVersion, IRMNRemote { } /// @inheritdoc IRMNRemote - function isCursed(bytes16 subject) external view returns (bool) { + function isCursed( + bytes16 subject + ) external view returns (bool) { if (s_cursedSubjects.length() == 0) { return false; } diff --git a/contracts/src/v0.8/ccip/test/BaseTest.t.sol b/contracts/src/v0.8/ccip/test/BaseTest.t.sol index 0c4d7d632c..4a425af97f 100644 --- a/contracts/src/v0.8/ccip/test/BaseTest.t.sol +++ b/contracts/src/v0.8/ccip/test/BaseTest.t.sol @@ -99,7 +99,9 @@ contract BaseTest is Test { vm.mockCall(address(s_mockRMNRemote), abi.encodeWithSignature("isCursed(bytes16)"), abi.encode(false)); // no curses by defaule } - function _setMockRMNGlobalCurse(bool isCursed) internal { + function _setMockRMNGlobalCurse( + bool isCursed + ) internal { vm.mockCall(address(s_mockRMNRemote), abi.encodeWithSignature("isCursed()"), abi.encode(isCursed)); } diff --git a/contracts/src/v0.8/ccip/test/WETH9.sol b/contracts/src/v0.8/ccip/test/WETH9.sol index fbc19ee2c4..bfd2b5f022 100644 --- a/contracts/src/v0.8/ccip/test/WETH9.sol +++ b/contracts/src/v0.8/ccip/test/WETH9.sol @@ -43,7 +43,9 @@ contract WETH9 { _deposit(); } - function withdraw(uint256 wad) external { + function withdraw( + uint256 wad + ) external { require(balanceOf[msg.sender] >= wad); balanceOf[msg.sender] -= wad; payable(msg.sender).transfer(wad); diff --git a/contracts/src/v0.8/ccip/test/applications/EtherSenderReceiver.t.sol b/contracts/src/v0.8/ccip/test/applications/EtherSenderReceiver.t.sol index cfd402d910..489ebcf8b8 100644 --- a/contracts/src/v0.8/ccip/test/applications/EtherSenderReceiver.t.sol +++ b/contracts/src/v0.8/ccip/test/applications/EtherSenderReceiver.t.sol @@ -107,7 +107,9 @@ contract EtherSenderReceiverTest_validatedMessage is EtherSenderReceiverTest { uint256 internal constant amount = 100; - function test_Fuzz_validatedMessage_msgSenderOverwrite(bytes memory data) public view { + function test_Fuzz_validatedMessage_msgSenderOverwrite( + bytes memory data + ) public view { Client.EVMTokenAmount[] memory tokenAmounts = new Client.EVMTokenAmount[](1); tokenAmounts[0] = Client.EVMTokenAmount({ token: address(0), // callers may not specify this. @@ -130,7 +132,9 @@ contract EtherSenderReceiverTest_validatedMessage is EtherSenderReceiverTest { assertEq(validatedMessage.extraArgs, bytes(""), "extraArgs must be empty"); } - function test_Fuzz_validatedMessage_tokenAddressOverwrite(address token) public view { + function test_Fuzz_validatedMessage_tokenAddressOverwrite( + address token + ) public view { Client.EVMTokenAmount[] memory tokenAmounts = new Client.EVMTokenAmount[](1); tokenAmounts[0] = Client.EVMTokenAmount({token: token, amount: amount}); Client.EVM2AnyMessage memory message = Client.EVM2AnyMessage({ @@ -300,7 +304,9 @@ contract EtherSenderReceiverTest_ccipReceive is EtherSenderReceiverTest { error InvalidTokenAmounts(uint256 gotAmounts); error InvalidToken(address gotToken, address expectedToken); - function test_Fuzz_ccipReceive(uint256 tokenAmount) public { + function test_Fuzz_ccipReceive( + uint256 tokenAmount + ) public { // cap to 10 ether because OWNER only has 10 ether. if (tokenAmount > 10 ether) { return; diff --git a/contracts/src/v0.8/ccip/test/applications/PingPongDemo.t.sol b/contracts/src/v0.8/ccip/test/applications/PingPongDemo.t.sol index f253a72fcb..c9f7493e4b 100644 --- a/contracts/src/v0.8/ccip/test/applications/PingPongDemo.t.sol +++ b/contracts/src/v0.8/ccip/test/applications/PingPongDemo.t.sol @@ -91,7 +91,9 @@ contract PingPong_startPingPong is PingPongDappSetup { _assertPingPongSuccess(message); } - function _assertPingPongSuccess(Internal.EVM2EVMMessage memory message) internal { + function _assertPingPongSuccess( + Internal.EVM2EVMMessage memory message + ) internal { message.messageId = Internal._hash(message, s_metadataHash); vm.expectEmit(); @@ -128,13 +130,17 @@ contract PingPong_ccipReceive is PingPongDappSetup { } contract PingPong_plumbing is PingPongDappSetup { - function test_Fuzz_CounterPartChainSelector_Success(uint64 chainSelector) public { + function test_Fuzz_CounterPartChainSelector_Success( + uint64 chainSelector + ) public { s_pingPong.setCounterpartChainSelector(chainSelector); assertEq(s_pingPong.getCounterpartChainSelector(), chainSelector); } - function test_Fuzz_CounterPartAddress_Success(address counterpartAddress) public { + function test_Fuzz_CounterPartAddress_Success( + address counterpartAddress + ) public { s_pingPong.setCounterpartAddress(counterpartAddress); assertEq(s_pingPong.getCounterpartAddress(), counterpartAddress); diff --git a/contracts/src/v0.8/ccip/test/arm/RMN.t.sol b/contracts/src/v0.8/ccip/test/arm/RMN.t.sol index 85501170e3..da1c98e0d2 100644 --- a/contracts/src/v0.8/ccip/test/arm/RMN.t.sol +++ b/contracts/src/v0.8/ccip/test/arm/RMN.t.sol @@ -1002,7 +1002,9 @@ contract RMN_permaBlessing is RMNSetup { return new address[](0); } - function addresses(address a) private pure returns (address[] memory) { + function addresses( + address a + ) private pure returns (address[] memory) { address[] memory arr = new address[](1); arr[0] = a; return arr; diff --git a/contracts/src/v0.8/ccip/test/arm/RMNSetup.t.sol b/contracts/src/v0.8/ccip/test/arm/RMNSetup.t.sol index 8feacb95f4..4a333306ec 100644 --- a/contracts/src/v0.8/ccip/test/arm/RMNSetup.t.sol +++ b/contracts/src/v0.8/ccip/test/arm/RMNSetup.t.sol @@ -6,7 +6,9 @@ import {IRMN} from "../../interfaces/IRMN.sol"; import {Test} from "forge-std/Test.sol"; -function makeSubjects(bytes16 a) pure returns (bytes16[] memory) { +function makeSubjects( + bytes16 a +) pure returns (bytes16[] memory) { bytes16[] memory subjects = new bytes16[](1); subjects[0] = a; return subjects; @@ -20,14 +22,18 @@ function makeSubjects(bytes16 a, bytes16 b) pure returns (bytes16[] memory) { } // in order from earliest to latest curse ids -function makeCursesHashFromList(bytes32[] memory curseIds) pure returns (bytes28 cursesHash) { +function makeCursesHashFromList( + bytes32[] memory curseIds +) pure returns (bytes28 cursesHash) { for (uint256 i = 0; i < curseIds.length; ++i) { cursesHash = bytes28(keccak256(abi.encode(cursesHash, curseIds[i]))); } } // hides the ugliness from tests -function makeCursesHash(bytes32 a) pure returns (bytes28) { +function makeCursesHash( + bytes32 a +) pure returns (bytes28) { bytes32[] memory curseIds = new bytes32[](1); curseIds[0] = a; return makeCursesHashFromList(curseIds); @@ -102,20 +108,28 @@ contract RMNSetup is Test { return votes; } - function makeTaggedRootSingleton(uint256 index) internal pure returns (IRMN.TaggedRoot[] memory) { + function makeTaggedRootSingleton( + uint256 index + ) internal pure returns (IRMN.TaggedRoot[] memory) { return makeTaggedRootsInclusive(index, index); } - function makeTaggedRoot(uint256 index) internal pure returns (IRMN.TaggedRoot memory) { + function makeTaggedRoot( + uint256 index + ) internal pure returns (IRMN.TaggedRoot memory) { return makeTaggedRootSingleton(index)[0]; } - function makeTaggedRootHash(uint256 index) internal pure returns (bytes32) { + function makeTaggedRootHash( + uint256 index + ) internal pure returns (bytes32) { IRMN.TaggedRoot memory taggedRoot = makeTaggedRootSingleton(index)[0]; return keccak256(abi.encode(taggedRoot.commitStore, taggedRoot.root)); } - function makeCurseId(uint256 index) internal pure returns (bytes16) { + function makeCurseId( + uint256 index + ) internal pure returns (bytes16) { return bytes16(uint128(index)); } @@ -137,7 +151,9 @@ contract RMNSetup is Test { return false; } - function getWeightOfVotesToBlessRoot(IRMN.TaggedRoot memory taggedRoot_) internal view returns (uint16) { + function getWeightOfVotesToBlessRoot( + IRMN.TaggedRoot memory taggedRoot_ + ) internal view returns (uint16) { (, uint16 weight,) = s_rmn.getBlessProgress(taggedRoot_); return weight; } diff --git a/contracts/src/v0.8/ccip/test/arm/RMN_benchmark.t.sol b/contracts/src/v0.8/ccip/test/arm/RMN_benchmark.t.sol index 8564614a74..cd17f023c7 100644 --- a/contracts/src/v0.8/ccip/test/arm/RMN_benchmark.t.sol +++ b/contracts/src/v0.8/ccip/test/arm/RMN_benchmark.t.sol @@ -5,7 +5,9 @@ import {GLOBAL_CURSE_SUBJECT, OWNER_CURSE_VOTE_ADDR, RMN} from "../../RMN.sol"; import {RMNSetup, makeCursesHash, makeSubjects} from "./RMNSetup.t.sol"; contract RMN_voteToBless_Benchmark is RMNSetup { - function test_RootSuccess_gas(uint256 n) internal { + function test_RootSuccess_gas( + uint256 n + ) internal { vm.prank(BLESS_VOTER_1); s_rmn.voteToBless(makeTaggedRootsInclusive(1, n)); } @@ -151,7 +153,9 @@ contract RMN_lazyVoteToCurseUpdate_Benchmark is RMN_voteToCurse_Benchmark { contract RMN_setConfig_Benchmark is RMNSetup { uint256 s_numVoters; - function configWithVoters(uint256 numVoters) internal pure returns (RMN.Config memory) { + function configWithVoters( + uint256 numVoters + ) internal pure returns (RMN.Config memory) { RMN.Config memory cfg = RMN.Config({voters: new RMN.Voter[](numVoters), blessWeightThreshold: 1, curseWeightThreshold: 1}); for (uint256 i = 1; i <= numVoters; ++i) { diff --git a/contracts/src/v0.8/ccip/test/attacks/onRamp/FacadeClient.sol b/contracts/src/v0.8/ccip/test/attacks/onRamp/FacadeClient.sol index ad549e6ccc..8947a27df1 100644 --- a/contracts/src/v0.8/ccip/test/attacks/onRamp/FacadeClient.sol +++ b/contracts/src/v0.8/ccip/test/attacks/onRamp/FacadeClient.sol @@ -30,7 +30,9 @@ contract FacadeClient { /// @dev Calls Router to initiate CCIP send. /// The expectation is that s_msg_sequence will always match the sequence in emitted CCIP messages. - function send(uint256 amount) public { + function send( + uint256 amount + ) public { Client.EVMTokenAmount[] memory tokenAmounts = new Client.EVMTokenAmount[](1); tokenAmounts[0].token = address(i_sourceToken); tokenAmounts[0].amount = amount; diff --git a/contracts/src/v0.8/ccip/test/capability/CCIPHome.t.sol b/contracts/src/v0.8/ccip/test/capability/CCIPHome.t.sol index f4784b0d0f..5b80a4e6a2 100644 --- a/contracts/src/v0.8/ccip/test/capability/CCIPHome.t.sol +++ b/contracts/src/v0.8/ccip/test/capability/CCIPHome.t.sol @@ -76,7 +76,9 @@ contract CCIPHomeTest is Test { ); } - function _getBaseConfig(Internal.OCRPluginType pluginType) internal pure returns (CCIPHome.OCR3Config memory) { + function _getBaseConfig( + Internal.OCRPluginType pluginType + ) internal pure returns (CCIPHome.OCR3Config memory) { CCIPHome.OCR3Node[] memory nodes = new CCIPHome.OCR3Node[](4); for (uint256 i = 0; i < nodes.length; i++) { nodes[i] = CCIPHome.OCR3Node({ @@ -398,7 +400,9 @@ contract CCIPHome_promoteCandidateAndRevokeActive is CCIPHomeTest { assertEq(candidateDigest, ZERO_DIGEST); } - function promoteCandidateAndRevokeActive(Internal.OCRPluginType pluginType) public { + function promoteCandidateAndRevokeActive( + Internal.OCRPluginType pluginType + ) public { CCIPHome.OCR3Config memory config = _getBaseConfig(pluginType); bytes32 firstConfigToPromote = s_ccipHome.setCandidate(DEFAULT_DON_ID, pluginType, config, ZERO_DIGEST); @@ -473,7 +477,9 @@ contract CCIPHome__validateConfig is CCIPHomeTest { s_ccipHome = new CCIPHomeHelper(CAPABILITIES_REGISTRY); } - function _addChainConfig(uint256 numNodes) internal returns (CCIPHome.OCR3Node[] memory nodes) { + function _addChainConfig( + uint256 numNodes + ) internal returns (CCIPHome.OCR3Node[] memory nodes) { return _addChainConfig(numNodes, 1); } diff --git a/contracts/src/v0.8/ccip/test/commitStore/CommitStore.t.sol b/contracts/src/v0.8/ccip/test/commitStore/CommitStore.t.sol index 0976ab96c5..0cc23f8a6d 100644 --- a/contracts/src/v0.8/ccip/test/commitStore/CommitStore.t.sol +++ b/contracts/src/v0.8/ccip/test/commitStore/CommitStore.t.sol @@ -117,7 +117,9 @@ contract CommitStore_constructor is FeeQuoterSetup, OCR2BaseSetup { } contract CommitStore_setMinSeqNr is CommitStoreSetup { - function test_Fuzz_SetMinSeqNr_Success(uint64 minSeqNr) public { + function test_Fuzz_SetMinSeqNr_Success( + uint64 minSeqNr + ) public { vm.expectEmit(); emit CommitStore.SequenceNumberSet(s_commitStore.getExpectedNextSequenceNumber(), minSeqNr); @@ -135,7 +137,9 @@ contract CommitStore_setMinSeqNr is CommitStoreSetup { } contract CommitStore_setDynamicConfig is CommitStoreSetup { - function test_Fuzz_SetDynamicConfig_Success(address priceRegistry) public { + function test_Fuzz_SetDynamicConfig_Success( + address priceRegistry + ) public { vm.assume(priceRegistry != address(0)); CommitStore.StaticConfig memory staticConfig = s_commitStore.getStaticConfig(); CommitStore.DynamicConfig memory dynamicConfig = CommitStore.DynamicConfig({priceRegistry: priceRegistry}); diff --git a/contracts/src/v0.8/ccip/test/e2e/End2End.t.sol b/contracts/src/v0.8/ccip/test/e2e/End2End.t.sol index 114265a248..8c931dd4fc 100644 --- a/contracts/src/v0.8/ccip/test/e2e/End2End.t.sol +++ b/contracts/src/v0.8/ccip/test/e2e/End2End.t.sol @@ -93,7 +93,9 @@ contract E2E is EVM2EVMOnRampSetup, CommitStoreSetup, EVM2EVMOffRampSetup { s_offRamp.execute(execReport, new EVM2EVMOffRamp.GasLimitOverride[](0)); } - function sendRequest(uint64 expectedSeqNum) public returns (Internal.EVM2EVMMessage memory) { + function sendRequest( + uint64 expectedSeqNum + ) public returns (Internal.EVM2EVMMessage memory) { Client.EVM2AnyMessage memory message = _generateTokenMessage(); uint256 expectedFee = s_sourceRouter.getFee(DEST_CHAIN_SELECTOR, message); diff --git a/contracts/src/v0.8/ccip/test/feeQuoter/FeeQuoterSetup.t.sol b/contracts/src/v0.8/ccip/test/feeQuoter/FeeQuoterSetup.t.sol index 9d98fa7e77..f1a00be78c 100644 --- a/contracts/src/v0.8/ccip/test/feeQuoter/FeeQuoterSetup.t.sol +++ b/contracts/src/v0.8/ccip/test/feeQuoter/FeeQuoterSetup.t.sol @@ -270,7 +270,9 @@ contract FeeQuoterSetup is TokenSetup { assertEq(config1.tokenDecimals, config2.tokenDecimals); } - function _assertTokenPriceFeedConfigUnconfigured(FeeQuoter.TokenPriceFeedConfig memory config) internal pure virtual { + function _assertTokenPriceFeedConfigUnconfigured( + FeeQuoter.TokenPriceFeedConfig memory config + ) internal pure virtual { _assertTokenPriceFeedConfigEquality( config, FeeQuoter.TokenPriceFeedConfig({dataFeedAddress: address(0), tokenDecimals: 0}) ); @@ -433,7 +435,9 @@ contract FeeQuoterFeeSetup is FeeQuoterSetup { return (tokenAmount * ratio) / 1e5; } - function _configUSDCentToWei(uint256 usdCent) internal pure returns (uint256) { + function _configUSDCentToWei( + uint256 usdCent + ) internal pure returns (uint256) { return usdCent * 1e16; } } diff --git a/contracts/src/v0.8/ccip/test/helpers/AggregateRateLimiterHelper.sol b/contracts/src/v0.8/ccip/test/helpers/AggregateRateLimiterHelper.sol index ced605a752..f41bcc430d 100644 --- a/contracts/src/v0.8/ccip/test/helpers/AggregateRateLimiterHelper.sol +++ b/contracts/src/v0.8/ccip/test/helpers/AggregateRateLimiterHelper.sol @@ -4,9 +4,13 @@ pragma solidity 0.8.24; import "../../AggregateRateLimiter.sol"; contract AggregateRateLimiterHelper is AggregateRateLimiter { - constructor(RateLimiter.Config memory config) AggregateRateLimiter(config) {} + constructor( + RateLimiter.Config memory config + ) AggregateRateLimiter(config) {} - function rateLimitValue(uint256 value) public { + function rateLimitValue( + uint256 value + ) public { _rateLimitValue(value); } diff --git a/contracts/src/v0.8/ccip/test/helpers/BurnMintERC677Helper.sol b/contracts/src/v0.8/ccip/test/helpers/BurnMintERC677Helper.sol index 9d2346996a..c3f95a7e06 100644 --- a/contracts/src/v0.8/ccip/test/helpers/BurnMintERC677Helper.sol +++ b/contracts/src/v0.8/ccip/test/helpers/BurnMintERC677Helper.sol @@ -8,7 +8,9 @@ contract BurnMintERC677Helper is BurnMintERC677, IGetCCIPAdmin { constructor(string memory name, string memory symbol) BurnMintERC677(name, symbol, 18, 0) {} // Gives one full token to any given address. - function drip(address to) external { + function drip( + address to + ) external { _mint(to, 1e18); } diff --git a/contracts/src/v0.8/ccip/test/helpers/CCIPHomeHelper.sol b/contracts/src/v0.8/ccip/test/helpers/CCIPHomeHelper.sol index 8e460b791e..0bc97c7aa5 100644 --- a/contracts/src/v0.8/ccip/test/helpers/CCIPHomeHelper.sol +++ b/contracts/src/v0.8/ccip/test/helpers/CCIPHomeHelper.sol @@ -4,13 +4,19 @@ pragma solidity 0.8.24; import {CCIPHome} from "../../capability/CCIPHome.sol"; contract CCIPHomeHelper is CCIPHome { - constructor(address capabilitiesRegistry) CCIPHome(capabilitiesRegistry) {} + constructor( + address capabilitiesRegistry + ) CCIPHome(capabilitiesRegistry) {} - function validateConfig(OCR3Config memory cfg) external view { + function validateConfig( + OCR3Config memory cfg + ) external view { return _validateConfig(cfg); } - function ensureInRegistry(bytes32[] memory p2pIds) external view { + function ensureInRegistry( + bytes32[] memory p2pIds + ) external view { return _ensureInRegistry(p2pIds); } } diff --git a/contracts/src/v0.8/ccip/test/helpers/CCIPReaderTester.sol b/contracts/src/v0.8/ccip/test/helpers/CCIPReaderTester.sol index c2acddc796..18afc48918 100644 --- a/contracts/src/v0.8/ccip/test/helpers/CCIPReaderTester.sol +++ b/contracts/src/v0.8/ccip/test/helpers/CCIPReaderTester.sol @@ -13,7 +13,9 @@ contract CCIPReaderTester { /// @notice Gets the next sequence number to be used in the onRamp /// @param destChainSelector The destination chain selector /// @return nextSequenceNumber The next sequence number to be used - function getExpectedNextSequenceNumber(uint64 destChainSelector) external view returns (uint64) { + function getExpectedNextSequenceNumber( + uint64 destChainSelector + ) external view returns (uint64) { return s_destChainSeqNrs[destChainSelector] + 1; } @@ -24,7 +26,9 @@ contract CCIPReaderTester { s_destChainSeqNrs[destChainSelector] = sequenceNumber; } - function getSourceChainConfig(uint64 sourceChainSelector) external view returns (OffRamp.SourceChainConfig memory) { + function getSourceChainConfig( + uint64 sourceChainSelector + ) external view returns (OffRamp.SourceChainConfig memory) { return s_sourceChainConfigs[sourceChainSelector]; } @@ -59,7 +63,9 @@ contract CCIPReaderTester { event CommitReportAccepted(OffRamp.CommitReport report); - function emitCommitReportAccepted(OffRamp.CommitReport memory report) external { + function emitCommitReportAccepted( + OffRamp.CommitReport memory report + ) external { emit CommitReportAccepted(report); } } diff --git a/contracts/src/v0.8/ccip/test/helpers/CommitStoreHelper.sol b/contracts/src/v0.8/ccip/test/helpers/CommitStoreHelper.sol index c8d66b8d72..2759a3312f 100644 --- a/contracts/src/v0.8/ccip/test/helpers/CommitStoreHelper.sol +++ b/contracts/src/v0.8/ccip/test/helpers/CommitStoreHelper.sol @@ -4,7 +4,9 @@ pragma solidity 0.8.24; import "../../CommitStore.sol"; contract CommitStoreHelper is CommitStore { - constructor(StaticConfig memory staticConfig) CommitStore(staticConfig) {} + constructor( + StaticConfig memory staticConfig + ) CommitStore(staticConfig) {} /// @dev Expose _report for tests function report(bytes calldata commitReport, uint40 epochAndRound) external { diff --git a/contracts/src/v0.8/ccip/test/helpers/ERC20RebasingHelper.sol b/contracts/src/v0.8/ccip/test/helpers/ERC20RebasingHelper.sol index e5ef16d060..617d39af5c 100644 --- a/contracts/src/v0.8/ccip/test/helpers/ERC20RebasingHelper.sol +++ b/contracts/src/v0.8/ccip/test/helpers/ERC20RebasingHelper.sol @@ -17,11 +17,15 @@ contract ERC20RebasingHelper is ERC20 { _burn(to, amount * s_multiplierPercentage / 100); } - function setMultiplierPercentage(uint16 multiplierPercentage) external { + function setMultiplierPercentage( + uint16 multiplierPercentage + ) external { s_multiplierPercentage = multiplierPercentage; } - function setMintShouldBurn(bool mintShouldBurn) external { + function setMintShouldBurn( + bool mintShouldBurn + ) external { s_mintShouldBurn = mintShouldBurn; } } diff --git a/contracts/src/v0.8/ccip/test/helpers/EVM2EVMOffRampHelper.sol b/contracts/src/v0.8/ccip/test/helpers/EVM2EVMOffRampHelper.sol index 1b537702be..510a79dc91 100644 --- a/contracts/src/v0.8/ccip/test/helpers/EVM2EVMOffRampHelper.sol +++ b/contracts/src/v0.8/ccip/test/helpers/EVM2EVMOffRampHelper.sol @@ -14,7 +14,9 @@ contract EVM2EVMOffRampHelper is EVM2EVMOffRamp, IgnoreContractSize { _setExecutionState(sequenceNumber, state); } - function getExecutionStateBitMap(uint64 bitmapIndex) public view returns (uint256) { + function getExecutionStateBitMap( + uint64 bitmapIndex + ) public view returns (uint256) { return s_executionStates[bitmapIndex]; } @@ -49,7 +51,9 @@ contract EVM2EVMOffRampHelper is EVM2EVMOffRamp, IgnoreContractSize { return _trialExecute(message, offchainTokenData, tokenGasOverrides); } - function report(bytes calldata executableMessages) external { + function report( + bytes calldata executableMessages + ) external { _report(executableMessages); } diff --git a/contracts/src/v0.8/ccip/test/helpers/EtherSenderReceiverHelper.sol b/contracts/src/v0.8/ccip/test/helpers/EtherSenderReceiverHelper.sol index 71a5cdc7ab..e357645bcb 100644 --- a/contracts/src/v0.8/ccip/test/helpers/EtherSenderReceiverHelper.sol +++ b/contracts/src/v0.8/ccip/test/helpers/EtherSenderReceiverHelper.sol @@ -5,17 +5,25 @@ import {EtherSenderReceiver} from "../../applications/EtherSenderReceiver.sol"; import {Client} from "../../libraries/Client.sol"; contract EtherSenderReceiverHelper is EtherSenderReceiver { - constructor(address router) EtherSenderReceiver(router) {} + constructor( + address router + ) EtherSenderReceiver(router) {} - function validatedMessage(Client.EVM2AnyMessage calldata message) public view returns (Client.EVM2AnyMessage memory) { + function validatedMessage( + Client.EVM2AnyMessage calldata message + ) public view returns (Client.EVM2AnyMessage memory) { return _validatedMessage(message); } - function validateFeeToken(Client.EVM2AnyMessage calldata message) public payable { + function validateFeeToken( + Client.EVM2AnyMessage calldata message + ) public payable { _validateFeeToken(message); } - function publicCcipReceive(Client.Any2EVMMessage memory message) public { + function publicCcipReceive( + Client.Any2EVMMessage memory message + ) public { _ccipReceive(message); } } diff --git a/contracts/src/v0.8/ccip/test/helpers/MaybeRevertingBurnMintTokenPool.sol b/contracts/src/v0.8/ccip/test/helpers/MaybeRevertingBurnMintTokenPool.sol index 7290e91509..a3273ffdbd 100644 --- a/contracts/src/v0.8/ccip/test/helpers/MaybeRevertingBurnMintTokenPool.sol +++ b/contracts/src/v0.8/ccip/test/helpers/MaybeRevertingBurnMintTokenPool.sol @@ -18,15 +18,21 @@ contract MaybeRevertingBurnMintTokenPool is BurnMintTokenPool { address router ) BurnMintTokenPool(token, allowlist, rmnProxy, router) {} - function setShouldRevert(bytes calldata revertReason) external { + function setShouldRevert( + bytes calldata revertReason + ) external { s_revertReason = revertReason; } - function setSourceTokenData(bytes calldata sourceTokenData) external { + function setSourceTokenData( + bytes calldata sourceTokenData + ) external { s_sourceTokenData = sourceTokenData; } - function setReleaseOrMintMultiplier(uint256 multiplier) external { + function setReleaseOrMintMultiplier( + uint256 multiplier + ) external { s_releaseOrMintMultiplier = multiplier; } diff --git a/contracts/src/v0.8/ccip/test/helpers/MerkleHelper.sol b/contracts/src/v0.8/ccip/test/helpers/MerkleHelper.sol index ccb05681f1..231b386656 100644 --- a/contracts/src/v0.8/ccip/test/helpers/MerkleHelper.sol +++ b/contracts/src/v0.8/ccip/test/helpers/MerkleHelper.sol @@ -14,7 +14,9 @@ library MerkleHelper { /// d c /// / \ /// a b - function getMerkleRoot(bytes32[] memory hashedLeaves) public pure returns (bytes32) { + function getMerkleRoot( + bytes32[] memory hashedLeaves + ) public pure returns (bytes32) { require(hashedLeaves.length <= 256); while (hashedLeaves.length > 1) { hashedLeaves = computeNextLayer(hashedLeaves); @@ -25,7 +27,9 @@ library MerkleHelper { /// @notice Computes a single layer of a merkle proof by hashing each pair (i, i+1) for /// each i, i+2, i+4.. n. When an uneven number of leaves is supplied the last item /// is simply included as the last element in the result set and not hashed. - function computeNextLayer(bytes32[] memory layer) public pure returns (bytes32[] memory) { + function computeNextLayer( + bytes32[] memory layer + ) public pure returns (bytes32[] memory) { uint256 leavesLen = layer.length; if (leavesLen == 1) return layer; diff --git a/contracts/src/v0.8/ccip/test/helpers/MessageHasher.sol b/contracts/src/v0.8/ccip/test/helpers/MessageHasher.sol index ea8ba98d44..db89a38612 100644 --- a/contracts/src/v0.8/ccip/test/helpers/MessageHasher.sol +++ b/contracts/src/v0.8/ccip/test/helpers/MessageHasher.sol @@ -61,15 +61,21 @@ contract MessageHasher { return abi.encode(leafDomainSeparator, implicitMetadataHash, fixedSizeFieldsHash, dataHash, tokenAmountsHash); } - function encodeEVMExtraArgsV1(Client.EVMExtraArgsV1 memory extraArgs) public pure returns (bytes memory) { + function encodeEVMExtraArgsV1( + Client.EVMExtraArgsV1 memory extraArgs + ) public pure returns (bytes memory) { return Client._argsToBytes(extraArgs); } - function encodeEVMExtraArgsV2(Client.EVMExtraArgsV2 memory extraArgs) public pure returns (bytes memory) { + function encodeEVMExtraArgsV2( + Client.EVMExtraArgsV2 memory extraArgs + ) public pure returns (bytes memory) { return Client._argsToBytes(extraArgs); } - function decodeEVMExtraArgsV1(uint256 gasLimit) public pure returns (Client.EVMExtraArgsV1 memory) { + function decodeEVMExtraArgsV1( + uint256 gasLimit + ) public pure returns (Client.EVMExtraArgsV1 memory) { return Client.EVMExtraArgsV1(gasLimit); } diff --git a/contracts/src/v0.8/ccip/test/helpers/MessageInterceptorHelper.sol b/contracts/src/v0.8/ccip/test/helpers/MessageInterceptorHelper.sol index a54145da84..80cdf61602 100644 --- a/contracts/src/v0.8/ccip/test/helpers/MessageInterceptorHelper.sol +++ b/contracts/src/v0.8/ccip/test/helpers/MessageInterceptorHelper.sol @@ -14,7 +14,9 @@ contract MessageInterceptorHelper is IMessageInterceptor { } /// @inheritdoc IMessageInterceptor - function onInboundMessage(Client.Any2EVMMessage memory message) external view { + function onInboundMessage( + Client.Any2EVMMessage memory message + ) external view { if (s_invalidMessageIds[message.messageId]) { revert MessageValidationError(bytes("Invalid message")); } diff --git a/contracts/src/v0.8/ccip/test/helpers/MultiAggregateRateLimiterHelper.sol b/contracts/src/v0.8/ccip/test/helpers/MultiAggregateRateLimiterHelper.sol index d011ba0685..7c2e6cc8c2 100644 --- a/contracts/src/v0.8/ccip/test/helpers/MultiAggregateRateLimiterHelper.sol +++ b/contracts/src/v0.8/ccip/test/helpers/MultiAggregateRateLimiterHelper.sol @@ -10,7 +10,9 @@ contract MultiAggregateRateLimiterHelper is MultiAggregateRateLimiter { address[] memory authorizedCallers ) MultiAggregateRateLimiter(feeQuoter, authorizedCallers) {} - function getTokenValue(Client.EVMTokenAmount memory tokenAmount) public view returns (uint256) { + function getTokenValue( + Client.EVMTokenAmount memory tokenAmount + ) public view returns (uint256) { return _getTokenValue(tokenAmount); } } diff --git a/contracts/src/v0.8/ccip/test/helpers/MultiOCR3Helper.sol b/contracts/src/v0.8/ccip/test/helpers/MultiOCR3Helper.sol index 003a5326b8..e760b79935 100644 --- a/contracts/src/v0.8/ccip/test/helpers/MultiOCR3Helper.sol +++ b/contracts/src/v0.8/ccip/test/helpers/MultiOCR3Helper.sol @@ -10,7 +10,9 @@ contract MultiOCR3Helper is MultiOCR3Base { /// Defined in storage since it cannot be passed as calldata due to strict transmit checks uint8 internal s_transmitOcrPluginType; - function setTransmitOcrPluginType(uint8 ocrPluginType) external { + function setTransmitOcrPluginType( + uint8 ocrPluginType + ) external { s_transmitOcrPluginType = ocrPluginType; } @@ -39,7 +41,9 @@ contract MultiOCR3Helper is MultiOCR3Base { return "MultiOCR3BaseHelper 1.0.0"; } - function _afterOCR3ConfigSet(uint8 ocrPluginType) internal virtual override { + function _afterOCR3ConfigSet( + uint8 ocrPluginType + ) internal virtual override { emit AfterConfigSet(ocrPluginType); } } diff --git a/contracts/src/v0.8/ccip/test/helpers/MultiTokenPool.sol b/contracts/src/v0.8/ccip/test/helpers/MultiTokenPool.sol index 5a1bf5021d..93eee7249a 100644 --- a/contracts/src/v0.8/ccip/test/helpers/MultiTokenPool.sol +++ b/contracts/src/v0.8/ccip/test/helpers/MultiTokenPool.sol @@ -108,7 +108,9 @@ abstract contract MultiTokenPool is IPoolV1, OwnerIsCreator { } /// @inheritdoc IPoolV1 - function isSupportedToken(address token) public view virtual returns (bool) { + function isSupportedToken( + address token + ) public view virtual returns (bool) { return s_tokens.contains(token); } @@ -130,7 +132,9 @@ abstract contract MultiTokenPool is IPoolV1, OwnerIsCreator { /// @notice Sets the pool's Router /// @param newRouter The new Router - function setRouter(address newRouter) public onlyOwner { + function setRouter( + address newRouter + ) public onlyOwner { if (newRouter == address(0)) revert ZeroAddressNotAllowed(); address oldRouter = address(s_router); s_router = IRouter(newRouter); @@ -139,7 +143,9 @@ abstract contract MultiTokenPool is IPoolV1, OwnerIsCreator { } /// @notice Signals which version of the pool interface is supported - function supportsInterface(bytes4 interfaceId) public pure virtual override returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) public pure virtual override returns (bool) { return interfaceId == Pool.CCIP_POOL_V1 || interfaceId == type(IPoolV1).interfaceId || interfaceId == type(IERC165).interfaceId; } @@ -157,7 +163,9 @@ abstract contract MultiTokenPool is IPoolV1, OwnerIsCreator { /// @param lockOrBurnIn The input to validate. /// @dev This function should always be called before executing a lock or burn. Not doing so would allow /// for various exploits. - function _validateLockOrBurn(Pool.LockOrBurnInV1 memory lockOrBurnIn) internal { + function _validateLockOrBurn( + Pool.LockOrBurnInV1 memory lockOrBurnIn + ) internal { if (!isSupportedToken(lockOrBurnIn.localToken)) revert InvalidToken(lockOrBurnIn.localToken); if (IRMN(i_rmnProxy).isCursed(bytes16(uint128(lockOrBurnIn.remoteChainSelector)))) revert CursedByRMN(); _checkAllowList(lockOrBurnIn.originalSender); @@ -175,7 +183,9 @@ abstract contract MultiTokenPool is IPoolV1, OwnerIsCreator { /// @param releaseOrMintIn The input to validate. /// @dev This function should always be called before executing a lock or burn. Not doing so would allow /// for various exploits. - function _validateReleaseOrMint(Pool.ReleaseOrMintInV1 memory releaseOrMintIn) internal { + function _validateReleaseOrMint( + Pool.ReleaseOrMintInV1 memory releaseOrMintIn + ) internal { if (!isSupportedToken(releaseOrMintIn.localToken)) revert InvalidToken(releaseOrMintIn.localToken); if (IRMN(i_rmnProxy).isCursed(bytes16(uint128(releaseOrMintIn.remoteChainSelector)))) revert CursedByRMN(); _onlyOffRamp(releaseOrMintIn.remoteChainSelector); @@ -226,7 +236,9 @@ abstract contract MultiTokenPool is IPoolV1, OwnerIsCreator { } /// @inheritdoc IPoolV1 - function isSupportedChain(uint64 remoteChainSelector) public view returns (bool) { + function isSupportedChain( + uint64 remoteChainSelector + ) public view returns (bool) { return s_remoteChainSelectors.contains(remoteChainSelector); } @@ -357,14 +369,18 @@ abstract contract MultiTokenPool is IPoolV1, OwnerIsCreator { /// @notice Checks whether remote chain selector is configured on this contract, and if the msg.sender /// is a permissioned onRamp for the given chain on the Router. - function _onlyOnRamp(uint64 remoteChainSelector) internal view { + function _onlyOnRamp( + uint64 remoteChainSelector + ) internal view { if (!isSupportedChain(remoteChainSelector)) revert ChainNotAllowed(remoteChainSelector); if (!(msg.sender == s_router.getOnRamp(remoteChainSelector))) revert CallerIsNotARampOnRouter(msg.sender); } /// @notice Checks whether remote chain selector is configured on this contract, and if the msg.sender /// is a permissioned offRamp for the given chain on the Router. - function _onlyOffRamp(uint64 remoteChainSelector) internal view { + function _onlyOffRamp( + uint64 remoteChainSelector + ) internal view { if (!isSupportedChain(remoteChainSelector)) revert ChainNotAllowed(remoteChainSelector); if (!s_router.isOffRamp(remoteChainSelector, msg.sender)) revert CallerIsNotARampOnRouter(msg.sender); } @@ -373,7 +389,9 @@ abstract contract MultiTokenPool is IPoolV1, OwnerIsCreator { // │ Allowlist │ // ================================================================ - function _checkAllowList(address sender) internal view { + function _checkAllowList( + address sender + ) internal view { if (i_allowlistEnabled && !s_allowList.contains(sender)) revert SenderNotAllowed(sender); } diff --git a/contracts/src/v0.8/ccip/test/helpers/OCR2Helper.sol b/contracts/src/v0.8/ccip/test/helpers/OCR2Helper.sol index cb66352ff6..8bac7e8c00 100644 --- a/contracts/src/v0.8/ccip/test/helpers/OCR2Helper.sol +++ b/contracts/src/v0.8/ccip/test/helpers/OCR2Helper.sol @@ -34,5 +34,7 @@ contract OCR2Helper is OCR2Base(false) { return "OCR2BaseHelper 1.0.0"; } - function _beforeSetConfig(bytes memory _onchainConfig) internal override {} + function _beforeSetConfig( + bytes memory _onchainConfig + ) internal override {} } diff --git a/contracts/src/v0.8/ccip/test/helpers/OCR2NoChecksHelper.sol b/contracts/src/v0.8/ccip/test/helpers/OCR2NoChecksHelper.sol index a1ececa326..3885fa11b7 100644 --- a/contracts/src/v0.8/ccip/test/helpers/OCR2NoChecksHelper.sol +++ b/contracts/src/v0.8/ccip/test/helpers/OCR2NoChecksHelper.sol @@ -28,11 +28,15 @@ contract OCR2NoChecksHelper is OCR2BaseNoChecks { ); } - function _report(bytes calldata report) internal override {} + function _report( + bytes calldata report + ) internal override {} function typeAndVersion() public pure override returns (string memory) { return "OCR2BaseHelper 1.0.0"; } - function _beforeSetConfig(bytes memory _onchainConfig) internal override {} + function _beforeSetConfig( + bytes memory _onchainConfig + ) internal override {} } diff --git a/contracts/src/v0.8/ccip/test/helpers/RateLimiterHelper.sol b/contracts/src/v0.8/ccip/test/helpers/RateLimiterHelper.sol index 8fb96a0c1c..6cd1c18705 100644 --- a/contracts/src/v0.8/ccip/test/helpers/RateLimiterHelper.sol +++ b/contracts/src/v0.8/ccip/test/helpers/RateLimiterHelper.sol @@ -8,7 +8,9 @@ contract RateLimiterHelper { RateLimiter.TokenBucket internal s_rateLimiter; - constructor(RateLimiter.Config memory config) { + constructor( + RateLimiter.Config memory config + ) { s_rateLimiter = RateLimiter.TokenBucket({ rate: config.rate, capacity: config.capacity, @@ -26,7 +28,9 @@ contract RateLimiterHelper { return s_rateLimiter._currentTokenBucketState(); } - function setTokenBucketConfig(RateLimiter.Config memory config) external { + function setTokenBucketConfig( + RateLimiter.Config memory config + ) external { s_rateLimiter._setTokenBucketConfig(config); } diff --git a/contracts/src/v0.8/ccip/test/helpers/ReportCodec.sol b/contracts/src/v0.8/ccip/test/helpers/ReportCodec.sol index 2e50124ab4..3bd97035c8 100644 --- a/contracts/src/v0.8/ccip/test/helpers/ReportCodec.sol +++ b/contracts/src/v0.8/ccip/test/helpers/ReportCodec.sol @@ -8,11 +8,15 @@ contract ReportCodec { event ExecuteReportDecoded(Internal.ExecutionReportSingleChain[] report); event CommitReportDecoded(OffRamp.CommitReport report); - function decodeExecuteReport(bytes memory report) public pure returns (Internal.ExecutionReportSingleChain[] memory) { + function decodeExecuteReport( + bytes memory report + ) public pure returns (Internal.ExecutionReportSingleChain[] memory) { return abi.decode(report, (Internal.ExecutionReportSingleChain[])); } - function decodeCommitReport(bytes memory report) public pure returns (OffRamp.CommitReport memory) { + function decodeCommitReport( + bytes memory report + ) public pure returns (OffRamp.CommitReport memory) { return abi.decode(report, (OffRamp.CommitReport)); } } diff --git a/contracts/src/v0.8/ccip/test/helpers/TokenPoolHelper.sol b/contracts/src/v0.8/ccip/test/helpers/TokenPoolHelper.sol index 4965d1ed2f..75f6b1b85d 100644 --- a/contracts/src/v0.8/ccip/test/helpers/TokenPoolHelper.sol +++ b/contracts/src/v0.8/ccip/test/helpers/TokenPoolHelper.sol @@ -26,11 +26,15 @@ contract TokenPoolHelper is TokenPool { return Pool.ReleaseOrMintOutV1({destinationAmount: releaseOrMintIn.amount}); } - function onlyOnRampModifier(uint64 remoteChainSelector) external view { + function onlyOnRampModifier( + uint64 remoteChainSelector + ) external view { _onlyOnRamp(remoteChainSelector); } - function onlyOffRampModifier(uint64 remoteChainSelector) external view { + function onlyOffRampModifier( + uint64 remoteChainSelector + ) external view { _onlyOffRamp(remoteChainSelector); } } diff --git a/contracts/src/v0.8/ccip/test/helpers/receivers/ConformingReceiver.sol b/contracts/src/v0.8/ccip/test/helpers/receivers/ConformingReceiver.sol index 159cd7a851..d4102da075 100644 --- a/contracts/src/v0.8/ccip/test/helpers/receivers/ConformingReceiver.sol +++ b/contracts/src/v0.8/ccip/test/helpers/receivers/ConformingReceiver.sol @@ -9,7 +9,9 @@ contract ConformingReceiver is CCIPReceiver { constructor(address router, address feeToken) CCIPReceiver(router) {} - function _ccipReceive(Client.Any2EVMMessage memory) internal virtual override { + function _ccipReceive( + Client.Any2EVMMessage memory + ) internal virtual override { emit MessageReceived(); } } diff --git a/contracts/src/v0.8/ccip/test/helpers/receivers/MaybeRevertMessageReceiver.sol b/contracts/src/v0.8/ccip/test/helpers/receivers/MaybeRevertMessageReceiver.sol index 01b9b77d37..091c628f09 100644 --- a/contracts/src/v0.8/ccip/test/helpers/receivers/MaybeRevertMessageReceiver.sol +++ b/contracts/src/v0.8/ccip/test/helpers/receivers/MaybeRevertMessageReceiver.sol @@ -17,27 +17,37 @@ contract MaybeRevertMessageReceiver is IAny2EVMMessageReceiver, IERC165 { bool public s_toRevert; bytes private s_err; - constructor(bool toRevert) { + constructor( + bool toRevert + ) { s_manager = msg.sender; s_toRevert = toRevert; } - function setRevert(bool toRevert) external { + function setRevert( + bool toRevert + ) external { s_toRevert = toRevert; } - function setErr(bytes memory err) external { + function setErr( + bytes memory err + ) external { s_err = err; } /// @notice IERC165 supports an interfaceId /// @param interfaceId The interfaceId to check /// @return true if the interfaceId is supported - function supportsInterface(bytes4 interfaceId) public pure override returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) public pure override returns (bool) { return interfaceId == type(IAny2EVMMessageReceiver).interfaceId || interfaceId == type(IERC165).interfaceId; } - function ccipReceive(Client.Any2EVMMessage calldata) external override { + function ccipReceive( + Client.Any2EVMMessage calldata + ) external override { if (s_toRevert) { revert CustomError(s_err); } diff --git a/contracts/src/v0.8/ccip/test/helpers/receivers/MaybeRevertMessageReceiverNo165.sol b/contracts/src/v0.8/ccip/test/helpers/receivers/MaybeRevertMessageReceiverNo165.sol index 4f56394c4e..7db4eab3b2 100644 --- a/contracts/src/v0.8/ccip/test/helpers/receivers/MaybeRevertMessageReceiverNo165.sol +++ b/contracts/src/v0.8/ccip/test/helpers/receivers/MaybeRevertMessageReceiverNo165.sol @@ -9,16 +9,22 @@ contract MaybeRevertMessageReceiverNo165 is IAny2EVMMessageReceiver { event MessageReceived(); - constructor(bool toRevert) { + constructor( + bool toRevert + ) { s_manager = msg.sender; s_toRevert = toRevert; } - function setRevert(bool toRevert) external { + function setRevert( + bool toRevert + ) external { s_toRevert = toRevert; } - function ccipReceive(Client.Any2EVMMessage calldata) external override { + function ccipReceive( + Client.Any2EVMMessage calldata + ) external override { if (s_toRevert) { revert(); } diff --git a/contracts/src/v0.8/ccip/test/helpers/receivers/ReentrancyAbuser.sol b/contracts/src/v0.8/ccip/test/helpers/receivers/ReentrancyAbuser.sol index b69bbcaa43..562de05f66 100644 --- a/contracts/src/v0.8/ccip/test/helpers/receivers/ReentrancyAbuser.sol +++ b/contracts/src/v0.8/ccip/test/helpers/receivers/ReentrancyAbuser.sol @@ -19,11 +19,15 @@ contract ReentrancyAbuser is CCIPReceiver { s_offRamp = offRamp; } - function setPayload(Internal.ExecutionReport calldata payload) public { + function setPayload( + Internal.ExecutionReport calldata payload + ) public { s_payload = payload; } - function _ccipReceive(Client.Any2EVMMessage memory) internal override { + function _ccipReceive( + Client.Any2EVMMessage memory + ) internal override { // Use original message gas limits in manual execution EVM2EVMOffRamp.GasLimitOverride[] memory gasOverrides = _getGasLimitsFromMessages(s_payload.messages); diff --git a/contracts/src/v0.8/ccip/test/helpers/receivers/ReentrancyAbuserMultiRamp.sol b/contracts/src/v0.8/ccip/test/helpers/receivers/ReentrancyAbuserMultiRamp.sol index c8eee48808..3f068151a1 100644 --- a/contracts/src/v0.8/ccip/test/helpers/receivers/ReentrancyAbuserMultiRamp.sol +++ b/contracts/src/v0.8/ccip/test/helpers/receivers/ReentrancyAbuserMultiRamp.sol @@ -17,11 +17,15 @@ contract ReentrancyAbuserMultiRamp is CCIPReceiver { s_offRamp = offRamp; } - function setPayload(Internal.ExecutionReportSingleChain calldata payload) public { + function setPayload( + Internal.ExecutionReportSingleChain calldata payload + ) public { s_payload = payload; } - function _ccipReceive(Client.Any2EVMMessage memory) internal override { + function _ccipReceive( + Client.Any2EVMMessage memory + ) internal override { // Use original message gas limits in manual execution uint256 numMsgs = s_payload.messages.length; OffRamp.GasLimitOverride[][] memory gasOverrides = new OffRamp.GasLimitOverride[][](1); diff --git a/contracts/src/v0.8/ccip/test/legacy/BurnMintTokenPool1_2.sol b/contracts/src/v0.8/ccip/test/legacy/BurnMintTokenPool1_2.sol index 44de2787c6..20343bc1c9 100644 --- a/contracts/src/v0.8/ccip/test/legacy/BurnMintTokenPool1_2.sol +++ b/contracts/src/v0.8/ccip/test/legacy/BurnMintTokenPool1_2.sol @@ -96,7 +96,9 @@ abstract contract TokenPool1_2 is IPoolPriorTo1_5, OwnerIsCreator, IERC165 { } /// @inheritdoc IERC165 - function supportsInterface(bytes4 interfaceId) public pure virtual override returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) public pure virtual override returns (bool) { return interfaceId == type(IPoolPriorTo1_5).interfaceId || interfaceId == type(IERC165).interfaceId; } @@ -106,13 +108,17 @@ abstract contract TokenPool1_2 is IPoolPriorTo1_5, OwnerIsCreator, IERC165 { /// @notice Checks whether something is a permissioned onRamp on this contract. /// @return true if the given address is a permissioned onRamp. - function isOnRamp(address onRamp) public view returns (bool) { + function isOnRamp( + address onRamp + ) public view returns (bool) { return s_onRamps.contains(onRamp); } /// @notice Checks whether something is a permissioned offRamp on this contract. /// @return true if the given address is a permissioned offRamp. - function isOffRamp(address offRamp) public view returns (bool) { + function isOffRamp( + address offRamp + ) public view returns (bool) { return s_offRamps.contains(offRamp); } @@ -195,24 +201,32 @@ abstract contract TokenPool1_2 is IPoolPriorTo1_5, OwnerIsCreator, IERC165 { // ================================================================ /// @notice Consumes outbound rate limiting capacity in this pool - function _consumeOnRampRateLimit(uint256 amount) internal { + function _consumeOnRampRateLimit( + uint256 amount + ) internal { s_onRampRateLimits[msg.sender]._consume(amount, address(i_token)); } /// @notice Consumes inbound rate limiting capacity in this pool - function _consumeOffRampRateLimit(uint256 amount) internal { + function _consumeOffRampRateLimit( + uint256 amount + ) internal { s_offRampRateLimits[msg.sender]._consume(amount, address(i_token)); } /// @notice Gets the token bucket with its values for the block it was requested at. /// @return The token bucket. - function currentOnRampRateLimiterState(address onRamp) external view returns (RateLimiter.TokenBucket memory) { + function currentOnRampRateLimiterState( + address onRamp + ) external view returns (RateLimiter.TokenBucket memory) { return s_onRampRateLimits[onRamp]._currentTokenBucketState(); } /// @notice Gets the token bucket with its values for the block it was requested at. /// @return The token bucket. - function currentOffRampRateLimiterState(address offRamp) external view returns (RateLimiter.TokenBucket memory) { + function currentOffRampRateLimiterState( + address offRamp + ) external view returns (RateLimiter.TokenBucket memory) { return s_offRampRateLimits[offRamp]._currentTokenBucketState(); } @@ -254,7 +268,9 @@ abstract contract TokenPool1_2 is IPoolPriorTo1_5, OwnerIsCreator, IERC165 { // │ Allowlist │ // ================================================================ - modifier checkAllowList(address sender) { + modifier checkAllowList( + address sender + ) { if (i_allowlistEnabled && !s_allowList.contains(sender)) revert SenderNotAllowed(sender); _; } diff --git a/contracts/src/v0.8/ccip/test/legacy/BurnMintTokenPool1_4.sol b/contracts/src/v0.8/ccip/test/legacy/BurnMintTokenPool1_4.sol index 168afee4f0..26107cdefd 100644 --- a/contracts/src/v0.8/ccip/test/legacy/BurnMintTokenPool1_4.sol +++ b/contracts/src/v0.8/ccip/test/legacy/BurnMintTokenPool1_4.sol @@ -114,7 +114,9 @@ abstract contract TokenPool1_4 is IPoolPriorTo1_5, OwnerIsCreator, IERC165 { /// @notice Sets the pool's Router /// @param newRouter The new Router - function setRouter(address newRouter) public onlyOwner { + function setRouter( + address newRouter + ) public onlyOwner { if (newRouter == address(0)) revert ZeroAddressNotAllowed(); address oldRouter = address(s_router); s_router = IRouter(newRouter); @@ -123,7 +125,9 @@ abstract contract TokenPool1_4 is IPoolPriorTo1_5, OwnerIsCreator, IERC165 { } /// @inheritdoc IERC165 - function supportsInterface(bytes4 interfaceId) public pure virtual override returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) public pure virtual override returns (bool) { return interfaceId == type(IPoolPriorTo1_5).interfaceId || interfaceId == type(IERC165).interfaceId; } @@ -133,7 +137,9 @@ abstract contract TokenPool1_4 is IPoolPriorTo1_5, OwnerIsCreator, IERC165 { /// @notice Checks whether a chain selector is permissioned on this contract. /// @return true if the given chain selector is a permissioned remote chain. - function isSupportedChain(uint64 remoteChainSelector) public view returns (bool) { + function isSupportedChain( + uint64 remoteChainSelector + ) public view returns (bool) { return s_remoteChainSelectors.contains(remoteChainSelector); } @@ -154,7 +160,9 @@ abstract contract TokenPool1_4 is IPoolPriorTo1_5, OwnerIsCreator, IERC165 { /// @dev Only callable by the owner /// @param chains A list of chains and their new permission status & rate limits. Rate limits /// are only used when the chain is being added through `allowed` being true. - function applyChainUpdates(ChainUpdate[] calldata chains) external virtual onlyOwner { + function applyChainUpdates( + ChainUpdate[] calldata chains + ) external virtual onlyOwner { for (uint256 i = 0; i < chains.length; ++i) { ChainUpdate memory update = chains[i]; RateLimiter._validateTokenBucketConfig(update.outboundRateLimiterConfig, !update.allowed); @@ -256,7 +264,9 @@ abstract contract TokenPool1_4 is IPoolPriorTo1_5, OwnerIsCreator, IERC165 { /// @notice Checks whether remote chain selector is configured on this contract, and if the msg.sender /// is a permissioned onRamp for the given chain on the Router. - modifier onlyOnRamp(uint64 remoteChainSelector) { + modifier onlyOnRamp( + uint64 remoteChainSelector + ) { if (!isSupportedChain(remoteChainSelector)) revert ChainNotAllowed(remoteChainSelector); if (!(msg.sender == s_router.getOnRamp(remoteChainSelector))) revert CallerIsNotARampOnRouter(msg.sender); _; @@ -264,7 +274,9 @@ abstract contract TokenPool1_4 is IPoolPriorTo1_5, OwnerIsCreator, IERC165 { /// @notice Checks whether remote chain selector is configured on this contract, and if the msg.sender /// is a permissioned offRamp for the given chain on the Router. - modifier onlyOffRamp(uint64 remoteChainSelector) { + modifier onlyOffRamp( + uint64 remoteChainSelector + ) { if (!isSupportedChain(remoteChainSelector)) revert ChainNotAllowed(remoteChainSelector); if (!s_router.isOffRamp(remoteChainSelector, msg.sender)) revert CallerIsNotARampOnRouter(msg.sender); _; @@ -274,7 +286,9 @@ abstract contract TokenPool1_4 is IPoolPriorTo1_5, OwnerIsCreator, IERC165 { // │ Allowlist │ // ================================================================ - modifier checkAllowList(address sender) { + modifier checkAllowList( + address sender + ) { if (i_allowlistEnabled && !s_allowList.contains(sender)) revert SenderNotAllowed(sender); _; } @@ -331,7 +345,9 @@ abstract contract BurnMintTokenPoolAbstract is TokenPool1_4 { /// @notice Contains the specific burn call for a pool. /// @dev overriding this method allows us to create pools with different burn signatures /// without duplicating the underlying logic. - function _burn(uint256 amount) internal virtual; + function _burn( + uint256 amount + ) internal virtual; /// @notice Burn the token in the pool /// @param amount Amount to burn @@ -392,7 +408,9 @@ contract BurnMintTokenPool1_4 is BurnMintTokenPoolAbstract, ITypeAndVersion { ) TokenPool1_4(token, allowlist, armProxy, router) {} /// @inheritdoc BurnMintTokenPoolAbstract - function _burn(uint256 amount) internal virtual override { + function _burn( + uint256 amount + ) internal virtual override { IBurnMintERC20(address(i_token)).burn(amount); } } diff --git a/contracts/src/v0.8/ccip/test/legacy/TokenPoolAndProxy.t.sol b/contracts/src/v0.8/ccip/test/legacy/TokenPoolAndProxy.t.sol index 9645d70b7a..ad41c76326 100644 --- a/contracts/src/v0.8/ccip/test/legacy/TokenPoolAndProxy.t.sol +++ b/contracts/src/v0.8/ccip/test/legacy/TokenPoolAndProxy.t.sol @@ -595,7 +595,9 @@ contract LockReleaseTokenPoolPoolAndProxy_canAcceptLiquidity is LockReleaseToken } contract LockReleaseTokenPoolPoolAndProxy_provideLiquidity is LockReleaseTokenPoolAndProxySetup { - function test_Fuzz_ProvideLiquidity_Success(uint256 amount) public { + function test_Fuzz_ProvideLiquidity_Success( + uint256 amount + ) public { uint256 balancePre = s_token.balanceOf(OWNER); s_token.approve(address(s_lockReleaseTokenPoolAndProxy), amount); @@ -614,7 +616,9 @@ contract LockReleaseTokenPoolPoolAndProxy_provideLiquidity is LockReleaseTokenPo s_lockReleaseTokenPoolAndProxy.provideLiquidity(1); } - function test_Fuzz_ExceedsAllowance(uint256 amount) public { + function test_Fuzz_ExceedsAllowance( + uint256 amount + ) public { vm.assume(amount > 0); vm.expectRevert("ERC20: insufficient allowance"); s_lockReleaseTokenPoolAndProxy.provideLiquidity(amount); @@ -630,7 +634,9 @@ contract LockReleaseTokenPoolPoolAndProxy_provideLiquidity is LockReleaseTokenPo } contract LockReleaseTokenPoolPoolAndProxy_withdrawalLiquidity is LockReleaseTokenPoolAndProxySetup { - function test_Fuzz_WithdrawalLiquidity_Success(uint256 amount) public { + function test_Fuzz_WithdrawalLiquidity_Success( + uint256 amount + ) public { uint256 balancePre = s_token.balanceOf(OWNER); s_token.approve(address(s_lockReleaseTokenPoolAndProxy), amount); s_lockReleaseTokenPoolAndProxy.provideLiquidity(amount); diff --git a/contracts/src/v0.8/ccip/test/mocks/MockCommitStore.sol b/contracts/src/v0.8/ccip/test/mocks/MockCommitStore.sol index aff06016fa..941977367e 100644 --- a/contracts/src/v0.8/ccip/test/mocks/MockCommitStore.sol +++ b/contracts/src/v0.8/ccip/test/mocks/MockCommitStore.sol @@ -23,7 +23,9 @@ contract MockCommitStore is ICommitStore { return s_expectedNextSequenceNumber; } - function setExpectedNextSequenceNumber(uint64 nextSeqNum) external { + function setExpectedNextSequenceNumber( + uint64 nextSeqNum + ) external { s_expectedNextSequenceNumber = nextSeqNum; } diff --git a/contracts/src/v0.8/ccip/test/mocks/MockE2EUSDCTransmitter.sol b/contracts/src/v0.8/ccip/test/mocks/MockE2EUSDCTransmitter.sol index bbd9c7dcc6..c9226a47c3 100644 --- a/contracts/src/v0.8/ccip/test/mocks/MockE2EUSDCTransmitter.sol +++ b/contracts/src/v0.8/ccip/test/mocks/MockE2EUSDCTransmitter.sol @@ -72,7 +72,9 @@ contract MockE2EUSDCTransmitter is IMessageTransmitterWithRelay { return s_shouldSucceed; } - function setShouldSucceed(bool shouldSucceed) external { + function setShouldSucceed( + bool shouldSucceed + ) external { s_shouldSucceed = shouldSucceed; } diff --git a/contracts/src/v0.8/ccip/test/mocks/MockRMN.sol b/contracts/src/v0.8/ccip/test/mocks/MockRMN.sol index 343078cc37..435c669763 100644 --- a/contracts/src/v0.8/ccip/test/mocks/MockRMN.sol +++ b/contracts/src/v0.8/ccip/test/mocks/MockRMN.sol @@ -17,7 +17,9 @@ contract MockRMN is IRMN { s_blessedByRoot[taggedRoot.commitStore][taggedRoot.root] = blessed; } - function setGlobalCursed(bool cursed) external { + function setGlobalCursed( + bool cursed + ) external { s_globalCursed = cursed; } @@ -27,7 +29,9 @@ contract MockRMN is IRMN { /// @notice Setting a revert error with length of 0 will disable reverts /// @dev Useful to test revert handling of ARMProxy - function setIsCursedRevert(bytes calldata revertErr) external { + function setIsCursedRevert( + bytes calldata revertErr + ) external { s_isCursedRevert = revertErr; } @@ -40,14 +44,18 @@ contract MockRMN is IRMN { return s_globalCursed; } - function isCursed(bytes16 subject) external view returns (bool) { + function isCursed( + bytes16 subject + ) external view returns (bool) { if (s_isCursedRevert.length > 0) { revert CustomError(s_isCursedRevert); } return s_globalCursed || s_cursedBySubject[subject]; } - function isBlessed(IRMN.TaggedRoot calldata taggedRoot) external view returns (bool) { + function isBlessed( + IRMN.TaggedRoot calldata taggedRoot + ) external view returns (bool) { return s_blessedByRoot[taggedRoot.commitStore][taggedRoot.root]; } } diff --git a/contracts/src/v0.8/ccip/test/mocks/MockRMN1_0.sol b/contracts/src/v0.8/ccip/test/mocks/MockRMN1_0.sol index d1a488d557..2f1df4926c 100644 --- a/contracts/src/v0.8/ccip/test/mocks/MockRMN1_0.sol +++ b/contracts/src/v0.8/ccip/test/mocks/MockRMN1_0.sol @@ -54,14 +54,18 @@ contract MockRMN is IRMN, OwnerIsCreator { return s_curse; } - function isCursed(bytes16 subject) external view override returns (bool) { + function isCursed( + bytes16 subject + ) external view override returns (bool) { if (s_err.length != 0) { revert CustomError(s_err); } return s_curse || s_curseBySubject[subject]; } - function voteToCurse(bytes32) external { + function voteToCurse( + bytes32 + ) external { s_curse = true; } @@ -69,7 +73,9 @@ contract MockRMN is IRMN, OwnerIsCreator { s_curseBySubject[subject] = true; } - function ownerUnvoteToCurse(OldRMN.UnvoteToCurseRecord[] memory) external { + function ownerUnvoteToCurse( + OldRMN.UnvoteToCurseRecord[] memory + ) external { s_curse = false; } @@ -77,11 +83,15 @@ contract MockRMN is IRMN, OwnerIsCreator { s_curseBySubject[subject] = false; } - function setRevert(bytes memory err) external { + function setRevert( + bytes memory err + ) external { s_err = err; } - function isBlessed(IRMN.TaggedRoot calldata) external view override returns (bool) { + function isBlessed( + IRMN.TaggedRoot calldata + ) external view override returns (bool) { return !s_curse; } diff --git a/contracts/src/v0.8/ccip/test/mocks/MockRouter.sol b/contracts/src/v0.8/ccip/test/mocks/MockRouter.sol index 6ca0bc073a..3ded9fd78f 100644 --- a/contracts/src/v0.8/ccip/test/mocks/MockRouter.sol +++ b/contracts/src/v0.8/ccip/test/mocks/MockRouter.sol @@ -119,7 +119,9 @@ contract MockCCIPRouter is IRouter, IRouterClient { return mockMsgId; } - function _fromBytes(bytes calldata extraArgs) internal pure returns (Client.EVMExtraArgsV2 memory) { + function _fromBytes( + bytes calldata extraArgs + ) internal pure returns (Client.EVMExtraArgsV2 memory) { if (extraArgs.length == 0) { return Client.EVMExtraArgsV2({gasLimit: DEFAULT_GAS_LIMIT, allowOutOfOrderExecution: false}); } @@ -135,12 +137,16 @@ contract MockCCIPRouter is IRouter, IRouterClient { } /// @notice Always returns true to make sure this check can be performed on any chain. - function isChainSupported(uint64) external pure returns (bool supported) { + function isChainSupported( + uint64 + ) external pure returns (bool supported) { return true; } /// @notice Returns an empty array. - function getSupportedTokens(uint64) external pure returns (address[] memory tokens) { + function getSupportedTokens( + uint64 + ) external pure returns (address[] memory tokens) { return new address[](0); } @@ -150,12 +156,16 @@ contract MockCCIPRouter is IRouter, IRouterClient { } /// @notice Sets the fees returned by getFee but is only checked when using native fee tokens - function setFee(uint256 feeAmount) external { + function setFee( + uint256 feeAmount + ) external { s_mockFeeTokenAmount = feeAmount; } /// @notice Always returns address(1234567890) - function getOnRamp(uint64 /* destChainSelector */ ) external pure returns (address onRampAddress) { + function getOnRamp( + uint64 /* destChainSelector */ + ) external pure returns (address onRampAddress) { return address(1234567890); } diff --git a/contracts/src/v0.8/ccip/test/ocr/MultiOCR3BaseSetup.t.sol b/contracts/src/v0.8/ccip/test/ocr/MultiOCR3BaseSetup.t.sol index 6f6219bc9b..9cfddf0dd5 100644 --- a/contracts/src/v0.8/ccip/test/ocr/MultiOCR3BaseSetup.t.sol +++ b/contracts/src/v0.8/ccip/test/ocr/MultiOCR3BaseSetup.t.sol @@ -84,7 +84,9 @@ contract MultiOCR3BaseSetup is BaseTest { vm.assertEq(configA.transmitters, configB.transmitters); } - function _assertOCRConfigUnconfigured(MultiOCR3Base.OCRConfig memory config) internal pure { + function _assertOCRConfigUnconfigured( + MultiOCR3Base.OCRConfig memory config + ) internal pure { assertEq(config.configInfo.configDigest, bytes32("")); assertEq(config.signers.length, 0); assertEq(config.transmitters.length, 0); diff --git a/contracts/src/v0.8/ccip/test/offRamp/EVM2EVMOffRamp.t.sol b/contracts/src/v0.8/ccip/test/offRamp/EVM2EVMOffRamp.t.sol index 493d02c7c2..876d74144d 100644 --- a/contracts/src/v0.8/ccip/test/offRamp/EVM2EVMOffRamp.t.sol +++ b/contracts/src/v0.8/ccip/test/offRamp/EVM2EVMOffRamp.t.sol @@ -248,7 +248,9 @@ contract EVM2EVMOffRamp_execute is EVM2EVMOffRampSetup { assertEq(startingBalance + amounts[0], dstToken0.balanceOf(message.receiver)); } - function test_Fuzz_getSenderNonce(uint8 trialExecutions) public { + function test_Fuzz_getSenderNonce( + uint8 trialExecutions + ) public { vm.assume(trialExecutions > 1); Internal.EVM2EVMMessage[] memory messages; @@ -279,7 +281,9 @@ contract EVM2EVMOffRamp_execute is EVM2EVMOffRampSetup { assertEq(s_offRamp.getSenderNonce(messages[0].sender), nonceBefore, "sender nonce is not as expected"); } - function test_Fuzz_getSenderNonceWithPrevOffRamp_Success(uint8 trialExecutions) public { + function test_Fuzz_getSenderNonceWithPrevOffRamp_Success( + uint8 trialExecutions + ) public { vm.assume(trialExecutions > 1); // Fuzz a random nonce for getSenderNonce test_Fuzz_getSenderNonce(trialExecutions); @@ -543,7 +547,9 @@ contract EVM2EVMOffRamp_execute is EVM2EVMOffRampSetup { assertEq(uint64(2), s_offRamp.getSenderNonce(OWNER)); } - function test_Fuzz_InterleavingOrderedAndUnorderedMessages_Success(bool[7] memory orderings) public { + function test_Fuzz_InterleavingOrderedAndUnorderedMessages_Success( + bool[7] memory orderings + ) public { Internal.EVM2EVMMessage[] memory messages = new Internal.EVM2EVMMessage[](orderings.length); // number of tokens needs to be capped otherwise we hit UnsupportedNumberOfTokens. Client.EVMTokenAmount[] memory tokenAmounts = new Client.EVMTokenAmount[](3); @@ -981,7 +987,9 @@ contract EVM2EVMOffRamp_executeSingleMessage is EVM2EVMOffRampSetup { s_offRamp.executeSingleMessage(message, new bytes[](message.tokenAmounts.length), new uint32[](0)); } - function _generateMsgWithoutTokens(uint256 gasLimit) internal view returns (Internal.EVM2EVMMessage memory) { + function _generateMsgWithoutTokens( + uint256 gasLimit + ) internal view returns (Internal.EVM2EVMMessage memory) { Internal.EVM2EVMMessage memory message = _generateAny2EVMMessageNoTokens(1); message.gasLimit = gasLimit; message.data = ""; @@ -2055,7 +2063,9 @@ contract EVM2EVMOffRamp__releaseOrMintTokens is EVM2EVMOffRampSetup { /// forge-config: default.fuzz.runs = 32 /// forge-config: ccip.fuzz.runs = 1024 // Uint256 gives a good range of values to test, both inside and outside of the eth address space. - function test_Fuzz__releaseOrMintTokens_AnyRevertIsCaught_Success(uint256 destPool) public { + function test_Fuzz__releaseOrMintTokens_AnyRevertIsCaught_Success( + uint256 destPool + ) public { // Input 447301751254033913445893214690834296930546521452, which is 0x4E59B44847B379578588920CA78FBF26C0B4956C // triggers some Create2Deployer and causes it to fail vm.assume(destPool != 447301751254033913445893214690834296930546521452); @@ -2165,7 +2175,9 @@ contract EVM2EVMOffRamp_updateRateLimitTokens is EVM2EVMOffRampSetup { assertEq(adds[1].destToken, destTokens[0]); } - function test_Fuzz_UpdateRateLimitTokens(uint8 numTokens) public { + function test_Fuzz_UpdateRateLimitTokens( + uint8 numTokens + ) public { // Needs to be more than 1 so that the division doesn't round down and the even makes the comparisons simpler vm.assume(numTokens > 1 && numTokens % 2 == 0); diff --git a/contracts/src/v0.8/ccip/test/offRamp/OffRamp.t.sol b/contracts/src/v0.8/ccip/test/offRamp/OffRamp.t.sol index 9cf0321a85..e86784ce88 100644 --- a/contracts/src/v0.8/ccip/test/offRamp/OffRamp.t.sol +++ b/contracts/src/v0.8/ccip/test/offRamp/OffRamp.t.sol @@ -695,7 +695,9 @@ contract OffRamp_executeSingleReport is OffRampSetup { assertEq(uint64(2), s_inboundNonceManager.getInboundNonce(SOURCE_CHAIN_SELECTOR_1, abi.encode(OWNER))); } - function test_Fuzz_InterleavingOrderedAndUnorderedMessages_Success(bool[7] memory orderings) public { + function test_Fuzz_InterleavingOrderedAndUnorderedMessages_Success( + bool[7] memory orderings + ) public { Internal.Any2EVMRampMessage[] memory messages = new Internal.Any2EVMRampMessage[](orderings.length); // number of tokens needs to be capped otherwise we hit UnsupportedNumberOfTokens. Client.EVMTokenAmount[] memory tokenAmounts = new Client.EVMTokenAmount[](3); @@ -990,7 +992,9 @@ contract OffRamp_executeSingleReport is OffRampSetup { ); } - function _constructCommitReport(bytes32 merkleRoot) internal view returns (OffRamp.CommitReport memory) { + function _constructCommitReport( + bytes32 merkleRoot + ) internal view returns (OffRamp.CommitReport memory) { Internal.MerkleRoot[] memory roots = new Internal.MerkleRoot[](1); roots[0] = Internal.MerkleRoot({ sourceChainSelector: SOURCE_CHAIN_SELECTOR_1, @@ -2969,7 +2973,9 @@ contract OffRamp_releaseOrMintTokens is OffRampSetup { /// forge-config: default.fuzz.runs = 32 /// forge-config: ccip.fuzz.runs = 1024 // Uint256 gives a good range of values to test, both inside and outside of the eth address space. - function test_Fuzz__releaseOrMintTokens_AnyRevertIsCaught_Success(address destPool) public { + function test_Fuzz__releaseOrMintTokens_AnyRevertIsCaught_Success( + address destPool + ) public { // Input 447301751254033913445893214690834296930546521452, which is 0x4E59B44847B379578588920CA78FBF26C0B4956C // triggers some Create2Deployer and causes it to fail vm.assume(destPool != 0x4e59b44847b379578588920cA78FbF26c0B4956C); diff --git a/contracts/src/v0.8/ccip/test/offRamp/OffRampSetup.t.sol b/contracts/src/v0.8/ccip/test/offRamp/OffRampSetup.t.sol index 0fb4ff5094..4202807102 100644 --- a/contracts/src/v0.8/ccip/test/offRamp/OffRampSetup.t.sol +++ b/contracts/src/v0.8/ccip/test/offRamp/OffRampSetup.t.sol @@ -188,7 +188,9 @@ contract OffRampSetup is FeeQuoterSetup, MultiOCR3BaseSetup { _setupMultipleOffRampsFromConfigs(sourceChainConfigs); } - function _setupMultipleOffRampsFromConfigs(OffRamp.SourceChainConfigArgs[] memory sourceChainConfigs) internal { + function _setupMultipleOffRampsFromConfigs( + OffRamp.SourceChainConfigArgs[] memory sourceChainConfigs + ) internal { s_offRamp.applySourceChainConfigUpdates(sourceChainConfigs); Router.OnRamp[] memory onRampUpdates = new Router.OnRamp[](0); @@ -223,7 +225,9 @@ contract OffRampSetup is FeeQuoterSetup, MultiOCR3BaseSetup { uint32 internal constant MAX_TOKEN_POOL_RELEASE_OR_MINT_GAS = 200_000; uint32 internal constant MAX_TOKEN_POOL_TRANSFER_GAS = 50_000; - function _generateDynamicOffRampConfig(address feeQuoter) internal pure returns (OffRamp.DynamicConfig memory) { + function _generateDynamicOffRampConfig( + address feeQuoter + ) internal pure returns (OffRamp.DynamicConfig memory) { return OffRamp.DynamicConfig({ permissionLessExecutionThresholdSeconds: PERMISSION_LESS_EXECUTION_THRESHOLD_SECONDS, feeQuoter: feeQuoter, @@ -463,7 +467,9 @@ contract OffRampSetup is FeeQuoterSetup, MultiOCR3BaseSetup { s_offRamp.commit(reportContext, abi.encode(commitReport), rs, ss, rawVs); } - function _execute(Internal.ExecutionReportSingleChain[] memory reports) internal { + function _execute( + Internal.ExecutionReportSingleChain[] memory reports + ) internal { bytes32[3] memory reportContext = [s_configDigestExec, s_configDigestExec, s_configDigestExec]; vm.startPrank(s_validTransmitters[0]); @@ -526,7 +532,9 @@ contract OffRampSetup is FeeQuoterSetup, MultiOCR3BaseSetup { } } - function _assertNoEmit(bytes32 eventSelector) internal { + function _assertNoEmit( + bytes32 eventSelector + ) internal { Vm.Log[] memory logs = vm.getRecordedLogs(); for (uint256 i = 0; i < logs.length; i++) { diff --git a/contracts/src/v0.8/ccip/test/onRamp/EVM2EVMOnRamp.t.sol b/contracts/src/v0.8/ccip/test/onRamp/EVM2EVMOnRamp.t.sol index f0cd0f80ed..40309a8da6 100644 --- a/contracts/src/v0.8/ccip/test/onRamp/EVM2EVMOnRamp.t.sol +++ b/contracts/src/v0.8/ccip/test/onRamp/EVM2EVMOnRamp.t.sol @@ -67,7 +67,9 @@ contract EVM2EVMOnRamp_constructor is EVM2EVMOnRampSetup { } contract EVM2EVMOnRamp_payNops_fuzz is EVM2EVMOnRampSetup { - function test_Fuzz_NopPayNops_Success(uint96 nopFeesJuels) public { + function test_Fuzz_NopPayNops_Success( + uint96 nopFeesJuels + ) public { (EVM2EVMOnRamp.NopAndWeight[] memory nopsAndWeights, uint256 weightsTotal) = s_onRamp.getNops(); // To avoid NoFeesToPay vm.assume(nopFeesJuels > weightsTotal); @@ -1045,7 +1047,9 @@ contract EVM2EVMOnRamp_getFeeSetup is EVM2EVMOnRampSetup { return (tokenAmount * ratio) / 1e5; } - function configUSDCentToWei(uint256 usdCent) internal pure returns (uint256) { + function configUSDCentToWei( + uint256 usdCent + ) internal pure returns (uint256) { return usdCent * 1e16; } } diff --git a/contracts/src/v0.8/ccip/test/onRamp/OnRamp.t.sol b/contracts/src/v0.8/ccip/test/onRamp/OnRamp.t.sol index 16889db39e..5ccd20b015 100644 --- a/contracts/src/v0.8/ccip/test/onRamp/OnRamp.t.sol +++ b/contracts/src/v0.8/ccip/test/onRamp/OnRamp.t.sol @@ -809,7 +809,9 @@ contract OnRamp_withdrawFeeTokens is OnRampSetup { } } - function test_Fuzz_WithdrawFeeTokens_Success(uint256[5] memory amounts) public { + function test_Fuzz_WithdrawFeeTokens_Success( + uint256[5] memory amounts + ) public { vm.startPrank(OWNER); address[] memory feeTokens = new address[](amounts.length); for (uint256 i = 0; i < amounts.length; ++i) { diff --git a/contracts/src/v0.8/ccip/test/onRamp/OnRampSetup.t.sol b/contracts/src/v0.8/ccip/test/onRamp/OnRampSetup.t.sol index 541146bdaf..7ba22d9458 100644 --- a/contracts/src/v0.8/ccip/test/onRamp/OnRampSetup.t.sol +++ b/contracts/src/v0.8/ccip/test/onRamp/OnRampSetup.t.sol @@ -105,7 +105,9 @@ contract OnRampSetup is FeeQuoterFeeSetup { ); } - function _generateDynamicOnRampConfig(address feeQuoter) internal pure returns (OnRamp.DynamicConfig memory) { + function _generateDynamicOnRampConfig( + address feeQuoter + ) internal pure returns (OnRamp.DynamicConfig memory) { return OnRamp.DynamicConfig({ feeQuoter: feeQuoter, reentrancyGuardEntered: false, @@ -116,7 +118,9 @@ contract OnRampSetup is FeeQuoterFeeSetup { } // Slicing is only available for calldata. So we have to build a new bytes array. - function _removeFirst4Bytes(bytes memory data) internal pure returns (bytes memory) { + function _removeFirst4Bytes( + bytes memory data + ) internal pure returns (bytes memory) { bytes memory result = new bytes(data.length - 4); for (uint256 i = 4; i < data.length; ++i) { result[i - 4] = data[i]; @@ -124,7 +128,9 @@ contract OnRampSetup is FeeQuoterFeeSetup { return result; } - function _generateDestChainConfigArgs(IRouter router) internal pure returns (OnRamp.DestChainConfigArgs[] memory) { + function _generateDestChainConfigArgs( + IRouter router + ) internal pure returns (OnRamp.DestChainConfigArgs[] memory) { OnRamp.DestChainConfigArgs[] memory destChainConfigs = new OnRamp.DestChainConfigArgs[](1); destChainConfigs[0] = OnRamp.DestChainConfigArgs({destChainSelector: DEST_CHAIN_SELECTOR, router: router, allowListEnabled: false}); diff --git a/contracts/src/v0.8/ccip/test/pools/BurnMintSetup.t.sol b/contracts/src/v0.8/ccip/test/pools/BurnMintSetup.t.sol index 220f6ca112..7bf0ce57d5 100644 --- a/contracts/src/v0.8/ccip/test/pools/BurnMintSetup.t.sol +++ b/contracts/src/v0.8/ccip/test/pools/BurnMintSetup.t.sol @@ -21,7 +21,9 @@ contract BurnMintSetup is RouterSetup { s_burnMintERC677 = new BurnMintERC677("Chainlink Token", "LINK", 18, 0); } - function _applyChainUpdates(address pool) internal { + function _applyChainUpdates( + address pool + ) internal { TokenPool.ChainUpdate[] memory chains = new TokenPool.ChainUpdate[](1); chains[0] = TokenPool.ChainUpdate({ remoteChainSelector: DEST_CHAIN_SELECTOR, diff --git a/contracts/src/v0.8/ccip/test/pools/BurnWithFromMintRebasingTokenPool.t.sol b/contracts/src/v0.8/ccip/test/pools/BurnWithFromMintRebasingTokenPool.t.sol index c88f030c56..ea5b4a2c43 100644 --- a/contracts/src/v0.8/ccip/test/pools/BurnWithFromMintRebasingTokenPool.t.sol +++ b/contracts/src/v0.8/ccip/test/pools/BurnWithFromMintRebasingTokenPool.t.sol @@ -50,7 +50,9 @@ contract BurnWithFromMintTokenPool_releaseOrMint is BurnWithFromMintRebasingToke assertEq(balancePre + amount, s_rebasingToken.balanceOf(address(OWNER))); } - function testFuzz_releaseOrMint_rebasing_success(uint16 multiplierPercentage) public { + function testFuzz_releaseOrMint_rebasing_success( + uint16 multiplierPercentage + ) public { uint256 amount = 1000; uint256 expectedAmount = amount * multiplierPercentage / 100; s_rebasingToken.setMultiplierPercentage(multiplierPercentage); @@ -72,7 +74,9 @@ contract BurnWithFromMintTokenPool_releaseOrMint is BurnWithFromMintRebasingToke s_pool.releaseOrMint(_getReleaseOrMintIn(amount)); } - function _getReleaseOrMintIn(uint256 amount) internal view returns (Pool.ReleaseOrMintInV1 memory) { + function _getReleaseOrMintIn( + uint256 amount + ) internal view returns (Pool.ReleaseOrMintInV1 memory) { return Pool.ReleaseOrMintInV1({ originalSender: bytes(""), receiver: OWNER, diff --git a/contracts/src/v0.8/ccip/test/pools/HybridLockReleaseUSDCTokenPool.t.sol b/contracts/src/v0.8/ccip/test/pools/HybridLockReleaseUSDCTokenPool.t.sol index ddb8c29dc2..73426129ef 100644 --- a/contracts/src/v0.8/ccip/test/pools/HybridLockReleaseUSDCTokenPool.t.sol +++ b/contracts/src/v0.8/ccip/test/pools/HybridLockReleaseUSDCTokenPool.t.sol @@ -126,7 +126,9 @@ contract USDCTokenPoolSetup is BaseTest { s_router.applyRampUpdates(onRampUpdates, new Router.OffRamp[](0), offRampUpdates); } - function _generateUSDCMessage(USDCMessage memory usdcMessage) internal pure returns (bytes memory) { + function _generateUSDCMessage( + USDCMessage memory usdcMessage + ) internal pure returns (bytes memory) { return abi.encodePacked( usdcMessage.version, usdcMessage.sourceDomain, diff --git a/contracts/src/v0.8/ccip/test/pools/LockReleaseTokenPool.t.sol b/contracts/src/v0.8/ccip/test/pools/LockReleaseTokenPool.t.sol index ed8a1cf31f..eea7f2af4c 100644 --- a/contracts/src/v0.8/ccip/test/pools/LockReleaseTokenPool.t.sol +++ b/contracts/src/v0.8/ccip/test/pools/LockReleaseTokenPool.t.sol @@ -76,7 +76,9 @@ contract LockReleaseTokenPool_setRebalancer is LockReleaseTokenPoolSetup { } contract LockReleaseTokenPool_lockOrBurn is LockReleaseTokenPoolSetup { - function test_Fuzz_LockOrBurnNoAllowList_Success(uint256 amount) public { + function test_Fuzz_LockOrBurnNoAllowList_Success( + uint256 amount + ) public { amount = bound(amount, 1, _getOutboundRateLimiterConfig().capacity); vm.startPrank(s_allowedOnRamp); @@ -316,7 +318,9 @@ contract LockReleaseTokenPool_canAcceptLiquidity is LockReleaseTokenPoolSetup { } contract LockReleaseTokenPool_provideLiquidity is LockReleaseTokenPoolSetup { - function test_Fuzz_ProvideLiquidity_Success(uint256 amount) public { + function test_Fuzz_ProvideLiquidity_Success( + uint256 amount + ) public { uint256 balancePre = s_token.balanceOf(OWNER); s_token.approve(address(s_lockReleaseTokenPool), amount); @@ -335,7 +339,9 @@ contract LockReleaseTokenPool_provideLiquidity is LockReleaseTokenPoolSetup { s_lockReleaseTokenPool.provideLiquidity(1); } - function test_Fuzz_ExceedsAllowance(uint256 amount) public { + function test_Fuzz_ExceedsAllowance( + uint256 amount + ) public { vm.assume(amount > 0); vm.expectRevert("ERC20: insufficient allowance"); s_lockReleaseTokenPool.provideLiquidity(amount); @@ -351,7 +357,9 @@ contract LockReleaseTokenPool_provideLiquidity is LockReleaseTokenPoolSetup { } contract LockReleaseTokenPool_withdrawalLiquidity is LockReleaseTokenPoolSetup { - function test_Fuzz_WithdrawalLiquidity_Success(uint256 amount) public { + function test_Fuzz_WithdrawalLiquidity_Success( + uint256 amount + ) public { uint256 balancePre = s_token.balanceOf(OWNER); s_token.approve(address(s_lockReleaseTokenPool), amount); s_lockReleaseTokenPool.provideLiquidity(amount); diff --git a/contracts/src/v0.8/ccip/test/pools/TokenPool.t.sol b/contracts/src/v0.8/ccip/test/pools/TokenPool.t.sol index 2c1bc0ed57..766a4870f6 100644 --- a/contracts/src/v0.8/ccip/test/pools/TokenPool.t.sol +++ b/contracts/src/v0.8/ccip/test/pools/TokenPool.t.sol @@ -109,7 +109,9 @@ contract TokenPool_setRemotePool is TokenPoolSetup { } contract TokenPool_applyChainUpdates is TokenPoolSetup { - function assertState(TokenPool.ChainUpdate[] memory chainUpdates) public view { + function assertState( + TokenPool.ChainUpdate[] memory chainUpdates + ) public view { uint64[] memory chainSelectors = s_tokenPool.getSupportedChains(); for (uint256 i = 0; i < chainUpdates.length; i++) { assertEq(chainUpdates[i].remoteChainSelector, chainSelectors[i]); diff --git a/contracts/src/v0.8/ccip/test/pools/USDCTokenPool.t.sol b/contracts/src/v0.8/ccip/test/pools/USDCTokenPool.t.sol index b71094a310..da5caba9d7 100644 --- a/contracts/src/v0.8/ccip/test/pools/USDCTokenPool.t.sol +++ b/contracts/src/v0.8/ccip/test/pools/USDCTokenPool.t.sol @@ -118,7 +118,9 @@ contract USDCTokenPoolSetup is BaseTest { s_router.applyRampUpdates(onRampUpdates, new Router.OffRamp[](0), offRampUpdates); } - function _generateUSDCMessage(USDCMessage memory usdcMessage) internal pure returns (bytes memory) { + function _generateUSDCMessage( + USDCMessage memory usdcMessage + ) internal pure returns (bytes memory) { return abi.encodePacked( usdcMessage.version, usdcMessage.sourceDomain, diff --git a/contracts/src/v0.8/ccip/test/rmn/RMNRemoteSetup.t.sol b/contracts/src/v0.8/ccip/test/rmn/RMNRemoteSetup.t.sol index ad25abcf1a..131dfec7cb 100644 --- a/contracts/src/v0.8/ccip/test/rmn/RMNRemoteSetup.t.sol +++ b/contracts/src/v0.8/ccip/test/rmn/RMNRemoteSetup.t.sol @@ -36,7 +36,9 @@ contract RMNRemoteSetup is BaseTest { /// @notice sets up a list of signers with strictly increasing onchain public keys /// @dev signers do not have to be in order when configured, but they do when generating signatures /// rather than sort signers every time, we do it once here and store the sorted list - function _setupSigners(uint256 numSigners) internal { + function _setupSigners( + uint256 numSigners + ) internal { // remove any existing config while (s_signerWallets.length > 0) { s_signerWallets.pop(); @@ -123,7 +125,9 @@ contract RMNRemoteSetup is BaseTest { } /// @notice bubble sort on a storage array of wallets - function _sort(Vm.Wallet[] storage wallets) private { + function _sort( + Vm.Wallet[] storage wallets + ) private { bool swapped; for (uint256 i = 1; i < wallets.length; i++) { swapped = false; diff --git a/contracts/src/v0.8/ccip/test/router/Router.t.sol b/contracts/src/v0.8/ccip/test/router/Router.t.sol index 95d3c2f293..2163f807d0 100644 --- a/contracts/src/v0.8/ccip/test/router/Router.t.sol +++ b/contracts/src/v0.8/ccip/test/router/Router.t.sol @@ -313,7 +313,9 @@ contract Router_ccipSend is EVM2EVMOnRampSetup { s_sourceRouter.ccipSend(wrongChain, message); } - function test_Fuzz_UnsupportedFeeToken_Reverts(address wrongFeeToken) public { + function test_Fuzz_UnsupportedFeeToken_Reverts( + address wrongFeeToken + ) public { // We have three fee tokens set, all others should revert. vm.assume(address(s_sourceFeeToken) != wrongFeeToken); vm.assume(address(s_sourceRouter.getWrappedNative()) != wrongFeeToken); @@ -327,7 +329,9 @@ contract Router_ccipSend is EVM2EVMOnRampSetup { s_sourceRouter.ccipSend(DEST_CHAIN_SELECTOR, message); } - function test_Fuzz_UnsupportedToken_Reverts(address wrongToken) public { + function test_Fuzz_UnsupportedToken_Reverts( + address wrongToken + ) public { for (uint256 i = 0; i < s_sourceTokens.length; ++i) { vm.assume(address(s_sourceTokens[i]) != wrongToken); } @@ -399,7 +403,9 @@ contract Router_applyRampUpdates is RouterSetup { s_receiver = new MaybeRevertMessageReceiver(false); } - function _assertOffRampRouteSucceeds(Router.OffRamp memory offRamp) internal { + function _assertOffRampRouteSucceeds( + Router.OffRamp memory offRamp + ) internal { vm.startPrank(offRamp.offRamp); Client.Any2EVMMessage memory message = _generateReceiverMessage(offRamp.sourceChainSelector); @@ -407,7 +413,9 @@ contract Router_applyRampUpdates is RouterSetup { s_sourceRouter.routeMessage(message, GAS_FOR_CALL_EXACT_CHECK, 100_000, address(s_receiver)); } - function _assertOffRampRouteReverts(Router.OffRamp memory offRamp) internal { + function _assertOffRampRouteReverts( + Router.OffRamp memory offRamp + ) internal { vm.startPrank(offRamp.offRamp); vm.expectRevert(IRouter.OnlyOffRamp.selector); @@ -416,7 +424,9 @@ contract Router_applyRampUpdates is RouterSetup { ); } - function test_Fuzz_OffRampUpdates(address[20] memory offRampsInput) public { + function test_Fuzz_OffRampUpdates( + address[20] memory offRampsInput + ) public { Router.OffRamp[] memory offRamps = new Router.OffRamp[](20); for (uint256 i = 0; i < offRampsInput.length; ++i) { @@ -595,7 +605,9 @@ contract Router_applyRampUpdates is RouterSetup { } } - function test_Fuzz_OnRampUpdates(Router.OnRamp[] memory onRamps) public { + function test_Fuzz_OnRampUpdates( + Router.OnRamp[] memory onRamps + ) public { // Test adding onRamps for (uint256 i = 0; i < onRamps.length; ++i) { vm.expectEmit(); @@ -668,7 +680,9 @@ contract Router_applyRampUpdates is RouterSetup { } contract Router_setWrappedNative is EVM2EVMOnRampSetup { - function test_Fuzz_SetWrappedNative_Success(address wrappedNative) public { + function test_Fuzz_SetWrappedNative_Success( + address wrappedNative + ) public { s_sourceRouter.setWrappedNative(wrappedNative); assertEq(wrappedNative, s_sourceRouter.getWrappedNative()); } @@ -694,7 +708,9 @@ contract Router_routeMessage is EVM2EVMOffRampSetup { vm.startPrank(address(s_offRamp)); } - function _generateManualGasLimit(uint256 callDataLength) internal view returns (uint256) { + function _generateManualGasLimit( + uint256 callDataLength + ) internal view returns (uint256) { return ((gasleft() - 2 * (16 * callDataLength + GAS_FOR_CALL_EXACT_CHECK)) * 62) / 64; } @@ -796,7 +812,9 @@ contract Router_routeMessage is EVM2EVMOffRampSetup { assertGt(gasUsed, 3_000); } - function test_Fuzz_ExecutionEvent_Success(bytes calldata error) public { + function test_Fuzz_ExecutionEvent_Success( + bytes calldata error + ) public { Client.Any2EVMMessage memory message = _generateReceiverMessage(SOURCE_CHAIN_SELECTOR); s_reverting_receiver.setErr(error); diff --git a/contracts/src/v0.8/ccip/test/router/RouterSetup.t.sol b/contracts/src/v0.8/ccip/test/router/RouterSetup.t.sol index 7297721baa..f4c1114bf2 100644 --- a/contracts/src/v0.8/ccip/test/router/RouterSetup.t.sol +++ b/contracts/src/v0.8/ccip/test/router/RouterSetup.t.sol @@ -26,7 +26,9 @@ contract RouterSetup is BaseTest { } } - function _generateReceiverMessage(uint64 chainSelector) internal pure returns (Client.Any2EVMMessage memory) { + function _generateReceiverMessage( + uint64 chainSelector + ) internal pure returns (Client.Any2EVMMessage memory) { Client.EVMTokenAmount[] memory ta = new Client.EVMTokenAmount[](0); return Client.Any2EVMMessage({ messageId: bytes32("a"), diff --git a/contracts/src/v0.8/ccip/test/tokenAdminRegistry/RegistryModuleOwnerCustom.t.sol b/contracts/src/v0.8/ccip/test/tokenAdminRegistry/RegistryModuleOwnerCustom.t.sol index fab044d60d..cf40fb62d2 100644 --- a/contracts/src/v0.8/ccip/test/tokenAdminRegistry/RegistryModuleOwnerCustom.t.sol +++ b/contracts/src/v0.8/ccip/test/tokenAdminRegistry/RegistryModuleOwnerCustom.t.sol @@ -105,7 +105,9 @@ contract RegistryModuleOwnerCustom_registerAdminViaOwner is RegistryModuleOwnerC } contract AccessController is AccessControl { - constructor(address admin) { + constructor( + address admin + ) { _grantRole(DEFAULT_ADMIN_ROLE, admin); } } diff --git a/contracts/src/v0.8/ccip/test/tokenAdminRegistry/TokenAdminRegistry.t.sol b/contracts/src/v0.8/ccip/test/tokenAdminRegistry/TokenAdminRegistry.t.sol index ada0369045..a5c2487478 100644 --- a/contracts/src/v0.8/ccip/test/tokenAdminRegistry/TokenAdminRegistry.t.sol +++ b/contracts/src/v0.8/ccip/test/tokenAdminRegistry/TokenAdminRegistry.t.sol @@ -99,7 +99,9 @@ contract TokenAdminRegistry_setPool is TokenAdminRegistrySetup { } contract TokenAdminRegistry_getAllConfiguredTokens is TokenAdminRegistrySetup { - function test_Fuzz_getAllConfiguredTokens_Success(uint8 numberOfTokens) public { + function test_Fuzz_getAllConfiguredTokens_Success( + uint8 numberOfTokens + ) public { TokenAdminRegistry cleanTokenAdminRegistry = new TokenAdminRegistry(); for (uint160 i = 0; i < numberOfTokens; ++i) { cleanTokenAdminRegistry.proposeAdministrator(address(i), address(i + 1000)); diff --git a/contracts/src/v0.8/ccip/tokenAdminRegistry/RegistryModuleOwnerCustom.sol b/contracts/src/v0.8/ccip/tokenAdminRegistry/RegistryModuleOwnerCustom.sol index 799875b758..4392fa8c56 100644 --- a/contracts/src/v0.8/ccip/tokenAdminRegistry/RegistryModuleOwnerCustom.sol +++ b/contracts/src/v0.8/ccip/tokenAdminRegistry/RegistryModuleOwnerCustom.sol @@ -20,7 +20,9 @@ contract RegistryModuleOwnerCustom is ITypeAndVersion { // The TokenAdminRegistry contract ITokenAdminRegistry internal immutable i_tokenAdminRegistry; - constructor(address tokenAdminRegistry) { + constructor( + address tokenAdminRegistry + ) { if (tokenAdminRegistry == address(0)) { revert AddressZero(); } @@ -30,21 +32,27 @@ contract RegistryModuleOwnerCustom is ITypeAndVersion { /// @notice Registers the admin of the token using the `getCCIPAdmin` method. /// @param token The token to register the admin for. /// @dev The caller must be the admin returned by the `getCCIPAdmin` method. - function registerAdminViaGetCCIPAdmin(address token) external { + function registerAdminViaGetCCIPAdmin( + address token + ) external { _registerAdmin(token, IGetCCIPAdmin(token).getCCIPAdmin()); } /// @notice Registers the admin of the token using the `owner` method. /// @param token The token to register the admin for. /// @dev The caller must be the admin returned by the `owner` method. - function registerAdminViaOwner(address token) external { + function registerAdminViaOwner( + address token + ) external { _registerAdmin(token, IOwner(token).owner()); } /// @notice Registers the admin of the token using OZ's AccessControl DEFAULT_ADMIN_ROLE. /// @param token The token to register the admin for. /// @dev The caller must have the DEFAULT_ADMIN_ROLE as defined by the contract itself. - function registerAccessControlDefaultAdmin(address token) external { + function registerAccessControlDefaultAdmin( + address token + ) external { bytes32 defaultAdminRole = AccessControl(token).DEFAULT_ADMIN_ROLE(); if (!AccessControl(token).hasRole(defaultAdminRole, msg.sender)) { revert RequiredRoleNotFound(msg.sender, defaultAdminRole, token); diff --git a/contracts/src/v0.8/ccip/tokenAdminRegistry/TokenAdminRegistry.sol b/contracts/src/v0.8/ccip/tokenAdminRegistry/TokenAdminRegistry.sol index fd995ca96a..fbe821ebc7 100644 --- a/contracts/src/v0.8/ccip/tokenAdminRegistry/TokenAdminRegistry.sol +++ b/contracts/src/v0.8/ccip/tokenAdminRegistry/TokenAdminRegistry.sol @@ -50,7 +50,9 @@ contract TokenAdminRegistry is ITokenAdminRegistry, ITypeAndVersion, OwnerIsCrea /// @notice Returns all pools for the given tokens. /// @dev Will return address(0) for tokens that do not have a pool. - function getPools(address[] calldata tokens) external view returns (address[] memory) { + function getPools( + address[] calldata tokens + ) external view returns (address[] memory) { address[] memory pools = new address[](tokens.length); for (uint256 i = 0; i < tokens.length; ++i) { pools[i] = s_tokenConfig[tokens[i]].tokenPool; @@ -59,14 +61,18 @@ contract TokenAdminRegistry is ITokenAdminRegistry, ITypeAndVersion, OwnerIsCrea } /// @inheritdoc ITokenAdminRegistry - function getPool(address token) external view returns (address) { + function getPool( + address token + ) external view returns (address) { return s_tokenConfig[token].tokenPool; } /// @notice Returns the configuration for a token. /// @param token The token to get the configuration for. /// @return config The configuration for the token. - function getTokenConfig(address token) external view returns (TokenConfig memory) { + function getTokenConfig( + address token + ) external view returns (TokenConfig memory) { return s_tokenConfig[token]; } @@ -136,7 +142,9 @@ contract TokenAdminRegistry is ITokenAdminRegistry, ITypeAndVersion, OwnerIsCrea /// @notice Accepts the administrator role for a token. /// @param localToken The token to accept the administrator role for. /// @dev This function can only be called by the pending administrator. - function acceptAdminRole(address localToken) external { + function acceptAdminRole( + address localToken + ) external { TokenConfig storage config = s_tokenConfig[localToken]; if (config.pendingAdministrator != msg.sender) { revert OnlyPendingAdministrator(msg.sender, localToken); @@ -187,13 +195,17 @@ contract TokenAdminRegistry is ITokenAdminRegistry, ITypeAndVersion, OwnerIsCrea /// @notice Checks if an address is a registry module. /// @param module The address to check. /// @return True if the address is a registry module, false otherwise. - function isRegistryModule(address module) public view returns (bool) { + function isRegistryModule( + address module + ) public view returns (bool) { return s_registryModules.contains(module); } /// @notice Adds a new registry module to the list of allowed modules. /// @param module The module to add. - function addRegistryModule(address module) external onlyOwner { + function addRegistryModule( + address module + ) external onlyOwner { if (s_registryModules.add(module)) { emit RegistryModuleAdded(module); } @@ -201,7 +213,9 @@ contract TokenAdminRegistry is ITokenAdminRegistry, ITypeAndVersion, OwnerIsCrea /// @notice Removes a registry module from the list of allowed modules. /// @param module The module to remove. - function removeRegistryModule(address module) external onlyOwner { + function removeRegistryModule( + address module + ) external onlyOwner { if (s_registryModules.remove(module)) { emit RegistryModuleRemoved(module); } @@ -212,7 +226,9 @@ contract TokenAdminRegistry is ITokenAdminRegistry, ITypeAndVersion, OwnerIsCrea // ================================================================ /// @notice Checks if an address is the administrator of the given token. - modifier onlyTokenAdmin(address token) { + modifier onlyTokenAdmin( + address token + ) { if (s_tokenConfig[token].administrator != msg.sender) { revert OnlyAdministrator(msg.sender, token); } From 7ecb6eea8cf3c2cea8cbd636d3304e1c36273501 Mon Sep 17 00:00:00 2001 From: "app-token-issuer-infra-releng[bot]" <120227048+app-token-issuer-infra-releng[bot]@users.noreply.github.com> Date: Thu, 28 Nov 2024 14:42:08 +0000 Subject: [PATCH 6/7] Update gethwrappers --- .../generated-wrapper-dependency-versions-do-not-edit.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/gethwrappers/ccip/generation/generated-wrapper-dependency-versions-do-not-edit.txt b/core/gethwrappers/ccip/generation/generated-wrapper-dependency-versions-do-not-edit.txt index 55139ea87e..258ae7a753 100644 --- a/core/gethwrappers/ccip/generation/generated-wrapper-dependency-versions-do-not-edit.txt +++ b/core/gethwrappers/ccip/generation/generated-wrapper-dependency-versions-do-not-edit.txt @@ -28,7 +28,7 @@ offramp: ../../../contracts/solc/v0.8.24/OffRamp/OffRamp.abi ../../../contracts/ onramp: ../../../contracts/solc/v0.8.24/OnRamp/OnRamp.abi ../../../contracts/solc/v0.8.24/OnRamp/OnRamp.bin 330be295a313aa4064819fb76d27f4b1a35fdcbd0959d68a71f1ebb72d0b1d7f ping_pong_demo: ../../../contracts/solc/v0.8.24/PingPongDemo/PingPongDemo.abi ../../../contracts/solc/v0.8.24/PingPongDemo/PingPongDemo.bin c1c2f8a65c7ffd971899cae7fe62f2da57d09e936151e2b92163c4bebe699d6b price_registry: ../../../contracts/solc/v0.8.24/PriceRegistry/PriceRegistry.abi ../../../contracts/solc/v0.8.24/PriceRegistry/PriceRegistry.bin e7781d600c1bb7aa4620106af7f6e146a109b97f4cb6a7d06c9e15773340ecb2 -registry_module_owner_custom: ../../../contracts/solc/v0.8.24/RegistryModuleOwnerCustom/RegistryModuleOwnerCustom.abi ../../../contracts/solc/v0.8.24/RegistryModuleOwnerCustom/RegistryModuleOwnerCustom.bin 75be86323c227917a9bbc3f799d7ed02f92db546653a36db30ed0ebe64461353 +registry_module_owner_custom: ../../../contracts/solc/v0.8.24/RegistryModuleOwnerCustom/RegistryModuleOwnerCustom.abi ../../../contracts/solc/v0.8.24/RegistryModuleOwnerCustom/RegistryModuleOwnerCustom.bin 0fc277a0b512db4e20b5a32a775b94ed2c0d342d8237511de78c94f7dacad428 report_codec: ../../../contracts/solc/v0.8.24/ReportCodec/ReportCodec.abi ../../../contracts/solc/v0.8.24/ReportCodec/ReportCodec.bin 738616a62c24ad4c5b851d174f40a06b51ccbc0bbfc65f04ff9d1c865f0be5bc rmn_contract: ../../../contracts/solc/v0.8.24/RMN/RMN.abi ../../../contracts/solc/v0.8.24/RMN/RMN.bin 8b45b0fb08631c6b582fd3c0b4052a79cc2b4e091e6286af1ab131bef63661f9 rmn_proxy_contract: ../../../contracts/solc/v0.8.24/ARMProxy/ARMProxy.abi ../../../contracts/solc/v0.8.24/ARMProxy/ARMProxy.bin b048d8e752e3c41113ebb305c1efa06737ad36b4907b93e627fb0a3113023454 From 6d131fdb89bc19fb421e32efb607074d56b2f207 Mon Sep 17 00:00:00 2001 From: Rens Rooimans Date: Thu, 28 Nov 2024 15:45:09 +0100 Subject: [PATCH 7/7] update snapshots --- contracts/gas-snapshots/ccip.gas-snapshot | 16 +- .../gas-snapshots/functions.gas-snapshot | 18 +- contracts/gas-snapshots/keystone.gas-snapshot | 196 +++++++++--------- contracts/gas-snapshots/l2ep.gas-snapshot | 180 ++++++++-------- contracts/gas-snapshots/shared.gas-snapshot | 75 +++---- 5 files changed, 238 insertions(+), 247 deletions(-) diff --git a/contracts/gas-snapshots/ccip.gas-snapshot b/contracts/gas-snapshots/ccip.gas-snapshot index 47daada4da..3042fa4ce4 100644 --- a/contracts/gas-snapshots/ccip.gas-snapshot +++ b/contracts/gas-snapshots/ccip.gas-snapshot @@ -114,13 +114,13 @@ CommitStore_verify:test_Paused_Revert() (gas: 18568) CommitStore_verify:test_TooManyLeaves_Revert() (gas: 36848) DefensiveExampleTest:test_HappyPath_Success() (gas: 200200) DefensiveExampleTest:test_Recovery() (gas: 424476) -E2E:test_E2E_3MessagesSuccess_gas() (gas: 1108425) +E2E:test_E2E_3MessagesSuccess_gas() (gas: 1141917) EVM2EVMOffRamp__releaseOrMintToken:test__releaseOrMintToken_NotACompatiblePool_Revert() (gas: 38322) EVM2EVMOffRamp__releaseOrMintToken:test__releaseOrMintToken_Success() (gas: 104438) -EVM2EVMOffRamp__releaseOrMintToken:test__releaseOrMintToken_TokenHandlingError_transfer_Revert() (gas: 86026) +EVM2EVMOffRamp__releaseOrMintToken:test__releaseOrMintToken_TokenHandlingError_transfer_Revert() (gas: 83526) EVM2EVMOffRamp__releaseOrMintToken:test_releaseOrMintToken_InvalidDataLength_Revert() (gas: 37365) EVM2EVMOffRamp__releaseOrMintToken:test_releaseOrMintToken_ReleaseOrMintBalanceMismatch_Revert() (gas: 95013) -EVM2EVMOffRamp__releaseOrMintToken:test_releaseOrMintToken_TokenHandlingError_BalanceOf_Revert() (gas: 40341) +EVM2EVMOffRamp__releaseOrMintToken:test_releaseOrMintToken_TokenHandlingError_BalanceOf_Revert() (gas: 37841) EVM2EVMOffRamp__releaseOrMintToken:test_releaseOrMintToken_skip_ReleaseOrMintBalanceMismatch_if_pool_Revert() (gas: 87189) EVM2EVMOffRamp__releaseOrMintTokens:test_OverValueWithARLOff_Success() (gas: 381594) EVM2EVMOffRamp__releaseOrMintTokens:test_PriceNotFoundForToken_Reverts() (gas: 140568) @@ -515,7 +515,7 @@ MultiAggregateRateLimiter_onInboundMessage:test_ValidateMessageWithRateLimitExce MultiAggregateRateLimiter_onInboundMessage:test_ValidateMessageWithRateLimitReset_Success() (gas: 76561) MultiAggregateRateLimiter_onInboundMessage:test_ValidateMessageWithTokensOnDifferentChains_Success() (gas: 308233) MultiAggregateRateLimiter_onInboundMessage:test_ValidateMessageWithTokens_Success() (gas: 50558) -MultiAggregateRateLimiter_onOutboundMessage:test_RateLimitValueDifferentLanes_Success() (gas: 1073669578) +MultiAggregateRateLimiter_onOutboundMessage:test_RateLimitValueDifferentLanes_Success() (gas: 51181) MultiAggregateRateLimiter_onOutboundMessage:test_ValidateMessageWithNoTokens_Success() (gas: 19302) MultiAggregateRateLimiter_onOutboundMessage:test_onOutboundMessage_ValidateMessageFromUnauthorizedCaller_Revert() (gas: 15913) MultiAggregateRateLimiter_onOutboundMessage:test_onOutboundMessage_ValidateMessageWithDifferentTokensOnDifferentChains_Success() (gas: 209885) @@ -569,7 +569,7 @@ MultiOCR3Base_transmit:test_UnauthorizedSigner_Revert() (gas: 61275) MultiOCR3Base_transmit:test_UnconfiguredPlugin_Revert() (gas: 39933) MultiOCR3Base_transmit:test_ZeroSignatures_Revert() (gas: 33049) MultiOnRampTokenPoolReentrancy:test_OnRampTokenPoolReentrancy_Success() (gas: 233732) -MultiRampsE2E:test_E2E_3MessagesMMultiOffRampSuccess_gas() (gas: 1501821) +MultiRampsE2E:test_E2E_3MessagesMMultiOffRampSuccess_gas() (gas: 1518567) NonceManager_NonceIncrementation:test_getIncrementedOutboundNonce_Success() (gas: 37934) NonceManager_NonceIncrementation:test_incrementInboundNonce_Skip() (gas: 23706) NonceManager_NonceIncrementation:test_incrementInboundNonce_Success() (gas: 38778) @@ -637,7 +637,7 @@ OffRamp_batchExecute:test_Unhealthy_Success() (gas: 554256) OffRamp_batchExecute:test_ZeroReports_Revert() (gas: 10622) OffRamp_ccipReceive:test_Reverts() (gas: 15407) OffRamp_commit:test_CommitOnRampMismatch_Revert() (gas: 92905) -OffRamp_commit:test_FailedRMNVerification_Reverts() (gas: 64099) +OffRamp_commit:test_FailedRMNVerification_Reverts() (gas: 61599) OffRamp_commit:test_InvalidIntervalMinLargerThanMax_Revert() (gas: 68173) OffRamp_commit:test_InvalidInterval_Revert() (gas: 64291) OffRamp_commit:test_InvalidRootRevert() (gas: 63356) @@ -731,10 +731,10 @@ OffRamp_manuallyExecute:test_manuallyExecute_WithMultiReportGasOverride_Success( OffRamp_manuallyExecute:test_manuallyExecute_WithPartialMessages_Success() (gas: 347346) OffRamp_releaseOrMintSingleToken:test__releaseOrMintSingleToken_NotACompatiblePool_Revert() (gas: 37656) OffRamp_releaseOrMintSingleToken:test__releaseOrMintSingleToken_Success() (gas: 104404) -OffRamp_releaseOrMintSingleToken:test__releaseOrMintSingleToken_TokenHandlingError_transfer_Revert() (gas: 85342) +OffRamp_releaseOrMintSingleToken:test__releaseOrMintSingleToken_TokenHandlingError_transfer_Revert() (gas: 82842) OffRamp_releaseOrMintSingleToken:test_releaseOrMintToken_InvalidDataLength_Revert() (gas: 36752) OffRamp_releaseOrMintSingleToken:test_releaseOrMintToken_ReleaseOrMintBalanceMismatch_Revert() (gas: 94382) -OffRamp_releaseOrMintSingleToken:test_releaseOrMintToken_TokenHandlingError_BalanceOf_Revert() (gas: 39741) +OffRamp_releaseOrMintSingleToken:test_releaseOrMintToken_TokenHandlingError_BalanceOf_Revert() (gas: 37241) OffRamp_releaseOrMintSingleToken:test_releaseOrMintToken_skip_ReleaseOrMintBalanceMismatch_if_pool_Revert() (gas: 86516) OffRamp_releaseOrMintTokens:test_TokenHandlingError_Reverts() (gas: 162381) OffRamp_releaseOrMintTokens:test__releaseOrMintTokens_PoolIsNotAPool_Reverts() (gas: 23903) diff --git a/contracts/gas-snapshots/functions.gas-snapshot b/contracts/gas-snapshots/functions.gas-snapshot index 69e0271684..1e6966fe09 100644 --- a/contracts/gas-snapshots/functions.gas-snapshot +++ b/contracts/gas-snapshots/functions.gas-snapshot @@ -229,13 +229,13 @@ FunctionsTermsOfServiceAllowList_UnblockSender:test_UnblockSender_RevertIfNotOwn FunctionsTermsOfServiceAllowList_UnblockSender:test_UnblockSender_Success() (gas: 96240) FunctionsTermsOfServiceAllowList_UpdateConfig:test_UpdateConfig_RevertIfNotOwner() (gas: 13819) FunctionsTermsOfServiceAllowList_UpdateConfig:test_UpdateConfig_Success() (gas: 22824) -Gas_AcceptTermsOfService:test_AcceptTermsOfService_Gas() (gas: 84725) -Gas_AddConsumer:test_AddConsumer_Gas() (gas: 79140) +Gas_AcceptTermsOfService:test_AcceptTermsOfService_Gas() (gas: 81752) +Gas_AddConsumer:test_AddConsumer_Gas() (gas: 76167) Gas_CreateSubscription:test_CreateSubscription_Gas() (gas: 73419) -Gas_FulfillRequest_DuplicateRequestID:test_FulfillRequest_DuplicateRequestID_MaximumGas() (gas: 20562) -Gas_FulfillRequest_DuplicateRequestID:test_FulfillRequest_DuplicateRequestID_MinimumGas() (gas: 20024) -Gas_FulfillRequest_Success:test_FulfillRequest_Success_MaximumGas() (gas: 501184) -Gas_FulfillRequest_Success:test_FulfillRequest_Success_MinimumGas() (gas: 202376) -Gas_FundSubscription:test_FundSubscription_Gas() (gas: 38518) -Gas_SendRequest:test_SendRequest_MaximumGas() (gas: 984338) -Gas_SendRequest:test_SendRequest_MinimumGas() (gas: 181561) \ No newline at end of file +Gas_FulfillRequest_DuplicateRequestID:test_FulfillRequest_DuplicateRequestID_MaximumGas() (gas: 17589) +Gas_FulfillRequest_DuplicateRequestID:test_FulfillRequest_DuplicateRequestID_MinimumGas() (gas: 17051) +Gas_FulfillRequest_Success:test_FulfillRequest_Success_MaximumGas() (gas: 498189) +Gas_FulfillRequest_Success:test_FulfillRequest_Success_MinimumGas() (gas: 199381) +Gas_FundSubscription:test_FundSubscription_Gas() (gas: 35545) +Gas_SendRequest:test_SendRequest_MaximumGas() (gas: 981365) +Gas_SendRequest:test_SendRequest_MinimumGas() (gas: 178588) \ No newline at end of file diff --git a/contracts/gas-snapshots/keystone.gas-snapshot b/contracts/gas-snapshots/keystone.gas-snapshot index 3a21b733b0..4752a7bd6f 100644 --- a/contracts/gas-snapshots/keystone.gas-snapshot +++ b/contracts/gas-snapshots/keystone.gas-snapshot @@ -1,87 +1,87 @@ -CapabilitiesRegistry_AddCapabilitiesTest:test_AddCapability_NoConfigurationContract() (gas: 165160) -CapabilitiesRegistry_AddCapabilitiesTest:test_AddCapability_WithConfiguration() (gas: 191990) -CapabilitiesRegistry_AddCapabilitiesTest:test_RevertWhen_CalledByNonAdmin() (gas: 27250) -CapabilitiesRegistry_AddCapabilitiesTest:test_RevertWhen_CapabilityExists() (gas: 152585) -CapabilitiesRegistry_AddCapabilitiesTest:test_RevertWhen_ConfigurationContractDoesNotMatchInterface() (gas: 99251) -CapabilitiesRegistry_AddCapabilitiesTest:test_RevertWhen_ConfigurationContractNotDeployed() (gas: 100235) -CapabilitiesRegistry_AddDONTest:test_AddDON() (gas: 397662) -CapabilitiesRegistry_AddDONTest:test_RevertWhen_CalledByNonAdmin() (gas: 21955) -CapabilitiesRegistry_AddDONTest:test_RevertWhen_CapabilityDoesNotExist() (gas: 173196) -CapabilitiesRegistry_AddDONTest:test_RevertWhen_DeprecatedCapabilityAdded() (gas: 244098) -CapabilitiesRegistry_AddDONTest:test_RevertWhen_DuplicateCapabilityAdded() (gas: 256604) -CapabilitiesRegistry_AddDONTest:test_RevertWhen_DuplicateNodeAdded() (gas: 120335) -CapabilitiesRegistry_AddDONTest:test_RevertWhen_FaultToleranceIsZero() (gas: 46314) -CapabilitiesRegistry_AddDONTest:test_RevertWhen_NodeAlreadyBelongsToWorkflowDON() (gas: 351528) -CapabilitiesRegistry_AddDONTest:test_RevertWhen_NodeDoesNotSupportCapability() (gas: 184109) -CapabilitiesRegistry_AddDONTest_WhenMaliciousCapabilityConfigurationConfigured:test_RevertWhen_MaliciousCapabilitiesConfigContractTriesToRemoveCapabilitiesFromDONNodes() (gas: 351499) -CapabilitiesRegistry_AddNodeOperatorsTest:test_AddNodeOperators() (gas: 196412) -CapabilitiesRegistry_AddNodeOperatorsTest:test_RevertWhen_CalledByNonAdmin() (gas: 20517) -CapabilitiesRegistry_AddNodeOperatorsTest:test_RevertWhen_NodeOperatorAdminAddressZero() (gas: 21853) -CapabilitiesRegistry_AddNodesTest:test_AddsNodeParams() (gas: 370469) -CapabilitiesRegistry_AddNodesTest:test_OwnerCanAddNodes() (gas: 370412) -CapabilitiesRegistry_AddNodesTest:test_RevertWhen_AddingDuplicateP2PId() (gas: 308840) -CapabilitiesRegistry_AddNodesTest:test_RevertWhen_AddingNodeWithInvalidCapability() (gas: 60242) -CapabilitiesRegistry_AddNodesTest:test_RevertWhen_AddingNodeWithInvalidNodeOperator() (gas: 29057) -CapabilitiesRegistry_AddNodesTest:test_RevertWhen_AddingNodeWithoutCapabilities() (gas: 31777) -CapabilitiesRegistry_AddNodesTest:test_RevertWhen_CalledByNonNodeOperatorAdminAndNonOwner() (gas: 29369) -CapabilitiesRegistry_AddNodesTest:test_RevertWhen_P2PIDEmpty() (gas: 31590) -CapabilitiesRegistry_AddNodesTest:test_RevertWhen_SignerAddressEmpty() (gas: 30458) -CapabilitiesRegistry_AddNodesTest:test_RevertWhen_SignerAddressNotUnique() (gas: 318363) -CapabilitiesRegistry_DeprecateCapabilitiesTest:test_DeprecatesCapability() (gas: 92947) -CapabilitiesRegistry_DeprecateCapabilitiesTest:test_EmitsEvent() (gas: 92416) -CapabilitiesRegistry_DeprecateCapabilitiesTest:test_RevertWhen_CalledByNonAdmin() (gas: 25861) -CapabilitiesRegistry_DeprecateCapabilitiesTest:test_RevertWhen_CapabilityDoesNotExist() (gas: 17253) -CapabilitiesRegistry_DeprecateCapabilitiesTest:test_RevertWhen_CapabilityIsDeprecated() (gas: 94546) -CapabilitiesRegistry_GetCapabilitiesTest:test_ReturnsCapabilities() (gas: 148509) -CapabilitiesRegistry_GetDONsTest:test_CorrectlyFetchesDONs() (gas: 79258) -CapabilitiesRegistry_GetDONsTest:test_DoesNotIncludeRemovedDONs() (gas: 75791) -CapabilitiesRegistry_GetHashedCapabilityTest:test_CorrectlyGeneratesHashedCapabilityId() (gas: 13678) -CapabilitiesRegistry_GetHashedCapabilityTest:test_DoesNotCauseIncorrectClashes() (gas: 16541) -CapabilitiesRegistry_GetNodeOperatorsTest:test_CorrectlyFetchesNodeOperators() (gas: 43532) -CapabilitiesRegistry_GetNodeOperatorsTest:test_DoesNotIncludeRemovedNodeOperators() (gas: 45407) -CapabilitiesRegistry_GetNodesTest:test_CorrectlyFetchesNodes() (gas: 78072) -CapabilitiesRegistry_GetNodesTest:test_DoesNotIncludeRemovedNodes() (gas: 81113) -CapabilitiesRegistry_RemoveDONsTest:test_RemovesDON() (gas: 65888) -CapabilitiesRegistry_RemoveDONsTest:test_RevertWhen_CalledByNonAdmin() (gas: 17319) -CapabilitiesRegistry_RemoveDONsTest:test_RevertWhen_DONDoesNotExist() (gas: 18221) -CapabilitiesRegistry_RemoveNodeOperatorsTest:test_RemovesNodeOperator() (gas: 42131) -CapabilitiesRegistry_RemoveNodeOperatorsTest:test_RevertWhen_CalledByNonOwner() (gas: 17570) -CapabilitiesRegistry_RemoveNodesTest:test_CanAddNodeWithSameSignerAddressAfterRemoving() (gas: 128198) -CapabilitiesRegistry_RemoveNodesTest:test_CanRemoveWhenDONDeleted() (gas: 304051) -CapabilitiesRegistry_RemoveNodesTest:test_CanRemoveWhenNodeNoLongerPartOfDON() (gas: 580021) -CapabilitiesRegistry_RemoveNodesTest:test_OwnerCanRemoveNodes() (gas: 79607) -CapabilitiesRegistry_RemoveNodesTest:test_RemovesNode() (gas: 81525) -CapabilitiesRegistry_RemoveNodesTest:test_RevertWhen_CalledByNonNodeOperatorAdminAndNonOwner() (gas: 27098) -CapabilitiesRegistry_RemoveNodesTest:test_RevertWhen_NodeDoesNotExist() (gas: 20122) -CapabilitiesRegistry_RemoveNodesTest:test_RevertWhen_NodePartOfCapabilitiesDON() (gas: 391972) -CapabilitiesRegistry_RemoveNodesTest:test_RevertWhen_P2PIDEmpty() (gas: 20101) -CapabilitiesRegistry_TypeAndVersionTest:test_TypeAndVersion() (gas: 10699) -CapabilitiesRegistry_UpdateDONTest:test_RevertWhen_CalledByNonAdmin() (gas: 21979) -CapabilitiesRegistry_UpdateDONTest:test_RevertWhen_CapabilityDoesNotExist() (gas: 157054) -CapabilitiesRegistry_UpdateDONTest:test_RevertWhen_DONDoesNotExist() (gas: 20190) -CapabilitiesRegistry_UpdateDONTest:test_RevertWhen_DeprecatedCapabilityAdded() (gas: 227956) -CapabilitiesRegistry_UpdateDONTest:test_RevertWhen_DuplicateCapabilityAdded() (gas: 243262) -CapabilitiesRegistry_UpdateDONTest:test_RevertWhen_DuplicateNodeAdded() (gas: 111705) -CapabilitiesRegistry_UpdateDONTest:test_RevertWhen_NodeDoesNotSupportCapability() (gas: 167967) -CapabilitiesRegistry_UpdateDONTest:test_UpdatesDON() (gas: 399442) -CapabilitiesRegistry_UpdateNodeOperatorTest:test_RevertWhen_CalledByNonAdminAndNonOwner() (gas: 24121) -CapabilitiesRegistry_UpdateNodeOperatorTest:test_RevertWhen_NodeOperatorAdminIsZeroAddress() (gas: 22970) -CapabilitiesRegistry_UpdateNodeOperatorTest:test_RevertWhen_NodeOperatorDoesNotExist() (gas: 22368) -CapabilitiesRegistry_UpdateNodeOperatorTest:test_RevertWhen_NodeOperatorIdAndParamLengthsMismatch() (gas: 18126) -CapabilitiesRegistry_UpdateNodeOperatorTest:test_UpdatesNodeOperator() (gas: 43652) -CapabilitiesRegistry_UpdateNodesTest:test_CanUpdateParamsIfNodeSignerAddressNoLongerUsed() (gas: 270986) -CapabilitiesRegistry_UpdateNodesTest:test_OwnerCanUpdateNodes() (gas: 172430) -CapabilitiesRegistry_UpdateNodesTest:test_RevertWhen_AddingNodeWithInvalidCapability() (gas: 40754) -CapabilitiesRegistry_UpdateNodesTest:test_RevertWhen_CalledByAnotherNodeOperatorAdmin() (gas: 32851) -CapabilitiesRegistry_UpdateNodesTest:test_RevertWhen_CalledByNonNodeOperatorAdminAndNonOwner() (gas: 33584) -CapabilitiesRegistry_UpdateNodesTest:test_RevertWhen_NodeDoesNotExist() (gas: 33290) -CapabilitiesRegistry_UpdateNodesTest:test_RevertWhen_NodeSignerAlreadyAssignedToAnotherNode() (gas: 35211) -CapabilitiesRegistry_UpdateNodesTest:test_RevertWhen_P2PIDEmpty() (gas: 33256) -CapabilitiesRegistry_UpdateNodesTest:test_RevertWhen_RemovingCapabilityRequiredByCapabilityDON() (gas: 480598) -CapabilitiesRegistry_UpdateNodesTest:test_RevertWhen_RemovingCapabilityRequiredByWorkflowDON() (gas: 350838) -CapabilitiesRegistry_UpdateNodesTest:test_RevertWhen_SignerAddressEmpty() (gas: 32442) -CapabilitiesRegistry_UpdateNodesTest:test_RevertWhen_UpdatingNodeWithoutCapabilities() (gas: 31565) -CapabilitiesRegistry_UpdateNodesTest:test_UpdatesNodeParams() (gas: 172552) +CapabilitiesRegistry_AddCapabilitiesTest:test_AddCapability_NoConfigurationContract() (gas: 154809) +CapabilitiesRegistry_AddCapabilitiesTest:test_AddCapability_WithConfiguration() (gas: 180379) +CapabilitiesRegistry_AddCapabilitiesTest:test_RevertWhen_CalledByNonAdmin() (gas: 24678) +CapabilitiesRegistry_AddCapabilitiesTest:test_RevertWhen_CapabilityExists() (gas: 145613) +CapabilitiesRegistry_AddCapabilitiesTest:test_RevertWhen_ConfigurationContractDoesNotMatchInterface() (gas: 94543) +CapabilitiesRegistry_AddCapabilitiesTest:test_RevertWhen_ConfigurationContractNotDeployed() (gas: 96326) +CapabilitiesRegistry_AddDONTest:test_AddDON() (gas: 373893) +CapabilitiesRegistry_AddDONTest:test_RevertWhen_CalledByNonAdmin() (gas: 19288) +CapabilitiesRegistry_AddDONTest:test_RevertWhen_CapabilityDoesNotExist() (gas: 169767) +CapabilitiesRegistry_AddDONTest:test_RevertWhen_DeprecatedCapabilityAdded() (gas: 239739) +CapabilitiesRegistry_AddDONTest:test_RevertWhen_DuplicateCapabilityAdded() (gas: 250950) +CapabilitiesRegistry_AddDONTest:test_RevertWhen_DuplicateNodeAdded() (gas: 116905) +CapabilitiesRegistry_AddDONTest:test_RevertWhen_FaultToleranceIsZero() (gas: 43373) +CapabilitiesRegistry_AddDONTest:test_RevertWhen_NodeAlreadyBelongsToWorkflowDON() (gas: 344037) +CapabilitiesRegistry_AddDONTest:test_RevertWhen_NodeDoesNotSupportCapability() (gas: 180165) +CapabilitiesRegistry_AddDONTest_WhenMaliciousCapabilityConfigurationConfigured:test_RevertWhen_MaliciousCapabilitiesConfigContractTriesToRemoveCapabilitiesFromDONNodes() (gas: 340514) +CapabilitiesRegistry_AddNodeOperatorsTest:test_AddNodeOperators() (gas: 184157) +CapabilitiesRegistry_AddNodeOperatorsTest:test_RevertWhen_CalledByNonAdmin() (gas: 17624) +CapabilitiesRegistry_AddNodeOperatorsTest:test_RevertWhen_NodeOperatorAdminAddressZero() (gas: 18520) +CapabilitiesRegistry_AddNodesTest:test_AddsNodeParams() (gas: 358492) +CapabilitiesRegistry_AddNodesTest:test_OwnerCanAddNodes() (gas: 358458) +CapabilitiesRegistry_AddNodesTest:test_RevertWhen_AddingDuplicateP2PId() (gas: 301273) +CapabilitiesRegistry_AddNodesTest:test_RevertWhen_AddingNodeWithInvalidCapability() (gas: 55196) +CapabilitiesRegistry_AddNodesTest:test_RevertWhen_AddingNodeWithInvalidNodeOperator() (gas: 24917) +CapabilitiesRegistry_AddNodesTest:test_RevertWhen_AddingNodeWithoutCapabilities() (gas: 27691) +CapabilitiesRegistry_AddNodesTest:test_RevertWhen_CalledByNonNodeOperatorAdminAndNonOwner() (gas: 25130) +CapabilitiesRegistry_AddNodesTest:test_RevertWhen_P2PIDEmpty() (gas: 27430) +CapabilitiesRegistry_AddNodesTest:test_RevertWhen_SignerAddressEmpty() (gas: 27069) +CapabilitiesRegistry_AddNodesTest:test_RevertWhen_SignerAddressNotUnique() (gas: 309723) +CapabilitiesRegistry_DeprecateCapabilitiesTest:test_DeprecatesCapability() (gas: 89742) +CapabilitiesRegistry_DeprecateCapabilitiesTest:test_EmitsEvent() (gas: 89870) +CapabilitiesRegistry_DeprecateCapabilitiesTest:test_RevertWhen_CalledByNonAdmin() (gas: 22879) +CapabilitiesRegistry_DeprecateCapabilitiesTest:test_RevertWhen_CapabilityDoesNotExist() (gas: 16166) +CapabilitiesRegistry_DeprecateCapabilitiesTest:test_RevertWhen_CapabilityIsDeprecated() (gas: 91134) +CapabilitiesRegistry_GetCapabilitiesTest:test_ReturnsCapabilities() (gas: 135488) +CapabilitiesRegistry_GetDONsTest:test_CorrectlyFetchesDONs() (gas: 65468) +CapabilitiesRegistry_GetDONsTest:test_DoesNotIncludeRemovedDONs() (gas: 65016) +CapabilitiesRegistry_GetHashedCapabilityTest:test_CorrectlyGeneratesHashedCapabilityId() (gas: 11428) +CapabilitiesRegistry_GetHashedCapabilityTest:test_DoesNotCauseIncorrectClashes() (gas: 13087) +CapabilitiesRegistry_GetNodeOperatorsTest:test_CorrectlyFetchesNodeOperators() (gas: 36429) +CapabilitiesRegistry_GetNodeOperatorsTest:test_DoesNotIncludeRemovedNodeOperators() (gas: 38714) +CapabilitiesRegistry_GetNodesTest:test_CorrectlyFetchesNodes() (gas: 65288) +CapabilitiesRegistry_GetNodesTest:test_DoesNotIncludeRemovedNodes() (gas: 73497) +CapabilitiesRegistry_RemoveDONsTest:test_RemovesDON() (gas: 54982) +CapabilitiesRegistry_RemoveDONsTest:test_RevertWhen_CalledByNonAdmin() (gas: 15647) +CapabilitiesRegistry_RemoveDONsTest:test_RevertWhen_DONDoesNotExist() (gas: 16550) +CapabilitiesRegistry_RemoveNodeOperatorsTest:test_RemovesNodeOperator() (gas: 36122) +CapabilitiesRegistry_RemoveNodeOperatorsTest:test_RevertWhen_CalledByNonOwner() (gas: 15816) +CapabilitiesRegistry_RemoveNodesTest:test_CanAddNodeWithSameSignerAddressAfterRemoving() (gas: 115150) +CapabilitiesRegistry_RemoveNodesTest:test_CanRemoveWhenDONDeleted() (gas: 287838) +CapabilitiesRegistry_RemoveNodesTest:test_CanRemoveWhenNodeNoLongerPartOfDON() (gas: 561183) +CapabilitiesRegistry_RemoveNodesTest:test_OwnerCanRemoveNodes() (gas: 73358) +CapabilitiesRegistry_RemoveNodesTest:test_RemovesNode() (gas: 75192) +CapabilitiesRegistry_RemoveNodesTest:test_RevertWhen_CalledByNonNodeOperatorAdminAndNonOwner() (gas: 25008) +CapabilitiesRegistry_RemoveNodesTest:test_RevertWhen_NodeDoesNotExist() (gas: 18373) +CapabilitiesRegistry_RemoveNodesTest:test_RevertWhen_NodePartOfCapabilitiesDON() (gas: 385422) +CapabilitiesRegistry_RemoveNodesTest:test_RevertWhen_P2PIDEmpty() (gas: 18363) +CapabilitiesRegistry_TypeAndVersionTest:test_TypeAndVersion() (gas: 9796) +CapabilitiesRegistry_UpdateDONTest:test_RevertWhen_CalledByNonAdmin() (gas: 19323) +CapabilitiesRegistry_UpdateDONTest:test_RevertWhen_CapabilityDoesNotExist() (gas: 152958) +CapabilitiesRegistry_UpdateDONTest:test_RevertWhen_DONDoesNotExist() (gas: 17749) +CapabilitiesRegistry_UpdateDONTest:test_RevertWhen_DeprecatedCapabilityAdded() (gas: 222975) +CapabilitiesRegistry_UpdateDONTest:test_RevertWhen_DuplicateCapabilityAdded() (gas: 236986) +CapabilitiesRegistry_UpdateDONTest:test_RevertWhen_DuplicateNodeAdded() (gas: 107687) +CapabilitiesRegistry_UpdateDONTest:test_RevertWhen_NodeDoesNotSupportCapability() (gas: 163401) +CapabilitiesRegistry_UpdateDONTest:test_UpdatesDON() (gas: 373510) +CapabilitiesRegistry_UpdateNodeOperatorTest:test_RevertWhen_CalledByNonAdminAndNonOwner() (gas: 20684) +CapabilitiesRegistry_UpdateNodeOperatorTest:test_RevertWhen_NodeOperatorAdminIsZeroAddress() (gas: 20008) +CapabilitiesRegistry_UpdateNodeOperatorTest:test_RevertWhen_NodeOperatorDoesNotExist() (gas: 19746) +CapabilitiesRegistry_UpdateNodeOperatorTest:test_RevertWhen_NodeOperatorIdAndParamLengthsMismatch() (gas: 15386) +CapabilitiesRegistry_UpdateNodeOperatorTest:test_UpdatesNodeOperator() (gas: 36990) +CapabilitiesRegistry_UpdateNodesTest:test_CanUpdateParamsIfNodeSignerAddressNoLongerUsed() (gas: 256437) +CapabilitiesRegistry_UpdateNodesTest:test_OwnerCanUpdateNodes() (gas: 162210) +CapabilitiesRegistry_UpdateNodesTest:test_RevertWhen_AddingNodeWithInvalidCapability() (gas: 35895) +CapabilitiesRegistry_UpdateNodesTest:test_RevertWhen_CalledByAnotherNodeOperatorAdmin() (gas: 29222) +CapabilitiesRegistry_UpdateNodesTest:test_RevertWhen_CalledByNonNodeOperatorAdminAndNonOwner() (gas: 29399) +CapabilitiesRegistry_UpdateNodesTest:test_RevertWhen_NodeDoesNotExist() (gas: 29221) +CapabilitiesRegistry_UpdateNodesTest:test_RevertWhen_NodeSignerAlreadyAssignedToAnotherNode() (gas: 31348) +CapabilitiesRegistry_UpdateNodesTest:test_RevertWhen_P2PIDEmpty() (gas: 29187) +CapabilitiesRegistry_UpdateNodesTest:test_RevertWhen_RemovingCapabilityRequiredByCapabilityDON() (gas: 471030) +CapabilitiesRegistry_UpdateNodesTest:test_RevertWhen_RemovingCapabilityRequiredByWorkflowDON() (gas: 341311) +CapabilitiesRegistry_UpdateNodesTest:test_RevertWhen_SignerAddressEmpty() (gas: 29080) +CapabilitiesRegistry_UpdateNodesTest:test_RevertWhen_UpdatingNodeWithoutCapabilities() (gas: 27609) +CapabilitiesRegistry_UpdateNodesTest:test_UpdatesNodeParams() (gas: 162264) KeystoneForwarder_ReportTest:test_Report_ConfigVersion() (gas: 2006826) KeystoneForwarder_ReportTest:test_Report_FailedDelieryWhenReportReceiverConsumesAllGas() (gas: 1004827) KeystoneForwarder_ReportTest:test_Report_FailedDeliveryWhenReceiverInterfaceNotSupported() (gas: 124974) @@ -99,17 +99,17 @@ KeystoneForwarder_ReportTest:test_RevertWhen_RetryingInvalidContractTransmission KeystoneForwarder_ReportTest:test_RevertWhen_RetryingSuccessfulTransmission() (gas: 355992) KeystoneForwarder_ReportTest:test_RevertWhen_TooFewSignatures() (gas: 55314) KeystoneForwarder_ReportTest:test_RevertWhen_TooManySignatures() (gas: 56050) -KeystoneForwarder_SetConfigTest:test_RevertWhen_ExcessSigners() (gas: 36989) -KeystoneForwarder_SetConfigTest:test_RevertWhen_FaultToleranceIsZero() (gas: 96835) -KeystoneForwarder_SetConfigTest:test_RevertWhen_InsufficientSigners() (gas: 17476) -KeystoneForwarder_SetConfigTest:test_RevertWhen_NotOwner() (gas: 97845) -KeystoneForwarder_SetConfigTest:test_RevertWhen_ProvidingDuplicateSigners() (gas: 124504) -KeystoneForwarder_SetConfigTest:test_RevertWhen_ProvidingZeroAddressSigner() (gas: 124123) -KeystoneForwarder_SetConfigTest:test_SetConfig_FirstTime() (gas: 1574325) -KeystoneForwarder_SetConfigTest:test_SetConfig_WhenSignersAreRemoved() (gas: 1580648) -KeystoneForwarder_TypeAndVersionTest:test_TypeAndVersion() (gas: 10619) -KeystoneRouter_SetConfigTest:test_AddForwarder_RevertWhen_NotOwner() (gas: 11782) -KeystoneRouter_SetConfigTest:test_RemoveForwarder_RevertWhen_NotOwner() (gas: 11738) -KeystoneRouter_SetConfigTest:test_RemoveForwarder_Success() (gas: 18831) -KeystoneRouter_SetConfigTest:test_Route_RevertWhen_UnauthorizedForwarder() (gas: 20110) -KeystoneRouter_SetConfigTest:test_Route_Success() (gas: 89986) \ No newline at end of file +KeystoneForwarder_SetConfigTest:test_RevertWhen_ExcessSigners() (gas: 20184) +KeystoneForwarder_SetConfigTest:test_RevertWhen_FaultToleranceIsZero() (gas: 88057) +KeystoneForwarder_SetConfigTest:test_RevertWhen_InsufficientSigners() (gas: 14533) +KeystoneForwarder_SetConfigTest:test_RevertWhen_NotOwner() (gas: 88766) +KeystoneForwarder_SetConfigTest:test_RevertWhen_ProvidingDuplicateSigners() (gas: 114578) +KeystoneForwarder_SetConfigTest:test_RevertWhen_ProvidingZeroAddressSigner() (gas: 114233) +KeystoneForwarder_SetConfigTest:test_SetConfig_FirstTime() (gas: 1540665) +KeystoneForwarder_SetConfigTest:test_SetConfig_WhenSignersAreRemoved() (gas: 1535361) +KeystoneForwarder_TypeAndVersionTest:test_TypeAndVersion() (gas: 9641) +KeystoneRouter_SetConfigTest:test_AddForwarder_RevertWhen_NotOwner() (gas: 10982) +KeystoneRouter_SetConfigTest:test_RemoveForwarder_RevertWhen_NotOwner() (gas: 10927) +KeystoneRouter_SetConfigTest:test_RemoveForwarder_Success() (gas: 17603) +KeystoneRouter_SetConfigTest:test_Route_RevertWhen_UnauthorizedForwarder() (gas: 18552) +KeystoneRouter_SetConfigTest:test_Route_Success() (gas: 80948) \ No newline at end of file diff --git a/contracts/gas-snapshots/l2ep.gas-snapshot b/contracts/gas-snapshots/l2ep.gas-snapshot index 643127b621..add2a354c3 100644 --- a/contracts/gas-snapshots/l2ep.gas-snapshot +++ b/contracts/gas-snapshots/l2ep.gas-snapshot @@ -1,142 +1,142 @@ -ArbitrumCrossDomainForwarder_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 37567) +ArbitrumCrossDomainForwarder_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 37548) ArbitrumCrossDomainForwarder_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 12954) -ArbitrumCrossDomainForwarder_Constructor:test_InitialState() (gas: 22111) +ArbitrumCrossDomainForwarder_Constructor:test_InitialState() (gas: 22133) ArbitrumCrossDomainForwarder_Forward:test_Forward() (gas: 47818) -ArbitrumCrossDomainForwarder_Forward:test_ForwardRevert() (gas: 22147) -ArbitrumCrossDomainForwarder_Forward:test_NotCallableByUnknownAddress() (gas: 16083) +ArbitrumCrossDomainForwarder_Forward:test_ForwardRevert() (gas: 22154) +ArbitrumCrossDomainForwarder_Forward:test_NotCallableByUnknownAddress() (gas: 16040) ArbitrumCrossDomainForwarder_TransferL1Ownership:test_CallableByL1Owner() (gas: 41439) ArbitrumCrossDomainForwarder_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 19274) -ArbitrumCrossDomainForwarder_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 18644) +ArbitrumCrossDomainForwarder_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 18622) ArbitrumCrossDomainForwarder_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 13232) -ArbitrumCrossDomainGovernor_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 37567) +ArbitrumCrossDomainGovernor_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 37548) ArbitrumCrossDomainGovernor_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 12954) -ArbitrumCrossDomainGovernor_Constructor:test_InitialState() (gas: 22134) +ArbitrumCrossDomainGovernor_Constructor:test_InitialState() (gas: 22156) ArbitrumCrossDomainGovernor_Forward:test_CallableByL2Owner() (gas: 49953) -ArbitrumCrossDomainGovernor_Forward:test_Forward() (gas: 47869) -ArbitrumCrossDomainGovernor_Forward:test_ForwardRevert() (gas: 24268) +ArbitrumCrossDomainGovernor_Forward:test_Forward() (gas: 47847) +ArbitrumCrossDomainGovernor_Forward:test_ForwardRevert() (gas: 24298) ArbitrumCrossDomainGovernor_Forward:test_NotCallableByUnknownAddress() (gas: 18216) -ArbitrumCrossDomainGovernor_ForwardDelegate:test_BubbleUpRevert() (gas: 19338) +ArbitrumCrossDomainGovernor_ForwardDelegate:test_BubbleUpRevert() (gas: 19363) ArbitrumCrossDomainGovernor_ForwardDelegate:test_CallableByCrossDomainMessengerAddressOrL1Owner() (gas: 60787) ArbitrumCrossDomainGovernor_ForwardDelegate:test_CallableByL2Owner() (gas: 62915) -ArbitrumCrossDomainGovernor_ForwardDelegate:test_NotCallableByUnknownAddress() (gas: 18271) +ArbitrumCrossDomainGovernor_ForwardDelegate:test_NotCallableByUnknownAddress() (gas: 18228) ArbitrumCrossDomainGovernor_ForwardDelegate:test_RevertsBatchWhenOneCallFails() (gas: 64276) ArbitrumCrossDomainGovernor_TransferL1Ownership:test_CallableByL1Owner() (gas: 41439) ArbitrumCrossDomainGovernor_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 19274) -ArbitrumCrossDomainGovernor_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 18644) +ArbitrumCrossDomainGovernor_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 18622) ArbitrumCrossDomainGovernor_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 13232) -ArbitrumSequencerUptimeFeed_AggregatorV3Interface:test_AggregatorV3Interface() (gas: 104766) -ArbitrumSequencerUptimeFeed_AggregatorV3Interface:test_Return0WhenRoundDoesNotExistYet() (gas: 19945) -ArbitrumSequencerUptimeFeed_Constants:test_InitialState() (gas: 8492) +ArbitrumSequencerUptimeFeed_AggregatorV3Interface:test_AggregatorV3Interface() (gas: 104748) +ArbitrumSequencerUptimeFeed_AggregatorV3Interface:test_Return0WhenRoundDoesNotExistYet() (gas: 19939) +ArbitrumSequencerUptimeFeed_Constants:test_InitialState() (gas: 8514) ArbitrumSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceAllowReadsIfConsumingContractIsWhitelisted() (gas: 592246) ArbitrumSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceDisallowReadsIfConsumingContractIsNotWhitelisted() (gas: 562331) -ArbitrumSequencerUptimeFeed_UpdateStatus:test_IgnoreOutOfOrderUpdates() (gas: 99593) -ArbitrumSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddr() (gas: 15442) -ArbitrumSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndNoTimeChange() (gas: 114527) -ArbitrumSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndTimeChange() (gas: 114610) -ArbitrumValidator_Validate:test_PostSequencerOffline() (gas: 69009) -OptimismCrossDomainForwarder_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 47110) -OptimismCrossDomainForwarder_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 22135) -OptimismCrossDomainForwarder_Constructor:test_InitialState() (gas: 21947) +ArbitrumSequencerUptimeFeed_UpdateStatus:test_IgnoreOutOfOrderUpdates() (gas: 99559) +ArbitrumSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddr() (gas: 15436) +ArbitrumSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndNoTimeChange() (gas: 114515) +ArbitrumSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndTimeChange() (gas: 114598) +ArbitrumValidator_Validate:test_PostSequencerOffline() (gas: 69027) +OptimismCrossDomainForwarder_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 47108) +OptimismCrossDomainForwarder_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 22132) +OptimismCrossDomainForwarder_Constructor:test_InitialState() (gas: 21969) OptimismCrossDomainForwarder_Forward:test_Forward() (gas: 58213) -OptimismCrossDomainForwarder_Forward:test_ForwardRevert() (gas: 32533) -OptimismCrossDomainForwarder_Forward:test_NotCallableByUnknownAddress() (gas: 13895) -OptimismCrossDomainForwarder_TransferL1Ownership:test_CallableByL1Owner() (gas: 48912) -OptimismCrossDomainForwarder_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 28733) -OptimismCrossDomainForwarder_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 16456) +OptimismCrossDomainForwarder_Forward:test_ForwardRevert() (gas: 32510) +OptimismCrossDomainForwarder_Forward:test_NotCallableByUnknownAddress() (gas: 13852) +OptimismCrossDomainForwarder_TransferL1Ownership:test_CallableByL1Owner() (gas: 48900) +OptimismCrossDomainForwarder_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 28718) +OptimismCrossDomainForwarder_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 16434) OptimismCrossDomainForwarder_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 11044) -OptimismCrossDomainGovernor_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 47110) -OptimismCrossDomainGovernor_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 22135) -OptimismCrossDomainGovernor_Constructor:test_InitialState() (gas: 21970) +OptimismCrossDomainGovernor_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 47108) +OptimismCrossDomainGovernor_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 22132) +OptimismCrossDomainGovernor_Constructor:test_InitialState() (gas: 21992) OptimismCrossDomainGovernor_Forward:test_CallableByL2Owner() (gas: 47797) -OptimismCrossDomainGovernor_Forward:test_Forward() (gas: 58284) +OptimismCrossDomainGovernor_Forward:test_Forward() (gas: 58262) OptimismCrossDomainGovernor_Forward:test_ForwardRevert() (gas: 32569) OptimismCrossDomainGovernor_Forward:test_NotCallableByUnknownAddress() (gas: 16031) -OptimismCrossDomainGovernor_ForwardDelegate:test_BubbleUpRevert() (gas: 29128) +OptimismCrossDomainGovernor_ForwardDelegate:test_BubbleUpRevert() (gas: 29147) OptimismCrossDomainGovernor_ForwardDelegate:test_CallableByCrossDomainMessengerAddressOrL1Owner() (gas: 72836) OptimismCrossDomainGovernor_ForwardDelegate:test_CallableByL2Owner() (gas: 72841) -OptimismCrossDomainGovernor_ForwardDelegate:test_NotCallableByUnknownAddress() (gas: 16086) +OptimismCrossDomainGovernor_ForwardDelegate:test_NotCallableByUnknownAddress() (gas: 16043) OptimismCrossDomainGovernor_ForwardDelegate:test_RevertsBatchWhenOneCallFails() (gas: 76045) -OptimismCrossDomainGovernor_TransferL1Ownership:test_CallableByL1Owner() (gas: 48912) -OptimismCrossDomainGovernor_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 28733) -OptimismCrossDomainGovernor_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 16456) +OptimismCrossDomainGovernor_TransferL1Ownership:test_CallableByL1Owner() (gas: 48900) +OptimismCrossDomainGovernor_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 28718) +OptimismCrossDomainGovernor_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 16434) OptimismCrossDomainGovernor_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 11044) -OptimismSequencerUptimeFeed_AggregatorV3Interface:test_AggregatorV3Interface() (gas: 72286) +OptimismSequencerUptimeFeed_AggregatorV3Interface:test_AggregatorV3Interface() (gas: 72304) OptimismSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetAnswerWhenRoundDoesNotExistYet() (gas: 17639) OptimismSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetRoundDataWhenRoundDoesNotExistYet() (gas: 17875) OptimismSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetTimestampWhenRoundDoesNotExistYet() (gas: 17628) -OptimismSequencerUptimeFeed_Constructor:test_InitialState() (gas: 22002) +OptimismSequencerUptimeFeed_Constructor:test_InitialState() (gas: 22024) OptimismSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceAllowReadsIfConsumingContractIsWhitelisted() (gas: 589475) OptimismSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceDisallowReadsIfConsumingContractIsNotWhitelisted() (gas: 562336) -OptimismSequencerUptimeFeed_UpdateStatus:test_IgnoreOutOfOrderUpdates() (gas: 67804) -OptimismSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddr() (gas: 13109) -OptimismSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddrAndNotL1SenderAddr() (gas: 23523) -OptimismSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenNoChange() (gas: 77205) -OptimismSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndNoTimeChange() (gas: 96089) -OptimismSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndTimeChange() (gas: 96172) -OptimismValidator_SetGasLimit:test_CorrectlyUpdatesTheGasLimit() (gas: 18636) -OptimismValidator_Validate:test_PostSequencerOffline() (gas: 74764) -OptimismValidator_Validate:test_PostSequencerStatusWhenThereIsNotStatusChange() (gas: 74798) +OptimismSequencerUptimeFeed_UpdateStatus:test_IgnoreOutOfOrderUpdates() (gas: 67816) +OptimismSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddr() (gas: 13070) +OptimismSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddrAndNotL1SenderAddr() (gas: 23529) +OptimismSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenNoChange() (gas: 77211) +OptimismSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndNoTimeChange() (gas: 96101) +OptimismSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndTimeChange() (gas: 96184) +OptimismValidator_SetGasLimit:test_CorrectlyUpdatesTheGasLimit() (gas: 18658) +OptimismValidator_Validate:test_PostSequencerOffline() (gas: 74741) +OptimismValidator_Validate:test_PostSequencerStatusWhenThereIsNotStatusChange() (gas: 74820) OptimismValidator_Validate:test_RevertsIfCalledByAnAccountWithNoAccess() (gas: 15556) -ScrollCrossDomainForwarder_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 47196) -ScrollCrossDomainForwarder_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 22185) -ScrollCrossDomainForwarder_Constructor:test_InitialState() (gas: 21623) +ScrollCrossDomainForwarder_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 47200) +ScrollCrossDomainForwarder_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 22182) +ScrollCrossDomainForwarder_Constructor:test_InitialState() (gas: 21645) ScrollCrossDomainForwarder_Forward:test_Forward() (gas: 58277) -ScrollCrossDomainForwarder_Forward:test_ForwardRevert() (gas: 32589) -ScrollCrossDomainForwarder_Forward:test_NotCallableByUnknownAddress() (gas: 13895) -ScrollCrossDomainForwarder_TransferL1Ownership:test_CallableByL1Owner() (gas: 48975) -ScrollCrossDomainForwarder_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 28791) -ScrollCrossDomainForwarder_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 16456) +ScrollCrossDomainForwarder_Forward:test_ForwardRevert() (gas: 32566) +ScrollCrossDomainForwarder_Forward:test_NotCallableByUnknownAddress() (gas: 13852) +ScrollCrossDomainForwarder_TransferL1Ownership:test_CallableByL1Owner() (gas: 48963) +ScrollCrossDomainForwarder_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 28782) +ScrollCrossDomainForwarder_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 16434) ScrollCrossDomainForwarder_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 11044) -ScrollCrossDomainGovernor_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 47196) -ScrollCrossDomainGovernor_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 22185) -ScrollCrossDomainGovernor_Constructor:test_InitialState() (gas: 21646) +ScrollCrossDomainGovernor_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 47200) +ScrollCrossDomainGovernor_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 22182) +ScrollCrossDomainGovernor_Constructor:test_InitialState() (gas: 21668) ScrollCrossDomainGovernor_Forward:test_CallableByL2Owner() (gas: 47792) -ScrollCrossDomainGovernor_Forward:test_Forward() (gas: 58343) +ScrollCrossDomainGovernor_Forward:test_Forward() (gas: 58321) ScrollCrossDomainGovernor_Forward:test_ForwardRevert() (gas: 32622) ScrollCrossDomainGovernor_Forward:test_NotCallableByUnknownAddress() (gas: 16028) -ScrollCrossDomainGovernor_ForwardDelegate:test_BubbleUpRevert() (gas: 29186) +ScrollCrossDomainGovernor_ForwardDelegate:test_BubbleUpRevert() (gas: 29205) ScrollCrossDomainGovernor_ForwardDelegate:test_CallableByCrossDomainMessengerAddressOrL1Owner() (gas: 72900) ScrollCrossDomainGovernor_ForwardDelegate:test_CallableByL2Owner() (gas: 72905) -ScrollCrossDomainGovernor_ForwardDelegate:test_NotCallableByUnknownAddress() (gas: 16083) +ScrollCrossDomainGovernor_ForwardDelegate:test_NotCallableByUnknownAddress() (gas: 16040) ScrollCrossDomainGovernor_ForwardDelegate:test_RevertsBatchWhenOneCallFails() (gas: 76110) -ScrollCrossDomainGovernor_TransferL1Ownership:test_CallableByL1Owner() (gas: 48975) -ScrollCrossDomainGovernor_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 28791) -ScrollCrossDomainGovernor_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 16456) +ScrollCrossDomainGovernor_TransferL1Ownership:test_CallableByL1Owner() (gas: 48963) +ScrollCrossDomainGovernor_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 28782) +ScrollCrossDomainGovernor_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 16434) ScrollCrossDomainGovernor_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 11044) -ScrollSequencerUptimeFeed_AggregatorV3Interface:test_AggregatorV3Interface() (gas: 72309) +ScrollSequencerUptimeFeed_AggregatorV3Interface:test_AggregatorV3Interface() (gas: 72327) ScrollSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetAnswerWhenRoundDoesNotExistYet() (gas: 17639) ScrollSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetRoundDataWhenRoundDoesNotExistYet() (gas: 17875) ScrollSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetTimestampWhenRoundDoesNotExistYet() (gas: 17628) -ScrollSequencerUptimeFeed_Constructor:test_InitialState() (gas: 174353) +ScrollSequencerUptimeFeed_Constructor:test_InitialState() (gas: 174375) ScrollSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceAllowReadsIfConsumingContractIsWhitelisted() (gas: 589475) ScrollSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceDisallowReadsIfConsumingContractIsNotWhitelisted() (gas: 562336) -ScrollSequencerUptimeFeed_UpdateStatus:test_IgnoreOutOfOrderUpdates() (gas: 67850) -ScrollSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddr() (gas: 13109) -ScrollSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddrAndNotL1SenderAddr() (gas: 23523) -ScrollSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenNoChange() (gas: 77251) -ScrollSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndNoTimeChange() (gas: 96135) -ScrollSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndTimeChange() (gas: 96218) -ScrollValidator_SetGasLimit:test_CorrectlyUpdatesTheGasLimit() (gas: 18770) -ScrollValidator_Validate:test_PostSequencerOffline() (gas: 78299) -ScrollValidator_Validate:test_PostSequencerStatusWhenThereIsNotStatusChange() (gas: 78339) +ScrollSequencerUptimeFeed_UpdateStatus:test_IgnoreOutOfOrderUpdates() (gas: 67862) +ScrollSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddr() (gas: 13070) +ScrollSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddrAndNotL1SenderAddr() (gas: 23529) +ScrollSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenNoChange() (gas: 77257) +ScrollSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndNoTimeChange() (gas: 96147) +ScrollSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndTimeChange() (gas: 96230) +ScrollValidator_SetGasLimit:test_CorrectlyUpdatesTheGasLimit() (gas: 18792) +ScrollValidator_Validate:test_PostSequencerOffline() (gas: 78276) +ScrollValidator_Validate:test_PostSequencerStatusWhenThereIsNotStatusChange() (gas: 78361) ScrollValidator_Validate:test_RevertsIfCalledByAnAccountWithNoAccess() (gas: 15556) -ZKSyncSequencerUptimeFeed_AggregatorV3Interface:test_AggregatorV3Interface() (gas: 67090) +ZKSyncSequencerUptimeFeed_AggregatorV3Interface:test_AggregatorV3Interface() (gas: 67072) ZKSyncSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetAnswerWhenRoundDoesNotExistYet() (gas: 17639) ZKSyncSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetRoundDataWhenRoundDoesNotExistYet() (gas: 17875) ZKSyncSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetTimestampWhenRoundDoesNotExistYet() (gas: 17628) -ZKSyncSequencerUptimeFeed_Constructor:test_InitialState() (gas: 22006) +ZKSyncSequencerUptimeFeed_Constructor:test_InitialState() (gas: 22028) ZKSyncSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceAllowReadsIfConsumingContractIsWhitelisted() (gas: 589495) ZKSyncSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceDisallowReadsIfConsumingContractIsNotWhitelisted() (gas: 562342) -ZKSyncSequencerUptimeFeed_UpdateStatus:test_IgnoreOutOfOrderUpdates() (gas: 61883) -ZKSyncSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddr() (gas: 13055) -ZKSyncSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenNoChange() (gas: 71321) -ZKSyncSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndNoTimeChange() (gas: 90176) -ZKSyncSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndTimeChange() (gas: 90259) -ZKSyncValidator_Constructor:test_ConstructingRevertedWithInvalidChainId() (gas: 104069) -ZKSyncValidator_Constructor:test_ConstructingRevertedWithZeroL1BridgeAddress() (gas: 81784) -ZKSyncValidator_Constructor:test_ConstructingRevertedWithZeroL2UpdateFeedAddress() (gas: 81796) +ZKSyncSequencerUptimeFeed_UpdateStatus:test_IgnoreOutOfOrderUpdates() (gas: 61871) +ZKSyncSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddr() (gas: 13026) +ZKSyncSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenNoChange() (gas: 71272) +ZKSyncSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndNoTimeChange() (gas: 90164) +ZKSyncSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndTimeChange() (gas: 90247) +ZKSyncValidator_Constructor:test_ConstructingRevertedWithInvalidChainId() (gas: 104046) +ZKSyncValidator_Constructor:test_ConstructingRevertedWithZeroL1BridgeAddress() (gas: 81761) +ZKSyncValidator_Constructor:test_ConstructingRevertedWithZeroL2UpdateFeedAddress() (gas: 81818) ZKSyncValidator_GetChainId:test_CorrectlyGetsTheChainId() (gas: 8346) -ZKSyncValidator_GetSetL2GasPerPubdataByteLimit:test_CorrectlyGetsAndUpdatesTheGasPerPubdataByteLimit() (gas: 18896) -ZKSyncValidator_Validate:test_PostSequencerOffline() (gas: 52210) -ZKSyncValidator_Validate:test_PostSequencerStatusWhenThereIsNotStatusChange() (gas: 52279) -ZKSyncValidator_Validate:test_RevertsIfCalledByAnAccountWithNoAccess() (gas: 15623) \ No newline at end of file +ZKSyncValidator_GetSetL2GasPerPubdataByteLimit:test_CorrectlyGetsAndUpdatesTheGasPerPubdataByteLimit() (gas: 18902) +ZKSyncValidator_Validate:test_PostSequencerOffline() (gas: 52205) +ZKSyncValidator_Validate:test_PostSequencerStatusWhenThereIsNotStatusChange() (gas: 52307) +ZKSyncValidator_Validate:test_RevertsIfCalledByAnAccountWithNoAccess() (gas: 15629) \ No newline at end of file diff --git a/contracts/gas-snapshots/shared.gas-snapshot b/contracts/gas-snapshots/shared.gas-snapshot index 5447570173..247c36c9bc 100644 --- a/contracts/gas-snapshots/shared.gas-snapshot +++ b/contracts/gas-snapshots/shared.gas-snapshot @@ -1,46 +1,35 @@ -AuthorizedCallers_applyAuthorizedCallerUpdates:test_AddAndRemove_Success() (gas: 124848) -AuthorizedCallers_applyAuthorizedCallerUpdates:test_OnlyAdd_Success() (gas: 132793) -AuthorizedCallers_applyAuthorizedCallerUpdates:test_OnlyCallableByOwner_Revert() (gas: 12218) -AuthorizedCallers_applyAuthorizedCallerUpdates:test_OnlyRemove_Success() (gas: 44833) -AuthorizedCallers_applyAuthorizedCallerUpdates:test_RemoveThenAdd_Success() (gas: 56901) -AuthorizedCallers_applyAuthorizedCallerUpdates:test_SkipRemove_Success() (gas: 31911) -AuthorizedCallers_applyAuthorizedCallerUpdates:test_ZeroAddressNotAllowed_Revert() (gas: 64612) -AuthorizedCallers_constructor:test_ZeroAddressNotAllowed_Revert() (gas: 64589) -AuthorizedCallers_constructor:test_constructor_Success() (gas: 663486) -BurnMintERC20_approve:test_approve() (gas: 57609) -BurnMintERC20_burn:test_BasicBurn() (gas: 153528) -BurnMintERC20_burnFrom:test_BurnFrom() (gas: 57965) -BurnMintERC20_burnFromAlias:test_burn() (gas: 58009) -BurnMintERC20_constructor:test_Constructor() (gas: 1680059) -BurnMintERC20_getCCIPAdmin:test_getCCIPAdmin() (gas: 10544) -BurnMintERC20_getCCIPAdmin:test_setCCIPAdmin() (gas: 21562) -BurnMintERC20_grantMintAndBurnRoles:test_GrantMintAndBurnRoles() (gas: 79089) -BurnMintERC20_mint:test_mint() (gas: 101815) -BurnMintERC20_supportsInterface:test_SupportsInterface() (gas: 11202) -BurnMintERC20_transfer:test_transfer() (gas: 42318) +AuthorizedCallers_applyAuthorizedCallerUpdates:test_AddAndRemove_Success() (gas: 124925) +AuthorizedCallers_applyAuthorizedCallerUpdates:test_OnlyAdd_Success() (gas: 132902) +AuthorizedCallers_applyAuthorizedCallerUpdates:test_OnlyCallableByOwner_Revert() (gas: 12335) +AuthorizedCallers_applyAuthorizedCallerUpdates:test_OnlyRemove_Success() (gas: 44930) +AuthorizedCallers_applyAuthorizedCallerUpdates:test_RemoveThenAdd_Success() (gas: 57028) +AuthorizedCallers_applyAuthorizedCallerUpdates:test_SkipRemove_Success() (gas: 32013) +AuthorizedCallers_applyAuthorizedCallerUpdates:test_ZeroAddressNotAllowed_Revert() (gas: 64661) +AuthorizedCallers_constructor:test_ZeroAddressNotAllowed_Revert() (gas: 64661) +AuthorizedCallers_constructor:test_constructor_Success() (gas: 693193) BurnMintERC677_approve:testApproveSuccess() (gas: 55477) BurnMintERC677_approve:testInvalidAddressReverts() (gas: 10653) BurnMintERC677_burn:testBasicBurnSuccess() (gas: 172022) BurnMintERC677_burn:testBurnFromZeroAddressReverts() (gas: 47166) BurnMintERC677_burn:testExceedsBalanceReverts() (gas: 21816) BurnMintERC677_burn:testSenderNotBurnerReverts() (gas: 13346) -BurnMintERC677_burnFrom:testBurnFromSuccess() (gas: 57928) +BurnMintERC677_burnFrom:testBurnFromSuccess() (gas: 57892) BurnMintERC677_burnFrom:testExceedsBalanceReverts() (gas: 35838) BurnMintERC677_burnFrom:testInsufficientAllowanceReverts() (gas: 21824) BurnMintERC677_burnFrom:testSenderNotBurnerReverts() (gas: 13346) -BurnMintERC677_burnFromAlias:testBurnFromSuccess() (gas: 57955) +BurnMintERC677_burnFromAlias:testBurnFromSuccess() (gas: 57919) BurnMintERC677_burnFromAlias:testExceedsBalanceReverts() (gas: 35854) BurnMintERC677_burnFromAlias:testInsufficientAllowanceReverts() (gas: 21844) BurnMintERC677_burnFromAlias:testSenderNotBurnerReverts() (gas: 13366) BurnMintERC677_constructor:testConstructorSuccess() (gas: 1651040) BurnMintERC677_decreaseApproval:testDecreaseApprovalSuccess() (gas: 31049) BurnMintERC677_grantMintAndBurnRoles:testGrantMintAndBurnRolesSuccess() (gas: 121279) -BurnMintERC677_grantRole:testGrantBurnAccessSuccess() (gas: 53402) +BurnMintERC677_grantRole:testGrantBurnAccessSuccess() (gas: 53420) BurnMintERC677_grantRole:testGrantManySuccess() (gas: 937593) -BurnMintERC677_grantRole:testGrantMintAccessSuccess() (gas: 94280) +BurnMintERC677_grantRole:testGrantMintAccessSuccess() (gas: 94297) BurnMintERC677_increaseApproval:testIncreaseApprovalSuccess() (gas: 44052) BurnMintERC677_mint:testBasicMintSuccess() (gas: 149664) -BurnMintERC677_mint:testMaxSupplyExceededReverts() (gas: 50323) +BurnMintERC677_mint:testMaxSupplyExceededReverts() (gas: 50345) BurnMintERC677_mint:testSenderNotMinterReverts() (gas: 11182) BurnMintERC677_supportsInterface:testConstructorSuccess() (gas: 12455) BurnMintERC677_transfer:testInvalidAddressReverts() (gas: 10629) @@ -50,41 +39,43 @@ CallWithExactGas__callWithExactGas:test_CallWithExactGasSafeReturnDataExactGas() CallWithExactGas__callWithExactGas:test_NoContractReverts() (gas: 11544) CallWithExactGas__callWithExactGas:test_NoGasForCallExactCheckReverts() (gas: 15760) CallWithExactGas__callWithExactGas:test_NotEnoughGasForCallReverts() (gas: 16210) -CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract:test_CallWithExactGasEvenIfTargetIsNoContractExactGasSuccess() (gas: 20033) +CallWithExactGas__callWithExactGas:test_callWithExactGasSuccess(bytes,bytes4) (runs: 256, μ: 15741, ~: 15694) +CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract:test_CallWithExactGasEvenIfTargetIsNoContractExactGasSuccess() (gas: 20076) CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract:test_CallWithExactGasEvenIfTargetIsNoContractReceiverErrorSuccess() (gas: 66394) +CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract:test_CallWithExactGasEvenIfTargetIsNoContractSuccess(bytes,bytes4) (runs: 256, μ: 16250, ~: 16203) CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract:test_NoContractSuccess() (gas: 12942) CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract:test_NoGasForCallExactCheckReturnFalseSuccess() (gas: 12984) CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract:test_NotEnoughGasForCallReturnsFalseSuccess() (gas: 13293) CallWithExactGas__callWithExactGasSafeReturnData:test_CallWithExactGasSafeReturnDataExactGas() (gas: 20287) -CallWithExactGas__callWithExactGasSafeReturnData:test_NoContractReverts() (gas: 13915) +CallWithExactGas__callWithExactGasSafeReturnData:test_NoContractReverts() (gas: 13893) CallWithExactGas__callWithExactGasSafeReturnData:test_NoGasForCallExactCheckReverts() (gas: 16108) -CallWithExactGas__callWithExactGasSafeReturnData:test_NotEnoughGasForCallReverts() (gas: 16513) -CallWithExactGas__callWithExactGasSafeReturnData:test_callWithExactGasSafeReturnData_ThrowOOGError_Revert() (gas: 36713) +CallWithExactGas__callWithExactGasSafeReturnData:test_NotEnoughGasForCallReverts() (gas: 16535) +CallWithExactGas__callWithExactGasSafeReturnData:test_callWithExactGasSafeReturnData_ThrowOOGError_Revert() (gas: 36666) EnumerableMapAddresses_at:testAtSuccess() (gas: 95055) -EnumerableMapAddresses_at:testBytes32AtSuccess() (gas: 94828) -EnumerableMapAddresses_at:testBytesAtSuccess() (gas: 96507) +EnumerableMapAddresses_at:testBytes32AtSuccess() (gas: 94850) +EnumerableMapAddresses_at:testBytesAtSuccess() (gas: 96529) EnumerableMapAddresses_contains:testBytes32ContainsSuccess() (gas: 93503) -EnumerableMapAddresses_contains:testBytesContainsSuccess() (gas: 93974) +EnumerableMapAddresses_contains:testBytesContainsSuccess() (gas: 93996) EnumerableMapAddresses_contains:testContainsSuccess() (gas: 93678) -EnumerableMapAddresses_get:testBytes32GetSuccess() (gas: 94238) -EnumerableMapAddresses_get:testBytesGetSuccess() (gas: 95919) -EnumerableMapAddresses_get:testGetSuccess() (gas: 94409) +EnumerableMapAddresses_get:testBytes32GetSuccess() (gas: 94260) +EnumerableMapAddresses_get:testBytesGetSuccess() (gas: 95853) +EnumerableMapAddresses_get:testGetSuccess() (gas: 94431) EnumerableMapAddresses_get_errorMessage:testBytesGetErrorMessageSuccess() (gas: 95852) EnumerableMapAddresses_get_errorMessage:testGetErrorMessageSuccess() (gas: 94467) EnumerableMapAddresses_length:testBytes32LengthSuccess() (gas: 72418) -EnumerableMapAddresses_length:testBytesLengthSuccess() (gas: 73035) -EnumerableMapAddresses_length:testLengthSuccess() (gas: 72592) +EnumerableMapAddresses_length:testBytesLengthSuccess() (gas: 72982) +EnumerableMapAddresses_length:testLengthSuccess() (gas: 72609) EnumerableMapAddresses_remove:testBytes32RemoveSuccess() (gas: 73432) EnumerableMapAddresses_remove:testBytesRemoveSuccess() (gas: 74216) EnumerableMapAddresses_remove:testRemoveSuccess() (gas: 73651) EnumerableMapAddresses_set:testBytes32SetSuccess() (gas: 94475) EnumerableMapAddresses_set:testBytesSetSuccess() (gas: 95405) -EnumerableMapAddresses_set:testSetSuccess() (gas: 94638) +EnumerableMapAddresses_set:testSetSuccess() (gas: 94660) EnumerableMapAddresses_tryGet:testBytes32TryGetSuccess() (gas: 94602) -EnumerableMapAddresses_tryGet:testBytesTryGetSuccess() (gas: 96316) +EnumerableMapAddresses_tryGet:testBytesTryGetSuccess() (gas: 96250) EnumerableMapAddresses_tryGet:testTryGetSuccess() (gas: 94869) -OpStackBurnMintERC677_constructor:testConstructorSuccess() (gas: 1721342) -OpStackBurnMintERC677_interfaceCompatibility:testBurnCompatibility() (gas: 291244) +OpStackBurnMintERC677_constructor:testConstructorSuccess() (gas: 1721311) +OpStackBurnMintERC677_interfaceCompatibility:testBurnCompatibility() (gas: 291155) OpStackBurnMintERC677_interfaceCompatibility:testMintCompatibility() (gas: 137917) OpStackBurnMintERC677_interfaceCompatibility:testStaticFunctionsCompatibility() (gas: 13773) OpStackBurnMintERC677_supportsInterface:testConstructorSuccess() (gas: 12728) @@ -99,7 +90,7 @@ Ownable2Step_transferOwnership:test_transferOwnership_success() (gas: 30124) SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_EmptySubset_Reverts() (gas: 5191) SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_EmptySuperset_Reverts() (gas: 4522) SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_HasDuplicates_Reverts() (gas: 7738) -SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_NotASubset_Reverts() (gas: 11700) +SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_NotASubset_Reverts() (gas: 11635) SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_SingleElementSubset() (gas: 3908) SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_SingleElementSubsetAndSuperset_Equal() (gas: 1459) SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_SingleElementSubsetAndSuperset_NotEqual_Reverts() (gas: 6149)