diff --git a/deployment/ccip/changeset/crossfamily/v1_6/cs_add_evm_solana_lane.go b/deployment/ccip/changeset/crossfamily/v1_6/cs_add_evm_solana_lane.go index 5a68d7b8cf6..fc310f712a9 100644 --- a/deployment/ccip/changeset/crossfamily/v1_6/cs_add_evm_solana_lane.go +++ b/deployment/ccip/changeset/crossfamily/v1_6/cs_add_evm_solana_lane.go @@ -13,6 +13,8 @@ import ( cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" "github.com/smartcontractkit/chainlink-deployments-framework/operations" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" + solana "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/solana_v0_1_0" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_6" "github.com/smartcontractkit/chainlink/deployment/ccip/shared" @@ -246,7 +248,7 @@ var ( type Dependencies struct { Env cldf.Environment - EVMMCMSState map[uint64]commonstate.MCMSWithTimelockState + EVMMCMSState map[uint64]evmstate.MCMSWithTimelockState SolanaMCMSState map[uint64]commonstate.MCMSWithTimelockStateSolana changesetInput csInputs diff --git a/deployment/ccip/changeset/cs_grant_and_mint_link_token.go b/deployment/ccip/changeset/cs_grant_and_mint_link_token.go index 5ab9a3b1b96..66160d9776e 100644 --- a/deployment/ccip/changeset/cs_grant_and_mint_link_token.go +++ b/deployment/ccip/changeset/cs_grant_and_mint_link_token.go @@ -9,9 +9,11 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" + cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" "github.com/smartcontractkit/chainlink-deployments-framework/operations" - evmstate "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" + opsutil "github.com/smartcontractkit/chainlink/deployment/common/opsutils" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" diff --git a/deployment/ccip/changeset/cs_orchestrate_changesets.go b/deployment/ccip/changeset/cs_orchestrate_changesets.go index c6d90b7ca74..6207b44e8fb 100644 --- a/deployment/ccip/changeset/cs_orchestrate_changesets.go +++ b/deployment/ccip/changeset/cs_orchestrate_changesets.go @@ -6,11 +6,12 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/smartcontractkit/ccip-owner-contracts/pkg/gethwrappers" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" "github.com/smartcontractkit/mcms" cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" + "github.com/smartcontractkit/chainlink/deployment/ccip/shared/stateview" - "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" ) @@ -68,7 +69,7 @@ type OrchestrateChangesetsConfig struct { ChangeSets []WithConfig } -func (c OrchestrateChangesetsConfig) EVMMCMSStateByChain(e cldf.Environment, s stateview.CCIPOnChainState) (map[uint64]state.MCMSWithTimelockState, error) { +func (c OrchestrateChangesetsConfig) EVMMCMSStateByChain(e cldf.Environment, s stateview.CCIPOnChainState) (map[uint64]evmstate.MCMSWithTimelockState, error) { if c.MCMSOverridesForEVMChains == nil { return s.EVMMCMSStateByChain(), nil } @@ -100,7 +101,7 @@ func (c OrchestrateChangesetsConfig) EVMMCMSStateByChain(e cldf.Environment, s s return nil, fmt.Errorf("failed to create ManyChainMultiSig for ProposerMcm on chain %s: %w", chain, err) } } - evmState[chainSelector] = state.MCMSWithTimelockState{ + evmState[chainSelector] = evmstate.MCMSWithTimelockState{ CancellerMcm: cancellerMcm, BypasserMcm: bypasserMcm, ProposerMcm: proposerMcm, diff --git a/deployment/ccip/shared/deployergroup/deployer_group.go b/deployment/ccip/shared/deployergroup/deployer_group.go index 4d71bc76992..a5a5baea7ee 100644 --- a/deployment/ccip/shared/deployergroup/deployer_group.go +++ b/deployment/ccip/shared/deployergroup/deployer_group.go @@ -8,6 +8,7 @@ import ( "slices" "strings" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" "golang.org/x/sync/errgroup" cldfproposalutils "github.com/smartcontractkit/chainlink-deployments-framework/engine/cld/mcms/proposalutils" @@ -587,5 +588,5 @@ func addressForChain(e cldf.Environment, selector uint64) (map[string]cldf.TypeA } func addressForChainFromDatastore(e cldf.Environment, selector uint64, qualifier string) (map[string]cldf.TypeAndVersion, error) { - return state.LoadAddressesFromDataStore(e.DataStore, selector, qualifier) + return evmstate.LoadAddressesFromDataStore(e.DataStore, selector, qualifier) //nolint:staticcheck // will be refactored once usages are removed } diff --git a/deployment/ccip/shared/deployergroup/deployer_group_test.go b/deployment/ccip/shared/deployergroup/deployer_group_test.go index b47a377c747..e22ecf5ddbd 100644 --- a/deployment/ccip/shared/deployergroup/deployer_group_test.go +++ b/deployment/ccip/shared/deployergroup/deployer_group_test.go @@ -8,6 +8,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" chain_selectors "github.com/smartcontractkit/chain-selectors" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" "github.com/stretchr/testify/require" "k8s.io/utils/ptr" @@ -23,7 +24,6 @@ import ( "github.com/smartcontractkit/chainlink/deployment/ccip/shared/deployergroup" "github.com/smartcontractkit/chainlink/deployment/ccip/shared/stateview" commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset" - commonstate "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" commontypes "github.com/smartcontractkit/chainlink/deployment/common/types" ) @@ -335,7 +335,7 @@ func TestDeployerGroupWithTimelockAddressQualifier(t *testing.T) { // Delete the newly deployed MCMS addresses from addressbook so that the state loader does not pick them up // otherwise the mcms state will throw an error for duplicate MCMS contracts addressBookToDelete := cldf.NewMemoryAddressBook() - addressesToDelete, err := commonstate.LoadAddressesFromDataStore(e.Env.DataStore, chain, linktokenOwnerQualifier) + addressesToDelete, err := evmstate.LoadAddressesFromDataStore(e.Env.DataStore, chain, linktokenOwnerQualifier) //nolint:staticcheck // will be refactored once usages are removed require.NoError(t, err) for addr, tv := range addressesToDelete { require.NoError(t, addressBookToDelete.Save(chain, addr, tv)) diff --git a/deployment/ccip/shared/stateview/evm/state.go b/deployment/ccip/shared/stateview/evm/state.go index e712e433c7e..7923151acac 100644 --- a/deployment/ccip/shared/stateview/evm/state.go +++ b/deployment/ccip/shared/stateview/evm/state.go @@ -12,6 +12,7 @@ import ( "github.com/smartcontractkit/ccip-contract-examples/chains/evm/gobindings/generated/1_6_1/proxy_admin" "github.com/smartcontractkit/ccip-contract-examples/chains/evm/gobindings/generated/1_6_1/token_governor" "github.com/smartcontractkit/ccip-contract-examples/chains/evm/gobindings/generated/1_6_1/transparent_upgradeable_proxy" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" "golang.org/x/sync/errgroup" chain_selectors "github.com/smartcontractkit/chain-selectors" @@ -83,7 +84,6 @@ import ( "github.com/smartcontractkit/chainlink/deployment/ccip/view/v1_5_1" "github.com/smartcontractkit/chainlink/deployment/ccip/view/v1_6" "github.com/smartcontractkit/chainlink/deployment/ccip/view/v1_6_1" - "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" v1_1 "github.com/smartcontractkit/chainlink/deployment/common/view/v1_0" "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/types" ) @@ -91,9 +91,9 @@ import ( // CCIPChainState holds a Go binding for all the currently deployed CCIP contracts // on a chain. If a binding is nil, it means there is no such contract on the chain. type CCIPChainState struct { - state.MCMSWithTimelockState - state.LinkTokenState - state.StaticLinkTokenState + evmstate.MCMSWithTimelockState + evmstate.LinkTokenState + evmstate.StaticLinkTokenState ABIByAddress map[string]string OnRamp onramp.OnRampInterface OffRamp offramp.OffRampInterface diff --git a/deployment/ccip/shared/stateview/state.go b/deployment/ccip/shared/stateview/state.go index e35224532b1..08cc82c16e7 100644 --- a/deployment/ccip/shared/stateview/state.go +++ b/deployment/ccip/shared/stateview/state.go @@ -19,6 +19,7 @@ import ( "github.com/smartcontractkit/ccip-contract-examples/chains/evm/gobindings/generated/1_6_1/transparent_upgradeable_proxy" "github.com/smartcontractkit/ccip-owner-contracts/pkg/gethwrappers" chain_selectors "github.com/smartcontractkit/chain-selectors" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" "golang.org/x/exp/maps" "golang.org/x/sync/errgroup" @@ -377,11 +378,11 @@ func (c CCIPOnChainState) HomeChainSelector() (uint64, error) { return 0, errors.New("no home chain found") } -func (c CCIPOnChainState) EVMMCMSStateByChain() map[uint64]commonstate.MCMSWithTimelockState { - mcmsStateByChain := make(map[uint64]commonstate.MCMSWithTimelockState) +func (c CCIPOnChainState) EVMMCMSStateByChain() map[uint64]evmstate.MCMSWithTimelockState { + mcmsStateByChain := make(map[uint64]evmstate.MCMSWithTimelockState) for _, chainSelector := range c.EVMChains() { chain := c.MustGetEVMChainState(chainSelector) - mcmsStateByChain[chainSelector] = commonstate.MCMSWithTimelockState{ + mcmsStateByChain[chainSelector] = evmstate.MCMSWithTimelockState{ CancellerMcm: chain.CancellerMcm, BypasserMcm: chain.BypasserMcm, ProposerMcm: chain.ProposerMcm, @@ -994,7 +995,7 @@ func (c CCIPOnChainState) GetEVMChainState(env cldf.Environment, chainSelector u } func (c CCIPOnChainState) UpdateMCMSStateWithAddressFromDatastoreForChain(e cldf.Environment, selector uint64, qualifier string) error { - mcmsStateWithQualifier, err := commonstate.MaybeLoadMCMSWithTimelockStateDataStoreWithQualifier(e, []uint64{selector}, qualifier) + mcmsStateWithQualifier, err := evmstate.MaybeLoadMCMSWithTimelockStateDataStoreWithQualifier(e, []uint64{selector}, qualifier) if err != nil { return fmt.Errorf("failed to load mcms state from datastore with qualifier %s: %w", qualifier, err) } @@ -1088,18 +1089,18 @@ func LoadChainState(ctx context.Context, chain cldf_evm.Chain, addresses map[str } var state evm.CCIPChainState - mcmsWithTimelock, err := commonstate.MaybeLoadMCMSWithTimelockChainState(chain, addresses) + mcmsWithTimelock, err := evmstate.MaybeLoadMCMSWithTimelockChainState(chain, addresses) if err != nil { return state, err } state.MCMSWithTimelockState = *mcmsWithTimelock - linkState, err := commonstate.MaybeLoadLinkTokenChainState(chain, addresses) + linkState, err := evmstate.MaybeLoadLinkTokenChainState(chain, addresses) if err != nil { return state, err } state.LinkTokenState = *linkState - staticLinkState, err := commonstate.MaybeLoadStaticLinkTokenState(chain, addresses) + staticLinkState, err := evmstate.MaybeLoadStaticLinkTokenState(chain, addresses) if err != nil { return state, err } @@ -1788,7 +1789,7 @@ func ValidateChain(env cldf.Environment, state CCIPOnChainState, chainSel uint64 return fmt.Errorf("%s does not exist in state", chain) } if mcmsCfg != nil { - err = mcmsCfg.Validate(chain, commonstate.MCMSWithTimelockState{ + err = mcmsCfg.Validate(chain, evmstate.MCMSWithTimelockState{ CancellerMcm: chainState.CancellerMcm, ProposerMcm: chainState.ProposerMcm, BypasserMcm: chainState.BypasserMcm, diff --git a/deployment/ccip/view/view.go b/deployment/ccip/view/view.go index 4696ca4bde0..468e44356bc 100644 --- a/deployment/ccip/view/view.go +++ b/deployment/ccip/view/view.go @@ -9,6 +9,8 @@ import ( linkviewv10 "github.com/smartcontractkit/cld-changesets/pkg/contract/link/view/v1_0" + mcmsv10 "github.com/smartcontractkit/cld-changesets/pkg/contract/mcms/view/v1_0" + "github.com/smartcontractkit/chainlink/deployment/ccip/view/aptos" "github.com/smartcontractkit/chainlink/deployment/ccip/view/shared" "github.com/smartcontractkit/chainlink/deployment/ccip/view/solana" @@ -53,7 +55,7 @@ type ChainView struct { // be more than one per env. CCIPHome map[string]v1_6.CCIPHomeView `json:"ccipHome,omitempty"` CapabilityRegistry map[string]common_v1_0.CapabilityRegistryView `json:"capabilityRegistry,omitempty"` - MCMSWithTimelock common_v1_0.MCMSWithTimelockView `json:"mcmsWithTimelock"` + MCMSWithTimelock mcmsv10.MCMSWithTimelockView `json:"mcmsWithTimelock"` LinkToken linkviewv10.LinkTokenView `json:"linkToken"` StaticLinkToken linkviewv10.StaticLinkTokenView `json:"staticLinkToken"` @@ -83,7 +85,7 @@ func NewChain() ChainView { OffRamp: make(map[string]v1_6.OffRampView), CapabilityRegistry: make(map[string]common_v1_0.CapabilityRegistryView), CCIPHome: make(map[string]v1_6.CCIPHomeView), - MCMSWithTimelock: common_v1_0.MCMSWithTimelockView{}, + MCMSWithTimelock: mcmsv10.MCMSWithTimelockView{}, LinkToken: linkviewv10.LinkTokenView{}, StaticLinkToken: linkviewv10.StaticLinkTokenView{}, UpdateMu: &sync.Mutex{}, diff --git a/deployment/common/changeset/deploy_link_token_test.go b/deployment/common/changeset/deploy_link_token_test.go index 95b5fb80d50..6fac75c267f 100644 --- a/deployment/common/changeset/deploy_link_token_test.go +++ b/deployment/common/changeset/deploy_link_token_test.go @@ -4,6 +4,7 @@ import ( "testing" chain_selectors "github.com/smartcontractkit/chain-selectors" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" @@ -13,7 +14,6 @@ import ( "github.com/smartcontractkit/chainlink-deployments-framework/engine/test/runtime" "github.com/smartcontractkit/chainlink/deployment/common/changeset" - commonState "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" ) func TestDeployLinkToken(t *testing.T) { @@ -35,7 +35,7 @@ func TestDeployLinkToken(t *testing.T) { addrs, err := rt.State().AddressBook.AddressesForChain(selector) require.NoError(t, err) - state, err := commonState.MaybeLoadLinkTokenChainState(chain, addrs) + state, err := evmstate.MaybeLoadLinkTokenChainState(chain, addrs) require.NoError(t, err) // View itself already unit tested @@ -65,7 +65,7 @@ func TestDeployLinkTokenZk(t *testing.T) { addrs, err := rt.State().AddressBook.AddressesForChain(selector) require.NoError(t, err) - state, err := commonState.MaybeLoadLinkTokenChainState(chain, addrs) + state, err := evmstate.MaybeLoadLinkTokenChainState(chain, addrs) require.NoError(t, err) // View itself already unit tested diff --git a/deployment/common/changeset/deploy_mcms_with_timelock.go b/deployment/common/changeset/deploy_mcms_with_timelock.go index 56dedac3d74..0c9877a534f 100644 --- a/deployment/common/changeset/deploy_mcms_with_timelock.go +++ b/deployment/common/changeset/deploy_mcms_with_timelock.go @@ -8,6 +8,7 @@ import ( "sync" "github.com/ethereum/go-ethereum/accounts/abi/bind" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" xerrgroup "golang.org/x/sync/errgroup" cldfproposalutils "github.com/smartcontractkit/chainlink-deployments-framework/engine/cld/mcms/proposalutils" @@ -23,7 +24,6 @@ import ( evminternal "github.com/smartcontractkit/chainlink/deployment/common/changeset/evm/mcms" solanaMCMS "github.com/smartcontractkit/chainlink/deployment/common/changeset/solana/mcms" - "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" "github.com/smartcontractkit/chainlink/deployment/common/opsutils" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" "github.com/smartcontractkit/chainlink/deployment/common/types" @@ -124,8 +124,8 @@ func DeployMCMSWithTimelockV2( // load mcms state with qualifier awareness // we load the state one by one to avoid early return from MaybeLoadMCMSWithTimelockStateWithQualifier // due to one of the chain not found - var chainstate *state.MCMSWithTimelockState - s, err := state.MaybeLoadMCMSWithTimelockStateWithQualifier(env, []uint64{chainSel}, qualifier) + var chainstate *evmstate.MCMSWithTimelockState + s, err := evmstate.MaybeLoadMCMSWithTimelockStateWithQualifier(env, []uint64{chainSel}, qualifier) if err != nil { // if the state is not found for chain, we assume it's a fresh deployment // this includes "no addresses found" which is expected for new qualifiers @@ -210,14 +210,14 @@ func grantRolePreconditions(e cldf.Environment, cfg GrantRoleInput) error { } // loads MCMS state for each chain using per-chain qualifiers from cfg.MCMS.TimelockQualifierPerChain when available -func loadMCMSStatePerChainWithQualifier(e cldf.Environment, cfg GrantRoleInput) (map[uint64]*state.MCMSWithTimelockState, error) { - result := make(map[uint64]*state.MCMSWithTimelockState) +func loadMCMSStatePerChainWithQualifier(e cldf.Environment, cfg GrantRoleInput) (map[uint64]*evmstate.MCMSWithTimelockState, error) { + result := make(map[uint64]*evmstate.MCMSWithTimelockState) for selector := range cfg.ExistingProposerByChain { qualifier := "" if cfg.MCMS != nil && cfg.MCMS.TimelockQualifierPerChain != nil { qualifier = cfg.MCMS.TimelockQualifierPerChain[selector] } - chainState, err := state.MaybeLoadMCMSWithTimelockStateWithQualifier(e, []uint64{selector}, qualifier) + chainState, err := evmstate.MaybeLoadMCMSWithTimelockStateWithQualifier(e, []uint64{selector}, qualifier) if err != nil { return nil, err } @@ -231,7 +231,7 @@ func grantRoleLogic(e cldf.Environment, cfg GrantRoleInput) (cldf.ChangesetOutpu if err != nil { return cldf.ChangesetOutput{}, err } - mcmsStateForProposal := make(map[uint64]state.MCMSWithTimelockState) + mcmsStateForProposal := make(map[uint64]evmstate.MCMSWithTimelockState) for k, v := range mcmsState { if v != nil { // Replace the proposer MCM in state with the existing proposer. @@ -244,7 +244,7 @@ func grantRoleLogic(e cldf.Environment, cfg GrantRoleInput) (cldf.ChangesetOutpu return cldf.ChangesetOutput{}, fmt.Errorf("failed to create ManyChainMultiSig for existing proposer %s on chain %d: %w", cfg.ExistingProposerByChain[k].Hex(), k, err) } - mcmsStateForProposal[k] = state.MCMSWithTimelockState{ + mcmsStateForProposal[k] = evmstate.MCMSWithTimelockState{ CancellerMcm: v.CancellerMcm, BypasserMcm: v.BypasserMcm, ProposerMcm: existingProposerMcm, diff --git a/deployment/common/changeset/deploy_mcms_with_timelock_test.go b/deployment/common/changeset/deploy_mcms_with_timelock_test.go index 82d715a95ca..e7e147f20a8 100644 --- a/deployment/common/changeset/deploy_mcms_with_timelock_test.go +++ b/deployment/common/changeset/deploy_mcms_with_timelock_test.go @@ -10,6 +10,7 @@ import ( "github.com/gagliardetto/solana-go" "github.com/google/go-cmp/cmp" chain_selectors "github.com/smartcontractkit/chain-selectors" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" mcmsevmsdk "github.com/smartcontractkit/mcms/sdk/evm" mcmssolanasdk "github.com/smartcontractkit/mcms/sdk/solana" mcmstypes "github.com/smartcontractkit/mcms/types" @@ -54,7 +55,7 @@ func TestGrantRoleInTimeLock(t *testing.T) { ) updatedEnv, err := commonchangeset.Apply(t, *env, configuredChangeset) require.NoError(t, err) - mcmsState, err := mcmschangesetstate.MaybeLoadMCMSWithTimelockState(updatedEnv, []uint64{selector}) + mcmsState, err := evmstate.MaybeLoadMCMSWithTimelockState(updatedEnv, []uint64{selector}) require.NoError(t, err) // change the environment to remove proposer from the timelock, so that we can deploy new proposer @@ -96,7 +97,7 @@ func TestGrantRoleInTimeLock(t *testing.T) { // now deploy MCMS again so that only the proposer is new updatedEnv, err = commonchangeset.Apply(t, updatedEnv, configuredChangeset) require.NoError(t, err) - mcmsState, err = mcmschangesetstate.MaybeLoadMCMSWithTimelockState(updatedEnv, []uint64{selector}) + mcmsState, err = evmstate.MaybeLoadMCMSWithTimelockState(updatedEnv, []uint64{selector}) require.NoError(t, err) require.NotEqual(t, existingProposer.Address(), mcmsState[selector].ProposerMcm.Address()) @@ -110,7 +111,7 @@ func TestGrantRoleInTimeLock(t *testing.T) { }, )) require.NoError(t, err) - mcmsState, err = mcmschangesetstate.MaybeLoadMCMSWithTimelockState(updatedEnv, []uint64{selector}) + mcmsState, err = evmstate.MaybeLoadMCMSWithTimelockState(updatedEnv, []uint64{selector}) require.NoError(t, err) evmTimelockInspector := mcmsevmsdk.NewTimelockInspector(updatedEnv.BlockChains.EVMChains()[selector].Client) @@ -220,7 +221,7 @@ func TestDeployMCMSWithTimelockV2WithFewExistingContracts(t *testing.T) { ) require.NoError(t, err) - state, err := mcmschangesetstate.MaybeLoadMCMSWithTimelockState(rt.Environment(), selectors) + state, err := evmstate.MaybeLoadMCMSWithTimelockState(rt.Environment(), selectors) require.NoError(t, err) evmState1 := state[selector1] @@ -349,7 +350,7 @@ func TestDeployMCMSWithTimelockV2(t *testing.T) { require.NoError(t, err) // Load the MCMS contractsstate - evmMCMSState, err := mcmschangesetstate.MaybeLoadMCMSWithTimelockState(rt.Environment(), []uint64{evmSelector}) + evmMCMSState, err := evmstate.MaybeLoadMCMSWithTimelockState(rt.Environment(), []uint64{evmSelector}) require.NoError(t, err) require.Len(t, evmMCMSState, 1) diff --git a/deployment/common/changeset/evm/mcms/mcms.go b/deployment/common/changeset/evm/mcms/mcms.go index 2f6c2ac3c50..2192d620314 100644 --- a/deployment/common/changeset/evm/mcms/mcms.go +++ b/deployment/common/changeset/evm/mcms/mcms.go @@ -11,6 +11,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" "github.com/spf13/cast" bindings "github.com/smartcontractkit/ccip-owner-contracts/pkg/gethwrappers" @@ -28,7 +29,6 @@ import ( "github.com/smartcontractkit/chainlink/deployment/common/changeset/evm/mcms/ops" "github.com/smartcontractkit/chainlink/deployment/common/changeset/evm/mcms/seqs" mcmsnew_zksync "github.com/smartcontractkit/chainlink/deployment/common/changeset/internal/evm/zksync" - "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" "github.com/smartcontractkit/chainlink/deployment/common/opsutils" commontypes "github.com/smartcontractkit/chainlink/deployment/common/types" "github.com/smartcontractkit/chainlink/deployment/common/view/v1_0" @@ -127,7 +127,7 @@ func DeployMCMSWithTimelockContractsEVM( chain cldf_evm.Chain, ab cldf.AddressBook, config commontypes.MCMSWithTimelockConfigV2, - state *state.MCMSWithTimelockState, + state *evmstate.MCMSWithTimelockState, ) ([]operations.Report[any, any], error) { execReports := make([]operations.Report[any, any], 0) lggr := env.Logger diff --git a/deployment/common/changeset/evm/mcms/mcms_test.go b/deployment/common/changeset/evm/mcms/mcms_test.go index 95ff6059f35..c834d625032 100644 --- a/deployment/common/changeset/evm/mcms/mcms_test.go +++ b/deployment/common/changeset/evm/mcms/mcms_test.go @@ -5,6 +5,7 @@ import ( "testing" chainsel "github.com/smartcontractkit/chain-selectors" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" "github.com/stretchr/testify/require" cldftesthelpers "github.com/smartcontractkit/chainlink-deployments-framework/engine/cld/mcms/proposalutils/testhelpers" @@ -15,7 +16,6 @@ import ( "github.com/smartcontractkit/chainlink-deployments-framework/engine/test/onchain" evminternal "github.com/smartcontractkit/chainlink/deployment/common/changeset/evm/mcms" - "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" "github.com/smartcontractkit/chainlink/deployment/common/types" "github.com/smartcontractkit/chainlink/v2/core/logger" @@ -84,7 +84,7 @@ func TestDeployMCMSWithTimelockContracts(t *testing.T) { require.NoError(t, err) require.Len(t, addresses, 5) - mcmsState, err := state.MaybeLoadMCMSWithTimelockChainState(chain, addresses) + mcmsState, err := evmstate.MaybeLoadMCMSWithTimelockChainState(chain, addresses) require.NoError(t, err) v, err := mcmsState.GenerateMCMSWithTimelockView() diff --git a/deployment/common/changeset/mcms_firedrill.go b/deployment/common/changeset/mcms_firedrill.go index 727d60cbe6a..801f935e517 100644 --- a/deployment/common/changeset/mcms_firedrill.go +++ b/deployment/common/changeset/mcms_firedrill.go @@ -5,6 +5,7 @@ import ( "github.com/gagliardetto/solana-go" chainsel "github.com/smartcontractkit/chain-selectors" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" "github.com/smartcontractkit/mcms" mcmsevmsdk "github.com/smartcontractkit/mcms/sdk/evm" mcmssolanasdk "github.com/smartcontractkit/mcms/sdk/solana" @@ -35,7 +36,7 @@ func buildNoOPEVM(e cldf.Environment, selector uint64) (mcmstypes.Transaction, e if err != nil { return mcmstypes.Transaction{}, err } - state, err := state.MaybeLoadMCMSWithTimelockChainState(chain, addresses) + state, err := evmstate.MaybeLoadMCMSWithTimelockChainState(chain, addresses) if err != nil { return mcmstypes.Transaction{}, err } @@ -102,7 +103,7 @@ func MCMSSignFireDrillChangeset(e cldf.Environment, cfg FireDrillConfig) (cldf.C if err != nil { return cldf.ChangesetOutput{}, err } - state, err := state.MaybeLoadMCMSWithTimelockChainState(e.BlockChains.EVMChains()[selector], addresses) + state, err := evmstate.MaybeLoadMCMSWithTimelockChainState(e.BlockChains.EVMChains()[selector], addresses) if err != nil { return cldf.ChangesetOutput{}, err } diff --git a/deployment/common/changeset/set_config_mcms.go b/deployment/common/changeset/set_config_mcms.go index e10836909e1..9dc427f2024 100644 --- a/deployment/common/changeset/set_config_mcms.go +++ b/deployment/common/changeset/set_config_mcms.go @@ -11,6 +11,7 @@ import ( solanasdk "github.com/gagliardetto/solana-go" "github.com/smartcontractkit/ccip-owner-contracts/pkg/gethwrappers" chain_selectors "github.com/smartcontractkit/chain-selectors" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" mcmslib "github.com/smartcontractkit/mcms" aptosmcms "github.com/smartcontractkit/mcms/sdk/aptos" "github.com/smartcontractkit/mcms/sdk/evm" @@ -72,7 +73,7 @@ func (cfg MCMSConfigV2) Validate(e cldf.Environment, selectors []uint64) error { if cfg.ProposalConfig != nil { qualifier = cfg.ProposalConfig.TimelockQualifierPerChain[chainSelector] } - state, err := commonState.MaybeLoadMCMSWithTimelockStateWithQualifier(e, []uint64{chainSelector}, qualifier) + state, err := evmstate.MaybeLoadMCMSWithTimelockStateWithQualifier(e, []uint64{chainSelector}, qualifier) if err != nil { return err } @@ -153,7 +154,7 @@ type setConfigTxs struct { } // setConfigPerRoleV2 sets the configuration for each of the MCMS contract roles on the mcmsState. -func setConfigPerRoleV2(ctx context.Context, lggr logger.Logger, chain cldf_evm.Chain, cfg ConfigPerRoleV2, mcmsState *commonState.MCMSWithTimelockState, useMCMS bool) (setConfigTxs, error) { +func setConfigPerRoleV2(ctx context.Context, lggr logger.Logger, chain cldf_evm.Chain, cfg ConfigPerRoleV2, mcmsState *evmstate.MCMSWithTimelockState, useMCMS bool) (setConfigTxs, error) { var proposerTx, cancellerTx, bypasserTx *types.Transaction var err error @@ -223,7 +224,7 @@ func SetConfigMCMSV2(e cldf.Environment, cfg MCMSConfigV2) (cldf.ChangesetOutput if cfg.ProposalConfig != nil { qualifier = cfg.ProposalConfig.TimelockQualifierPerChain[chainSelector] } - mcmsStatePerChain, err := commonState.MaybeLoadMCMSWithTimelockStateWithQualifier(e, []uint64{chainSelector}, qualifier) + mcmsStatePerChain, err := evmstate.MaybeLoadMCMSWithTimelockStateWithQualifier(e, []uint64{chainSelector}, qualifier) if err != nil { return cldf.ChangesetOutput{}, err } @@ -275,7 +276,7 @@ func SetConfigMCMSV2(e cldf.Environment, cfg MCMSConfigV2) (cldf.ChangesetOutput return cldf.ChangesetOutput{}, nil } -func addTxsToProposalBatchV2(setConfigTxsChain setConfigTxs, chainSelector uint64, state commonState.MCMSWithTimelockState) mcmstypes.BatchOperation { +func addTxsToProposalBatchV2(setConfigTxsChain setConfigTxs, chainSelector uint64, state evmstate.MCMSWithTimelockState) mcmstypes.BatchOperation { result := mcmstypes.BatchOperation{ ChainSelector: mcmstypes.ChainSelector(chainSelector), Transactions: []mcmstypes.Transaction{}, diff --git a/deployment/common/changeset/set_config_mcms_test.go b/deployment/common/changeset/set_config_mcms_test.go index 92d74d1d2be..199ab6b24f6 100644 --- a/deployment/common/changeset/set_config_mcms_test.go +++ b/deployment/common/changeset/set_config_mcms_test.go @@ -9,6 +9,7 @@ import ( "github.com/ethereum/go-ethereum/crypto" solanago "github.com/gagliardetto/solana-go" chain_selectors "github.com/smartcontractkit/chain-selectors" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" "github.com/smartcontractkit/mcms/sdk/evm" "github.com/smartcontractkit/mcms/sdk/solana" mcmstypes "github.com/smartcontractkit/mcms/types" @@ -552,7 +553,7 @@ func TestSetConfigMCMSV2WithTimelockQualifier(t *testing.T) { require.NoError(t, err) // Load state via the CLLCCIP qualifier to build a valid proposer config - cllccipState, err := state.MaybeLoadMCMSWithTimelockStateWithQualifier(rt.Environment(), []uint64{selector}, cllccipQualifier) + cllccipState, err := evmstate.MaybeLoadMCMSWithTimelockStateWithQualifier(rt.Environment(), []uint64{selector}, cllccipQualifier) require.NoError(t, err) require.NotNil(t, cllccipState[selector]) diff --git a/deployment/common/changeset/state.go b/deployment/common/changeset/state.go index a2de74f8f90..0fbe79a5a9c 100644 --- a/deployment/common/changeset/state.go +++ b/deployment/common/changeset/state.go @@ -7,6 +7,7 @@ import ( "github.com/ethereum/go-ethereum/common" owner_helpers "github.com/smartcontractkit/ccip-owner-contracts/pkg/gethwrappers" linkviewv10 "github.com/smartcontractkit/cld-changesets/pkg/contract/link/view/v1_0" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/link_token_interface" "github.com/smartcontractkit/chainlink-evm/gethwrappers/shared/generated/initial/link_token" @@ -16,7 +17,6 @@ import ( cldfproposalutils "github.com/smartcontractkit/chainlink-deployments-framework/engine/cld/mcms/proposalutils" "github.com/smartcontractkit/chainlink/deployment" - "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" "github.com/smartcontractkit/chainlink/deployment/common/types" "github.com/smartcontractkit/chainlink/deployment/common/view/v1_0" ) @@ -297,7 +297,7 @@ func MaybeLoadStaticLinkTokenState(chain cldf_evm.Chain, addresses map[string]cl // Returns the address if found in either source func SearchAddress(e cldf.Environment, chainSelector uint64, address string) (bool, error) { // Use the merged address loading from the EVM state function - addressesChain, err := state.AddressesForChain(e, chainSelector, "") + addressesChain, err := evmstate.AddressesForChain(e, chainSelector, "") if err != nil { return false, fmt.Errorf("failed to load addresses: %w", err) } diff --git a/deployment/common/changeset/state/evm_test.go b/deployment/common/changeset/state/evm_test.go deleted file mode 100644 index 8a965f75e72..00000000000 --- a/deployment/common/changeset/state/evm_test.go +++ /dev/null @@ -1,545 +0,0 @@ -package state - -import ( - "encoding/json" - "fmt" - "math/big" - "strings" - "testing" - - "github.com/ethereum/go-ethereum/common" - bindings "github.com/smartcontractkit/ccip-owner-contracts/pkg/gethwrappers" - chain_selectors "github.com/smartcontractkit/chain-selectors" - "github.com/smartcontractkit/mcms/sdk" - mcmstypes "github.com/smartcontractkit/mcms/types" - "github.com/stretchr/testify/require" - - cldf_evm "github.com/smartcontractkit/chainlink-deployments-framework/chain/evm" - "github.com/smartcontractkit/chainlink-deployments-framework/engine/test/environment" - - "github.com/smartcontractkit/chainlink-deployments-framework/datastore" - cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" - "github.com/smartcontractkit/chainlink/deployment" - "github.com/smartcontractkit/chainlink/deployment/common/types" -) - -func TestMCMSWithTimelockState_GenerateMCMSWithTimelockViewV2(t *testing.T) { - selector := chain_selectors.TEST_90000001.Selector - env, err := environment.New(t.Context(), - environment.WithEVMSimulated(t, []uint64{selector}), - ) - require.NoError(t, err) - - chain := env.BlockChains.EVMChains()[selector] - - proposerMcm := deployMCMEvm(t, chain, &mcmstypes.Config{Quorum: 1, Signers: []common.Address{ - common.HexToAddress("0x0000000000000000000000000000000000000001"), - }}) - cancellerMcm := deployMCMEvm(t, chain, &mcmstypes.Config{Quorum: 1, Signers: []common.Address{ - common.HexToAddress("0x0000000000000000000000000000000000000002"), - }}) - bypasserMcm := deployMCMEvm(t, chain, &mcmstypes.Config{Quorum: 1, Signers: []common.Address{ - common.HexToAddress("0x0000000000000000000000000000000000000003"), - }}) - timelock := deployTimelockEvm(t, chain, big.NewInt(1), - common.HexToAddress("0x0000000000000000000000000000000000000004"), - []common.Address{common.HexToAddress("0x0000000000000000000000000000000000000005")}, - []common.Address{common.HexToAddress("0x0000000000000000000000000000000000000006")}, - []common.Address{common.HexToAddress("0x0000000000000000000000000000000000000007")}, - []common.Address{common.HexToAddress("0x0000000000000000000000000000000000000008")}, - ) - callProxy := deployCallProxyEvm(t, chain, - common.HexToAddress("0x0000000000000000000000000000000000000009")) - - tests := []struct { - name string - contracts *MCMSWithTimelockState - want string - wantErr string - }{ - { - name: "success", - contracts: &MCMSWithTimelockState{ - ProposerMcm: proposerMcm, - CancellerMcm: cancellerMcm, - BypasserMcm: bypasserMcm, - Timelock: timelock, - CallProxy: callProxy, - }, - want: fmt.Sprintf(`{ - "proposer": { - "address": "%s", - "owner": "%s", - "config": { - "quorum": 1, - "signers": ["0x0000000000000000000000000000000000000001"], - "groupSigners": [] - } - }, - "canceller": { - "address": "%s", - "owner": "%s", - "config": { - "quorum": 1, - "signers": ["0x0000000000000000000000000000000000000002"], - "groupSigners": [] - } - }, - "bypasser": { - "address": "%s", - "owner": "%s", - "config": { - "quorum": 1, - "signers": ["0x0000000000000000000000000000000000000003"], - "groupSigners": [] - } - }, - "timelock": { - "address": "%s", - "owner": "0x0000000000000000000000000000000000000000", - "membersByRole": { - "ADMIN_ROLE": [ "0x0000000000000000000000000000000000000004" ], - "PROPOSER_ROLE": [ "0x0000000000000000000000000000000000000005" ], - "EXECUTOR_ROLE": [ "0x0000000000000000000000000000000000000006" ], - "CANCELLER_ROLE": [ "0x0000000000000000000000000000000000000007" ], - "BYPASSER_ROLE": [ "0x0000000000000000000000000000000000000008" ] - } - }, - "callProxy": { - "address": "%s", - "owner": "0x0000000000000000000000000000000000000000" - } - }`, evmAddr(proposerMcm.Address()), evmAddr(chain.DeployerKey.From), - evmAddr(cancellerMcm.Address()), evmAddr(chain.DeployerKey.From), - evmAddr(bypasserMcm.Address()), evmAddr(chain.DeployerKey.From), - evmAddr(timelock.Address()), evmAddr(callProxy.Address())), - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - state := tt.contracts - - got, err := state.GenerateMCMSWithTimelockView() - - if tt.wantErr == "" { - require.NoError(t, err) - require.JSONEq(t, tt.want, toJSON(t, &got)) - } else { - require.ErrorContains(t, err, tt.wantErr) - } - }) - } -} - -func TestAddressesForChain(t *testing.T) { - chainSelector := chain_selectors.ETHEREUM_MAINNET.Selector - - t.Run("environment with AddressBook only", func(t *testing.T) { - // Create environment with only AddressBook - addressBook := cldf.NewMemoryAddressBook() - err := addressBook.Save(chainSelector, "0x1234567890123456789012345678901234567890", - cldf.NewTypeAndVersion(types.LinkToken, deployment.Version1_0_0)) - require.NoError(t, err) - - env := cldf.Environment{ - ExistingAddresses: addressBook, - DataStore: nil, // No DataStore - } - - // Test the merge function - mergedAddresses, err := AddressesForChain(env, chainSelector, "") - require.NoError(t, err) - - // Should have address from AddressBook only - require.Len(t, mergedAddresses, 1) - require.Contains(t, mergedAddresses, "0x1234567890123456789012345678901234567890") - }) - - t.Run("environment with DataStore only", func(t *testing.T) { - // Create environment with only DataStore - dataStore := datastore.NewMemoryDataStore() - err := dataStore.Addresses().Add(datastore.AddressRef{ - ChainSelector: chainSelector, - Address: "0xABCDEF1234567890123456789012345678901234", - Type: datastore.ContractType(types.RBACTimelock), - Version: &deployment.Version1_0_0, - }) - require.NoError(t, err) - - addressBook := cldf.NewMemoryAddressBook() - - env := cldf.Environment{ - ExistingAddresses: addressBook, - DataStore: dataStore.Seal(), - } - - // Test the merge function - mergedAddresses, err := AddressesForChain(env, chainSelector, "") - require.NoError(t, err) - - // Should have address from DataStore only - require.Len(t, mergedAddresses, 1) - require.Contains(t, mergedAddresses, "0xABCDEF1234567890123456789012345678901234") - }) - t.Run("environment with AddressBook and DataStore without qualifier", func(t *testing.T) { - // Create a mock environment with both AddressBook and DataStore - addressBook := cldf.NewMemoryAddressBook() - err := addressBook.Save(chainSelector, "0x1234567890123456789012345678901234567890", - cldf.NewTypeAndVersion(types.LinkToken, deployment.Version1_0_0)) - require.NoError(t, err) - - dataStore := datastore.NewMemoryDataStore() - err = dataStore.Addresses().Add(datastore.AddressRef{ - ChainSelector: chainSelector, - Address: "0xABCDEF1234567890123456789012345678901234", - Type: datastore.ContractType(types.RBACTimelock), - Version: &deployment.Version1_0_0, - Labels: datastore.NewLabelSet( - "team:core", - "environment:production", - "role:timelock", - ), - }) - require.NoError(t, err) - - env := cldf.Environment{ - ExistingAddresses: addressBook, - DataStore: dataStore.Seal(), - } - - // Test the merge function - mergedAddresses, err := AddressesForChain(env, chainSelector, "") - require.NoError(t, err) - - // Should have addresses from both sources - require.Len(t, mergedAddresses, 2) - require.Contains(t, mergedAddresses, "0x1234567890123456789012345678901234567890") - require.Contains(t, mergedAddresses, "0xABCDEF1234567890123456789012345678901234") - - // Verify that types are correctly preserved - linkTokenTV := mergedAddresses["0x1234567890123456789012345678901234567890"] - require.Equal(t, types.LinkToken, linkTokenTV.Type) - require.Equal(t, deployment.Version1_0_0, linkTokenTV.Version) - - timelockTV := mergedAddresses["0xABCDEF1234567890123456789012345678901234"] - require.Equal(t, types.RBACTimelock, timelockTV.Type) - require.Equal(t, deployment.Version1_0_0, timelockTV.Version) - - // Verify labels are preserved in DataStore - refs := env.DataStore.Addresses().Filter(datastore.AddressRefByChainSelector(chainSelector)) - require.Len(t, refs, 1) - - timelockRef := refs[0] - require.Equal(t, "0xABCDEF1234567890123456789012345678901234", timelockRef.Address) - require.True(t, timelockRef.Labels.Contains("team:core")) - require.True(t, timelockRef.Labels.Contains("environment:production")) - require.True(t, timelockRef.Labels.Contains("role:timelock")) - }) - - t.Run("environment with AddressBook and DataStore with qualifier", func(t *testing.T) { - dataStore := datastore.NewMemoryDataStore() - - // Add contracts with different qualifiers - err := dataStore.Addresses().Add(datastore.AddressRef{ - ChainSelector: chainSelector, - Address: "0x1111111111111111111111111111111111111111", - Type: datastore.ContractType(types.RBACTimelock), - Version: &deployment.Version1_0_0, - Qualifier: "team-a", - Labels: datastore.NewLabelSet( - "team:team-a", - "role:timelock", - ), - }) - require.NoError(t, err) - - err = dataStore.Addresses().Add(datastore.AddressRef{ - ChainSelector: chainSelector, - Address: "0x2222222222222222222222222222222222222222", - Type: datastore.ContractType(types.RBACTimelock), - Version: &deployment.Version1_0_0, - Qualifier: "team-b", - Labels: datastore.NewLabelSet( - "team:team-b", - "role:timelock", - ), - }) - require.NoError(t, err) - - env := cldf.Environment{ - ExistingAddresses: cldf.NewMemoryAddressBook(), - DataStore: dataStore.Seal(), - } - - // Test filtering by qualifier - mergedAddresses, err := AddressesForChain(env, chainSelector, "team-a") - require.NoError(t, err) - - // Should only have team-a contract - require.Len(t, mergedAddresses, 1) - require.Contains(t, mergedAddresses, "0x1111111111111111111111111111111111111111") - require.NotContains(t, mergedAddresses, "0x2222222222222222222222222222222222222222") - - // Verify the correct contract type - timelockTV := mergedAddresses["0x1111111111111111111111111111111111111111"] - require.Equal(t, types.RBACTimelock, timelockTV.Type) - - // Verify labels are preserved for the filtered contract - refs := env.DataStore.Addresses().Filter( - datastore.AddressRefByChainSelector(chainSelector), - datastore.AddressRefByQualifier("team-a"), - ) - require.Len(t, refs, 1) - - teamARef := refs[0] - require.Equal(t, "0x1111111111111111111111111111111111111111", teamARef.Address) - require.Equal(t, "team-a", teamARef.Qualifier) - require.True(t, teamARef.Labels.Contains("team:team-a")) - require.True(t, teamARef.Labels.Contains("role:timelock")) - }) - - t.Run("environment with duplicated addresses in AddressBook and DataStore", func(t *testing.T) { - const ( - duplicateAddress = "0x1234567890123456789012345678901234567890" - uniqueAddress = "0xABCDEF1234567890123456789012345678901234" - ) - - // Create environment with same address in both AddressBook and DataStore - addressBook := cldf.NewMemoryAddressBook() - // Add LinkToken to AddressBook - err := addressBook.Save(chainSelector, duplicateAddress, - cldf.NewTypeAndVersion(types.LinkToken, deployment.Version1_0_0)) - require.NoError(t, err) - - dataStore := datastore.NewMemoryDataStore() - - // Add the SAME address to DataStore but with different type/version and labels - err = dataStore.Addresses().Add(datastore.AddressRef{ - ChainSelector: chainSelector, - Address: duplicateAddress, // Same address as AddressBook - Type: datastore.ContractType(types.RBACTimelock), // Different type from AddressBook LinkToken - Version: &deployment.Version1_6_0, // Different version - Labels: datastore.NewLabelSet( - "team:datastore-team", - "environment:staging", - "override:true", - ), - }) - require.NoError(t, err) - - // Also add a unique DataStore address - err = dataStore.Addresses().Add(datastore.AddressRef{ - ChainSelector: chainSelector, - Address: uniqueAddress, - Type: datastore.ContractType(types.RBACTimelock), - Version: &deployment.Version1_0_0, - Labels: datastore.NewLabelSet( - "team:unique-entry", - "role:timelock", - ), - }) - require.NoError(t, err) - - env := cldf.Environment{ - ExistingAddresses: addressBook, - DataStore: dataStore.Seal(), - } - - // Test the merge function - mergedAddresses, err := AddressesForChain(env, chainSelector, "") - require.NoError(t, err) - - // Should have 2 addresses total (duplicate should be merged, unique should be included) - require.Len(t, mergedAddresses, 2) - require.Contains(t, mergedAddresses, duplicateAddress) - require.Contains(t, mergedAddresses, uniqueAddress) - - // The duplicate address should use DataStore values (DataStore takes precedence) - duplicateTV := mergedAddresses[duplicateAddress] - require.Equal(t, types.RBACTimelock, duplicateTV.Type, "DataStore type should override AddressBook type") - require.Equal(t, deployment.Version1_6_0, duplicateTV.Version, "DataStore version should override AddressBook version") - - // The unique address should have correct type - uniqueTV := mergedAddresses[uniqueAddress] - require.Equal(t, types.RBACTimelock, uniqueTV.Type) - require.Equal(t, deployment.Version1_0_0, uniqueTV.Version) - - // Verify that DataStore labels are preserved for both addresses - refs := env.DataStore.Addresses().Filter(datastore.AddressRefByChainSelector(chainSelector)) - require.Len(t, refs, 2) - - // Find the refs by address - var duplicateRef, uniqueRef *datastore.AddressRef - for i := range refs { - switch refs[i].Address { - case duplicateAddress: - duplicateRef = &refs[i] - case uniqueAddress: - uniqueRef = &refs[i] - } - } - - require.NotNil(t, duplicateRef, "Should find duplicate address in DataStore") - require.NotNil(t, uniqueRef, "Should find unique address in DataStore") - - // Verify labels are preserved for the duplicate address (which should come from DataStore) - require.True(t, duplicateRef.Labels.Contains("team:datastore-team")) - require.True(t, duplicateRef.Labels.Contains("environment:staging")) - require.True(t, duplicateRef.Labels.Contains("override:true")) - - // Verify labels for the unique address - require.True(t, uniqueRef.Labels.Contains("team:unique-entry")) - require.True(t, uniqueRef.Labels.Contains("role:timelock")) - }) -} - -func TestGetMCMSWithTimelockState(t *testing.T) { - selector := chain_selectors.TEST_90000001.Selector - env, err := environment.New(t.Context(), - environment.WithEVMSimulated(t, []uint64{selector}), - ) - require.NoError(t, err) - - chain := env.BlockChains.EVMChains()[selector] - - sharedMcm := deployMCMEvm(t, chain, &mcmstypes.Config{Quorum: 1, Signers: []common.Address{ - common.HexToAddress("0x0000000000000000000000000000000000000001"), - }}) - sharedAddress := strings.ToLower(sharedMcm.Address().Hex()) - - timelock := deployTimelockEvm(t, chain, big.NewInt(1), - common.HexToAddress("0x0000000000000000000000000000000000000004"), - []common.Address{common.HexToAddress("0x0000000000000000000000000000000000000005")}, - []common.Address{common.HexToAddress("0x0000000000000000000000000000000000000006")}, - []common.Address{common.HexToAddress("0x0000000000000000000000000000000000000007")}, - []common.Address{common.HexToAddress("0x0000000000000000000000000000000000000008")}, - ) - callProxy := deployCallProxyEvm(t, chain, - common.HexToAddress("0x0000000000000000000000000000000000000009")) - proposerMcm := deployMCMEvm(t, chain, &mcmstypes.Config{Quorum: 1, Signers: []common.Address{ - common.HexToAddress("0x0000000000000000000000000000000000000002"), - }}) - - // timelock, callProxy, proposer shared by both stores - commonRefs := []datastore.AddressRef{ - {ChainSelector: selector, Address: strings.ToLower(timelock.Address().Hex()), Type: datastore.ContractType(types.RBACTimelock), Version: &deployment.Version1_0_0}, - {ChainSelector: selector, Address: strings.ToLower(callProxy.Address().Hex()), Type: datastore.ContractType(types.CallProxy), Version: &deployment.Version1_0_0}, - {ChainSelector: selector, Address: strings.ToLower(proposerMcm.Address().Hex()), Type: datastore.ContractType(types.ProposerManyChainMultisig), Version: &deployment.Version1_0_0}, - } - - t.Run("shared address for bypasser and canceller", func(t *testing.T) { - // Store DS with bypasser/canceller sharing the same address - store := datastore.NewMemoryDataStore() - for _, ref := range commonRefs { - require.NoError(t, store.Addresses().Add(ref)) - } - require.NoError(t, store.Addresses().Add(datastore.AddressRef{ - ChainSelector: selector, Address: sharedAddress, - Type: datastore.ContractType(types.BypasserManyChainMultisig), Version: &deployment.Version1_0_0, Qualifier: "bypasser", - })) - require.NoError(t, store.Addresses().Add(datastore.AddressRef{ - ChainSelector: selector, Address: sharedAddress, - Type: datastore.ContractType(types.CancellerManyChainMultisig), Version: &deployment.Version1_0_0, Qualifier: "canceller", - })) - - state, err := GetMCMSWithTimelockState(store.Seal().Addresses(), chain, "") - require.NoError(t, err) - - require.NotNil(t, state.Timelock, "timelock should be loaded") - require.NotNil(t, state.CallProxy, "call proxy should be loaded") - require.NotNil(t, state.ProposerMcm, "proposer should be loaded") - require.NotNil(t, state.BypasserMcm, "bypasser should be loaded despite shared address") - require.NotNil(t, state.CancellerMcm, "canceller should be loaded despite shared address") - - require.Equal(t, sharedMcm.Address(), state.BypasserMcm.Address()) - require.Equal(t, sharedMcm.Address(), state.CancellerMcm.Address()) - }) - - t.Run("legacy ManyChainMultisig type is ignored", func(t *testing.T) { - // Store with legacy ManyChainMultisig typed bypasser/canceller - legacyStore := datastore.NewMemoryDataStore() - for _, ref := range commonRefs { - require.NoError(t, legacyStore.Addresses().Add(ref)) - } - require.NoError(t, legacyStore.Addresses().Add(datastore.AddressRef{ - ChainSelector: selector, Address: sharedAddress, - Type: datastore.ContractType(types.ManyChainMultisig), Version: &deployment.Version1_0_0, Qualifier: "bypasser", - Labels: datastore.NewLabelSet(types.BypasserRole.String()), - })) - require.NoError(t, legacyStore.Addresses().Add(datastore.AddressRef{ - ChainSelector: selector, Address: sharedAddress, - Type: datastore.ContractType(types.ManyChainMultisig), Version: &deployment.Version1_0_0, Qualifier: "canceller", - Labels: datastore.NewLabelSet(types.CancellerRole.String()), - })) - - state, err := GetMCMSWithTimelockState(legacyStore.Seal().Addresses(), chain, "") - require.NoError(t, err) - - require.NotNil(t, state.Timelock, "timelock should still load") - require.NotNil(t, state.CallProxy, "callProxy should still load") - require.NotNil(t, state.ProposerMcm, "proposer should still load") - require.Nil(t, state.BypasserMcm, "legacy ManyChainMultisig bypasser should not load") - require.Nil(t, state.CancellerMcm, "legacy ManyChainMultisig canceller should not load") - }) -} - -// ----- helpers ----- - -func toJSON[T any](t *testing.T, value T) string { - t.Helper() - - bytes, err := json.Marshal(value) - require.NoError(t, err) - - return string(bytes) -} - -func deployMCMEvm( - t *testing.T, chain cldf_evm.Chain, config *mcmstypes.Config, -) *bindings.ManyChainMultiSig { - t.Helper() - - _, tx, contract, err := bindings.DeployManyChainMultiSig(chain.DeployerKey, chain.Client) - require.NoError(t, err) - _, err = chain.Confirm(tx) - require.NoError(t, err) - - groupQuorums, groupParents, signerAddresses, signerGroups, err := sdk.ExtractSetConfigInputs(config) - require.NoError(t, err) - tx, err = contract.SetConfig(chain.DeployerKey, signerAddresses, signerGroups, groupQuorums, groupParents, false) - require.NoError(t, err) - _, err = chain.Confirm(tx) - require.NoError(t, err) - - return contract -} - -func deployTimelockEvm( - t *testing.T, chain cldf_evm.Chain, minDelay *big.Int, admin common.Address, - proposers, executors, cancellers, bypassers []common.Address, -) *bindings.RBACTimelock { - t.Helper() - _, tx, contract, err := bindings.DeployRBACTimelock( - chain.DeployerKey, chain.Client, minDelay, admin, proposers, executors, cancellers, bypassers) - require.NoError(t, err) - _, err = chain.Confirm(tx) - require.NoError(t, err) - - return contract -} - -func deployCallProxyEvm( - t *testing.T, chain cldf_evm.Chain, target common.Address, -) *bindings.CallProxy { - t.Helper() - _, tx, contract, err := bindings.DeployCallProxy(chain.DeployerKey, chain.Client, target) - require.NoError(t, err) - _, err = chain.Confirm(tx) - require.NoError(t, err) - - return contract -} - -func evmAddr(addr common.Address) string { - return strings.ToLower(addr.Hex()) -} diff --git a/deployment/common/changeset/state/solana.go b/deployment/common/changeset/state/solana.go index a463f1621c9..55991b15c59 100644 --- a/deployment/common/changeset/state/solana.go +++ b/deployment/common/changeset/state/solana.go @@ -158,7 +158,7 @@ func (s *MCMSWithTimelockProgramsSolana) GenerateView( s.ProposerMcmSeed, s.CancellerMcmSeed, s.BypasserMcmSeed, s.TimelockProgram, s.TimelockSeed) } -// MCMSWithTimelockStateStateSolana holds the Go bindings +// MCMSWithTimelockStateSolana holds the Go bindings // for a MCMSWithTimelock contract deployment. // It is public for use in product specific packages. // Either all fields are nil or all fields are non-nil. @@ -166,7 +166,7 @@ type MCMSWithTimelockStateSolana struct { *MCMSWithTimelockProgramsSolana } -// MaybeLoadMCMSWithTimelockState loads the MCMSWithTimelockState state for each chain in the given environment. +// MaybeLoadMCMSWithTimelockStateSolana loads the MCMSWithTimelockStateSolana state for each chain in the given environment. func MaybeLoadMCMSWithTimelockStateSolana(env cldf.Environment, chainSelectors []uint64) (map[uint64]*MCMSWithTimelockStateSolana, error) { result := map[uint64]*MCMSWithTimelockStateSolana{} solChains := env.BlockChains.SolanaChains() @@ -192,7 +192,7 @@ func MaybeLoadMCMSWithTimelockStateSolana(env cldf.Environment, chainSelectors [ return result, nil } -// MaybeLoadMCMSWithTimelockChainState looks for the addresses corresponding to +// MaybeLoadMCMSWithTimelockChainStateSolana looks for the addresses corresponding to // contracts deployed with DeployMCMSWithTimelock and loads them into a // MCMSWithTimelockStateSolana struct. If none of the contracts are found, the // state struct will be nil. diff --git a/deployment/common/changeset/test_helpers.go b/deployment/common/changeset/test_helpers.go index 3ec602b0277..a3d9bd79c4a 100644 --- a/deployment/common/changeset/test_helpers.go +++ b/deployment/common/changeset/test_helpers.go @@ -8,6 +8,7 @@ import ( mapset "github.com/deckarep/golang-set/v2" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" "github.com/stretchr/testify/require" cldftesthelpers "github.com/smartcontractkit/chainlink-deployments-framework/engine/cld/mcms/proposalutils/testhelpers" @@ -23,8 +24,6 @@ import ( "github.com/smartcontractkit/chainlink-deployments-framework/datastore" cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" - - commonState "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" ) type testMetadata struct { @@ -194,7 +193,7 @@ func MustFundAddressWithLink(t *testing.T, e cldf.Environment, chain cldf_evm.Ch addresses, err := e.ExistingAddresses.AddressesForChain(chain.Selector) require.NoError(t, err) - linkState, err := commonState.MaybeLoadLinkTokenChainState(chain, addresses) + linkState, err := evmstate.MaybeLoadLinkTokenChainState(chain, addresses) require.NoError(t, err) require.NotNil(t, linkState.LinkToken) @@ -223,7 +222,7 @@ func MustFundAddressWithLink(t *testing.T, e cldf.Environment, chain cldf_evm.Ch func MaybeGetLinkBalance(t *testing.T, e cldf.Environment, chain cldf_evm.Chain, linkAddr common.Address) *big.Int { addresses, err := e.ExistingAddresses.AddressesForChain(chain.Selector) require.NoError(t, err) - linkState, err := commonState.MaybeLoadLinkTokenChainState(chain, addresses) + linkState, err := evmstate.MaybeLoadLinkTokenChainState(chain, addresses) require.NoError(t, err) endBalance, err := linkState.LinkToken.BalanceOf(&bind.CallOpts{Context: chain.DeployerKey.Context}, linkAddr) require.NoError(t, err) diff --git a/deployment/common/changeset/transfer_to_mcms_with_timelock.go b/deployment/common/changeset/transfer_to_mcms_with_timelock.go index 0aad9c14eb6..304ec5172f2 100644 --- a/deployment/common/changeset/transfer_to_mcms_with_timelock.go +++ b/deployment/common/changeset/transfer_to_mcms_with_timelock.go @@ -10,6 +10,7 @@ import ( "github.com/ethereum/go-ethereum/common" gethtypes "github.com/ethereum/go-ethereum/core/types" owner_helpers "github.com/smartcontractkit/ccip-owner-contracts/pkg/gethwrappers" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" mcmslib "github.com/smartcontractkit/mcms" "github.com/smartcontractkit/mcms/sdk" "github.com/smartcontractkit/mcms/sdk/evm" @@ -20,7 +21,6 @@ import ( "github.com/smartcontractkit/chainlink-evm/gethwrappers/shared/generated/initial/burn_mint_erc677" "github.com/smartcontractkit/chainlink/deployment/common/changeset/evm/mcms/seqs" - "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" "github.com/smartcontractkit/chainlink/deployment/common/types" ) @@ -58,7 +58,7 @@ func LoadOwnableContract(addr common.Address, client bind.ContractBackend) (comm // Returns the address if found in either source (similar to cldf.SearchAddressBook) func searchContractInBothSources(e cldf.Environment, chainSelector uint64, contractType cldf.ContractType, qualifier string) (string, error) { // Use the merged address loading from the EVM state function - addressesChain, err := state.AddressesForChain(e, chainSelector, qualifier) + addressesChain, err := evmstate.AddressesForChain(e, chainSelector, qualifier) if err != nil { return "", fmt.Errorf("failed to load addresses: %w", err) } @@ -263,7 +263,7 @@ func (cfg RenounceTimelockDeployerConfig) Validate(e cldf.Environment) error { } // MCMS should already exists - contracts, err := state.MaybeLoadMCMSWithTimelockStateWithQualifier(e, []uint64{cfg.ChainSel}, cfg.Qualifier) + contracts, err := evmstate.MaybeLoadMCMSWithTimelockStateWithQualifier(e, []uint64{cfg.ChainSel}, cfg.Qualifier) if err != nil { return err } @@ -285,7 +285,7 @@ func RenounceTimelockDeployer(e cldf.Environment, cfg RenounceTimelockDeployerCo return cldf.ChangesetOutput{}, err } - contracts, err := state.MaybeLoadMCMSWithTimelockStateWithQualifier(e, []uint64{cfg.ChainSel}, cfg.Qualifier) + contracts, err := evmstate.MaybeLoadMCMSWithTimelockStateWithQualifier(e, []uint64{cfg.ChainSel}, cfg.Qualifier) if err != nil { return cldf.ChangesetOutput{}, err } diff --git a/deployment/common/changeset/transfer_to_mcms_with_timelock_test.go b/deployment/common/changeset/transfer_to_mcms_with_timelock_test.go index 4aa0f2f0f17..2cf9dbed8c4 100644 --- a/deployment/common/changeset/transfer_to_mcms_with_timelock_test.go +++ b/deployment/common/changeset/transfer_to_mcms_with_timelock_test.go @@ -9,6 +9,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" chain_selectors "github.com/smartcontractkit/chain-selectors" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink-deployments-framework/datastore" @@ -20,9 +21,9 @@ import ( "github.com/smartcontractkit/chainlink-deployments-framework/engine/test/runtime" cldftesthelpers "github.com/smartcontractkit/chainlink-deployments-framework/engine/cld/mcms/proposalutils/testhelpers" + "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/common/changeset" - state2 "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" "github.com/smartcontractkit/chainlink/deployment/common/types" ) @@ -163,9 +164,9 @@ func TestTransferToMCMSWithTimelockV2DataStore(t *testing.T) { require.True(t, rt.State().Proposals[0].IsExecuted) // We expect now that the link token is owned by the MCMS timelock. - addrsDatastore, err := state2.LoadAddressesFromDataStore(rt.State().DataStore, selector, "") + addrsDatastore, err := evmstate.LoadAddressesFromDataStore(rt.State().DataStore, selector, "") //nolint:staticcheck // will be refactored once usages are removed require.NoError(t, err) - linkState, err := state2.MaybeLoadLinkTokenChainState(chain, addrsDatastore) + linkState, err := evmstate.MaybeLoadLinkTokenChainState(chain, addrsDatastore) require.NoError(t, err) o, err := linkState.LinkToken.Owner(nil) diff --git a/deployment/common/opsutils/evm.go b/deployment/common/opsutils/evm.go index 9c9eb4409cc..5baa77a4101 100644 --- a/deployment/common/opsutils/evm.go +++ b/deployment/common/opsutils/evm.go @@ -13,6 +13,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" "github.com/zksync-sdk/zksync2-go/accounts" "github.com/zksync-sdk/zksync2-go/clients" @@ -25,7 +26,6 @@ import ( cldfproposalutils "github.com/smartcontractkit/chainlink-deployments-framework/engine/cld/mcms/proposalutils" "github.com/smartcontractkit/chainlink-deployments-framework/operations" - "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" commontypes "github.com/smartcontractkit/chainlink/deployment/common/types" ) @@ -120,7 +120,7 @@ func AddEVMCallSequenceToCSOutput[IN any]( csOutput cldf.ChangesetOutput, seqReport operations.SequenceReport[IN, map[uint64][]EVMCallOutput], seqErr error, - mcmsStateByChain map[uint64]state.MCMSWithTimelockState, + mcmsStateByChain map[uint64]evmstate.MCMSWithTimelockState, mcmsCfg *proposalutils.TimelockConfig, mcmsDescription string, ) (cldf.ChangesetOutput, error) { diff --git a/deployment/common/opsutils/evm_test.go b/deployment/common/opsutils/evm_test.go index 4e170841019..54ee8628676 100644 --- a/deployment/common/opsutils/evm_test.go +++ b/deployment/common/opsutils/evm_test.go @@ -11,6 +11,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -25,9 +26,9 @@ import ( "github.com/smartcontractkit/chainlink-deployments-framework/engine/test/environment" "github.com/smartcontractkit/chainlink-deployments-framework/operations" "github.com/smartcontractkit/chainlink-deployments-framework/operations/optest" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers" "github.com/smartcontractkit/chainlink/deployment/ccip/shared/stateview" - "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" "github.com/smartcontractkit/chainlink/deployment/common/opsutils" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" commontypes "github.com/smartcontractkit/chainlink/deployment/common/types" @@ -173,7 +174,7 @@ func TestAddEVMCallSequenceToCSOutput_AllConfirmed(t *testing.T) { csOutput, seqReport, nil, - map[uint64]state.MCMSWithTimelockState{}, + map[uint64]evmstate.MCMSWithTimelockState{}, mcmsCfg, "test", ) diff --git a/deployment/common/proposalutils/propose.go b/deployment/common/proposalutils/propose.go index d6e71fae9b4..c68ac064972 100644 --- a/deployment/common/proposalutils/propose.go +++ b/deployment/common/proposalutils/propose.go @@ -11,6 +11,7 @@ import ( mapset "github.com/deckarep/golang-set/v2" "github.com/smartcontractkit/ccip-owner-contracts/pkg/gethwrappers" chain_selectors "github.com/smartcontractkit/chain-selectors" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" mcmslib "github.com/smartcontractkit/mcms" mcmschainwrappers "github.com/smartcontractkit/mcms/chainwrappers" mcmssdk "github.com/smartcontractkit/mcms/sdk" @@ -88,7 +89,7 @@ func (tc *TimelockConfig) MCMBasedOnActionTON(s *tonstate.MCMSSuiteState) (strin } } -func (tc *TimelockConfig) MCMBasedOnAction(s state.MCMSWithTimelockState) (*gethwrappers.ManyChainMultiSig, error) { +func (tc *TimelockConfig) MCMBasedOnAction(s evmstate.MCMSWithTimelockState) (*gethwrappers.ManyChainMultiSig, error) { // if MCMSAction is not set, default to timelock.Schedule, this is to ensure no breaking changes for existing code if tc.MCMSAction == "" { tc.MCMSAction = types.TimelockActionSchedule @@ -127,7 +128,7 @@ func (tc *TimelockConfig) validateCommon() error { return nil } -func (tc *TimelockConfig) Validate(chain cldf_evm.Chain, s state.MCMSWithTimelockState) error { +func (tc *TimelockConfig) Validate(chain cldf_evm.Chain, s evmstate.MCMSWithTimelockState) error { err := tc.validateCommon() if err != nil { return err @@ -436,7 +437,7 @@ func getSolanaState(env cldf.Environment, selector uint64) (*state.MCMSWithTimel // Deprecated: Use extensible AggregateProposalsV2 instead. Which accepts multiple chain families. func AggregateProposals( env cldf.Environment, - mcmsEVMState map[uint64]state.MCMSWithTimelockState, + mcmsEVMState map[uint64]evmstate.MCMSWithTimelockState, mcmsSolanaState map[uint64]state.MCMSWithTimelockStateSolana, proposals []mcmslib.TimelockProposal, description string, @@ -455,7 +456,7 @@ func AggregateProposals( } type MCMSStates struct { - MCMSEVMState map[uint64]state.MCMSWithTimelockState + MCMSEVMState map[uint64]evmstate.MCMSWithTimelockState MCMSSolanaState map[uint64]state.MCMSWithTimelockStateSolana MCMSAptosState map[uint64]aptos.AccountAddress MCMSTONState map[uint64]tonstate.MCMSChainState diff --git a/deployment/cre/capabilities_registry/v2/changeset/add_capabilities.go b/deployment/cre/capabilities_registry/v2/changeset/add_capabilities.go index 9b8e88e0434..c75cf9c80af 100644 --- a/deployment/cre/capabilities_registry/v2/changeset/add_capabilities.go +++ b/deployment/cre/capabilities_registry/v2/changeset/add_capabilities.go @@ -5,12 +5,12 @@ import ( "fmt" "github.com/ethereum/go-ethereum/common" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" "github.com/smartcontractkit/chainlink-deployments-framework/operations" capabilities_registry_v2 "github.com/smartcontractkit/chainlink-evm/gethwrappers/workflow/generated/capabilities_registry_wrapper_v2" - commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" "github.com/smartcontractkit/chainlink/deployment/cre/capabilities_registry/v2/changeset/operations/contracts" "github.com/smartcontractkit/chainlink/deployment/cre/capabilities_registry/v2/changeset/pkg" "github.com/smartcontractkit/chainlink/deployment/cre/capabilities_registry/v2/changeset/sequences" @@ -59,7 +59,7 @@ func (u AddCapabilities) VerifyPreconditions(_ cldf.Environment, config AddCapab } func (u AddCapabilities) Apply(e cldf.Environment, config AddCapabilitiesInput) (cldf.ChangesetOutput, error) { - var mcmsContracts *commonchangeset.MCMSWithTimelockState + var mcmsContracts *evmstate.MCMSWithTimelockState if config.MCMSConfig != nil { var err error mcmsContracts, err = strategies.GetMCMSContracts(e, config.RegistryChainSel, *config.MCMSConfig) diff --git a/deployment/cre/capabilities_registry/v2/changeset/configure_capabilities_registry.go b/deployment/cre/capabilities_registry/v2/changeset/configure_capabilities_registry.go index fb24ae16dc0..493cdfa1d48 100644 --- a/deployment/cre/capabilities_registry/v2/changeset/configure_capabilities_registry.go +++ b/deployment/cre/capabilities_registry/v2/changeset/configure_capabilities_registry.go @@ -4,6 +4,8 @@ import ( "encoding/json" "fmt" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" + "github.com/smartcontractkit/chainlink-deployments-framework/datastore" cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" "github.com/smartcontractkit/chainlink-deployments-framework/operations" @@ -11,7 +13,7 @@ import ( capabilities_registry_v2 "github.com/smartcontractkit/chainlink-evm/gethwrappers/workflow/generated/capabilities_registry_wrapper_v2" "github.com/smartcontractkit/chainlink-common/keystore/corekeys/p2pkey" - commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" + "github.com/smartcontractkit/chainlink/deployment/cre/capabilities_registry/v2/changeset/operations/contracts" "github.com/smartcontractkit/chainlink/deployment/cre/capabilities_registry/v2/changeset/pkg" "github.com/smartcontractkit/chainlink/deployment/cre/capabilities_registry/v2/changeset/sequences" @@ -38,7 +40,7 @@ type ConfigureCapabilitiesRegistryInput struct { type ConfigureCapabilitiesRegistryDeps struct { Env *cldf.Environment - MCMSContracts *commonchangeset.MCMSWithTimelockState // Required if MCMSConfig input is not nil + MCMSContracts *evmstate.MCMSWithTimelockState // Required if MCMSConfig input is not nil } type ConfigureCapabilitiesRegistry struct{} @@ -56,7 +58,7 @@ func (l ConfigureCapabilitiesRegistry) VerifyPreconditions(e cldf.Environment, c func (l ConfigureCapabilitiesRegistry) Apply(e cldf.Environment, config ConfigureCapabilitiesRegistryInput) (cldf.ChangesetOutput, error) { // Get MCMS contracts if needed - var mcmsContracts *commonchangeset.MCMSWithTimelockState + var mcmsContracts *evmstate.MCMSWithTimelockState if config.MCMSConfig != nil { var err error mcmsContracts, err = strategies.GetMCMSContracts(e, config.ChainSelector, *config.MCMSConfig) diff --git a/deployment/cre/capabilities_registry/v2/changeset/delete_don.go b/deployment/cre/capabilities_registry/v2/changeset/delete_don.go index ca1458efe2a..9f700a2f44d 100644 --- a/deployment/cre/capabilities_registry/v2/changeset/delete_don.go +++ b/deployment/cre/capabilities_registry/v2/changeset/delete_don.go @@ -5,13 +5,14 @@ import ( "fmt" "github.com/ethereum/go-ethereum/common" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" mcmslib "github.com/smartcontractkit/mcms" "github.com/smartcontractkit/mcms/types" cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" "github.com/smartcontractkit/chainlink-deployments-framework/operations" capabilities_registry_v2 "github.com/smartcontractkit/chainlink-evm/gethwrappers/workflow/generated/capabilities_registry_wrapper_v2" - commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" + opscontracts "github.com/smartcontractkit/chainlink/deployment/cre/capabilities_registry/v2/changeset/operations/contracts" "github.com/smartcontractkit/chainlink/deployment/cre/capabilities_registry/v2/changeset/pkg" "github.com/smartcontractkit/chainlink/deployment/cre/common/strategies" @@ -42,7 +43,7 @@ func (d DeleteDONs) VerifyPreconditions(_ cldf.Environment, cfg DeleteDONsInput) } func (d DeleteDONs) Apply(e cldf.Environment, cfg DeleteDONsInput) (cldf.ChangesetOutput, error) { - var mcmsContracts *commonchangeset.MCMSWithTimelockState + var mcmsContracts *evmstate.MCMSWithTimelockState if cfg.MCMSConfig != nil { var err error mcmsContracts, err = strategies.GetMCMSContracts(e, cfg.RegistryChainSel, *cfg.MCMSConfig) diff --git a/deployment/cre/capabilities_registry/v2/changeset/sequences/add_capabilities.go b/deployment/cre/capabilities_registry/v2/changeset/sequences/add_capabilities.go index 9372f9180ff..c3467947e4f 100644 --- a/deployment/cre/capabilities_registry/v2/changeset/sequences/add_capabilities.go +++ b/deployment/cre/capabilities_registry/v2/changeset/sequences/add_capabilities.go @@ -10,6 +10,7 @@ import ( "github.com/Masterminds/semver/v3" "github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/common" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" mcmslib "github.com/smartcontractkit/mcms" "github.com/smartcontractkit/mcms/types" @@ -19,7 +20,7 @@ import ( capabilities_registry_v2 "github.com/smartcontractkit/chainlink-evm/gethwrappers/workflow/generated/capabilities_registry_wrapper_v2" "github.com/smartcontractkit/chainlink-common/keystore/corekeys/p2pkey" - commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" + "github.com/smartcontractkit/chainlink/deployment/cre/capabilities_registry/v2/changeset/modifier" "github.com/smartcontractkit/chainlink/deployment/cre/capabilities_registry/v2/changeset/operations/contracts" "github.com/smartcontractkit/chainlink/deployment/cre/common/strategies" @@ -28,7 +29,7 @@ import ( type AddCapabilitiesDeps struct { Env *cldf.Environment - MCMSContracts *commonchangeset.MCMSWithTimelockState // Required if MCMSConfig is not nil + MCMSContracts *evmstate.MCMSWithTimelockState // Required if MCMSConfig is not nil } type AddCapabilitiesInput struct { diff --git a/deployment/cre/capabilities_registry/v2/changeset/sequences/configure_capabilities_registry.go b/deployment/cre/capabilities_registry/v2/changeset/sequences/configure_capabilities_registry.go index 21eca736188..5b04a3b5a80 100644 --- a/deployment/cre/capabilities_registry/v2/changeset/sequences/configure_capabilities_registry.go +++ b/deployment/cre/capabilities_registry/v2/changeset/sequences/configure_capabilities_registry.go @@ -15,7 +15,8 @@ import ( capabilities_registry_v2 "github.com/smartcontractkit/chainlink-evm/gethwrappers/workflow/generated/capabilities_registry_wrapper_v2" - commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" + "github.com/smartcontractkit/chainlink/deployment/cre/capabilities_registry/v2/changeset/operations/contracts" "github.com/smartcontractkit/chainlink/deployment/cre/common/strategies" crecontracts "github.com/smartcontractkit/chainlink/deployment/cre/contracts" @@ -23,7 +24,7 @@ import ( type ConfigureCapabilitiesRegistryDeps struct { Env *cldf.Environment - MCMSContracts *commonchangeset.MCMSWithTimelockState // Required if MCMSConfig is not nil + MCMSContracts *evmstate.MCMSWithTimelockState // Required if MCMSConfig is not nil } type ConfigureCapabilitiesRegistryInput struct { diff --git a/deployment/cre/capabilities_registry/v2/changeset/sequences/set_dons_families.go b/deployment/cre/capabilities_registry/v2/changeset/sequences/set_dons_families.go index f1a33faa1b2..57a9ad8a07f 100644 --- a/deployment/cre/capabilities_registry/v2/changeset/sequences/set_dons_families.go +++ b/deployment/cre/capabilities_registry/v2/changeset/sequences/set_dons_families.go @@ -6,6 +6,7 @@ import ( "github.com/Masterminds/semver/v3" "github.com/ethereum/go-ethereum/common" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" mcmslib "github.com/smartcontractkit/mcms" "github.com/smartcontractkit/mcms/types" @@ -14,7 +15,6 @@ import ( "github.com/smartcontractkit/chainlink-deployments-framework/operations" capabilities_registry_v2 "github.com/smartcontractkit/chainlink-evm/gethwrappers/workflow/generated/capabilities_registry_wrapper_v2" - commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" "github.com/smartcontractkit/chainlink/deployment/cre/capabilities_registry/v2/changeset/operations/contracts" "github.com/smartcontractkit/chainlink/deployment/cre/common/strategies" crecontracts "github.com/smartcontractkit/chainlink/deployment/cre/contracts" @@ -22,7 +22,7 @@ import ( type SetDONsFamiliesDeps struct { Env *cldf.Environment - MCMSContracts *commonchangeset.MCMSWithTimelockState // Required if MCMSConfig is not nil + MCMSContracts *evmstate.MCMSWithTimelockState // Required if MCMSConfig is not nil } type SetDONsFamiliesInput struct { diff --git a/deployment/cre/capabilities_registry/v2/changeset/set_dons_families.go b/deployment/cre/capabilities_registry/v2/changeset/set_dons_families.go index 9c2a97eaaef..1117bd28452 100644 --- a/deployment/cre/capabilities_registry/v2/changeset/set_dons_families.go +++ b/deployment/cre/capabilities_registry/v2/changeset/set_dons_families.go @@ -4,10 +4,11 @@ import ( "errors" "fmt" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" + cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" "github.com/smartcontractkit/chainlink-deployments-framework/operations" - commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" "github.com/smartcontractkit/chainlink/deployment/cre/capabilities_registry/v2/changeset/pkg" "github.com/smartcontractkit/chainlink/deployment/cre/capabilities_registry/v2/changeset/sequences" "github.com/smartcontractkit/chainlink/deployment/cre/common/strategies" @@ -41,7 +42,7 @@ func (l SetDONsFamilies) VerifyPreconditions(e cldf.Environment, config SetDONsF } func (l SetDONsFamilies) Apply(e cldf.Environment, config SetDONsFamiliesInput) (cldf.ChangesetOutput, error) { - var mcmscrecontracts *commonchangeset.MCMSWithTimelockState + var mcmscrecontracts *evmstate.MCMSWithTimelockState if config.MCMSConfig != nil { var err error mcmscrecontracts, err = strategies.GetMCMSContracts(e, config.RegistrySelector, *config.MCMSConfig) diff --git a/deployment/cre/capabilities_registry/v2/changeset/update_don.go b/deployment/cre/capabilities_registry/v2/changeset/update_don.go index b5e92e45e76..f77c7937eeb 100644 --- a/deployment/cre/capabilities_registry/v2/changeset/update_don.go +++ b/deployment/cre/capabilities_registry/v2/changeset/update_don.go @@ -5,6 +5,7 @@ import ( "fmt" "github.com/ethereum/go-ethereum/common" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" mcmslib "github.com/smartcontractkit/mcms" "github.com/smartcontractkit/mcms/types" @@ -13,7 +14,6 @@ import ( "github.com/smartcontractkit/chainlink-deployments-framework/operations" capabilities_registry_v2 "github.com/smartcontractkit/chainlink-evm/gethwrappers/workflow/generated/capabilities_registry_wrapper_v2" - commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" "github.com/smartcontractkit/chainlink/deployment/cre/capabilities_registry/v2/changeset/modifier" "github.com/smartcontractkit/chainlink/deployment/cre/capabilities_registry/v2/changeset/operations/contracts" "github.com/smartcontractkit/chainlink/deployment/cre/capabilities_registry/v2/changeset/pkg" @@ -67,7 +67,7 @@ func (u UpdateDON) VerifyPreconditions(_ cldf.Environment, config UpdateDONInput } func (u UpdateDON) Apply(e cldf.Environment, config UpdateDONInput) (cldf.ChangesetOutput, error) { - var mcmsContracts *commonchangeset.MCMSWithTimelockState + var mcmsContracts *evmstate.MCMSWithTimelockState if config.MCMSConfig != nil { var err error mcmsContracts, err = strategies.GetMCMSContracts(e, config.RegistryChainSel, *config.MCMSConfig) diff --git a/deployment/cre/capabilities_registry/v2/changeset/update_nodes_changeset.go b/deployment/cre/capabilities_registry/v2/changeset/update_nodes_changeset.go index 96ab0e9b013..eff654586f3 100644 --- a/deployment/cre/capabilities_registry/v2/changeset/update_nodes_changeset.go +++ b/deployment/cre/capabilities_registry/v2/changeset/update_nodes_changeset.go @@ -5,13 +5,13 @@ import ( "fmt" "github.com/ethereum/go-ethereum/common" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" mcmslib "github.com/smartcontractkit/mcms" mcmstypes "github.com/smartcontractkit/mcms/types" cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" "github.com/smartcontractkit/chainlink-deployments-framework/operations" - commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" "github.com/smartcontractkit/chainlink/deployment/cre/capabilities_registry/v2/changeset/operations/contracts" "github.com/smartcontractkit/chainlink/deployment/cre/capabilities_registry/v2/changeset/pkg" "github.com/smartcontractkit/chainlink/deployment/cre/common/strategies" @@ -56,7 +56,7 @@ func (u UpdateNodes) VerifyPreconditions(_ cldf.Environment, config UpdateNodesI } func (u UpdateNodes) Apply(e cldf.Environment, config UpdateNodesInput) (cldf.ChangesetOutput, error) { - var mcmsContracts *commonchangeset.MCMSWithTimelockState + var mcmsContracts *evmstate.MCMSWithTimelockState if config.MCMSConfig != nil { var err error mcmsContracts, err = strategies.GetMCMSContracts(e, config.RegistryChainSel, *config.MCMSConfig) diff --git a/deployment/cre/common/strategies/mcms_transaction.go b/deployment/cre/common/strategies/mcms_transaction.go index 2e46057a6e0..5414c5bd777 100644 --- a/deployment/cre/common/strategies/mcms_transaction.go +++ b/deployment/cre/common/strategies/mcms_transaction.go @@ -8,6 +8,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" mcmslib "github.com/smartcontractkit/mcms" "github.com/smartcontractkit/mcms/sdk" mcmstypes "github.com/smartcontractkit/mcms/types" @@ -16,7 +17,6 @@ import ( cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" - commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" "github.com/smartcontractkit/chainlink/deployment/cre/contracts" ) @@ -28,7 +28,7 @@ type MCMSTransaction struct { Description string Address common.Address Config *contracts.MCMSConfig - MCMSContracts *commonchangeset.MCMSWithTimelockState + MCMSContracts *evmstate.MCMSWithTimelockState } func (m *MCMSTransaction) Apply(callFn func(opts *bind.TransactOpts) (*types.Transaction, error)) (*mcmstypes.BatchOperation, *types.Transaction, error) { diff --git a/deployment/cre/common/strategies/mcms_transaction_test.go b/deployment/cre/common/strategies/mcms_transaction_test.go index c6b753d8f97..c305f1bc6c6 100644 --- a/deployment/cre/common/strategies/mcms_transaction_test.go +++ b/deployment/cre/common/strategies/mcms_transaction_test.go @@ -6,6 +6,7 @@ import ( "time" "github.com/ethereum/go-ethereum/common" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" mcmstypes "github.com/smartcontractkit/mcms/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -15,7 +16,6 @@ import ( commonconfig "github.com/smartcontractkit/chainlink-common/pkg/config" "github.com/smartcontractkit/chainlink-deployments-framework/deployment" - commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" "github.com/smartcontractkit/chainlink/deployment/cre/common/strategies" "github.com/smartcontractkit/chainlink/deployment/cre/contracts" "github.com/smartcontractkit/chainlink/deployment/cre/test" @@ -30,7 +30,7 @@ func getMCMSTransaction(t *testing.T, env deployment.Environment) *strategies.MC Description: "test", Config: &contracts.MCMSConfig{}, Address: common.HexToAddress("0x1"), - MCMSContracts: &commonchangeset.MCMSWithTimelockState{}, + MCMSContracts: &evmstate.MCMSWithTimelockState{}, } } diff --git a/deployment/cre/common/strategies/strategies.go b/deployment/cre/common/strategies/strategies.go index c8f044495bc..80db0a318b3 100644 --- a/deployment/cre/common/strategies/strategies.go +++ b/deployment/cre/common/strategies/strategies.go @@ -7,13 +7,13 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" mcmslib "github.com/smartcontractkit/mcms" mcmstypes "github.com/smartcontractkit/mcms/types" cldf_evm "github.com/smartcontractkit/chainlink-deployments-framework/chain/evm" cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" - commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" "github.com/smartcontractkit/chainlink/deployment/cre/contracts" ) @@ -35,7 +35,7 @@ func CreateStrategy( chain cldf_evm.Chain, env cldf.Environment, mcmsConfig *contracts.MCMSConfig, - mcmsContracts *commonchangeset.MCMSWithTimelockState, + mcmsContracts *evmstate.MCMSWithTimelockState, targetAddress common.Address, description string, ) (TransactionStrategy, error) { @@ -73,7 +73,7 @@ type SimpleTransactionV2 = SimpleTransaction type MCMSTransactionV2 = MCMSTransaction // GetMCMSContracts retrieves MCMS contracts from the environment using merged approach (both DataStore and AddressBook) -func GetMCMSContracts(e cldf.Environment, chainSelector uint64, mcmsConfig contracts.MCMSConfig) (*commonchangeset.MCMSWithTimelockState, error) { +func GetMCMSContracts(e cldf.Environment, chainSelector uint64, mcmsConfig contracts.MCMSConfig) (*evmstate.MCMSWithTimelockState, error) { var qualifier string qualifier, ok := mcmsConfig.TimelockQualifierPerChain[chainSelector] @@ -81,7 +81,7 @@ func GetMCMSContracts(e cldf.Environment, chainSelector uint64, mcmsConfig contr return nil, fmt.Errorf("no timelock qualifier found for chain selector %d in MCMSConfig", chainSelector) } - states, err := commonchangeset.MaybeLoadMCMSWithTimelockStateWithQualifier(e, []uint64{chainSelector}, qualifier) + states, err := evmstate.MaybeLoadMCMSWithTimelockStateWithQualifier(e, []uint64{chainSelector}, qualifier) if err != nil { return nil, fmt.Errorf("failed to load MCMS contracts for chain %d: %w", chainSelector, err) } diff --git a/deployment/cre/contracts/contracts.go b/deployment/cre/contracts/contracts.go index 69d83c798ca..a8bfaa9516d 100644 --- a/deployment/cre/contracts/contracts.go +++ b/deployment/cre/contracts/contracts.go @@ -6,13 +6,13 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" cldf_evm "github.com/smartcontractkit/chainlink-deployments-framework/chain/evm" "github.com/smartcontractkit/chainlink-deployments-framework/datastore" cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" "github.com/smartcontractkit/chainlink/deployment" - "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" "github.com/smartcontractkit/chainlink/deployment/common/types" @@ -64,7 +64,7 @@ func isOwnedByMCMSV2[T Ownable](contract T, store datastore.AddressRefStore, cha // OwnedContract represents a contract and its owned MCMS contracts. type OwnedContract[T Ownable] struct { // The MCMS contracts that the contract might own - McmsContracts *state.MCMSWithTimelockState + McmsContracts *evmstate.MCMSWithTimelockState // The actual contract instance Contract T } @@ -90,7 +90,7 @@ func NewOwnableV2[T Ownable](contract T, store datastore.AddressRefStore, chain } // in the latest versions, the qualifier should be the same for all the mcms contracts // which enables multiple MCMS deployments on a single chain - stateMCMS, err := state.GetMCMSWithTimelockState(store, chain, r.Qualifier) + stateMCMS, err := evmstate.GetMCMSWithTimelockState(store, chain, r.Qualifier) if err != nil { return nil, fmt.Errorf("failed to get MCMS with timelock state: %w", err) } @@ -100,7 +100,7 @@ func NewOwnableV2[T Ownable](contract T, store datastore.AddressRefStore, chain // TODO CRE-1360: remove this after we complete migration to consistent qualifiers m := matchLabels(store, *r, chain.Selector) var err2 error - stateMCMS, err2 = state.MaybeLoadMCMSWithTimelockChainState(chain, m) + stateMCMS, err2 = evmstate.MaybeLoadMCMSWithTimelockChainState(chain, m) if err2 != nil { return nil, fmt.Errorf("failed to get MCMS with timelock state by labels: %w", err2) } diff --git a/deployment/cre/forwarder/configure.go b/deployment/cre/forwarder/configure.go index 8a63567c5ff..f8c0d0ac9c8 100644 --- a/deployment/cre/forwarder/configure.go +++ b/deployment/cre/forwarder/configure.go @@ -8,6 +8,7 @@ import ( "github.com/Masterminds/semver/v3" "github.com/ethereum/go-ethereum/common" chainsel "github.com/smartcontractkit/chain-selectors" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" mcmslib "github.com/smartcontractkit/mcms" mcmstypes "github.com/smartcontractkit/mcms/types" @@ -19,7 +20,6 @@ import ( forwarder "github.com/smartcontractkit/chainlink-evm/gethwrappers/keystone/generated/forwarder_1_0_0" "github.com/smartcontractkit/chainlink/deployment" - changesetstate "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" cap_reg_v2 "github.com/smartcontractkit/chainlink/deployment/cre/capabilities_registry/v2/changeset/operations/contracts" "github.com/smartcontractkit/chainlink/deployment/cre/common/strategies" "github.com/smartcontractkit/chainlink/deployment/cre/contracts" @@ -114,7 +114,7 @@ var ConfigureSeq = operations.NewSequence[ConfigureSeqInput, ConfigureSeqOutput, "Found %d forwarder contracts for a chain. Config will be applied to all of them.", len(addressesRefs)) } - var mcmsContracts *changesetstate.MCMSWithTimelockState + var mcmsContracts *evmstate.MCMSWithTimelockState if input.MCMSConfig != nil { var mcmsErr error mcmsContracts, mcmsErr = strategies.GetMCMSContracts(*deps.Env, chain.Selector, *input.MCMSConfig) diff --git a/deployment/cre/ocr3/ocr3_1/changeset/operations/contracts/configure_vault_dkg.go b/deployment/cre/ocr3/ocr3_1/changeset/operations/contracts/configure_vault_dkg.go index 56ac653649d..151aa2993cd 100644 --- a/deployment/cre/ocr3/ocr3_1/changeset/operations/contracts/configure_vault_dkg.go +++ b/deployment/cre/ocr3/ocr3_1/changeset/operations/contracts/configure_vault_dkg.go @@ -7,6 +7,7 @@ import ( "io" "github.com/ethereum/go-ethereum/common" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" "github.com/smartcontractkit/chainlink/deployment/cre/common/strategies" "github.com/smartcontractkit/chainlink/deployment/cre/ocr3/ocr3_1" @@ -17,7 +18,6 @@ import ( cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" "github.com/smartcontractkit/chainlink-deployments-framework/operations" - changesetstate "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" crecontracts "github.com/smartcontractkit/chainlink/deployment/cre/contracts" "github.com/smartcontractkit/chainlink/deployment/cre/jobs/pkg" "github.com/smartcontractkit/chainlink/deployment/cre/ocr3/v2/changeset/operations/contracts" @@ -76,7 +76,7 @@ func (l ConfigureVaultDKG) VerifyPreconditions(_ cldf.Environment, input Configu func (l ConfigureVaultDKG) Apply(e cldf.Environment, input ConfigureVaultDKGInput) (cldf.ChangesetOutput, error) { e.Logger.Infow("Configuring Vault DKG contract with DON", "donName", input.DON.Name, "nodes", input.DON.NodeIDs, "dryRun", input.DryRun) - var mcmsContracts *changesetstate.MCMSWithTimelockState + var mcmsContracts *evmstate.MCMSWithTimelockState if input.MCMSConfig != nil { var mcmsErr error mcmsContracts, mcmsErr = strategies.GetMCMSContracts(e, input.ContractChainSelector, *input.MCMSConfig) diff --git a/deployment/cre/ocr3/ocr3_1/changeset/operations/contracts/configure_vault_plugin.go b/deployment/cre/ocr3/ocr3_1/changeset/operations/contracts/configure_vault_plugin.go index f04ef4f227e..dc2a94229b8 100644 --- a/deployment/cre/ocr3/ocr3_1/changeset/operations/contracts/configure_vault_plugin.go +++ b/deployment/cre/ocr3/ocr3_1/changeset/operations/contracts/configure_vault_plugin.go @@ -6,6 +6,7 @@ import ( "fmt" "github.com/ethereum/go-ethereum/common" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" "google.golang.org/protobuf/proto" "github.com/smartcontractkit/smdkg/dkgocr/dkgocrtypes" @@ -15,7 +16,6 @@ import ( cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" "github.com/smartcontractkit/chainlink-deployments-framework/operations" - changesetstate "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" "github.com/smartcontractkit/chainlink/deployment/cre/common/strategies" crecontracts "github.com/smartcontractkit/chainlink/deployment/cre/contracts" "github.com/smartcontractkit/chainlink/deployment/cre/jobs/pkg" @@ -84,7 +84,7 @@ func (l ConfigureVaultPlugin) VerifyPreconditions(_ cldf.Environment, input Conf func (l ConfigureVaultPlugin) Apply(e cldf.Environment, input ConfigureVaultPluginInput) (cldf.ChangesetOutput, error) { e.Logger.Infow("Configuring VaultPlugin contract with DON", "donName", input.DON.Name, "nodes", input.DON.NodeIDs, "dryRun", input.DryRun) - var mcmsContracts *changesetstate.MCMSWithTimelockState + var mcmsContracts *evmstate.MCMSWithTimelockState if input.MCMSConfig != nil { var mcmsErr error mcmsContracts, mcmsErr = strategies.GetMCMSContracts(e, input.ContractChainSelector, *input.MCMSConfig) diff --git a/deployment/cre/ocr3/v2/changeset/configure_ocr3.go b/deployment/cre/ocr3/v2/changeset/configure_ocr3.go index 7ecebe544c0..499615eea25 100644 --- a/deployment/cre/ocr3/v2/changeset/configure_ocr3.go +++ b/deployment/cre/ocr3/v2/changeset/configure_ocr3.go @@ -5,11 +5,11 @@ import ( "fmt" "github.com/ethereum/go-ethereum/common" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" "github.com/smartcontractkit/chainlink-deployments-framework/operations" - changesetstate "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" "github.com/smartcontractkit/chainlink/deployment/cre/common/strategies" crecontracts "github.com/smartcontractkit/chainlink/deployment/cre/contracts" "github.com/smartcontractkit/chainlink/deployment/cre/jobs/pkg" @@ -63,7 +63,7 @@ func (l ConfigureOCR3) Apply(e cldf.Environment, input ConfigureOCR3Input) (cldf } contractAddr := common.HexToAddress(contractAddrRef.Address) - var mcmsContracts *changesetstate.MCMSWithTimelockState + var mcmsContracts *evmstate.MCMSWithTimelockState if input.MCMSConfig != nil { var mcmsErr error mcmsContracts, mcmsErr = strategies.GetMCMSContracts(e, input.ContractChainSelector, *input.MCMSConfig) diff --git a/deployment/cre/workflow_registry/v2/changeset/admin_workflow_registry.go b/deployment/cre/workflow_registry/v2/changeset/admin_workflow_registry.go index c056d6e334d..5cc50fc8906 100644 --- a/deployment/cre/workflow_registry/v2/changeset/admin_workflow_registry.go +++ b/deployment/cre/workflow_registry/v2/changeset/admin_workflow_registry.go @@ -6,13 +6,13 @@ import ( "math/big" "github.com/ethereum/go-ethereum/common" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" "github.com/smartcontractkit/mcms" "github.com/smartcontractkit/mcms/types" cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" "github.com/smartcontractkit/chainlink-deployments-framework/operations" - commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" "github.com/smartcontractkit/chainlink/deployment/cre/common/strategies" crecontracts "github.com/smartcontractkit/chainlink/deployment/cre/contracts" "github.com/smartcontractkit/chainlink/deployment/cre/workflow_registry/v2/changeset/operations/contracts" @@ -40,7 +40,7 @@ func (l AdminPauseWorkflow) VerifyPreconditions(e cldf.Environment, config Admin func (l AdminPauseWorkflow) Apply(e cldf.Environment, config AdminPauseWorkflowInput) (cldf.ChangesetOutput, error) { // Get MCMS contracts if needed - var mcmsContracts *commonchangeset.MCMSWithTimelockState + var mcmsContracts *evmstate.MCMSWithTimelockState if config.MCMSConfig != nil { var err error mcmsContracts, err = strategies.GetMCMSContracts(e, config.ChainSelector, *config.MCMSConfig) @@ -130,7 +130,7 @@ func (l AdminBatchPauseWorkflows) Apply(e cldf.Environment, config AdminBatchPau } // Get MCMS contracts if needed - var mcmsContracts *commonchangeset.MCMSWithTimelockState + var mcmsContracts *evmstate.MCMSWithTimelockState if config.MCMSConfig != nil { var err error mcmsContracts, err = strategies.GetMCMSContracts(e, config.ChainSelector, *config.MCMSConfig) @@ -214,7 +214,7 @@ func (l AdminPauseAllByOwner) VerifyPreconditions(e cldf.Environment, config Adm func (l AdminPauseAllByOwner) Apply(e cldf.Environment, config AdminPauseAllByOwnerInput) (cldf.ChangesetOutput, error) { // Get MCMS contracts if needed - var mcmsContracts *commonchangeset.MCMSWithTimelockState + var mcmsContracts *evmstate.MCMSWithTimelockState if config.MCMSConfig != nil { var err error mcmsContracts, err = strategies.GetMCMSContracts(e, config.ChainSelector, *config.MCMSConfig) @@ -299,7 +299,7 @@ func (l AdminPauseAllByDON) VerifyPreconditions(e cldf.Environment, config Admin func (l AdminPauseAllByDON) Apply(e cldf.Environment, config AdminPauseAllByDONInput) (cldf.ChangesetOutput, error) { // Get MCMS contracts if needed - var mcmsContracts *commonchangeset.MCMSWithTimelockState + var mcmsContracts *evmstate.MCMSWithTimelockState if config.MCMSConfig != nil { var err error mcmsContracts, err = strategies.GetMCMSContracts(e, config.ChainSelector, *config.MCMSConfig) diff --git a/deployment/cre/workflow_registry/v2/changeset/configure_workflow_registry.go b/deployment/cre/workflow_registry/v2/changeset/configure_workflow_registry.go index 45c8d774501..637b74f3678 100644 --- a/deployment/cre/workflow_registry/v2/changeset/configure_workflow_registry.go +++ b/deployment/cre/workflow_registry/v2/changeset/configure_workflow_registry.go @@ -5,13 +5,13 @@ import ( "fmt" "github.com/ethereum/go-ethereum/common" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" "github.com/smartcontractkit/mcms" "github.com/smartcontractkit/mcms/types" cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" "github.com/smartcontractkit/chainlink-deployments-framework/operations" - commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" "github.com/smartcontractkit/chainlink/deployment/cre/common/strategies" crecontracts "github.com/smartcontractkit/chainlink/deployment/cre/contracts" "github.com/smartcontractkit/chainlink/deployment/cre/workflow_registry/v2/changeset/operations/contracts" @@ -45,7 +45,7 @@ func (l SetConfig) VerifyPreconditions(e cldf.Environment, config SetConfigInput func (l SetConfig) Apply(e cldf.Environment, config SetConfigInput) (cldf.ChangesetOutput, error) { // Get MCMS contracts if needed - var mcmsContracts *commonchangeset.MCMSWithTimelockState + var mcmsContracts *evmstate.MCMSWithTimelockState if config.MCMSConfig != nil { var err error mcmsContracts, err = strategies.GetMCMSContracts(e, config.ChainSelector, *config.MCMSConfig) @@ -142,7 +142,7 @@ func (l UpdateAllowedSigners) Apply(e cldf.Environment, config UpdateAllowedSign } // Get MCMS contracts if needed - var mcmsContracts *commonchangeset.MCMSWithTimelockState + var mcmsContracts *evmstate.MCMSWithTimelockState if config.MCMSConfig != nil { var err error mcmsContracts, err = strategies.GetMCMSContracts(e, config.ChainSelector, *config.MCMSConfig) @@ -229,7 +229,7 @@ func (l SetWorkflowOwnerConfig) VerifyPreconditions(e cldf.Environment, config S func (l SetWorkflowOwnerConfig) Apply(e cldf.Environment, config SetWorkflowOwnerConfigInput) (cldf.ChangesetOutput, error) { // Get MCMS contracts if needed - var mcmsContracts *commonchangeset.MCMSWithTimelockState + var mcmsContracts *evmstate.MCMSWithTimelockState if config.MCMSConfig != nil { var err error mcmsContracts, err = strategies.GetMCMSContracts(e, config.ChainSelector, *config.MCMSConfig) @@ -317,7 +317,7 @@ func (l SetDONLimit) VerifyPreconditions(e cldf.Environment, config SetDONLimitI func (l SetDONLimit) Apply(e cldf.Environment, config SetDONLimitInput) (cldf.ChangesetOutput, error) { // Get MCMS contracts if needed - var mcmsContracts *commonchangeset.MCMSWithTimelockState + var mcmsContracts *evmstate.MCMSWithTimelockState if config.MCMSConfig != nil { var err error mcmsContracts, err = strategies.GetMCMSContracts(e, config.ChainSelector, *config.MCMSConfig) @@ -406,7 +406,7 @@ func (l SetUserDONOverride) VerifyPreconditions(e cldf.Environment, config SetUs func (l SetUserDONOverride) Apply(e cldf.Environment, config SetUserDONOverrideInput) (cldf.ChangesetOutput, error) { // Get MCMS contracts if needed - var mcmsContracts *commonchangeset.MCMSWithTimelockState + var mcmsContracts *evmstate.MCMSWithTimelockState if config.MCMSConfig != nil { var err error mcmsContracts, err = strategies.GetMCMSContracts(e, config.ChainSelector, *config.MCMSConfig) @@ -494,7 +494,7 @@ func (l SetCapabilitiesRegistry) VerifyPreconditions(e cldf.Environment, config func (l SetCapabilitiesRegistry) Apply(e cldf.Environment, config SetCapabilitiesRegistryInput) (cldf.ChangesetOutput, error) { // Get MCMS contracts if needed - var mcmsContracts *commonchangeset.MCMSWithTimelockState + var mcmsContracts *evmstate.MCMSWithTimelockState if config.MCMSConfig != nil { var err error mcmsContracts, err = strategies.GetMCMSContracts(e, config.ChainSelector, *config.MCMSConfig) diff --git a/deployment/cre/workflow_registry/v2/changeset/user_workflow_registry.go b/deployment/cre/workflow_registry/v2/changeset/user_workflow_registry.go index 8545d53e962..7b8cf6c56c8 100644 --- a/deployment/cre/workflow_registry/v2/changeset/user_workflow_registry.go +++ b/deployment/cre/workflow_registry/v2/changeset/user_workflow_registry.go @@ -8,12 +8,13 @@ import ( "strings" "github.com/ethereum/go-ethereum/common" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" "github.com/smartcontractkit/mcms" "github.com/smartcontractkit/mcms/types" cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" "github.com/smartcontractkit/chainlink-deployments-framework/operations" - commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" + "github.com/smartcontractkit/chainlink/deployment/cre/common/strategies" crecontracts "github.com/smartcontractkit/chainlink/deployment/cre/contracts" "github.com/smartcontractkit/chainlink/deployment/cre/workflow_registry/v2/changeset/operations/contracts" @@ -76,7 +77,7 @@ func (u UserWorkflowUpsert) VerifyPreconditions(e cldf.Environment, config UserW func (u UserWorkflowUpsert) Apply(e cldf.Environment, config UserWorkflowUpsertInput) (cldf.ChangesetOutput, error) { // Get MCMS contracts if needed - var mcmsContracts *commonchangeset.MCMSWithTimelockState + var mcmsContracts *evmstate.MCMSWithTimelockState if config.MCMSConfig != nil { var err error mcmsContracts, err = strategies.GetMCMSContracts(e, config.ChainSelector, *config.MCMSConfig) @@ -168,7 +169,7 @@ func (u UserWorkflowPause) VerifyPreconditions(e cldf.Environment, config UserWo func (u UserWorkflowPause) Apply(e cldf.Environment, config UserWorkflowPauseInput) (cldf.ChangesetOutput, error) { // Get MCMS contracts if needed - var mcmsContracts *commonchangeset.MCMSWithTimelockState + var mcmsContracts *evmstate.MCMSWithTimelockState if config.MCMSConfig != nil { var err error mcmsContracts, err = strategies.GetMCMSContracts(e, config.ChainSelector, *config.MCMSConfig) @@ -265,7 +266,7 @@ func (u UserWorkflowBatchPause) VerifyPreconditions(e cldf.Environment, config U func (u UserWorkflowBatchPause) Apply(e cldf.Environment, config UserWorkflowBatchPauseInput) (cldf.ChangesetOutput, error) { // Get MCMS contracts if needed - var mcmsContracts *commonchangeset.MCMSWithTimelockState + var mcmsContracts *evmstate.MCMSWithTimelockState if config.MCMSConfig != nil { var err error mcmsContracts, err = strategies.GetMCMSContracts(e, config.ChainSelector, *config.MCMSConfig) @@ -363,7 +364,7 @@ func (u UserWorkflowActivate) VerifyPreconditions(e cldf.Environment, config Use func (u UserWorkflowActivate) Apply(e cldf.Environment, config UserWorkflowActivateInput) (cldf.ChangesetOutput, error) { // Get MCMS contracts if needed - var mcmsContracts *commonchangeset.MCMSWithTimelockState + var mcmsContracts *evmstate.MCMSWithTimelockState if config.MCMSConfig != nil { var err error mcmsContracts, err = strategies.GetMCMSContracts(e, config.ChainSelector, *config.MCMSConfig) @@ -448,7 +449,7 @@ func (u UserWorkflowDelete) VerifyPreconditions(e cldf.Environment, config UserW func (u UserWorkflowDelete) Apply(e cldf.Environment, config UserWorkflowDeleteInput) (cldf.ChangesetOutput, error) { // Get MCMS contracts if needed - var mcmsContracts *commonchangeset.MCMSWithTimelockState + var mcmsContracts *evmstate.MCMSWithTimelockState if config.MCMSConfig != nil { var err error mcmsContracts, err = strategies.GetMCMSContracts(e, config.ChainSelector, *config.MCMSConfig) @@ -544,7 +545,7 @@ func (u UserLinkOwner) VerifyPreconditions(e cldf.Environment, config UserLinkOw func (u UserLinkOwner) Apply(e cldf.Environment, config UserLinkOwnerInput) (cldf.ChangesetOutput, error) { // Get MCMS contracts if needed - var mcmsContracts *commonchangeset.MCMSWithTimelockState + var mcmsContracts *evmstate.MCMSWithTimelockState if config.MCMSConfig != nil { var err error mcmsContracts, err = strategies.GetMCMSContracts(e, config.ChainSelector, *config.MCMSConfig) @@ -642,7 +643,7 @@ func (u UserUnlinkOwner) VerifyPreconditions(e cldf.Environment, config UserUnli func (u UserUnlinkOwner) Apply(e cldf.Environment, config UserUnlinkOwnerInput) (cldf.ChangesetOutput, error) { // Get MCMS contracts if needed - var mcmsContracts *commonchangeset.MCMSWithTimelockState + var mcmsContracts *evmstate.MCMSWithTimelockState if config.MCMSConfig != nil { var err error mcmsContracts, err = strategies.GetMCMSContracts(e, config.ChainSelector, *config.MCMSConfig) @@ -736,7 +737,7 @@ func (u UserAllowlistRequest) VerifyPreconditions(e cldf.Environment, config Use func (u UserAllowlistRequest) Apply(e cldf.Environment, config UserAllowlistRequestInput) (cldf.ChangesetOutput, error) { // Get MCMS contracts if needed - var mcmsContracts *commonchangeset.MCMSWithTimelockState + var mcmsContracts *evmstate.MCMSWithTimelockState if config.MCMSConfig != nil { var err error mcmsContracts, err = strategies.GetMCMSContracts(e, config.ChainSelector, *config.MCMSConfig) diff --git a/deployment/data-feeds/changeset/proposal.go b/deployment/data-feeds/changeset/proposal.go index 4048b9013b3..15c8566ae0b 100644 --- a/deployment/data-feeds/changeset/proposal.go +++ b/deployment/data-feeds/changeset/proposal.go @@ -6,13 +6,12 @@ import ( "time" gethTypes "github.com/ethereum/go-ethereum/core/types" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" mcmslib "github.com/smartcontractkit/mcms" "github.com/smartcontractkit/mcms/sdk" "github.com/smartcontractkit/mcms/sdk/evm" mcmstypes "github.com/smartcontractkit/mcms/types" - commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" - cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" @@ -32,7 +31,7 @@ func BuildMultiChainProposals(env cldf.Environment, description string, proposal var proposerMCMSes = map[uint64]string{} var inspectorPerChain = map[uint64]sdk.Inspector{} var batches []mcmstypes.BatchOperation - mcmsStateCache := make(map[string]map[uint64]*commonchangeset.MCMSWithTimelockState) + mcmsStateCache := make(map[string]map[uint64]*evmstate.MCMSWithTimelockState) for chainSelector, proposalData := range proposalConfig { var transactions []mcmstypes.Transaction @@ -40,7 +39,7 @@ func BuildMultiChainProposals(env cldf.Environment, description string, proposal cacheKey := fmt.Sprintf("%d:%s", chainSelector, proposal.timeLockQualifier) // Load MCMS state only if not already cached if _, exists := mcmsStateCache[cacheKey]; !exists { - mcmsChainState, err := commonchangeset.MaybeLoadMCMSWithTimelockStateWithQualifier(env, []uint64{chainSelector}, proposal.timeLockQualifier) + mcmsChainState, err := evmstate.MaybeLoadMCMSWithTimelockStateWithQualifier(env, []uint64{chainSelector}, proposal.timeLockQualifier) if err != nil { return nil, fmt.Errorf("failed to load MCMS contracts for chain %d: %w", chainSelector, err) } diff --git a/deployment/keystone/changeset/deploy_ocr3.go b/deployment/keystone/changeset/deploy_ocr3.go index 5d132da68d8..bbf262af676 100644 --- a/deployment/keystone/changeset/deploy_ocr3.go +++ b/deployment/keystone/changeset/deploy_ocr3.go @@ -7,6 +7,7 @@ import ( "io" "github.com/ethereum/go-ethereum/common" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" ocr3_capability "github.com/smartcontractkit/chainlink-evm/gethwrappers/keystone/generated/ocr3_capability_1_0_0" @@ -14,7 +15,6 @@ import ( "github.com/smartcontractkit/mcms" mcmstypes "github.com/smartcontractkit/mcms/types" - changesetstate "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" "github.com/smartcontractkit/chainlink/deployment/cre/common/strategies" "github.com/smartcontractkit/chainlink/deployment/cre/contracts" "github.com/smartcontractkit/chainlink/deployment/cre/ocr3" @@ -68,7 +68,7 @@ func ConfigureOCR3Contract(env cldf.Environment, cfg ConfigureOCR3Config) (cldf. return cldf.ChangesetOutput{}, fmt.Errorf("failed to get OCR3 contract: %w", err) } - var mcmsContracts *changesetstate.MCMSWithTimelockState + var mcmsContracts *evmstate.MCMSWithTimelockState if cfg.UseMCMS() { var mcmsErr error mcmsContracts, mcmsErr = strategies.GetMCMSContracts(env, cfg.ChainSel, *cfg.MCMSConfig) diff --git a/deployment/keystone/changeset/operations/contracts/deploy_configure_forwarders_seq.go b/deployment/keystone/changeset/operations/contracts/deploy_configure_forwarders_seq.go index e39af6ce0c8..e94871d5cca 100644 --- a/deployment/keystone/changeset/operations/contracts/deploy_configure_forwarders_seq.go +++ b/deployment/keystone/changeset/operations/contracts/deploy_configure_forwarders_seq.go @@ -6,6 +6,7 @@ import ( "github.com/Masterminds/semver/v3" "github.com/ethereum/go-ethereum/common" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" mcmslib "github.com/smartcontractkit/mcms" "github.com/smartcontractkit/mcms/sdk" @@ -20,10 +21,10 @@ import ( forwarder "github.com/smartcontractkit/chainlink-evm/gethwrappers/keystone/generated/forwarder_1_0_0" "github.com/smartcontractkit/chainlink-common/keystore/corekeys/p2pkey" + "github.com/smartcontractkit/chainlink/deployment" mcmsOps "github.com/smartcontractkit/chainlink/deployment/common/changeset/evm/mcms/ops" mcmsSeqs "github.com/smartcontractkit/chainlink/deployment/common/changeset/evm/mcms/seqs" - mcmschangesetstate "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" "github.com/smartcontractkit/chainlink/deployment/common/types" contracts2 "github.com/smartcontractkit/chainlink/deployment/cre/capabilities_registry/v2/changeset/operations/contracts" @@ -265,7 +266,7 @@ func configureForwarderOp( return fmt.Errorf("configure-forwarders-seq failed: failed to get KeystoneForwarder contract for chain selector %d: %w", target, err) } - var mcmsContracts *mcmschangesetstate.MCMSWithTimelockState + var mcmsContracts *evmstate.MCMSWithTimelockState if input.MCMSConfig != nil { var mcmsErr error mcmsContracts, mcmsErr = strategies.GetMCMSContracts(*deps.Env, chain.Selector, *input.MCMSConfig) diff --git a/deployment/keystone/changeset/workflowregistry/strategies.go b/deployment/keystone/changeset/workflowregistry/strategies.go index fa704ce1fb9..2ad90f17c5c 100644 --- a/deployment/keystone/changeset/workflowregistry/strategies.go +++ b/deployment/keystone/changeset/workflowregistry/strategies.go @@ -6,6 +6,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" mcmslib "github.com/smartcontractkit/mcms" "github.com/smartcontractkit/mcms/sdk" mcmstypes "github.com/smartcontractkit/mcms/types" @@ -15,7 +16,6 @@ import ( cldf_evm "github.com/smartcontractkit/chainlink-deployments-framework/chain/evm" cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" - "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" "github.com/smartcontractkit/chainlink/deployment/keystone/changeset" ) @@ -115,7 +115,7 @@ type MCMSTransactionV2 struct { Description string Address common.Address ChainSel uint64 - MCMSContracts *state.MCMSWithTimelockState + MCMSContracts *evmstate.MCMSWithTimelockState Env cldf.Environment } diff --git a/deployment/vault/changeset/validation.go b/deployment/vault/changeset/validation.go index ee9c1595b31..936591cf781 100644 --- a/deployment/vault/changeset/validation.go +++ b/deployment/vault/changeset/validation.go @@ -11,8 +11,9 @@ import ( cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" + "github.com/smartcontractkit/chainlink/deployment/common/changeset" - evmstate "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" commontypes "github.com/smartcontractkit/chainlink/deployment/common/types" "github.com/smartcontractkit/chainlink/deployment/vault/changeset/types" diff --git a/deployment/vault/view/view.go b/deployment/vault/view/view.go index 652c5fc2571..ab6728bff99 100644 --- a/deployment/vault/view/view.go +++ b/deployment/vault/view/view.go @@ -6,9 +6,9 @@ import ( "slices" cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" + mcmsv10 "github.com/smartcontractkit/cld-changesets/pkg/contract/mcms/view/v1_0" + evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm" - "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" - "github.com/smartcontractkit/chainlink/deployment/common/view/v1_0" "github.com/smartcontractkit/chainlink/deployment/vault/changeset" "github.com/smartcontractkit/chainlink/deployment/vault/changeset/types" ) @@ -18,7 +18,7 @@ var _ cldf.ViewStateV2 = Vault type VaultView struct { TimelockBalances map[uint64]*types.TimelockNativeBalanceInfo `json:"timelock_balances"` WhitelistedAddresses map[uint64][]changeset.WhitelistEntry `json:"whitelisted_addresses"` - MCMSWithTimelock map[uint64]v1_0.MCMSWithTimelockView `json:"mcms_with_timelock,omitempty"` + MCMSWithTimelock map[uint64]mcmsv10.MCMSWithTimelockView `json:"mcms_with_timelock,omitempty"` } func (v *VaultView) MarshalJSON() ([]byte, error) { @@ -52,7 +52,7 @@ func Vault(e cldf.Environment, _ json.Marshaler) (json.Marshaler, error) { func GenerateVaultView(e cldf.Environment, chainSelectors []uint64) (*VaultView, error) { view := &VaultView{ WhitelistedAddresses: make(map[uint64][]changeset.WhitelistEntry), - MCMSWithTimelock: make(map[uint64]v1_0.MCMSWithTimelockView), + MCMSWithTimelock: make(map[uint64]mcmsv10.MCMSWithTimelockView), } balances, err := changeset.GetTimelockBalances(e, chainSelectors) @@ -67,7 +67,7 @@ func GenerateVaultView(e cldf.Environment, chainSelectors []uint64) (*VaultView, } view.WhitelistedAddresses = addresses - mcmsStates, err := state.MaybeLoadMCMSWithTimelockStateDataStore(e, chainSelectors) + mcmsStates, err := evmstate.MaybeLoadMCMSWithTimelockStateDataStore(e, chainSelectors) if err != nil { e.Logger.Warnf("Failed to load MCMS state (this may be expected if MCMS is not deployed): %v", err) } else {