diff --git a/deployment/ccip/changeset/deployer_group_test.go b/deployment/ccip/changeset/deployer_group_test.go index cd58633df7c..edacadb5de1 100644 --- a/deployment/ccip/changeset/deployer_group_test.go +++ b/deployment/ccip/changeset/deployer_group_test.go @@ -360,14 +360,14 @@ func TestDeployerGroupMultipleProposalsMCMS(t *testing.T) { e, _ := testhelpers.NewMemoryEnvironment(t, testhelpers.WithNumOfChains(2)) - state, err := changeset.LoadOnchainState(e.Env) + currentState, err := changeset.LoadOnchainState(e.Env) require.NoError(t, err) - timelocksPerChain := changeset.BuildTimelockPerChain(e.Env, state) + timelocksPerChain := changeset.BuildTimelockPerChain(e.Env, currentState) contractsByChain := make(map[uint64][]common.Address) for _, chain := range e.Env.AllChainSelectors() { - contractsByChain[chain] = []common.Address{state.Chains[chain].LinkToken.Address()} + contractsByChain[chain] = []common.Address{currentState.Chains[chain].LinkToken.Address()} } _, err = commonchangeset.Apply(t, e.Env, timelocksPerChain, @@ -397,10 +397,10 @@ func TestDeployerGroupMultipleProposalsMCMS(t *testing.T) { ) require.NoError(t, err) - state, err = changeset.LoadOnchainState(e.Env) + currentState, err = changeset.LoadOnchainState(e.Env) require.NoError(t, err) - token := state.Chains[e.HomeChainSel].LinkToken + token := currentState.Chains[e.HomeChainSel].LinkToken amount, err := token.BalanceOf(nil, cfg.address) require.NoError(t, err) diff --git a/deployment/ccip/changeset/solana/cs_chain_contracts.go b/deployment/ccip/changeset/solana/cs_chain_contracts.go index cd54f7d76e0..a7978504c06 100644 --- a/deployment/ccip/changeset/solana/cs_chain_contracts.go +++ b/deployment/ccip/changeset/solana/cs_chain_contracts.go @@ -12,10 +12,11 @@ import ( solState "github.com/smartcontractkit/chainlink-ccip/chains/solana/utils/state" "github.com/smartcontractkit/chainlink/deployment" - cs "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_6" ) -var _ deployment.ChangeSet[cs.SetOCR3OffRampConfig] = SetOCR3ConfigSolana +var _ deployment.ChangeSet[v1_6.SetOCR3OffRampConfig] = SetOCR3ConfigSolana var _ deployment.ChangeSet[AddRemoteChainToSolanaConfig] = AddRemoteChainToSolana var _ deployment.ChangeSet[BillingTokenConfig] = AddBillingToken var _ deployment.ChangeSet[BillingTokenForRemoteChainConfig] = AddBillingTokenForRemoteChain @@ -44,7 +45,7 @@ func commonValidation(e deployment.Environment, selector uint64, tokenPubKey sol if !ok { return fmt.Errorf("chain selector %d not found in environment", selector) } - state, err := cs.LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return fmt.Errorf("failed to load onchain state: %w", err) } @@ -68,7 +69,7 @@ func commonValidation(e deployment.Environment, selector uint64, tokenPubKey sol return nil } -func validateRouterConfig(chain deployment.SolChain, chainState cs.SolCCIPChainState) error { +func validateRouterConfig(chain deployment.SolChain, chainState changeset.SolCCIPChainState) error { if chainState.Router.IsZero() { return fmt.Errorf("router not found in existing state, deploy the router first for chain %d", chain.Selector) } @@ -81,7 +82,7 @@ func validateRouterConfig(chain deployment.SolChain, chainState cs.SolCCIPChainS return nil } -func validateFeeQuoterConfig(chain deployment.SolChain, chainState cs.SolCCIPChainState) error { +func validateFeeQuoterConfig(chain deployment.SolChain, chainState changeset.SolCCIPChainState) error { if chainState.FeeQuoter.IsZero() { return fmt.Errorf("fee quoter not found in existing state, deploy the fee quoter first for chain %d", chain.Selector) } @@ -94,7 +95,7 @@ func validateFeeQuoterConfig(chain deployment.SolChain, chainState cs.SolCCIPCha return nil } -func validateOffRampConfig(chain deployment.SolChain, chainState cs.SolCCIPChainState) error { +func validateOffRampConfig(chain deployment.SolChain, chainState changeset.SolCCIPChainState) error { if chainState.OffRamp.IsZero() { return fmt.Errorf("offramp not found in existing state, deploy the offramp first for chain %d", chain.Selector) } diff --git a/deployment/ccip/changeset/solana/cs_chain_contracts_test.go b/deployment/ccip/changeset/solana/cs_chain_contracts_test.go index 5734604e730..a9ce0721c7a 100644 --- a/deployment/ccip/changeset/solana/cs_chain_contracts_test.go +++ b/deployment/ccip/changeset/solana/cs_chain_contracts_test.go @@ -15,9 +15,11 @@ import ( solTokenUtil "github.com/smartcontractkit/chainlink-ccip/chains/solana/utils/tokens" "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/testcontext" + ccipChangeset "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" changeset_solana "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/solana" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_6" "github.com/smartcontractkit/chainlink/deployment" commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset" @@ -38,9 +40,9 @@ func TestAddRemoteChain(t *testing.T) { tenv.Env, err = commonchangeset.Apply(t, tenv.Env, nil, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(ccipChangeset.UpdateOnRampsDestsChangeset), - ccipChangeset.UpdateOnRampDestsConfig{ - UpdatesByChain: map[uint64]map[uint64]ccipChangeset.OnRampDestinationUpdate{ + deployment.CreateLegacyChangeSet(v1_6.UpdateOnRampsDestsChangeset), + v1_6.UpdateOnRampDestsConfig{ + UpdatesByChain: map[uint64]map[uint64]v1_6.OnRampDestinationUpdate{ evmChain: { solChain: { IsEnabled: true, diff --git a/deployment/ccip/changeset/solana/cs_deploy_chain.go b/deployment/ccip/changeset/solana/cs_deploy_chain.go index 6badbd6aaba..c93d98ca248 100644 --- a/deployment/ccip/changeset/solana/cs_deploy_chain.go +++ b/deployment/ccip/changeset/solana/cs_deploy_chain.go @@ -9,7 +9,8 @@ import ( "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" - cs "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" + state2 "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_6" solBinary "github.com/gagliardetto/binary" solRpc "github.com/gagliardetto/solana-go/rpc" @@ -21,20 +22,20 @@ import ( solState "github.com/smartcontractkit/chainlink-ccip/chains/solana/utils/state" ) -var _ deployment.ChangeSet[changeset.DeployChainContractsConfig] = DeployChainContractsChangesetSolana +var _ deployment.ChangeSet[v1_6.DeployChainContractsConfig] = DeployChainContractsChangesetSolana -func DeployChainContractsChangesetSolana(e deployment.Environment, c changeset.DeployChainContractsConfig) (deployment.ChangesetOutput, error) { +func DeployChainContractsChangesetSolana(e deployment.Environment, c v1_6.DeployChainContractsConfig) (deployment.ChangesetOutput, error) { if err := c.Validate(); err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("invalid DeployChainContractsConfig: %w", err) } newAddresses := deployment.NewMemoryAddressBook() - existingState, err := changeset.LoadOnchainState(e) + existingState, err := state2.LoadOnchainState(e) if err != nil { e.Logger.Errorw("Failed to load existing onchain state", "err", err) return deployment.ChangesetOutput{}, err } - err = changeset.ValidateHomeChainState(e, c.HomeChainSelector, existingState) + err = v1_6.ValidateHomeChainState(e, c.HomeChainSelector, existingState) if err != nil { return deployment.ChangesetOutput{}, err } @@ -282,7 +283,7 @@ func deployChainContractsSolana( return fmt.Errorf("failed to deploy program: %w", err) } - tv := deployment.NewTypeAndVersion(changeset.FeeQuoter, deployment.Version1_0_0) + tv := deployment.NewTypeAndVersion(state2.FeeQuoter, deployment.Version1_0_0) e.Logger.Infow("Deployed contract", "Contract", tv.String(), "addr", programID, "chain", chain.String()) feeQuoterAddress = solana.MustPublicKeyFromBase58(programID) @@ -305,7 +306,7 @@ func deployChainContractsSolana( return fmt.Errorf("failed to deploy program: %w", err) } - tv := deployment.NewTypeAndVersion(changeset.Router, deployment.Version1_0_0) + tv := deployment.NewTypeAndVersion(state2.Router, deployment.Version1_0_0) e.Logger.Infow("Deployed contract", "Contract", tv.String(), "addr", programID, "chain", chain.String()) ccipRouterProgram = solana.MustPublicKeyFromBase58(programID) @@ -327,7 +328,7 @@ func deployChainContractsSolana( if err != nil { return fmt.Errorf("failed to deploy program: %w", err) } - tv := deployment.NewTypeAndVersion(changeset.OffRamp, deployment.Version1_0_0) + tv := deployment.NewTypeAndVersion(state2.OffRamp, deployment.Version1_0_0) e.Logger.Infow("Deployed contract", "Contract", tv.String(), "addr", programID, "chain", chain.String()) offRampAddress = solana.MustPublicKeyFromBase58(programID) err = ab.Save(chain.Selector, programID, tv) @@ -437,7 +438,7 @@ type SetFeeAggregatorConfig struct { } func (cfg SetFeeAggregatorConfig) Validate(e deployment.Environment) error { - state, err := cs.LoadOnchainState(e) + state, err := state2.LoadOnchainState(e) if err != nil { return fmt.Errorf("failed to load onchain state: %w", err) } @@ -468,7 +469,7 @@ func SetFeeAggregator(e deployment.Environment, cfg SetFeeAggregatorConfig) (dep return deployment.ChangesetOutput{}, err } - state, _ := cs.LoadOnchainState(e) + state, _ := state2.LoadOnchainState(e) chainState := state.SolChains[cfg.ChainSelector] chain := e.SolChains[cfg.ChainSelector] diff --git a/deployment/ccip/changeset/solana/cs_deploy_chain_test.go b/deployment/ccip/changeset/solana/cs_deploy_chain_test.go index 5be5006d6b4..f9068a64653 100644 --- a/deployment/ccip/changeset/solana/cs_deploy_chain_test.go +++ b/deployment/ccip/changeset/solana/cs_deploy_chain_test.go @@ -11,6 +11,7 @@ import ( "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" cs_solana "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/solana" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_6" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" "github.com/smartcontractkit/chainlink/deployment/environment/memory" "github.com/smartcontractkit/chainlink/v2/core/logger" @@ -34,12 +35,12 @@ func TestDeployChainContractsChangesetSolana(t *testing.T) { nodes, err := deployment.NodeInfo(e.NodeIDs, e.Offchain) require.NoError(t, err) cfg := make(map[uint64]commontypes.MCMSWithTimelockConfigV2) - contractParams := make(map[uint64]changeset.ChainContractParams) + contractParams := make(map[uint64]v1_6.ChainContractParams) for _, chain := range e.AllChainSelectors() { cfg[chain] = proposalutils.SingleGroupTimelockConfigV2(t) - contractParams[chain] = changeset.ChainContractParams{ - FeeQuoterParams: changeset.DefaultFeeQuoterParams(), - OffRampParams: changeset.DefaultOffRampParams(), + contractParams[chain] = v1_6.ChainContractParams{ + FeeQuoterParams: v1_6.DefaultFeeQuoterParams(), + OffRampParams: v1_6.DefaultOffRampParams(), } } prereqCfg := make([]changeset.DeployPrerequisiteConfigPerChain, 0) @@ -55,8 +56,8 @@ func TestDeployChainContractsChangesetSolana(t *testing.T) { testhelpers.SavePreloadedSolAddresses(t, e, solChainSelectors[0]) e, err = commonchangeset.Apply(t, e, nil, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.DeployHomeChainChangeset), - changeset.DeployHomeChainConfig{ + deployment.CreateLegacyChangeSet(v1_6.DeployHomeChainChangeset), + v1_6.DeployHomeChainConfig{ HomeChainSel: homeChainSel, RMNStaticConfig: testhelpers.NewTestRMNStaticConfig(), RMNDynamicConfig: testhelpers.NewTestRMNDynamicConfig(), @@ -86,20 +87,20 @@ func TestDeployChainContractsChangesetSolana(t *testing.T) { }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.DeployChainContractsChangeset), - changeset.DeployChainContractsConfig{ + deployment.CreateLegacyChangeSet(v1_6.DeployChainContractsChangeset), + v1_6.DeployChainContractsConfig{ HomeChainSelector: homeChainSel, ContractParamsPerChain: contractParams, }, ), commonchangeset.Configure( deployment.CreateLegacyChangeSet(cs_solana.DeployChainContractsChangesetSolana), - changeset.DeployChainContractsConfig{ + v1_6.DeployChainContractsConfig{ HomeChainSelector: homeChainSel, - ContractParamsPerChain: map[uint64]changeset.ChainContractParams{ + ContractParamsPerChain: map[uint64]v1_6.ChainContractParams{ solChainSelectors[0]: { - FeeQuoterParams: changeset.DefaultFeeQuoterParams(), - OffRampParams: changeset.DefaultOffRampParams(), + FeeQuoterParams: v1_6.DefaultFeeQuoterParams(), + OffRampParams: v1_6.DefaultOffRampParams(), }, }, }, diff --git a/deployment/ccip/changeset/solana/cs_set_ocr3.go b/deployment/ccip/changeset/solana/cs_set_ocr3.go index 1dd2145b920..2c71cb28fc8 100644 --- a/deployment/ccip/changeset/solana/cs_set_ocr3.go +++ b/deployment/ccip/changeset/solana/cs_set_ocr3.go @@ -9,8 +9,9 @@ import ( solOffRamp "github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings/ccip_offramp" "github.com/smartcontractkit/chainlink/deployment" - cs "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/internal" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_6" ) const ( @@ -32,8 +33,8 @@ func btoi(b bool) uint8 { // run after the candidate is confirmed to be working correctly. // Multichain is especially helpful for NOP rotations where we have // to touch all the chain to change signers. -func SetOCR3ConfigSolana(e deployment.Environment, cfg cs.SetOCR3OffRampConfig) (deployment.ChangesetOutput, error) { - state, err := cs.LoadOnchainState(e) +func SetOCR3ConfigSolana(e deployment.Environment, cfg v1_6.SetOCR3OffRampConfig) (deployment.ChangesetOutput, error) { + state, err := changeset.LoadOnchainState(e) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to load onchain state: %w", err) } @@ -105,7 +106,7 @@ func SetOCR3ConfigSolana(e deployment.Environment, cfg cs.SetOCR3OffRampConfig) func isOCR3ConfigSetOnOffRampSolana( e deployment.Environment, chain deployment.SolChain, - chainState cs.SolCCIPChainState, + chainState changeset.SolCCIPChainState, args []internal.MultiOCR3BaseOCRConfigArgsSolana, ) (bool, error) { var configAccount solOffRamp.Config diff --git a/deployment/ccip/changeset/solana/cs_solana_token_test.go b/deployment/ccip/changeset/solana/cs_solana_token_test.go index c46e7eae7ad..d50eee74360 100644 --- a/deployment/ccip/changeset/solana/cs_solana_token_test.go +++ b/deployment/ccip/changeset/solana/cs_solana_token_test.go @@ -10,6 +10,7 @@ import ( "go.uber.org/zap/zapcore" solTokenUtil "github.com/smartcontractkit/chainlink-ccip/chains/solana/utils/tokens" + "github.com/smartcontractkit/chainlink/deployment" ccipChangeset "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" changeset_solana "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/solana" diff --git a/deployment/ccip/changeset/solana/cs_token_pool.go b/deployment/ccip/changeset/solana/cs_token_pool.go index 5e6315eba18..cdf61704cf9 100644 --- a/deployment/ccip/changeset/solana/cs_token_pool.go +++ b/deployment/ccip/changeset/solana/cs_token_pool.go @@ -13,7 +13,8 @@ import ( solTokenUtil "github.com/smartcontractkit/chainlink-ccip/chains/solana/utils/tokens" "github.com/smartcontractkit/chainlink/deployment" - cs "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" + state2 "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" ) var _ deployment.ChangeSet[TokenPoolConfig] = AddTokenPool @@ -32,7 +33,7 @@ func (cfg TokenPoolConfig) Validate(e deployment.Environment) error { if err := commonValidation(e, cfg.ChainSelector, tokenPubKey); err != nil { return err } - state, _ := cs.LoadOnchainState(e) + state, _ := state2.LoadOnchainState(e) chainState := state.SolChains[cfg.ChainSelector] if chainState.TokenPool.IsZero() { return fmt.Errorf("token pool not found in existing state, deploy the token pool first for chain %d", cfg.ChainSelector) @@ -59,7 +60,7 @@ func AddTokenPool(e deployment.Environment, cfg TokenPoolConfig) (deployment.Cha return deployment.ChangesetOutput{}, err } chain := e.SolChains[cfg.ChainSelector] - state, _ := cs.LoadOnchainState(e) + state, _ := state2.LoadOnchainState(e) chainState := state.SolChains[cfg.ChainSelector] authorityPubKey := solana.MustPublicKeyFromBase58(cfg.Authority) tokenPubKey := solana.MustPublicKeyFromBase58(cfg.TokenPubKey) @@ -136,7 +137,7 @@ func (cfg RemoteChainTokenPoolConfig) Validate(e deployment.Environment) error { if err := commonValidation(e, cfg.SolChainSelector, tokenPubKey); err != nil { return err } - state, _ := cs.LoadOnchainState(e) + state, _ := state2.LoadOnchainState(e) chainState := state.SolChains[cfg.SolChainSelector] if chainState.TokenPool.IsZero() { return fmt.Errorf("token pool not found in existing state, deploy token pool for chain %d", cfg.SolChainSelector) @@ -173,7 +174,7 @@ func SetupTokenPoolForRemoteChain(e deployment.Environment, cfg RemoteChainToken } tokenPubKey := solana.MustPublicKeyFromBase58(cfg.SolTokenPubKey) chain := e.SolChains[cfg.SolChainSelector] - state, _ := cs.LoadOnchainState(e) + state, _ := state2.LoadOnchainState(e) chainState := state.SolChains[cfg.SolChainSelector] // verified poolConfigPDA, _ := solTokenUtil.TokenPoolConfigAddress(tokenPubKey, chainState.TokenPool) @@ -240,7 +241,7 @@ func (cfg TokenPoolLookupTableConfig) Validate(e deployment.Environment) error { if err := commonValidation(e, cfg.ChainSelector, tokenPubKey); err != nil { return err } - state, _ := cs.LoadOnchainState(e) + state, _ := state2.LoadOnchainState(e) chainState := state.SolChains[cfg.ChainSelector] if chainState.TokenPool.IsZero() { return fmt.Errorf("token pool not found in existing state, deploy the token pool first for chain %d", cfg.ChainSelector) @@ -256,7 +257,7 @@ func AddTokenPoolLookupTable(e deployment.Environment, cfg TokenPoolLookupTableC chain := e.SolChains[cfg.ChainSelector] ctx := e.GetContext() client := chain.Client - state, _ := cs.LoadOnchainState(e) + state, _ := state2.LoadOnchainState(e) chainState := state.SolChains[cfg.ChainSelector] authorityPrivKey := chain.DeployerKey // assuming the authority is the deployer key tokenPubKey := solana.MustPublicKeyFromBase58(cfg.TokenPubKey) @@ -293,7 +294,7 @@ func AddTokenPoolLookupTable(e deployment.Environment, cfg TokenPoolLookupTableC return deployment.ChangesetOutput{}, fmt.Errorf("failed to await slot change while extending lookup table: %w", err) } newAddressBook := deployment.NewMemoryAddressBook() - tv := deployment.NewTypeAndVersion(cs.TokenPoolLookupTable, deployment.Version1_0_0) + tv := deployment.NewTypeAndVersion(changeset.TokenPoolLookupTable, deployment.Version1_0_0) tv.Labels.Add(tokenPubKey.String()) if err := newAddressBook.Save(cfg.ChainSelector, table.String(), tv); err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to save tokenpool address lookup table: %w", err) @@ -317,7 +318,7 @@ func (cfg SetPoolConfig) Validate(e deployment.Environment) error { if err := commonValidation(e, cfg.ChainSelector, tokenPubKey); err != nil { return err } - state, _ := cs.LoadOnchainState(e) + state, _ := state2.LoadOnchainState(e) chainState := state.SolChains[cfg.ChainSelector] chain := e.SolChains[cfg.ChainSelector] if chainState.TokenPool.IsZero() { @@ -344,7 +345,7 @@ func SetPool(e deployment.Environment, cfg SetPoolConfig) (deployment.ChangesetO } chain := e.SolChains[cfg.ChainSelector] - state, _ := cs.LoadOnchainState(e) + state, _ := state2.LoadOnchainState(e) chainState := state.SolChains[cfg.ChainSelector] tokenPubKey := solana.MustPublicKeyFromBase58(cfg.TokenPubKey) routerConfigPDA, _, _ := solState.FindConfigPDA(chainState.Router) diff --git a/deployment/ccip/changeset/solana/ownership_transfer_helpers.go b/deployment/ccip/changeset/solana/ownership_transfer_helpers.go index 07b7c2a5dbe..094c3d3bc75 100644 --- a/deployment/ccip/changeset/solana/ownership_transfer_helpers.go +++ b/deployment/ccip/changeset/solana/ownership_transfer_helpers.go @@ -13,7 +13,7 @@ import ( "github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings/fee_quoter" "github.com/smartcontractkit/chainlink/deployment" - "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" + state2 "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" ) @@ -83,7 +83,7 @@ func transferAndWrapAcceptOwnership( // transferOwnershipRouter transfers ownership of the router to the timelock. func transferOwnershipRouter( - ccipState changeset.CCIPOnChainState, + ccipState state2.CCIPOnChainState, chainSelector uint64, solChain deployment.SolChain, timelockProgramID solana.PublicKey, @@ -130,7 +130,7 @@ func transferOwnershipRouter( routerConfigPDA, // config PDA solChain.DeployerKey.PublicKey(), solChain, - changeset.Router, + state2.Router, ) if err != nil { @@ -143,7 +143,7 @@ func transferOwnershipRouter( // transferOwnershipFeeQuoter transfers ownership of the fee quoter to the timelock. func transferOwnershipFeeQuoter( - ccipState changeset.CCIPOnChainState, + ccipState state2.CCIPOnChainState, chainSelector uint64, solChain deployment.SolChain, timelockProgramID solana.PublicKey, @@ -190,7 +190,7 @@ func transferOwnershipFeeQuoter( feeQuoterConfigPDA, // config PDA solChain.DeployerKey.PublicKey(), solChain, - changeset.FeeQuoter, + state2.FeeQuoter, ) if err != nil { @@ -203,7 +203,7 @@ func transferOwnershipFeeQuoter( // transferOwnershipOffRamp transfers ownership of the offRamp to the timelock. func transferOwnershipOffRamp( - ccipState changeset.CCIPOnChainState, + ccipState state2.CCIPOnChainState, chainSelector uint64, solChain deployment.SolChain, timelockProgramID solana.PublicKey, @@ -250,7 +250,7 @@ func transferOwnershipOffRamp( offRampConfigPDA, // config PDA solChain.DeployerKey.PublicKey(), solChain, - changeset.OffRamp, + state2.OffRamp, ) if err != nil { diff --git a/deployment/ccip/changeset/solana/transfer_ccip_to_mcms_with_timelock.go b/deployment/ccip/changeset/solana/transfer_ccip_to_mcms_with_timelock.go index 25fc6e9c90b..6a71f10f8c8 100644 --- a/deployment/ccip/changeset/solana/transfer_ccip_to_mcms_with_timelock.go +++ b/deployment/ccip/changeset/solana/transfer_ccip_to_mcms_with_timelock.go @@ -13,7 +13,7 @@ import ( mcmsTypes "github.com/smartcontractkit/mcms/types" "github.com/smartcontractkit/chainlink/deployment" - "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" + state2 "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" "github.com/smartcontractkit/chainlink/deployment/common/types" @@ -37,7 +37,7 @@ type TransferCCIPToMCMSWithTimelockSolanaConfig struct { } // ValidateContracts checks if the required contracts are present on the chain -func ValidateContracts(state changeset.SolCCIPChainState, chainSelector uint64, contracts CCIPContractsToTransfer) error { +func ValidateContracts(state state2.SolCCIPChainState, chainSelector uint64, contracts CCIPContractsToTransfer) error { contractChecks := []struct { enabled bool value solana.PublicKey @@ -58,7 +58,7 @@ func ValidateContracts(state changeset.SolCCIPChainState, chainSelector uint64, } func (cfg TransferCCIPToMCMSWithTimelockSolanaConfig) Validate(e deployment.Environment) error { - ccipState, err := changeset.LoadOnchainStateSolana(e) + ccipState, err := state2.LoadOnchainStateSolana(e) if err != nil { return fmt.Errorf("failed to load onchain state: %w", err) } @@ -131,7 +131,7 @@ func TransferCCIPToMCMSWithTimelockSolana( } var batches []mcmsTypes.BatchOperation - ccipState, err := changeset.LoadOnchainStateSolana(e) + ccipState, err := state2.LoadOnchainStateSolana(e) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to load onchain state: %w", err) } diff --git a/deployment/ccip/changeset/solana/transfer_ccip_to_mcms_with_timelock_test.go b/deployment/ccip/changeset/solana/transfer_ccip_to_mcms_with_timelock_test.go index d1deb8b6ada..3b17643bbad 100644 --- a/deployment/ccip/changeset/solana/transfer_ccip_to_mcms_with_timelock_test.go +++ b/deployment/ccip/changeset/solana/transfer_ccip_to_mcms_with_timelock_test.go @@ -18,10 +18,11 @@ import ( "github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings/fee_quoter" "github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings/test_token_pool" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_6" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/deployment" - "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" solanachangesets "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/solana" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers" commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset" @@ -202,11 +203,11 @@ func prepareEnvironmentForOwnershipTransfer(t *testing.T) (deployment.Environmen // Fund account for fees testutils.FundAccounts(e.GetContext(), []solana.PrivateKey{*solChain.DeployerKey}, solChain.Client, t) cfg := make(map[uint64]commontypes.MCMSWithTimelockConfig) - contractParams := make(map[uint64]changeset.ChainContractParams) + contractParams := make(map[uint64]v1_6.ChainContractParams) for _, chain := range solChainSelectors { - contractParams[chain] = changeset.ChainContractParams{ - FeeQuoterParams: changeset.DefaultFeeQuoterParams(), - OffRampParams: changeset.DefaultOffRampParams(), + contractParams[chain] = v1_6.ChainContractParams{ + FeeQuoterParams: v1_6.DefaultFeeQuoterParams(), + OffRampParams: v1_6.DefaultOffRampParams(), } } prereqCfg := make([]changeset.DeployPrerequisiteConfigPerChain, 0) @@ -218,8 +219,8 @@ func prepareEnvironmentForOwnershipTransfer(t *testing.T) (deployment.Environmen testhelpers.SavePreloadedSolAddresses(t, e, solChainSelectors[0]) e, err = commonchangeset.ApplyChangesets(t, e, nil, []commonchangeset.ConfiguredChangeSet{ commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.DeployHomeChainChangeset), - changeset.DeployHomeChainConfig{ + deployment.CreateLegacyChangeSet(v1_6.DeployHomeChainChangeset), + v1_6.DeployHomeChainConfig{ HomeChainSel: homeChainSel, RMNStaticConfig: testhelpers.NewTestRMNStaticConfig(), RMNDynamicConfig: testhelpers.NewTestRMNDynamicConfig(), @@ -245,7 +246,7 @@ func prepareEnvironmentForOwnershipTransfer(t *testing.T) (deployment.Environmen ), commonchangeset.Configure( deployment.CreateLegacyChangeSet(solanachangesets.DeployChainContractsChangesetSolana), - changeset.DeployChainContractsConfig{ + v1_6.DeployChainContractsConfig{ HomeChainSelector: homeChainSel, ContractParamsPerChain: contractParams, }, diff --git a/deployment/ccip/changeset/state.go b/deployment/ccip/changeset/state.go index f11cd4434ae..d813fb97d74 100644 --- a/deployment/ccip/changeset/state.go +++ b/deployment/ccip/changeset/state.go @@ -37,11 +37,11 @@ import ( "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/ccip/view" - "github.com/smartcontractkit/chainlink/deployment/ccip/view/v1_0" + viewv1_0 "github.com/smartcontractkit/chainlink/deployment/ccip/view/v1_0" "github.com/smartcontractkit/chainlink/deployment/ccip/view/v1_2" - "github.com/smartcontractkit/chainlink/deployment/ccip/view/v1_5" - "github.com/smartcontractkit/chainlink/deployment/ccip/view/v1_5_1" - "github.com/smartcontractkit/chainlink/deployment/ccip/view/v1_6" + viewv1_5 "github.com/smartcontractkit/chainlink/deployment/ccip/view/v1_5" + viewv1_5_1 "github.com/smartcontractkit/chainlink/deployment/ccip/view/v1_5_1" + viewv1_6 "github.com/smartcontractkit/chainlink/deployment/ccip/view/v1_6" commoncs "github.com/smartcontractkit/chainlink/deployment/common/changeset" commontypes "github.com/smartcontractkit/chainlink/deployment/common/types" common_v1_0 "github.com/smartcontractkit/chainlink/deployment/common/view/v1_0" @@ -247,7 +247,7 @@ func (c CCIPChainState) GenerateView() (view.ChainView, error) { chainView.Router[c.Router.Address().Hex()] = routerView } if c.TokenAdminRegistry != nil { - taView, err := v1_5.GenerateTokenAdminRegistryView(c.TokenAdminRegistry) + taView, err := viewv1_5.GenerateTokenAdminRegistryView(c.TokenAdminRegistry) if err != nil { return chainView, errors.Wrapf(err, "failed to generate token admin registry view for token admin registry %s", c.TokenAdminRegistry.Address().String()) } @@ -255,7 +255,7 @@ func (c CCIPChainState) GenerateView() (view.ChainView, error) { } for tokenSymbol, versionToPool := range c.BurnMintTokenPools { for _, tokenPool := range versionToPool { - tokenPoolView, err := v1_5_1.GenerateTokenPoolView(tokenPool) + tokenPoolView, err := viewv1_5_1.GenerateTokenPoolView(tokenPool) if err != nil { return chainView, errors.Wrapf(err, "failed to generate burn mint token pool view for %s", tokenPool.Address().String()) } @@ -264,7 +264,7 @@ func (c CCIPChainState) GenerateView() (view.ChainView, error) { } for tokenSymbol, versionToPool := range c.BurnWithFromMintTokenPools { for _, tokenPool := range versionToPool { - tokenPoolView, err := v1_5_1.GenerateTokenPoolView(tokenPool) + tokenPoolView, err := viewv1_5_1.GenerateTokenPoolView(tokenPool) if err != nil { return chainView, errors.Wrapf(err, "failed to generate burn mint token pool view for %s", tokenPool.Address().String()) } @@ -273,7 +273,7 @@ func (c CCIPChainState) GenerateView() (view.ChainView, error) { } for tokenSymbol, versionToPool := range c.BurnFromMintTokenPools { for _, tokenPool := range versionToPool { - tokenPoolView, err := v1_5_1.GenerateTokenPoolView(tokenPool) + tokenPoolView, err := viewv1_5_1.GenerateTokenPoolView(tokenPool) if err != nil { return chainView, errors.Wrapf(err, "failed to generate burn mint token pool view for %s", tokenPool.Address().String()) } @@ -282,7 +282,7 @@ func (c CCIPChainState) GenerateView() (view.ChainView, error) { } for tokenSymbol, versionToPool := range c.LockReleaseTokenPools { for _, tokenPool := range versionToPool { - tokenPoolView, err := v1_5_1.GenerateLockReleaseTokenPoolView(tokenPool) + tokenPoolView, err := viewv1_5_1.GenerateLockReleaseTokenPoolView(tokenPool) if err != nil { return chainView, errors.Wrapf(err, "failed to generate lock release token pool view for %s", tokenPool.Address().String()) } @@ -290,14 +290,14 @@ func (c CCIPChainState) GenerateView() (view.ChainView, error) { } } if c.NonceManager != nil { - nmView, err := v1_6.GenerateNonceManagerView(c.NonceManager) + nmView, err := viewv1_6.GenerateNonceManagerView(c.NonceManager) if err != nil { return chainView, errors.Wrapf(err, "failed to generate nonce manager view for nonce manager %s", c.NonceManager.Address().String()) } chainView.NonceManager[c.NonceManager.Address().Hex()] = nmView } if c.RMNRemote != nil { - rmnView, err := v1_6.GenerateRMNRemoteView(c.RMNRemote) + rmnView, err := viewv1_6.GenerateRMNRemoteView(c.RMNRemote) if err != nil { return chainView, errors.Wrapf(err, "failed to generate rmn remote view for rmn remote %s", c.RMNRemote.Address().String()) } @@ -305,7 +305,7 @@ func (c CCIPChainState) GenerateView() (view.ChainView, error) { } if c.RMNHome != nil { - rmnHomeView, err := v1_6.GenerateRMNHomeView(c.RMNHome) + rmnHomeView, err := viewv1_6.GenerateRMNHomeView(c.RMNHome) if err != nil { return chainView, errors.Wrapf(err, "failed to generate rmn home view for rmn home %s", c.RMNHome.Address().String()) } @@ -313,7 +313,7 @@ func (c CCIPChainState) GenerateView() (view.ChainView, error) { } if c.FeeQuoter != nil && c.Router != nil && c.TokenAdminRegistry != nil { - fqView, err := v1_6.GenerateFeeQuoterView(c.FeeQuoter, c.Router, c.TokenAdminRegistry) + fqView, err := viewv1_6.GenerateFeeQuoterView(c.FeeQuoter, c.Router, c.TokenAdminRegistry) if err != nil { return chainView, errors.Wrapf(err, "failed to generate fee quoter view for fee quoter %s", c.FeeQuoter.Address().String()) } @@ -321,7 +321,7 @@ func (c CCIPChainState) GenerateView() (view.ChainView, error) { } if c.OnRamp != nil && c.Router != nil && c.TokenAdminRegistry != nil { - onRampView, err := v1_6.GenerateOnRampView( + onRampView, err := viewv1_6.GenerateOnRampView( c.OnRamp, c.Router, c.TokenAdminRegistry, @@ -333,7 +333,7 @@ func (c CCIPChainState) GenerateView() (view.ChainView, error) { } if c.OffRamp != nil && c.Router != nil { - offRampView, err := v1_6.GenerateOffRampView( + offRampView, err := viewv1_6.GenerateOffRampView( c.OffRamp, c.Router, ) @@ -344,14 +344,14 @@ func (c CCIPChainState) GenerateView() (view.ChainView, error) { } if c.RMNProxy != nil { - rmnProxyView, err := v1_0.GenerateRMNProxyView(c.RMNProxy) + rmnProxyView, err := viewv1_0.GenerateRMNProxyView(c.RMNProxy) if err != nil { return chainView, errors.Wrapf(err, "failed to generate rmn proxy view for rmn proxy %s", c.RMNProxy.Address().String()) } chainView.RMNProxy[c.RMNProxy.Address().Hex()] = rmnProxyView } if c.CCIPHome != nil && c.CapabilityRegistry != nil { - chView, err := v1_6.GenerateCCIPHomeView(c.CapabilityRegistry, c.CCIPHome) + chView, err := viewv1_6.GenerateCCIPHomeView(c.CapabilityRegistry, c.CCIPHome) if err != nil { return chainView, errors.Wrapf(err, "failed to generate CCIP home view for CCIP home %s", c.CCIPHome.Address()) } @@ -388,7 +388,7 @@ func (c CCIPChainState) GenerateView() (view.ChainView, error) { // Legacy contracts if c.CommitStore != nil { for source, commitStore := range c.CommitStore { - commitStoreView, err := v1_5.GenerateCommitStoreView(commitStore) + commitStoreView, err := viewv1_5.GenerateCommitStoreView(commitStore) if err != nil { return chainView, errors.Wrapf(err, "failed to generate commit store view for commit store %s for source %d", commitStore.Address().String(), source) } @@ -405,7 +405,7 @@ func (c CCIPChainState) GenerateView() (view.ChainView, error) { } if c.RMN != nil { - rmnView, err := v1_5.GenerateRMNView(c.RMN) + rmnView, err := viewv1_5.GenerateRMNView(c.RMN) if err != nil { return chainView, errors.Wrapf(err, "failed to generate rmn view for rmn %s", c.RMN.Address().String()) } @@ -414,7 +414,7 @@ func (c CCIPChainState) GenerateView() (view.ChainView, error) { if c.EVM2EVMOffRamp != nil { for source, offRamp := range c.EVM2EVMOffRamp { - offRampView, err := v1_5.GenerateOffRampView(offRamp) + offRampView, err := viewv1_5.GenerateOffRampView(offRamp) if err != nil { return chainView, errors.Wrapf(err, "failed to generate off ramp view for off ramp %s for source %d", offRamp.Address().String(), source) } @@ -424,7 +424,7 @@ func (c CCIPChainState) GenerateView() (view.ChainView, error) { if c.EVM2EVMOnRamp != nil { for dest, onRamp := range c.EVM2EVMOnRamp { - onRampView, err := v1_5.GenerateOnRampView(onRamp) + onRampView, err := viewv1_5.GenerateOnRampView(onRamp) if err != nil { return chainView, errors.Wrapf(err, "failed to generate on ramp view for on ramp %s for dest %d", onRamp.Address().String(), dest) } @@ -858,28 +858,28 @@ func LoadChainState(ctx context.Context, chain deployment.Chain, addresses map[s state.USDFeeds[key] = feed case deployment.NewTypeAndVersion(BurnMintTokenPool, deployment.Version1_5_1).String(): ethAddress := common.HexToAddress(address) - pool, metadata, err := newTokenPoolWithMetadata(ctx, burn_mint_token_pool.NewBurnMintTokenPool, ethAddress, chain.Client) + pool, metadata, err := NewTokenPoolWithMetadata(ctx, burn_mint_token_pool.NewBurnMintTokenPool, ethAddress, chain.Client) if err != nil { return state, fmt.Errorf("failed to connect address %s with token pool bindings and get token symbol: %w", ethAddress, err) } state.BurnMintTokenPools = helpers.AddValueToNestedMap(state.BurnMintTokenPools, metadata.Symbol, metadata.Version, pool) case deployment.NewTypeAndVersion(BurnWithFromMintTokenPool, deployment.Version1_5_1).String(): ethAddress := common.HexToAddress(address) - pool, metadata, err := newTokenPoolWithMetadata(ctx, burn_with_from_mint_token_pool.NewBurnWithFromMintTokenPool, ethAddress, chain.Client) + pool, metadata, err := NewTokenPoolWithMetadata(ctx, burn_with_from_mint_token_pool.NewBurnWithFromMintTokenPool, ethAddress, chain.Client) if err != nil { return state, fmt.Errorf("failed to connect address %s with token pool bindings and get token symbol: %w", ethAddress, err) } state.BurnWithFromMintTokenPools = helpers.AddValueToNestedMap(state.BurnWithFromMintTokenPools, metadata.Symbol, metadata.Version, pool) case deployment.NewTypeAndVersion(BurnFromMintTokenPool, deployment.Version1_5_1).String(): ethAddress := common.HexToAddress(address) - pool, metadata, err := newTokenPoolWithMetadata(ctx, burn_from_mint_token_pool.NewBurnFromMintTokenPool, ethAddress, chain.Client) + pool, metadata, err := NewTokenPoolWithMetadata(ctx, burn_from_mint_token_pool.NewBurnFromMintTokenPool, ethAddress, chain.Client) if err != nil { return state, fmt.Errorf("failed to connect address %s with token pool bindings and get token symbol: %w", ethAddress, err) } state.BurnFromMintTokenPools = helpers.AddValueToNestedMap(state.BurnFromMintTokenPools, metadata.Symbol, metadata.Version, pool) case deployment.NewTypeAndVersion(LockReleaseTokenPool, deployment.Version1_5_1).String(): ethAddress := common.HexToAddress(address) - pool, metadata, err := newTokenPoolWithMetadata(ctx, lock_release_token_pool.NewLockReleaseTokenPool, ethAddress, chain.Client) + pool, metadata, err := NewTokenPoolWithMetadata(ctx, lock_release_token_pool.NewLockReleaseTokenPool, ethAddress, chain.Client) if err != nil { return state, fmt.Errorf("failed to connect address %s with token pool bindings and get token symbol: %w", ethAddress, err) } diff --git a/deployment/ccip/changeset/testhelpers/test_environment.go b/deployment/ccip/changeset/testhelpers/test_environment.go index 2bcc8d3ddb4..5779cbecf5a 100644 --- a/deployment/ccip/changeset/testhelpers/test_environment.go +++ b/deployment/ccip/changeset/testhelpers/test_environment.go @@ -17,6 +17,7 @@ import ( "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/testcontext" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_6" commonconfig "github.com/smartcontractkit/chainlink-common/pkg/config" @@ -60,7 +61,7 @@ type TestConfigs struct { IsUSDCAttestationMissing bool IsMultiCall3 bool IsStaticLink bool - OCRConfigOverride func(*changeset.CCIPOCRParams) + OCRConfigOverride func(*v1_6.CCIPOCRParams) RMNEnabled bool NumOfRMNNodes int LinkPrice *big.Int @@ -171,7 +172,7 @@ func WithRMNEnabled(numOfNode int) TestOps { } } -func WithOCRConfigOverride(override func(*changeset.CCIPOCRParams)) TestOps { +func WithOCRConfigOverride(override func(*v1_6.CCIPOCRParams)) TestOps { return func(testCfg *TestConfigs) { testCfg.OCRConfigOverride = override } @@ -252,7 +253,7 @@ func (d *DeployedEnv) TimelockContracts(t *testing.T) map[uint64]*proposalutils. } func (d *DeployedEnv) SetupJobs(t *testing.T) { - out, err := changeset.CCIPCapabilityJobspecChangeset(d.Env, struct{}{}) + out, err := v1_6.CCIPCapabilityJobspecChangeset(d.Env, struct{}{}) require.NoError(t, err) require.NotEmpty(t, out.Jobs) for _, job := range out.Jobs { @@ -505,8 +506,8 @@ func NewEnvironmentWithJobsAndContracts(t *testing.T, tEnv TestEnvironment) Depl // now we update RMNProxy to point to RMNRemote e.Env, err = commonchangeset.Apply(t, e.Env, nil, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.SetRMNRemoteOnRMNProxyChangeset), - changeset.SetRMNRemoteOnRMNProxyConfig{ + deployment.CreateLegacyChangeSet(v1_6.SetRMNRemoteOnRMNProxyChangeset), + v1_6.SetRMNRemoteOnRMNProxyConfig{ ChainSelectors: evmChains, }, ), @@ -524,8 +525,8 @@ func AddCCIPContractsToEnvironment(t *testing.T, allChains []uint64, tEnv TestEn // Need to deploy prerequisites first so that we can form the USDC config // no proposals to be made, timelock can be passed as nil here var apps []commonchangeset.ConfiguredChangeSet - evmContractParams := make(map[uint64]changeset.ChainContractParams) - solContractParams := make(map[uint64]changeset.ChainContractParams) + evmContractParams := make(map[uint64]v1_6.ChainContractParams) + solContractParams := make(map[uint64]v1_6.ChainContractParams) evmChains := []uint64{} for _, chain := range allChains { if _, ok := e.Env.Chains[chain]; ok { @@ -541,23 +542,23 @@ func AddCCIPContractsToEnvironment(t *testing.T, allChains []uint64, tEnv TestEn } for _, chain := range evmChains { - evmContractParams[chain] = changeset.ChainContractParams{ - FeeQuoterParams: changeset.DefaultFeeQuoterParams(), - OffRampParams: changeset.DefaultOffRampParams(), + evmContractParams[chain] = v1_6.ChainContractParams{ + FeeQuoterParams: v1_6.DefaultFeeQuoterParams(), + OffRampParams: v1_6.DefaultOffRampParams(), } } for _, chain := range solChains { - solContractParams[chain] = changeset.ChainContractParams{ - FeeQuoterParams: changeset.DefaultFeeQuoterParams(), - OffRampParams: changeset.DefaultOffRampParams(), + solContractParams[chain] = v1_6.ChainContractParams{ + FeeQuoterParams: v1_6.DefaultFeeQuoterParams(), + OffRampParams: v1_6.DefaultOffRampParams(), } } apps = append(apps, []commonchangeset.ConfiguredChangeSet{ commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.DeployHomeChainChangeset), - changeset.DeployHomeChainConfig{ + deployment.CreateLegacyChangeSet(v1_6.DeployHomeChainChangeset), + v1_6.DeployHomeChainConfig{ HomeChainSel: e.HomeChainSel, RMNDynamicConfig: NewTestRMNDynamicConfig(), RMNStaticConfig: NewTestRMNStaticConfig(), @@ -568,15 +569,15 @@ func AddCCIPContractsToEnvironment(t *testing.T, allChains []uint64, tEnv TestEn }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.DeployChainContractsChangeset), - changeset.DeployChainContractsConfig{ + deployment.CreateLegacyChangeSet(v1_6.DeployChainContractsChangeset), + v1_6.DeployChainContractsConfig{ HomeChainSelector: e.HomeChainSel, ContractParamsPerChain: evmContractParams, }, ), commonchangeset.Configure( deployment.CreateLegacyChangeSet(solana.DeployChainContractsChangesetSolana), - changeset.DeployChainContractsConfig{ + v1_6.DeployChainContractsConfig{ HomeChainSelector: e.HomeChainSel, ContractParamsPerChain: solContractParams, }, @@ -628,8 +629,8 @@ func AddCCIPContractsToEnvironment(t *testing.T, allChains []uint64, tEnv TestEn nodeInfo, err := deployment.NodeInfo(e.Env.NodeIDs, e.Env.Offchain) require.NoError(t, err) // Build the per chain config. - chainConfigs := make(map[uint64]changeset.ChainConfig) - ocrConfigs := make(map[uint64]changeset.CCIPOCRParams) + chainConfigs := make(map[uint64]v1_6.ChainConfig) + ocrConfigs := make(map[uint64]v1_6.CCIPOCRParams) for _, chain := range evmChains { timelockContractsPerChain[chain] = &proposalutils.TimelockExecutionContracts{ Timelock: state.Chains[chain].Timelock, @@ -644,20 +645,20 @@ func AddCCIPContractsToEnvironment(t *testing.T, allChains []uint64, tEnv TestEn tokenInfo := tokenConfig.GetTokenInfo(e.Env.Logger, linkTokenAddr, state.Chains[chain].Weth9.Address()) ocrOverride := tc.OCRConfigOverride if tc.RMNEnabled { - ocrOverride = func(ocrParams *changeset.CCIPOCRParams) { + ocrOverride = func(ocrParams *v1_6.CCIPOCRParams) { if tc.OCRConfigOverride != nil { tc.OCRConfigOverride(ocrParams) } ocrParams.CommitOffChainConfig.RMNEnabled = true } } - ocrParams := changeset.DeriveCCIPOCRParams( - changeset.WithDefaultCommitOffChainConfig(e.FeedChainSel, tokenInfo), - changeset.WithDefaultExecuteOffChainConfig(tokenDataProviders), - changeset.WithOCRParamOverride(ocrOverride), + ocrParams := v1_6.DeriveCCIPOCRParams( + v1_6.WithDefaultCommitOffChainConfig(e.FeedChainSel, tokenInfo), + v1_6.WithDefaultExecuteOffChainConfig(tokenDataProviders), + v1_6.WithOCRParamOverride(ocrOverride), ) ocrConfigs[chain] = ocrParams - chainConfigs[chain] = changeset.ChainConfig{ + chainConfigs[chain] = v1_6.ChainConfig{ Readers: nodeInfo.NonBootstraps().PeerIDs(), FChain: uint8(len(nodeInfo.NonBootstraps().PeerIDs()) / 3), EncodableChainConfig: chainconfig.ChainConfig{ @@ -670,14 +671,14 @@ func AddCCIPContractsToEnvironment(t *testing.T, allChains []uint64, tEnv TestEn for _, chain := range solChains { ocrOverride := tc.OCRConfigOverride - ocrParams := changeset.DeriveCCIPOCRParams( + ocrParams := v1_6.DeriveCCIPOCRParams( // TODO: tokenInfo is nil for solana - changeset.WithDefaultCommitOffChainConfig(e.FeedChainSel, nil), - changeset.WithDefaultExecuteOffChainConfig(tokenDataProviders), - changeset.WithOCRParamOverride(ocrOverride), + v1_6.WithDefaultCommitOffChainConfig(e.FeedChainSel, nil), + v1_6.WithDefaultExecuteOffChainConfig(tokenDataProviders), + v1_6.WithOCRParamOverride(ocrOverride), ) ocrConfigs[chain] = ocrParams - chainConfigs[chain] = changeset.ChainConfig{ + chainConfigs[chain] = v1_6.ChainConfig{ Readers: nodeInfo.NonBootstraps().PeerIDs(), // #nosec G115 - Overflow is not a concern in this test scenario FChain: uint8(len(nodeInfo.NonBootstraps().PeerIDs()) / 3), @@ -699,8 +700,8 @@ func AddCCIPContractsToEnvironment(t *testing.T, allChains []uint64, tEnv TestEn apps = []commonchangeset.ConfiguredChangeSet{ commonchangeset.Configure( // Add the chain configs for the new chains. - deployment.CreateLegacyChangeSet(changeset.UpdateChainConfigChangeset), - changeset.UpdateChainConfigConfig{ + deployment.CreateLegacyChangeSet(v1_6.UpdateChainConfigChangeset), + v1_6.UpdateChainConfigConfig{ HomeChainSelector: e.HomeChainSel, RemoteChainAdds: chainConfigs, MCMS: mcmsConfig, @@ -708,15 +709,15 @@ func AddCCIPContractsToEnvironment(t *testing.T, allChains []uint64, tEnv TestEn ), commonchangeset.Configure( // Add the DONs and candidate commit OCR instances for the chain. - deployment.CreateLegacyChangeSet(changeset.AddDonAndSetCandidateChangeset), - changeset.AddDonAndSetCandidateChangesetConfig{ - SetCandidateConfigBase: changeset.SetCandidateConfigBase{ + deployment.CreateLegacyChangeSet(v1_6.AddDonAndSetCandidateChangeset), + v1_6.AddDonAndSetCandidateChangesetConfig{ + SetCandidateConfigBase: v1_6.SetCandidateConfigBase{ HomeChainSelector: e.HomeChainSel, // TODO: we dont know what this means for solana FeedChainSelector: e.FeedChainSel, MCMS: mcmsConfig, }, - PluginInfo: changeset.SetCandidatePluginInfo{ + PluginInfo: v1_6.SetCandidatePluginInfo{ OCRConfigPerRemoteChainSelector: ocrConfigs, PluginType: types.PluginTypeCCIPCommit, }, @@ -724,15 +725,15 @@ func AddCCIPContractsToEnvironment(t *testing.T, allChains []uint64, tEnv TestEn ), commonchangeset.Configure( // Add the exec OCR instances for the new chains. - deployment.CreateLegacyChangeSet(changeset.SetCandidateChangeset), - changeset.SetCandidateChangesetConfig{ - SetCandidateConfigBase: changeset.SetCandidateConfigBase{ + deployment.CreateLegacyChangeSet(v1_6.SetCandidateChangeset), + v1_6.SetCandidateChangesetConfig{ + SetCandidateConfigBase: v1_6.SetCandidateConfigBase{ HomeChainSelector: e.HomeChainSel, // TODO: we dont know what this means for solana FeedChainSelector: e.FeedChainSel, MCMS: mcmsConfig, }, - PluginInfo: []changeset.SetCandidatePluginInfo{ + PluginInfo: []v1_6.SetCandidatePluginInfo{ { OCRConfigPerRemoteChainSelector: ocrConfigs, PluginType: types.PluginTypeCCIPExec, @@ -742,10 +743,10 @@ func AddCCIPContractsToEnvironment(t *testing.T, allChains []uint64, tEnv TestEn ), commonchangeset.Configure( // Promote everything - deployment.CreateLegacyChangeSet(changeset.PromoteCandidateChangeset), - changeset.PromoteCandidateChangesetConfig{ + deployment.CreateLegacyChangeSet(v1_6.PromoteCandidateChangeset), + v1_6.PromoteCandidateChangesetConfig{ HomeChainSelector: e.HomeChainSel, - PluginInfo: []changeset.PromoteCandidatePluginInfo{ + PluginInfo: []v1_6.PromoteCandidatePluginInfo{ { PluginType: types.PluginTypeCCIPCommit, RemoteChainSelectors: allChains, @@ -760,8 +761,8 @@ func AddCCIPContractsToEnvironment(t *testing.T, allChains []uint64, tEnv TestEn ), commonchangeset.Configure( // Enable the OCR config on the remote chains. - deployment.CreateLegacyChangeSet(changeset.SetOCR3OffRampChangeset), - changeset.SetOCR3OffRampConfig{ + deployment.CreateLegacyChangeSet(v1_6.SetOCR3OffRampChangeset), + v1_6.SetOCR3OffRampConfig{ HomeChainSel: e.HomeChainSel, RemoteChainSels: evmChains, CCIPHomeConfigType: globals.ConfigTypeActive, @@ -770,14 +771,14 @@ func AddCCIPContractsToEnvironment(t *testing.T, allChains []uint64, tEnv TestEn commonchangeset.Configure( // Enable the OCR config on the remote chains. deployment.CreateLegacyChangeSet(changeset_solana.SetOCR3ConfigSolana), - changeset.SetOCR3OffRampConfig{ + v1_6.SetOCR3OffRampConfig{ HomeChainSel: e.HomeChainSel, RemoteChainSels: solChains, CCIPHomeConfigType: globals.ConfigTypeActive, }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.CCIPCapabilityJobspecChangeset), + deployment.CreateLegacyChangeSet(v1_6.CCIPCapabilityJobspecChangeset), nil, // Changeset ignores any config ), } diff --git a/deployment/ccip/changeset/testhelpers/test_helpers.go b/deployment/ccip/changeset/testhelpers/test_helpers.go index 1127e34a89b..608789485a0 100644 --- a/deployment/ccip/changeset/testhelpers/test_helpers.go +++ b/deployment/ccip/changeset/testhelpers/test_helpers.go @@ -21,6 +21,7 @@ import ( "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" changeset_solana "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/solana" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_6" commoncs "github.com/smartcontractkit/chainlink/deployment/common/changeset" commontypes "github.com/smartcontractkit/chainlink/deployment/common/types" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/v1_6_0/fee_quoter" @@ -481,9 +482,9 @@ func addLaneSolanaChangesets(t *testing.T, solChainSelector, remoteChainSelector func addEVMSrcChangesets(from, to uint64, isTestRouter bool, gasprice map[uint64]*big.Int, tokenPrices map[common.Address]*big.Int, fqCfg fee_quoter.FeeQuoterDestChainConfig) []commoncs.ConfiguredChangeSet { evmSrcChangesets := []commoncs.ConfiguredChangeSet{ commoncs.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateOnRampsDestsChangeset), - changeset.UpdateOnRampDestsConfig{ - UpdatesByChain: map[uint64]map[uint64]changeset.OnRampDestinationUpdate{ + deployment.CreateLegacyChangeSet(v1_6.UpdateOnRampsDestsChangeset), + v1_6.UpdateOnRampDestsConfig{ + UpdatesByChain: map[uint64]map[uint64]v1_6.OnRampDestinationUpdate{ from: { to: { IsEnabled: true, @@ -495,9 +496,9 @@ func addEVMSrcChangesets(from, to uint64, isTestRouter bool, gasprice map[uint64 }, ), commoncs.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateFeeQuoterPricesChangeset), - changeset.UpdateFeeQuoterPricesConfig{ - PricesByChain: map[uint64]changeset.FeeQuoterPriceUpdatePerSource{ + deployment.CreateLegacyChangeSet(v1_6.UpdateFeeQuoterPricesChangeset), + v1_6.UpdateFeeQuoterPricesConfig{ + PricesByChain: map[uint64]v1_6.FeeQuoterPriceUpdatePerSource{ from: { TokenPrices: tokenPrices, GasPrices: gasprice, @@ -506,8 +507,8 @@ func addEVMSrcChangesets(from, to uint64, isTestRouter bool, gasprice map[uint64 }, ), commoncs.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateFeeQuoterDestsChangeset), - changeset.UpdateFeeQuoterDestsConfig{ + deployment.CreateLegacyChangeSet(v1_6.UpdateFeeQuoterDestsChangeset), + v1_6.UpdateFeeQuoterDestsConfig{ UpdatesByChain: map[uint64]map[uint64]fee_quoter.FeeQuoterDestChainConfig{ from: { to: fqCfg, @@ -516,10 +517,10 @@ func addEVMSrcChangesets(from, to uint64, isTestRouter bool, gasprice map[uint64 }, ), commoncs.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateRouterRampsChangeset), - changeset.UpdateRouterRampsConfig{ + deployment.CreateLegacyChangeSet(v1_6.UpdateRouterRampsChangeset), + v1_6.UpdateRouterRampsConfig{ TestRouter: isTestRouter, - UpdatesByChain: map[uint64]changeset.RouterUpdates{ + UpdatesByChain: map[uint64]v1_6.RouterUpdates{ // onRamp update on source chain from: { OnRampUpdates: map[uint64]bool{ @@ -536,9 +537,9 @@ func addEVMSrcChangesets(from, to uint64, isTestRouter bool, gasprice map[uint64 func addEVMDestChangesets(e *DeployedEnv, to, from uint64, isTestRouter bool) []commoncs.ConfiguredChangeSet { evmDstChangesets := []commoncs.ConfiguredChangeSet{ commoncs.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateOffRampSourcesChangeset), - changeset.UpdateOffRampSourcesConfig{ - UpdatesByChain: map[uint64]map[uint64]changeset.OffRampSourceUpdate{ + deployment.CreateLegacyChangeSet(v1_6.UpdateOffRampSourcesChangeset), + v1_6.UpdateOffRampSourcesConfig{ + UpdatesByChain: map[uint64]map[uint64]v1_6.OffRampSourceUpdate{ to: { from: { IsEnabled: true, @@ -550,10 +551,10 @@ func addEVMDestChangesets(e *DeployedEnv, to, from uint64, isTestRouter bool) [] }, ), commoncs.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateRouterRampsChangeset), - changeset.UpdateRouterRampsConfig{ + deployment.CreateLegacyChangeSet(v1_6.UpdateRouterRampsChangeset), + v1_6.UpdateRouterRampsConfig{ TestRouter: isTestRouter, - UpdatesByChain: map[uint64]changeset.RouterUpdates{ + UpdatesByChain: map[uint64]v1_6.RouterUpdates{ // offramp update on dest chain to: { OffRampUpdates: map[uint64]bool{ @@ -572,9 +573,9 @@ func RemoveLane(t *testing.T, e *DeployedEnv, src, dest uint64, isTestRouter boo var err error apps := []commoncs.ConfiguredChangeSet{ commoncs.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateRouterRampsChangeset), - changeset.UpdateRouterRampsConfig{ - UpdatesByChain: map[uint64]changeset.RouterUpdates{ + deployment.CreateLegacyChangeSet(v1_6.UpdateRouterRampsChangeset), + v1_6.UpdateRouterRampsConfig{ + UpdatesByChain: map[uint64]v1_6.RouterUpdates{ // onRamp update on source chain src: { OnRampUpdates: map[uint64]bool{ @@ -585,19 +586,19 @@ func RemoveLane(t *testing.T, e *DeployedEnv, src, dest uint64, isTestRouter boo }, ), commoncs.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateFeeQuoterDestsChangeset), - changeset.UpdateFeeQuoterDestsConfig{ + deployment.CreateLegacyChangeSet(v1_6.UpdateFeeQuoterDestsChangeset), + v1_6.UpdateFeeQuoterDestsConfig{ UpdatesByChain: map[uint64]map[uint64]fee_quoter.FeeQuoterDestChainConfig{ src: { - dest: changeset.DefaultFeeQuoterDestChainConfig(false), + dest: v1_6.DefaultFeeQuoterDestChainConfig(false), }, }, }, ), commoncs.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateOnRampsDestsChangeset), - changeset.UpdateOnRampDestsConfig{ - UpdatesByChain: map[uint64]map[uint64]changeset.OnRampDestinationUpdate{ + deployment.CreateLegacyChangeSet(v1_6.UpdateOnRampsDestsChangeset), + v1_6.UpdateOnRampDestsConfig{ + UpdatesByChain: map[uint64]map[uint64]v1_6.OnRampDestinationUpdate{ src: { dest: { IsEnabled: false, @@ -626,7 +627,7 @@ func AddLaneWithDefaultPricesAndFeeQuoterConfig(t *testing.T, e *DeployedEnv, st stateChainFrom.Weth9.Address(): DefaultWethPrice, } } - fqCfg := changeset.DefaultFeeQuoterDestChainConfig(true, to) + fqCfg := v1_6.DefaultFeeQuoterDestChainConfig(true, to) AddLane( t, e, diff --git a/deployment/ccip/changeset/testhelpers/test_token_helpers.go b/deployment/ccip/changeset/testhelpers/test_token_helpers.go index 8e56d040018..8cbe7f7b094 100644 --- a/deployment/ccip/changeset/testhelpers/test_token_helpers.go +++ b/deployment/ccip/changeset/testhelpers/test_token_helpers.go @@ -10,8 +10,10 @@ import ( "go.uber.org/zap/zapcore" "github.com/smartcontractkit/chainlink-common/pkg/logger" + "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_5_1" commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset" commoncs "github.com/smartcontractkit/chainlink/deployment/common/changeset" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" @@ -27,8 +29,8 @@ const ( ) // CreateSymmetricRateLimits is a utility to quickly create a rate limiter config with equal inbound and outbound values. -func CreateSymmetricRateLimits(rate int64, capacity int64) changeset.RateLimiterConfig { - return changeset.RateLimiterConfig{ +func CreateSymmetricRateLimits(rate int64, capacity int64) v1_5_1.RateLimiterConfig { + return v1_5_1.RateLimiterConfig{ Inbound: token_pool.RateLimiterConfig{ IsEnabled: rate != 0 || capacity != 0, Rate: big.NewInt(rate), @@ -157,15 +159,15 @@ func getPoolsOwnedByDeployer[T commonchangeset.Ownable](t *testing.T, contracts func DeployTestTokenPools( t *testing.T, e deployment.Environment, - newPools map[uint64]changeset.DeployTokenPoolInput, + newPools map[uint64]v1_5_1.DeployTokenPoolInput, transferToTimelock bool, ) deployment.Environment { selectors := e.AllChainSelectors() e, err := commonchangeset.Apply(t, e, nil, commoncs.Configure( - deployment.CreateLegacyChangeSet(changeset.DeployTokenPoolContractsChangeset), - changeset.DeployTokenPoolContractsConfig{ + deployment.CreateLegacyChangeSet(v1_5_1.DeployTokenPoolContractsChangeset), + v1_5_1.DeployTokenPoolContractsConfig{ TokenSymbol: TestTokenSymbol, NewPools: newPools, }, diff --git a/deployment/ccip/changeset/testhelpers/test_usdc_helpers.go b/deployment/ccip/changeset/testhelpers/test_usdc_helpers.go index 911250bb7d9..b16095d6638 100644 --- a/deployment/ccip/changeset/testhelpers/test_usdc_helpers.go +++ b/deployment/ccip/changeset/testhelpers/test_usdc_helpers.go @@ -11,6 +11,7 @@ import ( "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_6" commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/v1_5_1/usdc_token_pool" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/v1_6_0/fee_quoter" @@ -119,11 +120,11 @@ func UpdateFeeQuoterForUSDC( } _, err := commonchangeset.Apply(t, e, nil, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.ApplyTokenTransferFeeConfigUpdatesFeeQuoterChangeset), - changeset.ApplyTokenTransferFeeConfigUpdatesConfig{ - UpdatesByChain: map[uint64]changeset.ApplyTokenTransferFeeConfigUpdatesConfigPerChain{ + deployment.CreateLegacyChangeSet(v1_6.ApplyTokenTransferFeeConfigUpdatesFeeQuoterChangeset), + v1_6.ApplyTokenTransferFeeConfigUpdatesConfig{ + UpdatesByChain: map[uint64]v1_6.ApplyTokenTransferFeeConfigUpdatesConfigPerChain{ chain.Selector: { - TokenTransferFeeConfigArgs: []changeset.TokenTransferFeeConfigArg{ + TokenTransferFeeConfigArgs: []v1_6.TokenTransferFeeConfigArg{ { DestChain: dstChain, TokenTransferFeeConfigPerToken: map[changeset.TokenSymbol]fee_quoter.FeeQuoterTokenTransferFeeConfig{ diff --git a/deployment/ccip/changeset/token_pools.go b/deployment/ccip/changeset/token_pools.go index bff248d35eb..ba75b3601a7 100644 --- a/deployment/ccip/changeset/token_pools.go +++ b/deployment/ccip/changeset/token_pools.go @@ -18,9 +18,9 @@ import ( ccipconfig "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/config" ) -var currentTokenPoolVersion semver.Version = deployment.Version1_5_1 +var CurrentTokenPoolVersion semver.Version = deployment.Version1_5_1 -var tokenPoolTypes map[deployment.ContractType]struct{} = map[deployment.ContractType]struct{}{ +var TokenPoolTypes map[deployment.ContractType]struct{} = map[deployment.ContractType]struct{}{ BurnMintTokenPool: struct{}{}, BurnWithFromMintTokenPool: struct{}{}, BurnFromMintTokenPool: struct{}{}, @@ -29,7 +29,7 @@ var tokenPoolTypes map[deployment.ContractType]struct{} = map[deployment.Contrac HybridLockReleaseUSDCTokenPool: struct{}{}, } -var tokenPoolVersions map[semver.Version]struct{} = map[semver.Version]struct{}{ +var TokenPoolVersions map[semver.Version]struct{} = map[semver.Version]struct{}{ deployment.Version1_5_1: struct{}{}, } @@ -45,12 +45,12 @@ type TokenPoolInfo struct { func (t TokenPoolInfo) Validate() error { // Ensure that the inputted type is known - if _, ok := tokenPoolTypes[t.Type]; !ok { + if _, ok := TokenPoolTypes[t.Type]; !ok { return fmt.Errorf("%s is not a known token pool type", t.Type) } // Ensure that the inputted version is known - if _, ok := tokenPoolVersions[t.Version]; !ok { + if _, ok := TokenPoolVersions[t.Version]; !ok { return fmt.Errorf("%s is not a known token pool version", t.Version) } @@ -83,7 +83,7 @@ func (t TokenPoolInfo) GetPoolAndTokenAddress( chain deployment.Chain, state CCIPChainState, ) (*token_pool.TokenPool, common.Address, error) { - tokenPoolAddress, ok := getTokenPoolAddressFromSymbolTypeAndVersion(state, chain, symbol, t.Type, t.Version) + tokenPoolAddress, ok := GetTokenPoolAddressFromSymbolTypeAndVersion(state, chain, symbol, t.Type, t.Version) if !ok { return nil, utils.ZeroAddress, fmt.Errorf("token pool does not exist on %s with symbol %s, type %s, and version %s", chain, symbol, t.Type, t.Version) } @@ -110,8 +110,8 @@ type tokenPoolMetadata struct { Symbol TokenSymbol } -// newTokenPoolWithMetadata returns a token pool along with its metadata. -func newTokenPoolWithMetadata[P tokenPool]( +// NewTokenPoolWithMetadata returns a token pool along with its metadata. +func NewTokenPoolWithMetadata[P tokenPool]( ctx context.Context, newTokenPool func(address common.Address, backend bind.ContractBackend) (P, error), poolAddress common.Address, @@ -151,8 +151,8 @@ func newTokenPoolWithMetadata[P tokenPool]( }, nil } -// getTokenPoolAddressFromSymbolTypeAndVersion returns the token pool address in the environment linked to a particular symbol, type, and version -func getTokenPoolAddressFromSymbolTypeAndVersion( +// GetTokenPoolAddressFromSymbolTypeAndVersion returns the token pool address in the environment linked to a particular symbol, type, and version +func GetTokenPoolAddressFromSymbolTypeAndVersion( chainState CCIPChainState, chain deployment.Chain, symbol TokenSymbol, diff --git a/deployment/ccip/changeset/cs_accept_admin_role.go b/deployment/ccip/changeset/v1_5_1/cs_accept_admin_role.go similarity index 78% rename from deployment/ccip/changeset/cs_accept_admin_role.go rename to deployment/ccip/changeset/v1_5_1/cs_accept_admin_role.go index fd66a575671..fbe1216c94b 100644 --- a/deployment/ccip/changeset/cs_accept_admin_role.go +++ b/deployment/ccip/changeset/v1_5_1/cs_accept_admin_role.go @@ -1,4 +1,4 @@ -package changeset +package v1_5_1 import ( "fmt" @@ -6,16 +6,17 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/smartcontractkit/chainlink/deployment" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/v1_5_0/token_admin_registry" ) -var _ deployment.ChangeSet[TokenAdminRegistryChangesetConfig] = AcceptAdminRoleChangeset +var _ deployment.ChangeSet[changeset.TokenAdminRegistryChangesetConfig] = AcceptAdminRoleChangeset func validateAcceptAdminRole( config token_admin_registry.TokenAdminRegistryTokenConfig, sender common.Address, externalAdmin common.Address, - symbol TokenSymbol, + symbol changeset.TokenSymbol, chain deployment.Chain, ) error { // We must be the pending administrator @@ -26,16 +27,16 @@ func validateAcceptAdminRole( } // AcceptAdminRoleChangeset accepts admin rights for tokens on the token admin registry. -func AcceptAdminRoleChangeset(env deployment.Environment, c TokenAdminRegistryChangesetConfig) (deployment.ChangesetOutput, error) { +func AcceptAdminRoleChangeset(env deployment.Environment, c changeset.TokenAdminRegistryChangesetConfig) (deployment.ChangesetOutput, error) { if err := c.Validate(env, false, validateAcceptAdminRole); err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("invalid TokenAdminRegistryChangesetConfig: %w", err) } - state, err := LoadOnchainState(env) + state, err := changeset.LoadOnchainState(env) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to load onchain state: %w", err) } - deployerGroup := NewDeployerGroup(env, state, c.MCMS).WithDeploymentContext("accept admin role for tokens on token admin registries") + deployerGroup := changeset.NewDeployerGroup(env, state, c.MCMS).WithDeploymentContext("accept admin role for tokens on token admin registries") for chainSelector, tokenSymbolToPoolInfo := range c.Pools { chain := env.Chains[chainSelector] diff --git a/deployment/ccip/changeset/cs_accept_admin_role_test.go b/deployment/ccip/changeset/v1_5_1/cs_accept_admin_role_test.go similarity index 88% rename from deployment/ccip/changeset/cs_accept_admin_role_test.go rename to deployment/ccip/changeset/v1_5_1/cs_accept_admin_role_test.go index bea9b9fcdc0..09b8e5bbfb9 100644 --- a/deployment/ccip/changeset/cs_accept_admin_role_test.go +++ b/deployment/ccip/changeset/v1_5_1/cs_accept_admin_role_test.go @@ -1,4 +1,4 @@ -package changeset_test +package v1_5_1_test import ( "testing" @@ -9,6 +9,7 @@ import ( "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_5_1" commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset" "github.com/smartcontractkit/chainlink/v2/core/logger" ) @@ -18,7 +19,7 @@ func TestAcceptAdminRoleChangeset_Validations(t *testing.T) { e, selectorA, _, tokens, timelockContracts := testhelpers.SetupTwoChainEnvironmentWithTokens(t, logger.TestLogger(t), true) - e = testhelpers.DeployTestTokenPools(t, e, map[uint64]changeset.DeployTokenPoolInput{ + e = testhelpers.DeployTestTokenPools(t, e, map[uint64]v1_5_1.DeployTokenPoolInput{ selectorA: { Type: changeset.BurnMintTokenPool, TokenAddress: tokens[selectorA].Address, @@ -88,7 +89,7 @@ func TestAcceptAdminRoleChangeset_Validations(t *testing.T) { Config: changeset.TokenAdminRegistryChangesetConfig{ MCMS: mcmsConfig, Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - selectorA: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorA: { testhelpers.TestTokenSymbol: { Type: changeset.BurnMintTokenPool, Version: deployment.Version1_5_1, @@ -104,7 +105,7 @@ func TestAcceptAdminRoleChangeset_Validations(t *testing.T) { t.Run(test.Msg, func(t *testing.T) { _, err := commonchangeset.Apply(t, e, timelockContracts, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.AcceptAdminRoleChangeset), + deployment.CreateLegacyChangeSet(v1_5_1.AcceptAdminRoleChangeset), test.Config, ), ) @@ -124,7 +125,7 @@ func TestAcceptAdminRoleChangeset_Execution(t *testing.T) { t.Run(msg, func(t *testing.T) { e, selectorA, selectorB, tokens, timelockContracts := testhelpers.SetupTwoChainEnvironmentWithTokens(t, logger.TestLogger(t), mcmsConfig != nil) - e = testhelpers.DeployTestTokenPools(t, e, map[uint64]changeset.DeployTokenPoolInput{ + e = testhelpers.DeployTestTokenPools(t, e, map[uint64]v1_5_1.DeployTokenPoolInput{ selectorA: { Type: changeset.BurnMintTokenPool, TokenAddress: tokens[selectorA].Address, @@ -145,17 +146,17 @@ func TestAcceptAdminRoleChangeset_Execution(t *testing.T) { e, err = commonchangeset.Apply(t, e, timelockContracts, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.ProposeAdminRoleChangeset), + deployment.CreateLegacyChangeSet(v1_5_1.ProposeAdminRoleChangeset), changeset.TokenAdminRegistryChangesetConfig{ MCMS: mcmsConfig, Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - selectorA: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorA: { testhelpers.TestTokenSymbol: { Type: changeset.BurnMintTokenPool, Version: deployment.Version1_5_1, }, }, - selectorB: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorB: { testhelpers.TestTokenSymbol: { Type: changeset.BurnMintTokenPool, Version: deployment.Version1_5_1, @@ -165,17 +166,17 @@ func TestAcceptAdminRoleChangeset_Execution(t *testing.T) { }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.AcceptAdminRoleChangeset), + deployment.CreateLegacyChangeSet(v1_5_1.AcceptAdminRoleChangeset), changeset.TokenAdminRegistryChangesetConfig{ MCMS: mcmsConfig, Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - selectorA: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorA: { testhelpers.TestTokenSymbol: { Type: changeset.BurnMintTokenPool, Version: deployment.Version1_5_1, }, }, - selectorB: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorB: { testhelpers.TestTokenSymbol: { Type: changeset.BurnMintTokenPool, Version: deployment.Version1_5_1, diff --git a/deployment/ccip/changeset/cs_configure_token_pools.go b/deployment/ccip/changeset/v1_5_1/cs_configure_token_pools.go similarity index 94% rename from deployment/ccip/changeset/cs_configure_token_pools.go rename to deployment/ccip/changeset/v1_5_1/cs_configure_token_pools.go index 40a566d6e76..3385ec7817a 100644 --- a/deployment/ccip/changeset/cs_configure_token_pools.go +++ b/deployment/ccip/changeset/v1_5_1/cs_configure_token_pools.go @@ -1,4 +1,4 @@ -package changeset +package v1_5_1 import ( "bytes" @@ -13,6 +13,7 @@ import ( "github.com/smartcontractkit/chainlink-integrations/evm/utils" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/v1_5_1/token_pool" "github.com/smartcontractkit/chainlink/deployment" @@ -71,19 +72,19 @@ type TokenPoolConfig struct { Version semver.Version } -func (c TokenPoolConfig) Validate(ctx context.Context, chain deployment.Chain, state CCIPChainState, useMcms bool, tokenSymbol TokenSymbol) error { +func (c TokenPoolConfig) Validate(ctx context.Context, chain deployment.Chain, state changeset.CCIPChainState, useMcms bool, tokenSymbol changeset.TokenSymbol) error { // Ensure that the inputted type is known - if _, ok := tokenPoolTypes[c.Type]; !ok { + if _, ok := changeset.TokenPoolTypes[c.Type]; !ok { return fmt.Errorf("%s is not a known token pool type", c.Type) } // Ensure that the inputted version is known - if _, ok := tokenPoolVersions[c.Version]; !ok { + if _, ok := changeset.TokenPoolVersions[c.Version]; !ok { return fmt.Errorf("%s is not a known token pool version", c.Version) } // Ensure that a pool with given symbol, type and version is known to the environment - tokenPoolAddress, ok := getTokenPoolAddressFromSymbolTypeAndVersion(state, chain, tokenSymbol, c.Type, c.Version) + tokenPoolAddress, ok := changeset.GetTokenPoolAddressFromSymbolTypeAndVersion(state, chain, tokenSymbol, c.Type, c.Version) if !ok { return fmt.Errorf("token pool does not exist on %s with symbol %s, type %s, and version %s", chain.String(), tokenSymbol, c.Type, c.Version) } @@ -108,18 +109,18 @@ func (c TokenPoolConfig) Validate(ctx context.Context, chain deployment.Chain, s // ConfigureTokenPoolContractsConfig is the configuration for the ConfigureTokenPoolContractsConfig changeset. type ConfigureTokenPoolContractsConfig struct { // MCMS defines the delay to use for Timelock (if absent, the changeset will attempt to use the deployer key). - MCMS *MCMSConfig + MCMS *changeset.MCMSConfig // PoolUpdates defines the changes that we want to make to the token pool on a chain PoolUpdates map[uint64]TokenPoolConfig // Symbol is the symbol of the token of interest. - TokenSymbol TokenSymbol + TokenSymbol changeset.TokenSymbol } func (c ConfigureTokenPoolContractsConfig) Validate(env deployment.Environment) error { if c.TokenSymbol == "" { return errors.New("token symbol must be defined") } - state, err := LoadOnchainState(env) + state, err := changeset.LoadOnchainState(env) if err != nil { return fmt.Errorf("failed to load onchain state: %w", err) } @@ -175,12 +176,12 @@ func ConfigureTokenPoolContractsChangeset(env deployment.Environment, c Configur if err := c.Validate(env); err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("invalid ConfigureTokenPoolContractsConfig: %w", err) } - state, err := LoadOnchainState(env) + state, err := changeset.LoadOnchainState(env) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to load onchain state: %w", err) } - deployerGroup := NewDeployerGroup(env, state, c.MCMS).WithDeploymentContext(fmt.Sprintf("configure %s token pools", c.TokenSymbol)) + deployerGroup := changeset.NewDeployerGroup(env, state, c.MCMS).WithDeploymentContext(fmt.Sprintf("configure %s token pools", c.TokenSymbol)) for chainSelector := range c.PoolUpdates { chain := env.Chains[chainSelector] @@ -204,7 +205,7 @@ func configureTokenPool( ctx context.Context, opts *bind.TransactOpts, chains map[uint64]deployment.Chain, - state CCIPOnChainState, + state changeset.CCIPOnChainState, config ConfigureTokenPoolContractsConfig, chainSelector uint64, ) error { @@ -307,13 +308,13 @@ func configureTokenPool( // getTokenStateFromPool fetches the token config from the registry given the pool address func getTokenStateFromPool( ctx context.Context, - symbol TokenSymbol, + symbol changeset.TokenSymbol, poolType deployment.ContractType, version semver.Version, chain deployment.Chain, - state CCIPChainState, + state changeset.CCIPChainState, ) (*token_pool.TokenPool, common.Address, token_admin_registry.TokenAdminRegistryTokenConfig, error) { - tokenPoolAddress, ok := getTokenPoolAddressFromSymbolTypeAndVersion(state, chain, symbol, poolType, version) + tokenPoolAddress, ok := changeset.GetTokenPoolAddressFromSymbolTypeAndVersion(state, chain, symbol, poolType, version) if !ok { return nil, utils.ZeroAddress, token_admin_registry.TokenAdminRegistryTokenConfig{}, fmt.Errorf("token pool does not exist on %s with symbol %s, type %s, and version %s", chain.String(), symbol, poolType, version) } diff --git a/deployment/ccip/changeset/cs_configure_token_pools_test.go b/deployment/ccip/changeset/v1_5_1/cs_configure_token_pools_test.go similarity index 84% rename from deployment/ccip/changeset/cs_configure_token_pools_test.go rename to deployment/ccip/changeset/v1_5_1/cs_configure_token_pools_test.go index 682a84254fa..09ba7f5f980 100644 --- a/deployment/ccip/changeset/cs_configure_token_pools_test.go +++ b/deployment/ccip/changeset/v1_5_1/cs_configure_token_pools_test.go @@ -1,4 +1,4 @@ -package changeset_test +package v1_5_1_test import ( "bytes" @@ -14,6 +14,7 @@ import ( "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_5_1" commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset" "github.com/smartcontractkit/chainlink/deployment/environment/memory" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/v1_5_1/token_pool" @@ -22,8 +23,8 @@ import ( ) // createSymmetricRateLimits is a utility to quickly create a rate limiter config with equal inbound and outbound values. -func createSymmetricRateLimits(rate int64, capacity int64) changeset.RateLimiterConfig { - return changeset.RateLimiterConfig{ +func createSymmetricRateLimits(rate int64, capacity int64) v1_5_1.RateLimiterConfig { + return v1_5_1.RateLimiterConfig{ Inbound: token_pool.RateLimiterConfig{ IsEnabled: rate != 0 || capacity != 0, Rate: big.NewInt(rate), @@ -128,7 +129,7 @@ func TestValidateRemoteChains(t *testing.T) { for _, test := range tests { t.Run(test.ErrStr, func(t *testing.T) { - remoteChains := changeset.RateLimiterPerChain{ + remoteChains := v1_5_1.RateLimiterPerChain{ 1: { Inbound: token_pool.RateLimiterConfig{ IsEnabled: test.IsEnabled, @@ -155,7 +156,7 @@ func TestValidateTokenPoolConfig(t *testing.T) { e, selectorA, _, tokens, _ := testhelpers.SetupTwoChainEnvironmentWithTokens(t, logger.TestLogger(t), true) - e = testhelpers.DeployTestTokenPools(t, e, map[uint64]changeset.DeployTokenPoolInput{ + e = testhelpers.DeployTestTokenPools(t, e, map[uint64]v1_5_1.DeployTokenPoolInput{ selectorA: { Type: changeset.BurnMintTokenPool, TokenAddress: tokens[selectorA].Address, @@ -168,25 +169,25 @@ func TestValidateTokenPoolConfig(t *testing.T) { tests := []struct { UseMcms bool - TokenPoolConfig changeset.TokenPoolConfig + TokenPoolConfig v1_5_1.TokenPoolConfig ErrStr string Msg string }{ { Msg: "Pool type is invalid", - TokenPoolConfig: changeset.TokenPoolConfig{}, + TokenPoolConfig: v1_5_1.TokenPoolConfig{}, ErrStr: "is not a known token pool type", }, { Msg: "Pool version is invalid", - TokenPoolConfig: changeset.TokenPoolConfig{ + TokenPoolConfig: v1_5_1.TokenPoolConfig{ Type: changeset.BurnMintTokenPool, }, ErrStr: "is not a known token pool version", }, { Msg: "Pool is not owned by required address", - TokenPoolConfig: changeset.TokenPoolConfig{ + TokenPoolConfig: v1_5_1.TokenPoolConfig{ Type: changeset.BurnMintTokenPool, Version: deployment.Version1_5_1, }, @@ -213,43 +214,43 @@ func TestValidateConfigureTokenPoolContractsConfig(t *testing.T) { tests := []struct { TokenSymbol changeset.TokenSymbol - Input changeset.ConfigureTokenPoolContractsConfig + Input v1_5_1.ConfigureTokenPoolContractsConfig ErrStr string Msg string }{ { Msg: "Token symbol is missing", - Input: changeset.ConfigureTokenPoolContractsConfig{}, + Input: v1_5_1.ConfigureTokenPoolContractsConfig{}, ErrStr: "token symbol must be defined", }, { Msg: "Chain selector is invalid", - Input: changeset.ConfigureTokenPoolContractsConfig{ + Input: v1_5_1.ConfigureTokenPoolContractsConfig{ TokenSymbol: testhelpers.TestTokenSymbol, - PoolUpdates: map[uint64]changeset.TokenPoolConfig{ - 0: changeset.TokenPoolConfig{}, + PoolUpdates: map[uint64]v1_5_1.TokenPoolConfig{ + 0: v1_5_1.TokenPoolConfig{}, }, }, ErrStr: "failed to validate chain selector 0", }, { Msg: "Chain selector doesn't exist in environment", - Input: changeset.ConfigureTokenPoolContractsConfig{ + Input: v1_5_1.ConfigureTokenPoolContractsConfig{ TokenSymbol: testhelpers.TestTokenSymbol, - PoolUpdates: map[uint64]changeset.TokenPoolConfig{ - 5009297550715157269: changeset.TokenPoolConfig{}, + PoolUpdates: map[uint64]v1_5_1.TokenPoolConfig{ + 5009297550715157269: v1_5_1.TokenPoolConfig{}, }, }, ErrStr: "does not exist in environment", }, { Msg: "Corresponding pool update missing", - Input: changeset.ConfigureTokenPoolContractsConfig{ + Input: v1_5_1.ConfigureTokenPoolContractsConfig{ TokenSymbol: testhelpers.TestTokenSymbol, - PoolUpdates: map[uint64]changeset.TokenPoolConfig{ - e.AllChainSelectors()[0]: changeset.TokenPoolConfig{ - ChainUpdates: changeset.RateLimiterPerChain{ - e.AllChainSelectors()[1]: changeset.RateLimiterConfig{}, + PoolUpdates: map[uint64]v1_5_1.TokenPoolConfig{ + e.AllChainSelectors()[0]: v1_5_1.TokenPoolConfig{ + ChainUpdates: v1_5_1.RateLimiterPerChain{ + e.AllChainSelectors()[1]: v1_5_1.RateLimiterConfig{}, }, }, }, @@ -275,17 +276,17 @@ func TestValidateConfigureTokenPoolContractsConfig(t *testing.T) { */ { Msg: "Token admin registry is missing", - Input: changeset.ConfigureTokenPoolContractsConfig{ + Input: v1_5_1.ConfigureTokenPoolContractsConfig{ TokenSymbol: testhelpers.TestTokenSymbol, - PoolUpdates: map[uint64]changeset.TokenPoolConfig{ - e.AllChainSelectors()[0]: changeset.TokenPoolConfig{ - ChainUpdates: changeset.RateLimiterPerChain{ - e.AllChainSelectors()[1]: changeset.RateLimiterConfig{}, + PoolUpdates: map[uint64]v1_5_1.TokenPoolConfig{ + e.AllChainSelectors()[0]: v1_5_1.TokenPoolConfig{ + ChainUpdates: v1_5_1.RateLimiterPerChain{ + e.AllChainSelectors()[1]: v1_5_1.RateLimiterConfig{}, }, }, - e.AllChainSelectors()[1]: changeset.TokenPoolConfig{ - ChainUpdates: changeset.RateLimiterPerChain{ - e.AllChainSelectors()[0]: changeset.RateLimiterConfig{}, + e.AllChainSelectors()[1]: v1_5_1.TokenPoolConfig{ + ChainUpdates: v1_5_1.RateLimiterPerChain{ + e.AllChainSelectors()[0]: v1_5_1.RateLimiterConfig{}, }, }, }, @@ -306,15 +307,15 @@ func TestValidateConfigureTokenPoolContracts(t *testing.T) { t.Parallel() type regPass struct { - SelectorA2B changeset.RateLimiterConfig - SelectorB2A changeset.RateLimiterConfig + SelectorA2B v1_5_1.RateLimiterConfig + SelectorB2A v1_5_1.RateLimiterConfig } type updatePass struct { UpdatePoolOnA bool UpdatePoolOnB bool - SelectorA2B changeset.RateLimiterConfig - SelectorB2A changeset.RateLimiterConfig + SelectorA2B v1_5_1.RateLimiterConfig + SelectorB2A v1_5_1.RateLimiterConfig } type tokenPools struct { @@ -382,7 +383,7 @@ func TestValidateConfigureTokenPoolContracts(t *testing.T) { t.Run(test.Msg, func(t *testing.T) { e, selectorA, selectorB, tokens, timelockContracts := testhelpers.SetupTwoChainEnvironmentWithTokens(t, logger.TestLogger(t), mcmsConfig != nil) - e = testhelpers.DeployTestTokenPools(t, e, map[uint64]changeset.DeployTokenPoolInput{ + e = testhelpers.DeployTestTokenPools(t, e, map[uint64]v1_5_1.DeployTokenPoolInput{ selectorA: { Type: changeset.BurnMintTokenPool, TokenAddress: tokens[selectorA].Address, @@ -395,7 +396,7 @@ func TestValidateConfigureTokenPoolContracts(t *testing.T) { }, }, mcmsConfig != nil) - e = testhelpers.DeployTestTokenPools(t, e, map[uint64]changeset.DeployTokenPoolInput{ + e = testhelpers.DeployTestTokenPools(t, e, map[uint64]v1_5_1.DeployTokenPoolInput{ selectorA: { Type: changeset.LockReleaseTokenPool, TokenAddress: tokens[selectorA].Address, @@ -442,22 +443,22 @@ func TestValidateConfigureTokenPoolContracts(t *testing.T) { // Configure & set the active pools on the registry e, err = commonchangeset.Apply(t, e, timelockContracts, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.ConfigureTokenPoolContractsChangeset), - changeset.ConfigureTokenPoolContractsConfig{ + deployment.CreateLegacyChangeSet(v1_5_1.ConfigureTokenPoolContractsChangeset), + v1_5_1.ConfigureTokenPoolContractsConfig{ TokenSymbol: testhelpers.TestTokenSymbol, MCMS: mcmsConfig, - PoolUpdates: map[uint64]changeset.TokenPoolConfig{ + PoolUpdates: map[uint64]v1_5_1.TokenPoolConfig{ selectorA: { Type: changeset.LockReleaseTokenPool, Version: deployment.Version1_5_1, - ChainUpdates: changeset.RateLimiterPerChain{ + ChainUpdates: v1_5_1.RateLimiterPerChain{ selectorB: test.RegistrationPass.SelectorA2B, }, }, selectorB: { Type: changeset.LockReleaseTokenPool, Version: deployment.Version1_5_1, - ChainUpdates: changeset.RateLimiterPerChain{ + ChainUpdates: v1_5_1.RateLimiterPerChain{ selectorA: test.RegistrationPass.SelectorB2A, }, }, @@ -465,17 +466,17 @@ func TestValidateConfigureTokenPoolContracts(t *testing.T) { }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.ProposeAdminRoleChangeset), + deployment.CreateLegacyChangeSet(v1_5_1.ProposeAdminRoleChangeset), changeset.TokenAdminRegistryChangesetConfig{ MCMS: mcmsConfig, Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - selectorA: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorA: { testhelpers.TestTokenSymbol: { Type: changeset.LockReleaseTokenPool, Version: deployment.Version1_5_1, }, }, - selectorB: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorB: { testhelpers.TestTokenSymbol: { Type: changeset.LockReleaseTokenPool, Version: deployment.Version1_5_1, @@ -485,17 +486,17 @@ func TestValidateConfigureTokenPoolContracts(t *testing.T) { }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.AcceptAdminRoleChangeset), + deployment.CreateLegacyChangeSet(v1_5_1.AcceptAdminRoleChangeset), changeset.TokenAdminRegistryChangesetConfig{ MCMS: mcmsConfig, Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - selectorA: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorA: { testhelpers.TestTokenSymbol: { Type: changeset.LockReleaseTokenPool, Version: deployment.Version1_5_1, }, }, - selectorB: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorB: { testhelpers.TestTokenSymbol: { Type: changeset.LockReleaseTokenPool, Version: deployment.Version1_5_1, @@ -505,17 +506,17 @@ func TestValidateConfigureTokenPoolContracts(t *testing.T) { }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.SetPoolChangeset), + deployment.CreateLegacyChangeSet(v1_5_1.SetPoolChangeset), changeset.TokenAdminRegistryChangesetConfig{ MCMS: mcmsConfig, Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - selectorA: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorA: { testhelpers.TestTokenSymbol: { Type: changeset.LockReleaseTokenPool, Version: deployment.Version1_5_1, }, }, - selectorB: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorB: { testhelpers.TestTokenSymbol: { Type: changeset.LockReleaseTokenPool, Version: deployment.Version1_5_1, @@ -529,7 +530,7 @@ func TestValidateConfigureTokenPoolContracts(t *testing.T) { for _, selector := range e.AllChainSelectors() { var remoteChainSelector uint64 - var rateLimiterConfig changeset.RateLimiterConfig + var rateLimiterConfig v1_5_1.RateLimiterConfig switch selector { case selectorA: remoteChainSelector = selectorB @@ -565,22 +566,22 @@ func TestValidateConfigureTokenPoolContracts(t *testing.T) { } e, err = commonchangeset.Apply(t, e, timelockContracts, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.ConfigureTokenPoolContractsChangeset), - changeset.ConfigureTokenPoolContractsConfig{ + deployment.CreateLegacyChangeSet(v1_5_1.ConfigureTokenPoolContractsChangeset), + v1_5_1.ConfigureTokenPoolContractsConfig{ TokenSymbol: testhelpers.TestTokenSymbol, MCMS: mcmsConfig, - PoolUpdates: map[uint64]changeset.TokenPoolConfig{ + PoolUpdates: map[uint64]v1_5_1.TokenPoolConfig{ selectorA: { Type: aType, Version: deployment.Version1_5_1, - ChainUpdates: changeset.RateLimiterPerChain{ + ChainUpdates: v1_5_1.RateLimiterPerChain{ selectorB: test.UpdatePass.SelectorA2B, }, }, selectorB: { Type: bType, Version: deployment.Version1_5_1, - ChainUpdates: changeset.RateLimiterPerChain{ + ChainUpdates: v1_5_1.RateLimiterPerChain{ selectorA: test.UpdatePass.SelectorB2A, }, }, @@ -594,7 +595,7 @@ func TestValidateConfigureTokenPoolContracts(t *testing.T) { var updatePool bool var updateRemotePool bool var remoteChainSelector uint64 - var rateLimiterConfig changeset.RateLimiterConfig + var rateLimiterConfig v1_5_1.RateLimiterConfig switch selector { case selectorA: remoteChainSelector = selectorB diff --git a/deployment/ccip/changeset/cs_deploy_token_pools.go b/deployment/ccip/changeset/v1_5_1/cs_deploy_token_pools.go similarity index 89% rename from deployment/ccip/changeset/cs_deploy_token_pools.go rename to deployment/ccip/changeset/v1_5_1/cs_deploy_token_pools.go index 94afb0a35f7..1f184252bcf 100644 --- a/deployment/ccip/changeset/cs_deploy_token_pools.go +++ b/deployment/ccip/changeset/v1_5_1/cs_deploy_token_pools.go @@ -1,4 +1,4 @@ -package changeset +package v1_5_1 import ( "context" @@ -15,6 +15,7 @@ import ( "github.com/smartcontractkit/chainlink-integrations/evm/utils" "github.com/smartcontractkit/chainlink/deployment" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/v1_5_1/burn_from_mint_token_pool" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/v1_5_1/burn_mint_token_pool" @@ -41,7 +42,7 @@ type DeployTokenPoolInput struct { AcceptLiquidity *bool } -func (i DeployTokenPoolInput) Validate(ctx context.Context, chain deployment.Chain, state CCIPChainState, tokenSymbol TokenSymbol) error { +func (i DeployTokenPoolInput) Validate(ctx context.Context, chain deployment.Chain, state changeset.CCIPChainState, tokenSymbol changeset.TokenSymbol) error { // Ensure that required fields are populated if i.TokenAddress == utils.ZeroAddress { return errors.New("token address must be defined") @@ -51,7 +52,7 @@ func (i DeployTokenPoolInput) Validate(ctx context.Context, chain deployment.Cha } // Validate that the type is known - if _, ok := tokenPoolTypes[i.Type]; !ok { + if _, ok := changeset.TokenPoolTypes[i.Type]; !ok { return fmt.Errorf("requested token pool type %s is unknown", i.Type) } @@ -78,17 +79,17 @@ func (i DeployTokenPoolInput) Validate(ctx context.Context, chain deployment.Cha } // Validate acceptLiquidity based on requested pool type - if i.Type == LockReleaseTokenPool && i.AcceptLiquidity == nil { + if i.Type == changeset.LockReleaseTokenPool && i.AcceptLiquidity == nil { return errors.New("accept liquidity must be defined for lock release pools") } - if i.Type != LockReleaseTokenPool && i.AcceptLiquidity != nil { + if i.Type != changeset.LockReleaseTokenPool && i.AcceptLiquidity != nil { return errors.New("accept liquidity must be nil for burn mint pools") } // We should check if a token pool with this type, version, and symbol already exists - _, ok := getTokenPoolAddressFromSymbolTypeAndVersion(state, chain, tokenSymbol, i.Type, currentTokenPoolVersion) + _, ok := changeset.GetTokenPoolAddressFromSymbolTypeAndVersion(state, chain, tokenSymbol, i.Type, changeset.CurrentTokenPoolVersion) if ok { - return fmt.Errorf("token pool with type %s and version %s already exists for %s on %s", i.Type, currentTokenPoolVersion, tokenSymbol, chain) + return fmt.Errorf("token pool with type %s and version %s already exists for %s on %s", i.Type, changeset.CurrentTokenPoolVersion, tokenSymbol, chain) } return nil @@ -97,7 +98,7 @@ func (i DeployTokenPoolInput) Validate(ctx context.Context, chain deployment.Cha // DeployTokenPoolContractsConfig defines the token pool contracts that need to be deployed on each chain. type DeployTokenPoolContractsConfig struct { // Symbol is the symbol of the token for which we are deploying a pool. - TokenSymbol TokenSymbol + TokenSymbol changeset.TokenSymbol // NewPools defines the per-chain configuration of each new pool NewPools map[uint64]DeployTokenPoolInput // IsTestRouter indicates whether or not the test router should be used. @@ -106,11 +107,11 @@ type DeployTokenPoolContractsConfig struct { func (c DeployTokenPoolContractsConfig) Validate(env deployment.Environment) error { // Ensure that required fields are populated - if c.TokenSymbol == TokenSymbol("") { + if c.TokenSymbol == changeset.TokenSymbol("") { return errors.New("token symbol must be defined") } - state, err := LoadOnchainState(env) + state, err := changeset.LoadOnchainState(env) if err != nil { return fmt.Errorf("failed to load onchain state: %w", err) } @@ -154,7 +155,7 @@ func DeployTokenPoolContractsChangeset(env deployment.Environment, c DeployToken } newAddresses := deployment.NewMemoryAddressBook() - state, err := LoadOnchainState(env) + state, err := changeset.LoadOnchainState(env) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to load onchain state: %w", err) } @@ -185,7 +186,7 @@ func DeployTokenPoolContractsChangeset(env deployment.Environment, c DeployToken func deployTokenPool( logger logger.Logger, chain deployment.Chain, - chainState CCIPChainState, + chainState changeset.CCIPChainState, addressBook deployment.AddressBook, poolConfig DeployTokenPoolInput, isTestRouter bool, @@ -202,22 +203,22 @@ func deployTokenPool( var tx *types.Transaction var err error switch poolConfig.Type { - case BurnMintTokenPool: + case changeset.BurnMintTokenPool: tpAddr, tx, _, err = burn_mint_token_pool.DeployBurnMintTokenPool( chain.DeployerKey, chain.Client, poolConfig.TokenAddress, poolConfig.LocalTokenDecimals, poolConfig.AllowList, rmnProxy.Address(), router.Address(), ) - case BurnWithFromMintTokenPool: + case changeset.BurnWithFromMintTokenPool: tpAddr, tx, _, err = burn_with_from_mint_token_pool.DeployBurnWithFromMintTokenPool( chain.DeployerKey, chain.Client, poolConfig.TokenAddress, poolConfig.LocalTokenDecimals, poolConfig.AllowList, rmnProxy.Address(), router.Address(), ) - case BurnFromMintTokenPool: + case changeset.BurnFromMintTokenPool: tpAddr, tx, _, err = burn_from_mint_token_pool.DeployBurnFromMintTokenPool( chain.DeployerKey, chain.Client, poolConfig.TokenAddress, poolConfig.LocalTokenDecimals, poolConfig.AllowList, rmnProxy.Address(), router.Address(), ) - case LockReleaseTokenPool: + case changeset.LockReleaseTokenPool: tpAddr, tx, _, err = lock_release_token_pool.DeployLockReleaseTokenPool( chain.DeployerKey, chain.Client, poolConfig.TokenAddress, poolConfig.LocalTokenDecimals, poolConfig.AllowList, rmnProxy.Address(), *poolConfig.AcceptLiquidity, router.Address(), @@ -230,7 +231,7 @@ func deployTokenPool( return deployment.ContractDeploy[*token_pool.TokenPool]{ Address: tpAddr, Contract: tp, - Tv: deployment.NewTypeAndVersion(poolConfig.Type, currentTokenPoolVersion), + Tv: deployment.NewTypeAndVersion(poolConfig.Type, changeset.CurrentTokenPoolVersion), Tx: tx, Err: err, } diff --git a/deployment/ccip/changeset/cs_deploy_token_pools_test.go b/deployment/ccip/changeset/v1_5_1/cs_deploy_token_pools_test.go similarity index 82% rename from deployment/ccip/changeset/cs_deploy_token_pools_test.go rename to deployment/ccip/changeset/v1_5_1/cs_deploy_token_pools_test.go index 8e129cfbed9..546ee19c8a3 100644 --- a/deployment/ccip/changeset/cs_deploy_token_pools_test.go +++ b/deployment/ccip/changeset/v1_5_1/cs_deploy_token_pools_test.go @@ -1,4 +1,4 @@ -package changeset_test +package v1_5_1_test import ( "context" @@ -11,9 +11,11 @@ import ( "go.uber.org/zap/zapcore" "github.com/smartcontractkit/chainlink-integrations/evm/utils" + "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_5_1" commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset" "github.com/smartcontractkit/chainlink/deployment/environment/memory" "github.com/smartcontractkit/chainlink/v2/core/logger" @@ -30,50 +32,50 @@ func TestValidateDeployTokenPoolContractsConfig(t *testing.T) { tests := []struct { Msg string TokenSymbol changeset.TokenSymbol - Input changeset.DeployTokenPoolContractsConfig + Input v1_5_1.DeployTokenPoolContractsConfig ErrStr string }{ { Msg: "Token symbol is missing", - Input: changeset.DeployTokenPoolContractsConfig{}, + Input: v1_5_1.DeployTokenPoolContractsConfig{}, ErrStr: "token symbol must be defined", }, { Msg: "Chain selector is not valid", - Input: changeset.DeployTokenPoolContractsConfig{ + Input: v1_5_1.DeployTokenPoolContractsConfig{ TokenSymbol: "TEST", - NewPools: map[uint64]changeset.DeployTokenPoolInput{ - 0: changeset.DeployTokenPoolInput{}, + NewPools: map[uint64]v1_5_1.DeployTokenPoolInput{ + 0: v1_5_1.DeployTokenPoolInput{}, }, }, ErrStr: "failed to validate chain selector 0", }, { Msg: "Chain selector doesn't exist in environment", - Input: changeset.DeployTokenPoolContractsConfig{ + Input: v1_5_1.DeployTokenPoolContractsConfig{ TokenSymbol: "TEST", - NewPools: map[uint64]changeset.DeployTokenPoolInput{ - 5009297550715157269: changeset.DeployTokenPoolInput{}, + NewPools: map[uint64]v1_5_1.DeployTokenPoolInput{ + 5009297550715157269: v1_5_1.DeployTokenPoolInput{}, }, }, ErrStr: "does not exist in environment", }, { Msg: "Router contract is missing from chain", - Input: changeset.DeployTokenPoolContractsConfig{ + Input: v1_5_1.DeployTokenPoolContractsConfig{ TokenSymbol: "TEST", - NewPools: map[uint64]changeset.DeployTokenPoolInput{ - e.AllChainSelectors()[0]: changeset.DeployTokenPoolInput{}, + NewPools: map[uint64]v1_5_1.DeployTokenPoolInput{ + e.AllChainSelectors()[0]: v1_5_1.DeployTokenPoolInput{}, }, }, ErrStr: "missing router", }, { Msg: "Test router contract is missing from chain", - Input: changeset.DeployTokenPoolContractsConfig{ + Input: v1_5_1.DeployTokenPoolContractsConfig{ TokenSymbol: "TEST", - NewPools: map[uint64]changeset.DeployTokenPoolInput{ - e.AllChainSelectors()[0]: changeset.DeployTokenPoolInput{}, + NewPools: map[uint64]v1_5_1.DeployTokenPoolInput{ + e.AllChainSelectors()[0]: v1_5_1.DeployTokenPoolInput{}, }, IsTestRouter: true, }, @@ -96,7 +98,7 @@ func TestValidateDeployTokenPoolInput(t *testing.T) { acceptLiquidity := false invalidAddress := utils.RandomAddress() - e = testhelpers.DeployTestTokenPools(t, e, map[uint64]changeset.DeployTokenPoolInput{ + e = testhelpers.DeployTestTokenPools(t, e, map[uint64]v1_5_1.DeployTokenPoolInput{ selectorA: { Type: changeset.BurnMintTokenPool, TokenAddress: tokens[selectorA].Address, @@ -107,24 +109,24 @@ func TestValidateDeployTokenPoolInput(t *testing.T) { tests := []struct { Msg string Symbol changeset.TokenSymbol - Input changeset.DeployTokenPoolInput + Input v1_5_1.DeployTokenPoolInput ErrStr string }{ { Msg: "Token address is missing", - Input: changeset.DeployTokenPoolInput{}, + Input: v1_5_1.DeployTokenPoolInput{}, ErrStr: "token address must be defined", }, { Msg: "Token pool type is missing", - Input: changeset.DeployTokenPoolInput{ + Input: v1_5_1.DeployTokenPoolInput{ TokenAddress: invalidAddress, }, ErrStr: "type must be defined", }, { Msg: "Token pool type is invalid", - Input: changeset.DeployTokenPoolInput{ + Input: v1_5_1.DeployTokenPoolInput{ TokenAddress: invalidAddress, Type: deployment.ContractType("InvalidTokenPool"), }, @@ -132,7 +134,7 @@ func TestValidateDeployTokenPoolInput(t *testing.T) { }, { Msg: "Token address is invalid", - Input: changeset.DeployTokenPoolInput{ + Input: v1_5_1.DeployTokenPoolInput{ Type: changeset.BurnMintTokenPool, TokenAddress: invalidAddress, }, @@ -141,7 +143,7 @@ func TestValidateDeployTokenPoolInput(t *testing.T) { { Msg: "Token symbol mismatch", Symbol: "WRONG", - Input: changeset.DeployTokenPoolInput{ + Input: v1_5_1.DeployTokenPoolInput{ Type: changeset.BurnMintTokenPool, TokenAddress: tokens[selectorA].Address, }, @@ -150,7 +152,7 @@ func TestValidateDeployTokenPoolInput(t *testing.T) { { Msg: "Token decimal mismatch", Symbol: testhelpers.TestTokenSymbol, - Input: changeset.DeployTokenPoolInput{ + Input: v1_5_1.DeployTokenPoolInput{ Type: changeset.BurnMintTokenPool, TokenAddress: tokens[selectorA].Address, LocalTokenDecimals: 17, @@ -160,7 +162,7 @@ func TestValidateDeployTokenPoolInput(t *testing.T) { { Msg: "Accept liquidity should be defined", Symbol: testhelpers.TestTokenSymbol, - Input: changeset.DeployTokenPoolInput{ + Input: v1_5_1.DeployTokenPoolInput{ Type: changeset.LockReleaseTokenPool, TokenAddress: tokens[selectorA].Address, LocalTokenDecimals: testhelpers.LocalTokenDecimals, @@ -170,7 +172,7 @@ func TestValidateDeployTokenPoolInput(t *testing.T) { { Msg: "Accept liquidity should be omitted", Symbol: testhelpers.TestTokenSymbol, - Input: changeset.DeployTokenPoolInput{ + Input: v1_5_1.DeployTokenPoolInput{ Type: changeset.BurnMintTokenPool, TokenAddress: tokens[selectorA].Address, LocalTokenDecimals: testhelpers.LocalTokenDecimals, @@ -181,7 +183,7 @@ func TestValidateDeployTokenPoolInput(t *testing.T) { { Msg: "Token pool already exists", Symbol: testhelpers.TestTokenSymbol, - Input: changeset.DeployTokenPoolInput{ + Input: v1_5_1.DeployTokenPoolInput{ Type: changeset.BurnMintTokenPool, TokenAddress: tokens[selectorA].Address, LocalTokenDecimals: testhelpers.LocalTokenDecimals, @@ -212,12 +214,12 @@ func TestDeployTokenPoolContracts(t *testing.T) { tests := []struct { Msg string - Input changeset.DeployTokenPoolInput + Input v1_5_1.DeployTokenPoolInput GetPool func(changeset.CCIPChainState) Ownable }{ { Msg: "BurnMint", - Input: changeset.DeployTokenPoolInput{ + Input: v1_5_1.DeployTokenPoolInput{ Type: changeset.BurnMintTokenPool, LocalTokenDecimals: testhelpers.LocalTokenDecimals, AllowList: []common.Address{}, @@ -231,7 +233,7 @@ func TestDeployTokenPoolContracts(t *testing.T) { }, { Msg: "BurnWithFromMint", - Input: changeset.DeployTokenPoolInput{ + Input: v1_5_1.DeployTokenPoolInput{ Type: changeset.BurnWithFromMintTokenPool, LocalTokenDecimals: testhelpers.LocalTokenDecimals, AllowList: []common.Address{}, @@ -245,7 +247,7 @@ func TestDeployTokenPoolContracts(t *testing.T) { }, { Msg: "BurnFromMint", - Input: changeset.DeployTokenPoolInput{ + Input: v1_5_1.DeployTokenPoolInput{ Type: changeset.BurnFromMintTokenPool, LocalTokenDecimals: testhelpers.LocalTokenDecimals, AllowList: []common.Address{}, @@ -259,7 +261,7 @@ func TestDeployTokenPoolContracts(t *testing.T) { }, { Msg: "LockRelease", - Input: changeset.DeployTokenPoolInput{ + Input: v1_5_1.DeployTokenPoolInput{ Type: changeset.LockReleaseTokenPool, LocalTokenDecimals: testhelpers.LocalTokenDecimals, AllowList: []common.Address{}, @@ -282,10 +284,10 @@ func TestDeployTokenPoolContracts(t *testing.T) { e, err := commonchangeset.Apply(t, e, timelockContracts, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.DeployTokenPoolContractsChangeset), - changeset.DeployTokenPoolContractsConfig{ + deployment.CreateLegacyChangeSet(v1_5_1.DeployTokenPoolContractsChangeset), + v1_5_1.DeployTokenPoolContractsConfig{ TokenSymbol: testhelpers.TestTokenSymbol, - NewPools: map[uint64]changeset.DeployTokenPoolInput{ + NewPools: map[uint64]v1_5_1.DeployTokenPoolInput{ selectorA: test.Input, }, }, diff --git a/deployment/ccip/changeset/cs_deploy_usdc_token_pools.go b/deployment/ccip/changeset/v1_5_1/cs_deploy_usdc_token_pools.go similarity index 94% rename from deployment/ccip/changeset/cs_deploy_usdc_token_pools.go rename to deployment/ccip/changeset/v1_5_1/cs_deploy_usdc_token_pools.go index 36c41a819a9..68ae0f08a40 100644 --- a/deployment/ccip/changeset/cs_deploy_usdc_token_pools.go +++ b/deployment/ccip/changeset/v1_5_1/cs_deploy_usdc_token_pools.go @@ -1,4 +1,4 @@ -package changeset +package v1_5_1 import ( "context" @@ -9,7 +9,9 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/smartcontractkit/chainlink-integrations/evm/utils" + "github.com/smartcontractkit/chainlink/deployment" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/latest/mock_usdc_token_messenger" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/v1_5_1/usdc_token_pool" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/shared/generated/erc20" @@ -28,7 +30,7 @@ type DeployUSDCTokenPoolInput struct { AllowList []common.Address } -func (i DeployUSDCTokenPoolInput) Validate(ctx context.Context, chain deployment.Chain, state CCIPChainState) error { +func (i DeployUSDCTokenPoolInput) Validate(ctx context.Context, chain deployment.Chain, state changeset.CCIPChainState) error { // Ensure that required fields are populated if i.TokenAddress == utils.ZeroAddress { return errors.New("token address must be defined") @@ -46,7 +48,7 @@ func (i DeployUSDCTokenPoolInput) Validate(ctx context.Context, chain deployment if err != nil { return fmt.Errorf("failed to fetch symbol from token with address %s: %w", i.TokenAddress, err) } - if symbol != string(USDCSymbol) { + if symbol != string(changeset.USDCSymbol) { return fmt.Errorf("symbol of token with address %s (%s) is not USDC", i.TokenAddress, symbol) } @@ -82,7 +84,7 @@ type DeployUSDCTokenPoolContractsConfig struct { } func (c DeployUSDCTokenPoolContractsConfig) Validate(env deployment.Environment) error { - state, err := LoadOnchainState(env) + state, err := changeset.LoadOnchainState(env) if err != nil { return fmt.Errorf("failed to load onchain state: %w", err) } @@ -120,7 +122,7 @@ func DeployUSDCTokenPoolContractsChangeset(env deployment.Environment, c DeployU } newAddresses := deployment.NewMemoryAddressBook() - state, err := LoadOnchainState(env) + state, err := changeset.LoadOnchainState(env) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to load onchain state: %w", err) } @@ -138,7 +140,7 @@ func DeployUSDCTokenPoolContractsChangeset(env deployment.Environment, c DeployU return deployment.ContractDeploy[*usdc_token_pool.USDCTokenPool]{ Address: poolAddress, Contract: usdcTokenPool, - Tv: deployment.NewTypeAndVersion(USDCTokenPool, deployment.Version1_5_1), + Tv: deployment.NewTypeAndVersion(changeset.USDCTokenPool, deployment.Version1_5_1), Tx: tx, Err: err, } diff --git a/deployment/ccip/changeset/cs_deploy_usdc_token_pools_test.go b/deployment/ccip/changeset/v1_5_1/cs_deploy_usdc_token_pools_test.go similarity index 86% rename from deployment/ccip/changeset/cs_deploy_usdc_token_pools_test.go rename to deployment/ccip/changeset/v1_5_1/cs_deploy_usdc_token_pools_test.go index 5477fe76d09..de887fcbc9c 100644 --- a/deployment/ccip/changeset/cs_deploy_usdc_token_pools_test.go +++ b/deployment/ccip/changeset/v1_5_1/cs_deploy_usdc_token_pools_test.go @@ -1,4 +1,4 @@ -package changeset_test +package v1_5_1_test import ( "fmt" @@ -9,8 +9,10 @@ import ( "go.uber.org/zap/zapcore" "github.com/smartcontractkit/chainlink-integrations/evm/utils" + "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_5_1" commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset" commoncs "github.com/smartcontractkit/chainlink/deployment/common/changeset" "github.com/smartcontractkit/chainlink/deployment/environment/memory" @@ -88,32 +90,32 @@ func TestValidateDeployUSDCTokenPoolContractsConfig(t *testing.T) { tests := []struct { Msg string - Input changeset.DeployUSDCTokenPoolContractsConfig + Input v1_5_1.DeployUSDCTokenPoolContractsConfig ErrStr string }{ { Msg: "Chain selector is not valid", - Input: changeset.DeployUSDCTokenPoolContractsConfig{ - USDCPools: map[uint64]changeset.DeployUSDCTokenPoolInput{ - 0: changeset.DeployUSDCTokenPoolInput{}, + Input: v1_5_1.DeployUSDCTokenPoolContractsConfig{ + USDCPools: map[uint64]v1_5_1.DeployUSDCTokenPoolInput{ + 0: v1_5_1.DeployUSDCTokenPoolInput{}, }, }, ErrStr: "failed to validate chain selector 0", }, { Msg: "Chain selector doesn't exist in environment", - Input: changeset.DeployUSDCTokenPoolContractsConfig{ - USDCPools: map[uint64]changeset.DeployUSDCTokenPoolInput{ - 5009297550715157269: changeset.DeployUSDCTokenPoolInput{}, + Input: v1_5_1.DeployUSDCTokenPoolContractsConfig{ + USDCPools: map[uint64]v1_5_1.DeployUSDCTokenPoolInput{ + 5009297550715157269: v1_5_1.DeployUSDCTokenPoolInput{}, }, }, ErrStr: "does not exist in environment", }, { Msg: "Missing router", - Input: changeset.DeployUSDCTokenPoolContractsConfig{ - USDCPools: map[uint64]changeset.DeployUSDCTokenPoolInput{ - e.AllChainSelectors()[0]: changeset.DeployUSDCTokenPoolInput{}, + Input: v1_5_1.DeployUSDCTokenPoolContractsConfig{ + USDCPools: map[uint64]v1_5_1.DeployUSDCTokenPoolInput{ + e.AllChainSelectors()[0]: v1_5_1.DeployUSDCTokenPoolInput{}, }, }, ErrStr: "missing router", @@ -167,24 +169,24 @@ func TestValidateDeployUSDCTokenPoolInput(t *testing.T) { tests := []struct { Msg string - Input changeset.DeployUSDCTokenPoolInput + Input v1_5_1.DeployUSDCTokenPoolInput ErrStr string }{ { Msg: "Missing token address", - Input: changeset.DeployUSDCTokenPoolInput{}, + Input: v1_5_1.DeployUSDCTokenPoolInput{}, ErrStr: "token address must be defined", }, { Msg: "Missing token messenger", - Input: changeset.DeployUSDCTokenPoolInput{ + Input: v1_5_1.DeployUSDCTokenPoolInput{ TokenAddress: utils.RandomAddress(), }, ErrStr: "token messenger must be defined", }, { Msg: "Can't reach token", - Input: changeset.DeployUSDCTokenPoolInput{ + Input: v1_5_1.DeployUSDCTokenPoolInput{ TokenAddress: utils.RandomAddress(), TokenMessenger: utils.RandomAddress(), }, @@ -192,7 +194,7 @@ func TestValidateDeployUSDCTokenPoolInput(t *testing.T) { }, { Msg: "Symbol is wrong", - Input: changeset.DeployUSDCTokenPoolInput{ + Input: v1_5_1.DeployUSDCTokenPoolInput{ TokenAddress: nonUsdcToken.Address, TokenMessenger: utils.RandomAddress(), }, @@ -200,7 +202,7 @@ func TestValidateDeployUSDCTokenPoolInput(t *testing.T) { }, { Msg: "Can't reach token messenger", - Input: changeset.DeployUSDCTokenPoolInput{ + Input: v1_5_1.DeployUSDCTokenPoolInput{ TokenAddress: usdcToken.Address, TokenMessenger: utils.RandomAddress(), }, @@ -208,7 +210,7 @@ func TestValidateDeployUSDCTokenPoolInput(t *testing.T) { }, { Msg: "No error", - Input: changeset.DeployUSDCTokenPoolInput{ + Input: v1_5_1.DeployUSDCTokenPoolInput{ TokenAddress: usdcToken.Address, TokenMessenger: tokenMessenger.Address, }, @@ -257,11 +259,11 @@ func TestDeployUSDCTokenPoolContracts(t *testing.T) { ) require.NoError(t, err) - newUSDCTokenPools := make(map[uint64]changeset.DeployUSDCTokenPoolInput, len(selectors)) + newUSDCTokenPools := make(map[uint64]v1_5_1.DeployUSDCTokenPoolInput, len(selectors)) for _, selector := range selectors { usdcToken, tokenMessenger := deployUSDCPrerequisites(t, lggr, e.Chains[selector], addressBook) - newUSDCTokenPools[selector] = changeset.DeployUSDCTokenPoolInput{ + newUSDCTokenPools[selector] = v1_5_1.DeployUSDCTokenPoolInput{ TokenAddress: usdcToken.Address, TokenMessenger: tokenMessenger.Address, } @@ -270,8 +272,8 @@ func TestDeployUSDCTokenPoolContracts(t *testing.T) { for i := range numRuns { e, err = commoncs.Apply(t, e, nil, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.DeployUSDCTokenPoolContractsChangeset), - changeset.DeployUSDCTokenPoolContractsConfig{ + deployment.CreateLegacyChangeSet(v1_5_1.DeployUSDCTokenPoolContractsChangeset), + v1_5_1.DeployUSDCTokenPoolContractsConfig{ USDCPools: newUSDCTokenPools, }, ), diff --git a/deployment/ccip/changeset/cs_propose_admin_role.go b/deployment/ccip/changeset/v1_5_1/cs_propose_admin_role.go similarity index 81% rename from deployment/ccip/changeset/cs_propose_admin_role.go rename to deployment/ccip/changeset/v1_5_1/cs_propose_admin_role.go index b04fd6b74b1..c026f98ae0b 100644 --- a/deployment/ccip/changeset/cs_propose_admin_role.go +++ b/deployment/ccip/changeset/v1_5_1/cs_propose_admin_role.go @@ -1,4 +1,4 @@ -package changeset +package v1_5_1 import ( "fmt" @@ -8,16 +8,17 @@ import ( "github.com/smartcontractkit/chainlink-integrations/evm/utils" "github.com/smartcontractkit/chainlink/deployment" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/v1_5_0/token_admin_registry" ) -var _ deployment.ChangeSet[TokenAdminRegistryChangesetConfig] = ProposeAdminRoleChangeset +var _ deployment.ChangeSet[changeset.TokenAdminRegistryChangesetConfig] = ProposeAdminRoleChangeset func validateProposeAdminRole( config token_admin_registry.TokenAdminRegistryTokenConfig, sender common.Address, externalAdmin common.Address, - symbol TokenSymbol, + symbol changeset.TokenSymbol, chain deployment.Chain, ) error { // To propose ourselves as admin of the token, two things must be true. @@ -31,16 +32,16 @@ func validateProposeAdminRole( } // ProposeAdminRoleChangeset proposes admin rights for tokens on the token admin registry. -func ProposeAdminRoleChangeset(env deployment.Environment, c TokenAdminRegistryChangesetConfig) (deployment.ChangesetOutput, error) { +func ProposeAdminRoleChangeset(env deployment.Environment, c changeset.TokenAdminRegistryChangesetConfig) (deployment.ChangesetOutput, error) { if err := c.Validate(env, true, validateProposeAdminRole); err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("invalid TokenAdminRegistryChangesetConfig: %w", err) } - state, err := LoadOnchainState(env) + state, err := changeset.LoadOnchainState(env) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to load onchain state: %w", err) } - deployerGroup := NewDeployerGroup(env, state, c.MCMS).WithDeploymentContext("propose admin role for tokens on token admin registries") + deployerGroup := changeset.NewDeployerGroup(env, state, c.MCMS).WithDeploymentContext("propose admin role for tokens on token admin registries") for chainSelector, tokenSymbolToPoolInfo := range c.Pools { chain := env.Chains[chainSelector] diff --git a/deployment/ccip/changeset/cs_propose_admin_role_test.go b/deployment/ccip/changeset/v1_5_1/cs_propose_admin_role_test.go similarity index 85% rename from deployment/ccip/changeset/cs_propose_admin_role_test.go rename to deployment/ccip/changeset/v1_5_1/cs_propose_admin_role_test.go index 37ea908087b..864a4e2cd91 100644 --- a/deployment/ccip/changeset/cs_propose_admin_role_test.go +++ b/deployment/ccip/changeset/v1_5_1/cs_propose_admin_role_test.go @@ -1,4 +1,4 @@ -package changeset_test +package v1_5_1_test import ( "testing" @@ -7,9 +7,11 @@ import ( "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink-integrations/evm/utils" + "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_5_1" commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset" "github.com/smartcontractkit/chainlink/v2/core/logger" ) @@ -19,7 +21,7 @@ func TestProposeAdminRoleChangeset_Validations(t *testing.T) { e, selectorA, _, tokens, timelockContracts := testhelpers.SetupTwoChainEnvironmentWithTokens(t, logger.TestLogger(t), true) - e = testhelpers.DeployTestTokenPools(t, e, map[uint64]changeset.DeployTokenPoolInput{ + e = testhelpers.DeployTestTokenPools(t, e, map[uint64]v1_5_1.DeployTokenPoolInput{ selectorA: { Type: changeset.BurnMintTokenPool, TokenAddress: tokens[selectorA].Address, @@ -34,11 +36,11 @@ func TestProposeAdminRoleChangeset_Validations(t *testing.T) { // We want an administrator to exist to force failure in the last test e, err := commonchangeset.Apply(t, e, timelockContracts, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.ProposeAdminRoleChangeset), + deployment.CreateLegacyChangeSet(v1_5_1.ProposeAdminRoleChangeset), changeset.TokenAdminRegistryChangesetConfig{ MCMS: mcmsConfig, Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - selectorA: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorA: { testhelpers.TestTokenSymbol: { Type: changeset.BurnMintTokenPool, Version: deployment.Version1_5_1, @@ -48,11 +50,11 @@ func TestProposeAdminRoleChangeset_Validations(t *testing.T) { }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.AcceptAdminRoleChangeset), + deployment.CreateLegacyChangeSet(v1_5_1.AcceptAdminRoleChangeset), changeset.TokenAdminRegistryChangesetConfig{ MCMS: mcmsConfig, Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - selectorA: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorA: { testhelpers.TestTokenSymbol: { Type: changeset.BurnMintTokenPool, Version: deployment.Version1_5_1, @@ -73,7 +75,7 @@ func TestProposeAdminRoleChangeset_Validations(t *testing.T) { Msg: "Chain selector is invalid", Config: changeset.TokenAdminRegistryChangesetConfig{ Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - 0: map[changeset.TokenSymbol]changeset.TokenPoolInfo{}, + 0: {}, }, }, ErrStr: "failed to validate chain selector 0", @@ -82,7 +84,7 @@ func TestProposeAdminRoleChangeset_Validations(t *testing.T) { Msg: "Chain selector doesn't exist in environment", Config: changeset.TokenAdminRegistryChangesetConfig{ Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - 5009297550715157269: map[changeset.TokenSymbol]changeset.TokenPoolInfo{}, + 5009297550715157269: {}, }, }, ErrStr: "does not exist in environment", @@ -91,7 +93,7 @@ func TestProposeAdminRoleChangeset_Validations(t *testing.T) { Msg: "Ownership validation failure", Config: changeset.TokenAdminRegistryChangesetConfig{ Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - selectorA: map[changeset.TokenSymbol]changeset.TokenPoolInfo{}, + selectorA: {}, }, }, ErrStr: "token admin registry failed ownership validation", @@ -101,7 +103,7 @@ func TestProposeAdminRoleChangeset_Validations(t *testing.T) { Config: changeset.TokenAdminRegistryChangesetConfig{ MCMS: mcmsConfig, Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - selectorA: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorA: { testhelpers.TestTokenSymbol: { Type: "InvalidType", Version: deployment.Version1_5_1, @@ -116,7 +118,7 @@ func TestProposeAdminRoleChangeset_Validations(t *testing.T) { Config: changeset.TokenAdminRegistryChangesetConfig{ MCMS: mcmsConfig, Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - selectorA: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorA: { testhelpers.TestTokenSymbol: { Type: changeset.BurnMintTokenPool, Version: deployment.Version1_0_0, @@ -131,7 +133,7 @@ func TestProposeAdminRoleChangeset_Validations(t *testing.T) { Config: changeset.TokenAdminRegistryChangesetConfig{ MCMS: mcmsConfig, Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - selectorA: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorA: { testhelpers.TestTokenSymbol: { Type: changeset.BurnMintTokenPool, Version: deployment.Version1_5_1, @@ -147,7 +149,7 @@ func TestProposeAdminRoleChangeset_Validations(t *testing.T) { t.Run(test.Msg, func(t *testing.T) { _, err = commonchangeset.Apply(t, e, timelockContracts, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.ProposeAdminRoleChangeset), + deployment.CreateLegacyChangeSet(v1_5_1.ProposeAdminRoleChangeset), test.Config, ), ) @@ -167,7 +169,7 @@ func TestProposeAdminRoleChangeset_ExecutionWithoutExternalAdmin(t *testing.T) { t.Run(msg, func(t *testing.T) { e, selectorA, selectorB, tokens, timelockContracts := testhelpers.SetupTwoChainEnvironmentWithTokens(t, logger.TestLogger(t), mcmsConfig != nil) - e = testhelpers.DeployTestTokenPools(t, e, map[uint64]changeset.DeployTokenPoolInput{ + e = testhelpers.DeployTestTokenPools(t, e, map[uint64]v1_5_1.DeployTokenPoolInput{ selectorA: { Type: changeset.BurnMintTokenPool, TokenAddress: tokens[selectorA].Address, @@ -188,17 +190,17 @@ func TestProposeAdminRoleChangeset_ExecutionWithoutExternalAdmin(t *testing.T) { e, err = commonchangeset.Apply(t, e, timelockContracts, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.ProposeAdminRoleChangeset), + deployment.CreateLegacyChangeSet(v1_5_1.ProposeAdminRoleChangeset), changeset.TokenAdminRegistryChangesetConfig{ MCMS: mcmsConfig, Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - selectorA: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorA: { testhelpers.TestTokenSymbol: { Type: changeset.BurnMintTokenPool, Version: deployment.Version1_5_1, }, }, - selectorB: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorB: { testhelpers.TestTokenSymbol: { Type: changeset.BurnMintTokenPool, Version: deployment.Version1_5_1, @@ -241,7 +243,7 @@ func TestProposeAdminRoleChangeset_ExecutionWithExternalAdmin(t *testing.T) { externalAdminA := utils.RandomAddress() externalAdminB := utils.RandomAddress() - e = testhelpers.DeployTestTokenPools(t, e, map[uint64]changeset.DeployTokenPoolInput{ + e = testhelpers.DeployTestTokenPools(t, e, map[uint64]v1_5_1.DeployTokenPoolInput{ selectorA: { Type: changeset.BurnMintTokenPool, TokenAddress: tokens[selectorA].Address, @@ -262,18 +264,18 @@ func TestProposeAdminRoleChangeset_ExecutionWithExternalAdmin(t *testing.T) { _, err = commonchangeset.Apply(t, e, timelockContracts, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.ProposeAdminRoleChangeset), + deployment.CreateLegacyChangeSet(v1_5_1.ProposeAdminRoleChangeset), changeset.TokenAdminRegistryChangesetConfig{ MCMS: mcmsConfig, Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - selectorA: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorA: { testhelpers.TestTokenSymbol: { Type: changeset.BurnMintTokenPool, Version: deployment.Version1_5_1, ExternalAdmin: externalAdminA, }, }, - selectorB: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorB: { testhelpers.TestTokenSymbol: { Type: changeset.BurnMintTokenPool, Version: deployment.Version1_5_1, diff --git a/deployment/ccip/changeset/cs_set_pool.go b/deployment/ccip/changeset/v1_5_1/cs_set_pool.go similarity index 78% rename from deployment/ccip/changeset/cs_set_pool.go rename to deployment/ccip/changeset/v1_5_1/cs_set_pool.go index 6e2f9feb755..fd72a9c9f26 100644 --- a/deployment/ccip/changeset/cs_set_pool.go +++ b/deployment/ccip/changeset/v1_5_1/cs_set_pool.go @@ -1,4 +1,4 @@ -package changeset +package v1_5_1 import ( "fmt" @@ -6,16 +6,17 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/smartcontractkit/chainlink/deployment" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/v1_5_0/token_admin_registry" ) -var _ deployment.ChangeSet[TokenAdminRegistryChangesetConfig] = SetPoolChangeset +var _ deployment.ChangeSet[changeset.TokenAdminRegistryChangesetConfig] = SetPoolChangeset func validateSetPool( config token_admin_registry.TokenAdminRegistryTokenConfig, sender common.Address, externalAdmin common.Address, - symbol TokenSymbol, + symbol changeset.TokenSymbol, chain deployment.Chain, ) error { // We must be the administrator @@ -26,16 +27,16 @@ func validateSetPool( } // SetPoolChangeset sets pools for tokens on the token admin registry. -func SetPoolChangeset(env deployment.Environment, c TokenAdminRegistryChangesetConfig) (deployment.ChangesetOutput, error) { +func SetPoolChangeset(env deployment.Environment, c changeset.TokenAdminRegistryChangesetConfig) (deployment.ChangesetOutput, error) { if err := c.Validate(env, false, validateSetPool); err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("invalid TokenAdminRegistryChangesetConfig: %w", err) } - state, err := LoadOnchainState(env) + state, err := changeset.LoadOnchainState(env) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to load onchain state: %w", err) } - deployerGroup := NewDeployerGroup(env, state, c.MCMS).WithDeploymentContext("set pool for tokens on token admin registries") + deployerGroup := changeset.NewDeployerGroup(env, state, c.MCMS).WithDeploymentContext("set pool for tokens on token admin registries") for chainSelector, tokenSymbolToPoolInfo := range c.Pools { chain := env.Chains[chainSelector] diff --git a/deployment/ccip/changeset/cs_set_pool_test.go b/deployment/ccip/changeset/v1_5_1/cs_set_pool_test.go similarity index 83% rename from deployment/ccip/changeset/cs_set_pool_test.go rename to deployment/ccip/changeset/v1_5_1/cs_set_pool_test.go index e19c15c4db5..04ffbda64ad 100644 --- a/deployment/ccip/changeset/cs_set_pool_test.go +++ b/deployment/ccip/changeset/v1_5_1/cs_set_pool_test.go @@ -1,4 +1,4 @@ -package changeset_test +package v1_5_1_test import ( "testing" @@ -9,6 +9,7 @@ import ( "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_5_1" commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset" "github.com/smartcontractkit/chainlink/v2/core/logger" ) @@ -18,7 +19,7 @@ func TestSetPoolChangeset_Validations(t *testing.T) { e, selectorA, _, tokens, timelockContracts := testhelpers.SetupTwoChainEnvironmentWithTokens(t, logger.TestLogger(t), true) - e = testhelpers.DeployTestTokenPools(t, e, map[uint64]changeset.DeployTokenPoolInput{ + e = testhelpers.DeployTestTokenPools(t, e, map[uint64]v1_5_1.DeployTokenPoolInput{ selectorA: { Type: changeset.BurnMintTokenPool, TokenAddress: tokens[selectorA].Address, @@ -39,7 +40,7 @@ func TestSetPoolChangeset_Validations(t *testing.T) { Msg: "Chain selector is invalid", Config: changeset.TokenAdminRegistryChangesetConfig{ Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - 0: map[changeset.TokenSymbol]changeset.TokenPoolInfo{}, + 0: {}, }, }, ErrStr: "failed to validate chain selector 0", @@ -48,7 +49,7 @@ func TestSetPoolChangeset_Validations(t *testing.T) { Msg: "Chain selector doesn't exist in environment", Config: changeset.TokenAdminRegistryChangesetConfig{ Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - 5009297550715157269: map[changeset.TokenSymbol]changeset.TokenPoolInfo{}, + 5009297550715157269: {}, }, }, ErrStr: "does not exist in environment", @@ -58,7 +59,7 @@ func TestSetPoolChangeset_Validations(t *testing.T) { Config: changeset.TokenAdminRegistryChangesetConfig{ MCMS: mcmsConfig, Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - selectorA: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorA: { testhelpers.TestTokenSymbol: { Type: "InvalidType", Version: deployment.Version1_5_1, @@ -73,7 +74,7 @@ func TestSetPoolChangeset_Validations(t *testing.T) { Config: changeset.TokenAdminRegistryChangesetConfig{ MCMS: mcmsConfig, Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - selectorA: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorA: { testhelpers.TestTokenSymbol: { Type: changeset.BurnMintTokenPool, Version: deployment.Version1_0_0, @@ -88,7 +89,7 @@ func TestSetPoolChangeset_Validations(t *testing.T) { Config: changeset.TokenAdminRegistryChangesetConfig{ MCMS: mcmsConfig, Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - selectorA: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorA: { testhelpers.TestTokenSymbol: { Type: changeset.BurnMintTokenPool, Version: deployment.Version1_5_1, @@ -104,7 +105,7 @@ func TestSetPoolChangeset_Validations(t *testing.T) { t.Run(test.Msg, func(t *testing.T) { _, err := commonchangeset.Apply(t, e, timelockContracts, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.SetPoolChangeset), + deployment.CreateLegacyChangeSet(v1_5_1.SetPoolChangeset), test.Config, ), ) @@ -124,7 +125,7 @@ func TestSetPoolChangeset_Execution(t *testing.T) { t.Run(msg, func(t *testing.T) { e, selectorA, selectorB, tokens, timelockContracts := testhelpers.SetupTwoChainEnvironmentWithTokens(t, logger.TestLogger(t), mcmsConfig != nil) - e = testhelpers.DeployTestTokenPools(t, e, map[uint64]changeset.DeployTokenPoolInput{ + e = testhelpers.DeployTestTokenPools(t, e, map[uint64]v1_5_1.DeployTokenPoolInput{ selectorA: { Type: changeset.BurnMintTokenPool, TokenAddress: tokens[selectorA].Address, @@ -145,17 +146,17 @@ func TestSetPoolChangeset_Execution(t *testing.T) { _, err = commonchangeset.Apply(t, e, timelockContracts, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.ProposeAdminRoleChangeset), + deployment.CreateLegacyChangeSet(v1_5_1.ProposeAdminRoleChangeset), changeset.TokenAdminRegistryChangesetConfig{ MCMS: mcmsConfig, Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - selectorA: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorA: { testhelpers.TestTokenSymbol: { Type: changeset.BurnMintTokenPool, Version: deployment.Version1_5_1, }, }, - selectorB: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorB: { testhelpers.TestTokenSymbol: { Type: changeset.BurnMintTokenPool, Version: deployment.Version1_5_1, @@ -165,17 +166,17 @@ func TestSetPoolChangeset_Execution(t *testing.T) { }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.AcceptAdminRoleChangeset), + deployment.CreateLegacyChangeSet(v1_5_1.AcceptAdminRoleChangeset), changeset.TokenAdminRegistryChangesetConfig{ MCMS: mcmsConfig, Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - selectorA: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorA: { testhelpers.TestTokenSymbol: { Type: changeset.BurnMintTokenPool, Version: deployment.Version1_5_1, }, }, - selectorB: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorB: { testhelpers.TestTokenSymbol: { Type: changeset.BurnMintTokenPool, Version: deployment.Version1_5_1, @@ -185,17 +186,17 @@ func TestSetPoolChangeset_Execution(t *testing.T) { }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.SetPoolChangeset), + deployment.CreateLegacyChangeSet(v1_5_1.SetPoolChangeset), changeset.TokenAdminRegistryChangesetConfig{ MCMS: mcmsConfig, Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - selectorA: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorA: { testhelpers.TestTokenSymbol: { Type: changeset.BurnMintTokenPool, Version: deployment.Version1_5_1, }, }, - selectorB: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorB: { testhelpers.TestTokenSymbol: { Type: changeset.BurnMintTokenPool, Version: deployment.Version1_5_1, diff --git a/deployment/ccip/changeset/cs_sync_usdc_domains_with_chains.go b/deployment/ccip/changeset/v1_5_1/cs_sync_usdc_domains_with_chains.go similarity index 94% rename from deployment/ccip/changeset/cs_sync_usdc_domains_with_chains.go rename to deployment/ccip/changeset/v1_5_1/cs_sync_usdc_domains_with_chains.go index 7203d6043bb..1783c9e75e7 100644 --- a/deployment/ccip/changeset/cs_sync_usdc_domains_with_chains.go +++ b/deployment/ccip/changeset/v1_5_1/cs_sync_usdc_domains_with_chains.go @@ -1,4 +1,4 @@ -package changeset +package v1_5_1 import ( "errors" @@ -9,6 +9,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/smartcontractkit/chainlink/deployment" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" commoncs "github.com/smartcontractkit/chainlink/deployment/common/changeset" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/v1_5_1/usdc_token_pool" ) @@ -22,10 +23,10 @@ type SyncUSDCDomainsWithChainsConfig struct { // ChainSelectorToUSDCDomain maps chains selectors to their USDC domain identifiers. ChainSelectorToUSDCDomain map[uint64]uint32 // MCMS defines the delay to use for Timelock (if absent, the changeset will attempt to use the deployer key). - MCMS *MCMSConfig + MCMS *changeset.MCMSConfig } -func (c SyncUSDCDomainsWithChainsConfig) Validate(env deployment.Environment, state CCIPOnChainState) error { +func (c SyncUSDCDomainsWithChainsConfig) Validate(env deployment.Environment, state changeset.CCIPOnChainState) error { ctx := env.GetContext() if c.ChainSelectorToUSDCDomain == nil { @@ -90,7 +91,7 @@ func (c SyncUSDCDomainsWithChainsConfig) Validate(env deployment.Environment, st // SyncUSDCDomainsWithChainsChangeset syncs domain support on specified USDC token pools with its chain support. // As such, it is expected that ConfigureTokenPoolContractsChangeset is executed before running this changeset. func SyncUSDCDomainsWithChainsChangeset(env deployment.Environment, c SyncUSDCDomainsWithChainsConfig) (deployment.ChangesetOutput, error) { - state, err := LoadOnchainState(env) + state, err := changeset.LoadOnchainState(env) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to load onchain state: %w", err) } @@ -99,7 +100,7 @@ func SyncUSDCDomainsWithChainsChangeset(env deployment.Environment, c SyncUSDCDo } readOpts := &bind.CallOpts{Context: env.GetContext()} - deployerGroup := NewDeployerGroup(env, state, c.MCMS).WithDeploymentContext("sync domain support with chain support on USDC token pools") + deployerGroup := changeset.NewDeployerGroup(env, state, c.MCMS).WithDeploymentContext("sync domain support with chain support on USDC token pools") for chainSelector, version := range c.USDCVersionByChain { chain := env.Chains[chainSelector] diff --git a/deployment/ccip/changeset/cs_sync_usdc_domains_with_chains_test.go b/deployment/ccip/changeset/v1_5_1/cs_sync_usdc_domains_with_chains_test.go similarity index 78% rename from deployment/ccip/changeset/cs_sync_usdc_domains_with_chains_test.go rename to deployment/ccip/changeset/v1_5_1/cs_sync_usdc_domains_with_chains_test.go index 53c589ec99b..bbbdc033310 100644 --- a/deployment/ccip/changeset/cs_sync_usdc_domains_with_chains_test.go +++ b/deployment/ccip/changeset/v1_5_1/cs_sync_usdc_domains_with_chains_test.go @@ -1,4 +1,4 @@ -package changeset_test +package v1_5_1_test import ( "testing" @@ -11,6 +11,7 @@ import ( "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_5_1" commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset" commoncs "github.com/smartcontractkit/chainlink/deployment/common/changeset" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" @@ -21,21 +22,21 @@ func TestValidateSyncUSDCDomainsWithChainsConfig(t *testing.T) { tests := []struct { Msg string - Input func(selector uint64) changeset.SyncUSDCDomainsWithChainsConfig + Input func(selector uint64) v1_5_1.SyncUSDCDomainsWithChainsConfig ErrStr string DeployUSDC bool }{ { Msg: "Domain mapping not defined", - Input: func(selector uint64) changeset.SyncUSDCDomainsWithChainsConfig { - return changeset.SyncUSDCDomainsWithChainsConfig{} + Input: func(selector uint64) v1_5_1.SyncUSDCDomainsWithChainsConfig { + return v1_5_1.SyncUSDCDomainsWithChainsConfig{} }, ErrStr: "chain selector to usdc domain must be defined", }, { Msg: "Chain selector is not valid", - Input: func(selector uint64) changeset.SyncUSDCDomainsWithChainsConfig { - return changeset.SyncUSDCDomainsWithChainsConfig{ + Input: func(selector uint64) v1_5_1.SyncUSDCDomainsWithChainsConfig { + return v1_5_1.SyncUSDCDomainsWithChainsConfig{ USDCVersionByChain: map[uint64]semver.Version{ 0: deployment.Version1_5_1, }, @@ -46,8 +47,8 @@ func TestValidateSyncUSDCDomainsWithChainsConfig(t *testing.T) { }, { Msg: "Chain selector doesn't exist in environment", - Input: func(selector uint64) changeset.SyncUSDCDomainsWithChainsConfig { - return changeset.SyncUSDCDomainsWithChainsConfig{ + Input: func(selector uint64) v1_5_1.SyncUSDCDomainsWithChainsConfig { + return v1_5_1.SyncUSDCDomainsWithChainsConfig{ USDCVersionByChain: map[uint64]semver.Version{ 5009297550715157269: deployment.Version1_5_1, }, @@ -57,8 +58,8 @@ func TestValidateSyncUSDCDomainsWithChainsConfig(t *testing.T) { ErrStr: "does not exist in environment", }, { - Input: func(selector uint64) changeset.SyncUSDCDomainsWithChainsConfig { - return changeset.SyncUSDCDomainsWithChainsConfig{ + Input: func(selector uint64) v1_5_1.SyncUSDCDomainsWithChainsConfig { + return v1_5_1.SyncUSDCDomainsWithChainsConfig{ USDCVersionByChain: map[uint64]semver.Version{ selector: deployment.Version1_5_1, }, @@ -69,8 +70,8 @@ func TestValidateSyncUSDCDomainsWithChainsConfig(t *testing.T) { }, { Msg: "No USDC token pool found with version", - Input: func(selector uint64) changeset.SyncUSDCDomainsWithChainsConfig { - return changeset.SyncUSDCDomainsWithChainsConfig{ + Input: func(selector uint64) v1_5_1.SyncUSDCDomainsWithChainsConfig { + return v1_5_1.SyncUSDCDomainsWithChainsConfig{ USDCVersionByChain: map[uint64]semver.Version{ selector: deployment.Version1_0_0, }, @@ -82,8 +83,8 @@ func TestValidateSyncUSDCDomainsWithChainsConfig(t *testing.T) { }, { Msg: "Not owned by expected owner", - Input: func(selector uint64) changeset.SyncUSDCDomainsWithChainsConfig { - return changeset.SyncUSDCDomainsWithChainsConfig{ + Input: func(selector uint64) v1_5_1.SyncUSDCDomainsWithChainsConfig { + return v1_5_1.SyncUSDCDomainsWithChainsConfig{ USDCVersionByChain: map[uint64]semver.Version{ selector: deployment.Version1_5_1, }, @@ -96,8 +97,8 @@ func TestValidateSyncUSDCDomainsWithChainsConfig(t *testing.T) { }, { Msg: "No domain ID found for selector", - Input: func(selector uint64) changeset.SyncUSDCDomainsWithChainsConfig { - return changeset.SyncUSDCDomainsWithChainsConfig{ + Input: func(selector uint64) v1_5_1.SyncUSDCDomainsWithChainsConfig { + return v1_5_1.SyncUSDCDomainsWithChainsConfig{ USDCVersionByChain: map[uint64]semver.Version{ selector: deployment.Version1_5_1, }, @@ -109,8 +110,8 @@ func TestValidateSyncUSDCDomainsWithChainsConfig(t *testing.T) { }, { Msg: "Missing USDC in input", - Input: func(selector uint64) changeset.SyncUSDCDomainsWithChainsConfig { - return changeset.SyncUSDCDomainsWithChainsConfig{ + Input: func(selector uint64) v1_5_1.SyncUSDCDomainsWithChainsConfig { + return v1_5_1.SyncUSDCDomainsWithChainsConfig{ USDCVersionByChain: map[uint64]semver.Version{}, ChainSelectorToUSDCDomain: map[uint64]uint32{}, } @@ -134,18 +135,18 @@ func TestValidateSyncUSDCDomainsWithChainsConfig(t *testing.T) { var err error e, err = commoncs.Apply(t, e, nil, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.ConfigureTokenPoolContractsChangeset), - changeset.ConfigureTokenPoolContractsConfig{ - PoolUpdates: map[uint64]changeset.TokenPoolConfig{ - selectors[0]: changeset.TokenPoolConfig{ - ChainUpdates: changeset.RateLimiterPerChain{ + deployment.CreateLegacyChangeSet(v1_5_1.ConfigureTokenPoolContractsChangeset), + v1_5_1.ConfigureTokenPoolContractsConfig{ + PoolUpdates: map[uint64]v1_5_1.TokenPoolConfig{ + selectors[0]: { + ChainUpdates: v1_5_1.RateLimiterPerChain{ selectors[1]: testhelpers.CreateSymmetricRateLimits(0, 0), }, Type: changeset.USDCTokenPool, Version: deployment.Version1_5_1, }, - selectors[1]: changeset.TokenPoolConfig{ - ChainUpdates: changeset.RateLimiterPerChain{ + selectors[1]: { + ChainUpdates: v1_5_1.RateLimiterPerChain{ selectors[0]: testhelpers.CreateSymmetricRateLimits(0, 0), }, Type: changeset.USDCTokenPool, @@ -217,19 +218,19 @@ func TestSyncUSDCDomainsWithChainsChangeset(t *testing.T) { e, err = commoncs.Apply(t, e, timelockContracts, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.ConfigureTokenPoolContractsChangeset), - changeset.ConfigureTokenPoolContractsConfig{ + deployment.CreateLegacyChangeSet(v1_5_1.ConfigureTokenPoolContractsChangeset), + v1_5_1.ConfigureTokenPoolContractsConfig{ MCMS: mcmsConfig, - PoolUpdates: map[uint64]changeset.TokenPoolConfig{ - selectors[0]: changeset.TokenPoolConfig{ - ChainUpdates: changeset.RateLimiterPerChain{ + PoolUpdates: map[uint64]v1_5_1.TokenPoolConfig{ + selectors[0]: { + ChainUpdates: v1_5_1.RateLimiterPerChain{ selectors[1]: testhelpers.CreateSymmetricRateLimits(0, 0), }, Type: changeset.USDCTokenPool, Version: deployment.Version1_5_1, }, - selectors[1]: changeset.TokenPoolConfig{ - ChainUpdates: changeset.RateLimiterPerChain{ + selectors[1]: { + ChainUpdates: v1_5_1.RateLimiterPerChain{ selectors[0]: testhelpers.CreateSymmetricRateLimits(0, 0), }, Type: changeset.USDCTokenPool, @@ -244,8 +245,8 @@ func TestSyncUSDCDomainsWithChainsChangeset(t *testing.T) { e, err = commoncs.Apply(t, e, timelockContracts, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.SyncUSDCDomainsWithChainsChangeset), - changeset.SyncUSDCDomainsWithChainsConfig{ + deployment.CreateLegacyChangeSet(v1_5_1.SyncUSDCDomainsWithChainsChangeset), + v1_5_1.SyncUSDCDomainsWithChainsConfig{ MCMS: mcmsConfig, USDCVersionByChain: map[uint64]semver.Version{ selectors[0]: deployment.Version1_5_1, @@ -285,7 +286,7 @@ func TestSyncUSDCDomainsWithChainsChangeset(t *testing.T) { } // Idempotency check - output, err := changeset.SyncUSDCDomainsWithChainsChangeset(e, changeset.SyncUSDCDomainsWithChainsConfig{ + output, err := v1_5_1.SyncUSDCDomainsWithChainsChangeset(e, v1_5_1.SyncUSDCDomainsWithChainsConfig{ MCMS: mcmsConfig, USDCVersionByChain: map[uint64]semver.Version{ selectors[0]: deployment.Version1_5_1, diff --git a/deployment/ccip/changeset/cs_transfer_admin_role.go b/deployment/ccip/changeset/v1_5_1/cs_transfer_admin_role.go similarity index 79% rename from deployment/ccip/changeset/cs_transfer_admin_role.go rename to deployment/ccip/changeset/v1_5_1/cs_transfer_admin_role.go index fe82d8d0d41..ffd34f43854 100644 --- a/deployment/ccip/changeset/cs_transfer_admin_role.go +++ b/deployment/ccip/changeset/v1_5_1/cs_transfer_admin_role.go @@ -1,4 +1,4 @@ -package changeset +package v1_5_1 import ( "errors" @@ -9,16 +9,17 @@ import ( "github.com/smartcontractkit/chainlink-integrations/evm/utils" "github.com/smartcontractkit/chainlink/deployment" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/v1_5_0/token_admin_registry" ) -var _ deployment.ChangeSet[TokenAdminRegistryChangesetConfig] = TransferAdminRoleChangeset +var _ deployment.ChangeSet[changeset.TokenAdminRegistryChangesetConfig] = TransferAdminRoleChangeset func validateTransferAdminRole( config token_admin_registry.TokenAdminRegistryTokenConfig, sender common.Address, externalAdmin common.Address, - symbol TokenSymbol, + symbol changeset.TokenSymbol, chain deployment.Chain, ) error { if externalAdmin == utils.ZeroAddress { @@ -32,16 +33,16 @@ func validateTransferAdminRole( } // TransferAdminRoleChangeset transfers the admin role for tokens on the token admin registry to 3rd parties. -func TransferAdminRoleChangeset(env deployment.Environment, c TokenAdminRegistryChangesetConfig) (deployment.ChangesetOutput, error) { +func TransferAdminRoleChangeset(env deployment.Environment, c changeset.TokenAdminRegistryChangesetConfig) (deployment.ChangesetOutput, error) { if err := c.Validate(env, false, validateTransferAdminRole); err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("invalid TokenAdminRegistryChangesetConfig: %w", err) } - state, err := LoadOnchainState(env) + state, err := changeset.LoadOnchainState(env) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to load onchain state: %w", err) } - deployerGroup := NewDeployerGroup(env, state, c.MCMS).WithDeploymentContext("transfer admin role for tokens on token admin registries") + deployerGroup := changeset.NewDeployerGroup(env, state, c.MCMS).WithDeploymentContext("transfer admin role for tokens on token admin registries") for chainSelector, tokenSymbolToPoolInfo := range c.Pools { chain := env.Chains[chainSelector] diff --git a/deployment/ccip/changeset/cs_transfer_admin_role_test.go b/deployment/ccip/changeset/v1_5_1/cs_transfer_admin_role_test.go similarity index 83% rename from deployment/ccip/changeset/cs_transfer_admin_role_test.go rename to deployment/ccip/changeset/v1_5_1/cs_transfer_admin_role_test.go index 8fca285acfd..cf9d22e6f53 100644 --- a/deployment/ccip/changeset/cs_transfer_admin_role_test.go +++ b/deployment/ccip/changeset/v1_5_1/cs_transfer_admin_role_test.go @@ -1,4 +1,4 @@ -package changeset_test +package v1_5_1_test import ( "testing" @@ -7,9 +7,11 @@ import ( "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink-integrations/evm/utils" + "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_5_1" commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset" "github.com/smartcontractkit/chainlink/v2/core/logger" ) @@ -19,7 +21,7 @@ func TestTransferAdminRoleChangeset_Validations(t *testing.T) { e, selectorA, _, tokens, timelockContracts := testhelpers.SetupTwoChainEnvironmentWithTokens(t, logger.TestLogger(t), true) - e = testhelpers.DeployTestTokenPools(t, e, map[uint64]changeset.DeployTokenPoolInput{ + e = testhelpers.DeployTestTokenPools(t, e, map[uint64]v1_5_1.DeployTokenPoolInput{ selectorA: { Type: changeset.BurnMintTokenPool, TokenAddress: tokens[selectorA].Address, @@ -40,7 +42,7 @@ func TestTransferAdminRoleChangeset_Validations(t *testing.T) { Msg: "Chain selector is invalid", Config: changeset.TokenAdminRegistryChangesetConfig{ Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - 0: map[changeset.TokenSymbol]changeset.TokenPoolInfo{}, + 0: {}, }, }, ErrStr: "failed to validate chain selector 0", @@ -49,7 +51,7 @@ func TestTransferAdminRoleChangeset_Validations(t *testing.T) { Msg: "Chain selector doesn't exist in environment", Config: changeset.TokenAdminRegistryChangesetConfig{ Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - 5009297550715157269: map[changeset.TokenSymbol]changeset.TokenPoolInfo{}, + 5009297550715157269: {}, }, }, ErrStr: "does not exist in environment", @@ -59,7 +61,7 @@ func TestTransferAdminRoleChangeset_Validations(t *testing.T) { Config: changeset.TokenAdminRegistryChangesetConfig{ MCMS: mcmsConfig, Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - selectorA: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorA: { testhelpers.TestTokenSymbol: { Type: "InvalidType", Version: deployment.Version1_5_1, @@ -74,7 +76,7 @@ func TestTransferAdminRoleChangeset_Validations(t *testing.T) { Config: changeset.TokenAdminRegistryChangesetConfig{ MCMS: mcmsConfig, Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - selectorA: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorA: { testhelpers.TestTokenSymbol: { Type: changeset.BurnMintTokenPool, Version: deployment.Version1_0_0, @@ -89,7 +91,7 @@ func TestTransferAdminRoleChangeset_Validations(t *testing.T) { Config: changeset.TokenAdminRegistryChangesetConfig{ MCMS: mcmsConfig, Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - selectorA: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorA: { testhelpers.TestTokenSymbol: { Type: changeset.BurnMintTokenPool, Version: deployment.Version1_5_1, @@ -104,7 +106,7 @@ func TestTransferAdminRoleChangeset_Validations(t *testing.T) { Config: changeset.TokenAdminRegistryChangesetConfig{ MCMS: mcmsConfig, Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - selectorA: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorA: { testhelpers.TestTokenSymbol: { Type: changeset.BurnMintTokenPool, Version: deployment.Version1_5_1, @@ -121,7 +123,7 @@ func TestTransferAdminRoleChangeset_Validations(t *testing.T) { t.Run(test.Msg, func(t *testing.T) { _, err := commonchangeset.Apply(t, e, timelockContracts, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.TransferAdminRoleChangeset), + deployment.CreateLegacyChangeSet(v1_5_1.TransferAdminRoleChangeset), test.Config, ), ) @@ -143,7 +145,7 @@ func TestTransferAdminRoleChangeset_Execution(t *testing.T) { externalAdminA := utils.RandomAddress() externalAdminB := utils.RandomAddress() - e = testhelpers.DeployTestTokenPools(t, e, map[uint64]changeset.DeployTokenPoolInput{ + e = testhelpers.DeployTestTokenPools(t, e, map[uint64]v1_5_1.DeployTokenPoolInput{ selectorA: { Type: changeset.BurnMintTokenPool, TokenAddress: tokens[selectorA].Address, @@ -164,17 +166,17 @@ func TestTransferAdminRoleChangeset_Execution(t *testing.T) { _, err = commonchangeset.Apply(t, e, timelockContracts, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.ProposeAdminRoleChangeset), + deployment.CreateLegacyChangeSet(v1_5_1.ProposeAdminRoleChangeset), changeset.TokenAdminRegistryChangesetConfig{ MCMS: mcmsConfig, Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - selectorA: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorA: { testhelpers.TestTokenSymbol: { Type: changeset.BurnMintTokenPool, Version: deployment.Version1_5_1, }, }, - selectorB: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorB: { testhelpers.TestTokenSymbol: { Type: changeset.BurnMintTokenPool, Version: deployment.Version1_5_1, @@ -184,17 +186,17 @@ func TestTransferAdminRoleChangeset_Execution(t *testing.T) { }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.AcceptAdminRoleChangeset), + deployment.CreateLegacyChangeSet(v1_5_1.AcceptAdminRoleChangeset), changeset.TokenAdminRegistryChangesetConfig{ MCMS: mcmsConfig, Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - selectorA: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorA: { testhelpers.TestTokenSymbol: { Type: changeset.BurnMintTokenPool, Version: deployment.Version1_5_1, }, }, - selectorB: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorB: { testhelpers.TestTokenSymbol: { Type: changeset.BurnMintTokenPool, Version: deployment.Version1_5_1, @@ -204,18 +206,18 @@ func TestTransferAdminRoleChangeset_Execution(t *testing.T) { }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.TransferAdminRoleChangeset), + deployment.CreateLegacyChangeSet(v1_5_1.TransferAdminRoleChangeset), changeset.TokenAdminRegistryChangesetConfig{ MCMS: mcmsConfig, Pools: map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo{ - selectorA: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorA: { testhelpers.TestTokenSymbol: { Type: changeset.BurnMintTokenPool, Version: deployment.Version1_5_1, ExternalAdmin: externalAdminA, }, }, - selectorB: map[changeset.TokenSymbol]changeset.TokenPoolInfo{ + selectorB: { testhelpers.TestTokenSymbol: { Type: changeset.BurnMintTokenPool, Version: deployment.Version1_5_1, diff --git a/deployment/ccip/changeset/accept_ownership_test.go b/deployment/ccip/changeset/v1_6/accept_ownership_test.go similarity index 98% rename from deployment/ccip/changeset/accept_ownership_test.go rename to deployment/ccip/changeset/v1_6/accept_ownership_test.go index 1cbb55ed1cc..5a9af9db1bc 100644 --- a/deployment/ccip/changeset/accept_ownership_test.go +++ b/deployment/ccip/changeset/v1_6/accept_ownership_test.go @@ -1,4 +1,4 @@ -package changeset_test +package v1_6_test import ( "testing" diff --git a/deployment/ccip/changeset/cs_active_candidate_test.go b/deployment/ccip/changeset/v1_6/cs_active_candidate_test.go similarity index 82% rename from deployment/ccip/changeset/cs_active_candidate_test.go rename to deployment/ccip/changeset/v1_6/cs_active_candidate_test.go index abf87355398..55326fd7111 100644 --- a/deployment/ccip/changeset/cs_active_candidate_test.go +++ b/deployment/ccip/changeset/v1_6/cs_active_candidate_test.go @@ -1,4 +1,4 @@ -package changeset_test +package v1_6_test import ( "math/big" @@ -9,9 +9,11 @@ import ( "golang.org/x/exp/maps" "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/testcontext" - "github.com/smartcontractkit/chainlink/deployment" + "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_6" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/internal" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers" commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset" @@ -44,9 +46,9 @@ func Test_ActiveCandidate(t *testing.T) { sourceState := state.Chains[source] tenv.Env, err = commonchangeset.Apply(t, tenv.Env, tenv.TimelockContracts(t), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateOnRampsDestsChangeset), - changeset.UpdateOnRampDestsConfig{ - UpdatesByChain: map[uint64]map[uint64]changeset.OnRampDestinationUpdate{ + deployment.CreateLegacyChangeSet(v1_6.UpdateOnRampsDestsChangeset), + v1_6.UpdateOnRampDestsConfig{ + UpdatesByChain: map[uint64]map[uint64]v1_6.OnRampDestinationUpdate{ source: { dest: { IsEnabled: true, @@ -57,9 +59,9 @@ func Test_ActiveCandidate(t *testing.T) { }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateFeeQuoterPricesChangeset), - changeset.UpdateFeeQuoterPricesConfig{ - PricesByChain: map[uint64]changeset.FeeQuoterPriceUpdatePerSource{ + deployment.CreateLegacyChangeSet(v1_6.UpdateFeeQuoterPricesChangeset), + v1_6.UpdateFeeQuoterPricesConfig{ + PricesByChain: map[uint64]v1_6.FeeQuoterPriceUpdatePerSource{ source: { TokenPrices: map[common.Address]*big.Int{ sourceState.LinkToken.Address(): testhelpers.DefaultLinkPrice, @@ -73,19 +75,19 @@ func Test_ActiveCandidate(t *testing.T) { }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateFeeQuoterDestsChangeset), - changeset.UpdateFeeQuoterDestsConfig{ + deployment.CreateLegacyChangeSet(v1_6.UpdateFeeQuoterDestsChangeset), + v1_6.UpdateFeeQuoterDestsConfig{ UpdatesByChain: map[uint64]map[uint64]fee_quoter.FeeQuoterDestChainConfig{ source: { - dest: changeset.DefaultFeeQuoterDestChainConfig(true), + dest: v1_6.DefaultFeeQuoterDestChainConfig(true), }, }, }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateOffRampSourcesChangeset), - changeset.UpdateOffRampSourcesConfig{ - UpdatesByChain: map[uint64]map[uint64]changeset.OffRampSourceUpdate{ + deployment.CreateLegacyChangeSet(v1_6.UpdateOffRampSourcesChangeset), + v1_6.UpdateOffRampSourcesConfig{ + UpdatesByChain: map[uint64]map[uint64]v1_6.OffRampSourceUpdate{ dest: { source: { IsEnabled: true, @@ -96,9 +98,9 @@ func Test_ActiveCandidate(t *testing.T) { }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateRouterRampsChangeset), - changeset.UpdateRouterRampsConfig{ - UpdatesByChain: map[uint64]changeset.RouterUpdates{ + deployment.CreateLegacyChangeSet(v1_6.UpdateRouterRampsChangeset), + v1_6.UpdateRouterRampsConfig{ + UpdatesByChain: map[uint64]v1_6.RouterUpdates{ // onRamp update on source chain source: { OnRampUpdates: map[uint64]bool{ @@ -195,21 +197,21 @@ func Test_ActiveCandidate(t *testing.T) { tokenConfig := changeset.NewTestTokenConfig(state.Chains[tenv.FeedChainSel].USDFeeds) _, err = commonchangeset.Apply(t, tenv.Env, tenv.TimelockContracts(t), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.SetCandidateChangeset), - changeset.SetCandidateChangesetConfig{ - SetCandidateConfigBase: changeset.SetCandidateConfigBase{ + deployment.CreateLegacyChangeSet(v1_6.SetCandidateChangeset), + v1_6.SetCandidateChangesetConfig{ + SetCandidateConfigBase: v1_6.SetCandidateConfigBase{ HomeChainSelector: tenv.HomeChainSel, FeedChainSelector: tenv.FeedChainSel, MCMS: &changeset.MCMSConfig{ MinDelay: 0, }, }, - PluginInfo: []changeset.SetCandidatePluginInfo{ + PluginInfo: []v1_6.SetCandidatePluginInfo{ { // NOTE: this is technically not a new chain, but needed for validation. - OCRConfigPerRemoteChainSelector: map[uint64]changeset.CCIPOCRParams{ - dest: changeset.DeriveCCIPOCRParams( - changeset.WithDefaultCommitOffChainConfig(tenv.FeedChainSel, + OCRConfigPerRemoteChainSelector: map[uint64]v1_6.CCIPOCRParams{ + dest: v1_6.DeriveCCIPOCRParams( + v1_6.WithDefaultCommitOffChainConfig(tenv.FeedChainSel, tokenConfig.GetTokenInfo(logger.TestLogger(t), state.Chains[dest].LinkToken.Address(), state.Chains[dest].Weth9.Address())), @@ -219,9 +221,9 @@ func Test_ActiveCandidate(t *testing.T) { }, { // NOTE: this is technically not a new chain, but needed for validation. - OCRConfigPerRemoteChainSelector: map[uint64]changeset.CCIPOCRParams{ - dest: changeset.DeriveCCIPOCRParams( - changeset.WithDefaultExecuteOffChainConfig(nil), + OCRConfigPerRemoteChainSelector: map[uint64]v1_6.CCIPOCRParams{ + dest: v1_6.DeriveCCIPOCRParams( + v1_6.WithDefaultExecuteOffChainConfig(nil), ), }, PluginType: types.PluginTypeCCIPExec, diff --git a/deployment/ccip/changeset/cs_add_lane_test.go b/deployment/ccip/changeset/v1_6/cs_add_lane_test.go similarity index 99% rename from deployment/ccip/changeset/cs_add_lane_test.go rename to deployment/ccip/changeset/v1_6/cs_add_lane_test.go index 8f395ea0ec9..175a16e9c31 100644 --- a/deployment/ccip/changeset/cs_add_lane_test.go +++ b/deployment/ccip/changeset/v1_6/cs_add_lane_test.go @@ -1,4 +1,4 @@ -package changeset_test +package v1_6_test import ( "testing" diff --git a/deployment/ccip/changeset/cs_ccip_home.go b/deployment/ccip/changeset/v1_6/cs_ccip_home.go similarity index 96% rename from deployment/ccip/changeset/cs_ccip_home.go rename to deployment/ccip/changeset/v1_6/cs_ccip_home.go index ccf937e4906..bec314b4518 100644 --- a/deployment/ccip/changeset/cs_ccip_home.go +++ b/deployment/ccip/changeset/v1_6/cs_ccip_home.go @@ -1,4 +1,4 @@ -package changeset +package v1_6 import ( "bytes" @@ -26,6 +26,7 @@ import ( "github.com/smartcontractkit/chainlink-ccip/pluginconfig" "github.com/smartcontractkit/chainlink/deployment" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/globals" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/internal" commoncs "github.com/smartcontractkit/chainlink/deployment/common/changeset" @@ -45,7 +46,7 @@ var ( _ deployment.ChangeSet[UpdateChainConfigConfig] = UpdateChainConfigChangeset ) -func findTokenInfo(tokens []TokenDetails, address common.Address) (string, uint8, error) { +func findTokenInfo(tokens []changeset.TokenDetails, address common.Address) (string, uint8, error) { for _, token := range tokens { if token.Address() == address { tokenSymbol, err := token.Symbol(nil) @@ -62,12 +63,12 @@ func findTokenInfo(tokens []TokenDetails, address common.Address) (string, uint8 return "", 0, fmt.Errorf("token %s not found in available tokens", address) } -func validateExecOffchainConfig(e deployment.Environment, c *pluginconfig.ExecuteOffchainConfig, selector uint64, state CCIPOnChainState) error { +func validateExecOffchainConfig(e deployment.Environment, c *pluginconfig.ExecuteOffchainConfig, selector uint64, state changeset.CCIPOnChainState) error { if err := c.Validate(); err != nil { return fmt.Errorf("invalid execute off-chain config: %w", err) } // get offRamp - if err := state.ValidateRamp(selector, OffRamp); err != nil { + if err := state.ValidateRamp(selector, changeset.OffRamp); err != nil { return fmt.Errorf("validate offRamp: %w", err) } permissionLessExecutionThresholdSeconds, err := state.OffRampPermissionLessExecutionThresholdSeconds(e.GetContext(), e, selector) @@ -91,7 +92,7 @@ func validateExecOffchainConfig(e deployment.Environment, c *pluginconfig.Execut return nil } -func validateCommitOffchainConfig(c *pluginconfig.CommitOffchainConfig, selector uint64, feedChainSel uint64, state CCIPOnChainState) error { +func validateCommitOffchainConfig(c *pluginconfig.CommitOffchainConfig, selector uint64, feedChainSel uint64, state changeset.CCIPOnChainState) error { if err := c.Validate(); err != nil { return fmt.Errorf("invalid commit off-chain config: %w", err) } @@ -103,7 +104,7 @@ func validateCommitOffchainConfig(c *pluginconfig.CommitOffchainConfig, selector aggregatorAddr := common.HexToAddress(string(tokenConfig.AggregatorAddress)) token := common.HexToAddress(tokenUnknownAddr.String()) - tokenInfos := make([]TokenDetails, 0) + tokenInfos := make([]changeset.TokenDetails, 0) onchainState := state.Chains[selector] for _, tk := range onchainState.BurnMintTokens677 { tokenInfos = append(tokenInfos, tk) @@ -114,7 +115,7 @@ func validateCommitOffchainConfig(c *pluginconfig.CommitOffchainConfig, selector for _, tk := range onchainState.ERC677Tokens { tokenInfos = append(tokenInfos, tk) } - var linkTokenInfo TokenDetails + var linkTokenInfo changeset.TokenDetails linkTokenInfo = onchainState.LinkToken if onchainState.LinkToken == nil { linkTokenInfo = onchainState.StaticLinkToken @@ -130,7 +131,7 @@ func validateCommitOffchainConfig(c *pluginconfig.CommitOffchainConfig, selector symbol, token.String(), tokenConfig.Decimals, decimal) } feedChainState := state.Chains[feedChainSel] - aggregatorInState := feedChainState.USDFeeds[TokenSymbol(symbol)] + aggregatorInState := feedChainState.USDFeeds[changeset.TokenSymbol(symbol)] if aggregatorAddr == (common.Address{}) { return fmt.Errorf("token %s -address %s has no aggregator in provided token config", symbol, token.String()) } @@ -146,7 +147,7 @@ func validateCommitOffchainConfig(c *pluginconfig.CommitOffchainConfig, selector return nil } -func validateUSDCConfig(usdcConfig *pluginconfig.USDCCCTPObserverConfig, state CCIPOnChainState) error { +func validateUSDCConfig(usdcConfig *pluginconfig.USDCCCTPObserverConfig, state changeset.CCIPOnChainState) error { for sel, token := range usdcConfig.Tokens { onchainState, ok := state.Chains[uint64(sel)] if !ok { @@ -172,7 +173,7 @@ type CCIPOCRParams struct { ExecuteOffChainConfig *pluginconfig.ExecuteOffchainConfig } -func (c CCIPOCRParams) Validate(e deployment.Environment, selector uint64, feedChainSel uint64, state CCIPOnChainState) error { +func (c CCIPOCRParams) Validate(e deployment.Environment, selector uint64, feedChainSel uint64, state changeset.CCIPOnChainState) error { if err := c.OCRParameters.Validate(); err != nil { return fmt.Errorf("invalid OCR parameters: %w", err) } @@ -293,11 +294,11 @@ type PromoteCandidateChangesetConfig struct { // MCMS is optional MCMS configuration, if provided the changeset will generate an MCMS proposal. // If nil, the changeset will execute the commands directly using the deployer key // of the provided environment. - MCMS *MCMSConfig + MCMS *changeset.MCMSConfig } func (p PromoteCandidateChangesetConfig) Validate(e deployment.Environment) (map[uint64]uint32, error) { - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return nil, err } @@ -322,7 +323,7 @@ func (p PromoteCandidateChangesetConfig) Validate(e deployment.Environment) (map if err := deployment.IsValidChainSelector(chainSelector); err != nil { return nil, fmt.Errorf("don chain selector invalid: %w", err) } - if err := state.ValidateRamp(chainSelector, OffRamp); err != nil { + if err := state.ValidateRamp(chainSelector, changeset.OffRamp); err != nil { return nil, err } @@ -386,7 +387,7 @@ func PromoteCandidateChangeset( if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("%w: %w", deployment.ErrInvalidConfig, err) } - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return deployment.ChangesetOutput{}, err } @@ -461,7 +462,7 @@ func (p SetCandidatePluginInfo) String() string { return fmt.Sprintf("PluginType: %s, Chains: %v", p.PluginType.String(), allchains) } -func (p SetCandidatePluginInfo) Validate(e deployment.Environment, state CCIPOnChainState, homeChain uint64, feedChain uint64) error { +func (p SetCandidatePluginInfo) Validate(e deployment.Environment, state changeset.CCIPOnChainState, homeChain uint64, feedChain uint64) error { if p.PluginType != types.PluginTypeCCIPCommit && p.PluginType != types.PluginTypeCCIPExec { return errors.New("PluginType must be set to either CCIPCommit or CCIPExec") @@ -473,7 +474,7 @@ func (p SetCandidatePluginInfo) Validate(e deployment.Environment, state CCIPOnC if err := deployment.IsValidChainSelector(chainSelector); err != nil { return fmt.Errorf("don chain selector invalid: %w", err) } - if err := state.ValidateRamp(chainSelector, OffRamp); err != nil { + if err := state.ValidateRamp(chainSelector, changeset.OffRamp); err != nil { return err } if p.PluginType == types.PluginTypeCCIPCommit && params.CommitOffChainConfig == nil { @@ -519,10 +520,10 @@ type SetCandidateConfigBase struct { // MCMS is optional MCMS configuration, if provided the changeset will generate an MCMS proposal. // If nil, the changeset will execute the commands directly using the deployer key // of the provided environment. - MCMS *MCMSConfig + MCMS *changeset.MCMSConfig } -func (s SetCandidateConfigBase) Validate(e deployment.Environment, state CCIPOnChainState) error { +func (s SetCandidateConfigBase) Validate(e deployment.Environment, state changeset.CCIPOnChainState) error { if err := deployment.IsValidChainSelector(s.HomeChainSelector); err != nil { return fmt.Errorf("home chain selector invalid: %w", err) } @@ -565,7 +566,7 @@ type AddDonAndSetCandidateChangesetConfig struct { PluginInfo SetCandidatePluginInfo } -func (a AddDonAndSetCandidateChangesetConfig) Validate(e deployment.Environment, state CCIPOnChainState) error { +func (a AddDonAndSetCandidateChangesetConfig) Validate(e deployment.Environment, state changeset.CCIPOnChainState) error { if err := a.SetCandidateConfigBase.Validate(e, state); err != nil { return err } @@ -608,7 +609,7 @@ func AddDonAndSetCandidateChangeset( e deployment.Environment, cfg AddDonAndSetCandidateChangesetConfig, ) (deployment.ChangesetOutput, error) { - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return deployment.ChangesetOutput{}, err } @@ -749,7 +750,7 @@ func newDonWithCandidateOp( } tx, err := proposalutils.TransactionForChain(homeChain.Selector, capReg.Address().Hex(), addDonTx.Data(), - big.NewInt(0), string(CapabilitiesRegistry), []string{}) + big.NewInt(0), string(changeset.CapabilitiesRegistry), []string{}) if err != nil { return mcmstypes.Transaction{}, fmt.Errorf("failed to create AddDON mcms tx (don: %d; ptype: %s): %w", donID, types.PluginType(pluginConfig.PluginType).String(), err) @@ -764,7 +765,7 @@ type SetCandidateChangesetConfig struct { PluginInfo []SetCandidatePluginInfo } -func (s SetCandidateChangesetConfig) Validate(e deployment.Environment, state CCIPOnChainState) (map[uint64]uint32, error) { +func (s SetCandidateChangesetConfig) Validate(e deployment.Environment, state changeset.CCIPOnChainState) (map[uint64]uint32, error) { err := s.SetCandidateConfigBase.Validate(e, state) if err != nil { return nil, err @@ -800,7 +801,7 @@ func SetCandidateChangeset( e deployment.Environment, cfg SetCandidateChangesetConfig, ) (deployment.ChangesetOutput, error) { - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return deployment.ChangesetOutput{}, err } @@ -942,7 +943,7 @@ func setCandidateOnExistingDon( donID, types.PluginType(pluginConfig.PluginType).String(), err) } - tx, err := proposalutils.TransactionForChain(homeChain.Selector, capReg.Address().Hex(), updateDonTx.Data(), big.NewInt(0), string(CapabilitiesRegistry), []string{}) + tx, err := proposalutils.TransactionForChain(homeChain.Selector, capReg.Address().Hex(), updateDonTx.Data(), big.NewInt(0), string(changeset.CapabilitiesRegistry), []string{}) if err != nil { return nil, fmt.Errorf("failed to create UpdateDON mcms tx in set candidate (don: %d; ptype: %s): %w", donID, types.PluginType(pluginConfig.PluginType).String(), err) @@ -1006,7 +1007,7 @@ func promoteCandidateOp( } tx, err := proposalutils.TransactionForChain(homeChain.Selector, capReg.Address().Hex(), updateDonTx.Data(), - big.NewInt(0), string(CapabilitiesRegistry), []string{}) + big.NewInt(0), string(changeset.CapabilitiesRegistry), []string{}) if err != nil { return mcmstypes.Transaction{}, fmt.Errorf("failed to create UpdateDON mcms tx in promote candidate (don: %d; ptype: %s): %w", donID, types.PluginType(pluginType).String(), err) @@ -1064,10 +1065,10 @@ type RevokeCandidateChangesetConfig struct { // MCMS is optional MCMS configuration, if provided the changeset will generate an MCMS proposal. // If nil, the changeset will execute the commands directly using the deployer key // of the provided environment. - MCMS *MCMSConfig + MCMS *changeset.MCMSConfig } -func (r RevokeCandidateChangesetConfig) Validate(e deployment.Environment, state CCIPOnChainState) (donID uint32, err error) { +func (r RevokeCandidateChangesetConfig) Validate(e deployment.Environment, state changeset.CCIPOnChainState) (donID uint32, err error) { if err := deployment.IsValidChainSelector(r.HomeChainSelector); err != nil { return 0, fmt.Errorf("home chain selector invalid: %w", err) } @@ -1117,7 +1118,7 @@ func (r RevokeCandidateChangesetConfig) Validate(e deployment.Environment, state } func RevokeCandidateChangeset(e deployment.Environment, cfg RevokeCandidateChangesetConfig) (deployment.ChangesetOutput, error) { - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return deployment.ChangesetOutput{}, err } @@ -1234,7 +1235,7 @@ func revokeCandidateOps( } tx, err := proposalutils.TransactionForChain(homeChain.Selector, capReg.Address().Hex(), updateDonTx.Data(), - big.NewInt(0), string(CapabilitiesRegistry), []string{}) + big.NewInt(0), string(changeset.CapabilitiesRegistry), []string{}) if err != nil { return nil, fmt.Errorf("failed to create UpdateDON mcms tx in revoke candidate (don: %d; ptype: %s): %w", donID, types.PluginType(pluginType).String(), err) @@ -1253,11 +1254,11 @@ type UpdateChainConfigConfig struct { HomeChainSelector uint64 RemoteChainRemoves []uint64 RemoteChainAdds map[uint64]ChainConfig - MCMS *MCMSConfig + MCMS *changeset.MCMSConfig } func (c UpdateChainConfigConfig) Validate(e deployment.Environment) error { - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return err } @@ -1306,7 +1307,7 @@ func UpdateChainConfigChangeset(e deployment.Environment, cfg UpdateChainConfigC if err := cfg.Validate(e); err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("%w: %w", deployment.ErrInvalidConfig, err) } - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return deployment.ChangesetOutput{}, err } @@ -1361,7 +1362,7 @@ func UpdateChainConfigChangeset(e deployment.Environment, cfg UpdateChainConfigC proposers := map[uint64]string{cfg.HomeChainSelector: state.Chains[cfg.HomeChainSelector].ProposerMcm.Address().Hex()} inspectors := map[uint64]mcmssdk.Inspector{cfg.HomeChainSelector: mcmsevmsdk.NewInspector(e.Chains[cfg.HomeChainSelector].Client)} batchOp, err := proposalutils.BatchOperationForChain(cfg.HomeChainSelector, state.Chains[cfg.HomeChainSelector].CCIPHome.Address().Hex(), - tx.Data(), big.NewInt(0), string(CCIPHome), []string{}) + tx.Data(), big.NewInt(0), string(changeset.CCIPHome), []string{}) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to create batch operation: %w", err) } diff --git a/deployment/ccip/changeset/cs_ccip_home_test.go b/deployment/ccip/changeset/v1_6/cs_ccip_home_test.go similarity index 85% rename from deployment/ccip/changeset/cs_ccip_home_test.go rename to deployment/ccip/changeset/v1_6/cs_ccip_home_test.go index 9a2fbd49e36..254c69e37c1 100644 --- a/deployment/ccip/changeset/cs_ccip_home_test.go +++ b/deployment/ccip/changeset/v1_6/cs_ccip_home_test.go @@ -1,4 +1,4 @@ -package changeset_test +package v1_6_test import ( "math/big" @@ -21,6 +21,7 @@ import ( "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/globals" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/internal" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_6" "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/types" "github.com/smartcontractkit/chainlink/v2/core/logger" @@ -40,8 +41,8 @@ func TestInvalidOCR3Params(t *testing.T) { // no proposals to be made, timelock can be passed as nil here e.Env, err = commonchangeset.Apply(t, e.Env, nil, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.DeployHomeChainChangeset), - changeset.DeployHomeChainConfig{ + deployment.CreateLegacyChangeSet(v1_6.DeployHomeChainChangeset), + v1_6.DeployHomeChainConfig{ HomeChainSel: e.HomeChainSel, RMNDynamicConfig: testhelpers.NewTestRMNDynamicConfig(), RMNStaticConfig: testhelpers.NewTestRMNStaticConfig(), @@ -52,13 +53,13 @@ func TestInvalidOCR3Params(t *testing.T) { }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.DeployChainContractsChangeset), - changeset.DeployChainContractsConfig{ + deployment.CreateLegacyChangeSet(v1_6.DeployChainContractsChangeset), + v1_6.DeployChainContractsConfig{ HomeChainSelector: e.HomeChainSel, - ContractParamsPerChain: map[uint64]changeset.ChainContractParams{ + ContractParamsPerChain: map[uint64]v1_6.ChainContractParams{ chain1: { - FeeQuoterParams: changeset.DefaultFeeQuoterParams(), - OffRampParams: changeset.DefaultOffRampParams(), + FeeQuoterParams: v1_6.DefaultFeeQuoterParams(), + OffRampParams: v1_6.DefaultOffRampParams(), }, }, }, @@ -70,9 +71,9 @@ func TestInvalidOCR3Params(t *testing.T) { require.NoError(t, err) nodes, err := deployment.NodeInfo(e.Env.NodeIDs, e.Env.Offchain) require.NoError(t, err) - params := changeset.DeriveCCIPOCRParams( - changeset.WithDefaultCommitOffChainConfig(e.FeedChainSel, nil), - changeset.WithDefaultExecuteOffChainConfig(nil), + params := v1_6.DeriveCCIPOCRParams( + v1_6.WithDefaultCommitOffChainConfig(e.FeedChainSel, nil), + v1_6.WithDefaultExecuteOffChainConfig(nil), ) // tweak params to have invalid config // make DeltaRound greater than DeltaProgress @@ -161,10 +162,10 @@ func Test_PromoteCandidate(t *testing.T) { }, }, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.PromoteCandidateChangeset), - changeset.PromoteCandidateChangesetConfig{ + deployment.CreateLegacyChangeSet(v1_6.PromoteCandidateChangeset), + v1_6.PromoteCandidateChangesetConfig{ HomeChainSelector: tenv.HomeChainSel, - PluginInfo: []changeset.PromoteCandidatePluginInfo{ + PluginInfo: []v1_6.PromoteCandidatePluginInfo{ { RemoteChainSelectors: []uint64{dest}, PluginType: types.PluginTypeCCIPCommit, @@ -259,18 +260,18 @@ func Test_SetCandidate(t *testing.T) { }, }, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.SetCandidateChangeset), - changeset.SetCandidateChangesetConfig{ - SetCandidateConfigBase: changeset.SetCandidateConfigBase{ + deployment.CreateLegacyChangeSet(v1_6.SetCandidateChangeset), + v1_6.SetCandidateChangesetConfig{ + SetCandidateConfigBase: v1_6.SetCandidateConfigBase{ HomeChainSelector: tenv.HomeChainSel, FeedChainSelector: tenv.FeedChainSel, MCMS: mcmsConfig, }, - PluginInfo: []changeset.SetCandidatePluginInfo{ + PluginInfo: []v1_6.SetCandidatePluginInfo{ { - OCRConfigPerRemoteChainSelector: map[uint64]changeset.CCIPOCRParams{ - dest: changeset.DeriveCCIPOCRParams( - changeset.WithDefaultCommitOffChainConfig( + OCRConfigPerRemoteChainSelector: map[uint64]v1_6.CCIPOCRParams{ + dest: v1_6.DeriveCCIPOCRParams( + v1_6.WithDefaultCommitOffChainConfig( tenv.FeedChainSel, tokenConfig.GetTokenInfo(logger.TestLogger(t), state.Chains[dest].LinkToken.Address(), @@ -280,11 +281,11 @@ func Test_SetCandidate(t *testing.T) { PluginType: types.PluginTypeCCIPCommit, }, { - OCRConfigPerRemoteChainSelector: map[uint64]changeset.CCIPOCRParams{ - dest: changeset.DeriveCCIPOCRParams( - changeset.WithDefaultExecuteOffChainConfig(nil), + OCRConfigPerRemoteChainSelector: map[uint64]v1_6.CCIPOCRParams{ + dest: v1_6.DeriveCCIPOCRParams( + v1_6.WithDefaultExecuteOffChainConfig(nil), // change the default config to make MessageVisibilityInterval != PermissionLessExecutionThresholdSeconds - changeset.WithOCRParamOverride(func(params *changeset.CCIPOCRParams) { + v1_6.WithOCRParamOverride(func(params *v1_6.CCIPOCRParams) { dCfg, err := state.Chains[dest].OffRamp.GetDynamicConfig(&bind.CallOpts{ Context: ctx, }) @@ -313,18 +314,18 @@ func Test_SetCandidate(t *testing.T) { }, }, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.SetCandidateChangeset), - changeset.SetCandidateChangesetConfig{ - SetCandidateConfigBase: changeset.SetCandidateConfigBase{ + deployment.CreateLegacyChangeSet(v1_6.SetCandidateChangeset), + v1_6.SetCandidateChangesetConfig{ + SetCandidateConfigBase: v1_6.SetCandidateConfigBase{ HomeChainSelector: tenv.HomeChainSel, FeedChainSelector: tenv.FeedChainSel, MCMS: mcmsConfig, }, - PluginInfo: []changeset.SetCandidatePluginInfo{ + PluginInfo: []v1_6.SetCandidatePluginInfo{ { - OCRConfigPerRemoteChainSelector: map[uint64]changeset.CCIPOCRParams{ - dest: changeset.DeriveCCIPOCRParams( - changeset.WithDefaultCommitOffChainConfig( + OCRConfigPerRemoteChainSelector: map[uint64]v1_6.CCIPOCRParams{ + dest: v1_6.DeriveCCIPOCRParams( + v1_6.WithDefaultCommitOffChainConfig( tenv.FeedChainSel, tokenConfig.GetTokenInfo(logger.TestLogger(t), state.Chains[dest].LinkToken.Address(), @@ -334,9 +335,9 @@ func Test_SetCandidate(t *testing.T) { PluginType: types.PluginTypeCCIPCommit, }, { - OCRConfigPerRemoteChainSelector: map[uint64]changeset.CCIPOCRParams{ - dest: changeset.DeriveCCIPOCRParams( - changeset.WithDefaultExecuteOffChainConfig(nil), + OCRConfigPerRemoteChainSelector: map[uint64]v1_6.CCIPOCRParams{ + dest: v1_6.DeriveCCIPOCRParams( + v1_6.WithDefaultExecuteOffChainConfig(nil), ), }, PluginType: types.PluginTypeCCIPExec, @@ -430,18 +431,18 @@ func Test_RevokeCandidate(t *testing.T) { }, }, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.SetCandidateChangeset), - changeset.SetCandidateChangesetConfig{ - SetCandidateConfigBase: changeset.SetCandidateConfigBase{ + deployment.CreateLegacyChangeSet(v1_6.SetCandidateChangeset), + v1_6.SetCandidateChangesetConfig{ + SetCandidateConfigBase: v1_6.SetCandidateConfigBase{ HomeChainSelector: tenv.HomeChainSel, FeedChainSelector: tenv.FeedChainSel, MCMS: mcmsConfig, }, - PluginInfo: []changeset.SetCandidatePluginInfo{ + PluginInfo: []v1_6.SetCandidatePluginInfo{ { - OCRConfigPerRemoteChainSelector: map[uint64]changeset.CCIPOCRParams{ - dest: changeset.DeriveCCIPOCRParams( - changeset.WithDefaultCommitOffChainConfig( + OCRConfigPerRemoteChainSelector: map[uint64]v1_6.CCIPOCRParams{ + dest: v1_6.DeriveCCIPOCRParams( + v1_6.WithDefaultCommitOffChainConfig( tenv.FeedChainSel, tokenConfig.GetTokenInfo(logger.TestLogger(t), state.Chains[dest].LinkToken.Address(), @@ -451,9 +452,9 @@ func Test_RevokeCandidate(t *testing.T) { PluginType: types.PluginTypeCCIPCommit, }, { - OCRConfigPerRemoteChainSelector: map[uint64]changeset.CCIPOCRParams{ - dest: changeset.DeriveCCIPOCRParams( - changeset.WithDefaultExecuteOffChainConfig(nil), + OCRConfigPerRemoteChainSelector: map[uint64]v1_6.CCIPOCRParams{ + dest: v1_6.DeriveCCIPOCRParams( + v1_6.WithDefaultExecuteOffChainConfig(nil), ), }, PluginType: types.PluginTypeCCIPExec, @@ -489,8 +490,8 @@ func Test_RevokeCandidate(t *testing.T) { }, }, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.RevokeCandidateChangeset), - changeset.RevokeCandidateChangesetConfig{ + deployment.CreateLegacyChangeSet(v1_6.RevokeCandidateChangeset), + v1_6.RevokeCandidateChangesetConfig{ HomeChainSelector: tenv.HomeChainSel, RemoteChainSelector: dest, PluginType: types.PluginTypeCCIPCommit, @@ -498,8 +499,8 @@ func Test_RevokeCandidate(t *testing.T) { }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.RevokeCandidateChangeset), - changeset.RevokeCandidateChangesetConfig{ + deployment.CreateLegacyChangeSet(v1_6.RevokeCandidateChangeset), + v1_6.RevokeCandidateChangesetConfig{ HomeChainSelector: tenv.HomeChainSel, RemoteChainSelector: dest, PluginType: types.PluginTypeCCIPExec, @@ -604,11 +605,11 @@ func Test_UpdateChainConfigs(t *testing.T) { }, }, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateChainConfigChangeset), - changeset.UpdateChainConfigConfig{ + deployment.CreateLegacyChangeSet(v1_6.UpdateChainConfigChangeset), + v1_6.UpdateChainConfigConfig{ HomeChainSelector: tenv.HomeChainSel, RemoteChainRemoves: []uint64{otherChain}, - RemoteChainAdds: make(map[uint64]changeset.ChainConfig), + RemoteChainAdds: make(map[uint64]v1_6.ChainConfig), MCMS: mcmsConfig, }, ), @@ -629,11 +630,11 @@ func Test_UpdateChainConfigs(t *testing.T) { }, }, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateChainConfigChangeset), - changeset.UpdateChainConfigConfig{ + deployment.CreateLegacyChangeSet(v1_6.UpdateChainConfigChangeset), + v1_6.UpdateChainConfigConfig{ HomeChainSelector: tenv.HomeChainSel, RemoteChainRemoves: []uint64{}, - RemoteChainAdds: map[uint64]changeset.ChainConfig{ + RemoteChainAdds: map[uint64]v1_6.ChainConfig{ otherChain: { EncodableChainConfig: chainconfig.ChainConfig{ GasPriceDeviationPPB: cciptypes.BigInt{Int: big.NewInt(globals.GasPriceDeviationPPB)}, diff --git a/deployment/ccip/changeset/cs_chain_contracts.go b/deployment/ccip/changeset/v1_6/cs_chain_contracts.go similarity index 94% rename from deployment/ccip/changeset/cs_chain_contracts.go rename to deployment/ccip/changeset/v1_6/cs_chain_contracts.go index af9aae04338..bd45ea24e94 100644 --- a/deployment/ccip/changeset/cs_chain_contracts.go +++ b/deployment/ccip/changeset/v1_6/cs_chain_contracts.go @@ -1,4 +1,4 @@ -package changeset +package v1_6 import ( "bytes" @@ -19,6 +19,7 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/logger" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" commonState "github.com/smartcontractkit/chainlink/deployment/common/changeset/state" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/v1_6_0/fee_quoter" @@ -69,7 +70,7 @@ var ( type UpdateNonceManagerConfig struct { UpdatesByChain map[uint64]NonceManagerUpdate // source -> dest -> update - MCMS *MCMSConfig + MCMS *changeset.MCMSConfig } type NonceManagerUpdate struct { @@ -89,7 +90,7 @@ type PreviousRampCfg struct { } func (cfg UpdateNonceManagerConfig) Validate(e deployment.Environment) error { - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return err } @@ -144,7 +145,7 @@ func UpdateNonceManagersChangeset(e deployment.Environment, cfg UpdateNonceManag if err := cfg.Validate(e); err != nil { return deployment.ChangesetOutput{}, err } - s, err := LoadOnchainState(e) + s, err := changeset.LoadOnchainState(e) if err != nil { return deployment.ChangesetOutput{}, err } @@ -211,7 +212,7 @@ func UpdateNonceManagersChangeset(e deployment.Environment, cfg UpdateNonceManag mcmsTransactions := make([]mcmstypes.Transaction, 0) if authTx != nil { mcmsTx, err := proposalutils.TransactionForChain(chainSel, nm.Address().Hex(), authTx.Data(), big.NewInt(0), - string(NonceManager), []string{}) + string(changeset.NonceManager), []string{}) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to create transaction for chain %d: %w", chainSel, err) } @@ -220,7 +221,7 @@ func UpdateNonceManagersChangeset(e deployment.Environment, cfg UpdateNonceManag } if prevRampsTx != nil { mcmsTx, err := proposalutils.TransactionForChain(chainSel, nm.Address().Hex(), prevRampsTx.Data(), big.NewInt(0), - string(NonceManager), []string{}) + string(changeset.NonceManager), []string{}) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to create transaction for chain %d: %w", chainSel, err) } @@ -276,17 +277,17 @@ type UpdateOnRampDestsConfig struct { // Disallow mixing MCMS/non-MCMS per chain for simplicity. // (can still be achieved by calling this function multiple times) - MCMS *MCMSConfig + MCMS *changeset.MCMSConfig } func (cfg UpdateOnRampDestsConfig) Validate(e deployment.Environment) error { - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return err } supportedChains := state.SupportedChains() for chainSel, updates := range cfg.UpdatesByChain { - if err := ValidateChain(e, state, chainSel, cfg.MCMS); err != nil { + if err := changeset.ValidateChain(e, state, chainSel, cfg.MCMS); err != nil { return err } chainState, ok := state.Chains[chainSel] @@ -329,7 +330,7 @@ func UpdateOnRampsDestsChangeset(e deployment.Environment, cfg UpdateOnRampDests if err := cfg.Validate(e); err != nil { return deployment.ChangesetOutput{}, err } - s, err := LoadOnchainState(e) + s, err := changeset.LoadOnchainState(e) if err != nil { return deployment.ChangesetOutput{}, err } @@ -374,7 +375,7 @@ func UpdateOnRampsDestsChangeset(e deployment.Environment, cfg UpdateOnRampDests } batchOperation, err := proposalutils.BatchOperationForChain(chainSel, onRamp.Address().Hex(), tx.Data(), - big.NewInt(0), string(OnRamp), []string{}) + big.NewInt(0), string(changeset.OnRamp), []string{}) if err != nil { return deployment.ChangesetOutput{}, err } @@ -419,12 +420,12 @@ type UpdateOnRampDynamicConfig struct { UpdatesByChain map[uint64]OnRampDynamicConfigUpdate // Disallow mixing MCMS/non-MCMS per chain for simplicity. // (can still be achieved by calling this function multiple times) - MCMS *MCMSConfig + MCMS *changeset.MCMSConfig } -func (cfg UpdateOnRampDynamicConfig) Validate(e deployment.Environment, state CCIPOnChainState) error { +func (cfg UpdateOnRampDynamicConfig) Validate(e deployment.Environment, state changeset.CCIPOnChainState) error { for chainSel, config := range cfg.UpdatesByChain { - if err := ValidateChain(e, state, chainSel, cfg.MCMS); err != nil { + if err := changeset.ValidateChain(e, state, chainSel, cfg.MCMS); err != nil { return err } if err := commoncs.ValidateOwnership(e.GetContext(), cfg.MCMS != nil, e.Chains[chainSel].DeployerKey.From, state.Chains[chainSel].Timelock.Address(), state.Chains[chainSel].OnRamp); err != nil { @@ -441,7 +442,7 @@ func (cfg UpdateOnRampDynamicConfig) Validate(e deployment.Environment, state CC } func UpdateOnRampDynamicConfigChangeset(e deployment.Environment, cfg UpdateOnRampDynamicConfig) (deployment.ChangesetOutput, error) { - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return deployment.ChangesetOutput{}, err } @@ -489,7 +490,7 @@ func UpdateOnRampDynamicConfigChangeset(e deployment.Environment, cfg UpdateOnRa } batchOperation, err := proposalutils.BatchOperationForChain(chainSel, onRamp.Address().Hex(), tx.Data(), - big.NewInt(0), string(OnRamp), []string{}) + big.NewInt(0), string(changeset.OnRamp), []string{}) if err != nil { return deployment.ChangesetOutput{}, err } @@ -529,16 +530,16 @@ type UpdateOnRampAllowListConfig struct { UpdatesByChain map[uint64]map[uint64]OnRampAllowListUpdate // Disallow mixing MCMS/non-MCMS per chain for simplicity. // (can still be achieved by calling this function multiple times) - MCMS *MCMSConfig + MCMS *changeset.MCMSConfig } func (cfg UpdateOnRampAllowListConfig) Validate(env deployment.Environment) error { - state, err := LoadOnchainState(env) + state, err := changeset.LoadOnchainState(env) if err != nil { return fmt.Errorf("failed to load onchain state: %w", err) } for srcSel, updates := range cfg.UpdatesByChain { - if err := ValidateChain(env, state, srcSel, cfg.MCMS); err != nil { + if err := changeset.ValidateChain(env, state, srcSel, cfg.MCMS); err != nil { return err } onRamp := state.Chains[srcSel].OnRamp @@ -566,7 +567,7 @@ func (cfg UpdateOnRampAllowListConfig) Validate(env deployment.Environment) erro } } for destSel, update := range updates { - if err := ValidateChain(env, state, srcSel, cfg.MCMS); err != nil { + if err := changeset.ValidateChain(env, state, srcSel, cfg.MCMS); err != nil { return err } if len(update.AddedAllowlistedSenders) > 0 && !update.AllowListEnabled { @@ -586,7 +587,7 @@ func UpdateOnRampAllowListChangeset(e deployment.Environment, cfg UpdateOnRampAl if err := cfg.Validate(e); err != nil { return deployment.ChangesetOutput{}, err } - onchain, err := LoadOnchainState(e) + onchain, err := changeset.LoadOnchainState(e) if err != nil { return deployment.ChangesetOutput{}, err } @@ -647,7 +648,7 @@ func UpdateOnRampAllowListChangeset(e deployment.Environment, cfg UpdateOnRampAl } batchOperation, err := proposalutils.BatchOperationForChain(srcSel, onRamp.Address().Hex(), tx.Data(), - big.NewInt(0), string(OnRamp), []string{}) + big.NewInt(0), string(changeset.OnRamp), []string{}) if err != nil { return deployment.ChangesetOutput{}, err } @@ -683,12 +684,12 @@ func UpdateOnRampAllowListChangeset(e deployment.Environment, cfg UpdateOnRampAl type WithdrawOnRampFeeTokensConfig struct { FeeTokensByChain map[uint64][]common.Address - MCMS *MCMSConfig + MCMS *changeset.MCMSConfig } -func (cfg WithdrawOnRampFeeTokensConfig) Validate(e deployment.Environment, state CCIPOnChainState) error { +func (cfg WithdrawOnRampFeeTokensConfig) Validate(e deployment.Environment, state changeset.CCIPOnChainState) error { for chainSel, feeTokens := range cfg.FeeTokensByChain { - if err := ValidateChain(e, state, chainSel, cfg.MCMS); err != nil { + if err := changeset.ValidateChain(e, state, chainSel, cfg.MCMS); err != nil { return err } if err := commoncs.ValidateOwnership(e.GetContext(), cfg.MCMS != nil, e.Chains[chainSel].DeployerKey.From, state.Chains[chainSel].Timelock.Address(), state.Chains[chainSel].OnRamp); err != nil { @@ -722,7 +723,7 @@ func (cfg WithdrawOnRampFeeTokensConfig) Validate(e deployment.Environment, stat } func WithdrawOnRampFeeTokensChangeset(e deployment.Environment, cfg WithdrawOnRampFeeTokensConfig) (deployment.ChangesetOutput, error) { - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return deployment.ChangesetOutput{}, err } @@ -749,7 +750,7 @@ func WithdrawOnRampFeeTokensChangeset(e deployment.Environment, cfg WithdrawOnRa } batchOperation, err := proposalutils.BatchOperationForChain(chainSel, onRamp.Address().Hex(), tx.Data(), - big.NewInt(0), string(OnRamp), []string{}) + big.NewInt(0), string(changeset.OnRamp), []string{}) if err != nil { return deployment.ChangesetOutput{}, err } @@ -785,7 +786,7 @@ func WithdrawOnRampFeeTokensChangeset(e deployment.Environment, cfg WithdrawOnRa type UpdateFeeQuoterPricesConfig struct { PricesByChain map[uint64]FeeQuoterPriceUpdatePerSource // source -> PriceDetails - MCMS *MCMSConfig + MCMS *changeset.MCMSConfig } type FeeQuoterPriceUpdatePerSource struct { @@ -794,7 +795,7 @@ type FeeQuoterPriceUpdatePerSource struct { } func (cfg UpdateFeeQuoterPricesConfig) Validate(e deployment.Environment) error { - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return err } @@ -872,7 +873,7 @@ func UpdateFeeQuoterPricesChangeset(e deployment.Environment, cfg UpdateFeeQuote if err := cfg.Validate(e); err != nil { return deployment.ChangesetOutput{}, err } - s, err := LoadOnchainState(e) + s, err := changeset.LoadOnchainState(e) if err != nil { return deployment.ChangesetOutput{}, err } @@ -916,7 +917,7 @@ func UpdateFeeQuoterPricesChangeset(e deployment.Environment, cfg UpdateFeeQuote } batchOperation, err := proposalutils.BatchOperationForChain(chainSel, fq.Address().Hex(), tx.Data(), - big.NewInt(0), string(FeeQuoter), []string{}) + big.NewInt(0), string(changeset.FeeQuoter), []string{}) if err != nil { return deployment.ChangesetOutput{}, err } @@ -955,11 +956,11 @@ type UpdateFeeQuoterDestsConfig struct { UpdatesByChain map[uint64]map[uint64]fee_quoter.FeeQuoterDestChainConfig // Disallow mixing MCMS/non-MCMS per chain for simplicity. // (can still be achieved by calling this function multiple times) - MCMS *MCMSConfig + MCMS *changeset.MCMSConfig } func (cfg UpdateFeeQuoterDestsConfig) Validate(e deployment.Environment) error { - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return err } @@ -1003,7 +1004,7 @@ func UpdateFeeQuoterDestsChangeset(e deployment.Environment, cfg UpdateFeeQuoter if err := cfg.Validate(e); err != nil { return deployment.ChangesetOutput{}, err } - s, err := LoadOnchainState(e) + s, err := changeset.LoadOnchainState(e) if err != nil { return deployment.ChangesetOutput{}, err } @@ -1037,7 +1038,7 @@ func UpdateFeeQuoterDestsChangeset(e deployment.Environment, cfg UpdateFeeQuoter } } else { batchOperation, err := proposalutils.BatchOperationForChain(chainSel, fq.Address().Hex(), tx.Data(), - big.NewInt(0), string(FeeQuoter), []string{}) + big.NewInt(0), string(changeset.FeeQuoter), []string{}) if err != nil { return deployment.ChangesetOutput{}, err } @@ -1082,10 +1083,10 @@ type UpdateOffRampSourcesConfig struct { // UpdatesByChain is a mapping from dest chain -> source chain -> source chain // update on the dest chain offramp. UpdatesByChain map[uint64]map[uint64]OffRampSourceUpdate - MCMS *MCMSConfig + MCMS *changeset.MCMSConfig } -func (cfg UpdateOffRampSourcesConfig) Validate(e deployment.Environment, state CCIPOnChainState) error { +func (cfg UpdateOffRampSourcesConfig) Validate(e deployment.Environment, state changeset.CCIPOnChainState) error { supportedChains := state.SupportedChains() for chainSel, updates := range cfg.UpdatesByChain { chainState, ok := state.Chains[chainSel] @@ -1115,7 +1116,7 @@ func (cfg UpdateOffRampSourcesConfig) Validate(e deployment.Environment, state C return fmt.Errorf("cannot update offramp source to the same chain %d", source) } - if err := state.ValidateRamp(source, OnRamp); err != nil { + if err := state.ValidateRamp(source, changeset.OnRamp); err != nil { return err } } @@ -1125,7 +1126,7 @@ func (cfg UpdateOffRampSourcesConfig) Validate(e deployment.Environment, state C // UpdateOffRampSourcesChangeset updates the offramp sources for each offramp. func UpdateOffRampSourcesChangeset(e deployment.Environment, cfg UpdateOffRampSourcesConfig) (deployment.ChangesetOutput, error) { - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return deployment.ChangesetOutput{}, err } @@ -1184,7 +1185,7 @@ func UpdateOffRampSourcesChangeset(e deployment.Environment, cfg UpdateOffRampSo } batchOperation, err := proposalutils.BatchOperationForChain(chainSel, offRamp.Address().Hex(), tx.Data(), - big.NewInt(0), string(OffRamp), []string{}) + big.NewInt(0), string(changeset.OffRamp), []string{}) if err != nil { return deployment.ChangesetOutput{}, err } @@ -1228,13 +1229,13 @@ type UpdateRouterRampsConfig struct { // on all chains. Disallow mixing test router/non-test router per chain for simplicity. TestRouter bool UpdatesByChain map[uint64]RouterUpdates - MCMS *MCMSConfig + MCMS *changeset.MCMSConfig } -func (cfg UpdateRouterRampsConfig) Validate(e deployment.Environment, state CCIPOnChainState) error { +func (cfg UpdateRouterRampsConfig) Validate(e deployment.Environment, state changeset.CCIPOnChainState) error { supportedChains := state.SupportedChains() for chainSel, update := range cfg.UpdatesByChain { - if err := ValidateChain(e, state, chainSel, cfg.MCMS); err != nil { + if err := changeset.ValidateChain(e, state, chainSel, cfg.MCMS); err != nil { return err } chainState, ok := state.Chains[chainSel] @@ -1268,7 +1269,7 @@ func (cfg UpdateRouterRampsConfig) Validate(e deployment.Environment, state CCIP if source == chainSel { return fmt.Errorf("cannot update offramp source to the same chain %d", source) } - if err := state.ValidateRamp(source, OnRamp); err != nil { + if err := state.ValidateRamp(source, changeset.OnRamp); err != nil { return err } } @@ -1280,7 +1281,7 @@ func (cfg UpdateRouterRampsConfig) Validate(e deployment.Environment, state CCIP if destination == chainSel { return fmt.Errorf("cannot update onRamp dest to the same chain %d", destination) } - if err := state.ValidateRamp(destination, OffRamp); err != nil { + if err := state.ValidateRamp(destination, changeset.OffRamp); err != nil { return err } } @@ -1296,7 +1297,7 @@ func (cfg UpdateRouterRampsConfig) Validate(e deployment.Environment, state CCIP // on all chains to support the new chain through the test router first. Once tested, // Enable the new destination on the real router. func UpdateRouterRampsChangeset(e deployment.Environment, cfg UpdateRouterRampsConfig) (deployment.ChangesetOutput, error) { - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return deployment.ChangesetOutput{}, err } @@ -1364,7 +1365,7 @@ func UpdateRouterRampsChangeset(e deployment.Environment, cfg UpdateRouterRampsC } batchOperation, err := proposalutils.BatchOperationForChain(chainSel, routerC.Address().Hex(), tx.Data(), - big.NewInt(0), string(Router), []string{}) + big.NewInt(0), string(changeset.Router), []string{}) if err != nil { return deployment.ChangesetOutput{}, err } @@ -1402,11 +1403,11 @@ type SetOCR3OffRampConfig struct { HomeChainSel uint64 RemoteChainSels []uint64 CCIPHomeConfigType globals.ConfigType - MCMS *MCMSConfig + MCMS *changeset.MCMSConfig } -func (c SetOCR3OffRampConfig) Validate(e deployment.Environment, state CCIPOnChainState) error { - if err := ValidateChain(e, state, c.HomeChainSel, c.MCMS); err != nil { +func (c SetOCR3OffRampConfig) Validate(e deployment.Environment, state changeset.CCIPOnChainState) error { + if err := changeset.ValidateChain(e, state, c.HomeChainSel, c.MCMS); err != nil { return err } if c.CCIPHomeConfigType != globals.ConfigTypeActive && @@ -1421,7 +1422,7 @@ func (c SetOCR3OffRampConfig) Validate(e deployment.Environment, state CCIPOnCha return nil } -func (c SetOCR3OffRampConfig) validateRemoteChain(e *deployment.Environment, state *CCIPOnChainState, chainSelector uint64) error { +func (c SetOCR3OffRampConfig) validateRemoteChain(e *deployment.Environment, state *changeset.CCIPOnChainState, chainSelector uint64) error { family, err := chain_selectors.GetSelectorFamily(chainSelector) if err != nil { return err @@ -1468,7 +1469,7 @@ func (c SetOCR3OffRampConfig) validateRemoteChain(e *deployment.Environment, sta // Multichain is especially helpful for NOP rotations where we have // to touch all the chain to change signers. func SetOCR3OffRampChangeset(e deployment.Environment, cfg SetOCR3OffRampConfig) (deployment.ChangesetOutput, error) { - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return deployment.ChangesetOutput{}, err } @@ -1518,7 +1519,7 @@ func SetOCR3OffRampChangeset(e deployment.Environment, cfg SetOCR3OffRampConfig) } batchOperation, err := proposalutils.BatchOperationForChain(remote, offRamp.Address().Hex(), tx.Data(), - big.NewInt(0), string(OffRamp), []string{}) + big.NewInt(0), string(changeset.OffRamp), []string{}) if err != nil { return deployment.ChangesetOutput{}, err } @@ -1555,16 +1556,16 @@ func SetOCR3OffRampChangeset(e deployment.Environment, cfg SetOCR3OffRampConfig) type UpdateDynamicConfigOffRampConfig struct { Updates map[uint64]OffRampParams - MCMS *MCMSConfig + MCMS *changeset.MCMSConfig } func (cfg UpdateDynamicConfigOffRampConfig) Validate(e deployment.Environment) error { - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return err } for chainSel, params := range cfg.Updates { - if err := ValidateChain(e, state, chainSel, cfg.MCMS); err != nil { + if err := changeset.ValidateChain(e, state, chainSel, cfg.MCMS); err != nil { return fmt.Errorf("chain %d: %w", chainSel, err) } if state.Chains[chainSel].OffRamp == nil { @@ -1598,7 +1599,7 @@ func UpdateDynamicConfigOffRampChangeset(e deployment.Environment, cfg UpdateDyn if err := cfg.Validate(e); err != nil { return deployment.ChangesetOutput{}, err } - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return deployment.ChangesetOutput{}, err } @@ -1632,7 +1633,7 @@ func UpdateDynamicConfigOffRampChangeset(e deployment.Environment, cfg UpdateDyn } batchOperation, err := proposalutils.BatchOperationForChain(chainSel, offRamp.Address().Hex(), tx.Data(), - big.NewInt(0), string(OffRamp), []string{}) + big.NewInt(0), string(changeset.OffRamp), []string{}) if err != nil { return deployment.ChangesetOutput{}, err } @@ -1760,16 +1761,16 @@ func DefaultFeeQuoterDestChainConfig(configEnabled bool, destChainSelector ...ui type ApplyFeeTokensUpdatesConfig struct { UpdatesByChain map[uint64]ApplyFeeTokensUpdatesConfigPerChain - MCMSConfig *MCMSConfig + MCMSConfig *changeset.MCMSConfig } type ApplyFeeTokensUpdatesConfigPerChain struct { - TokensToRemove []TokenSymbol - TokensToAdd []TokenSymbol + TokensToRemove []changeset.TokenSymbol + TokensToAdd []changeset.TokenSymbol } func (cfg ApplyFeeTokensUpdatesConfig) Validate(e deployment.Environment) error { - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return err } @@ -1779,7 +1780,7 @@ func (cfg ApplyFeeTokensUpdatesConfig) Validate(e deployment.Environment) error } } for chainSel, updates := range cfg.UpdatesByChain { - if err := ValidateChain(e, state, chainSel, cfg.MCMSConfig); err != nil { + if err := changeset.ValidateChain(e, state, chainSel, cfg.MCMSConfig); err != nil { return err } chainState := state.Chains[chainSel] @@ -1820,7 +1821,7 @@ func ApplyFeeTokensUpdatesFeeQuoterChangeset(e deployment.Environment, cfg Apply if err := cfg.Validate(e); err != nil { return deployment.ChangesetOutput{}, err } - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return deployment.ChangesetOutput{}, err } @@ -1855,7 +1856,7 @@ func ApplyFeeTokensUpdatesFeeQuoterChangeset(e deployment.Environment, cfg Apply return deployment.ChangesetOutput{}, err } op, err := proposalutils.BatchOperationForChain( - chainSel, fq.Address().String(), tx.Data(), big.NewInt(0), FeeQuoter.String(), nil) + chainSel, fq.Address().String(), tx.Data(), big.NewInt(0), changeset.FeeQuoter.String(), nil) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("error creating batch operation for chain %d: %w", chainSel, err) } @@ -1892,16 +1893,16 @@ func ApplyFeeTokensUpdatesFeeQuoterChangeset(e deployment.Environment, cfg Apply type UpdateTokenPriceFeedsConfig struct { Updates map[uint64][]UpdateTokenPriceFeedsConfigPerChain FeedChainSelector uint64 - MCMS *MCMSConfig + MCMS *changeset.MCMSConfig } type UpdateTokenPriceFeedsConfigPerChain struct { - SourceToken TokenSymbol + SourceToken changeset.TokenSymbol IsEnabled bool } func (cfg UpdateTokenPriceFeedsConfig) Validate(e deployment.Environment) error { - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return err } @@ -1910,7 +1911,7 @@ func (cfg UpdateTokenPriceFeedsConfig) Validate(e deployment.Environment) error return fmt.Errorf("feed chain %d not found in state", cfg.FeedChainSelector) } for chainSel, updates := range cfg.Updates { - if err := ValidateChain(e, state, chainSel, cfg.MCMS); err != nil { + if err := changeset.ValidateChain(e, state, chainSel, cfg.MCMS); err != nil { return err } chainState := state.Chains[chainSel] @@ -1954,7 +1955,7 @@ func UpdateTokenPriceFeedsFeeQuoterChangeset(e deployment.Environment, cfg Updat return deployment.ChangesetOutput{}, err } - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return deployment.ChangesetOutput{}, err } @@ -2008,7 +2009,7 @@ func UpdateTokenPriceFeedsFeeQuoterChangeset(e deployment.Environment, cfg Updat return deployment.ChangesetOutput{}, err } op, err := proposalutils.BatchOperationForChain( - chainSel, fq.Address().String(), tx.Data(), big.NewInt(0), FeeQuoter.String(), nil) + chainSel, fq.Address().String(), tx.Data(), big.NewInt(0), changeset.FeeQuoter.String(), nil) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("error creating batch operation for chain %d: %w", chainSel, err) } @@ -2044,16 +2045,16 @@ func UpdateTokenPriceFeedsFeeQuoterChangeset(e deployment.Environment, cfg Updat type PremiumMultiplierWeiPerEthUpdatesConfig struct { Updates map[uint64][]PremiumMultiplierWeiPerEthUpdatesConfigPerChain - MCMS *MCMSConfig + MCMS *changeset.MCMSConfig } func (cfg PremiumMultiplierWeiPerEthUpdatesConfig) Validate(e deployment.Environment) error { - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return err } for chainSel, updates := range cfg.Updates { - if err := ValidateChain(e, state, chainSel, cfg.MCMS); err != nil { + if err := changeset.ValidateChain(e, state, chainSel, cfg.MCMS); err != nil { return err } chainState := state.Chains[chainSel] @@ -2086,7 +2087,7 @@ func (cfg PremiumMultiplierWeiPerEthUpdatesConfig) Validate(e deployment.Environ } type PremiumMultiplierWeiPerEthUpdatesConfigPerChain struct { - Token TokenSymbol + Token changeset.TokenSymbol PremiumMultiplierWeiPerEth uint64 } @@ -2097,7 +2098,7 @@ func ApplyPremiumMultiplierWeiPerEthUpdatesFeeQuoterChangeset(e deployment.Envir if err := cfg.Validate(e); err != nil { return deployment.ChangesetOutput{}, err } - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return deployment.ChangesetOutput{}, err } @@ -2132,7 +2133,7 @@ func ApplyPremiumMultiplierWeiPerEthUpdatesFeeQuoterChangeset(e deployment.Envir return deployment.ChangesetOutput{}, err } op, err := proposalutils.BatchOperationForChain( - chainSel, fq.Address().String(), tx.Data(), big.NewInt(0), FeeQuoter.String(), nil) + chainSel, fq.Address().String(), tx.Data(), big.NewInt(0), changeset.FeeQuoter.String(), nil) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("error creating batch operation for chain %d: %w", chainSel, err) } @@ -2168,16 +2169,16 @@ func ApplyPremiumMultiplierWeiPerEthUpdatesFeeQuoterChangeset(e deployment.Envir type ApplyTokenTransferFeeConfigUpdatesConfig struct { UpdatesByChain map[uint64]ApplyTokenTransferFeeConfigUpdatesConfigPerChain - MCMS *MCMSConfig + MCMS *changeset.MCMSConfig } func (cfg ApplyTokenTransferFeeConfigUpdatesConfig) Validate(e deployment.Environment) error { - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return err } for chainSel, updates := range cfg.UpdatesByChain { - if err := ValidateChain(e, state, chainSel, cfg.MCMS); err != nil { + if err := changeset.ValidateChain(e, state, chainSel, cfg.MCMS); err != nil { return err } chainState := state.Chains[chainSel] @@ -2203,7 +2204,7 @@ func (cfg ApplyTokenTransferFeeConfigUpdatesConfig) Validate(e deployment.Enviro return fmt.Errorf("dest bytes overhead must be at least %d for token %s in chain %d", globals.CCIPLockOrBurnV1RetBytes, token, chainSel) } } - if err := ValidateChain(e, state, update.DestChain, nil); err != nil { + if err := changeset.ValidateChain(e, state, update.DestChain, nil); err != nil { return fmt.Errorf("dest chain %d: %w", update.DestChain, err) } } @@ -2214,7 +2215,7 @@ func (cfg ApplyTokenTransferFeeConfigUpdatesConfig) Validate(e deployment.Enviro if _, ok := tokenAddresses[remove.Token]; !ok { return fmt.Errorf("token %s not found in state for chain %d", remove.Token, chainSel) } - if err := ValidateChain(e, state, remove.DestChain, nil); err != nil { + if err := changeset.ValidateChain(e, state, remove.DestChain, nil); err != nil { return fmt.Errorf("dest chain %d: %w", remove.DestChain, err) } _, err := chainState.FeeQuoter.GetTokenTransferFeeConfig(&bind.CallOpts{ @@ -2245,12 +2246,12 @@ type ApplyTokenTransferFeeConfigUpdatesConfigPerChain struct { type TokenTransferFeeConfigArg struct { DestChain uint64 - TokenTransferFeeConfigPerToken map[TokenSymbol]fee_quoter.FeeQuoterTokenTransferFeeConfig + TokenTransferFeeConfigPerToken map[changeset.TokenSymbol]fee_quoter.FeeQuoterTokenTransferFeeConfig } type TokenTransferFeeConfigRemoveArg struct { DestChain uint64 - Token TokenSymbol + Token changeset.TokenSymbol } // ApplyTokenTransferFeeConfigUpdatesFeeQuoterChangeset applies the token transfer fee config updates for provided tokens to the fee quoter. @@ -2263,7 +2264,7 @@ func ApplyTokenTransferFeeConfigUpdatesFeeQuoterChangeset(e deployment.Environme if err := cfg.Validate(e); err != nil { return deployment.ChangesetOutput{}, err } - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return deployment.ChangesetOutput{}, err } @@ -2312,7 +2313,7 @@ func ApplyTokenTransferFeeConfigUpdatesFeeQuoterChangeset(e deployment.Environme return deployment.ChangesetOutput{}, err } op, err := proposalutils.BatchOperationForChain( - chainSel, fq.Address().String(), tx.Data(), big.NewInt(0), FeeQuoter.String(), nil) + chainSel, fq.Address().String(), tx.Data(), big.NewInt(0), changeset.FeeQuoter.String(), nil) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("error creating batch operation for chain %d: %w", chainSel, err) } diff --git a/deployment/ccip/changeset/cs_chain_contracts_test.go b/deployment/ccip/changeset/v1_6/cs_chain_contracts_test.go similarity index 87% rename from deployment/ccip/changeset/cs_chain_contracts_test.go rename to deployment/ccip/changeset/v1_6/cs_chain_contracts_test.go index 54ce6e6bbc8..b8430355012 100644 --- a/deployment/ccip/changeset/cs_chain_contracts_test.go +++ b/deployment/ccip/changeset/v1_6/cs_chain_contracts_test.go @@ -1,4 +1,4 @@ -package changeset_test +package v1_6_test import ( "math/big" @@ -17,15 +17,16 @@ import ( "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/testcontext" "github.com/smartcontractkit/chainlink/deployment" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/globals" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers/v1_5" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_6" "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/types" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/v1_5_0/rmn_contract" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/shared/generated/burn_mint_erc677" "github.com/smartcontractkit/chainlink-integrations/evm/utils" - "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers" commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/v1_6_0/fee_quoter" @@ -70,9 +71,9 @@ func TestUpdateOnRampsDests(t *testing.T) { } _, err = commonchangeset.Apply(t, tenv.Env, tenv.TimelockContracts(t), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateOnRampsDestsChangeset), - changeset.UpdateOnRampDestsConfig{ - UpdatesByChain: map[uint64]map[uint64]changeset.OnRampDestinationUpdate{ + deployment.CreateLegacyChangeSet(v1_6.UpdateOnRampsDestsChangeset), + v1_6.UpdateOnRampDestsConfig{ + UpdatesByChain: map[uint64]map[uint64]v1_6.OnRampDestinationUpdate{ source: { dest: { IsEnabled: true, @@ -146,9 +147,9 @@ func TestUpdateOnRampDynamicConfig(t *testing.T) { } _, err = commonchangeset.Apply(t, tenv.Env, tenv.TimelockContracts(t), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateOnRampDynamicConfigChangeset), - changeset.UpdateOnRampDynamicConfig{ - UpdatesByChain: map[uint64]changeset.OnRampDynamicConfigUpdate{ + deployment.CreateLegacyChangeSet(v1_6.UpdateOnRampDynamicConfigChangeset), + v1_6.UpdateOnRampDynamicConfig{ + UpdatesByChain: map[uint64]v1_6.OnRampDynamicConfigUpdate{ source: { FeeAggregator: common.HexToAddress("0x1002"), }, @@ -214,9 +215,9 @@ func TestUpdateOnRampAllowList(t *testing.T) { } _, err = commonchangeset.Apply(t, tenv.Env, tenv.TimelockContracts(t), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateOnRampAllowListChangeset), - changeset.UpdateOnRampAllowListConfig{ - UpdatesByChain: map[uint64]map[uint64]changeset.OnRampAllowListUpdate{ + deployment.CreateLegacyChangeSet(v1_6.UpdateOnRampAllowListChangeset), + v1_6.UpdateOnRampAllowListConfig{ + UpdatesByChain: map[uint64]map[uint64]v1_6.OnRampAllowListUpdate{ source: { dest: { AllowListEnabled: true, @@ -344,8 +345,8 @@ func TestWithdrawOnRampFeeTokens(t *testing.T) { _, err = commonchangeset.Apply(t, tenv.Env, tenv.TimelockContracts(t), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.WithdrawOnRampFeeTokensChangeset), - changeset.WithdrawOnRampFeeTokensConfig{ + deployment.CreateLegacyChangeSet(v1_6.WithdrawOnRampFeeTokensChangeset), + v1_6.WithdrawOnRampFeeTokensConfig{ FeeTokensByChain: map[uint64][]common.Address{ source: {linkToken.Address(), weth9.Address()}, dest: {state.Chains[dest].LinkToken.Address(), state.Chains[dest].Weth9.Address()}, @@ -404,9 +405,9 @@ func TestUpdateOffRampsSources(t *testing.T) { } _, err = commonchangeset.Apply(t, tenv.Env, tenv.TimelockContracts(t), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateOffRampSourcesChangeset), - changeset.UpdateOffRampSourcesConfig{ - UpdatesByChain: map[uint64]map[uint64]changeset.OffRampSourceUpdate{ + deployment.CreateLegacyChangeSet(v1_6.UpdateOffRampSourcesChangeset), + v1_6.UpdateOffRampSourcesConfig{ + UpdatesByChain: map[uint64]map[uint64]v1_6.OffRampSourceUpdate{ source: { dest: { IsEnabled: true, @@ -479,13 +480,13 @@ func TestUpdateFQDests(t *testing.T) { } } - fqCfg1 := changeset.DefaultFeeQuoterDestChainConfig(true) - fqCfg2 := changeset.DefaultFeeQuoterDestChainConfig(true) + fqCfg1 := v1_6.DefaultFeeQuoterDestChainConfig(true) + fqCfg2 := v1_6.DefaultFeeQuoterDestChainConfig(true) fqCfg2.DestGasOverhead = 1000 _, err = commonchangeset.Apply(t, tenv.Env, tenv.TimelockContracts(t), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateFeeQuoterDestsChangeset), - changeset.UpdateFeeQuoterDestsConfig{ + deployment.CreateLegacyChangeSet(v1_6.UpdateFeeQuoterDestsChangeset), + v1_6.UpdateFeeQuoterDestsConfig{ UpdatesByChain: map[uint64]map[uint64]fee_quoter.FeeQuoterDestChainConfig{ source: { dest: fqCfg1, @@ -550,10 +551,10 @@ func TestUpdateRouterRamps(t *testing.T) { // Updates test router. _, err = commonchangeset.Apply(t, tenv.Env, tenv.TimelockContracts(t), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateRouterRampsChangeset), - changeset.UpdateRouterRampsConfig{ + deployment.CreateLegacyChangeSet(v1_6.UpdateRouterRampsChangeset), + v1_6.UpdateRouterRampsConfig{ TestRouter: true, - UpdatesByChain: map[uint64]changeset.RouterUpdates{ + UpdatesByChain: map[uint64]v1_6.RouterUpdates{ source: { OffRampUpdates: map[uint64]bool{ dest: true, @@ -625,9 +626,9 @@ func TestUpdateDynamicConfigOffRampChangeset(t *testing.T) { msgInterceptor := utils.RandomAddress() _, err = commonchangeset.Apply(t, tenv.Env, tenv.TimelockContracts(t), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateDynamicConfigOffRampChangeset), - changeset.UpdateDynamicConfigOffRampConfig{ - Updates: map[uint64]changeset.OffRampParams{ + deployment.CreateLegacyChangeSet(v1_6.UpdateDynamicConfigOffRampChangeset), + v1_6.UpdateDynamicConfigOffRampConfig{ + Updates: map[uint64]v1_6.OffRampParams{ source: { PermissionLessExecutionThresholdSeconds: uint32(2 * 60 * 60), MessageInterceptor: msgInterceptor, @@ -685,9 +686,9 @@ func TestUpdateNonceManagersCS(t *testing.T) { _, err = commonchangeset.Apply(t, tenv.Env, tenv.TimelockContracts(t), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateNonceManagersChangeset), - changeset.UpdateNonceManagerConfig{ - UpdatesByChain: map[uint64]changeset.NonceManagerUpdate{ + deployment.CreateLegacyChangeSet(v1_6.UpdateNonceManagersChangeset), + v1_6.UpdateNonceManagerConfig{ + UpdatesByChain: map[uint64]v1_6.NonceManagerUpdate{ source: { RemovedAuthCallers: []common.Address{state.Chains[source].OnRamp.Address()}, }, @@ -743,11 +744,11 @@ func TestUpdateNonceManagersCSApplyPreviousRampsUpdates(t *testing.T) { // it should fail _, err = commonchangeset.Apply(t, e.Env, e.TimelockContracts(t), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateNonceManagersChangeset), - changeset.UpdateNonceManagerConfig{ - UpdatesByChain: map[uint64]changeset.NonceManagerUpdate{ + deployment.CreateLegacyChangeSet(v1_6.UpdateNonceManagersChangeset), + v1_6.UpdateNonceManagerConfig{ + UpdatesByChain: map[uint64]v1_6.NonceManagerUpdate{ srcChain.Selector: { - PreviousRampsArgs: []changeset.PreviousRampCfg{ + PreviousRampsArgs: []v1_6.PreviousRampCfg{ { RemoteChainSelector: destChain.Selector, }, @@ -764,11 +765,11 @@ func TestUpdateNonceManagersCSApplyPreviousRampsUpdates(t *testing.T) { // it should fail again as there is no offramp for the source chain _, err = commonchangeset.Apply(t, e.Env, e.TimelockContracts(t), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateNonceManagersChangeset), - changeset.UpdateNonceManagerConfig{ - UpdatesByChain: map[uint64]changeset.NonceManagerUpdate{ + deployment.CreateLegacyChangeSet(v1_6.UpdateNonceManagersChangeset), + v1_6.UpdateNonceManagerConfig{ + UpdatesByChain: map[uint64]v1_6.NonceManagerUpdate{ srcChain.Selector: { - PreviousRampsArgs: []changeset.PreviousRampCfg{ + PreviousRampsArgs: []v1_6.PreviousRampCfg{ { RemoteChainSelector: destChain.Selector, }, @@ -783,11 +784,11 @@ func TestUpdateNonceManagersCSApplyPreviousRampsUpdates(t *testing.T) { // Now apply the update with AllowEmptyOffRamp and it should pass _, err = commonchangeset.Apply(t, e.Env, e.TimelockContracts(t), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateNonceManagersChangeset), - changeset.UpdateNonceManagerConfig{ - UpdatesByChain: map[uint64]changeset.NonceManagerUpdate{ + deployment.CreateLegacyChangeSet(v1_6.UpdateNonceManagersChangeset), + v1_6.UpdateNonceManagerConfig{ + UpdatesByChain: map[uint64]v1_6.NonceManagerUpdate{ srcChain.Selector: { - PreviousRampsArgs: []changeset.PreviousRampCfg{ + PreviousRampsArgs: []v1_6.PreviousRampCfg{ { RemoteChainSelector: destChain.Selector, AllowEmptyOffRamp: true, @@ -808,19 +809,19 @@ func TestSetOCR3ConfigValidations(t *testing.T) { envNodes, err := deployment.NodeInfo(e.Env.NodeIDs, e.Env.Offchain) require.NoError(t, err) allChains := e.Env.AllChainSelectors() - evmContractParams := make(map[uint64]changeset.ChainContractParams) + evmContractParams := make(map[uint64]v1_6.ChainContractParams) for _, chain := range allChains { - evmContractParams[chain] = changeset.ChainContractParams{ - FeeQuoterParams: changeset.DefaultFeeQuoterParams(), - OffRampParams: changeset.DefaultOffRampParams(), + evmContractParams[chain] = v1_6.ChainContractParams{ + FeeQuoterParams: v1_6.DefaultFeeQuoterParams(), + OffRampParams: v1_6.DefaultOffRampParams(), } } var apps []commonchangeset.ConfiguredChangeSet // now deploy contracts apps = append(apps, []commonchangeset.ConfiguredChangeSet{ commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.DeployHomeChainChangeset), - changeset.DeployHomeChainConfig{ + deployment.CreateLegacyChangeSet(v1_6.DeployHomeChainChangeset), + v1_6.DeployHomeChainConfig{ HomeChainSel: e.HomeChainSel, RMNDynamicConfig: testhelpers.NewTestRMNDynamicConfig(), RMNStaticConfig: testhelpers.NewTestRMNStaticConfig(), @@ -831,8 +832,8 @@ func TestSetOCR3ConfigValidations(t *testing.T) { }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.DeployChainContractsChangeset), - changeset.DeployChainContractsConfig{ + deployment.CreateLegacyChangeSet(v1_6.DeployChainContractsChangeset), + v1_6.DeployChainContractsConfig{ HomeChainSelector: e.HomeChainSel, ContractParamsPerChain: evmContractParams, }, @@ -844,8 +845,8 @@ func TestSetOCR3ConfigValidations(t *testing.T) { _, err = commonchangeset.Apply(t, e.Env, e.TimelockContracts(t), commonchangeset.Configure( // Enable the OCR config on the remote chains. - deployment.CreateLegacyChangeSet(changeset.SetOCR3OffRampChangeset), - changeset.SetOCR3OffRampConfig{ + deployment.CreateLegacyChangeSet(v1_6.SetOCR3OffRampChangeset), + v1_6.SetOCR3OffRampConfig{ HomeChainSel: e.HomeChainSel, RemoteChainSels: allChains, CCIPHomeConfigType: globals.ConfigTypeActive, @@ -857,16 +858,16 @@ func TestSetOCR3ConfigValidations(t *testing.T) { require.Contains(t, err.Error(), "invalid OCR3 config state, expected active config") // Build the per chain config. - wrongChainConfigs := make(map[uint64]changeset.ChainConfig) - ocrConfigs := make(map[uint64]changeset.CCIPOCRParams) + wrongChainConfigs := make(map[uint64]v1_6.ChainConfig) + ocrConfigs := make(map[uint64]v1_6.CCIPOCRParams) for _, chain := range allChains { - ocrParams := changeset.DeriveCCIPOCRParams( - changeset.WithDefaultCommitOffChainConfig(e.FeedChainSel, nil), - changeset.WithDefaultExecuteOffChainConfig(nil), + ocrParams := v1_6.DeriveCCIPOCRParams( + v1_6.WithDefaultCommitOffChainConfig(e.FeedChainSel, nil), + v1_6.WithDefaultExecuteOffChainConfig(nil), ) ocrConfigs[chain] = ocrParams // set wrong chain config with incorrect value of FChain - wrongChainConfigs[chain] = changeset.ChainConfig{ + wrongChainConfigs[chain] = v1_6.ChainConfig{ Readers: envNodes.NonBootstraps().PeerIDs(), //nolint:gosec // disable G115 FChain: uint8(len(envNodes.NonBootstraps().PeerIDs())), @@ -882,21 +883,21 @@ func TestSetOCR3ConfigValidations(t *testing.T) { e.Env, err = commonchangeset.ApplyChangesets(t, e.Env, nil, []commonchangeset.ConfiguredChangeSet{ commonchangeset.Configure( // Add the chain configs for the new chains. - deployment.CreateLegacyChangeSet(changeset.UpdateChainConfigChangeset), - changeset.UpdateChainConfigConfig{ + deployment.CreateLegacyChangeSet(v1_6.UpdateChainConfigChangeset), + v1_6.UpdateChainConfigConfig{ HomeChainSelector: e.HomeChainSel, RemoteChainAdds: wrongChainConfigs, }, ), commonchangeset.Configure( // Add the DONs and candidate commit OCR instances for the chain. - deployment.CreateLegacyChangeSet(changeset.AddDonAndSetCandidateChangeset), - changeset.AddDonAndSetCandidateChangesetConfig{ - SetCandidateConfigBase: changeset.SetCandidateConfigBase{ + deployment.CreateLegacyChangeSet(v1_6.AddDonAndSetCandidateChangeset), + v1_6.AddDonAndSetCandidateChangesetConfig{ + SetCandidateConfigBase: v1_6.SetCandidateConfigBase{ HomeChainSelector: e.HomeChainSel, FeedChainSelector: e.FeedChainSel, }, - PluginInfo: changeset.SetCandidatePluginInfo{ + PluginInfo: v1_6.SetCandidatePluginInfo{ OCRConfigPerRemoteChainSelector: ocrConfigs, PluginType: types.PluginTypeCCIPCommit, }, @@ -968,9 +969,9 @@ func TestApplyFeeTokensUpdatesFeeQuoterChangeset(t *testing.T) { _, err = commonchangeset.Apply(t, tenv.Env, tenv.TimelockContracts(t), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.ApplyFeeTokensUpdatesFeeQuoterChangeset), - changeset.ApplyFeeTokensUpdatesConfig{ - UpdatesByChain: map[uint64]changeset.ApplyFeeTokensUpdatesConfigPerChain{ + deployment.CreateLegacyChangeSet(v1_6.ApplyFeeTokensUpdatesFeeQuoterChangeset), + v1_6.ApplyFeeTokensUpdatesConfig{ + UpdatesByChain: map[uint64]v1_6.ApplyFeeTokensUpdatesConfigPerChain{ source: { TokensToAdd: []changeset.TokenSymbol{testhelpers.TestTokenSymbol}, TokensToRemove: []changeset.TokenSymbol{changeset.LinkSymbol}, @@ -1028,9 +1029,9 @@ func TestApplyPremiumMultiplierWeiPerEthUpdatesFeeQuoterChangeset(t *testing.T) // try to update PremiumMultiplierWeiPerEth for a token that does not exist _, err = commonchangeset.Apply(t, tenv.Env, tenv.TimelockContracts(t), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.ApplyPremiumMultiplierWeiPerEthUpdatesFeeQuoterChangeset), - changeset.PremiumMultiplierWeiPerEthUpdatesConfig{ - Updates: map[uint64][]changeset.PremiumMultiplierWeiPerEthUpdatesConfigPerChain{ + deployment.CreateLegacyChangeSet(v1_6.ApplyPremiumMultiplierWeiPerEthUpdatesFeeQuoterChangeset), + v1_6.PremiumMultiplierWeiPerEthUpdatesConfig{ + Updates: map[uint64][]v1_6.PremiumMultiplierWeiPerEthUpdatesConfigPerChain{ source: { { Token: testhelpers.TestTokenSymbol, @@ -1073,9 +1074,9 @@ func TestApplyPremiumMultiplierWeiPerEthUpdatesFeeQuoterChangeset(t *testing.T) // now try to apply the changeset for TEST token _, err = commonchangeset.Apply(t, tenv.Env, tenv.TimelockContracts(t), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.ApplyPremiumMultiplierWeiPerEthUpdatesFeeQuoterChangeset), - changeset.PremiumMultiplierWeiPerEthUpdatesConfig{ - Updates: map[uint64][]changeset.PremiumMultiplierWeiPerEthUpdatesConfigPerChain{ + deployment.CreateLegacyChangeSet(v1_6.ApplyPremiumMultiplierWeiPerEthUpdatesFeeQuoterChangeset), + v1_6.PremiumMultiplierWeiPerEthUpdatesConfig{ + Updates: map[uint64][]v1_6.PremiumMultiplierWeiPerEthUpdatesConfigPerChain{ source: { { Token: testhelpers.TestTokenSymbol, @@ -1164,9 +1165,9 @@ func TestUpdateTokenPriceFeedsFeeQuoterChangeset(t *testing.T) { // try to update price feed for this it will fail as there is no price feed deployed for this token _, err = commonchangeset.Apply(t, tenv.Env, tenv.TimelockContracts(t), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateTokenPriceFeedsFeeQuoterChangeset), - changeset.UpdateTokenPriceFeedsConfig{ - Updates: map[uint64][]changeset.UpdateTokenPriceFeedsConfigPerChain{ + deployment.CreateLegacyChangeSet(v1_6.UpdateTokenPriceFeedsFeeQuoterChangeset), + v1_6.UpdateTokenPriceFeedsConfig{ + Updates: map[uint64][]v1_6.UpdateTokenPriceFeedsConfigPerChain{ source: { { SourceToken: testhelpers.TestTokenSymbol, @@ -1183,9 +1184,9 @@ func TestUpdateTokenPriceFeedsFeeQuoterChangeset(t *testing.T) { // now try to apply the changeset for link token, there is already a price feed deployed for link token _, err = commonchangeset.Apply(t, tenv.Env, tenv.TimelockContracts(t), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateTokenPriceFeedsFeeQuoterChangeset), - changeset.UpdateTokenPriceFeedsConfig{ - Updates: map[uint64][]changeset.UpdateTokenPriceFeedsConfigPerChain{ + deployment.CreateLegacyChangeSet(v1_6.UpdateTokenPriceFeedsFeeQuoterChangeset), + v1_6.UpdateTokenPriceFeedsConfig{ + Updates: map[uint64][]v1_6.UpdateTokenPriceFeedsConfigPerChain{ source: { { SourceToken: changeset.LinkSymbol, @@ -1256,11 +1257,11 @@ func TestApplyTokenTransferFeeConfigUpdatesFeeQuoterChangeset(t *testing.T) { _, err = commonchangeset.Apply(t, tenv.Env, tenv.TimelockContracts(t), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.ApplyTokenTransferFeeConfigUpdatesFeeQuoterChangeset), - changeset.ApplyTokenTransferFeeConfigUpdatesConfig{ - UpdatesByChain: map[uint64]changeset.ApplyTokenTransferFeeConfigUpdatesConfigPerChain{ + deployment.CreateLegacyChangeSet(v1_6.ApplyTokenTransferFeeConfigUpdatesFeeQuoterChangeset), + v1_6.ApplyTokenTransferFeeConfigUpdatesConfig{ + UpdatesByChain: map[uint64]v1_6.ApplyTokenTransferFeeConfigUpdatesConfigPerChain{ source: { - TokenTransferFeeConfigRemoveArgs: []changeset.TokenTransferFeeConfigRemoveArg{ + TokenTransferFeeConfigRemoveArgs: []v1_6.TokenTransferFeeConfigRemoveArg{ { DestChain: dest, Token: changeset.LinkSymbol, @@ -1268,7 +1269,7 @@ func TestApplyTokenTransferFeeConfigUpdatesFeeQuoterChangeset(t *testing.T) { }, }, dest: { - TokenTransferFeeConfigArgs: []changeset.TokenTransferFeeConfigArg{ + TokenTransferFeeConfigArgs: []v1_6.TokenTransferFeeConfigArg{ { DestChain: source, TokenTransferFeeConfigPerToken: map[changeset.TokenSymbol]fee_quoter.FeeQuoterTokenTransferFeeConfig{ @@ -1292,11 +1293,11 @@ func TestApplyTokenTransferFeeConfigUpdatesFeeQuoterChangeset(t *testing.T) { require.Contains(t, err.Error(), "min fee must be less than max fee for token") _, err = commonchangeset.Apply(t, tenv.Env, tenv.TimelockContracts(t), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.ApplyTokenTransferFeeConfigUpdatesFeeQuoterChangeset), - changeset.ApplyTokenTransferFeeConfigUpdatesConfig{ - UpdatesByChain: map[uint64]changeset.ApplyTokenTransferFeeConfigUpdatesConfigPerChain{ + deployment.CreateLegacyChangeSet(v1_6.ApplyTokenTransferFeeConfigUpdatesFeeQuoterChangeset), + v1_6.ApplyTokenTransferFeeConfigUpdatesConfig{ + UpdatesByChain: map[uint64]v1_6.ApplyTokenTransferFeeConfigUpdatesConfigPerChain{ source: { - TokenTransferFeeConfigRemoveArgs: []changeset.TokenTransferFeeConfigRemoveArg{ + TokenTransferFeeConfigRemoveArgs: []v1_6.TokenTransferFeeConfigRemoveArg{ { DestChain: dest, Token: changeset.LinkSymbol, @@ -1304,7 +1305,7 @@ func TestApplyTokenTransferFeeConfigUpdatesFeeQuoterChangeset(t *testing.T) { }, }, dest: { - TokenTransferFeeConfigArgs: []changeset.TokenTransferFeeConfigArg{ + TokenTransferFeeConfigArgs: []v1_6.TokenTransferFeeConfigArg{ { DestChain: source, TokenTransferFeeConfigPerToken: map[changeset.TokenSymbol]fee_quoter.FeeQuoterTokenTransferFeeConfig{ diff --git a/deployment/ccip/changeset/cs_deploy_chain.go b/deployment/ccip/changeset/v1_6/cs_deploy_chain.go similarity index 96% rename from deployment/ccip/changeset/cs_deploy_chain.go rename to deployment/ccip/changeset/v1_6/cs_deploy_chain.go index 47143fd5a44..5b50b9ca06b 100644 --- a/deployment/ccip/changeset/cs_deploy_chain.go +++ b/deployment/ccip/changeset/v1_6/cs_deploy_chain.go @@ -1,4 +1,4 @@ -package changeset +package v1_6 import ( "errors" @@ -14,6 +14,8 @@ import ( chainsel "github.com/smartcontractkit/chain-selectors" "github.com/smartcontractkit/chainlink/deployment" + + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/globals" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/internal" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/v1_2_0/router" @@ -155,8 +157,8 @@ func DefaultOffRampParams() OffRampParams { } } -func ValidateHomeChainState(e deployment.Environment, homeChainSel uint64, existingState CCIPOnChainState) error { - existingState, err := LoadOnchainState(e) +func ValidateHomeChainState(e deployment.Environment, homeChainSel uint64, existingState changeset.CCIPOnChainState) error { + existingState, err := changeset.LoadOnchainState(e) if err != nil { e.Logger.Errorw("Failed to load existing onchain state", "err", err) return err @@ -203,7 +205,7 @@ func deployChainContractsForChains( ab deployment.AddressBook, homeChainSel uint64, contractParamsPerChain map[uint64]ChainContractParams) error { - existingState, err := LoadOnchainState(e) + existingState, err := changeset.LoadOnchainState(e) if err != nil { e.Logger.Errorw("Failed to load existing onchain state", "err", err) return err @@ -257,7 +259,7 @@ func deployChainContractsForChains( func deployChainContractsEVM(e deployment.Environment, chain deployment.Chain, ab deployment.AddressBook, rmnHome *rmn_home.RMNHome, contractParams ChainContractParams) error { // check for existing contracts - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { e.Logger.Errorw("Failed to load existing onchain state", "err", err) return err @@ -315,7 +317,7 @@ func deployChainContractsEVM(e deployment.Environment, chain deployment.Chain, a rmnLegacyAddr, ) return deployment.ContractDeploy[*rmn_remote.RMNRemote]{ - Address: rmnRemoteAddr, Contract: rmnRemote, Tx: tx, Tv: deployment.NewTypeAndVersion(RMNRemote, deployment.Version1_6_0), Err: err2, + Address: rmnRemoteAddr, Contract: rmnRemote, Tx: tx, Tv: deployment.NewTypeAndVersion(changeset.RMNRemote, deployment.Version1_6_0), Err: err2, } }) if err != nil { @@ -355,7 +357,7 @@ func deployChainContractsEVM(e deployment.Environment, chain deployment.Chain, a RMNProxy.Address(), ) return deployment.ContractDeploy[*router.Router]{ - Address: routerAddr, Contract: routerC, Tx: tx2, Tv: deployment.NewTypeAndVersion(TestRouter, deployment.Version1_2_0), Err: err2, + Address: routerAddr, Contract: routerC, Tx: tx2, Tv: deployment.NewTypeAndVersion(changeset.TestRouter, deployment.Version1_2_0), Err: err2, } }) if err != nil { @@ -376,7 +378,7 @@ func deployChainContractsEVM(e deployment.Environment, chain deployment.Chain, a []common.Address{}, // Need to add onRamp after ) return deployment.ContractDeploy[*nonce_manager.NonceManager]{ - Address: nonceManagerAddr, Contract: nonceManager, Tx: tx2, Tv: deployment.NewTypeAndVersion(NonceManager, deployment.Version1_6_0), Err: err2, + Address: nonceManagerAddr, Contract: nonceManager, Tx: tx2, Tv: deployment.NewTypeAndVersion(changeset.NonceManager, deployment.Version1_6_0), Err: err2, } }) if err != nil { @@ -416,7 +418,7 @@ func deployChainContractsEVM(e deployment.Environment, chain deployment.Chain, a contractParams.FeeQuoterParams.DestChainConfigArgs, ) return deployment.ContractDeploy[*fee_quoter.FeeQuoter]{ - Address: prAddr, Contract: pr, Tx: tx2, Tv: deployment.NewTypeAndVersion(FeeQuoter, deployment.Version1_6_0), Err: err2, + Address: prAddr, Contract: pr, Tx: tx2, Tv: deployment.NewTypeAndVersion(changeset.FeeQuoter, deployment.Version1_6_0), Err: err2, } }) if err != nil { @@ -447,7 +449,7 @@ func deployChainContractsEVM(e deployment.Environment, chain deployment.Chain, a []onramp.OnRampDestChainConfigArgs{}, ) return deployment.ContractDeploy[*onramp.OnRamp]{ - Address: onRampAddr, Contract: onRamp, Tx: tx2, Tv: deployment.NewTypeAndVersion(OnRamp, deployment.Version1_6_0), Err: err2, + Address: onRampAddr, Contract: onRamp, Tx: tx2, Tv: deployment.NewTypeAndVersion(changeset.OnRamp, deployment.Version1_6_0), Err: err2, } }) if err != nil { @@ -480,7 +482,7 @@ func deployChainContractsEVM(e deployment.Environment, chain deployment.Chain, a []offramp.OffRampSourceChainConfigArgs{}, ) return deployment.ContractDeploy[*offramp.OffRamp]{ - Address: offRampAddr, Contract: offRamp, Tx: tx2, Tv: deployment.NewTypeAndVersion(OffRamp, deployment.Version1_6_0), Err: err2, + Address: offRampAddr, Contract: offRamp, Tx: tx2, Tv: deployment.NewTypeAndVersion(changeset.OffRamp, deployment.Version1_6_0), Err: err2, } }) if err != nil { diff --git a/deployment/ccip/changeset/cs_deploy_chain_test.go b/deployment/ccip/changeset/v1_6/cs_deploy_chain_test.go similarity index 88% rename from deployment/ccip/changeset/cs_deploy_chain_test.go rename to deployment/ccip/changeset/v1_6/cs_deploy_chain_test.go index 8802a935a2a..def897868f0 100644 --- a/deployment/ccip/changeset/cs_deploy_chain_test.go +++ b/deployment/ccip/changeset/v1_6/cs_deploy_chain_test.go @@ -1,4 +1,4 @@ -package changeset_test +package v1_6_test import ( "testing" @@ -9,6 +9,7 @@ import ( "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_6" commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" commontypes "github.com/smartcontractkit/chainlink/deployment/common/types" @@ -30,12 +31,12 @@ func TestDeployChainContractsChangeset(t *testing.T) { require.NoError(t, err) p2pIds := nodes.NonBootstraps().PeerIDs() cfg := make(map[uint64]commontypes.MCMSWithTimelockConfigV2) - contractParams := make(map[uint64]changeset.ChainContractParams) + contractParams := make(map[uint64]v1_6.ChainContractParams) for _, chain := range e.AllChainSelectors() { cfg[chain] = proposalutils.SingleGroupTimelockConfigV2(t) - contractParams[chain] = changeset.ChainContractParams{ - FeeQuoterParams: changeset.DefaultFeeQuoterParams(), - OffRampParams: changeset.DefaultOffRampParams(), + contractParams[chain] = v1_6.ChainContractParams{ + FeeQuoterParams: v1_6.DefaultFeeQuoterParams(), + OffRampParams: v1_6.DefaultOffRampParams(), } } prereqCfg := make([]changeset.DeployPrerequisiteConfigPerChain, 0) @@ -47,8 +48,8 @@ func TestDeployChainContractsChangeset(t *testing.T) { e, err = commonchangeset.Apply(t, e, nil, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.DeployHomeChainChangeset), - changeset.DeployHomeChainConfig{ + deployment.CreateLegacyChangeSet(v1_6.DeployHomeChainChangeset), + v1_6.DeployHomeChainConfig{ HomeChainSel: homeChainSel, RMNStaticConfig: testhelpers.NewTestRMNStaticConfig(), RMNDynamicConfig: testhelpers.NewTestRMNDynamicConfig(), @@ -73,8 +74,8 @@ func TestDeployChainContractsChangeset(t *testing.T) { }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.DeployChainContractsChangeset), - changeset.DeployChainContractsConfig{ + deployment.CreateLegacyChangeSet(v1_6.DeployChainContractsChangeset), + v1_6.DeployChainContractsConfig{ HomeChainSelector: homeChainSel, ContractParamsPerChain: contractParams, }, diff --git a/deployment/ccip/changeset/cs_home_chain.go b/deployment/ccip/changeset/v1_6/cs_home_chain.go similarity index 96% rename from deployment/ccip/changeset/cs_home_chain.go rename to deployment/ccip/changeset/v1_6/cs_home_chain.go index 458356ae25c..62f14432d22 100644 --- a/deployment/ccip/changeset/cs_home_chain.go +++ b/deployment/ccip/changeset/v1_6/cs_home_chain.go @@ -1,4 +1,4 @@ -package changeset +package v1_6 import ( "bytes" @@ -18,6 +18,7 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/logger" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" "github.com/smartcontractkit/chainlink/deployment" @@ -91,7 +92,7 @@ func (c DeployHomeChainConfig) Validate() error { // and returns a deployment.ContractDeploy struct with the address and contract instance. func deployCapReg( lggr logger.Logger, - state CCIPOnChainState, + state changeset.CCIPOnChainState, ab deployment.AddressBook, chain deployment.Chain, ) (*deployment.ContractDeploy[*capabilities_registry.CapabilitiesRegistry], error) { @@ -101,7 +102,7 @@ func deployCapReg( if cr != nil { lggr.Infow("Found CapabilitiesRegistry in chain state", "address", cr.Address().String()) return &deployment.ContractDeploy[*capabilities_registry.CapabilitiesRegistry]{ - Address: cr.Address(), Contract: cr, Tv: deployment.NewTypeAndVersion(CapabilitiesRegistry, deployment.Version1_0_0), + Address: cr.Address(), Contract: cr, Tv: deployment.NewTypeAndVersion(changeset.CapabilitiesRegistry, deployment.Version1_0_0), }, nil } } @@ -112,7 +113,7 @@ func deployCapReg( chain.Client, ) return deployment.ContractDeploy[*capabilities_registry.CapabilitiesRegistry]{ - Address: crAddr, Contract: cr, Tv: deployment.NewTypeAndVersion(CapabilitiesRegistry, deployment.Version1_0_0), Tx: tx, Err: err2, + Address: crAddr, Contract: cr, Tv: deployment.NewTypeAndVersion(changeset.CapabilitiesRegistry, deployment.Version1_0_0), Tx: tx, Err: err2, } }) if err != nil { @@ -133,7 +134,7 @@ func deployHomeChain( nodeP2PIDsPerNodeOpAdmin map[string][][32]byte, ) (*deployment.ContractDeploy[*capabilities_registry.CapabilitiesRegistry], error) { // load existing state - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return nil, fmt.Errorf("failed to load onchain state: %w", err) } @@ -158,7 +159,7 @@ func deployHomeChain( capReg.Address, ) return deployment.ContractDeploy[*ccip_home.CCIPHome]{ - Address: ccAddr, Tv: deployment.NewTypeAndVersion(CCIPHome, deployment.Version1_6_0), Tx: tx, Err: err2, Contract: cc, + Address: ccAddr, Tv: deployment.NewTypeAndVersion(changeset.CCIPHome, deployment.Version1_6_0), Tx: tx, Err: err2, Contract: cc, } }) if err != nil { @@ -179,7 +180,7 @@ func deployHomeChain( chain.Client, ) return deployment.ContractDeploy[*rmn_home.RMNHome]{ - Address: rmnAddr, Tv: deployment.NewTypeAndVersion(RMNHome, deployment.Version1_6_0), Tx: tx, Err: err2, Contract: rmn, + Address: rmnAddr, Tv: deployment.NewTypeAndVersion(changeset.RMNHome, deployment.Version1_6_0), Tx: tx, Err: err2, Contract: rmn, } }, ) @@ -445,10 +446,10 @@ func addNodes( type RemoveDONsConfig struct { HomeChainSel uint64 DonIDs []uint32 - MCMS *MCMSConfig + MCMS *changeset.MCMSConfig } -func (c RemoveDONsConfig) Validate(homeChain CCIPChainState) error { +func (c RemoveDONsConfig) Validate(homeChain changeset.CCIPChainState) error { if err := deployment.IsValidChainSelector(c.HomeChainSel); err != nil { return fmt.Errorf("home chain selector must be set %w", err) } @@ -471,7 +472,7 @@ func (c RemoveDONsConfig) Validate(homeChain CCIPChainState) error { // RemoveDONs removes DONs from the CapabilitiesRegistry contract. // TODO: Could likely be moved to common, but needs a common state struct first. func RemoveDONs(e deployment.Environment, cfg RemoveDONsConfig) (deployment.ChangesetOutput, error) { - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return deployment.ChangesetOutput{}, err } @@ -503,7 +504,7 @@ func RemoveDONs(e deployment.Environment, cfg RemoveDONsConfig) (deployment.Chan batchOperation, err := proposalutils.BatchOperationForChain(cfg.HomeChainSel, homeChainState.CapabilityRegistry.Address().Hex(), tx.Data(), big.NewInt(0), - string(CapabilitiesRegistry), []string{}) + string(changeset.CapabilitiesRegistry), []string{}) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to create batch operation for home chain: %w", err) } diff --git a/deployment/ccip/changeset/cs_home_chain_test.go b/deployment/ccip/changeset/v1_6/cs_home_chain_test.go similarity index 89% rename from deployment/ccip/changeset/cs_home_chain_test.go rename to deployment/ccip/changeset/v1_6/cs_home_chain_test.go index c4cf086ebea..77cfd8c8d2d 100644 --- a/deployment/ccip/changeset/cs_home_chain_test.go +++ b/deployment/ccip/changeset/v1_6/cs_home_chain_test.go @@ -1,4 +1,4 @@ -package changeset_test +package v1_6_test import ( "testing" @@ -10,6 +10,7 @@ import ( "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_6" commoncs "github.com/smartcontractkit/chainlink/deployment/common/changeset" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" "github.com/smartcontractkit/chainlink/deployment/common/view/v1_0" @@ -29,7 +30,7 @@ func TestDeployHomeChain(t *testing.T) { nodes, err := deployment.NodeInfo(e.NodeIDs, e.Offchain) require.NoError(t, err) p2pIds := nodes.NonBootstraps().PeerIDs() - homeChainCfg := changeset.DeployHomeChainConfig{ + homeChainCfg := v1_6.DeployHomeChainConfig{ HomeChainSel: homeChainSel, RMNStaticConfig: testhelpers.NewTestRMNStaticConfig(), RMNDynamicConfig: testhelpers.NewTestRMNDynamicConfig(), @@ -38,7 +39,7 @@ func TestDeployHomeChain(t *testing.T) { "NodeOperator": p2pIds, }, } - output, err := changeset.DeployHomeChainChangeset(e, homeChainCfg) + output, err := v1_6.DeployHomeChainChangeset(e, homeChainCfg) require.NoError(t, err) require.NoError(t, e.ExistingAddresses.Merge(output.AddressBook)) state, err := changeset.LoadOnchainState(e) @@ -67,7 +68,7 @@ func TestDeployHomeChainIdempotent(t *testing.T) { e, _ := testhelpers.NewMemoryEnvironment(t) nodes, err := deployment.NodeInfo(e.Env.NodeIDs, e.Env.Offchain) require.NoError(t, err) - homeChainCfg := changeset.DeployHomeChainConfig{ + homeChainCfg := v1_6.DeployHomeChainConfig{ HomeChainSel: e.HomeChainSel, RMNStaticConfig: testhelpers.NewTestRMNStaticConfig(), RMNDynamicConfig: testhelpers.NewTestRMNDynamicConfig(), @@ -77,7 +78,7 @@ func TestDeployHomeChainIdempotent(t *testing.T) { }, } // apply the changeset once again to ensure idempotency - output, err := changeset.DeployHomeChainChangeset(e.Env, homeChainCfg) + output, err := v1_6.DeployHomeChainChangeset(e.Env, homeChainCfg) require.NoError(t, err) require.NoError(t, e.Env.ExistingAddresses.Merge(output.AddressBook)) _, err = changeset.LoadOnchainState(e.Env) @@ -91,12 +92,12 @@ func TestRemoveDonsValidate(t *testing.T) { homeChain := s.Chains[e.HomeChainSel] var tt = []struct { name string - config changeset.RemoveDONsConfig + config v1_6.RemoveDONsConfig expectErr bool }{ { name: "invalid home", - config: changeset.RemoveDONsConfig{ + config: v1_6.RemoveDONsConfig{ HomeChainSel: 0, DonIDs: []uint32{1}, }, @@ -104,7 +105,7 @@ func TestRemoveDonsValidate(t *testing.T) { }, { name: "invalid dons", - config: changeset.RemoveDONsConfig{ + config: v1_6.RemoveDONsConfig{ HomeChainSel: e.HomeChainSel, DonIDs: []uint32{1377}, }, @@ -112,7 +113,7 @@ func TestRemoveDonsValidate(t *testing.T) { }, { name: "no dons", - config: changeset.RemoveDONsConfig{ + config: v1_6.RemoveDONsConfig{ HomeChainSel: e.HomeChainSel, DonIDs: []uint32{}, }, @@ -120,7 +121,7 @@ func TestRemoveDonsValidate(t *testing.T) { }, { name: "success", - config: changeset.RemoveDONsConfig{ + config: v1_6.RemoveDONsConfig{ HomeChainSel: e.HomeChainSel, DonIDs: []uint32{1}, }, @@ -150,8 +151,8 @@ func TestRemoveDons(t *testing.T) { require.NoError(t, err) e.Env, err = commoncs.Apply(t, e.Env, nil, commoncs.Configure( - deployment.CreateLegacyChangeSet(changeset.RemoveDONs), - changeset.RemoveDONsConfig{ + deployment.CreateLegacyChangeSet(v1_6.RemoveDONs), + v1_6.RemoveDONsConfig{ HomeChainSel: e.HomeChainSel, DonIDs: []uint32{donsBefore[0].Id}, }, @@ -182,8 +183,8 @@ func TestRemoveDons(t *testing.T) { }, ), commoncs.Configure( - deployment.CreateLegacyChangeSet(changeset.RemoveDONs), - changeset.RemoveDONsConfig{ + deployment.CreateLegacyChangeSet(v1_6.RemoveDONs), + v1_6.RemoveDONsConfig{ HomeChainSel: e.HomeChainSel, DonIDs: []uint32{donsBefore[0].Id}, MCMS: &changeset.MCMSConfig{MinDelay: 0}, diff --git a/deployment/ccip/changeset/cs_jobspec.go b/deployment/ccip/changeset/v1_6/cs_jobspec.go similarity index 99% rename from deployment/ccip/changeset/cs_jobspec.go rename to deployment/ccip/changeset/v1_6/cs_jobspec.go index 051402b5194..ccff971441b 100644 --- a/deployment/ccip/changeset/cs_jobspec.go +++ b/deployment/ccip/changeset/v1_6/cs_jobspec.go @@ -1,4 +1,4 @@ -package changeset +package v1_6 import ( "bytes" diff --git a/deployment/ccip/changeset/cs_jobspec_test.go b/deployment/ccip/changeset/v1_6/cs_jobspec_test.go similarity index 87% rename from deployment/ccip/changeset/cs_jobspec_test.go rename to deployment/ccip/changeset/v1_6/cs_jobspec_test.go index 96b86eaeb2d..a98320c031c 100644 --- a/deployment/ccip/changeset/cs_jobspec_test.go +++ b/deployment/ccip/changeset/v1_6/cs_jobspec_test.go @@ -1,4 +1,4 @@ -package changeset_test +package v1_6_test import ( "testing" @@ -6,8 +6,8 @@ import ( "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink/deployment" - "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_6" commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset" ccip "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/validate" ) @@ -21,8 +21,8 @@ func TestJobSpecChangeset(t *testing.T) { require.NoError(t, err) e, err = commonchangeset.Apply(t, e, nil, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.DeployHomeChainChangeset), - changeset.DeployHomeChainConfig{ + deployment.CreateLegacyChangeSet(v1_6.DeployHomeChainChangeset), + v1_6.DeployHomeChainConfig{ HomeChainSel: tenv.HomeChainSel, RMNDynamicConfig: testhelpers.NewTestRMNDynamicConfig(), RMNStaticConfig: testhelpers.NewTestRMNStaticConfig(), @@ -34,7 +34,7 @@ func TestJobSpecChangeset(t *testing.T) { ), ) require.NoError(t, err) - output, err := changeset.CCIPCapabilityJobspecChangeset(e, nil) + output, err := v1_6.CCIPCapabilityJobspecChangeset(e, nil) require.NoError(t, err) require.NotEmpty(t, output.Jobs) nodeIDs := make(map[string]struct{}) @@ -56,7 +56,7 @@ func TestJobSpecChangesetIdempotent(t *testing.T) { e, _ := testhelpers.NewMemoryEnvironment(t) // we call the changeset again to ensure that it doesn't return any new job specs // as the job specs are already created in the first call - output, err := changeset.CCIPCapabilityJobspecChangeset(e.Env, nil) + output, err := v1_6.CCIPCapabilityJobspecChangeset(e.Env, nil) require.NoError(t, err) require.Empty(t, output.Jobs) } diff --git a/deployment/ccip/changeset/cs_rmn_curse_uncurse.go b/deployment/ccip/changeset/v1_6/cs_rmn_curse_uncurse.go similarity index 95% rename from deployment/ccip/changeset/cs_rmn_curse_uncurse.go rename to deployment/ccip/changeset/v1_6/cs_rmn_curse_uncurse.go index 3f382549996..63ac89689ae 100644 --- a/deployment/ccip/changeset/cs_rmn_curse_uncurse.go +++ b/deployment/ccip/changeset/v1_6/cs_rmn_curse_uncurse.go @@ -1,4 +1,4 @@ -package changeset +package v1_6 import ( "encoding/binary" @@ -6,6 +6,7 @@ import ( "fmt" "github.com/smartcontractkit/chainlink/deployment" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" commoncs "github.com/smartcontractkit/chainlink/deployment/common/changeset" ) @@ -31,13 +32,13 @@ type RMNCurseAction struct { type CurseAction func(e deployment.Environment) []RMNCurseAction type RMNCurseConfig struct { - MCMS *MCMSConfig + MCMS *changeset.MCMSConfig CurseActions []CurseAction Reason string } func (c RMNCurseConfig) Validate(e deployment.Environment) error { - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return fmt.Errorf("failed to load onchain state: %w", err) @@ -215,12 +216,12 @@ func RMNCurseChangeset(e deployment.Environment, cfg RMNCurseConfig) (deployment return deployment.ChangesetOutput{}, err } - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to load onchain state: %w", err) } - deployerGroup := NewDeployerGroup(e, state, cfg.MCMS).WithDeploymentContext("proposal to curse RMNs: " + cfg.Reason) + deployerGroup := changeset.NewDeployerGroup(e, state, cfg.MCMS).WithDeploymentContext("proposal to curse RMNs: " + cfg.Reason) // Generate curse actions var curseActions []RMNCurseAction @@ -286,12 +287,12 @@ func RMNUncurseChangeset(e deployment.Environment, cfg RMNCurseConfig) (deployme return deployment.ChangesetOutput{}, err } - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to load onchain state: %w", err) } - deployerGroup := NewDeployerGroup(e, state, cfg.MCMS).WithDeploymentContext("proposal to uncurse RMNs: " + cfg.Reason) + deployerGroup := changeset.NewDeployerGroup(e, state, cfg.MCMS).WithDeploymentContext("proposal to uncurse RMNs: " + cfg.Reason) // Generate curse actions var curseActions []RMNCurseAction diff --git a/deployment/ccip/changeset/cs_update_rmn_config.go b/deployment/ccip/changeset/v1_6/cs_update_rmn_config.go similarity index 91% rename from deployment/ccip/changeset/cs_update_rmn_config.go rename to deployment/ccip/changeset/v1_6/cs_update_rmn_config.go index f6cc6f18744..e6a452b7d96 100644 --- a/deployment/ccip/changeset/cs_update_rmn_config.go +++ b/deployment/ccip/changeset/v1_6/cs_update_rmn_config.go @@ -1,4 +1,4 @@ -package changeset +package v1_6 import ( "bytes" @@ -14,6 +14,8 @@ import ( mcmstypes "github.com/smartcontractkit/mcms/types" "github.com/smartcontractkit/chainlink/deployment" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" + "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/v1_0_0/rmn_proxy_contract" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/v1_6_0/rmn_home" @@ -32,10 +34,10 @@ var ( type SetRMNRemoteOnRMNProxyConfig struct { ChainSelectors []uint64 - MCMSConfig *MCMSConfig + MCMSConfig *changeset.MCMSConfig } -func (c SetRMNRemoteOnRMNProxyConfig) Validate(state CCIPOnChainState) error { +func (c SetRMNRemoteOnRMNProxyConfig) Validate(state changeset.CCIPOnChainState) error { for _, chain := range c.ChainSelectors { err := deployment.IsValidChainSelector(chain) if err != nil { @@ -56,7 +58,7 @@ func (c SetRMNRemoteOnRMNProxyConfig) Validate(state CCIPOnChainState) error { } func SetRMNRemoteOnRMNProxyChangeset(e deployment.Environment, cfg SetRMNRemoteOnRMNProxyConfig) (deployment.ChangesetOutput, error) { - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to load onchain state: %w", err) } @@ -64,8 +66,8 @@ func SetRMNRemoteOnRMNProxyChangeset(e deployment.Environment, cfg SetRMNRemoteO return deployment.ChangesetOutput{}, err } - timelocks := BuildTimelockAddressPerChain(e, state) - proposerMcms := BuildProposerMcmAddressesPerChain(e, state) + timelocks := changeset.BuildTimelockAddressPerChain(e, state) + proposerMcms := changeset.BuildProposerMcmAddressesPerChain(e, state) inspectors := map[uint64]mcmssdk.Inspector{} timelockBatch := []mcmstypes.BatchOperation{} @@ -118,7 +120,7 @@ func SetRMNRemoteOnRMNProxyChangeset(e deployment.Environment, cfg SetRMNRemoteO } func setRMNRemoteOnRMNProxyOp( - txOpts *bind.TransactOpts, chain deployment.Chain, chainState CCIPChainState, mcmsEnabled bool, + txOpts *bind.TransactOpts, chain deployment.Chain, chainState changeset.CCIPChainState, mcmsEnabled bool, ) (mcmstypes.BatchOperation, error) { rmnProxy := chainState.RMNProxy rmnRemoteAddr := chainState.RMNRemote.Address() @@ -135,7 +137,7 @@ func setRMNRemoteOnRMNProxyOp( } batchOperation, err := proposalutils.BatchOperationForChain(chain.Selector, rmnProxy.Address().Hex(), - setRMNTx.Data(), big.NewInt(0), string(RMN), []string{}) + setRMNTx.Data(), big.NewInt(0), string(changeset.RMN), []string{}) if err != nil { return mcmstypes.BatchOperation{}, fmt.Errorf("failed to create batch operation for chain%s: %w", chain.String(), err) } @@ -172,7 +174,7 @@ func (c RMNNopConfig) SetBit(bitmap *big.Int, value bool) { } } -func getDeployer(e deployment.Environment, chain uint64, mcmConfig *MCMSConfig) *bind.TransactOpts { +func getDeployer(e deployment.Environment, chain uint64, mcmConfig *changeset.MCMSConfig) *bind.TransactOpts { if mcmConfig == nil { return e.Chains[chain].DeployerKey } @@ -185,10 +187,10 @@ type SetRMNHomeCandidateConfig struct { RMNStaticConfig rmn_home.RMNHomeStaticConfig RMNDynamicConfig rmn_home.RMNHomeDynamicConfig DigestToOverride [32]byte - MCMSConfig *MCMSConfig + MCMSConfig *changeset.MCMSConfig } -func (c SetRMNHomeCandidateConfig) Validate(state CCIPOnChainState) error { +func (c SetRMNHomeCandidateConfig) Validate(state changeset.CCIPOnChainState) error { err := deployment.IsValidChainSelector(c.HomeChainSelector) if err != nil { return err @@ -291,10 +293,10 @@ func isRMNDynamicConfigEqual(a, b rmn_home.RMNHomeDynamicConfig) bool { type PromoteRMNHomeCandidateConfig struct { HomeChainSelector uint64 DigestToPromote [32]byte - MCMSConfig *MCMSConfig + MCMSConfig *changeset.MCMSConfig } -func (c PromoteRMNHomeCandidateConfig) Validate(state CCIPOnChainState) error { +func (c PromoteRMNHomeCandidateConfig) Validate(state changeset.CCIPOnChainState) error { err := deployment.IsValidChainSelector(c.HomeChainSelector) if err != nil { return err @@ -329,7 +331,7 @@ func (c PromoteRMNHomeCandidateConfig) Validate(state CCIPOnChainState) error { // DynamicConfig contains the list of source chains with their chain selectors, f value and the bitmap of the nodes that are oberver for each source chain // The bitmap is a 256 bit array where each bit represents a node. If the bit matching the index of the node in the static config is set it means that the node is an observer func SetRMNHomeCandidateConfigChangeset(e deployment.Environment, config SetRMNHomeCandidateConfig) (deployment.ChangesetOutput, error) { - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to load onchain state: %w", err) } @@ -366,13 +368,13 @@ func SetRMNHomeCandidateConfigChangeset(e deployment.Environment, config SetRMNH } operation, err := proposalutils.BatchOperationForChain(homeChain.Selector, rmnHome.Address().Hex(), - setCandidateTx.Data(), big.NewInt(0), string(RMN), []string{}) + setCandidateTx.Data(), big.NewInt(0), string(changeset.RMN), []string{}) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to create batch operation for chain %s: %w", homeChain.String(), err) } - timelocks := BuildTimelockAddressPerChain(e, state) - proposerMcms := BuildProposerMcmAddressesPerChain(e, state) + timelocks := changeset.BuildTimelockAddressPerChain(e, state) + proposerMcms := changeset.BuildProposerMcmAddressesPerChain(e, state) inspectors, err := proposalutils.McmsInspectors(e) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to get mcms inspector for chain %s: %w", homeChain.String(), err) @@ -395,7 +397,7 @@ func SetRMNHomeCandidateConfigChangeset(e deployment.Environment, config SetRMNH } func PromoteRMNHomeCandidateConfigChangeset(e deployment.Environment, config PromoteRMNHomeCandidateConfig) (deployment.ChangesetOutput, error) { - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to load onchain state: %w", err) } @@ -443,13 +445,13 @@ func PromoteRMNHomeCandidateConfigChangeset(e deployment.Environment, config Pro } operation, err := proposalutils.BatchOperationForChain(homeChain.Selector, rmnHome.Address().Hex(), - promoteCandidateTx.Data(), big.NewInt(0), string(RMN), []string{}) + promoteCandidateTx.Data(), big.NewInt(0), string(changeset.RMN), []string{}) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to create batch operation for chain %s: %w", homeChain.String(), err) } - timelocks := BuildTimelockAddressPerChain(e, state) - proposerMcms := BuildProposerMcmAddressesPerChain(e, state) + timelocks := changeset.BuildTimelockAddressPerChain(e, state) + proposerMcms := changeset.BuildProposerMcmAddressesPerChain(e, state) inspectors := map[uint64]mcmssdk.Inspector{} inspectors[config.HomeChainSelector], err = proposalutils.McmsInspectorForChain(e, config.HomeChainSelector) @@ -475,7 +477,7 @@ func PromoteRMNHomeCandidateConfigChangeset(e deployment.Environment, config Pro }, nil } -func BuildRMNRemotePerChain(e deployment.Environment, state CCIPOnChainState) map[uint64]*rmn_remote.RMNRemote { +func BuildRMNRemotePerChain(e deployment.Environment, state changeset.CCIPOnChainState) map[uint64]*rmn_remote.RMNRemote { timelocksPerChain := make(map[uint64]*rmn_remote.RMNRemote) for _, chain := range e.Chains { timelocksPerChain[chain.Selector] = state.Chains[chain.Selector].RMNRemote @@ -491,7 +493,7 @@ type RMNRemoteConfig struct { type SetRMNRemoteConfig struct { HomeChainSelector uint64 RMNRemoteConfigs map[uint64]RMNRemoteConfig - MCMSConfig *MCMSConfig + MCMSConfig *changeset.MCMSConfig } func (c SetRMNRemoteConfig) Validate() error { @@ -524,7 +526,7 @@ type SetRMNHomeDynamicConfigConfig struct { HomeChainSelector uint64 RMNDynamicConfig rmn_home.RMNHomeDynamicConfig ActiveDigest [32]byte - MCMS *MCMSConfig + MCMS *changeset.MCMSConfig } func (c SetRMNHomeDynamicConfigConfig) Validate(e deployment.Environment) error { @@ -533,7 +535,7 @@ func (c SetRMNHomeDynamicConfigConfig) Validate(e deployment.Environment) error return err } - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return fmt.Errorf("failed to load onchain state: %w", err) } @@ -565,12 +567,12 @@ func SetRMNHomeDynamicConfigChangeset(e deployment.Environment, cfg SetRMNHomeDy return deployment.ChangesetOutput{}, err } - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to load onchain state: %w", err) } - deployerGroup := NewDeployerGroup(e, state, cfg.MCMS).WithDeploymentContext("set RMNHome dynamic config") + deployerGroup := changeset.NewDeployerGroup(e, state, cfg.MCMS).WithDeploymentContext("set RMNHome dynamic config") chain, exists := e.Chains[cfg.HomeChainSelector] if !exists { @@ -599,7 +601,7 @@ func SetRMNHomeDynamicConfigChangeset(e deployment.Environment, cfg SetRMNHomeDy type RevokeCandidateConfig struct { HomeChainSelector uint64 CandidateDigest [32]byte - MCMS *MCMSConfig + MCMS *changeset.MCMSConfig } func (c RevokeCandidateConfig) Validate(e deployment.Environment) error { @@ -608,7 +610,7 @@ func (c RevokeCandidateConfig) Validate(e deployment.Environment) error { return err } - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return fmt.Errorf("failed to load onchain state: %w", err) } @@ -636,12 +638,12 @@ func RevokeRMNHomeCandidateConfigChangeset(e deployment.Environment, cfg RevokeC return deployment.ChangesetOutput{}, err } - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to load onchain state: %w", err) } - deployerGroup := NewDeployerGroup(e, state, cfg.MCMS).WithDeploymentContext("revoke candidate config") + deployerGroup := changeset.NewDeployerGroup(e, state, cfg.MCMS).WithDeploymentContext("revoke candidate config") chain, exists := e.Chains[cfg.HomeChainSelector] if !exists { @@ -667,7 +669,7 @@ func RevokeRMNHomeCandidateConfigChangeset(e deployment.Environment, cfg RevokeC } func SetRMNRemoteConfigChangeset(e deployment.Environment, config SetRMNRemoteConfig) (deployment.ChangesetOutput, error) { - state, err := LoadOnchainState(e) + state, err := changeset.LoadOnchainState(e) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to load onchain state: %w", err) } @@ -735,7 +737,7 @@ func SetRMNRemoteConfigChangeset(e deployment.Environment, config SetRMNRemoteCo } operation, err := proposalutils.BatchOperationForChain(e.Chains[chain].Selector, remote.Address().Hex(), - tx.Data(), big.NewInt(0), string(RMN), []string{}) + tx.Data(), big.NewInt(0), string(changeset.RMN), []string{}) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to create batch operation for chain %s: %w", homeChain.String(), err) } @@ -747,8 +749,8 @@ func SetRMNRemoteConfigChangeset(e deployment.Environment, config SetRMNRemoteCo return deployment.ChangesetOutput{}, nil } - timelocks := BuildTimelockAddressPerChain(e, state) - proposerMcms := BuildProposerMcmAddressesPerChain(e, state) + timelocks := changeset.BuildTimelockAddressPerChain(e, state) + proposerMcms := changeset.BuildProposerMcmAddressesPerChain(e, state) inspectors, err := proposalutils.McmsInspectors(e) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to get mcms inspector for chain %s: %w", homeChain.String(), err) diff --git a/deployment/ccip/changeset/view.go b/deployment/ccip/changeset/view.go index 1fd8fdbe38f..9d33368c721 100644 --- a/deployment/ccip/changeset/view.go +++ b/deployment/ccip/changeset/view.go @@ -4,6 +4,7 @@ import ( "encoding/json" "github.com/smartcontractkit/chainlink/deployment" + ccipview "github.com/smartcontractkit/chainlink/deployment/ccip/view" "github.com/smartcontractkit/chainlink/deployment/common/view" ) diff --git a/deployment/environment/crib/ccip_deployer.go b/deployment/environment/crib/ccip_deployer.go index 49e3fae4678..647c477572d 100644 --- a/deployment/environment/crib/ccip_deployer.go +++ b/deployment/environment/crib/ccip_deployer.go @@ -4,14 +4,21 @@ import ( "context" "errors" "fmt" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/v1_5_1/token_pool" - "golang.org/x/sync/errgroup" "math/big" "sync" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_5_1" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_6" + + "golang.org/x/sync/errgroup" + + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/v1_5_1/token_pool" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/globals" "github.com/smartcontractkit/chainlink-ccip/chainconfig" + "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/types" "github.com/ethereum/go-ethereum/common" @@ -20,7 +27,6 @@ import ( cciptypes "github.com/smartcontractkit/chainlink-ccip/pkg/types/ccipocr3" "github.com/smartcontractkit/chainlink/deployment" - "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers" commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset" commontypes "github.com/smartcontractkit/chainlink/deployment/common/types" @@ -65,8 +71,8 @@ func DeployHomeChainContracts(ctx context.Context, lggr logger.Logger, envConfig cfg, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.DeployHomeChainChangeset), - changeset.DeployHomeChainConfig{ + deployment.CreateLegacyChangeSet(v1_6.DeployHomeChainChangeset), + v1_6.DeployHomeChainConfig{ HomeChainSel: homeChainSel, RMNStaticConfig: testhelpers.NewTestRMNStaticConfig(), RMNDynamicConfig: testhelpers.NewTestRMNDynamicConfig(), @@ -259,19 +265,19 @@ func FundCCIPTransmitters(ctx context.Context, lggr logger.Logger, envConfig dev func setupChains(lggr logger.Logger, e *deployment.Environment, homeChainSel uint64) (deployment.Environment, error) { chainSelectors := e.AllChainSelectors() - chainConfigs := make(map[uint64]changeset.ChainConfig) + chainConfigs := make(map[uint64]v1_6.ChainConfig) nodeInfo, err := deployment.NodeInfo(e.NodeIDs, e.Offchain) if err != nil { return *e, fmt.Errorf("failed to get node info from env: %w", err) } prereqCfgs := make([]changeset.DeployPrerequisiteConfigPerChain, 0) - contractParams := make(map[uint64]changeset.ChainContractParams) + contractParams := make(map[uint64]v1_6.ChainContractParams) for _, chain := range chainSelectors { prereqCfgs = append(prereqCfgs, changeset.DeployPrerequisiteConfigPerChain{ ChainSelector: chain, }) - chainConfigs[chain] = changeset.ChainConfig{ + chainConfigs[chain] = v1_6.ChainConfig{ Readers: nodeInfo.NonBootstraps().PeerIDs(), FChain: 1, EncodableChainConfig: chainconfig.ChainConfig{ @@ -280,15 +286,15 @@ func setupChains(lggr logger.Logger, e *deployment.Environment, homeChainSel uin OptimisticConfirmations: 1, }, } - contractParams[chain] = changeset.ChainContractParams{ - FeeQuoterParams: changeset.DefaultFeeQuoterParams(), - OffRampParams: changeset.DefaultOffRampParams(), + contractParams[chain] = v1_6.ChainContractParams{ + FeeQuoterParams: v1_6.DefaultFeeQuoterParams(), + OffRampParams: v1_6.DefaultOffRampParams(), } } env, err := commonchangeset.Apply(nil, *e, nil, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateChainConfigChangeset), - changeset.UpdateChainConfigConfig{ + deployment.CreateLegacyChangeSet(v1_6.UpdateChainConfigChangeset), + v1_6.UpdateChainConfigConfig{ HomeChainSelector: homeChainSel, RemoteChainAdds: chainConfigs, }, @@ -304,20 +310,20 @@ func setupChains(lggr logger.Logger, e *deployment.Environment, homeChainSel uin }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.DeployChainContractsChangeset), - changeset.DeployChainContractsConfig{ + deployment.CreateLegacyChangeSet(v1_6.DeployChainContractsChangeset), + v1_6.DeployChainContractsConfig{ HomeChainSelector: homeChainSel, ContractParamsPerChain: contractParams, }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.SetRMNRemoteOnRMNProxyChangeset), - changeset.SetRMNRemoteOnRMNProxyConfig{ + deployment.CreateLegacyChangeSet(v1_6.SetRMNRemoteOnRMNProxyChangeset), + v1_6.SetRMNRemoteOnRMNProxyConfig{ ChainSelectors: chainSelectors, }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.CCIPCapabilityJobspecChangeset), + deployment.CreateLegacyChangeSet(v1_6.CCIPCapabilityJobspecChangeset), nil, // ChangeSet does not use a config. ), ) @@ -334,10 +340,10 @@ func setupLinkPools(e *deployment.Environment) (deployment.Environment, error) { return *e, fmt.Errorf("failed to load onchain state: %w", err) } chainSelectors := e.AllChainSelectors() - poolInput := make(map[uint64]changeset.DeployTokenPoolInput) + poolInput := make(map[uint64]v1_5_1.DeployTokenPoolInput) pools := make(map[uint64]map[changeset.TokenSymbol]changeset.TokenPoolInfo) for _, chain := range chainSelectors { - poolInput[chain] = changeset.DeployTokenPoolInput{ + poolInput[chain] = v1_5_1.DeployTokenPoolInput{ Type: changeset.BurnMintTokenPool, LocalTokenDecimals: 18, AllowList: []common.Address{}, @@ -353,26 +359,26 @@ func setupLinkPools(e *deployment.Environment) (deployment.Environment, error) { } env, err := commonchangeset.Apply(nil, *e, nil, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.DeployTokenPoolContractsChangeset), - changeset.DeployTokenPoolContractsConfig{ + deployment.CreateLegacyChangeSet(v1_5_1.DeployTokenPoolContractsChangeset), + v1_5_1.DeployTokenPoolContractsConfig{ TokenSymbol: changeset.LinkSymbol, NewPools: poolInput, }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.ProposeAdminRoleChangeset), + deployment.CreateLegacyChangeSet(v1_5_1.ProposeAdminRoleChangeset), changeset.TokenAdminRegistryChangesetConfig{ Pools: pools, }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.AcceptAdminRoleChangeset), + deployment.CreateLegacyChangeSet(v1_5_1.AcceptAdminRoleChangeset), changeset.TokenAdminRegistryChangesetConfig{ Pools: pools, }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.SetPoolChangeset), + deployment.CreateLegacyChangeSet(v1_5_1.SetPoolChangeset), changeset.TokenAdminRegistryChangesetConfig{ Pools: pools, }, @@ -402,19 +408,19 @@ func setupLinkPools(e *deployment.Environment) (deployment.Environment, error) { func setupLanes(e *deployment.Environment, state changeset.CCIPOnChainState) (deployment.Environment, error) { eg := errgroup.Group{} - poolUpdates := make(map[uint64]changeset.TokenPoolConfig) - rateLimitPerChain := make(changeset.RateLimiterPerChain) + poolUpdates := make(map[uint64]v1_5_1.TokenPoolConfig) + rateLimitPerChain := make(v1_5_1.RateLimiterPerChain) mu := sync.Mutex{} for src := range e.Chains { src := src eg.Go(func() error { - onRampUpdatesByChain := make(map[uint64]map[uint64]changeset.OnRampDestinationUpdate) - pricesByChain := make(map[uint64]changeset.FeeQuoterPriceUpdatePerSource) + onRampUpdatesByChain := make(map[uint64]map[uint64]v1_6.OnRampDestinationUpdate) + pricesByChain := make(map[uint64]v1_6.FeeQuoterPriceUpdatePerSource) feeQuoterDestsUpdatesByChain := make(map[uint64]map[uint64]fee_quoter.FeeQuoterDestChainConfig) - updateOffRampSources := make(map[uint64]map[uint64]changeset.OffRampSourceUpdate) - updateRouterChanges := make(map[uint64]changeset.RouterUpdates) - onRampUpdatesByChain[src] = make(map[uint64]changeset.OnRampDestinationUpdate) - pricesByChain[src] = changeset.FeeQuoterPriceUpdatePerSource{ + updateOffRampSources := make(map[uint64]map[uint64]v1_6.OffRampSourceUpdate) + updateRouterChanges := make(map[uint64]v1_6.RouterUpdates) + onRampUpdatesByChain[src] = make(map[uint64]v1_6.OnRampDestinationUpdate) + pricesByChain[src] = v1_6.FeeQuoterPriceUpdatePerSource{ TokenPrices: map[common.Address]*big.Int{ state.Chains[src].LinkToken.Address(): testhelpers.DefaultLinkPrice, state.Chains[src].Weth9.Address(): testhelpers.DefaultWethPrice, @@ -422,22 +428,22 @@ func setupLanes(e *deployment.Environment, state changeset.CCIPOnChainState) (de GasPrices: make(map[uint64]*big.Int), } feeQuoterDestsUpdatesByChain[src] = make(map[uint64]fee_quoter.FeeQuoterDestChainConfig) - updateOffRampSources[src] = make(map[uint64]changeset.OffRampSourceUpdate) - updateRouterChanges[src] = changeset.RouterUpdates{ + updateOffRampSources[src] = make(map[uint64]v1_6.OffRampSourceUpdate) + updateRouterChanges[src] = v1_6.RouterUpdates{ OffRampUpdates: make(map[uint64]bool), OnRampUpdates: make(map[uint64]bool), } for dst := range e.Chains { if src != dst { - onRampUpdatesByChain[src][dst] = changeset.OnRampDestinationUpdate{ + onRampUpdatesByChain[src][dst] = v1_6.OnRampDestinationUpdate{ IsEnabled: true, AllowListEnabled: false, } pricesByChain[src].GasPrices[dst] = testhelpers.DefaultGasPrice - feeQuoterDestsUpdatesByChain[src][dst] = changeset.DefaultFeeQuoterDestChainConfig(true) + feeQuoterDestsUpdatesByChain[src][dst] = v1_6.DefaultFeeQuoterDestChainConfig(true) - updateOffRampSources[src][dst] = changeset.OffRampSourceUpdate{ + updateOffRampSources[src][dst] = v1_6.OffRampSourceUpdate{ IsEnabled: true, IsRMNVerificationDisabled: true, } @@ -445,7 +451,7 @@ func setupLanes(e *deployment.Environment, state changeset.CCIPOnChainState) (de updateRouterChanges[src].OffRampUpdates[dst] = true updateRouterChanges[src].OnRampUpdates[dst] = true mu.Lock() - rateLimitPerChain[dst] = changeset.RateLimiterConfig{ + rateLimitPerChain[dst] = v1_5_1.RateLimiterConfig{ Inbound: token_pool.RateLimiterConfig{ IsEnabled: false, Capacity: big.NewInt(0), @@ -460,9 +466,8 @@ func setupLanes(e *deployment.Environment, state changeset.CCIPOnChainState) (de mu.Unlock() } } - mu.Lock() - poolUpdates[src] = changeset.TokenPoolConfig{ + poolUpdates[src] = v1_5_1.TokenPoolConfig{ Type: changeset.BurnMintTokenPool, Version: deployment.Version1_5_1, ChainUpdates: rateLimitPerChain, @@ -471,32 +476,32 @@ func setupLanes(e *deployment.Environment, state changeset.CCIPOnChainState) (de _, err := commonchangeset.Apply(nil, *e, nil, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateOnRampsDestsChangeset), - changeset.UpdateOnRampDestsConfig{ + deployment.CreateLegacyChangeSet(v1_6.UpdateOnRampsDestsChangeset), + v1_6.UpdateOnRampDestsConfig{ UpdatesByChain: onRampUpdatesByChain, }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateFeeQuoterPricesChangeset), - changeset.UpdateFeeQuoterPricesConfig{ + deployment.CreateLegacyChangeSet(v1_6.UpdateFeeQuoterPricesChangeset), + v1_6.UpdateFeeQuoterPricesConfig{ PricesByChain: pricesByChain, }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateFeeQuoterDestsChangeset), - changeset.UpdateFeeQuoterDestsConfig{ + deployment.CreateLegacyChangeSet(v1_6.UpdateFeeQuoterDestsChangeset), + v1_6.UpdateFeeQuoterDestsConfig{ UpdatesByChain: feeQuoterDestsUpdatesByChain, }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateOffRampSourcesChangeset), - changeset.UpdateOffRampSourcesConfig{ + deployment.CreateLegacyChangeSet(v1_6.UpdateOffRampSourcesChangeset), + v1_6.UpdateOffRampSourcesConfig{ UpdatesByChain: updateOffRampSources, }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateRouterRampsChangeset), - changeset.UpdateRouterRampsConfig{ + deployment.CreateLegacyChangeSet(v1_6.UpdateRouterRampsChangeset), + v1_6.UpdateRouterRampsConfig{ UpdatesByChain: updateRouterChanges, }, ), @@ -511,8 +516,8 @@ func setupLanes(e *deployment.Environment, state changeset.CCIPOnChainState) (de } _, err = commonchangeset.Apply(nil, *e, nil, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.ConfigureTokenPoolContractsChangeset), - changeset.ConfigureTokenPoolContractsConfig{ + deployment.CreateLegacyChangeSet(v1_5_1.ConfigureTokenPoolContractsChangeset), + v1_5_1.ConfigureTokenPoolContractsConfig{ TokenSymbol: changeset.LinkSymbol, PoolUpdates: poolUpdates, }, @@ -523,10 +528,10 @@ func setupLanes(e *deployment.Environment, state changeset.CCIPOnChainState) (de func mustOCR(e *deployment.Environment, homeChainSel uint64, feedChainSel uint64, newDons bool) (deployment.Environment, error) { chainSelectors := e.AllChainSelectors() - var ocrConfigPerSelector = make(map[uint64]changeset.CCIPOCRParams) + var ocrConfigPerSelector = make(map[uint64]v1_6.CCIPOCRParams) for selector := range e.Chains { - ocrConfigPerSelector[selector] = changeset.DeriveCCIPOCRParams(changeset.WithDefaultCommitOffChainConfig(feedChainSel, nil), - changeset.WithDefaultExecuteOffChainConfig(nil), + ocrConfigPerSelector[selector] = v1_6.DeriveCCIPOCRParams(v1_6.WithDefaultCommitOffChainConfig(feedChainSel, nil), + v1_6.WithDefaultExecuteOffChainConfig(nil), ) } @@ -534,13 +539,13 @@ func mustOCR(e *deployment.Environment, homeChainSel uint64, feedChainSel uint64 if newDons { commitChangeset = commonchangeset.Configure( // Add the DONs and candidate commit OCR instances for the chain - deployment.CreateLegacyChangeSet(changeset.AddDonAndSetCandidateChangeset), - changeset.AddDonAndSetCandidateChangesetConfig{ - SetCandidateConfigBase: changeset.SetCandidateConfigBase{ + deployment.CreateLegacyChangeSet(v1_6.AddDonAndSetCandidateChangeset), + v1_6.AddDonAndSetCandidateChangesetConfig{ + SetCandidateConfigBase: v1_6.SetCandidateConfigBase{ HomeChainSelector: homeChainSel, FeedChainSelector: feedChainSel, }, - PluginInfo: changeset.SetCandidatePluginInfo{ + PluginInfo: v1_6.SetCandidatePluginInfo{ OCRConfigPerRemoteChainSelector: ocrConfigPerSelector, PluginType: types.PluginTypeCCIPCommit, }, @@ -549,13 +554,13 @@ func mustOCR(e *deployment.Environment, homeChainSel uint64, feedChainSel uint64 } else { commitChangeset = commonchangeset.Configure( // Update commit OCR instances for existing chains - deployment.CreateLegacyChangeSet(changeset.SetCandidateChangeset), - changeset.SetCandidateChangesetConfig{ - SetCandidateConfigBase: changeset.SetCandidateConfigBase{ + deployment.CreateLegacyChangeSet(v1_6.SetCandidateChangeset), + v1_6.SetCandidateChangesetConfig{ + SetCandidateConfigBase: v1_6.SetCandidateConfigBase{ HomeChainSelector: homeChainSel, FeedChainSelector: feedChainSel, }, - PluginInfo: []changeset.SetCandidatePluginInfo{ + PluginInfo: []v1_6.SetCandidatePluginInfo{ { OCRConfigPerRemoteChainSelector: ocrConfigPerSelector, PluginType: types.PluginTypeCCIPCommit, @@ -569,13 +574,13 @@ func mustOCR(e *deployment.Environment, homeChainSel uint64, feedChainSel uint64 commitChangeset, commonchangeset.Configure( // Add the exec OCR instances for the new chains - deployment.CreateLegacyChangeSet(changeset.SetCandidateChangeset), - changeset.SetCandidateChangesetConfig{ - SetCandidateConfigBase: changeset.SetCandidateConfigBase{ + deployment.CreateLegacyChangeSet(v1_6.SetCandidateChangeset), + v1_6.SetCandidateChangesetConfig{ + SetCandidateConfigBase: v1_6.SetCandidateConfigBase{ HomeChainSelector: homeChainSel, FeedChainSelector: feedChainSel, }, - PluginInfo: []changeset.SetCandidatePluginInfo{ + PluginInfo: []v1_6.SetCandidatePluginInfo{ { OCRConfigPerRemoteChainSelector: ocrConfigPerSelector, PluginType: types.PluginTypeCCIPExec, @@ -585,10 +590,10 @@ func mustOCR(e *deployment.Environment, homeChainSel uint64, feedChainSel uint64 ), commonchangeset.Configure( // Promote everything - deployment.CreateLegacyChangeSet(changeset.PromoteCandidateChangeset), - changeset.PromoteCandidateChangesetConfig{ + deployment.CreateLegacyChangeSet(v1_6.PromoteCandidateChangeset), + v1_6.PromoteCandidateChangesetConfig{ HomeChainSelector: homeChainSel, - PluginInfo: []changeset.PromoteCandidatePluginInfo{ + PluginInfo: []v1_6.PromoteCandidatePluginInfo{ { RemoteChainSelectors: chainSelectors, PluginType: types.PluginTypeCCIPCommit, @@ -602,8 +607,8 @@ func mustOCR(e *deployment.Environment, homeChainSel uint64, feedChainSel uint64 ), commonchangeset.Configure( // Enable the OCR config on the remote chains - deployment.CreateLegacyChangeSet(changeset.SetOCR3OffRampChangeset), - changeset.SetOCR3OffRampConfig{ + deployment.CreateLegacyChangeSet(v1_6.SetOCR3OffRampChangeset), + v1_6.SetOCR3OffRampConfig{ HomeChainSel: homeChainSel, RemoteChainSels: chainSelectors, CCIPHomeConfigType: globals.ConfigTypeActive, diff --git a/integration-tests/load/ccip/ccip_test.go b/integration-tests/load/ccip/ccip_test.go index f23409334f4..a486742550e 100644 --- a/integration-tests/load/ccip/ccip_test.go +++ b/integration-tests/load/ccip/ccip_test.go @@ -13,12 +13,13 @@ import ( "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink/deployment" + ccipchangeset "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink-ccip/pkg/types/ccipocr3" "github.com/smartcontractkit/chainlink-common/pkg/logger" "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" "github.com/smartcontractkit/chainlink-testing-framework/wasp" - ccipchangeset "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" + "github.com/smartcontractkit/chainlink/deployment/environment/crib" tc "github.com/smartcontractkit/chainlink/integration-tests/testconfig" ) diff --git a/integration-tests/load/ccip/destination_gun.go b/integration-tests/load/ccip/destination_gun.go index bbf86ef8fe5..df5224b88ec 100644 --- a/integration-tests/load/ccip/destination_gun.go +++ b/integration-tests/load/ccip/destination_gun.go @@ -8,6 +8,7 @@ import ( "math/big" "math/rand" + ccipchangeset "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers" "github.com/ethereum/go-ethereum/accounts/abi/bind" @@ -18,7 +19,6 @@ import ( "github.com/smartcontractkit/chainlink-testing-framework/wasp" "github.com/smartcontractkit/chainlink/deployment" - ccipchangeset "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/integration-tests/testconfig/ccip" "github.com/smartcontractkit/chainlink-integrations/evm/utils" diff --git a/integration-tests/smoke/ccip/ccip_add_chain_test.go b/integration-tests/smoke/ccip/ccip_add_chain_test.go index fda84a94551..22c5acea9fa 100644 --- a/integration-tests/smoke/ccip/ccip_add_chain_test.go +++ b/integration-tests/smoke/ccip/ccip_add_chain_test.go @@ -10,7 +10,10 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/testcontext" + "github.com/smartcontractkit/chainlink/deployment" + state2 "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_6" ccipcs "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers" @@ -37,7 +40,7 @@ func Test_AddChain(t *testing.T) { testhelpers.WithPrerequisiteDeploymentOnly(nil), testhelpers.WithNumOfUsersPerChain(usersPerChain), testhelpers.WithNoJobsAndContracts(), - testhelpers.WithOCRConfigOverride(func(params *ccipcs.CCIPOCRParams) { + testhelpers.WithOCRConfigOverride(func(params *v1_6.CCIPOCRParams) { // Only 1 boost (=OCR round) is enough to cover the fee params.ExecuteOffChainConfig.RelativeBoostPerWaitHour = 1 }), @@ -55,7 +58,7 @@ func Test_AddChain(t *testing.T) { ///////////////////////////////////// e = setupChain(t, e, tEnv, toDeploy, false) - state, err := ccipcs.LoadOnchainState(e.Env) + state, err := state2.LoadOnchainState(e.Env) require.NoError(t, err) tEnv.UpdateDeployedEnvironment(e) // check RMNRemote is up and RMNProxy is correctly wired. @@ -175,7 +178,7 @@ func Test_AddChain(t *testing.T) { // transferred to MCMS. e = setupChain(t, e, tEnv, []uint64{remainingChain}, true) - state, err = ccipcs.LoadOnchainState(e.Env) + state, err = state2.LoadOnchainState(e.Env) require.NoError(t, err) tEnv.UpdateDeployedEnvironment(e) @@ -199,7 +202,7 @@ func Test_AddChain(t *testing.T) { true, // mcmsEnabled ) - state, err = ccipcs.LoadOnchainState(e.Env) + state, err = state2.LoadOnchainState(e.Env) require.NoError(t, err) assertChainWiringOutbound( @@ -317,7 +320,7 @@ func Test_AddChain(t *testing.T) { true, // mcmsEnabled ) - state, err = ccipcs.LoadOnchainState(e.Env) + state, err = state2.LoadOnchainState(e.Env) require.NoError(t, err) assertChainWiringOutbound( @@ -435,15 +438,15 @@ func setupInboundWiring( var err error e.Env, err = commonchangeset.Apply(t, e.Env, e.TimelockContracts(t), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(ccipcs.UpdateOffRampSourcesChangeset), - ccipcs.UpdateOffRampSourcesConfig{ + deployment.CreateLegacyChangeSet(v1_6.UpdateOffRampSourcesChangeset), + v1_6.UpdateOffRampSourcesConfig{ UpdatesByChain: offRampSourceUpdates(t, newChains, sources, testRouterEnabled), MCMS: mcmsConfig, }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(ccipcs.UpdateRouterRampsChangeset), - ccipcs.UpdateRouterRampsConfig{ + deployment.CreateLegacyChangeSet(v1_6.UpdateRouterRampsChangeset), + v1_6.UpdateRouterRampsConfig{ TestRouter: testRouterEnabled, UpdatesByChain: routerOffRampUpdates(t, newChains, sources), MCMS: mcmsConfig, @@ -476,29 +479,29 @@ func setupOutboundWiring( var err error e.Env, err = commonchangeset.Apply(t, e.Env, e.TimelockContracts(t), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(ccipcs.UpdateOnRampsDestsChangeset), - ccipcs.UpdateOnRampDestsConfig{ + deployment.CreateLegacyChangeSet(v1_6.UpdateOnRampsDestsChangeset), + v1_6.UpdateOnRampDestsConfig{ UpdatesByChain: onRampDestUpdates(t, newChains, sources, testRouterEnabled), MCMS: mcmsConfig, }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(ccipcs.UpdateFeeQuoterPricesChangeset), - ccipcs.UpdateFeeQuoterPricesConfig{ + deployment.CreateLegacyChangeSet(v1_6.UpdateFeeQuoterPricesChangeset), + v1_6.UpdateFeeQuoterPricesConfig{ PricesByChain: feeQuoterPricesByChain(t, newChains, sources), MCMS: mcmsConfig, }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(ccipcs.UpdateFeeQuoterDestsChangeset), - ccipcs.UpdateFeeQuoterDestsConfig{ + deployment.CreateLegacyChangeSet(v1_6.UpdateFeeQuoterDestsChangeset), + v1_6.UpdateFeeQuoterDestsConfig{ UpdatesByChain: feeQuoterDestUpdates(t, newChains, sources), MCMS: mcmsConfig, }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(ccipcs.UpdateRouterRampsChangeset), - ccipcs.UpdateRouterRampsConfig{ + deployment.CreateLegacyChangeSet(v1_6.UpdateRouterRampsChangeset), + v1_6.UpdateRouterRampsConfig{ TestRouter: testRouterEnabled, UpdatesByChain: routerOnRampUpdates(t, newChains, sources), MCMS: mcmsConfig, @@ -520,8 +523,8 @@ func setupChain(t *testing.T, e testhelpers.DeployedEnv, tEnv testhelpers.TestEn var err error e.Env, err = commonchangeset.Apply(t, e.Env, e.TimelockContracts(t), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(ccipcs.SetRMNRemoteOnRMNProxyChangeset), - ccipcs.SetRMNRemoteOnRMNProxyConfig{ + deployment.CreateLegacyChangeSet(v1_6.SetRMNRemoteOnRMNProxyChangeset), + v1_6.SetRMNRemoteOnRMNProxyConfig{ ChainSelectors: chains, }, ), @@ -536,7 +539,7 @@ func setupChain(t *testing.T, e testhelpers.DeployedEnv, tEnv testhelpers.TestEn // It doesn't check that the existingChains have the newChain enabled as a dest. func assertChainWiringInbound( t *testing.T, - state ccipcs.CCIPOnChainState, + state state2.CCIPOnChainState, newChain uint64, existingChains []uint64, testRouterEnabled bool, @@ -582,7 +585,7 @@ func assertChainWiringInbound( // It doesn't check that the newChain can process the requests. func assertChainWiringOutbound( t *testing.T, - state ccipcs.CCIPOnChainState, + state state2.CCIPOnChainState, newChain uint64, existingChains []uint64, testRouterEnabled bool, @@ -619,13 +622,13 @@ func assertChainWiringOutbound( } // routerOffRampUpdates adds the provided sources to the router of the provided dest chain. -func routerOffRampUpdates(t *testing.T, dests []uint64, sources []uint64) (updates map[uint64]ccipcs.RouterUpdates) { - updates = make(map[uint64]ccipcs.RouterUpdates) +func routerOffRampUpdates(t *testing.T, dests []uint64, sources []uint64) (updates map[uint64]v1_6.RouterUpdates) { + updates = make(map[uint64]v1_6.RouterUpdates) for _, source := range sources { for _, dest := range dests { require.NotEqual(t, source, dest) if _, ok := updates[dest]; !ok { - updates[dest] = ccipcs.RouterUpdates{ + updates[dest] = v1_6.RouterUpdates{ OffRampUpdates: map[uint64]bool{ source: true, }, @@ -640,13 +643,13 @@ func routerOffRampUpdates(t *testing.T, dests []uint64, sources []uint64) (updat // routerOnRampUpdates sets each dest selector in the given dest chains slice on the router // to point to the local onramp on each source chain. -func routerOnRampUpdates(t *testing.T, dests []uint64, sources []uint64) (updates map[uint64]ccipcs.RouterUpdates) { - updates = make(map[uint64]ccipcs.RouterUpdates) +func routerOnRampUpdates(t *testing.T, dests []uint64, sources []uint64) (updates map[uint64]v1_6.RouterUpdates) { + updates = make(map[uint64]v1_6.RouterUpdates) for _, source := range sources { for _, dest := range dests { require.NotEqual(t, source, dest) if _, ok := updates[source]; !ok { - updates[source] = ccipcs.RouterUpdates{ + updates[source] = v1_6.RouterUpdates{ OnRampUpdates: map[uint64]bool{ dest: true, }, @@ -668,17 +671,17 @@ func feeQuoterDestUpdates(t *testing.T, dests []uint64, sources []uint64) (updat if _, ok := updates[source]; !ok { updates[source] = make(map[uint64]fee_quoter.FeeQuoterDestChainConfig) } - updates[source][dest] = ccipcs.DefaultFeeQuoterDestChainConfig(true) + updates[source][dest] = v1_6.DefaultFeeQuoterDestChainConfig(true) } } return } // feeQuoterPricesByChain sets the gas price for the provided dests on the fee quoters in the provided sources. -func feeQuoterPricesByChain(t *testing.T, dests []uint64, sources []uint64) (prices map[uint64]ccipcs.FeeQuoterPriceUpdatePerSource) { - prices = make(map[uint64]ccipcs.FeeQuoterPriceUpdatePerSource) +func feeQuoterPricesByChain(t *testing.T, dests []uint64, sources []uint64) (prices map[uint64]v1_6.FeeQuoterPriceUpdatePerSource) { + prices = make(map[uint64]v1_6.FeeQuoterPriceUpdatePerSource) for _, source := range sources { - prices[source] = ccipcs.FeeQuoterPriceUpdatePerSource{ + prices[source] = v1_6.FeeQuoterPriceUpdatePerSource{ GasPrices: make(map[uint64]*big.Int), } for _, dest := range dests { @@ -690,20 +693,20 @@ func feeQuoterPricesByChain(t *testing.T, dests []uint64, sources []uint64) (pri } // onRampDestUpdates adds the provided dests as destination chains to the onRamps on the provided sources. -func onRampDestUpdates(t *testing.T, dests []uint64, sources []uint64, testRouterEnabled bool) (updates map[uint64]map[uint64]ccipcs.OnRampDestinationUpdate) { - updates = make(map[uint64]map[uint64]ccipcs.OnRampDestinationUpdate) +func onRampDestUpdates(t *testing.T, dests []uint64, sources []uint64, testRouterEnabled bool) (updates map[uint64]map[uint64]v1_6.OnRampDestinationUpdate) { + updates = make(map[uint64]map[uint64]v1_6.OnRampDestinationUpdate) for _, source := range sources { for _, dest := range dests { require.NotEqual(t, source, dest) if _, ok := updates[source]; !ok { - updates[source] = map[uint64]ccipcs.OnRampDestinationUpdate{ + updates[source] = map[uint64]v1_6.OnRampDestinationUpdate{ dest: { IsEnabled: true, TestRouter: testRouterEnabled, }, } } else { - updates[source][dest] = ccipcs.OnRampDestinationUpdate{ + updates[source][dest] = v1_6.OnRampDestinationUpdate{ IsEnabled: true, TestRouter: testRouterEnabled, } @@ -714,15 +717,15 @@ func onRampDestUpdates(t *testing.T, dests []uint64, sources []uint64, testRoute } // offRampSourceUpdates adds the provided sources to the offRamp on the provided dest chains. -func offRampSourceUpdates(t *testing.T, dests []uint64, sources []uint64, testRouterEnabled bool) (updates map[uint64]map[uint64]ccipcs.OffRampSourceUpdate) { - updates = make(map[uint64]map[uint64]ccipcs.OffRampSourceUpdate) +func offRampSourceUpdates(t *testing.T, dests []uint64, sources []uint64, testRouterEnabled bool) (updates map[uint64]map[uint64]v1_6.OffRampSourceUpdate) { + updates = make(map[uint64]map[uint64]v1_6.OffRampSourceUpdate) for _, source := range sources { for _, dest := range dests { require.NotEqual(t, source, dest) if _, ok := updates[dest]; !ok { - updates[dest] = make(map[uint64]ccipcs.OffRampSourceUpdate) + updates[dest] = make(map[uint64]v1_6.OffRampSourceUpdate) } - updates[dest][source] = ccipcs.OffRampSourceUpdate{ + updates[dest][source] = v1_6.OffRampSourceUpdate{ IsEnabled: true, TestRouter: testRouterEnabled, IsRMNVerificationDisabled: true, @@ -732,7 +735,7 @@ func offRampSourceUpdates(t *testing.T, dests []uint64, sources []uint64, testRo return } -func assertRMNRemoteAndProxyState(t *testing.T, chains []uint64, state ccipcs.CCIPOnChainState) { +func assertRMNRemoteAndProxyState(t *testing.T, chains []uint64, state state2.CCIPOnChainState) { for _, chain := range chains { require.NotEqual(t, common.Address{}, state.Chains[chain].RMNRemote.Address()) _, err := state.Chains[chain].RMNRemote.GetCursedSubjects(&bind.CallOpts{ @@ -756,7 +759,7 @@ func transferToMCMSAndRenounceTimelockDeployer( t *testing.T, e testhelpers.DeployedEnv, chains []uint64, - state ccipcs.CCIPOnChainState, + state state2.CCIPOnChainState, onlyChainContracts bool, ) { apps := make([]commonchangeset.ConfiguredChangeSet, 0, len(chains)+1) diff --git a/integration-tests/smoke/ccip/ccip_batching_test.go b/integration-tests/smoke/ccip/ccip_batching_test.go index 32ee6947d13..6b87a104a78 100644 --- a/integration-tests/smoke/ccip/ccip_batching_test.go +++ b/integration-tests/smoke/ccip/ccip_batching_test.go @@ -15,11 +15,11 @@ import ( "github.com/smartcontractkit/chainlink-ccip/pkg/types/ccipocr3" "github.com/smartcontractkit/chainlink-common/pkg/merklemulti" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers" testsetups "github.com/smartcontractkit/chainlink/integration-tests/testsetups/ccip" "github.com/smartcontractkit/chainlink/deployment" - "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/v1_2_0/router" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/v1_6_0/offramp" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/v1_6_0/onramp" diff --git a/integration-tests/smoke/ccip/ccip_cs_rmn_curse_uncurse_test.go b/integration-tests/smoke/ccip/ccip_cs_rmn_curse_uncurse_test.go index 5cc5540cd64..c5457d2bee6 100644 --- a/integration-tests/smoke/ccip/ccip_cs_rmn_curse_uncurse_test.go +++ b/integration-tests/smoke/ccip/ccip_cs_rmn_curse_uncurse_test.go @@ -9,6 +9,7 @@ import ( "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_6" commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" ) @@ -22,7 +23,7 @@ type curseAssertion struct { type CurseTestCase struct { name string - curseActionsBuilder func(mapIDToSelectorFunc) []changeset.CurseAction + curseActionsBuilder func(mapIDToSelectorFunc) []v1_6.CurseAction curseAssertions []curseAssertion } @@ -31,8 +32,8 @@ type mapIDToSelectorFunc func(uint64) uint64 var testCases = []CurseTestCase{ { name: "lane", - curseActionsBuilder: func(mapIDToSelector mapIDToSelectorFunc) []changeset.CurseAction { - return []changeset.CurseAction{changeset.CurseLaneBidirectionally(mapIDToSelector(0), mapIDToSelector(1))} + curseActionsBuilder: func(mapIDToSelector mapIDToSelectorFunc) []v1_6.CurseAction { + return []v1_6.CurseAction{v1_6.CurseLaneBidirectionally(mapIDToSelector(0), mapIDToSelector(1))} }, curseAssertions: []curseAssertion{ {chainID: 0, subject: 1, cursed: true}, @@ -45,10 +46,10 @@ var testCases = []CurseTestCase{ }, { name: "lane duplicate", - curseActionsBuilder: func(mapIDToSelector mapIDToSelectorFunc) []changeset.CurseAction { - return []changeset.CurseAction{ - changeset.CurseLaneBidirectionally(mapIDToSelector(0), mapIDToSelector(1)), - changeset.CurseLaneBidirectionally(mapIDToSelector(0), mapIDToSelector(1))} + curseActionsBuilder: func(mapIDToSelector mapIDToSelectorFunc) []v1_6.CurseAction { + return []v1_6.CurseAction{ + v1_6.CurseLaneBidirectionally(mapIDToSelector(0), mapIDToSelector(1)), + v1_6.CurseLaneBidirectionally(mapIDToSelector(0), mapIDToSelector(1))} }, curseAssertions: []curseAssertion{ {chainID: 0, subject: 1, cursed: true}, @@ -61,8 +62,8 @@ var testCases = []CurseTestCase{ }, { name: "chain", - curseActionsBuilder: func(mapIDToSelector mapIDToSelectorFunc) []changeset.CurseAction { - return []changeset.CurseAction{changeset.CurseChain(mapIDToSelector(0))} + curseActionsBuilder: func(mapIDToSelector mapIDToSelectorFunc) []v1_6.CurseAction { + return []v1_6.CurseAction{v1_6.CurseChain(mapIDToSelector(0))} }, curseAssertions: []curseAssertion{ {chainID: 0, globalCurse: true, cursed: true}, @@ -74,8 +75,8 @@ var testCases = []CurseTestCase{ }, { name: "chain duplicate", - curseActionsBuilder: func(mapIDToSelector mapIDToSelectorFunc) []changeset.CurseAction { - return []changeset.CurseAction{changeset.CurseChain(mapIDToSelector(0)), changeset.CurseChain(mapIDToSelector(0))} + curseActionsBuilder: func(mapIDToSelector mapIDToSelectorFunc) []v1_6.CurseAction { + return []v1_6.CurseAction{v1_6.CurseChain(mapIDToSelector(0)), v1_6.CurseChain(mapIDToSelector(0))} }, curseAssertions: []curseAssertion{ {chainID: 0, globalCurse: true, cursed: true}, @@ -87,8 +88,8 @@ var testCases = []CurseTestCase{ }, { name: "chain and lanes", - curseActionsBuilder: func(mapIDToSelector mapIDToSelectorFunc) []changeset.CurseAction { - return []changeset.CurseAction{changeset.CurseChain(mapIDToSelector(0)), changeset.CurseLaneBidirectionally(mapIDToSelector(1), mapIDToSelector(2))} + curseActionsBuilder: func(mapIDToSelector mapIDToSelectorFunc) []v1_6.CurseAction { + return []v1_6.CurseAction{v1_6.CurseChain(mapIDToSelector(0)), v1_6.CurseLaneBidirectionally(mapIDToSelector(1), mapIDToSelector(2))} }, curseAssertions: []curseAssertion{ {chainID: 0, globalCurse: true, cursed: true}, @@ -155,17 +156,17 @@ func runRmnUncurseTest(t *testing.T, tc CurseTestCase) { verifyNoActiveCurseOnAllChains(t, &e) - config := changeset.RMNCurseConfig{ + config := v1_6.RMNCurseConfig{ CurseActions: tc.curseActionsBuilder(mapIDToSelector), Reason: "test curse", } - _, err := changeset.RMNCurseChangeset(e.Env, config) + _, err := v1_6.RMNCurseChangeset(e.Env, config) require.NoError(t, err) verifyTestCaseAssertions(t, &e, tc, mapIDToSelector) - _, err = changeset.RMNUncurseChangeset(e.Env, config) + _, err = v1_6.RMNUncurseChangeset(e.Env, config) require.NoError(t, err) verifyNoActiveCurseOnAllChains(t, &e) @@ -173,7 +174,7 @@ func runRmnUncurseTest(t *testing.T, tc CurseTestCase) { func transferRMNContractToMCMS(t *testing.T, e *testhelpers.DeployedEnv, state changeset.CCIPOnChainState, timelocksPerChain map[uint64]*proposalutils.TimelockExecutionContracts) { contractsByChain := make(map[uint64][]common.Address) - rmnRemotePerChain := changeset.BuildRMNRemotePerChain(e.Env, state) + rmnRemotePerChain := v1_6.BuildRMNRemotePerChain(e.Env, state) rmnRemoteAddressesByChain := make(map[uint64]common.Address) for chain, remote := range rmnRemotePerChain { if remote == nil { @@ -207,7 +208,7 @@ func runRmnUncurseMCMSTest(t *testing.T, tc CurseTestCase) { return e.Env.AllChainSelectors()[id] } - config := changeset.RMNCurseConfig{ + config := v1_6.RMNCurseConfig{ CurseActions: tc.curseActionsBuilder(mapIDToSelector), Reason: "test curse", MCMS: &changeset.MCMSConfig{MinDelay: 0}, @@ -224,7 +225,7 @@ func runRmnUncurseMCMSTest(t *testing.T, tc CurseTestCase) { _, err = commonchangeset.Apply(t, e.Env, timelocksPerChain, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.RMNCurseChangeset), + deployment.CreateLegacyChangeSet(v1_6.RMNCurseChangeset), config, ), ) @@ -234,7 +235,7 @@ func runRmnUncurseMCMSTest(t *testing.T, tc CurseTestCase) { _, err = commonchangeset.Apply(t, e.Env, timelocksPerChain, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.RMNUncurseChangeset), + deployment.CreateLegacyChangeSet(v1_6.RMNUncurseChangeset), config, ), ) @@ -250,7 +251,7 @@ func runRmnCurseConfigValidateTest(t *testing.T, tc CurseTestCase) { return e.Env.AllChainSelectors()[id] } - config := changeset.RMNCurseConfig{ + config := v1_6.RMNCurseConfig{ CurseActions: tc.curseActionsBuilder(mapIDToSelector), Reason: "test curse", } @@ -268,12 +269,12 @@ func runRmnCurseTest(t *testing.T, tc CurseTestCase) { verifyNoActiveCurseOnAllChains(t, &e) - config := changeset.RMNCurseConfig{ + config := v1_6.RMNCurseConfig{ CurseActions: tc.curseActionsBuilder(mapIDToSelector), Reason: "test curse", } - _, err := changeset.RMNCurseChangeset(e.Env, config) + _, err := v1_6.RMNCurseChangeset(e.Env, config) require.NoError(t, err) verifyTestCaseAssertions(t, &e, tc, mapIDToSelector) @@ -288,15 +289,15 @@ func runRmnCurseIdempotentTest(t *testing.T, tc CurseTestCase) { verifyNoActiveCurseOnAllChains(t, &e) - config := changeset.RMNCurseConfig{ + config := v1_6.RMNCurseConfig{ CurseActions: tc.curseActionsBuilder(mapIDToSelector), Reason: "test curse", } - _, err := changeset.RMNCurseChangeset(e.Env, config) + _, err := v1_6.RMNCurseChangeset(e.Env, config) require.NoError(t, err) - _, err = changeset.RMNCurseChangeset(e.Env, config) + _, err = v1_6.RMNCurseChangeset(e.Env, config) require.NoError(t, err) verifyTestCaseAssertions(t, &e, tc, mapIDToSelector) @@ -311,20 +312,20 @@ func runRmnUncurseIdempotentTest(t *testing.T, tc CurseTestCase) { verifyNoActiveCurseOnAllChains(t, &e) - config := changeset.RMNCurseConfig{ + config := v1_6.RMNCurseConfig{ CurseActions: tc.curseActionsBuilder(mapIDToSelector), Reason: "test curse", } - _, err := changeset.RMNCurseChangeset(e.Env, config) + _, err := v1_6.RMNCurseChangeset(e.Env, config) require.NoError(t, err) verifyTestCaseAssertions(t, &e, tc, mapIDToSelector) - _, err = changeset.RMNUncurseChangeset(e.Env, config) + _, err = v1_6.RMNUncurseChangeset(e.Env, config) require.NoError(t, err) - _, err = changeset.RMNUncurseChangeset(e.Env, config) + _, err = v1_6.RMNUncurseChangeset(e.Env, config) require.NoError(t, err) verifyNoActiveCurseOnAllChains(t, &e) @@ -337,7 +338,7 @@ func runRmnCurseMCMSTest(t *testing.T, tc CurseTestCase) { return e.Env.AllChainSelectors()[id] } - config := changeset.RMNCurseConfig{ + config := v1_6.RMNCurseConfig{ CurseActions: tc.curseActionsBuilder(mapIDToSelector), Reason: "test curse", MCMS: &changeset.MCMSConfig{MinDelay: 0}, @@ -354,7 +355,7 @@ func runRmnCurseMCMSTest(t *testing.T, tc CurseTestCase) { _, err = commonchangeset.Apply(t, e.Env, timelocksPerChain, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.RMNCurseChangeset), + deployment.CreateLegacyChangeSet(v1_6.RMNCurseChangeset), config, ), ) @@ -368,9 +369,9 @@ func verifyTestCaseAssertions(t *testing.T, e *testhelpers.DeployedEnv, tc Curse require.NoError(t, err) for _, assertion := range tc.curseAssertions { - cursedSubject := changeset.SelectorToSubject(mapIDToSelector(assertion.subject)) + cursedSubject := v1_6.SelectorToSubject(mapIDToSelector(assertion.subject)) if assertion.globalCurse { - cursedSubject = changeset.GlobalCurseSubject() + cursedSubject = v1_6.GlobalCurseSubject() } isCursed, err := state.Chains[mapIDToSelector(assertion.chainID)].RMNRemote.IsCursed(nil, cursedSubject) diff --git a/integration-tests/smoke/ccip/ccip_cs_update_rmn_config_test.go b/integration-tests/smoke/ccip/ccip_cs_update_rmn_config_test.go index aa2e5477d8c..40997ccc1ee 100644 --- a/integration-tests/smoke/ccip/ccip_cs_update_rmn_config_test.go +++ b/integration-tests/smoke/ccip/ccip_cs_update_rmn_config_test.go @@ -10,6 +10,7 @@ import ( "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_6" commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" commontypes "github.com/smartcontractkit/chainlink/deployment/common/types" @@ -18,19 +19,19 @@ import ( ) var ( - rmnStaging1 = changeset.RMNNopConfig{ + rmnStaging1 = v1_6.RMNNopConfig{ NodeIndex: 0, PeerId: deployment.MustPeerIDFromString("p2p_12D3KooWRXxZq3pd4a3ZGkKj7Nt1SQQrnB8CuvbPnnV9KVeMeWqg"), OffchainPublicKey: [32]byte(common.FromHex("0xb34944857a42444d1b285d7940d6e06682309e0781e43a69676ee9f85c73c2d1")), EVMOnChainPublicKey: common.HexToAddress("0x5af8ee32316a6427f169a45fdc1b3a91a85ac459e3c1cb91c69e1c51f0c1fc21"), } - rmnStaging2 = changeset.RMNNopConfig{ + rmnStaging2 = v1_6.RMNNopConfig{ NodeIndex: 1, PeerId: deployment.MustPeerIDFromString("p2p_12D3KooWEmdxYQFsRbD9aFczF32zA3CcUwuSiWCk2CrmACo4v9RL"), OffchainPublicKey: [32]byte(common.FromHex("0x68d9f3f274e3985528a923a9bace3d39c55dd778b187b4120b384cc48c892859")), EVMOnChainPublicKey: common.HexToAddress("0x858589216956f482a0f68b282a7050af4cd48ed2"), } - rmnStaging3 = changeset.RMNNopConfig{ + rmnStaging3 = v1_6.RMNNopConfig{ NodeIndex: 2, PeerId: deployment.MustPeerIDFromString("p2p_12D3KooWJS42cNXKJvj6DeZnxEX7aGxhEuap6uNFrz554AbUDw6Q"), OffchainPublicKey: [32]byte(common.FromHex("0x5af8ee32316a6427f169a45fdc1b3a91a85ac459e3c1cb91c69e1c51f0c1fc21")), @@ -41,7 +42,7 @@ var ( type updateRMNConfigTestCase struct { useMCMS bool name string - nops []changeset.RMNNopConfig + nops []v1_6.RMNNopConfig } func TestUpdateRMNConfig(t *testing.T) { @@ -50,12 +51,12 @@ func TestUpdateRMNConfig(t *testing.T) { { useMCMS: true, name: "with MCMS", - nops: []changeset.RMNNopConfig{rmnStaging1, rmnStaging2, rmnStaging3}, + nops: []v1_6.RMNNopConfig{rmnStaging1, rmnStaging2, rmnStaging3}, }, { useMCMS: false, name: "without MCMS", - nops: []changeset.RMNNopConfig{rmnStaging1, rmnStaging2, rmnStaging3}, + nops: []v1_6.RMNNopConfig{rmnStaging1, rmnStaging2, rmnStaging3}, }, } @@ -73,13 +74,13 @@ func TestSetDynamicConfig(t *testing.T) { require.NoError(t, err) rmnHome := state.Chains[e.HomeChainSel].RMNHome - nops := []changeset.RMNNopConfig{rmnStaging1, rmnStaging2, rmnStaging3} + nops := []v1_6.RMNNopConfig{rmnStaging1, rmnStaging2, rmnStaging3} nodes := make([]rmn_home.RMNHomeNode, 0, len(nops)) for _, nop := range nops { nodes = append(nodes, nop.ToRMNHomeNode()) } - setRMNHomeCandidateConfig := changeset.SetRMNHomeCandidateConfig{ + setRMNHomeCandidateConfig := v1_6.SetRMNHomeCandidateConfig{ HomeChainSelector: e.HomeChainSel, RMNStaticConfig: rmn_home.RMNHomeStaticConfig{ Nodes: nodes, @@ -91,24 +92,24 @@ func TestSetDynamicConfig(t *testing.T) { }, } - _, err = changeset.SetRMNHomeCandidateConfigChangeset(e.Env, setRMNHomeCandidateConfig) + _, err = v1_6.SetRMNHomeCandidateConfigChangeset(e.Env, setRMNHomeCandidateConfig) require.NoError(t, err) candidate, err := rmnHome.GetCandidateDigest(nil) require.NoError(t, err) - promoteCandidateConfig := changeset.PromoteRMNHomeCandidateConfig{ + promoteCandidateConfig := v1_6.PromoteRMNHomeCandidateConfig{ HomeChainSelector: e.HomeChainSel, DigestToPromote: candidate, } - _, err = changeset.PromoteRMNHomeCandidateConfigChangeset(e.Env, promoteCandidateConfig) + _, err = v1_6.PromoteRMNHomeCandidateConfigChangeset(e.Env, promoteCandidateConfig) require.NoError(t, err) active, err := rmnHome.GetActiveDigest(nil) require.NoError(t, err) - setDynamicConfig := changeset.SetRMNHomeDynamicConfigConfig{ + setDynamicConfig := v1_6.SetRMNHomeDynamicConfigConfig{ HomeChainSelector: e.HomeChainSel, RMNDynamicConfig: rmn_home.RMNHomeDynamicConfig{ SourceChains: []rmn_home.RMNHomeSourceChain{ @@ -122,7 +123,7 @@ func TestSetDynamicConfig(t *testing.T) { ActiveDigest: active, } - _, err = changeset.SetRMNHomeDynamicConfigChangeset(e.Env, setDynamicConfig) + _, err = v1_6.SetRMNHomeDynamicConfigChangeset(e.Env, setDynamicConfig) require.NoError(t, err) dynamicConfig, err := rmnHome.GetConfig(nil, active) @@ -138,13 +139,13 @@ func TestRevokeConfig(t *testing.T) { require.NoError(t, err) rmnHome := state.Chains[e.HomeChainSel].RMNHome - nops := []changeset.RMNNopConfig{rmnStaging1, rmnStaging2, rmnStaging3} + nops := []v1_6.RMNNopConfig{rmnStaging1, rmnStaging2, rmnStaging3} nodes := make([]rmn_home.RMNHomeNode, 0, len(nops)) for _, nop := range nops { nodes = append(nodes, nop.ToRMNHomeNode()) } - setRMNHomeCandidateConfig := changeset.SetRMNHomeCandidateConfig{ + setRMNHomeCandidateConfig := v1_6.SetRMNHomeCandidateConfig{ HomeChainSelector: e.HomeChainSel, RMNStaticConfig: rmn_home.RMNHomeStaticConfig{ Nodes: nodes, @@ -156,18 +157,18 @@ func TestRevokeConfig(t *testing.T) { }, } - _, err = changeset.SetRMNHomeCandidateConfigChangeset(e.Env, setRMNHomeCandidateConfig) + _, err = v1_6.SetRMNHomeCandidateConfigChangeset(e.Env, setRMNHomeCandidateConfig) require.NoError(t, err) candidate, err := rmnHome.GetCandidateDigest(nil) require.NoError(t, err) - revokeCandidateConfig := changeset.RevokeCandidateConfig{ + revokeCandidateConfig := v1_6.RevokeCandidateConfig{ HomeChainSelector: e.HomeChainSel, CandidateDigest: candidate, } - _, err = changeset.RevokeRMNHomeCandidateConfigChangeset(e.Env, revokeCandidateConfig) + _, err = v1_6.RevokeRMNHomeCandidateConfigChangeset(e.Env, revokeCandidateConfig) require.NoError(t, err) newCandidate, err := rmnHome.GetCandidateDigest(nil) @@ -224,7 +225,7 @@ func updateRMNConfig(t *testing.T, tc updateRMNConfigTestCase) { nodes = append(nodes, nop.ToRMNHomeNode()) } - setRMNHomeCandidateConfig := changeset.SetRMNHomeCandidateConfig{ + setRMNHomeCandidateConfig := v1_6.SetRMNHomeCandidateConfig{ HomeChainSelector: e.HomeChainSel, RMNStaticConfig: rmn_home.RMNHomeStaticConfig{ Nodes: nodes, @@ -239,7 +240,7 @@ func updateRMNConfig(t *testing.T, tc updateRMNConfigTestCase) { _, err = commonchangeset.Apply(t, e.Env, timelocksPerChain, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.SetRMNHomeCandidateConfigChangeset), + deployment.CreateLegacyChangeSet(v1_6.SetRMNHomeCandidateConfigChangeset), setRMNHomeCandidateConfig, ), ) @@ -257,7 +258,7 @@ func updateRMNConfig(t *testing.T, tc updateRMNConfigTestCase) { require.NotEqual(t, previousCandidateDigest, currentCandidateDigest) require.Equal(t, previousActiveDigest, currentActiveDigest) - promoteConfig := changeset.PromoteRMNHomeCandidateConfig{ + promoteConfig := v1_6.PromoteRMNHomeCandidateConfig{ HomeChainSelector: e.HomeChainSel, DigestToPromote: currentCandidateDigest, MCMSConfig: mcmsConfig, @@ -265,7 +266,7 @@ func updateRMNConfig(t *testing.T, tc updateRMNConfigTestCase) { _, err = commonchangeset.Apply(t, e.Env, timelocksPerChain, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.PromoteRMNHomeCandidateConfigChangeset), + deployment.CreateLegacyChangeSet(v1_6.PromoteRMNHomeCandidateConfigChangeset), promoteConfig, ), ) @@ -281,9 +282,9 @@ func updateRMNConfig(t *testing.T, tc updateRMNConfigTestCase) { signers = append(signers, nop.ToRMNRemoteSigner()) } - remoteConfigs := make(map[uint64]changeset.RMNRemoteConfig, len(e.Env.Chains)) + remoteConfigs := make(map[uint64]v1_6.RMNRemoteConfig, len(e.Env.Chains)) for _, chain := range e.Env.Chains { - remoteConfig := changeset.RMNRemoteConfig{ + remoteConfig := v1_6.RMNRemoteConfig{ Signers: signers, F: 0, } @@ -291,7 +292,7 @@ func updateRMNConfig(t *testing.T, tc updateRMNConfigTestCase) { remoteConfigs[chain.Selector] = remoteConfig } - setRemoteConfig := changeset.SetRMNRemoteConfig{ + setRemoteConfig := v1_6.SetRMNRemoteConfig{ HomeChainSelector: e.HomeChainSel, RMNRemoteConfigs: remoteConfigs, MCMSConfig: mcmsConfig, @@ -299,13 +300,13 @@ func updateRMNConfig(t *testing.T, tc updateRMNConfigTestCase) { _, err = commonchangeset.Apply(t, e.Env, timelocksPerChain, commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.SetRMNRemoteConfigChangeset), + deployment.CreateLegacyChangeSet(v1_6.SetRMNRemoteConfigChangeset), setRemoteConfig, ), ) require.NoError(t, err) - rmnRemotePerChain := changeset.BuildRMNRemotePerChain(e.Env, state) + rmnRemotePerChain := v1_6.BuildRMNRemotePerChain(e.Env, state) for _, rmnRemote := range rmnRemotePerChain { remoteConfigSetEvents, err := rmnRemote.FilterConfigSet(nil, nil) require.NoError(t, err) @@ -319,7 +320,7 @@ func updateRMNConfig(t *testing.T, tc updateRMNConfigTestCase) { } func buildRMNRemoteAddressPerChain(e deployment.Environment, state changeset.CCIPOnChainState) map[uint64]common.Address { - rmnRemotePerChain := changeset.BuildRMNRemotePerChain(e, state) + rmnRemotePerChain := v1_6.BuildRMNRemotePerChain(e, state) rmnRemoteAddressPerChain := make(map[uint64]common.Address) for chain, remote := range rmnRemotePerChain { if remote == nil { @@ -371,15 +372,15 @@ func TestSetRMNRemoteOnRMNProxy(t *testing.T) { contractsByChain[chain] = []common.Address{rmnProxy.Address()} } timelockContractsPerChain := make(map[uint64]*proposalutils.TimelockExecutionContracts) - allContractParams := make(map[uint64]changeset.ChainContractParams) + allContractParams := make(map[uint64]v1_6.ChainContractParams) for _, chain := range allChains { timelockContractsPerChain[chain] = &proposalutils.TimelockExecutionContracts{ Timelock: state.Chains[chain].Timelock, CallProxy: state.Chains[chain].CallProxy, } - allContractParams[chain] = changeset.ChainContractParams{ - FeeQuoterParams: changeset.DefaultFeeQuoterParams(), - OffRampParams: changeset.DefaultOffRampParams(), + allContractParams[chain] = v1_6.ChainContractParams{ + FeeQuoterParams: v1_6.DefaultFeeQuoterParams(), + OffRampParams: v1_6.DefaultOffRampParams(), } } envNodes, err := deployment.NodeInfo(e.Env.NodeIDs, e.Env.Offchain) @@ -394,8 +395,8 @@ func TestSetRMNRemoteOnRMNProxy(t *testing.T) { }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.DeployHomeChainChangeset), - changeset.DeployHomeChainConfig{ + deployment.CreateLegacyChangeSet(v1_6.DeployHomeChainChangeset), + v1_6.DeployHomeChainConfig{ HomeChainSel: e.HomeChainSel, RMNDynamicConfig: testhelpers.NewTestRMNDynamicConfig(), RMNStaticConfig: testhelpers.NewTestRMNStaticConfig(), @@ -406,15 +407,15 @@ func TestSetRMNRemoteOnRMNProxy(t *testing.T) { }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.DeployChainContractsChangeset), - changeset.DeployChainContractsConfig{ + deployment.CreateLegacyChangeSet(v1_6.DeployChainContractsChangeset), + v1_6.DeployChainContractsConfig{ HomeChainSelector: e.HomeChainSel, ContractParamsPerChain: allContractParams, }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.SetRMNRemoteOnRMNProxyChangeset), - changeset.SetRMNRemoteOnRMNProxyConfig{ + deployment.CreateLegacyChangeSet(v1_6.SetRMNRemoteOnRMNProxyChangeset), + v1_6.SetRMNRemoteOnRMNProxyConfig{ ChainSelectors: allChains, MCMSConfig: &changeset.MCMSConfig{ MinDelay: 0, diff --git a/integration-tests/smoke/ccip/ccip_disable_lane_test.go b/integration-tests/smoke/ccip/ccip_disable_lane_test.go index 91c1f9f6a7f..e6381100d3a 100644 --- a/integration-tests/smoke/ccip/ccip_disable_lane_test.go +++ b/integration-tests/smoke/ccip/ccip_disable_lane_test.go @@ -15,6 +15,7 @@ import ( "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_6" testsetups "github.com/smartcontractkit/chainlink/integration-tests/testsetups/ccip" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/v1_2_0/router" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/v1_6_0/onramp" @@ -132,7 +133,7 @@ func TestDisableLane(t *testing.T) { state.Chains[pair.SourceChainSelector].LinkToken.Address(): linkPrice, state.Chains[pair.SourceChainSelector].Weth9.Address(): wethPrice, }, - changeset.DefaultFeeQuoterDestChainConfig(true)) + v1_6.DefaultFeeQuoterDestChainConfig(true)) } // send a message in all the lane including re-enabled lanes for _, pair := range pairs { diff --git a/integration-tests/smoke/ccip/ccip_fee_boosting_test.go b/integration-tests/smoke/ccip/ccip_fee_boosting_test.go index 8114cd3f803..e8e300b466f 100644 --- a/integration-tests/smoke/ccip/ccip_fee_boosting_test.go +++ b/integration-tests/smoke/ccip/ccip_fee_boosting_test.go @@ -8,7 +8,9 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/config" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_6" commoncs "github.com/smartcontractkit/chainlink/deployment/common/changeset" testsetups "github.com/smartcontractkit/chainlink/integration-tests/testsetups/ccip" @@ -24,7 +26,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/ccipevm" "github.com/smartcontractkit/chainlink/deployment" - "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/v1_2_0/router" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/v1_6_0/onramp" ) @@ -38,7 +39,7 @@ func Test_CCIPFeeBoosting(t *testing.T) { t.Skip("Skipping test as Fee Boosting is disabled") e, _, _ := testsetups.NewIntegrationEnvironment( t, - testhelpers.WithOCRConfigOverride(func(params *changeset.CCIPOCRParams) { + testhelpers.WithOCRConfigOverride(func(params *v1_6.CCIPOCRParams) { params.ExecuteOffChainConfig.RelativeBoostPerWaitHour = 1 // Disable token price updates params.CommitOffChainConfig.TokenPriceBatchWriteFrequency = *config.MustNewDuration(1_000_000 * time.Hour) @@ -81,7 +82,7 @@ func Test_CCIPFeeBoosting(t *testing.T) { ) t.Log("Adjusted gas price on dest chain:", adjustedGasPriceDest) - feeQuoterCfg := changeset.DefaultFeeQuoterDestChainConfig(true) + feeQuoterCfg := v1_6.DefaultFeeQuoterDestChainConfig(true) // the default adds 10% to the gas price, we want to increase it // to make sure the fee boosting will be finished in proper time for testing feeQuoterCfg.GasMultiplierWeiPerEth = 120e16 @@ -99,9 +100,9 @@ func Test_CCIPFeeBoosting(t *testing.T) { // Update token prices in destination chain FeeQuoter e.Env, err = commoncs.Apply(t, e.Env, e.TimelockContracts(t), commoncs.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateFeeQuoterPricesChangeset), - changeset.UpdateFeeQuoterPricesConfig{ - PricesByChain: map[uint64]changeset.FeeQuoterPriceUpdatePerSource{ + deployment.CreateLegacyChangeSet(v1_6.UpdateFeeQuoterPricesChangeset), + v1_6.UpdateFeeQuoterPricesConfig{ + PricesByChain: map[uint64]v1_6.FeeQuoterPriceUpdatePerSource{ destChain: { TokenPrices: map[common.Address]*big.Int{ state.Chains[destChain].LinkToken.Address(): linkPrice, @@ -140,9 +141,9 @@ func Test_CCIPFeeBoosting(t *testing.T) { e.Env, err = commoncs.Apply(t, e.Env, e.TimelockContracts(t), commoncs.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateFeeQuoterPricesChangeset), - changeset.UpdateFeeQuoterPricesConfig{ - PricesByChain: map[uint64]changeset.FeeQuoterPriceUpdatePerSource{ + deployment.CreateLegacyChangeSet(v1_6.UpdateFeeQuoterPricesChangeset), + v1_6.UpdateFeeQuoterPricesConfig{ + PricesByChain: map[uint64]v1_6.FeeQuoterPriceUpdatePerSource{ sourceChain: { GasPrices: map[uint64]*big.Int{ destChain: originalGasPriceDestUSD, diff --git a/integration-tests/smoke/ccip/ccip_gas_price_updates_test.go b/integration-tests/smoke/ccip/ccip_gas_price_updates_test.go index 37668260c51..96e99ec4929 100644 --- a/integration-tests/smoke/ccip/ccip_gas_price_updates_test.go +++ b/integration-tests/smoke/ccip/ccip_gas_price_updates_test.go @@ -16,6 +16,7 @@ import ( "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_6" testsetups "github.com/smartcontractkit/chainlink/integration-tests/testsetups/ccip" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/v1_6_0/fee_quoter" ) @@ -28,7 +29,7 @@ func Test_CCIPGasPriceUpdates(t *testing.T) { var gasPriceExpiry = 5 * time.Second e, _, _ := testsetups.NewIntegrationEnvironment(t, - testhelpers.WithOCRConfigOverride(func(params *changeset.CCIPOCRParams) { + testhelpers.WithOCRConfigOverride(func(params *v1_6.CCIPOCRParams) { params.CommitOffChainConfig.RemoteGasPriceBatchWriteFrequency = *config.MustNewDuration(gasPriceExpiry) }), ) diff --git a/integration-tests/smoke/ccip/ccip_migration_to_v_1_6_test.go b/integration-tests/smoke/ccip/ccip_migration_to_v_1_6_test.go index 5e6279f5748..ec689da2a13 100644 --- a/integration-tests/smoke/ccip/ccip_migration_to_v_1_6_test.go +++ b/integration-tests/smoke/ccip/ccip_migration_to_v_1_6_test.go @@ -15,10 +15,12 @@ import ( "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/testcontext" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_6" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/v1_5_0/evm_2_evm_onramp" "github.com/smartcontractkit/chainlink/deployment" - "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers" v1_5testhelpers "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers/v1_5" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_5" @@ -189,8 +191,8 @@ func TestMigrateFromV1_5ToV1_6(t *testing.T) { e.Env, err = commonchangeset.Apply(t, e.Env, e.TimelockContracts(t), commonchangeset.Configure( // as we have already transferred ownership for RMNProxy to MCMS, it needs to be done via MCMS proposal - deployment.CreateLegacyChangeSet(changeset.SetRMNRemoteOnRMNProxyChangeset), - changeset.SetRMNRemoteOnRMNProxyConfig{ + deployment.CreateLegacyChangeSet(v1_6.SetRMNRemoteOnRMNProxyChangeset), + v1_6.SetRMNRemoteOnRMNProxyConfig{ ChainSelectors: e.Env.AllChainSelectors(), MCMSConfig: &changeset.MCMSConfig{ MinDelay: 0, @@ -198,12 +200,12 @@ func TestMigrateFromV1_5ToV1_6(t *testing.T) { }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateNonceManagersChangeset), - changeset.UpdateNonceManagerConfig{ + deployment.CreateLegacyChangeSet(v1_6.UpdateNonceManagersChangeset), + v1_6.UpdateNonceManagerConfig{ // we only have lanes between src1 --> dest - UpdatesByChain: map[uint64]changeset.NonceManagerUpdate{ + UpdatesByChain: map[uint64]v1_6.NonceManagerUpdate{ src1: { - PreviousRampsArgs: []changeset.PreviousRampCfg{ + PreviousRampsArgs: []v1_6.PreviousRampCfg{ { RemoteChainSelector: dest, AllowEmptyOffRamp: true, @@ -211,7 +213,7 @@ func TestMigrateFromV1_5ToV1_6(t *testing.T) { }, }, src2: { - PreviousRampsArgs: []changeset.PreviousRampCfg{ + PreviousRampsArgs: []v1_6.PreviousRampCfg{ { RemoteChainSelector: dest, AllowEmptyOffRamp: true, @@ -219,7 +221,7 @@ func TestMigrateFromV1_5ToV1_6(t *testing.T) { }, }, dest: { - PreviousRampsArgs: []changeset.PreviousRampCfg{ + PreviousRampsArgs: []v1_6.PreviousRampCfg{ { RemoteChainSelector: src1, AllowEmptyOnRamp: true, @@ -287,9 +289,9 @@ func TestMigrateFromV1_5ToV1_6(t *testing.T) { // now that the 1.6 lane is working, we can enable the real router e.Env, err = commonchangeset.Apply(t, e.Env, e.TimelockContracts(t), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateOnRampsDestsChangeset), - changeset.UpdateOnRampDestsConfig{ - UpdatesByChain: map[uint64]map[uint64]changeset.OnRampDestinationUpdate{ + deployment.CreateLegacyChangeSet(v1_6.UpdateOnRampsDestsChangeset), + v1_6.UpdateOnRampDestsConfig{ + UpdatesByChain: map[uint64]map[uint64]v1_6.OnRampDestinationUpdate{ src1: { dest: { IsEnabled: true, @@ -301,9 +303,9 @@ func TestMigrateFromV1_5ToV1_6(t *testing.T) { }, ), commonchangeset.Configure( - deployment.CreateLegacyChangeSet(changeset.UpdateOffRampSourcesChangeset), - changeset.UpdateOffRampSourcesConfig{ - UpdatesByChain: map[uint64]map[uint64]changeset.OffRampSourceUpdate{ + deployment.CreateLegacyChangeSet(v1_6.UpdateOffRampSourcesChangeset), + v1_6.UpdateOffRampSourcesConfig{ + UpdatesByChain: map[uint64]map[uint64]v1_6.OffRampSourceUpdate{ dest: { src1: { IsEnabled: true, @@ -316,13 +318,13 @@ func TestMigrateFromV1_5ToV1_6(t *testing.T) { ), commonchangeset.Configure( // this needs to be MCMS proposal as the router contract is owned by MCMS - deployment.CreateLegacyChangeSet(changeset.UpdateRouterRampsChangeset), - changeset.UpdateRouterRampsConfig{ + deployment.CreateLegacyChangeSet(v1_6.UpdateRouterRampsChangeset), + v1_6.UpdateRouterRampsConfig{ TestRouter: false, MCMS: &changeset.MCMSConfig{ MinDelay: 0, }, - UpdatesByChain: map[uint64]changeset.RouterUpdates{ + UpdatesByChain: map[uint64]v1_6.RouterUpdates{ // onRamp update on source chain src1: { OnRampUpdates: map[uint64]bool{ diff --git a/integration-tests/smoke/ccip/ccip_reader_test.go b/integration-tests/smoke/ccip/ccip_reader_test.go index 7d07fa92ade..a45d47f58ba 100644 --- a/integration-tests/smoke/ccip/ccip_reader_test.go +++ b/integration-tests/smoke/ccip/ccip_reader_test.go @@ -19,8 +19,14 @@ import ( "github.com/stretchr/testify/require" "go.uber.org/zap/zapcore" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_6" "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/ccipevm" "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/ccipsolana" + + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers" + "github.com/smartcontractkit/chainlink/deployment/environment/memory" + "github.com/smartcontractkit/chainlink/integration-tests/utils/pgtest" ccipcommon "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/common" readermocks "github.com/smartcontractkit/chainlink-ccip/mocks/pkg/contractreader" @@ -29,11 +35,6 @@ import ( ccipreaderpkg "github.com/smartcontractkit/chainlink-ccip/pkg/reader" cciptypes "github.com/smartcontractkit/chainlink-ccip/pkg/types/ccipocr3" "github.com/smartcontractkit/chainlink-ccip/plugintypes" - "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" - "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers" - "github.com/smartcontractkit/chainlink/deployment/environment/memory" - "github.com/smartcontractkit/chainlink/integration-tests/utils/pgtest" - "github.com/smartcontractkit/chainlink-common/pkg/types" "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" @@ -946,7 +947,7 @@ func Test_GetMedianDataAvailabilityGasConfig(t *testing.T) { boundContracts := map[cciptypes.ChainSelector][]types.BoundContract{} for i, selector := range env.Env.AllChainSelectorsExcluding([]uint64{destChain}) { feeQuoter := state.Chains[selector].FeeQuoter - destChainCfg := changeset.DefaultFeeQuoterDestChainConfig(true) + destChainCfg := v1_6.DefaultFeeQuoterDestChainConfig(true) //nolint:gosec // disable G115 destChainCfg.DestDataAvailabilityOverheadGas = uint32(100 + i) //nolint:gosec // disable G115 diff --git a/integration-tests/smoke/ccip/ccip_rmn_test.go b/integration-tests/smoke/ccip/ccip_rmn_test.go index 9197b75454b..351864e4d7c 100644 --- a/integration-tests/smoke/ccip/ccip_rmn_test.go +++ b/integration-tests/smoke/ccip/ccip_rmn_test.go @@ -25,6 +25,7 @@ import ( "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_6" "github.com/smartcontractkit/chainlink/deployment/environment/devenv" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/v1_2_0/router" @@ -323,7 +324,7 @@ func runRmnTestCase(t *testing.T, tc rmnTestCase) { candidateDigest, err := homeChainState.RMNHome.GetCandidateDigest(&bind.CallOpts{Context: ctx}) require.NoError(t, err) - _, err = changeset.SetRMNHomeCandidateConfigChangeset(envWithRMN.Env, changeset.SetRMNHomeCandidateConfig{ + _, err = v1_6.SetRMNHomeCandidateConfigChangeset(envWithRMN.Env, v1_6.SetRMNHomeCandidateConfig{ HomeChainSelector: envWithRMN.HomeChainSel, RMNStaticConfig: staticConfig, RMNDynamicConfig: dynamicConfig, @@ -337,7 +338,7 @@ func runRmnTestCase(t *testing.T, tc rmnTestCase) { t.Logf("RMNHome candidateDigest after setting new candidate: %x", candidateDigest[:]) t.Logf("Promoting RMNHome candidate with candidateDigest: %x", candidateDigest[:]) - _, err = changeset.PromoteRMNHomeCandidateConfigChangeset(envWithRMN.Env, changeset.PromoteRMNHomeCandidateConfig{ + _, err = v1_6.PromoteRMNHomeCandidateConfigChangeset(envWithRMN.Env, v1_6.PromoteRMNHomeCandidateConfig{ HomeChainSelector: envWithRMN.HomeChainSel, DigestToPromote: candidateDigest, }) @@ -350,19 +351,19 @@ func runRmnTestCase(t *testing.T, tc rmnTestCase) { "active digest should be the same as the previously candidate digest after promotion, previous candidate: %x, active: %x", candidateDigest[:], activeDigest[:]) - rmnRemoteConfig := make(map[uint64]changeset.RMNRemoteConfig) + rmnRemoteConfig := make(map[uint64]v1_6.RMNRemoteConfig) for _, remoteCfg := range tc.remoteChainsConfig { selector := tc.pf.chainSelectors[remoteCfg.chainIdx] if remoteCfg.f < 0 { t.Fatalf("remoteCfg.f is negative: %d", remoteCfg.f) } - rmnRemoteConfig[selector] = changeset.RMNRemoteConfig{ + rmnRemoteConfig[selector] = v1_6.RMNRemoteConfig{ F: uint64(remoteCfg.f), Signers: tc.alterSigners(t, tc.pf.rmnRemoteSigners), } } - _, err = changeset.SetRMNRemoteConfigChangeset(envWithRMN.Env, changeset.SetRMNRemoteConfig{ + _, err = v1_6.SetRMNRemoteConfigChangeset(envWithRMN.Env, v1_6.SetRMNRemoteConfig{ HomeChainSelector: envWithRMN.HomeChainSel, RMNRemoteConfigs: rmnRemoteConfig, }) @@ -738,15 +739,15 @@ func (tc rmnTestCase) callContractsToCurseChains(ctx context.Context, t *testing } for _, subjectDescription := range cursedSubjects { - curseActions := make([]changeset.CurseAction, 0) + curseActions := make([]v1_6.CurseAction, 0) if subjectDescription == globalCurse { - curseActions = append(curseActions, changeset.CurseGloballyOnlyOnChain(remoteSel)) + curseActions = append(curseActions, v1_6.CurseGloballyOnlyOnChain(remoteSel)) } else { - curseActions = append(curseActions, changeset.CurseLaneOnlyOnSource(remoteSel, tc.pf.chainSelectors[subjectDescription])) + curseActions = append(curseActions, v1_6.CurseLaneOnlyOnSource(remoteSel, tc.pf.chainSelectors[subjectDescription])) } - _, err := changeset.RMNCurseChangeset(envWithRMN.Env, changeset.RMNCurseConfig{ + _, err := v1_6.RMNCurseChangeset(envWithRMN.Env, v1_6.RMNCurseConfig{ CurseActions: curseActions, Reason: "test curse", }) @@ -770,15 +771,15 @@ func (tc rmnTestCase) callContractsToCurseAndRevokeCurse(ctx context.Context, eg cursedSubjects := tc.revokedCursedSubjectsPerChain[remoteCfg.chainIdx] for subjectDescription, revokeAfter := range cursedSubjects { - curseActions := make([]changeset.CurseAction, 0) + curseActions := make([]v1_6.CurseAction, 0) if subjectDescription == globalCurse { - curseActions = append(curseActions, changeset.CurseGloballyOnlyOnChain(remoteSel)) + curseActions = append(curseActions, v1_6.CurseGloballyOnlyOnChain(remoteSel)) } else { - curseActions = append(curseActions, changeset.CurseLaneOnlyOnSource(remoteSel, tc.pf.chainSelectors[subjectDescription])) + curseActions = append(curseActions, v1_6.CurseLaneOnlyOnSource(remoteSel, tc.pf.chainSelectors[subjectDescription])) } - _, err := changeset.RMNCurseChangeset(envWithRMN.Env, changeset.RMNCurseConfig{ + _, err := v1_6.RMNCurseChangeset(envWithRMN.Env, v1_6.RMNCurseConfig{ CurseActions: curseActions, Reason: "test curse", }) @@ -788,7 +789,7 @@ func (tc rmnTestCase) callContractsToCurseAndRevokeCurse(ctx context.Context, eg <-time.NewTimer(revokeAfter).C t.Logf("revoking curse on subject %d (%d)", subjectDescription, subjectDescription) - _, err := changeset.RMNUncurseChangeset(envWithRMN.Env, changeset.RMNCurseConfig{ + _, err := v1_6.RMNUncurseChangeset(envWithRMN.Env, v1_6.RMNCurseConfig{ CurseActions: curseActions, Reason: "test uncurse", }) diff --git a/integration-tests/smoke/ccip/ccip_token_price_updates_test.go b/integration-tests/smoke/ccip/ccip_token_price_updates_test.go index 9e852e97923..12ada106764 100644 --- a/integration-tests/smoke/ccip/ccip_token_price_updates_test.go +++ b/integration-tests/smoke/ccip/ccip_token_price_updates_test.go @@ -20,6 +20,7 @@ import ( "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_6" testsetups "github.com/smartcontractkit/chainlink/integration-tests/testsetups/ccip" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/v1_6_0/fee_quoter" ) @@ -30,7 +31,7 @@ func Test_CCIPTokenPriceUpdates(t *testing.T) { var tokenPriceExpiry = 5 * time.Second e, _, _ := testsetups.NewIntegrationEnvironment(t, - testhelpers.WithOCRConfigOverride(func(params *changeset.CCIPOCRParams) { + testhelpers.WithOCRConfigOverride(func(params *v1_6.CCIPOCRParams) { params.CommitOffChainConfig.TokenPriceBatchWriteFrequency = *config.MustNewDuration(tokenPriceExpiry) })) state, err := changeset.LoadOnchainState(e.Env) diff --git a/integration-tests/testsetups/ccip/test_helpers.go b/integration-tests/testsetups/ccip/test_helpers.go index a094cce761f..221ebd8c638 100644 --- a/integration-tests/testsetups/ccip/test_helpers.go +++ b/integration-tests/testsetups/ccip/test_helpers.go @@ -33,6 +33,7 @@ import ( "github.com/smartcontractkit/chainlink-testing-framework/seth" evmcfg "github.com/smartcontractkit/chainlink-integrations/evm/config/toml" + "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers"