Skip to content

Commit

Permalink
MultiAggregateRateLimiter - non-evm and multi-lane remote token suppo…
Browse files Browse the repository at this point in the history
…rt (#939)

## Motivation
Follow up of #916 to integrate non-EVM token support, and convert
`rateLimitedTokens` configuration to be per-chain. This converts the
multi-ARL to be truly multi-lane and untied from EVM2EVM to EVM2Any,
Any2EVM

## Solution
* Add `chainSelector` to rate limit tokens state
* Convert addresses from `bytes` to `bytes32` (for now assuming that we
can fit token addresses in `bytes32` for all non-EVM chains)
  • Loading branch information
elatoskinas authored Jun 7, 2024
1 parent 18cd879 commit c36cd86
Show file tree
Hide file tree
Showing 13 changed files with 673 additions and 490 deletions.
5 changes: 5 additions & 0 deletions contracts/.changeset/dull-dryers-attack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@chainlink/contracts-ccip": minor
---

#added non-evm token and multi-lane token support for multi-arl interceptor
72 changes: 35 additions & 37 deletions contracts/gas-snapshots/ccip.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -481,48 +481,46 @@ MockRouterTest:test_ccipSendWithLinkFeeTokenbutInsufficientAllowance_Revert() (g
MockRouterTest:test_ccipSendWithSufficientNativeFeeTokens_Success() (gas: 43853)
MultiAggregateRateLimiter__getTokenValue:test_GetTokenValue_Success() (gas: 19595)
MultiAggregateRateLimiter__getTokenValue:test_NoTokenPrice_Reverts() (gas: 21180)
MultiAggregateRateLimiter__rateLimitValue:test_AggregateValueMaxCapacityExceeded_Revert() (gas: 17228)
MultiAggregateRateLimiter__rateLimitValue:test_RateLimitValueDifferentChainSelectors_Success() (gas: 9223372036854754743)
MultiAggregateRateLimiter__rateLimitValue:test_RateLimitValueDifferentLanes_Success() (gas: 9223372036854754743)
MultiAggregateRateLimiter__rateLimitValue:test_RateLimitValue_Success_gas() (gas: 18769)
MultiAggregateRateLimiter_applyRateLimiterConfigUpdates:test_MultipleConfigsBothLanes_Success() (gas: 132024)
MultiAggregateRateLimiter_applyRateLimiterConfigUpdates:test_MultipleConfigs_Success() (gas: 311954)
MultiAggregateRateLimiter_applyRateLimiterConfigUpdates:test_OnlyCallableByOwner_Revert() (gas: 17713)
MultiAggregateRateLimiter_applyRateLimiterConfigUpdates:test_SingleConfigOutgoing_Success() (gas: 75754)
MultiAggregateRateLimiter_applyRateLimiterConfigUpdates:test_SingleConfig_Success() (gas: 75758)
MultiAggregateRateLimiter_applyRateLimiterConfigUpdates:test_UpdateExistingConfigWithNoDifference_Success() (gas: 38158)
MultiAggregateRateLimiter_applyRateLimiterConfigUpdates:test_UpdateExistingConfig_Success() (gas: 49117)
MultiAggregateRateLimiter_applyRateLimiterConfigUpdates:test_ZeroChainSelector_Revert() (gas: 17033)
MultiAggregateRateLimiter_applyRateLimiterConfigUpdates:test_ZeroConfigs_Success() (gas: 12352)
MultiAggregateRateLimiter_constructor:test_ConstructorNoAuthorizedCallers_Success() (gas: 1916532)
MultiAggregateRateLimiter_constructor:test_ConstructorNoConfigs_Success() (gas: 2034259)
MultiAggregateRateLimiter_constructor:test_Constructor_Success() (gas: 2213795)
MultiAggregateRateLimiter_applyRateLimiterConfigUpdates:test_MultipleConfigsBothLanes_Success() (gas: 132031)
MultiAggregateRateLimiter_applyRateLimiterConfigUpdates:test_MultipleConfigs_Success() (gas: 312057)
MultiAggregateRateLimiter_applyRateLimiterConfigUpdates:test_OnlyCallableByOwner_Revert() (gas: 17717)
MultiAggregateRateLimiter_applyRateLimiterConfigUpdates:test_SingleConfigOutgoing_Success() (gas: 75729)
MultiAggregateRateLimiter_applyRateLimiterConfigUpdates:test_SingleConfig_Success() (gas: 75733)
MultiAggregateRateLimiter_applyRateLimiterConfigUpdates:test_UpdateExistingConfigWithNoDifference_Success() (gas: 38133)
MultiAggregateRateLimiter_applyRateLimiterConfigUpdates:test_UpdateExistingConfig_Success() (gas: 49092)
MultiAggregateRateLimiter_applyRateLimiterConfigUpdates:test_ZeroChainSelector_Revert() (gas: 17019)
MultiAggregateRateLimiter_applyRateLimiterConfigUpdates:test_ZeroConfigs_Success() (gas: 12295)
MultiAggregateRateLimiter_constructor:test_ConstructorNoAuthorizedCallers_Success() (gas: 1956183)
MultiAggregateRateLimiter_constructor:test_Constructor_Success() (gas: 2072477)
MultiAggregateRateLimiter_getTokenBucket:test_GetTokenBucket_Success() (gas: 34248)
MultiAggregateRateLimiter_getTokenBucket:test_Refill_Success() (gas: 47383)
MultiAggregateRateLimiter_getTokenBucket:test_Refill_Success() (gas: 47358)
MultiAggregateRateLimiter_getTokenBucket:test_TimeUnderflow_Revert() (gas: 15806)
MultiAggregateRateLimiter_onIncomingMessage:test_ValidateMessageFromUnauthorizedCaller_Revert() (gas: 14555)
MultiAggregateRateLimiter_onIncomingMessage:test_ValidateMessageWithDisabledRateLimitToken_Success() (gas: 64038)
MultiAggregateRateLimiter_onIncomingMessage:test_ValidateMessageWithNoTokens_Success() (gas: 15267)
MultiAggregateRateLimiter_onIncomingMessage:test_ValidateMessageWithRateLimitDisabled_Success() (gas: 67187)
MultiAggregateRateLimiter_onIncomingMessage:test_ValidateMessageWithRateLimitExceeded_Revert() (gas: 50297)
MultiAggregateRateLimiter_onIncomingMessage:test_ValidateMessageWithRateLimitReset_Success() (gas: 77910)
MultiAggregateRateLimiter_onIncomingMessage:test_ValidateMessageWithTokensOnDifferentChains_Success() (gas: 87938)
MultiAggregateRateLimiter_onIncomingMessage:test_ValidateMessageWithTokens_Success() (gas: 54460)
MultiAggregateRateLimiter_setAuthorizedCallers:test_AddAndRemove_Success() (gas: 120460)
MultiAggregateRateLimiter_setAuthorizedCallers:test_AddThenRemove_Success() (gas: 65981)
MultiAggregateRateLimiter_setAuthorizedCallers:test_OnlyAdd_Success() (gas: 133162)
MultiAggregateRateLimiter_setAuthorizedCallers:test_OnlyOwner_Revert() (gas: 13615)
MultiAggregateRateLimiter_setAuthorizedCallers:test_OnlyRemove_Success() (gas: 45684)
MultiAggregateRateLimiter_setAuthorizedCallers:test_SkipRemove_Success() (gas: 32621)
MultiAggregateRateLimiter_setAuthorizedCallers:test_ZeroAddressAdd_Revert() (gas: 12621)
MultiAggregateRateLimiter_onIncomingMessage:test_ValidateMessageFromUnauthorizedCaller_Revert() (gas: 14532)
MultiAggregateRateLimiter_onIncomingMessage:test_ValidateMessageWithDifferentTokensOnDifferentChains_Success() (gas: 189169)
MultiAggregateRateLimiter_onIncomingMessage:test_ValidateMessageWithDisabledRateLimitToken_Success() (gas: 59823)
MultiAggregateRateLimiter_onIncomingMessage:test_ValidateMessageWithNoTokens_Success() (gas: 17562)
MultiAggregateRateLimiter_onIncomingMessage:test_ValidateMessageWithRateLimitDisabled_Success() (gas: 44848)
MultiAggregateRateLimiter_onIncomingMessage:test_ValidateMessageWithRateLimitExceeded_Revert() (gas: 50433)
MultiAggregateRateLimiter_onIncomingMessage:test_ValidateMessageWithRateLimitReset_Success() (gas: 78388)
MultiAggregateRateLimiter_onIncomingMessage:test_ValidateMessageWithTokensOnDifferentChains_Success() (gas: 263156)
MultiAggregateRateLimiter_onIncomingMessage:test_ValidateMessageWithTokens_Success() (gas: 54607)
MultiAggregateRateLimiter_setAuthorizedCallers:test_AddAndRemove_Success() (gas: 125991)
MultiAggregateRateLimiter_setAuthorizedCallers:test_OnlyAdd_Success() (gas: 133140)
MultiAggregateRateLimiter_setAuthorizedCallers:test_OnlyOwner_Revert() (gas: 13570)
MultiAggregateRateLimiter_setAuthorizedCallers:test_OnlyRemove_Success() (gas: 45639)
MultiAggregateRateLimiter_setAuthorizedCallers:test_RemoveThenAdd_Success() (gas: 57929)
MultiAggregateRateLimiter_setAuthorizedCallers:test_SkipRemove_Success() (gas: 32576)
MultiAggregateRateLimiter_setAuthorizedCallers:test_ZeroAddressAdd_Revert() (gas: 12623)
MultiAggregateRateLimiter_setPriceRegistry:test_OnlyOwner_Revert() (gas: 11336)
MultiAggregateRateLimiter_setPriceRegistry:test_Owner_Success() (gas: 19124)
MultiAggregateRateLimiter_setPriceRegistry:test_ZeroAddress_Revert() (gas: 10608)
MultiAggregateRateLimiter_updateRateLimitTokens:test_NonOwner_Revert() (gas: 17104)
MultiAggregateRateLimiter_updateRateLimitTokens:test_UpdateRateLimitTokens_AddsAndRemoves_Success() (gas: 161147)
MultiAggregateRateLimiter_updateRateLimitTokens:test_UpdateRateLimitTokens_Success() (gas: 198653)
MultiAggregateRateLimiter_updateRateLimitTokens:test_ZeroDestToken_Revert() (gas: 17139)
MultiAggregateRateLimiter_updateRateLimitTokens:test_ZeroSourceToken_Revert() (gas: 17194)
MultiAggregateRateLimiter_updateRateLimitTokens:test_NonOwner_Revert() (gas: 16085)
MultiAggregateRateLimiter_updateRateLimitTokens:test_UpdateRateLimitTokensMultipleChains_Success() (gas: 225635)
MultiAggregateRateLimiter_updateRateLimitTokens:test_UpdateRateLimitTokensSingleChain_Success() (gas: 200184)
MultiAggregateRateLimiter_updateRateLimitTokens:test_UpdateRateLimitTokens_AddsAndRemoves_Success() (gas: 162050)
MultiAggregateRateLimiter_updateRateLimitTokens:test_UpdateRateLimitTokens_RemoveNonExistentToken_Success() (gas: 28509)
MultiAggregateRateLimiter_updateRateLimitTokens:test_ZeroDestToken_Revert() (gas: 17430)
MultiAggregateRateLimiter_updateRateLimitTokens:test_ZeroSourceToken_Revert() (gas: 17485)
MultiCommitStore_applySourceChainConfigUpdates:test_InvalidSourceChainConfig_Revert() (gas: 29592)
MultiCommitStore_applySourceChainConfigUpdates:test_OnlyOwner_Revert() (gas: 12743)
MultiCommitStore_constructor:test_Constructor_Failure() (gas: 316394)
Expand Down
23 changes: 15 additions & 8 deletions contracts/gas-snapshots/shared.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,21 @@ CallWithExactGas__callWithExactGasSafeReturnData:test_CallWithExactGasSafeReturn
CallWithExactGas__callWithExactGasSafeReturnData:test_NoContractReverts() (gas: 13917)
CallWithExactGas__callWithExactGasSafeReturnData:test_NoGasForCallExactCheckReverts() (gas: 16116)
CallWithExactGas__callWithExactGasSafeReturnData:test_NotEnoughGasForCallReverts() (gas: 16547)
EnumerableMapAddresses_at:testAtSuccess() (gas: 102929)
EnumerableMapAddresses_contains:testContainsSuccess() (gas: 100949)
EnumerableMapAddresses_get:testGetSuccess() (gas: 102572)
EnumerableMapAddresses_get_errorMessage:testGetErrorMessageSuccess() (gas: 103008)
EnumerableMapAddresses_length:testLengthSuccess() (gas: 79429)
EnumerableMapAddresses_remove:testRemoveSuccess() (gas: 81598)
EnumerableMapAddresses_set:testSetSuccess() (gas: 102917)
EnumerableMapAddresses_tryGet:testTryGetSuccess() (gas: 103286)
EnumerableMapAddresses_at:testAtSuccess() (gas: 95001)
EnumerableMapAddresses_at:testBytes32AtSuccess() (gas: 94770)
EnumerableMapAddresses_contains:testBytes32ContainsSuccess() (gas: 93518)
EnumerableMapAddresses_contains:testContainsSuccess() (gas: 93696)
EnumerableMapAddresses_get:testBytes32GetSuccess() (gas: 94249)
EnumerableMapAddresses_get:testGetSuccess() (gas: 94436)
EnumerableMapAddresses_get_errorMessage:testGetErrorMessageSuccess() (gas: 94477)
EnumerableMapAddresses_length:testBytes32LengthSuccess() (gas: 72404)
EnumerableMapAddresses_length:testLengthSuccess() (gas: 72582)
EnumerableMapAddresses_remove:testBytes32RemoveSuccess() (gas: 73408)
EnumerableMapAddresses_remove:testRemoveSuccess() (gas: 73686)
EnumerableMapAddresses_set:testBytes32SetSuccess() (gas: 94496)
EnumerableMapAddresses_set:testSetSuccess() (gas: 94685)
EnumerableMapAddresses_tryGet:testBytes32TryGetSuccess() (gas: 94604)
EnumerableMapAddresses_tryGet:testTryGetSuccess() (gas: 94864)
OpStackBurnMintERC677_constructor:testConstructorSuccess() (gas: 1743649)
OpStackBurnMintERC677_interfaceCompatibility:testBurnCompatibility() (gas: 298649)
OpStackBurnMintERC677_interfaceCompatibility:testMintCompatibility() (gas: 137957)
Expand Down
Loading

0 comments on commit c36cd86

Please sign in to comment.