Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions chains/evm/.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -309,26 +309,26 @@ MockRouterTest:test_ccipSendWithEVMExtraArgsV1() (gas: 110647)
MockRouterTest:test_ccipSendWithEVMExtraArgsV2() (gas: 133011)
MockRouterTest:test_ccipSendWithLinkFeeTokenAndValidMsgValue() (gas: 122017)
MockRouterTest:test_ccipSendWithSufficientNativeFeeTokens() (gas: 44327)
OffRamp__getCCVsForMessage:test__getCCVsForMessage_DeduplicatesOptionalAgainstRequired() (gas: 92663)
OffRamp__getCCVsForMessage:test__getCCVsForMessage_DeduplicatesOptionalAgainstRequired() (gas: 92468)
OffRamp_applySourceChainConfigUpdates:test_applySourceChainConfigUpdates_multipleChains() (gas: 649751)
OffRamp_applySourceChainConfigUpdates:test_applySourceChainConfigUpdates_updateExistingChain() (gas: 145771)
OffRamp_constructor:test_constructor() (gas: 4637751)
OffRamp_ensureCCVQuorumIsReached:test_ensureCCVQuorumIsReached_AllCCVsFound() (gas: 78643)
OffRamp_ensureCCVQuorumIsReached:test_ensureCCVQuorumIsReached_OptionalIsAlsoRequired() (gas: 46789)
OffRamp_ensureCCVQuorumIsReached:test_ensureCCVQuorumIsReached_Success_OptionalCCVsFound() (gas: 44627)
OffRamp_execute:test_execute() (gas: 108339)
OffRamp_constructor:test_constructor() (gas: 4618497)
OffRamp_ensureCCVQuorumIsReached:test_ensureCCVQuorumIsReached_AllCCVsFound() (gas: 78346)
OffRamp_ensureCCVQuorumIsReached:test_ensureCCVQuorumIsReached_OptionalIsAlsoRequired() (gas: 46598)
OffRamp_ensureCCVQuorumIsReached:test_ensureCCVQuorumIsReached_Success_OptionalCCVsFound() (gas: 44436)
OffRamp_execute:test_execute() (gas: 108038)
OffRamp_execute:test_execute_InsufficientGasToCompleteTx_setsToFailure() (gas: 94032)
OffRamp_execute:test_execute_ReentrancyGuardReentrantCall_Fails() (gas: 1224406)
OffRamp_execute:test_execute_ReentrancyGuardReentrantCall_Fails() (gas: 1224210)
OffRamp_execute:test_execute_RunsOutOfGasAndSetsStateToFailure() (gas: 93785)
OffRamp_execute:test_execute_UsesGasLimitOverrideWhenGreaterThanMessageGasLimit() (gas: 216759)
OffRamp_execute:test_execute_WithReceiver() (gas: 421923)
OffRamp_executeSingleMessage:test_executeSingleMessage_PassActualTokenAmountToReceiver() (gas: 1312662)
OffRamp_executeSingleMessage:test_executeSingleMessage_PassAmountReturnedByPoolToReceiver() (gas: 1309545)
OffRamp_executeSingleMessage:test_executeSingleMessage_UsesGasLimitOverrideWhenNonZero() (gas: 1312358)
OffRamp_execute:test_execute_UsesGasLimitOverrideWhenGreaterThanMessageGasLimit() (gas: 216459)
OffRamp_execute:test_execute_WithReceiver() (gas: 421622)
OffRamp_executeSingleMessage:test_executeSingleMessage_PassActualTokenAmountToReceiver() (gas: 1312361)
OffRamp_executeSingleMessage:test_executeSingleMessage_PassAmountReturnedByPoolToReceiver() (gas: 1309245)
OffRamp_executeSingleMessage:test_executeSingleMessage_UsesGasLimitOverrideWhenNonZero() (gas: 1312057)
OffRamp_getAllSourceChainConfigs:test_getAllSourceChainConfigs_ReturnsMultipleChains() (gas: 323105)
OffRamp_getAllSourceChainConfigs:test_getAllSourceChainConfigs_ReturnsSingleChain() (gas: 43467)
OffRamp_getBalanceOfReceiver:test_getBalanceOfReceiver() (gas: 13916)
OffRamp_getCCVsForMessage:test_getCCVsForMessage() (gas: 115322)
OffRamp_getCCVsForMessage:test_getCCVsForMessage() (gas: 115022)
OffRamp_getCCVsFromPool:test_getCCVsFromPool_ReturnsDefaultCCVs_WhenPoolDoesNotSupportV2() (gas: 280089)
OffRamp_getCCVsFromPool:test_getCCVsFromPool_ReturnsDefaultCCVs_WhenPoolReturnsEmptyArray() (gas: 215409)
OffRamp_getCCVsFromPool:test_getCCVsFromPool_ReturnsPoolCCVs_WhenPoolSupportsV2() (gas: 286145)
Expand All @@ -337,7 +337,7 @@ OffRamp_getCCVsFromReceiver:test_getCCVsFromReceiver_contractV2_fallsBackToDefau
OffRamp_getCCVsFromReceiver:test_getCCVsFromReceiver_contractV2_usesReceiverValues() (gas: 347955)
OffRamp_getCCVsFromReceiver:test_getCCVsFromReceiver_noContract_fallsBackToDefaults() (gas: 17197)
OffRamp_getSourceChainConfig:test_getSourceChainConfig_ReturnsCorrectConfig() (gas: 35401)
OffRamp_getStaticConfig:test_getStaticConfig_MatchesConstructorValues() (gas: 4636708)
OffRamp_getStaticConfig:test_getStaticConfig_MatchesConstructorValues() (gas: 4617454)
OffRamp_isTokenOnlyTransfer:test_isTokenOnlyTransfer_FalseWhen_HasDataOnly() (gas: 16688)
OffRamp_isTokenOnlyTransfer:test_isTokenOnlyTransfer_FalseWhen_HasGasLimitOnly() (gas: 16564)
OffRamp_isTokenOnlyTransfer:test_isTokenOnlyTransfer_FalseWhen_ReceiverSupportsInterface_WithDataAndGas() (gas: 16490)
Expand Down Expand Up @@ -623,7 +623,7 @@ VersionedVerifierResolver_applyOutboundImplementationUpdates:test_applyOutboundI
VersionedVerifierResolver_setFeeAggregator:test_setFeeAggregator() (gas: 37286)
VersionedVerifierResolver_withdrawFeeTokens:test_withdrawFeeTokens() (gas: 215451)
VersionedVerifierResolver_withdrawFeeTokens:test_withdrawFeeTokens_MultipleTokens() (gas: 1492937)
cctp_e2e:test_cctp_e2e() (gas: 653955)
e2e:test_e2e() (gas: 548557)
cctp_e2e:test_cctp_e2e() (gas: 653759)
e2e:test_e2e() (gas: 548256)
e2e_feeWithdrawal:test_FeeWithdrawal_AfterCcipSend() (gas: 583046)
e2e_lombard:test_e2e_Lombard() (gas: 732408)
e2e_lombard:test_e2e_Lombard() (gas: 732108)
16 changes: 9 additions & 7 deletions chains/evm/contracts/offRamp/OffRamp.sol
Original file line number Diff line number Diff line change
Expand Up @@ -482,13 +482,16 @@ contract OffRamp is ITypeAndVersion, Ownable2StepMsgSender {
(requiredReceiverCCVs, optionalCCVs, optionalThreshold) = _getCCVsFromReceiver(sourceChainSelector, receiver);
}

address[] memory laneMandatedCCVs = s_sourceChainConfigs[sourceChainSelector].laneMandatedCCVs;
address[] storage laneMandatedCCVs = s_sourceChainConfigs[sourceChainSelector].laneMandatedCCVs;
address[] storage defaultCCVs = s_sourceChainConfigs[sourceChainSelector].defaultCCVs;

// Save lengths in memory to avoid multiple storage reads. This is safe as the logic below does not modify the arrays.
uint256 laneMandatedCCVsLength = laneMandatedCCVs.length;
uint256 defaultCCVsLength = defaultCCVs.length;

// We allocate the memory for all possible CCVs upfront to avoid multiple allocations.
address[] memory allRequiredCCVs = new address[](
requiredReceiverCCVs.length + requiredPoolCCVs.length + laneMandatedCCVs.length + defaultCCVs.length
);
address[] memory allRequiredCCVs =
new address[](requiredReceiverCCVs.length + requiredPoolCCVs.length + laneMandatedCCVsLength + defaultCCVsLength);

uint256 index = 0;
for (uint256 i = 0; i < requiredReceiverCCVs.length; ++i) {
Expand All @@ -499,15 +502,14 @@ contract OffRamp is ITypeAndVersion, Ownable2StepMsgSender {
allRequiredCCVs[index++] = requiredPoolCCVs[i];
}

for (uint256 i = 0; i < laneMandatedCCVs.length; ++i) {
for (uint256 i = 0; i < laneMandatedCCVsLength; ++i) {
allRequiredCCVs[index++] = laneMandatedCCVs[i];
}

// Add defaults if any address(0) was found.
for (uint256 i = 0; i < index; ++i) {
if (allRequiredCCVs[i] == address(0)) {
uint256 numberOfDefaults = defaultCCVs.length;
for (uint256 j = 0; j < numberOfDefaults; ++j) {
for (uint256 j = 0; j < defaultCCVsLength; ++j) {
allRequiredCCVs[index++] = defaultCCVs[j];
}
// Break to ensure they're only added once.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ mock_receiver_v2: ../solc/ccip/MockReceiverV2/MockReceiverV2.sol/MockReceiverV2.
mock_usdc_token_messenger: ../solc/ccip/MockE2EUSDCTokenMessenger/MockE2EUSDCTokenMessenger.sol/MockE2EUSDCTokenMessenger.abi.json ../solc/ccip/MockE2EUSDCTokenMessenger/MockE2EUSDCTokenMessenger.sol/MockE2EUSDCTokenMessenger.bin b72993a4bd22e92126d36f26b3c9c69d47bff010c5156633fbe8836e7f86ccb1
mock_usdc_token_transmitter: ../solc/ccip/MockE2EUSDCTransmitter/MockE2EUSDCTransmitter.sol/MockE2EUSDCTransmitter.abi.json ../solc/ccip/MockE2EUSDCTransmitter/MockE2EUSDCTransmitter.sol/MockE2EUSDCTransmitter.bin ae0d090105bc248f4eccd337836ec1db760c506d6f5578e662305abbbc520fcd
multi_ocr3_helper: ../solc/ccip/MultiOCR3Helper/MultiOCR3Helper.sol/MultiOCR3Helper.abi.json ../solc/ccip/MultiOCR3Helper/MultiOCR3Helper.sol/MultiOCR3Helper.bin 068d4e34ec79766e1875319f1767075a2a43c07d79aff53449ea693db33a5ded
offramp: ../solc/ccip/OffRamp/OffRamp.sol/OffRamp.abi.json ../solc/ccip/OffRamp/OffRamp.sol/OffRamp.bin 3aeedae358e049889afe73761bc533164f26fd5479c2864e67fd79ddf150bda0
offramp: ../solc/ccip/OffRamp/OffRamp.sol/OffRamp.abi.json ../solc/ccip/OffRamp/OffRamp.sol/OffRamp.bin 3c5f81c2214422cc5a638fa43e84acea0c4b25cc91a18f5b0034053c451f359e
onramp: ../solc/ccip/OnRamp/OnRamp.sol/OnRamp.abi.json ../solc/ccip/OnRamp/OnRamp.sol/OnRamp.bin 55d5f77a097e66673b22cb3041de79b74d4e7e1b98c40e94f151796ab9ddea8d
ping_pong_demo: ../solc/ccip/PingPongDemo/PingPongDemo.sol/PingPongDemo.abi.json ../solc/ccip/PingPongDemo/PingPongDemo.sol/PingPongDemo.bin db90196d1d48e825d2d9cf9fffcb4d662a9b9ceaf3b61dbac3f60a61e99a4572
proxy: ../solc/ccip/Proxy/Proxy.sol/Proxy.abi.json ../solc/ccip/Proxy/Proxy.sol/Proxy.bin 3916035cbec7281d520fc0ea1808bdc757442e82a2f14c66fa3c0294a082e91f
Expand Down
Loading