diff --git a/contracts/gas-snapshots/ccip.gas-snapshot b/contracts/gas-snapshots/ccip.gas-snapshot index b2f97021c8..0b1af96d31 100644 --- a/contracts/gas-snapshots/ccip.gas-snapshot +++ b/contracts/gas-snapshots/ccip.gas-snapshot @@ -516,29 +516,29 @@ MultiOCR3Base_transmit:test_UnauthorizedSigner_Revert() (gas: 69917) MultiOCR3Base_transmit:test_UnconfiguredPlugin_Revert() (gas: 42537) MultiOCR3Base_transmit:test_ZeroSignatures_Revert() (gas: 37478) MultiOnRampTokenPoolReentrancy:test_OnRampTokenPoolReentrancy_Success() (gas: 304699) -MultiRampsE2E:test_E2E_3MessagesMMultiOffRampSuccess_gas() (gas: 1926302) -NonceManager_NonceIncrementation:test_getIncrementedOutboundNonce_Success() (gas: 40448) -NonceManager_NonceIncrementation:test_incrementInboundNonce_Skip() (gas: 27403) -NonceManager_NonceIncrementation:test_incrementInboundNonce_Success() (gas: 41879) -NonceManager_NonceIncrementation:test_incrementNoncesInboundAndOutbound_Success() (gas: 79874) -NonceManager_OffRampUpgrade:test_NoPrevOffRampForChain_Success() (gas: 316259) -NonceManager_OffRampUpgrade:test_UpgradedNonceNewSenderStartsAtZero_Success() (gas: 322432) -NonceManager_OffRampUpgrade:test_UpgradedNonceStartsAtV1Nonce_Success() (gas: 417132) -NonceManager_OffRampUpgrade:test_UpgradedOffRampNonceSkipsIfMsgInFlight_Success() (gas: 375380) -NonceManager_OffRampUpgrade:test_UpgradedSenderNoncesReadsPreviousRampTransitive_Success() (gas: 327638) -NonceManager_OffRampUpgrade:test_UpgradedSenderNoncesReadsPreviousRamp_Success() (gas: 313211) -NonceManager_OffRampUpgrade:test_Upgraded_Success() (gas: 183405) -NonceManager_OnRampUpgrade:test_UpgradeNonceNewSenderStartsAtZero_Success() (gas: 193460) -NonceManager_OnRampUpgrade:test_UpgradeNonceStartsAtV1Nonce_Success() (gas: 268061) -NonceManager_OnRampUpgrade:test_UpgradeSenderNoncesReadsPreviousRamp_Success() (gas: 153619) -NonceManager_OnRampUpgrade:test_Upgrade_Success() (gas: 125710) -NonceManager_applyPreviousRampsUpdates:test_MultipleRampsUpdates() (gas: 134448) -NonceManager_applyPreviousRampsUpdates:test_PreviousRampAlreadySetOffRamp_Revert() (gas: 47118) -NonceManager_applyPreviousRampsUpdates:test_PreviousRampAlreadySetOnRampAndOffRamp_Revert() (gas: 69128) -NonceManager_applyPreviousRampsUpdates:test_PreviousRampAlreadySetOnRamp_Revert() (gas: 46949) -NonceManager_applyPreviousRampsUpdates:test_SingleRampUpdate() (gas: 72431) -NonceManager_applyPreviousRampsUpdates:test_ZeroInput() (gas: 12892) -NonceManager_typeAndVersion:test_typeAndVersion() (gas: 10623) +MultiRampsE2E:test_E2E_3MessagesMMultiOffRampSuccess_gas() (gas: 1504663) +NonceManager_NonceIncrementation:test_getIncrementedOutboundNonce_Success() (gas: 37934) +NonceManager_NonceIncrementation:test_incrementInboundNonce_Skip() (gas: 23706) +NonceManager_NonceIncrementation:test_incrementInboundNonce_Success() (gas: 38778) +NonceManager_NonceIncrementation:test_incrementNoncesInboundAndOutbound_Success() (gas: 71901) +NonceManager_OffRampUpgrade:test_NoPrevOffRampForChain_Success() (gas: 262159) +NonceManager_OffRampUpgrade:test_UpgradedNonceNewSenderStartsAtZero_Success() (gas: 265836) +NonceManager_OffRampUpgrade:test_UpgradedNonceStartsAtV1Nonce_Success() (gas: 329824) +NonceManager_OffRampUpgrade:test_UpgradedOffRampNonceSkipsIfMsgInFlight_Success() (gas: 300784) +NonceManager_OffRampUpgrade:test_UpgradedSenderNoncesReadsPreviousRampTransitive_Success() (gas: 249120) +NonceManager_OffRampUpgrade:test_UpgradedSenderNoncesReadsPreviousRamp_Success() (gas: 237027) +NonceManager_OffRampUpgrade:test_Upgraded_Success() (gas: 153748) +NonceManager_OnRampUpgrade:test_UpgradeNonceNewSenderStartsAtZero_Success() (gas: 168959) +NonceManager_OnRampUpgrade:test_UpgradeNonceStartsAtV1Nonce_Success() (gas: 221148) +NonceManager_OnRampUpgrade:test_UpgradeSenderNoncesReadsPreviousRamp_Success() (gas: 126861) +NonceManager_OnRampUpgrade:test_Upgrade_Success() (gas: 107723) +NonceManager_applyPreviousRampsUpdates:test_MultipleRampsUpdates() (gas: 123207) +NonceManager_applyPreviousRampsUpdates:test_PreviousRampAlreadySetOffRamp_Revert() (gas: 43079) +NonceManager_applyPreviousRampsUpdates:test_PreviousRampAlreadySetOnRampAndOffRamp_Revert() (gas: 64408) +NonceManager_applyPreviousRampsUpdates:test_PreviousRampAlreadySetOnRamp_Revert() (gas: 42943) +NonceManager_applyPreviousRampsUpdates:test_SingleRampUpdate() (gas: 66696) +NonceManager_applyPreviousRampsUpdates:test_ZeroInput() (gas: 12070) +NonceManager_typeAndVersion:test_typeAndVersion() (gas: 9705) OCR2BaseNoChecks_setOCR2Config:test_FMustBePositive_Revert() (gas: 15443) OCR2BaseNoChecks_setOCR2Config:test_RepeatAddress_Revert() (gas: 48841) OCR2BaseNoChecks_setOCR2Config:test_SetConfigSuccess_gas() (gas: 97138) @@ -564,140 +564,140 @@ OCR2Base_transmit:test_Transmit2SignersSuccess_gas() (gas: 58490) OCR2Base_transmit:test_UnAuthorizedTransmitter_Revert() (gas: 27448) OCR2Base_transmit:test_UnauthorizedSigner_Revert() (gas: 45597) OCR2Base_transmit:test_WrongNumberOfSignatures_Revert() (gas: 23593) -OffRamp_afterOC3ConfigSet:test_afterOCR3ConfigSet_SignatureVerificationDisabled_Revert() (gas: 8902529) -OffRamp_applySourceChainConfigUpdates:test_AddMultipleChains_Success() (gas: 495132) -OffRamp_applySourceChainConfigUpdates:test_AddNewChain_Success() (gas: 107802) -OffRamp_applySourceChainConfigUpdates:test_ApplyZeroUpdates_Success() (gas: 13418) -OffRamp_applySourceChainConfigUpdates:test_InvalidOnRampUpdate_Revert() (gas: 231022) -OffRamp_applySourceChainConfigUpdates:test_ReplaceExistingChainOnRamp_Success() (gas: 110522) -OffRamp_applySourceChainConfigUpdates:test_ReplaceExistingChain_Success() (gas: 124535) -OffRamp_applySourceChainConfigUpdates:test_RouterAddress_Revert() (gas: 15757) -OffRamp_applySourceChainConfigUpdates:test_ZeroOnRampAddress_Revert() (gas: 77820) -OffRamp_applySourceChainConfigUpdates:test_ZeroSourceChainSelector_Revert() (gas: 17894) -OffRamp_batchExecute:test_MultipleReportsDifferentChainsSkipCursedChain_Success() (gas: 224083) -OffRamp_batchExecute:test_MultipleReportsDifferentChains_Success() (gas: 425996) -OffRamp_batchExecute:test_MultipleReportsSameChain_Success() (gas: 368952) -OffRamp_batchExecute:test_MultipleReportsSkipDuplicate_Success() (gas: 208104) -OffRamp_batchExecute:test_OutOfBoundsGasLimitsAccess_Revert() (gas: 239311) -OffRamp_batchExecute:test_SingleReport_Success() (gas: 188653) -OffRamp_batchExecute:test_Unhealthy_Success() (gas: 717329) -OffRamp_batchExecute:test_ZeroReports_Revert() (gas: 12088) -OffRamp_ccipReceive:test_Reverts() (gas: 18753) -OffRamp_commit:test_CommitOnRampMismatch_Revert() (gas: 109720) -OffRamp_commit:test_FailedRMNVerification_Reverts() (gas: 77314) -OffRamp_commit:test_InvalidIntervalMinLargerThanMax_Revert() (gas: 83071) -OffRamp_commit:test_InvalidInterval_Revert() (gas: 77116) -OffRamp_commit:test_InvalidRootRevert() (gas: 75631) -OffRamp_commit:test_NoConfigWithOtherConfigPresent_Revert() (gas: 9548401) -OffRamp_commit:test_NoConfig_Revert() (gas: 9122532) -OffRamp_commit:test_OnlyGasPriceUpdates_Success() (gas: 130728) -OffRamp_commit:test_OnlyPriceUpdateStaleReport_Revert() (gas: 147353) -OffRamp_commit:test_OnlyTokenPriceUpdates_Success() (gas: 130749) -OffRamp_commit:test_PriceSequenceNumberCleared_Success() (gas: 424203) -OffRamp_commit:test_ReportAndPriceUpdate_Success() (gas: 190103) -OffRamp_commit:test_ReportOnlyRootSuccess_gas() (gas: 161941) -OffRamp_commit:test_RootAlreadyCommitted_Revert() (gas: 176263) -OffRamp_commit:test_SourceChainNotEnabled_Revert() (gas: 72480) -OffRamp_commit:test_StaleReportWithRoot_Success() (gas: 280739) -OffRamp_commit:test_UnauthorizedTransmitter_Revert() (gas: 144515) -OffRamp_commit:test_Unhealthy_Revert() (gas: 71728) -OffRamp_commit:test_ValidPriceUpdateThenStaleReportWithRoot_Success() (gas: 250379) -OffRamp_commit:test_ZeroEpochAndRound_Revert() (gas: 61202) -OffRamp_constructor:test_Constructor_Success() (gas: 9121263) -OffRamp_constructor:test_SourceChainSelector_Revert() (gas: 148706) -OffRamp_constructor:test_ZeroChainSelector_Revert() (gas: 112646) -OffRamp_constructor:test_ZeroNonceManager_Revert() (gas: 110448) -OffRamp_constructor:test_ZeroOnRampAddress_Revert() (gas: 174260) -OffRamp_constructor:test_ZeroRMNRemote_Revert() (gas: 110450) -OffRamp_constructor:test_ZeroTokenAdminRegistry_Revert() (gas: 110395) -OffRamp_execute:test_IncorrectArrayType_Revert() (gas: 19670) -OffRamp_execute:test_LargeBatch_Success() (gas: 4789035) -OffRamp_execute:test_MultipleReportsWithPartialValidationFailures_Success() (gas: 462387) -OffRamp_execute:test_MultipleReports_Success() (gas: 392392) -OffRamp_execute:test_NoConfigWithOtherConfigPresent_Revert() (gas: 9972739) -OffRamp_execute:test_NoConfig_Revert() (gas: 9179658) -OffRamp_execute:test_NonArray_Revert() (gas: 34048) -OffRamp_execute:test_SingleReport_Success() (gas: 209314) -OffRamp_execute:test_UnauthorizedTransmitter_Revert() (gas: 173200) -OffRamp_execute:test_WrongConfigWithSigners_Revert() (gas: 9980482) -OffRamp_execute:test_ZeroReports_Revert() (gas: 19285) -OffRamp_executeSingleMessage:test_MessageSender_Revert() (gas: 23977) -OffRamp_executeSingleMessage:test_NonContractWithTokens_Success() (gas: 277738) -OffRamp_executeSingleMessage:test_NonContract_Success() (gas: 26476) -OffRamp_executeSingleMessage:test_TokenHandlingError_Revert() (gas: 236582) -OffRamp_executeSingleMessage:test_ZeroGasDONExecution_Revert() (gas: 60990) -OffRamp_executeSingleMessage:test_executeSingleMessage_NoTokens_Success() (gas: 60132) -OffRamp_executeSingleMessage:test_executeSingleMessage_WithFailingValidationNoRouterCall_Revert() (gas: 267137) -OffRamp_executeSingleMessage:test_executeSingleMessage_WithFailingValidation_Revert() (gas: 98126) -OffRamp_executeSingleMessage:test_executeSingleMessage_WithTokens_Success() (gas: 320798) -OffRamp_executeSingleMessage:test_executeSingleMessage_WithVInterception_Success() (gas: 108714) -OffRamp_executeSingleReport:test_DisabledSourceChain_Revert() (gas: 36766) -OffRamp_executeSingleReport:test_EmptyReport_Revert() (gas: 24545) -OffRamp_executeSingleReport:test_InvalidSourcePoolAddress_Success() (gas: 595814) -OffRamp_executeSingleReport:test_ManualExecutionNotYetEnabled_Revert() (gas: 60468) -OffRamp_executeSingleReport:test_MismatchingDestChainSelector_Revert() (gas: 42455) -OffRamp_executeSingleReport:test_NonExistingSourceChain_Revert() (gas: 37212) -OffRamp_executeSingleReport:test_ReceiverError_Success() (gas: 221890) -OffRamp_executeSingleReport:test_RetryFailedMessageWithoutManualExecution_Revert() (gas: 237935) -OffRamp_executeSingleReport:test_RootNotCommitted_Revert() (gas: 52346) -OffRamp_executeSingleReport:test_RouterYULCall_Revert() (gas: 625018) -OffRamp_executeSingleReport:test_SingleMessageNoTokensOtherChain_Success() (gas: 297913) -OffRamp_executeSingleReport:test_SingleMessageNoTokensUnordered_Success() (gas: 252901) -OffRamp_executeSingleReport:test_SingleMessageNoTokens_Success() (gas: 271928) -OffRamp_executeSingleReport:test_SingleMessageToNonCCIPReceiver_Success() (gas: 307332) -OffRamp_executeSingleReport:test_SingleMessagesNoTokensSuccess_gas() (gas: 168258) -OffRamp_executeSingleReport:test_SkippedIncorrectNonceStillExecutes_Success() (gas: 502204) -OffRamp_executeSingleReport:test_SkippedIncorrectNonce_Success() (gas: 71999) -OffRamp_executeSingleReport:test_TokenDataMismatch_Revert() (gas: 86531) -OffRamp_executeSingleReport:test_TwoMessagesWithTokensAndGE_Success() (gas: 733681) -OffRamp_executeSingleReport:test_TwoMessagesWithTokensSuccess_gas() (gas: 666498) -OffRamp_executeSingleReport:test_UnexpectedTokenData_Revert() (gas: 42450) -OffRamp_executeSingleReport:test_UnhealthySingleChainCurse_Revert() (gas: 710720) -OffRamp_executeSingleReport:test_Unhealthy_Success() (gas: 710723) -OffRamp_executeSingleReport:test_WithCurseOnAnotherSourceChain_Success() (gas: 574134) -OffRamp_executeSingleReport:test__execute_SkippedAlreadyExecutedMessageUnordered_Success() (gas: 172776) -OffRamp_executeSingleReport:test__execute_SkippedAlreadyExecutedMessage_Success() (gas: 202237) -OffRamp_getExecutionState:test_FillExecutionState_Success() (gas: 5703276) -OffRamp_getExecutionState:test_GetDifferentChainExecutionState_Success() (gas: 148004) -OffRamp_getExecutionState:test_GetExecutionState_Success() (gas: 111520) -OffRamp_manuallyExecute:test_ManualExecGasLimitMismatchSingleReport_Revert() (gas: 128026) -OffRamp_manuallyExecute:test_manuallyExecute_DestinationGasAmountCountMismatch_Revert() (gas: 103971) -OffRamp_manuallyExecute:test_manuallyExecute_DoesNotRevertIfUntouched_Success() (gas: 208382) -OffRamp_manuallyExecute:test_manuallyExecute_FailedTx_Revert() (gas: 261275) -OffRamp_manuallyExecute:test_manuallyExecute_ForkedChain_Revert() (gas: 37688) -OffRamp_manuallyExecute:test_manuallyExecute_GasLimitMismatchMultipleReports_Revert() (gas: 267627) -OffRamp_manuallyExecute:test_manuallyExecute_InvalidReceiverExecutionGasLimit_Revert() (gas: 38216) -OffRamp_manuallyExecute:test_manuallyExecute_InvalidTokenGasOverride_Revert() (gas: 73056) -OffRamp_manuallyExecute:test_manuallyExecute_LowGasLimit_Success() (gas: 742494) -OffRamp_manuallyExecute:test_manuallyExecute_MultipleReportsWithSingleCursedLane_Revert() (gas: 408960) -OffRamp_manuallyExecute:test_manuallyExecute_ReentrancyFails_Success() (gas: 3574005) -OffRamp_manuallyExecute:test_manuallyExecute_SourceChainSelectorMismatch_Revert() (gas: 199720) -OffRamp_manuallyExecute:test_manuallyExecute_Success() (gas: 279997) -OffRamp_manuallyExecute:test_manuallyExecute_WithGasOverride_Success() (gas: 280693) -OffRamp_manuallyExecute:test_manuallyExecute_WithMultiReportGasOverride_Success() (gas: 1033763) -OffRamp_manuallyExecute:test_manuallyExecute_WithPartialMessages_Success() (gas: 461923) -OffRamp_releaseOrMintSingleToken:test__releaseOrMintSingleToken_NotACompatiblePool_Revert() (gas: 47648) -OffRamp_releaseOrMintSingleToken:test__releaseOrMintSingleToken_Success() (gas: 121919) -OffRamp_releaseOrMintSingleToken:test__releaseOrMintSingleToken_TokenHandlingError_transfer_Revert() (gas: 99377) -OffRamp_releaseOrMintSingleToken:test_releaseOrMintToken_InvalidDataLength_Revert() (gas: 44074) -OffRamp_releaseOrMintSingleToken:test_releaseOrMintToken_ReleaseOrMintBalanceMismatch_Revert() (gas: 109868) -OffRamp_releaseOrMintSingleToken:test_releaseOrMintToken_TokenHandlingError_BalanceOf_Revert() (gas: 46405) -OffRamp_releaseOrMintSingleToken:test_releaseOrMintToken_skip_ReleaseOrMintBalanceMismatch_if_pool_Revert() (gas: 101128) -OffRamp_releaseOrMintTokens:test_TokenHandlingError_Reverts() (gas: 187037) -OffRamp_releaseOrMintTokens:test__releaseOrMintTokens_PoolIsNotAPool_Reverts() (gas: 28901) -OffRamp_releaseOrMintTokens:test_releaseOrMintTokens_InvalidDataLengthReturnData_Revert() (gas: 74851) -OffRamp_releaseOrMintTokens:test_releaseOrMintTokens_PoolDoesNotSupportDest_Reverts() (gas: 94066) -OffRamp_releaseOrMintTokens:test_releaseOrMintTokens_Success() (gas: 206891) -OffRamp_releaseOrMintTokens:test_releaseOrMintTokens_WithGasOverride_Success() (gas: 209712) -OffRamp_releaseOrMintTokens:test_releaseOrMintTokens_destDenominatedDecimals_Success() (gas: 217613) -OffRamp_setDynamicConfig:test_FeeQuoterZeroAddress_Revert() (gas: 12524) -OffRamp_setDynamicConfig:test_NonOwner_Revert() (gas: 15529) -OffRamp_setDynamicConfig:test_SetDynamicConfigWithInterceptor_Success() (gas: 50816) -OffRamp_setDynamicConfig:test_SetDynamicConfig_Success() (gas: 28782) -OffRamp_trialExecute:test_RateLimitError_Success() (gas: 259624) -OffRamp_trialExecute:test_TokenHandlingErrorIsCaught_Success() (gas: 269734) -OffRamp_trialExecute:test_TokenPoolIsNotAContract_Success() (gas: 386633) -OffRamp_trialExecute:test_trialExecute_Success() (gas: 329701) +OffRamp_afterOC3ConfigSet:test_afterOCR3ConfigSet_SignatureVerificationDisabled_Revert() (gas: 5656596) +OffRamp_applySourceChainConfigUpdates:test_AddMultipleChains_Success() (gas: 469391) +OffRamp_applySourceChainConfigUpdates:test_AddNewChain_Success() (gas: 99637) +OffRamp_applySourceChainConfigUpdates:test_ApplyZeroUpdates_Success() (gas: 12591) +OffRamp_applySourceChainConfigUpdates:test_InvalidOnRampUpdate_Revert() (gas: 205322) +OffRamp_applySourceChainConfigUpdates:test_ReplaceExistingChainOnRamp_Success() (gas: 101437) +OffRamp_applySourceChainConfigUpdates:test_ReplaceExistingChain_Success() (gas: 111307) +OffRamp_applySourceChainConfigUpdates:test_RouterAddress_Revert() (gas: 13441) +OffRamp_applySourceChainConfigUpdates:test_ZeroOnRampAddress_Revert() (gas: 72702) +OffRamp_applySourceChainConfigUpdates:test_ZeroSourceChainSelector_Revert() (gas: 15497) +OffRamp_batchExecute:test_MultipleReportsDifferentChainsSkipCursedChain_Success() (gas: 177979) +OffRamp_batchExecute:test_MultipleReportsDifferentChains_Success() (gas: 335646) +OffRamp_batchExecute:test_MultipleReportsSameChain_Success() (gas: 278912) +OffRamp_batchExecute:test_MultipleReportsSkipDuplicate_Success() (gas: 169308) +OffRamp_batchExecute:test_OutOfBoundsGasLimitsAccess_Revert() (gas: 189031) +OffRamp_batchExecute:test_SingleReport_Success() (gas: 157132) +OffRamp_batchExecute:test_Unhealthy_Success() (gas: 554208) +OffRamp_batchExecute:test_ZeroReports_Revert() (gas: 10600) +OffRamp_ccipReceive:test_Reverts() (gas: 15385) +OffRamp_commit:test_CommitOnRampMismatch_Revert() (gas: 92905) +OffRamp_commit:test_FailedRMNVerification_Reverts() (gas: 64099) +OffRamp_commit:test_InvalidIntervalMinLargerThanMax_Revert() (gas: 68124) +OffRamp_commit:test_InvalidInterval_Revert() (gas: 64291) +OffRamp_commit:test_InvalidRootRevert() (gas: 63356) +OffRamp_commit:test_NoConfigWithOtherConfigPresent_Revert() (gas: 6260756) +OffRamp_commit:test_NoConfig_Revert() (gas: 5844428) +OffRamp_commit:test_OnlyGasPriceUpdates_Success() (gas: 113042) +OffRamp_commit:test_OnlyPriceUpdateStaleReport_Revert() (gas: 121403) +OffRamp_commit:test_OnlyTokenPriceUpdates_Success() (gas: 113063) +OffRamp_commit:test_PriceSequenceNumberCleared_Success() (gas: 355198) +OffRamp_commit:test_ReportAndPriceUpdate_Success() (gas: 164351) +OffRamp_commit:test_ReportOnlyRootSuccess_gas() (gas: 139364) +OffRamp_commit:test_RootAlreadyCommitted_Revert() (gas: 146555) +OffRamp_commit:test_SourceChainNotEnabled_Revert() (gas: 59858) +OffRamp_commit:test_StaleReportWithRoot_Success() (gas: 232074) +OffRamp_commit:test_UnauthorizedTransmitter_Revert() (gas: 125409) +OffRamp_commit:test_Unhealthy_Revert() (gas: 58633) +OffRamp_commit:test_ValidPriceUpdateThenStaleReportWithRoot_Success() (gas: 206729) +OffRamp_commit:test_ZeroEpochAndRound_Revert() (gas: 51722) +OffRamp_constructor:test_Constructor_Success() (gas: 5845416) +OffRamp_constructor:test_SourceChainSelector_Revert() (gas: 135514) +OffRamp_constructor:test_ZeroChainSelector_Revert() (gas: 102949) +OffRamp_constructor:test_ZeroNonceManager_Revert() (gas: 100843) +OffRamp_constructor:test_ZeroOnRampAddress_Revert() (gas: 161040) +OffRamp_constructor:test_ZeroRMNRemote_Revert() (gas: 100763) +OffRamp_constructor:test_ZeroTokenAdminRegistry_Revert() (gas: 100801) +OffRamp_execute:test_IncorrectArrayType_Revert() (gas: 17639) +OffRamp_execute:test_LargeBatch_Success() (gas: 3426635) +OffRamp_execute:test_MultipleReportsWithPartialValidationFailures_Success() (gas: 373095) +OffRamp_execute:test_MultipleReports_Success() (gas: 301009) +OffRamp_execute:test_NoConfigWithOtherConfigPresent_Revert() (gas: 6669661) +OffRamp_execute:test_NoConfig_Revert() (gas: 5894136) +OffRamp_execute:test_NonArray_Revert() (gas: 27562) +OffRamp_execute:test_SingleReport_Success() (gas: 176364) +OffRamp_execute:test_UnauthorizedTransmitter_Revert() (gas: 148382) +OffRamp_execute:test_WrongConfigWithSigners_Revert() (gas: 6672410) +OffRamp_execute:test_ZeroReports_Revert() (gas: 17361) +OffRamp_executeSingleMessage:test_MessageSender_Revert() (gas: 18511) +OffRamp_executeSingleMessage:test_NonContractWithTokens_Success() (gas: 244057) +OffRamp_executeSingleMessage:test_NonContract_Success() (gas: 20759) +OffRamp_executeSingleMessage:test_TokenHandlingError_Revert() (gas: 205094) +OffRamp_executeSingleMessage:test_ZeroGasDONExecution_Revert() (gas: 49316) +OffRamp_executeSingleMessage:test_executeSingleMessage_NoTokens_Success() (gas: 48760) +OffRamp_executeSingleMessage:test_executeSingleMessage_WithFailingValidationNoRouterCall_Revert() (gas: 218081) +OffRamp_executeSingleMessage:test_executeSingleMessage_WithFailingValidation_Revert() (gas: 85349) +OffRamp_executeSingleMessage:test_executeSingleMessage_WithTokens_Success() (gas: 274194) +OffRamp_executeSingleMessage:test_executeSingleMessage_WithVInterception_Success() (gas: 91809) +OffRamp_executeSingleReport:test_DisabledSourceChain_Revert() (gas: 28260) +OffRamp_executeSingleReport:test_EmptyReport_Revert() (gas: 22062) +OffRamp_executeSingleReport:test_InvalidSourcePoolAddress_Success() (gas: 481748) +OffRamp_executeSingleReport:test_ManualExecutionNotYetEnabled_Revert() (gas: 48372) +OffRamp_executeSingleReport:test_MismatchingDestChainSelector_Revert() (gas: 33959) +OffRamp_executeSingleReport:test_NonExistingSourceChain_Revert() (gas: 28436) +OffRamp_executeSingleReport:test_ReceiverError_Success() (gas: 188084) +OffRamp_executeSingleReport:test_RetryFailedMessageWithoutManualExecution_Revert() (gas: 198518) +OffRamp_executeSingleReport:test_RootNotCommitted_Revert() (gas: 40741) +OffRamp_executeSingleReport:test_RouterYULCall_Revert() (gas: 413233) +OffRamp_executeSingleReport:test_SingleMessageNoTokensOtherChain_Success() (gas: 249776) +OffRamp_executeSingleReport:test_SingleMessageNoTokensUnordered_Success() (gas: 193590) +OffRamp_executeSingleReport:test_SingleMessageNoTokens_Success() (gas: 213624) +OffRamp_executeSingleReport:test_SingleMessageToNonCCIPReceiver_Success() (gas: 249506) +OffRamp_executeSingleReport:test_SingleMessagesNoTokensSuccess_gas() (gas: 142151) +OffRamp_executeSingleReport:test_SkippedIncorrectNonceStillExecutes_Success() (gas: 409289) +OffRamp_executeSingleReport:test_SkippedIncorrectNonce_Success() (gas: 58293) +OffRamp_executeSingleReport:test_TokenDataMismatch_Revert() (gas: 73868) +OffRamp_executeSingleReport:test_TwoMessagesWithTokensAndGE_Success() (gas: 583401) +OffRamp_executeSingleReport:test_TwoMessagesWithTokensSuccess_gas() (gas: 532115) +OffRamp_executeSingleReport:test_UnexpectedTokenData_Revert() (gas: 33717) +OffRamp_executeSingleReport:test_UnhealthySingleChainCurse_Revert() (gas: 549738) +OffRamp_executeSingleReport:test_Unhealthy_Success() (gas: 549752) +OffRamp_executeSingleReport:test_WithCurseOnAnotherSourceChain_Success() (gas: 460495) +OffRamp_executeSingleReport:test__execute_SkippedAlreadyExecutedMessageUnordered_Success() (gas: 135910) +OffRamp_executeSingleReport:test__execute_SkippedAlreadyExecutedMessage_Success() (gas: 165615) +OffRamp_getExecutionState:test_FillExecutionState_Success() (gas: 3868658) +OffRamp_getExecutionState:test_GetDifferentChainExecutionState_Success() (gas: 120474) +OffRamp_getExecutionState:test_GetExecutionState_Success() (gas: 89178) +OffRamp_manuallyExecute:test_ManualExecGasLimitMismatchSingleReport_Revert() (gas: 81284) +OffRamp_manuallyExecute:test_manuallyExecute_DestinationGasAmountCountMismatch_Revert() (gas: 74161) +OffRamp_manuallyExecute:test_manuallyExecute_DoesNotRevertIfUntouched_Success() (gas: 173244) +OffRamp_manuallyExecute:test_manuallyExecute_FailedTx_Revert() (gas: 214189) +OffRamp_manuallyExecute:test_manuallyExecute_ForkedChain_Revert() (gas: 27152) +OffRamp_manuallyExecute:test_manuallyExecute_GasLimitMismatchMultipleReports_Revert() (gas: 165098) +OffRamp_manuallyExecute:test_manuallyExecute_InvalidReceiverExecutionGasLimit_Revert() (gas: 27689) +OffRamp_manuallyExecute:test_manuallyExecute_InvalidTokenGasOverride_Revert() (gas: 55260) +OffRamp_manuallyExecute:test_manuallyExecute_LowGasLimit_Success() (gas: 498614) +OffRamp_manuallyExecute:test_manuallyExecute_MultipleReportsWithSingleCursedLane_Revert() (gas: 316158) +OffRamp_manuallyExecute:test_manuallyExecute_ReentrancyFails_Success() (gas: 2245360) +OffRamp_manuallyExecute:test_manuallyExecute_SourceChainSelectorMismatch_Revert() (gas: 165602) +OffRamp_manuallyExecute:test_manuallyExecute_Success() (gas: 227234) +OffRamp_manuallyExecute:test_manuallyExecute_WithGasOverride_Success() (gas: 227774) +OffRamp_manuallyExecute:test_manuallyExecute_WithMultiReportGasOverride_Success() (gas: 781510) +OffRamp_manuallyExecute:test_manuallyExecute_WithPartialMessages_Success() (gas: 347431) +OffRamp_releaseOrMintSingleToken:test__releaseOrMintSingleToken_NotACompatiblePool_Revert() (gas: 37634) +OffRamp_releaseOrMintSingleToken:test__releaseOrMintSingleToken_Success() (gas: 104404) +OffRamp_releaseOrMintSingleToken:test__releaseOrMintSingleToken_TokenHandlingError_transfer_Revert() (gas: 85342) +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_skip_ReleaseOrMintBalanceMismatch_if_pool_Revert() (gas: 86516) +OffRamp_releaseOrMintTokens:test_TokenHandlingError_Reverts() (gas: 162381) +OffRamp_releaseOrMintTokens:test__releaseOrMintTokens_PoolIsNotAPool_Reverts() (gas: 23903) +OffRamp_releaseOrMintTokens:test_releaseOrMintTokens_InvalidDataLengthReturnData_Revert() (gas: 62751) +OffRamp_releaseOrMintTokens:test_releaseOrMintTokens_PoolDoesNotSupportDest_Reverts() (gas: 79790) +OffRamp_releaseOrMintTokens:test_releaseOrMintTokens_Success() (gas: 174512) +OffRamp_releaseOrMintTokens:test_releaseOrMintTokens_WithGasOverride_Success() (gas: 176424) +OffRamp_releaseOrMintTokens:test_releaseOrMintTokens_destDenominatedDecimals_Success() (gas: 187723) +OffRamp_setDynamicConfig:test_FeeQuoterZeroAddress_Revert() (gas: 11269) +OffRamp_setDynamicConfig:test_NonOwner_Revert() (gas: 13884) +OffRamp_setDynamicConfig:test_SetDynamicConfigWithInterceptor_Success() (gas: 46421) +OffRamp_setDynamicConfig:test_SetDynamicConfig_Success() (gas: 24463) +OffRamp_trialExecute:test_RateLimitError_Success() (gas: 219355) +OffRamp_trialExecute:test_TokenHandlingErrorIsCaught_Success() (gas: 227977) +OffRamp_trialExecute:test_TokenPoolIsNotAContract_Success() (gas: 295350) +OffRamp_trialExecute:test_trialExecute_Success() (gas: 277894) OnRampTokenPoolReentrancy:test_OnRampTokenPoolReentrancy_Success() (gas: 508639) OnRamp_applyAllowListUpdates:test_applyAllowListUpdates_InvalidAllowListRequestDisabledAllowListWithAdds() (gas: 21134) OnRamp_applyAllowListUpdates:test_applyAllowListUpdates_Revert() (gas: 80371) @@ -752,23 +752,23 @@ PingPong_plumbing:test_OutOfOrderExecution_Success() (gas: 21848) PingPong_plumbing:test_Pausing_Success() (gas: 19077) PingPong_startPingPong:test_StartPingPong_With_OOO_Success() (gas: 197173) PingPong_startPingPong:test_StartPingPong_With_Sequenced_Ordered_Success() (gas: 215989) -RMNHome_promoteSecondaryAndRevokePrimary:test_promoteSecondaryAndRevokePrimary_OnlyOwner_reverts() (gas: 10913) -RMNHome_promoteSecondaryAndRevokePrimary:test_promoteSecondaryAndRevokePrimary_success() (gas: 209) -RMNHome_revokeSecondary:test_revokeSecondary_ConfigDigestMismatch_reverts() (gas: 19032) -RMNHome_revokeSecondary:test_revokeSecondary_OnlyOwner_reverts() (gas: 10988) -RMNHome_revokeSecondary:test_revokeSecondary_success() (gas: 28209) -RMNHome_setDynamicConfig:test_setDynamicConfig_DigestNotFound_reverts() (gas: 30203) -RMNHome_setDynamicConfig:test_setDynamicConfig_MinObserversTooHigh_reverts() (gas: 18870) -RMNHome_setDynamicConfig:test_setDynamicConfig_OnlyOwner_reverts() (gas: 14137) -RMNHome_setDynamicConfig:test_setDynamicConfig_success() (gas: 104105) -RMNHome_setSecondary:test_setSecondary_DuplicateOffchainPublicKey_reverts() (gas: 18936) -RMNHome_setSecondary:test_setSecondary_DuplicatePeerId_reverts() (gas: 18730) -RMNHome_setSecondary:test_setSecondary_DuplicateSourceChain_reverts() (gas: 20418) -RMNHome_setSecondary:test_setSecondary_MinObserversTooHigh_reverts() (gas: 20857) -RMNHome_setSecondary:test_setSecondary_OnlyOwner_reverts() (gas: 15276) -RMNHome_setSecondary:test_setSecondary_OutOfBoundsNodesLength_reverts() (gas: 137337) -RMNHome_setSecondary:test_setSecondary_OutOfBoundsObserverNodeIndex_reverts() (gas: 20562) -RMNHome_setSecondary:test_setSecondary_success() (gas: 588484) +RMNHome_promoteCandidateAndRevokeActive:test_promoteCandidateAndRevokeActive_OnlyOwner_reverts() (gas: 10979) +RMNHome_promoteCandidateAndRevokeActive:test_promoteCandidateAndRevokeActive_success() (gas: 164) +RMNHome_revokeCandidate:test_revokeCandidate_ConfigDigestMismatch_reverts() (gas: 19073) +RMNHome_revokeCandidate:test_revokeCandidate_OnlyOwner_reverts() (gas: 10984) +RMNHome_revokeCandidate:test_revokeCandidate_success() (gas: 28184) +RMNHome_setCandidate:test_setCandidate_DuplicateOffchainPublicKey_reverts() (gas: 18871) +RMNHome_setCandidate:test_setCandidate_DuplicatePeerId_reverts() (gas: 18687) +RMNHome_setCandidate:test_setCandidate_DuplicateSourceChain_reverts() (gas: 20408) +RMNHome_setCandidate:test_setCandidate_MinObserversTooHigh_reverts() (gas: 20805) +RMNHome_setCandidate:test_setCandidate_OnlyOwner_reverts() (gas: 15233) +RMNHome_setCandidate:test_setCandidate_OutOfBoundsNodesLength_reverts() (gas: 137295) +RMNHome_setCandidate:test_setCandidate_OutOfBoundsObserverNodeIndex_reverts() (gas: 20521) +RMNHome_setCandidate:test_setCandidate_success() (gas: 588408) +RMNHome_setDynamicConfig:test_setDynamicConfig_DigestNotFound_reverts() (gas: 30159) +RMNHome_setDynamicConfig:test_setDynamicConfig_MinObserversTooHigh_reverts() (gas: 18848) +RMNHome_setDynamicConfig:test_setDynamicConfig_OnlyOwner_reverts() (gas: 14115) +RMNHome_setDynamicConfig:test_setDynamicConfig_success() (gas: 103992) RMNRemote_constructor:test_constructor_success() (gas: 8853) RMNRemote_constructor:test_constructor_zeroChainSelector_reverts() (gas: 61072) RMNRemote_curse:test_curse_AlreadyCursed_duplicateSubject_reverts() (gas: 156801) diff --git a/contracts/src/v0.8/ccip/capability/CCIPHome.sol b/contracts/src/v0.8/ccip/capability/CCIPHome.sol index cea7f4c780..1c639f420a 100644 --- a/contracts/src/v0.8/ccip/capability/CCIPHome.sol +++ b/contracts/src/v0.8/ccip/capability/CCIPHome.sol @@ -14,8 +14,6 @@ import {EnumerableSet} from "../../vendor/openzeppelin-solidity/v5.0.2/contracts /// @notice CCIPHome stores the configuration for the CCIP capability. /// We have two classes of configuration: chain configuration and DON (in the CapabilitiesRegistry sense) configuration. /// Each chain will have a single configuration which includes information like the router address. -/// Each CR DON will have up to four configurations: for each of (commit, exec), one blue and one green configuration. -/// This is done in order to achieve "blue-green" deployments. contract CCIPHome is OwnerIsCreator, ITypeAndVersion, ICapabilityConfiguration, IERC165 { using EnumerableSet for EnumerableSet.UintSet; @@ -49,7 +47,10 @@ contract CCIPHome is OwnerIsCreator, ITypeAndVersion, ICapabilityConfiguration, error DigestNotFound(bytes32 configDigest); error InvalidStateTransition( - bytes32 currentPrimaryDigest, bytes32 currentSecondaryDigest, bytes32 blue, bytes32 green + bytes32 currentActiveDigest, + bytes32 currentCandidateDigest, + bytes32 proposedActiveDigest, + bytes32 proposedCandidateDigest ); /// @notice Represents an oracle node in OCR3 configs part of the role DON. @@ -124,8 +125,8 @@ contract CCIPHome is OwnerIsCreator, ITypeAndVersion, ICapabilityConfiguration, /// @notice The total number of configs ever set, used for generating the version of the configs. uint32 private s_configCount = 0; - /// @notice The index of the primary config. - uint32 private s_primaryConfigIndex = 0; + /// @notice The index of the active config. + uint32 private s_activeConfigIndex = 0; /// @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. @@ -165,37 +166,38 @@ contract CCIPHome is OwnerIsCreator, ITypeAndVersion, ICapabilityConfiguration, revert OnlyCapabilitiesRegistryCanCall(); } - (OCR3Config memory blue, OCR3Config memory green) = abi.decode(update, (OCR3Config, OCR3Config)); + (OCR3Config memory newActiveConfig, OCR3Config memory newCandidateConfig) = + abi.decode(update, (OCR3Config, OCR3Config)); bytes32 pluginKey = bytes32(uint256(donId)); uint32 newConfigVersion = s_configCount + 1; - (bytes32 currentBlueDigest, bytes32 currentGreenDigest) = getConfigDigests(pluginKey); - bytes32 newBlueDigest = _calculateConfigDigest(pluginKey, abi.encode(blue), newConfigVersion); - bytes32 newGreenDigest = _calculateConfigDigest(pluginKey, abi.encode(green), newConfigVersion); + (bytes32 currentActiveDigest, bytes32 currentCandidateDigest) = getConfigDigests(pluginKey); + bytes32 newActiveDigest = _calculateConfigDigest(pluginKey, abi.encode(newActiveConfig), newConfigVersion); + bytes32 newCandidateDigest = _calculateConfigDigest(pluginKey, abi.encode(newCandidateConfig), newConfigVersion); // Check the possible steps of the state machine - // 1. promoteSecondaryAndRevokePrimary requires - // - blue digest to be the current secondary digest - // - green digest to be the zero digest - if (currentGreenDigest == newBlueDigest && newGreenDigest == ZERO_DIGEST) { - _promoteSecondaryAndRevokePrimary(pluginKey, newBlueDigest); + // 1. promoteCandidateAndRevokeActive requires + // - newActiveDigest to be the current candidate digest + // - newCandidateDigest to be the zero digest + if (currentCandidateDigest == newActiveDigest && newCandidateDigest == ZERO_DIGEST) { + _promoteCandidateAndRevokeActive(pluginKey, newActiveDigest); return; } - // setSecondary and revokeSecondary require no changes to the blue config - if (currentBlueDigest == newBlueDigest) { - // 2. If the green config is non-zero, we call setSecondary - if (newGreenDigest != ZERO_DIGEST) { - _setSecondary(pluginKey, blue, newBlueDigest); + // setCandidate and revokeCandidate require no changes to the active config + if (currentActiveDigest == newActiveDigest) { + // 2. If the candidate config is non-zero, we call setCandidate + if (newCandidateDigest != ZERO_DIGEST) { + _setCandidate(pluginKey, newActiveConfig, newActiveDigest); return; } else { - // 3. If the green config is zero, we call revokeSecondary - _revokeSecondary(pluginKey, newGreenDigest); + // 3. If the candidate config is zero, we call revokeCandidate + _revokeCandidate(pluginKey, newCandidateDigest); return; } } // There are no other valid state transitions so we revert if we have not returned by now. - revert InvalidStateTransition(currentBlueDigest, currentGreenDigest, newBlueDigest, newGreenDigest); + revert InvalidStateTransition(currentActiveDigest, currentCandidateDigest, newActiveDigest, newCandidateDigest); } /// @inheritdoc ICapabilityConfiguration @@ -209,30 +211,29 @@ contract CCIPHome is OwnerIsCreator, ITypeAndVersion, ICapabilityConfiguration, // │ Getters │ // ================================================================ - /// @notice Returns the current primary and secondary config digests. + /// @notice Returns the current active and candidate config digests. /// @dev Can be bytes32(0) if no config has been set yet or it has been revoked. /// @param pluginKey The key of the plugin to get the config digests for. - /// @return primaryConfigDigest The digest of the primary config. - /// @return secondaryConfigDigest The digest of the secondary config. + /// @return activeConfigDigest The digest of the active config. + /// @return candidateConfigDigest The digest of the candidate config. function getConfigDigests( bytes32 pluginKey - ) public view returns (bytes32 primaryConfigDigest, bytes32 secondaryConfigDigest) { + ) public view returns (bytes32 activeConfigDigest, bytes32 candidateConfigDigest) { return ( - s_configs[pluginKey][s_primaryConfigIndex].configDigest, - s_configs[pluginKey][s_primaryConfigIndex ^ 1].configDigest + s_configs[pluginKey][s_activeConfigIndex].configDigest, s_configs[pluginKey][s_activeConfigIndex ^ 1].configDigest ); } - /// @notice Returns the primary config digest for for a given key. + /// @notice Returns the active config digest for for a given key. /// @param pluginKey The key of the plugin to get the config digests for. - function getPrimaryDigest(bytes32 pluginKey) public view returns (bytes32) { - return s_configs[pluginKey][s_primaryConfigIndex].configDigest; + function getActiveDigest(bytes32 pluginKey) public view returns (bytes32) { + return s_configs[pluginKey][s_activeConfigIndex].configDigest; } - /// @notice Returns the secondary config digest for for a given key. + /// @notice Returns the candidate config digest for for a given key. /// @param pluginKey The key of the plugin to get the config digests for. - function getSecondaryDigest(bytes32 pluginKey) public view returns (bytes32) { - return s_configs[pluginKey][s_primaryConfigIndex ^ 1].configDigest; + function getCandidateDigest(bytes32 pluginKey) public view returns (bytes32) { + return s_configs[pluginKey][s_activeConfigIndex ^ 1].configDigest; } /// @notice The offchain code can use this to fetch an old config which might still be in use by some remotes. Use @@ -256,49 +257,49 @@ contract CCIPHome is OwnerIsCreator, ITypeAndVersion, ICapabilityConfiguration, return (versionedConfig, false); } - /// @notice Returns the primary and secondary configuration for a given plugin key. + /// @notice Returns the active and candidate configuration for a given plugin key. /// @param pluginKey The unique key for the DON that the configuration applies to. - /// @return primaryConfig The primary configuration. - /// @return secondaryConfig The secondary configuration. + /// @return activeConfig The active configuration. + /// @return candidateConfig The candidate configuration. function getAllConfigs( bytes32 pluginKey - ) external view returns (VersionedConfig memory primaryConfig, VersionedConfig memory secondaryConfig) { - VersionedConfig memory storedPrimaryConfig = s_configs[pluginKey][s_primaryConfigIndex]; - if (storedPrimaryConfig.configDigest != ZERO_DIGEST) { - primaryConfig = storedPrimaryConfig; + ) external view returns (VersionedConfig memory activeConfig, VersionedConfig memory candidateConfig) { + VersionedConfig memory storedActiveConfig = s_configs[pluginKey][s_activeConfigIndex]; + if (storedActiveConfig.configDigest != ZERO_DIGEST) { + activeConfig = storedActiveConfig; } - VersionedConfig memory storedSecondaryConfig = s_configs[pluginKey][s_primaryConfigIndex ^ 1]; - if (storedSecondaryConfig.configDigest != ZERO_DIGEST) { - secondaryConfig = storedSecondaryConfig; + VersionedConfig memory storedCandidateConfig = s_configs[pluginKey][s_activeConfigIndex ^ 1]; + if (storedCandidateConfig.configDigest != ZERO_DIGEST) { + candidateConfig = storedCandidateConfig; } - return (primaryConfig, secondaryConfig); + return (activeConfig, candidateConfig); } // ================================================================ // │ State transitions │ // ================================================================ - /// @notice Sets a new config as the secondary config. Does not influence the primary config. + /// @notice Sets a new config as the candidate config. Does not influence the active config. /// @param pluginKey The key of the plugin to set the config for. /// @return newConfigDigest The digest of the new config. - function _setSecondary( + function _setCandidate( bytes32 pluginKey, OCR3Config memory config, bytes32 newDigest ) internal returns (bytes32 newConfigDigest) { _validateConfig(config); - bytes32 existingDigest = getSecondaryDigest(pluginKey); + bytes32 existingDigest = getCandidateDigest(pluginKey); // are we going to overwrite a config? If so, emit an event. - if (getSecondaryDigest(pluginKey) != ZERO_DIGEST) { + if (getCandidateDigest(pluginKey) != ZERO_DIGEST) { emit ConfigRevoked(existingDigest); } uint32 newVersion = ++s_configCount; - VersionedConfig storage existingConfig = s_configs[pluginKey][s_primaryConfigIndex ^ 1]; + VersionedConfig storage existingConfig = s_configs[pluginKey][s_activeConfigIndex ^ 1]; existingConfig.version = newVersion; existingConfig.configDigest = newDigest; @@ -324,38 +325,38 @@ contract CCIPHome is OwnerIsCreator, ITypeAndVersion, ICapabilityConfiguration, /// @notice Revokes a specific config by digest. /// @param pluginKey The key of the plugin to revoke the config for. /// @param configDigest The digest of the config to revoke. This is done to prevent accidental revokes. - function _revokeSecondary(bytes32 pluginKey, bytes32 configDigest) internal { - uint256 secondaryConfigIndex = s_primaryConfigIndex ^ 1; - if (s_configs[pluginKey][secondaryConfigIndex].configDigest != configDigest) { - revert ConfigDigestMismatch(s_configs[pluginKey][secondaryConfigIndex].configDigest, configDigest); + function _revokeCandidate(bytes32 pluginKey, bytes32 configDigest) internal { + uint256 candidateConfigIndex = s_activeConfigIndex ^ 1; + if (s_configs[pluginKey][candidateConfigIndex].configDigest != configDigest) { + revert ConfigDigestMismatch(s_configs[pluginKey][candidateConfigIndex].configDigest, configDigest); } emit ConfigRevoked(configDigest); // Delete only the digest, as that's what's used to determine if a config is active. This means the actual // config stays in storage which should significantly reduce the gas cost of overwriting that storage space in // the future. - delete s_configs[pluginKey][secondaryConfigIndex].configDigest; + delete s_configs[pluginKey][candidateConfigIndex].configDigest; } - /// @notice Promotes the secondary config to the primary config and revokes the primary config. + /// @notice Promotes the candidate config to the active config and revokes the active config. /// @param pluginKey The key of the plugin to promote the config for. /// @param digestToPromote The digest of the config to promote. - function _promoteSecondaryAndRevokePrimary(bytes32 pluginKey, bytes32 digestToPromote) internal { - uint256 secondaryConfigIndex = s_primaryConfigIndex ^ 1; - if (s_configs[pluginKey][secondaryConfigIndex].configDigest != digestToPromote) { - revert ConfigDigestMismatch(s_configs[pluginKey][secondaryConfigIndex].configDigest, digestToPromote); + function _promoteCandidateAndRevokeActive(bytes32 pluginKey, bytes32 digestToPromote) internal { + uint256 candidateConfigIndex = s_activeConfigIndex ^ 1; + if (s_configs[pluginKey][candidateConfigIndex].configDigest != digestToPromote) { + revert ConfigDigestMismatch(s_configs[pluginKey][candidateConfigIndex].configDigest, digestToPromote); } - uint256 primaryConfigIndex = s_primaryConfigIndex; + uint256 activeConfigIndex = s_activeConfigIndex; - delete s_configs[pluginKey][primaryConfigIndex].configDigest; + delete s_configs[pluginKey][activeConfigIndex].configDigest; - bytes32 digestToRevoke = s_configs[pluginKey][primaryConfigIndex].configDigest; + bytes32 digestToRevoke = s_configs[pluginKey][activeConfigIndex].configDigest; if (digestToRevoke != ZERO_DIGEST) { emit ConfigRevoked(digestToRevoke); } - s_primaryConfigIndex ^= 1; + s_activeConfigIndex ^= 1; emit ConfigPromoted(digestToPromote); } diff --git a/contracts/src/v0.8/ccip/capability/RMNHome.sol b/contracts/src/v0.8/ccip/capability/RMNHome.sol index c8d554cb4b..f7f697a772 100644 --- a/contracts/src/v0.8/ccip/capability/RMNHome.sol +++ b/contracts/src/v0.8/ccip/capability/RMNHome.sol @@ -69,29 +69,29 @@ contract RMNHome is OwnerIsCreator, ITypeAndVersion { /// @notice The total number of configs ever set, used for generating the version of the configs. uint32 private s_configCount = 0; - /// @notice The index of the primary config. - uint32 private s_primaryConfigIndex = 0; + /// @notice The index of the active config. + uint32 private s_activeConfigIndex = 0; // ================================================================ // │ Getters │ // ================================================================ - /// @notice Returns the current primary and secondary config digests. + /// @notice Returns the current active and candidate config digests. /// @dev Can be bytes32(0) if no config has been set yet or it has been revoked. - /// @return primaryConfigDigest The digest of the primary config. - /// @return secondaryConfigDigest The digest of the secondary config. - function getConfigDigests() external view returns (bytes32 primaryConfigDigest, bytes32 secondaryConfigDigest) { - return (s_configs[s_primaryConfigIndex].configDigest, s_configs[s_primaryConfigIndex ^ 1].configDigest); + /// @return activeConfigDigest The digest of the active config. + /// @return candidateConfigDigest The digest of the candidate config. + function getConfigDigests() external view returns (bytes32 activeConfigDigest, bytes32 candidateConfigDigest) { + return (s_configs[s_activeConfigIndex].configDigest, s_configs[s_activeConfigIndex ^ 1].configDigest); } - /// @notice Returns the primary config digest - function getPrimaryDigest() public view returns (bytes32) { - return s_configs[s_primaryConfigIndex].configDigest; + /// @notice Returns the active config digest + function getActiveDigest() public view returns (bytes32) { + return s_configs[s_activeConfigIndex].configDigest; } - /// @notice Returns the secondary config digest - function getSecondaryDigest() public view returns (bytes32) { - return s_configs[s_primaryConfigIndex ^ 1].configDigest; + /// @notice Returns the candidate config digest + function getCandidateDigest() public view returns (bytes32) { + return s_configs[s_activeConfigIndex ^ 1].configDigest; } /// @notice The offchain code can use this to fetch an old config which might still be in use by some remotes. Use @@ -113,39 +113,39 @@ contract RMNHome is OwnerIsCreator, ITypeAndVersion { function getAllConfigs() external view - returns (VersionedConfig memory primaryConfig, VersionedConfig memory secondaryConfig) + returns (VersionedConfig memory activeConfig, VersionedConfig memory candidateConfig) { - VersionedConfig memory storedPrimaryConfig = s_configs[s_primaryConfigIndex]; - if (storedPrimaryConfig.configDigest != ZERO_DIGEST) { - primaryConfig = storedPrimaryConfig; + VersionedConfig memory storedActiveConfig = s_configs[s_activeConfigIndex]; + if (storedActiveConfig.configDigest != ZERO_DIGEST) { + activeConfig = storedActiveConfig; } - VersionedConfig memory storedSecondaryConfig = s_configs[s_primaryConfigIndex ^ 1]; - if (storedSecondaryConfig.configDigest != ZERO_DIGEST) { - secondaryConfig = storedSecondaryConfig; + VersionedConfig memory storedCandidateConfig = s_configs[s_activeConfigIndex ^ 1]; + if (storedCandidateConfig.configDigest != ZERO_DIGEST) { + candidateConfig = storedCandidateConfig; } - return (primaryConfig, secondaryConfig); + return (activeConfig, candidateConfig); } // ================================================================ // │ State transitions │ // ================================================================ - /// @notice Sets a new config as the secondary config. Does not influence the primary config. + /// @notice Sets a new config as the candidate config. Does not influence the active config. /// @param staticConfig The static part of the config. /// @param dynamicConfig The dynamic part of the config. /// @param digestToOverwrite The digest of the config to overwrite, or ZERO_DIGEST if no config is to be overwritten. /// This is done to prevent accidental overwrites. /// @return newConfigDigest The digest of the new config. - function setSecondary( + function setCandidate( StaticConfig calldata staticConfig, DynamicConfig calldata dynamicConfig, bytes32 digestToOverwrite ) external onlyOwner returns (bytes32 newConfigDigest) { _validateStaticAndDynamicConfig(staticConfig, dynamicConfig); - bytes32 existingDigest = getSecondaryDigest(); + bytes32 existingDigest = getCandidateDigest(); if (existingDigest != digestToOverwrite) { revert ConfigDigestMismatch(existingDigest, digestToOverwrite); @@ -159,7 +159,7 @@ contract RMNHome is OwnerIsCreator, ITypeAndVersion { uint32 newVersion = ++s_configCount; newConfigDigest = _calculateConfigDigest(abi.encode(staticConfig), newVersion); - VersionedConfig storage existingConfig = s_configs[s_primaryConfigIndex ^ 1]; + VersionedConfig storage existingConfig = s_configs[s_activeConfigIndex ^ 1]; existingConfig.configDigest = newConfigDigest; existingConfig.version = newVersion; existingConfig.staticConfig = staticConfig; @@ -172,36 +172,36 @@ contract RMNHome is OwnerIsCreator, ITypeAndVersion { /// @notice Revokes a specific config by digest. /// @param configDigest The digest of the config to revoke. This is done to prevent accidental revokes. - function revokeSecondary(bytes32 configDigest) external onlyOwner { - uint256 secondaryConfigIndex = s_primaryConfigIndex ^ 1; - if (s_configs[secondaryConfigIndex].configDigest != configDigest) { - revert ConfigDigestMismatch(s_configs[secondaryConfigIndex].configDigest, configDigest); + function revokeCandidate(bytes32 configDigest) external onlyOwner { + uint256 candidateConfigIndex = s_activeConfigIndex ^ 1; + if (s_configs[candidateConfigIndex].configDigest != configDigest) { + revert ConfigDigestMismatch(s_configs[candidateConfigIndex].configDigest, configDigest); } emit ConfigRevoked(configDigest); // Delete only the digest, as that's what's used to determine if a config is active. This means the actual // config stays in storage which should significantly reduce the gas cost of overwriting that storage space in // the future. - delete s_configs[secondaryConfigIndex].configDigest; + delete s_configs[candidateConfigIndex].configDigest; } - /// @notice Promotes the secondary config to the primary config and revokes the primary config. + /// @notice Promotes the candidate config to the active config and revokes the active config. /// @param digestToPromote The digest of the config to promote. /// @param digestToRevoke The digest of the config to revoke. - function promoteSecondaryAndRevokePrimary(bytes32 digestToPromote, bytes32 digestToRevoke) external onlyOwner { - uint256 secondaryConfigIndex = s_primaryConfigIndex ^ 1; - if (s_configs[secondaryConfigIndex].configDigest != digestToPromote) { - revert ConfigDigestMismatch(s_configs[secondaryConfigIndex].configDigest, digestToPromote); + function promoteCandidateAndRevokeActive(bytes32 digestToPromote, bytes32 digestToRevoke) external onlyOwner { + uint256 candidateConfigIndex = s_activeConfigIndex ^ 1; + if (s_configs[candidateConfigIndex].configDigest != digestToPromote) { + revert ConfigDigestMismatch(s_configs[candidateConfigIndex].configDigest, digestToPromote); } - uint256 primaryConfigIndex = s_primaryConfigIndex; - if (s_configs[primaryConfigIndex].configDigest != digestToRevoke) { - revert ConfigDigestMismatch(s_configs[primaryConfigIndex].configDigest, digestToRevoke); + uint256 activeConfigIndex = s_activeConfigIndex; + if (s_configs[activeConfigIndex].configDigest != digestToRevoke) { + revert ConfigDigestMismatch(s_configs[activeConfigIndex].configDigest, digestToRevoke); } - delete s_configs[primaryConfigIndex].configDigest; + delete s_configs[activeConfigIndex].configDigest; - s_primaryConfigIndex ^= 1; + s_activeConfigIndex ^= 1; if (digestToRevoke != ZERO_DIGEST) { emit ConfigRevoked(digestToRevoke); } diff --git a/contracts/src/v0.8/ccip/test/capability/RMNHomeTest.t.sol b/contracts/src/v0.8/ccip/test/capability/RMNHomeTest.t.sol index 16c299a573..276a006f66 100644 --- a/contracts/src/v0.8/ccip/test/capability/RMNHomeTest.t.sol +++ b/contracts/src/v0.8/ccip/test/capability/RMNHomeTest.t.sol @@ -53,8 +53,8 @@ contract RMNHomeTest is Test { } } -contract RMNHome_setSecondary is RMNHomeTest { - function test_setSecondary_success() public { +contract RMNHome_setCandidate is RMNHomeTest { + function test_setCandidate_success() public { Config memory config = _getBaseConfig(); RMNHome.VersionedConfig memory versionedConfig = RMNHome.VersionedConfig({ version: 1, @@ -70,7 +70,7 @@ contract RMNHome_setSecondary is RMNHomeTest { versionedConfig.configDigest, versionedConfig.version, versionedConfig.staticConfig, versionedConfig.dynamicConfig ); - s_rmnHome.setSecondary(versionedConfig.staticConfig, versionedConfig.dynamicConfig, ZERO_DIGEST); + s_rmnHome.setCandidate(versionedConfig.staticConfig, versionedConfig.dynamicConfig, ZERO_DIGEST); (RMNHome.VersionedConfig memory storedVersionedConfig, bool ok) = s_rmnHome.getConfig(versionedConfig.configDigest); assertTrue(ok); @@ -96,61 +96,61 @@ contract RMNHome_setSecondary is RMNHomeTest { assertEq(storedStaticConfig.offchainConfig, versionedConfig.staticConfig.offchainConfig); } - function test_setSecondary_OutOfBoundsNodesLength_reverts() public { + function test_setCandidate_OutOfBoundsNodesLength_reverts() public { Config memory config = _getBaseConfig(); config.staticConfig.nodes = new RMNHome.Node[](257); vm.expectRevert(RMNHome.OutOfBoundsNodesLength.selector); - s_rmnHome.setSecondary(config.staticConfig, config.dynamicConfig, ZERO_DIGEST); + s_rmnHome.setCandidate(config.staticConfig, config.dynamicConfig, ZERO_DIGEST); } - function test_setSecondary_DuplicatePeerId_reverts() public { + function test_setCandidate_DuplicatePeerId_reverts() public { Config memory config = _getBaseConfig(); config.staticConfig.nodes[1].peerId = config.staticConfig.nodes[0].peerId; vm.expectRevert(RMNHome.DuplicatePeerId.selector); - s_rmnHome.setSecondary(config.staticConfig, config.dynamicConfig, ZERO_DIGEST); + s_rmnHome.setCandidate(config.staticConfig, config.dynamicConfig, ZERO_DIGEST); } - function test_setSecondary_DuplicateOffchainPublicKey_reverts() public { + function test_setCandidate_DuplicateOffchainPublicKey_reverts() public { Config memory config = _getBaseConfig(); config.staticConfig.nodes[1].offchainPublicKey = config.staticConfig.nodes[0].offchainPublicKey; vm.expectRevert(RMNHome.DuplicateOffchainPublicKey.selector); - s_rmnHome.setSecondary(config.staticConfig, config.dynamicConfig, ZERO_DIGEST); + s_rmnHome.setCandidate(config.staticConfig, config.dynamicConfig, ZERO_DIGEST); } - function test_setSecondary_DuplicateSourceChain_reverts() public { + function test_setCandidate_DuplicateSourceChain_reverts() public { Config memory config = _getBaseConfig(); config.dynamicConfig.sourceChains[1].chainSelector = config.dynamicConfig.sourceChains[0].chainSelector; vm.expectRevert(RMNHome.DuplicateSourceChain.selector); - s_rmnHome.setSecondary(config.staticConfig, config.dynamicConfig, ZERO_DIGEST); + s_rmnHome.setCandidate(config.staticConfig, config.dynamicConfig, ZERO_DIGEST); } - function test_setSecondary_OutOfBoundsObserverNodeIndex_reverts() public { + function test_setCandidate_OutOfBoundsObserverNodeIndex_reverts() public { Config memory config = _getBaseConfig(); config.dynamicConfig.sourceChains[0].observerNodesBitmap = 1 << config.staticConfig.nodes.length; vm.expectRevert(RMNHome.OutOfBoundsObserverNodeIndex.selector); - s_rmnHome.setSecondary(config.staticConfig, config.dynamicConfig, ZERO_DIGEST); + s_rmnHome.setCandidate(config.staticConfig, config.dynamicConfig, ZERO_DIGEST); } - function test_setSecondary_MinObserversTooHigh_reverts() public { + function test_setCandidate_MinObserversTooHigh_reverts() public { Config memory config = _getBaseConfig(); config.dynamicConfig.sourceChains[0].minObservers++; vm.expectRevert(RMNHome.MinObserversTooHigh.selector); - s_rmnHome.setSecondary(config.staticConfig, config.dynamicConfig, ZERO_DIGEST); + s_rmnHome.setCandidate(config.staticConfig, config.dynamicConfig, ZERO_DIGEST); } - function test_setSecondary_OnlyOwner_reverts() public { + function test_setCandidate_OnlyOwner_reverts() public { Config memory config = _getBaseConfig(); vm.startPrank(address(0)); vm.expectRevert("Only callable by owner"); - s_rmnHome.setSecondary(config.staticConfig, config.dynamicConfig, ZERO_DIGEST); + s_rmnHome.setCandidate(config.staticConfig, config.dynamicConfig, ZERO_DIGEST); } } @@ -158,23 +158,23 @@ contract RMNHome_setDynamicConfig is RMNHomeTest { function setUp() public override { super.setUp(); Config memory config = _getBaseConfig(); - s_rmnHome.setSecondary(config.staticConfig, config.dynamicConfig, ZERO_DIGEST); + s_rmnHome.setCandidate(config.staticConfig, config.dynamicConfig, ZERO_DIGEST); } function test_setDynamicConfig_success() public { - (bytes32 priorPrimaryDigest,) = s_rmnHome.getConfigDigests(); + (bytes32 priorActiveDigest,) = s_rmnHome.getConfigDigests(); Config memory config = _getBaseConfig(); config.dynamicConfig.sourceChains[0].minObservers--; - (, bytes32 secondaryConfigDigest) = s_rmnHome.getConfigDigests(); + (, bytes32 candidateConfigDigest) = s_rmnHome.getConfigDigests(); vm.expectEmit(); - emit RMNHome.DynamicConfigSet(secondaryConfigDigest, config.dynamicConfig); + emit RMNHome.DynamicConfigSet(candidateConfigDigest, config.dynamicConfig); - s_rmnHome.setDynamicConfig(config.dynamicConfig, secondaryConfigDigest); + s_rmnHome.setDynamicConfig(config.dynamicConfig, candidateConfigDigest); - (RMNHome.VersionedConfig memory storedVersionedConfig, bool ok) = s_rmnHome.getConfig(secondaryConfigDigest); + (RMNHome.VersionedConfig memory storedVersionedConfig, bool ok) = s_rmnHome.getConfig(candidateConfigDigest); assertTrue(ok); assertEq( storedVersionedConfig.dynamicConfig.sourceChains[0].minObservers, @@ -182,9 +182,9 @@ contract RMNHome_setDynamicConfig is RMNHomeTest { ); // Asser the digests don't change when updating the dynamic config - (bytes32 primaryDigest, bytes32 secondaryDigest) = s_rmnHome.getConfigDigests(); - assertEq(primaryDigest, priorPrimaryDigest); - assertEq(secondaryDigest, secondaryConfigDigest); + (bytes32 activeDigest, bytes32 candidateDigest) = s_rmnHome.getConfigDigests(); + assertEq(activeDigest, priorActiveDigest); + assertEq(candidateDigest, candidateConfigDigest); } // Asserts the validation function is being called @@ -217,63 +217,63 @@ contract RMNHome_setDynamicConfig is RMNHomeTest { } } -contract RMNHome_revokeSecondary is RMNHomeTest { +contract RMNHome_revokeCandidate is RMNHomeTest { // Sets two configs function setUp() public override { super.setUp(); Config memory config = _getBaseConfig(); - bytes32 digest = s_rmnHome.setSecondary(config.staticConfig, config.dynamicConfig, ZERO_DIGEST); - s_rmnHome.promoteSecondaryAndRevokePrimary(digest, ZERO_DIGEST); + bytes32 digest = s_rmnHome.setCandidate(config.staticConfig, config.dynamicConfig, ZERO_DIGEST); + s_rmnHome.promoteCandidateAndRevokeActive(digest, ZERO_DIGEST); config.dynamicConfig.sourceChains[0].minObservers--; - s_rmnHome.setSecondary(config.staticConfig, config.dynamicConfig, ZERO_DIGEST); + s_rmnHome.setCandidate(config.staticConfig, config.dynamicConfig, ZERO_DIGEST); } - function test_revokeSecondary_success() public { - (bytes32 priorPrimaryDigest, bytes32 priorSecondaryDigest) = s_rmnHome.getConfigDigests(); + function test_revokeCandidate_success() public { + (bytes32 priorActiveDigest, bytes32 priorCandidateDigest) = s_rmnHome.getConfigDigests(); vm.expectEmit(); - emit RMNHome.ConfigRevoked(priorSecondaryDigest); + emit RMNHome.ConfigRevoked(priorCandidateDigest); - s_rmnHome.revokeSecondary(priorSecondaryDigest); + s_rmnHome.revokeCandidate(priorCandidateDigest); - (RMNHome.VersionedConfig memory storedVersionedConfig, bool ok) = s_rmnHome.getConfig(priorSecondaryDigest); + (RMNHome.VersionedConfig memory storedVersionedConfig, bool ok) = s_rmnHome.getConfig(priorCandidateDigest); assertFalse(ok); // Ensure no old data is returned, even though it's still in storage assertEq(storedVersionedConfig.version, 0); assertEq(storedVersionedConfig.staticConfig.nodes.length, 0); assertEq(storedVersionedConfig.dynamicConfig.sourceChains.length, 0); - // Asser the primary digest is unaffected but the secondary digest is set to zero - (bytes32 primaryDigest, bytes32 secondaryDigest) = s_rmnHome.getConfigDigests(); - assertEq(primaryDigest, priorPrimaryDigest); - assertEq(secondaryDigest, ZERO_DIGEST); - assertTrue(secondaryDigest != priorSecondaryDigest); + // Asser the active digest is unaffected but the candidate digest is set to zero + (bytes32 activeDigest, bytes32 candidateDigest) = s_rmnHome.getConfigDigests(); + assertEq(activeDigest, priorActiveDigest); + assertEq(candidateDigest, ZERO_DIGEST); + assertTrue(candidateDigest != priorCandidateDigest); } - function test_revokeSecondary_ConfigDigestMismatch_reverts() public { - (, bytes32 priorSecondaryDigest) = s_rmnHome.getConfigDigests(); + function test_revokeCandidate_ConfigDigestMismatch_reverts() public { + (, bytes32 priorCandidateDigest) = s_rmnHome.getConfigDigests(); bytes32 wrongDigest = keccak256("wrong_digest"); - vm.expectRevert(abi.encodeWithSelector(RMNHome.ConfigDigestMismatch.selector, priorSecondaryDigest, wrongDigest)); - s_rmnHome.revokeSecondary(wrongDigest); + vm.expectRevert(abi.encodeWithSelector(RMNHome.ConfigDigestMismatch.selector, priorCandidateDigest, wrongDigest)); + s_rmnHome.revokeCandidate(wrongDigest); } - function test_revokeSecondary_OnlyOwner_reverts() public { + function test_revokeCandidate_OnlyOwner_reverts() public { vm.startPrank(address(0)); vm.expectRevert("Only callable by owner"); - s_rmnHome.revokeSecondary(keccak256("configDigest")); + s_rmnHome.revokeCandidate(keccak256("configDigest")); } } -contract RMNHome_promoteSecondaryAndRevokePrimary is RMNHomeTest { - function test_promoteSecondaryAndRevokePrimary_success() public {} +contract RMNHome_promoteCandidateAndRevokeActive is RMNHomeTest { + function test_promoteCandidateAndRevokeActive_success() public {} - function test_promoteSecondaryAndRevokePrimary_OnlyOwner_reverts() public { + function test_promoteCandidateAndRevokeActive_OnlyOwner_reverts() public { vm.startPrank(address(0)); vm.expectRevert("Only callable by owner"); - s_rmnHome.promoteSecondaryAndRevokePrimary(keccak256("toPromote"), keccak256("ToRevoke")); + s_rmnHome.promoteCandidateAndRevokeActive(keccak256("toPromote"), keccak256("ToRevoke")); } }