fix(ccip): LoadChainState handles EVM2EVMOnRamp/EVM2EVMOffRamp v1.5 address-book entries#22339
Conversation
|
✅ No conflicts with other open PRs targeting |
There was a problem hiding this comment.
Pull request overview
Risk Rating: MEDIUM
Adds backward-compatible handling for legacy contract identifiers in deployment/on-chain state loading, primarily for CCIP v1.5 EVM2EVM ramp address-book/datastore keys, and additionally for a legacy MCMS datastore label (prodTestnetMCM).
Changes:
- Extend CCIP
LoadChainStateto recognize legacy v1.5 datastore aliases (EVM2EVMOnRamp/EVM2EVMOffRamp) whenloadLegacyContractsis enabled. - Introduce
ProdTestnetMCMas a legacy contract type alias for MCMS (same ABI asManyChainMultiSig) and update MCMS loading + ABI mapping to accept it. - Add tests covering legacy v1.5 ramp keys and legacy
prodTestnetMCMbehavior.
Scrupulous human review recommended (high impact / easy-to-miss):
deployment/common/changeset/state/evm.goDataStore refs loading path for MCMS roles (label propagation and role assignment).deployment/ccip/shared/stateview/state.golegacy-contract gating logic to ensure legacy addresses are only loaded when intended (and ABI mappings remain correct for labeled entries).
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| deployment/common/types/types.go | Adds ProdTestnetMCM legacy contract type constant for MCMS. |
| deployment/common/changeset/state/evm.go | Updates MCMS loaders to accept prodTestnetMCM as an alias (and adds DataStore-refs branch). |
| deployment/common/changeset/state/evm_prod_testnet_mcm_test.go | Adds tests for prodTestnetMCM address-map and DataStore-ref loading. |
| deployment/common/changeset/state.go | Mirrors prodTestnetMCM alias handling in deprecated MCMS loader. |
| deployment/ccip/shared/types.go | Adds legacy v1.5 datastore aliases EVM2EVMOnRamp / EVM2EVMOffRamp. |
| deployment/ccip/shared/stateview/state.go | Extends ABI mapping and legacy loading switch cases for the new aliases + prodTestnetMCM. |
| deployment/ccip/shared/stateview/state_test.go | Adds a test validating legacy v1.5 ramp key handling with/without the legacy flag. |
| case tv.Type == types.ProdTestnetMCM && tv.Version.String() == deployment.Version1_0_0.String(): | ||
| // Legacy prodTestnetMCM (same ABI as ManyChainMultiSig); roles via labels (see MaybeLoadMCMSWithTimelockChainState). | ||
| mcms, err := bindings.NewManyChainMultiSig(addr, chain.Client) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| if tv.Labels.Contains(types.ProposerRole.String()) && state.ProposerMcm == nil { | ||
| state.ProposerMcm = mcms | ||
| } | ||
| if tv.Labels.Contains(types.BypasserRole.String()) && state.BypasserMcm == nil { | ||
| state.BypasserMcm = mcms | ||
| } | ||
| if tv.Labels.Contains(types.CancellerRole.String()) && state.CancellerMcm == nil { | ||
| state.CancellerMcm = mcms | ||
| } |
| // legacy addresses below are commented out to avoid loading them by default, to be uncommented for migrations | ||
| case cldf.NewTypeAndVersion(ccipshared.OnRamp, deployment.Version1_5_0).String(): | ||
| case cldf.NewTypeAndVersion(ccipshared.OnRamp, deployment.Version1_5_0).String(), | ||
| cldf.NewTypeAndVersion(ccipshared.EVM2EVMOnRamp, deployment.Version1_5_0).String(): | ||
| if !config.loadLegacyContracts { | ||
| continue |
| // ProdTestnetMCM is a legacy RDD label still present on CCIP testnet datastore / address-book entries. | ||
| // It denotes the same ManyChainMultiSig ABI as ManyChainMultiSig @ v1.0.0; role disambiguation uses | ||
| // the same PROPOSER / BYPASSER / CANCELLER labels as ManyChainMultiSig entries. | ||
| ProdTestnetMCM cldf.ContractType = "prodTestnetMCM" | ||
| RBACTimelock cldf.ContractType = "RBACTimelock" |
|




This pull request adds support for recognizing and loading legacy v1.5 EVM2EVMOnRamp and EVM2EVMOffRamp contract types in the chain state loader, ensuring backward compatibility for migrations and legacy deployments. It also introduces a comprehensive test to verify the correct handling of these legacy contract keys and their mapping to the appropriate contract ABIs.
Legacy contract support and test coverage:
LoadChainStateinstate.goto recognize both legacy and standard type/version keys for EVM2EVMOnRamp and EVM2EVMOffRamp contracts, allowing them to be loaded when theloadLegacyContractsflag is set. [1] [2]EVM2EVMOnRampandEVM2EVMOffRamptotypes.gofor legacy v1.5 datastore aliases, matching on-chain typeAndVersion values.Testing enhancements:
TestLoadChainState_LegacyV15EVM2EVMDatastoreKeysinstate_test.goto deploy v1.5 onramp/offramp contracts, verify their loading behavior with and without the legacy flag, and check correct ABI assignments.state_test.goto support the new tests.