Skip to content

Commit

Permalink
adding chain selector return value
Browse files Browse the repository at this point in the history
Signed-off-by: 0xsuryansh <[email protected]>
  • Loading branch information
0xsuryansh committed Oct 2, 2024
1 parent 0735802 commit 094bdc5
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 28 deletions.
26 changes: 13 additions & 13 deletions contracts/gas-snapshots/ccip.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ OCR2Base_transmit:test_Transmit2SignersSuccess_gas() (gas: 51689)
OCR2Base_transmit:test_UnAuthorizedTransmitter_Revert() (gas: 23511)
OCR2Base_transmit:test_UnauthorizedSigner_Revert() (gas: 39707)
OCR2Base_transmit:test_WrongNumberOfSignatures_Revert() (gas: 20584)
OffRamp_afterOC3ConfigSet:test_afterOCR3ConfigSet_SignatureVerificationDisabled_Revert() (gas: 5869456)
OffRamp_afterOC3ConfigSet:test_afterOCR3ConfigSet_SignatureVerificationDisabled_Revert() (gas: 5915989)
OffRamp_applySourceChainConfigUpdates:test_AddMultipleChains_Success() (gas: 626169)
OffRamp_applySourceChainConfigUpdates:test_AddNewChain_Success() (gas: 166511)
OffRamp_applySourceChainConfigUpdates:test_ApplyZeroUpdates_Success() (gas: 16763)
Expand All @@ -634,8 +634,8 @@ OffRamp_commit:test_FailedRMNVerification_Reverts() (gas: 64099)
OffRamp_commit:test_InvalidIntervalMinLargerThanMax_Revert() (gas: 68173)
OffRamp_commit:test_InvalidInterval_Revert() (gas: 64291)
OffRamp_commit:test_InvalidRootRevert() (gas: 63356)
OffRamp_commit:test_NoConfigWithOtherConfigPresent_Revert() (gas: 6630247)
OffRamp_commit:test_NoConfig_Revert() (gas: 6213919)
OffRamp_commit:test_NoConfigWithOtherConfigPresent_Revert() (gas: 6676780)
OffRamp_commit:test_NoConfig_Revert() (gas: 6260452)
OffRamp_commit:test_OnlyGasPriceUpdates_Success() (gas: 113042)
OffRamp_commit:test_OnlyPriceUpdateStaleReport_Revert() (gas: 121403)
OffRamp_commit:test_OnlyTokenPriceUpdates_Success() (gas: 113063)
Expand All @@ -649,23 +649,23 @@ OffRamp_commit:test_UnauthorizedTransmitter_Revert() (gas: 125409)
OffRamp_commit:test_Unhealthy_Revert() (gas: 58633)
OffRamp_commit:test_ValidPriceUpdateThenStaleReportWithRoot_Success() (gas: 206778)
OffRamp_commit:test_ZeroEpochAndRound_Revert() (gas: 51722)
OffRamp_constructor:test_Constructor_Success() (gas: 6175874)
OffRamp_constructor:test_SourceChainSelector_Revert() (gas: 182772)
OffRamp_constructor:test_ZeroChainSelector_Revert() (gas: 103307)
OffRamp_constructor:test_ZeroNonceManager_Revert() (gas: 101201)
OffRamp_constructor:test_ZeroOnRampAddress_Revert() (gas: 228198)
OffRamp_constructor:test_ZeroRMNRemote_Revert() (gas: 101121)
OffRamp_constructor:test_ZeroTokenAdminRegistry_Revert() (gas: 101159)
OffRamp_constructor:test_Constructor_Success() (gas: 6221879)
OffRamp_constructor:test_SourceChainSelector_Revert() (gas: 182841)
OffRamp_constructor:test_ZeroChainSelector_Revert() (gas: 103375)
OffRamp_constructor:test_ZeroNonceManager_Revert() (gas: 101269)
OffRamp_constructor:test_ZeroOnRampAddress_Revert() (gas: 228266)
OffRamp_constructor:test_ZeroRMNRemote_Revert() (gas: 101189)
OffRamp_constructor:test_ZeroTokenAdminRegistry_Revert() (gas: 101227)
OffRamp_execute:test_IncorrectArrayType_Revert() (gas: 17639)
OffRamp_execute:test_LargeBatch_Success() (gas: 3425675)
OffRamp_execute:test_MultipleReportsWithPartialValidationFailures_Success() (gas: 372967)
OffRamp_execute:test_MultipleReports_Success() (gas: 300913)
OffRamp_execute:test_NoConfigWithOtherConfigPresent_Revert() (gas: 7039120)
OffRamp_execute:test_NoConfig_Revert() (gas: 6263595)
OffRamp_execute:test_NoConfigWithOtherConfigPresent_Revert() (gas: 7085653)
OffRamp_execute:test_NoConfig_Revert() (gas: 6310128)
OffRamp_execute:test_NonArray_Revert() (gas: 27562)
OffRamp_execute:test_SingleReport_Success() (gas: 176332)
OffRamp_execute:test_UnauthorizedTransmitter_Revert() (gas: 148350)
OffRamp_execute:test_WrongConfigWithSigners_Revert() (gas: 7041869)
OffRamp_execute:test_WrongConfigWithSigners_Revert() (gas: 7088402)
OffRamp_execute:test_ZeroReports_Revert() (gas: 17361)
OffRamp_executeSingleMessage:test_MessageSender_Revert() (gas: 18511)
OffRamp_executeSingleMessage:test_NonContractWithTokens_Success() (gas: 244057)
Expand Down
8 changes: 5 additions & 3 deletions contracts/src/v0.8/ccip/offRamp/OffRamp.sol
Original file line number Diff line number Diff line change
Expand Up @@ -926,12 +926,14 @@ contract OffRamp is ITypeAndVersion, MultiOCR3Base {

/// @notice Returns all source chain configs
/// @return sourceChainConfigs The source chain configs corresponding to all the supported chain selectors
function getAllSourceChainConfig() external view returns (SourceChainConfig[] memory) {
function getAllSourceChainConfig() external view returns (uint64[] memory, SourceChainConfig[] memory) {
SourceChainConfig[] memory sourceChainConfigs = new SourceChainConfig[](s_sourceChainSelectors.length());
uint64[] memory sourceChainSelectors = new uint64[](s_sourceChainSelectors.length());
for (uint256 i = 0; i < s_sourceChainSelectors.length(); ++i) {
sourceChainConfigs[i] = s_sourceChainConfigs[uint64(s_sourceChainSelectors.at(i))];
sourceChainSelectors[i] = uint64(s_sourceChainSelectors.at(i));
sourceChainConfigs[i] = s_sourceChainConfigs[sourceChainSelectors[i]];
}
return sourceChainConfigs;
return (sourceChainSelectors, sourceChainConfigs);
}

/// @notice Updates source configs
Expand Down
4 changes: 2 additions & 2 deletions contracts/src/v0.8/ccip/test/offRamp/OffRamp.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ contract OffRamp_constructor is OffRampSetup {
MultiOCR3Base.OCRConfig memory gotOCRConfig = s_offRamp.latestConfigDetails(uint8(Internal.OCRPluginType.Execution));
_assertOCRConfigEquality(expectedOCRConfig, gotOCRConfig);

OffRamp.SourceChainConfig[] memory actualSourceChainConfigs = s_offRamp.getAllSourceChainConfig();
(uint64[] memory actualSourceChainSelectors, OffRamp.SourceChainConfig[] memory actualSourceChainConfigs) =
s_offRamp.getAllSourceChainConfig();

_assertSourceChainConfigEquality(actualSourceChainConfigs[0], expectedSourceChainConfig1);
_assertSourceChainConfigEquality(actualSourceChainConfigs[1], expectedSourceChainConfig2);
Expand All @@ -137,7 +138,6 @@ contract OffRamp_constructor is OffRampSetup {
assertEq(OWNER, s_offRamp.owner());
assertEq(0, s_offRamp.getLatestPriceSequenceNumber());

uint256[] memory actualSourceChainSelectors = s_offRamp.getSourceChainSelectors();
// assertion for source chain selector
for (uint256 i = 0; i < expectedSourceChainSelectors.length; i++) {
assertEq(expectedSourceChainSelectors[i], actualSourceChainSelectors[i]);
Expand Down
19 changes: 10 additions & 9 deletions core/gethwrappers/ccip/generated/offramp/offramp.go

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ mock_v3_aggregator_contract: ../../../contracts/solc/v0.8.24/MockV3Aggregator/Mo
multi_aggregate_rate_limiter: ../../../contracts/solc/v0.8.24/MultiAggregateRateLimiter/MultiAggregateRateLimiter.abi ../../../contracts/solc/v0.8.24/MultiAggregateRateLimiter/MultiAggregateRateLimiter.bin 0b541232e49727e947dc164eadf35963c66e67576f21baa0ecaa06a8833148ed
multi_ocr3_helper: ../../../contracts/solc/v0.8.24/MultiOCR3Helper/MultiOCR3Helper.abi ../../../contracts/solc/v0.8.24/MultiOCR3Helper/MultiOCR3Helper.bin 04b6b261dd71925670bf4d904aaf7bf08543452009feefb88e07d4c49d12e969
nonce_manager: ../../../contracts/solc/v0.8.24/NonceManager/NonceManager.abi ../../../contracts/solc/v0.8.24/NonceManager/NonceManager.bin 6f64e1083b356c06ee66b9138e398b9c97a4cd3e8c9ec38cf3010cebc79af536
offramp: ../../../contracts/solc/v0.8.24/OffRamp/OffRamp.abi ../../../contracts/solc/v0.8.24/OffRamp/OffRamp.bin 0b8c19d3dc18bae2859e7c8c4b52b97f6de1a849400cb713662cd9cedb22fdd4
offramp: ../../../contracts/solc/v0.8.24/OffRamp/OffRamp.abi ../../../contracts/solc/v0.8.24/OffRamp/OffRamp.bin 7b95f8ea28863272e075c3e7aeef2c2600a8bddd48a2a4c21ff21402d72f6f57
onramp: ../../../contracts/solc/v0.8.24/OnRamp/OnRamp.abi ../../../contracts/solc/v0.8.24/OnRamp/OnRamp.bin 4f29f05261bdaf9b99e675c1169c0d5cba841b6dd7ca3a8997cc0d3cae7ba850
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
Expand Down

0 comments on commit 094bdc5

Please sign in to comment.