Skip to content

Commit

Permalink
Add amoy and metis
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonmci committed Jul 15, 2024
2 parents c380748 + 50fae99 commit ec8d7b5
Show file tree
Hide file tree
Showing 23 changed files with 1,680 additions and 134 deletions.
60 changes: 30 additions & 30 deletions contracts/gas-snapshots/ccip.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ E2E:test_E2E_3MessagesSuccess_gas() (gas: 1104821)
EVM2EVMMultiOffRamp__releaseOrMintSingleToken:test__releaseOrMintSingleToken_NotACompatiblePool_Revert() (gas: 38220)
EVM2EVMMultiOffRamp__releaseOrMintSingleToken:test__releaseOrMintSingleToken_Success() (gas: 108400)
EVM2EVMMultiOffRamp__releaseOrMintSingleToken:test__releaseOrMintSingleToken_TokenHandlingError_revert_Revert() (gas: 116868)
EVM2EVMMultiOffRamp_applySourceChainConfigUpdates:test_AddMultipleChains_Success() (gas: 460557)
EVM2EVMMultiOffRamp_applySourceChainConfigUpdates:test_AddMultipleChains_Success() (gas: 460512)
EVM2EVMMultiOffRamp_applySourceChainConfigUpdates:test_AddNewChain_Success() (gas: 95536)
EVM2EVMMultiOffRamp_applySourceChainConfigUpdates:test_ApplyZeroUpdates_Success() (gas: 12460)
EVM2EVMMultiOffRamp_applySourceChainConfigUpdates:test_ReplaceExistingChainOnRamp_Revert() (gas: 90379)
Expand All @@ -142,8 +142,8 @@ EVM2EVMMultiOffRamp_ccipReceive:test_Reverts() (gas: 15659)
EVM2EVMMultiOffRamp_commit:test_InvalidIntervalMinLargerThanMax_Revert() (gas: 67189)
EVM2EVMMultiOffRamp_commit:test_InvalidInterval_Revert() (gas: 59695)
EVM2EVMMultiOffRamp_commit:test_InvalidRootRevert() (gas: 58775)
EVM2EVMMultiOffRamp_commit:test_NoConfigWithOtherConfigPresent_Revert() (gas: 6544263)
EVM2EVMMultiOffRamp_commit:test_NoConfig_Revert() (gas: 6127493)
EVM2EVMMultiOffRamp_commit:test_NoConfigWithOtherConfigPresent_Revert() (gas: 6545701)
EVM2EVMMultiOffRamp_commit:test_NoConfig_Revert() (gas: 6128931)
EVM2EVMMultiOffRamp_commit:test_OnlyGasPriceUpdates_Success() (gas: 108372)
EVM2EVMMultiOffRamp_commit:test_OnlyPriceUpdateStaleReport_Revert() (gas: 118374)
EVM2EVMMultiOffRamp_commit:test_OnlyTokenPriceUpdates_Success() (gas: 108415)
Expand All @@ -156,36 +156,36 @@ EVM2EVMMultiOffRamp_commit:test_StaleReportWithRoot_Success() (gas: 227655)
EVM2EVMMultiOffRamp_commit:test_UnauthorizedTransmitter_Revert() (gas: 119676)
EVM2EVMMultiOffRamp_commit:test_Unhealthy_Revert() (gas: 77602)
EVM2EVMMultiOffRamp_commit:test_ValidPriceUpdateThenStaleReportWithRoot_Success() (gas: 209115)
EVM2EVMMultiOffRamp_commit:test_WrongConfigWithoutSigners_Revert() (gas: 6538652)
EVM2EVMMultiOffRamp_commit:test_WrongConfigWithoutSigners_Revert() (gas: 6540090)
EVM2EVMMultiOffRamp_commit:test_ZeroEpochAndRound_Revert() (gas: 47782)
EVM2EVMMultiOffRamp_constructor:test_Constructor_Success() (gas: 6127677)
EVM2EVMMultiOffRamp_constructor:test_SourceChainSelector_Revert() (gas: 104335)
EVM2EVMMultiOffRamp_constructor:test_ZeroChainSelector_Revert() (gas: 100260)
EVM2EVMMultiOffRamp_constructor:test_ZeroNonceManager_Revert() (gas: 98131)
EVM2EVMMultiOffRamp_constructor:test_ZeroOnRampAddress_Revert() (gas: 106841)
EVM2EVMMultiOffRamp_constructor:test_ZeroRMNProxy_Revert() (gas: 98030)
EVM2EVMMultiOffRamp_constructor:test_ZeroTokenAdminRegistry_Revert() (gas: 98097)
EVM2EVMMultiOffRamp_constructor:test_Constructor_Success() (gas: 6131977)
EVM2EVMMultiOffRamp_constructor:test_SourceChainSelector_Revert() (gas: 157553)
EVM2EVMMultiOffRamp_constructor:test_ZeroChainSelector_Revert() (gas: 104040)
EVM2EVMMultiOffRamp_constructor:test_ZeroNonceManager_Revert() (gas: 101920)
EVM2EVMMultiOffRamp_constructor:test_ZeroOnRampAddress_Revert() (gas: 160058)
EVM2EVMMultiOffRamp_constructor:test_ZeroRMNProxy_Revert() (gas: 101810)
EVM2EVMMultiOffRamp_constructor:test_ZeroTokenAdminRegistry_Revert() (gas: 101877)
EVM2EVMMultiOffRamp_execute:test_IncorrectArrayType_Revert() (gas: 17277)
EVM2EVMMultiOffRamp_execute:test_LargeBatch_Success() (gas: 1563033)
EVM2EVMMultiOffRamp_execute:test_MultipleReportsWithPartialValidationFailures_Success() (gas: 343670)
EVM2EVMMultiOffRamp_execute:test_MultipleReportsWithPartialValidationFailures_Success() (gas: 343778)
EVM2EVMMultiOffRamp_execute:test_MultipleReports_Success() (gas: 260538)
EVM2EVMMultiOffRamp_execute:test_NoConfigWithOtherConfigPresent_Revert() (gas: 6594735)
EVM2EVMMultiOffRamp_execute:test_NoConfig_Revert() (gas: 6177684)
EVM2EVMMultiOffRamp_execute:test_NoConfigWithOtherConfigPresent_Revert() (gas: 6596173)
EVM2EVMMultiOffRamp_execute:test_NoConfig_Revert() (gas: 6179122)
EVM2EVMMultiOffRamp_execute:test_NonArray_Revert() (gas: 27678)
EVM2EVMMultiOffRamp_execute:test_SingleReport_Success() (gas: 165299)
EVM2EVMMultiOffRamp_execute:test_UnauthorizedTransmitter_Revert() (gas: 149255)
EVM2EVMMultiOffRamp_execute:test_WrongConfigWithSigners_Revert() (gas: 6956810)
EVM2EVMMultiOffRamp_execute:test_WrongConfigWithSigners_Revert() (gas: 6958248)
EVM2EVMMultiOffRamp_execute:test_ZeroReports_Revert() (gas: 17151)
EVM2EVMMultiOffRamp_executeSingleMessage:test_MessageSender_Revert() (gas: 18413)
EVM2EVMMultiOffRamp_executeSingleMessage:test_NonContractWithTokens_Success() (gas: 249488)
EVM2EVMMultiOffRamp_executeSingleMessage:test_NonContract_Success() (gas: 20672)
EVM2EVMMultiOffRamp_executeSingleMessage:test_TokenHandlingError_Revert() (gas: 201787)
EVM2EVMMultiOffRamp_executeSingleMessage:test_ZeroGasDONExecution_Revert() (gas: 48860)
EVM2EVMMultiOffRamp_executeSingleMessage:test_executeSingleMessage_NoTokens_Success() (gas: 48381)
EVM2EVMMultiOffRamp_executeSingleMessage:test_executeSingleMessage_WithFailingValidationNoRouterCall_Revert() (gas: 232668)
EVM2EVMMultiOffRamp_executeSingleMessage:test_executeSingleMessage_WithFailingValidation_Revert() (gas: 89262)
EVM2EVMMultiOffRamp_executeSingleMessage:test_executeSingleMessage_WithFailingValidationNoRouterCall_Revert() (gas: 232765)
EVM2EVMMultiOffRamp_executeSingleMessage:test_executeSingleMessage_WithFailingValidation_Revert() (gas: 89359)
EVM2EVMMultiOffRamp_executeSingleMessage:test_executeSingleMessage_WithTokens_Success() (gas: 278263)
EVM2EVMMultiOffRamp_executeSingleMessage:test_executeSingleMessage_WithValidation_Success() (gas: 93485)
EVM2EVMMultiOffRamp_executeSingleMessage:test_executeSingleMessage_WithValidation_Success() (gas: 93582)
EVM2EVMMultiOffRamp_executeSingleReport:test_DisabledSourceChain_Revert() (gas: 35083)
EVM2EVMMultiOffRamp_executeSingleReport:test_EmptyReport_Revert() (gas: 23910)
EVM2EVMMultiOffRamp_executeSingleReport:test_InvalidSourcePoolAddress_Success() (gas: 451951)
Expand Down Expand Up @@ -236,19 +236,19 @@ EVM2EVMMultiOffRamp_releaseOrMintTokens:test_releaseOrMintTokens_PoolDoesNotSupp
EVM2EVMMultiOffRamp_releaseOrMintTokens:test_releaseOrMintTokens_Success() (gas: 179068)
EVM2EVMMultiOffRamp_releaseOrMintTokens:test_releaseOrMintTokens_destDenominatedDecimals_Success() (gas: 278906)
EVM2EVMMultiOffRamp_resetUnblessedRoots:test_OnlyOwner_Revert() (gas: 11376)
EVM2EVMMultiOffRamp_resetUnblessedRoots:test_ResetUnblessedRoots_Success() (gas: 215403)
EVM2EVMMultiOffRamp_setDynamicConfig:test_NonOwner_Revert() (gas: 14289)
EVM2EVMMultiOffRamp_setDynamicConfig:test_PriceRegistryZeroAddress_Revert() (gas: 11795)
EVM2EVMMultiOffRamp_setDynamicConfig:test_RouterZeroAddress_Revert() (gas: 13951)
EVM2EVMMultiOffRamp_setDynamicConfig:test_SetDynamicConfigWithValidator_Success() (gas: 55630)
EVM2EVMMultiOffRamp_setDynamicConfig:test_SetDynamicConfig_Success() (gas: 33640)
EVM2EVMMultiOffRamp_trialExecute:test_RateLimitError_Success() (gas: 238383)
EVM2EVMMultiOffRamp_trialExecute:test_TokenHandlingErrorIsCaught_Success() (gas: 247046)
EVM2EVMMultiOffRamp_trialExecute:test_TokenPoolIsNotAContract_Success() (gas: 300337)
EVM2EVMMultiOffRamp_resetUnblessedRoots:test_ResetUnblessedRoots_Success() (gas: 215388)
EVM2EVMMultiOffRamp_setDynamicConfig:test_NonOwner_Revert() (gas: 14371)
EVM2EVMMultiOffRamp_setDynamicConfig:test_PriceRegistryZeroAddress_Revert() (gas: 11895)
EVM2EVMMultiOffRamp_setDynamicConfig:test_RouterZeroAddress_Revert() (gas: 14051)
EVM2EVMMultiOffRamp_setDynamicConfig:test_SetDynamicConfigWithValidator_Success() (gas: 55768)
EVM2EVMMultiOffRamp_setDynamicConfig:test_SetDynamicConfig_Success() (gas: 33778)
EVM2EVMMultiOffRamp_trialExecute:test_RateLimitError_Success() (gas: 238368)
EVM2EVMMultiOffRamp_trialExecute:test_TokenHandlingErrorIsCaught_Success() (gas: 247031)
EVM2EVMMultiOffRamp_trialExecute:test_TokenPoolIsNotAContract_Success() (gas: 300322)
EVM2EVMMultiOffRamp_trialExecute:test_trialExecute_Success() (gas: 280699)
EVM2EVMMultiOffRamp_verify:test_Blessed_Success() (gas: 176601)
EVM2EVMMultiOffRamp_verify:test_NotBlessedWrongChainSelector_Success() (gas: 178672)
EVM2EVMMultiOffRamp_verify:test_NotBlessed_Success() (gas: 141533)
EVM2EVMMultiOffRamp_verify:test_Blessed_Success() (gas: 176586)
EVM2EVMMultiOffRamp_verify:test_NotBlessedWrongChainSelector_Success() (gas: 178657)
EVM2EVMMultiOffRamp_verify:test_NotBlessed_Success() (gas: 141518)
EVM2EVMMultiOffRamp_verify:test_TooManyLeaves_Revert() (gas: 51505)
EVM2EVMMultiOnRamp_applyDestChainConfigUpdates:test_InvalidChainFamilySelector_Revert() (gas: 16764)
EVM2EVMMultiOnRamp_applyDestChainConfigUpdates:test_InvalidDestBytesOverhead_Revert() (gas: 33948)
Expand Down
1 change: 1 addition & 0 deletions contracts/scripts/native_solc_compile_all_ccip
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ compileContract ccip/NonceManager.sol
compileContract ccip/test/helpers/BurnMintERC677Helper.sol
compileContract ccip/test/helpers/CommitStoreHelper.sol
compileContract ccip/test/helpers/MessageHasher.sol
compileContract ccip/test/helpers/ReportCodec.sol
compileContract ccip/test/helpers/receivers/MaybeRevertMessageReceiver.sol
compileContract ccip/test/mocks/MockRMN1_0.sol
compileContract ccip/test/mocks/MockE2EUSDCTokenMessenger.sol
Expand Down
14 changes: 13 additions & 1 deletion contracts/src/v0.8/ccip/offRamp/EVM2EVMMultiOffRamp.sol
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,11 @@ contract EVM2EVMMultiOffRamp is ITypeAndVersion, MultiOCR3Base {
/// @dev The sequence number of the last price update
uint64 private s_latestPriceSequenceNumber;

constructor(StaticConfig memory staticConfig, SourceChainConfigArgs[] memory sourceChainConfigs) MultiOCR3Base() {
constructor(
StaticConfig memory staticConfig,
DynamicConfig memory dynamicConfig,
SourceChainConfigArgs[] memory sourceChainConfigs
) MultiOCR3Base() {
if (
staticConfig.rmnProxy == address(0) || staticConfig.tokenAdminRegistry == address(0)
|| staticConfig.nonceManager == address(0)
Expand All @@ -187,6 +191,7 @@ contract EVM2EVMMultiOffRamp is ITypeAndVersion, MultiOCR3Base {
i_nonceManager = staticConfig.nonceManager;
emit StaticConfigSet(staticConfig);

_setDynamicConfig(dynamicConfig);
_applySourceChainConfigUpdates(sourceChainConfigs);
}

Expand Down Expand Up @@ -750,7 +755,14 @@ contract EVM2EVMMultiOffRamp is ITypeAndVersion, MultiOCR3Base {
}

/// @notice Sets the dynamic config.
/// @param dynamicConfig The new dynamic config.
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 {
if (dynamicConfig.priceRegistry == address(0) || dynamicConfig.router == address(0)) {
revert ZeroAddressNotAllowed();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ contract EVM2EVMMultiOffRampHelper is EVM2EVMMultiOffRamp, IgnoreContractSize {

constructor(
StaticConfig memory staticConfig,
DynamicConfig memory dynamicConfig,
SourceChainConfigArgs[] memory sourceChainConfigs
) EVM2EVMMultiOffRamp(staticConfig, sourceChainConfigs) {}
) EVM2EVMMultiOffRamp(staticConfig, dynamicConfig, sourceChainConfigs) {}

function setExecutionStateHelper(
uint64 sourceChainSelector,
Expand Down
18 changes: 18 additions & 0 deletions contracts/src/v0.8/ccip/test/helpers/ReportCodec.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {Internal} from "../../libraries/Internal.sol";
import {EVM2EVMMultiOffRamp} from "../../offRamp/EVM2EVMMultiOffRamp.sol";

contract ReportCodec {
event ExecuteReportDecoded(Internal.ExecutionReportSingleChain[] report);
event CommitReportDecoded(EVM2EVMMultiOffRamp.CommitReport report);

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 (EVM2EVMMultiOffRamp.CommitReport memory) {
return abi.decode(report, (EVM2EVMMultiOffRamp.CommitReport));
}
}
12 changes: 10 additions & 2 deletions contracts/src/v0.8/ccip/test/offRamp/EVM2EVMMultiOffRamp.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ contract EVM2EVMMultiOffRamp_constructor is EVM2EVMMultiOffRampSetup {
vm.expectEmit();
emit EVM2EVMMultiOffRamp.StaticConfigSet(staticConfig);

vm.expectEmit();
emit EVM2EVMMultiOffRamp.DynamicConfigSet(dynamicConfig);

vm.expectEmit();
emit EVM2EVMMultiOffRamp.SourceChainSelectorAdded(SOURCE_CHAIN_SELECTOR_1);

Expand All @@ -79,7 +82,7 @@ contract EVM2EVMMultiOffRamp_constructor is EVM2EVMMultiOffRampSetup {
vm.expectEmit();
emit EVM2EVMMultiOffRamp.SourceChainConfigSet(SOURCE_CHAIN_SELECTOR_1 + 1, expectedSourceChainConfig2);

s_offRamp = new EVM2EVMMultiOffRampHelper(staticConfig, sourceChainConfigs);
s_offRamp = new EVM2EVMMultiOffRampHelper(staticConfig, dynamicConfig, sourceChainConfigs);

MultiOCR3Base.OCRConfigArgs[] memory ocrConfigs = new MultiOCR3Base.OCRConfigArgs[](1);
ocrConfigs[0] = MultiOCR3Base.OCRConfigArgs({
Expand All @@ -91,7 +94,6 @@ contract EVM2EVMMultiOffRamp_constructor is EVM2EVMMultiOffRampSetup {
transmitters: s_validTransmitters
});

s_offRamp.setDynamicConfig(dynamicConfig);
s_offRamp.setOCR3Configs(ocrConfigs);

// Static config
Expand Down Expand Up @@ -153,6 +155,7 @@ contract EVM2EVMMultiOffRamp_constructor is EVM2EVMMultiOffRampSetup {
tokenAdminRegistry: address(s_tokenAdminRegistry),
nonceManager: address(s_inboundNonceManager)
}),
_generateDynamicMultiOffRampConfig(USER_3, address(s_priceRegistry)),
sourceChainConfigs
);
}
Expand All @@ -175,6 +178,7 @@ contract EVM2EVMMultiOffRamp_constructor is EVM2EVMMultiOffRampSetup {
tokenAdminRegistry: address(s_tokenAdminRegistry),
nonceManager: address(s_inboundNonceManager)
}),
_generateDynamicMultiOffRampConfig(USER_3, address(s_priceRegistry)),
sourceChainConfigs
);
}
Expand All @@ -195,6 +199,7 @@ contract EVM2EVMMultiOffRamp_constructor is EVM2EVMMultiOffRampSetup {
tokenAdminRegistry: address(s_tokenAdminRegistry),
nonceManager: address(s_inboundNonceManager)
}),
_generateDynamicMultiOffRampConfig(USER_3, address(s_priceRegistry)),
sourceChainConfigs
);
}
Expand All @@ -215,6 +220,7 @@ contract EVM2EVMMultiOffRamp_constructor is EVM2EVMMultiOffRampSetup {
tokenAdminRegistry: address(s_tokenAdminRegistry),
nonceManager: address(s_inboundNonceManager)
}),
_generateDynamicMultiOffRampConfig(USER_3, address(s_priceRegistry)),
sourceChainConfigs
);
}
Expand All @@ -235,6 +241,7 @@ contract EVM2EVMMultiOffRamp_constructor is EVM2EVMMultiOffRampSetup {
tokenAdminRegistry: ZERO_ADDRESS,
nonceManager: address(s_inboundNonceManager)
}),
_generateDynamicMultiOffRampConfig(USER_3, address(s_priceRegistry)),
sourceChainConfigs
);
}
Expand All @@ -255,6 +262,7 @@ contract EVM2EVMMultiOffRamp_constructor is EVM2EVMMultiOffRampSetup {
tokenAdminRegistry: address(s_tokenAdminRegistry),
nonceManager: ZERO_ADDRESS
}),
_generateDynamicMultiOffRampConfig(USER_3, address(s_priceRegistry)),
sourceChainConfigs
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ contract EVM2EVMMultiOffRampSetup is TokenSetup, PriceRegistrySetup, MultiOCR3Ba
tokenAdminRegistry: address(s_tokenAdminRegistry),
nonceManager: address(nonceManager)
}),
_generateDynamicMultiOffRampConfig(address(router), address(s_priceRegistry)),
sourceChainConfigs
);

Expand Down Expand Up @@ -445,10 +446,10 @@ contract EVM2EVMMultiOffRampSetup is TokenSetup, PriceRegistrySetup, MultiOCR3Ba
tokenAdminRegistry: address(s_tokenAdminRegistry),
nonceManager: address(s_inboundNonceManager)
}),
_generateDynamicMultiOffRampConfig(address(s_destRouter), address(s_priceRegistry)),
new EVM2EVMMultiOffRamp.SourceChainConfigArgs[](0)
);

s_offRamp.setDynamicConfig(_generateDynamicMultiOffRampConfig(address(s_destRouter), address(s_priceRegistry)));
address[] memory authorizedCallers = new address[](1);
authorizedCallers[0] = address(s_offRamp);
s_inboundNonceManager.applyAuthorizedCallerUpdates(
Expand Down

Large diffs are not rendered by default.

Loading

0 comments on commit ec8d7b5

Please sign in to comment.