Skip to content

Commit

Permalink
Add RMNHomeAddress in the OCR3Config (#1449)
Browse files Browse the repository at this point in the history
Adding `rmnHomeAddress` in the `OCR3Config` struct + generated wrappers.
  • Loading branch information
0xnogo authored Sep 25, 2024
1 parent ebc7094 commit 75b4250
Show file tree
Hide file tree
Showing 7 changed files with 142 additions and 82 deletions.
88 changes: 45 additions & 43 deletions contracts/gas-snapshots/ccip.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -36,29 +36,29 @@ BurnWithFromMintTokenPool_lockOrBurn:test_PoolBurn_Success() (gas: 244050)
BurnWithFromMintTokenPool_lockOrBurn:test_Setup_Success() (gas: 24170)
CCIPClientExample_sanity:test_ImmutableExamples_Success() (gas: 2052431)
CCIPConfigSetup:test_getCapabilityConfiguration_Success() (gas: 9508)
CCIPConfig_ConfigStateMachine:test__computeConfigDigest_Success() (gas: 83274)
CCIPConfig_ConfigStateMachine:test__computeNewConfigWithMeta_InitToRunning_Success() (gas: 354656)
CCIPConfig_ConfigStateMachine:test__computeNewConfigWithMeta_RunningToStaging_Success() (gas: 466876)
CCIPConfig_ConfigStateMachine:test__computeNewConfigWithMeta_StagingToRunning_Success() (gas: 433253)
CCIPConfig_ConfigStateMachine:test__groupByPluginType_TooManyOCR3Configs_Reverts() (gas: 28063)
CCIPConfig_ConfigStateMachine:test__groupByPluginType_threeCommitConfigs_Reverts() (gas: 61002)
CCIPConfig_ConfigStateMachine:test__groupByPluginType_threeExecutionConfigs_Reverts() (gas: 60940)
CCIPConfig_ConfigStateMachine:test__stateFromConfigLength_Success() (gas: 11668)
CCIPConfig_ConfigStateMachine:test__computeConfigDigest_Success() (gas: 87751)
CCIPConfig_ConfigStateMachine:test__computeNewConfigWithMeta_InitToRunning_Success() (gas: 359022)
CCIPConfig_ConfigStateMachine:test__computeNewConfigWithMeta_RunningToStaging_Success() (gas: 478323)
CCIPConfig_ConfigStateMachine:test__computeNewConfigWithMeta_StagingToRunning_Success() (gas: 443187)
CCIPConfig_ConfigStateMachine:test__groupByPluginType_TooManyOCR3Configs_Reverts() (gas: 31646)
CCIPConfig_ConfigStateMachine:test__groupByPluginType_threeCommitConfigs_Reverts() (gas: 64324)
CCIPConfig_ConfigStateMachine:test__groupByPluginType_threeExecutionConfigs_Reverts() (gas: 64262)
CCIPConfig_ConfigStateMachine:test__stateFromConfigLength_Success() (gas: 11734)
CCIPConfig_ConfigStateMachine:test__validateConfigStateTransition_Success() (gas: 8783)
CCIPConfig_ConfigStateMachine:test__validateConfigTransition_InitToRunning_Success() (gas: 305974)
CCIPConfig_ConfigStateMachine:test__validateConfigTransition_InitToRunning_WrongConfigCount_Reverts() (gas: 46142)
CCIPConfig_ConfigStateMachine:test__validateConfigTransition_NonExistentConfigTransition_Reverts() (gas: 25040)
CCIPConfig_ConfigStateMachine:test__validateConfigTransition_RunningToStaging_Success() (gas: 362471)
CCIPConfig_ConfigStateMachine:test__validateConfigTransition_RunningToStaging_WrongConfigCount_Reverts() (gas: 110001)
CCIPConfig_ConfigStateMachine:test__validateConfigTransition_RunningToStaging_WrongConfigDigestBlueGreen_Reverts() (gas: 141606)
CCIPConfig_ConfigStateMachine:test__validateConfigTransition_StagingToRunning_Success() (gas: 362211)
CCIPConfig_ConfigStateMachine:test__validateConfigTransition_StagingToRunning_WrongConfigDigest_Reverts() (gas: 141673)
CCIPConfig_ConfigStateMachine:test__validateConfigTransition_InitToRunning_Success() (gas: 308111)
CCIPConfig_ConfigStateMachine:test__validateConfigTransition_InitToRunning_WrongConfigCount_Reverts() (gas: 48274)
CCIPConfig_ConfigStateMachine:test__validateConfigTransition_NonExistentConfigTransition_Reverts() (gas: 27945)
CCIPConfig_ConfigStateMachine:test__validateConfigTransition_RunningToStaging_Success() (gas: 368614)
CCIPConfig_ConfigStateMachine:test__validateConfigTransition_RunningToStaging_WrongConfigCount_Reverts() (gas: 116145)
CCIPConfig_ConfigStateMachine:test__validateConfigTransition_RunningToStaging_WrongConfigDigestBlueGreen_Reverts() (gas: 149842)
CCIPConfig_ConfigStateMachine:test__validateConfigTransition_StagingToRunning_Success() (gas: 368354)
CCIPConfig_ConfigStateMachine:test__validateConfigTransition_StagingToRunning_WrongConfigDigest_Reverts() (gas: 149909)
CCIPConfig_ConfigStateMachine:test_getCapabilityConfiguration_Success() (gas: 9632)
CCIPConfig_beforeCapabilityConfigSet:test_beforeCapabilityConfigSet_CommitAndExecConfig_Success() (gas: 1699166)
CCIPConfig_beforeCapabilityConfigSet:test_beforeCapabilityConfigSet_CommitConfigOnly_Success() (gas: 991503)
CCIPConfig_beforeCapabilityConfigSet:test_beforeCapabilityConfigSet_ExecConfigOnly_Success() (gas: 991534)
CCIPConfig_beforeCapabilityConfigSet:test_beforeCapabilityConfigSet_CommitAndExecConfig_Success() (gas: 1798048)
CCIPConfig_beforeCapabilityConfigSet:test_beforeCapabilityConfigSet_CommitConfigOnly_Success() (gas: 1040966)
CCIPConfig_beforeCapabilityConfigSet:test_beforeCapabilityConfigSet_ExecConfigOnly_Success() (gas: 1040997)
CCIPConfig_beforeCapabilityConfigSet:test_beforeCapabilityConfigSet_OnlyCapabilitiesRegistryCanCall_Reverts() (gas: 9665)
CCIPConfig_beforeCapabilityConfigSet:test_beforeCapabilityConfigSet_ZeroLengthConfig_Success() (gas: 16042)
CCIPConfig_beforeCapabilityConfigSet:test_beforeCapabilityConfigSet_ZeroLengthConfig_Success() (gas: 16115)
CCIPConfig_beforeCapabilityConfigSet:test_getCapabilityConfiguration_Success() (gas: 9596)
CCIPConfig_chainConfig:test__applyChainConfigUpdates_FChainNotPositive_Reverts() (gas: 185139)
CCIPConfig_chainConfig:test_applyChainConfigUpdates_addChainConfigs_Success() (gas: 347170)
Expand All @@ -67,30 +67,32 @@ CCIPConfig_chainConfig:test_applyChainConfigUpdates_removeChainConfigs_Success()
CCIPConfig_chainConfig:test_applyChainConfigUpdates_selectorNotFound_Reverts() (gas: 14943)
CCIPConfig_chainConfig:test_getCapabilityConfiguration_Success() (gas: 9617)
CCIPConfig_chainConfig:test_getPaginatedCCIPConfigs_Success() (gas: 370770)
CCIPConfig_constructor:test_constructor_Success() (gas: 3155264)
CCIPConfig_constructor:test_constructor_ZeroAddressNotAllowed_Revert() (gas: 61226)
CCIPConfig_updatePluginConfig:test__updatePluginConfig_InvalidConfigLength_Reverts() (gas: 22160)
CCIPConfig_updatePluginConfig:test__updatePluginConfig_InvalidConfigStateTransition_Reverts() (gas: 19491)
CCIPConfig_constructor:test_constructor_Success() (gas: 3275156)
CCIPConfig_constructor:test_constructor_ZeroAddressNotAllowed_Revert() (gas: 61370)
CCIPConfig_updatePluginConfig:test__updatePluginConfig_InvalidConfigLength_Reverts() (gas: 24518)
CCIPConfig_updatePluginConfig:test__updatePluginConfig_InvalidConfigStateTransition_Reverts() (gas: 21077)
CCIPConfig_updatePluginConfig:test_getCapabilityConfiguration_Success() (gas: 9654)
CCIPConfig_updatePluginConfig:test_updatePluginConfig_InitToRunning_Success() (gas: 1039133)
CCIPConfig_updatePluginConfig:test_updatePluginConfig_RunningToStaging_Success() (gas: 1923111)
CCIPConfig_updatePluginConfig:test_updatePluginConfig_StagingToRunning_Success() (gas: 1923145)
CCIPConfig_validateConfig:test__validateConfigLessTransmittersThanSigners_Success() (gas: 333177)
CCIPConfig_validateConfig:test__validateConfigSmallerFChain_Success() (gas: 464532)
CCIPConfig_validateConfig:test__validateConfig_ABIEncodedAddress_OfframpAddressCannotBeZero_Reverts() (gas: 288463)
CCIPConfig_validateConfig:test__validateConfig_ChainSelectorNotFound_Reverts() (gas: 291264)
CCIPConfig_validateConfig:test__validateConfig_ChainSelectorNotSet_Reverts() (gas: 288096)
CCIPConfig_validateConfig:test__validateConfig_FChainTooHigh_Reverts() (gas: 335512)
CCIPConfig_validateConfig:test__validateConfig_FMustBePositive_Reverts() (gas: 289648)
CCIPConfig_validateConfig:test__validateConfig_FTooHigh_Reverts() (gas: 289087)
CCIPConfig_validateConfig:test__validateConfig_NodeNotInRegistry_Reverts() (gas: 342330)
CCIPConfig_validateConfig:test__validateConfig_NotEnoughTransmittersEmptyAddresses_Reverts() (gas: 306844)
CCIPConfig_validateConfig:test__validateConfig_NotEnoughTransmitters_Reverts() (gas: 1209806)
CCIPConfig_validateConfig:test__validateConfig_OfframpAddressCannotBeZero_Reverts() (gas: 288202)
CCIPConfig_validateConfig:test__validateConfig_Success() (gas: 299119)
CCIPConfig_validateConfig:test__validateConfig_TooManySigners_Reverts() (gas: 788872)
CCIPConfig_validateConfig:test__validateConfig_ZeroP2PId_Reverts() (gas: 292418)
CCIPConfig_validateConfig:test__validateConfig_ZeroSignerKey_Reverts() (gas: 292467)
CCIPConfig_updatePluginConfig:test_updatePluginConfig_InitToRunning_Success() (gas: 1092200)
CCIPConfig_updatePluginConfig:test_updatePluginConfig_RunningToStaging_Success() (gas: 2043837)
CCIPConfig_updatePluginConfig:test_updatePluginConfig_StagingToRunning_Success() (gas: 2043872)
CCIPConfig_validateConfig:test__validateConfigLessTransmittersThanSigners_Success() (gas: 334491)
CCIPConfig_validateConfig:test__validateConfigSmallerFChain_Success() (gas: 465605)
CCIPConfig_validateConfig:test__validateConfig_ABIEncodedAddress_OfframpAddressCannotBeZero_Reverts() (gas: 289551)
CCIPConfig_validateConfig:test__validateConfig_ABIEncodedAddress_RMNHomeAddressCannotBeZero_Reverts() (gas: 289846)
CCIPConfig_validateConfig:test__validateConfig_ChainSelectorNotFound_Reverts() (gas: 292593)
CCIPConfig_validateConfig:test__validateConfig_ChainSelectorNotSet_Reverts() (gas: 289185)
CCIPConfig_validateConfig:test__validateConfig_FChainTooHigh_Reverts() (gas: 336851)
CCIPConfig_validateConfig:test__validateConfig_FMustBePositive_Reverts() (gas: 290977)
CCIPConfig_validateConfig:test__validateConfig_FTooHigh_Reverts() (gas: 290416)
CCIPConfig_validateConfig:test__validateConfig_NodeNotInRegistry_Reverts() (gas: 343692)
CCIPConfig_validateConfig:test__validateConfig_NotEnoughTransmittersEmptyAddresses_Reverts() (gas: 309173)
CCIPConfig_validateConfig:test__validateConfig_NotEnoughTransmitters_Reverts() (gas: 1211220)
CCIPConfig_validateConfig:test__validateConfig_OfframpAddressCannotBeZero_Reverts() (gas: 289247)
CCIPConfig_validateConfig:test__validateConfig_RMNHomeAddressCannotBeZero_Reverts() (gas: 289485)
CCIPConfig_validateConfig:test__validateConfig_Success() (gas: 300450)
CCIPConfig_validateConfig:test__validateConfig_TooManySigners_Reverts() (gas: 790349)
CCIPConfig_validateConfig:test__validateConfig_ZeroP2PId_Reverts() (gas: 293748)
CCIPConfig_validateConfig:test__validateConfig_ZeroSignerKey_Reverts() (gas: 293820)
CCIPConfig_validateConfig:test_getCapabilityConfiguration_Success() (gas: 9596)
CommitStore_constructor:test_Constructor_Success() (gas: 2855567)
CommitStore_isUnpausedAndRMNHealthy:test_RMN_Success() (gas: 73954)
Expand Down
6 changes: 6 additions & 0 deletions contracts/src/v0.8/ccip/capability/CCIPConfig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ contract CCIPConfig is ITypeAndVersion, ICapabilityConfiguration, OwnerIsCreator
error FChainTooHigh(uint256 fChain, uint256 FRoleDON);
error InvalidPluginType();
error OfframpAddressCannotBeZero();
error RMNHomeAddressCannotBeZero();
error InvalidConfigLength(uint256 length);
error InvalidConfigStateTransition(
CCIPConfigTypes.ConfigState currentState, CCIPConfigTypes.ConfigState proposedState
Expand Down Expand Up @@ -227,6 +228,7 @@ contract CCIPConfig is ITypeAndVersion, ICapabilityConfiguration, OwnerIsCreator
ocr3Config.FRoleDON = newOcr3Config.FRoleDON;
ocr3Config.offchainConfigVersion = newOcr3Config.offchainConfigVersion;
ocr3Config.offrampAddress = newOcr3Config.offrampAddress;
ocr3Config.rmnHomeAddress = newOcr3Config.rmnHomeAddress;
ocr3Config.offchainConfig = newOcr3Config.offchainConfig;

// Remove all excess nodes
Expand Down Expand Up @@ -426,6 +428,9 @@ contract CCIPConfig is ITypeAndVersion, ICapabilityConfiguration, OwnerIsCreator
if (cfg.offrampAddress.length == 0 || keccak256(cfg.offrampAddress) == EMPTY_ENCODED_ADDRESS_HASH) {
revert OfframpAddressCannotBeZero();
}
if (cfg.rmnHomeAddress.length == 0 || keccak256(cfg.rmnHomeAddress) == EMPTY_ENCODED_ADDRESS_HASH) {
revert RMNHomeAddressCannotBeZero();
}
if (!s_remoteChainSelectors.contains(cfg.chainSelector)) revert ChainSelectorNotFound(cfg.chainSelector);

// fChain cannot exceed FRoleDON, since it is a subcommittee in the larger DON
Expand Down Expand Up @@ -494,6 +499,7 @@ contract CCIPConfig is ITypeAndVersion, ICapabilityConfiguration, OwnerIsCreator
donId,
ocr3Config.pluginType,
ocr3Config.offrampAddress,
ocr3Config.rmnHomeAddress,
configCount,
ocr3Config.nodes,
ocr3Config.FRoleDON,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ library CCIPConfigTypes {
uint8 FRoleDON; // | The "big F" parameter for the role DON.
uint64 offchainConfigVersion; // ─────────────╯ The version of the offchain configuration.
bytes offrampAddress; // The remote chain offramp address.
bytes rmnHomeAddress; // The home chain RMN home address.
OCR3Node[] nodes; // Keys & IDs of nodes part of the role DON
bytes offchainConfig; // The offchain configuration for the OCR3 protocol. Protobuf encoded.
}
Expand Down
Loading

0 comments on commit 75b4250

Please sign in to comment.