Skip to content

chore: remove the legacy TransferToMCMS changeset #17719

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deployment/ccip/changeset/v1_6/accept_ownership_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func Test_NewAcceptOwnershipChangeset(t *testing.T) {
_, err = commonchangeset.Apply(t, e.Env, timelockContracts,
// note this doesn't have proposals.
commonchangeset.Configure(
cldf.CreateLegacyChangeSet(commonchangeset.TransferToMCMSWithTimelock),
cldf.CreateLegacyChangeSet(commonchangeset.TransferToMCMSWithTimelockV2),
testhelpers.GenTestTransferOwnershipConfig(e, allChains, state, true),
),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func Test_ActiveCandidate(t *testing.T) {
// and set new config digest on the offramp.
_, err = commonchangeset.Apply(t, tenv.Env, tenv.TimelockContracts(t),
commonchangeset.Configure(
cldf.CreateLegacyChangeSet(commonchangeset.TransferToMCMSWithTimelock),
cldf.CreateLegacyChangeSet(commonchangeset.TransferToMCMSWithTimelockV2),
testhelpers.GenTestTransferOwnershipConfig(tenv, allChains, state, true),
),
)
Expand Down
4 changes: 2 additions & 2 deletions deployment/ccip/changeset/v1_6/cs_add_new_chain_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func TestConnectNewChain(t *testing.T) {
}
e, err = commonchangeset.Apply(t, e, timelockContracts,
commonchangeset.Configure(
cldf.CreateLegacyChangeSet(commoncs.TransferToMCMSWithTimelock),
cldf.CreateLegacyChangeSet(commoncs.TransferToMCMSWithTimelockV2),
commoncs.TransferToMCMSWithTimelockConfig{
ContractsByChain: contractsToTransfer,
MCMSConfig: proposalutils.TimelockConfig{
Expand Down Expand Up @@ -367,7 +367,7 @@ func TestAddAndPromoteCandidatesForNewChain(t *testing.T) {
)
e, err = commonchangeset.Apply(t, e, timelockContracts,
commonchangeset.Configure(
cldf.CreateLegacyChangeSet(commoncs.TransferToMCMSWithTimelock),
cldf.CreateLegacyChangeSet(commoncs.TransferToMCMSWithTimelockV2),
commoncs.TransferToMCMSWithTimelockConfig{
ContractsByChain: contractsToTransfer,
MCMSConfig: proposalutils.TimelockConfig{
Expand Down
6 changes: 3 additions & 3 deletions deployment/ccip/changeset/v1_6/cs_home_chain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func TestRemoveDons(t *testing.T) {
},
},
commoncs.Configure(
cldf.CreateLegacyChangeSet(commoncs.TransferToMCMSWithTimelock),
cldf.CreateLegacyChangeSet(commoncs.TransferToMCMSWithTimelockV2),
commoncs.TransferToMCMSWithTimelockConfig{
ContractsByChain: map[uint64][]common.Address{
e.HomeChainSel: {homeChain.CapabilityRegistry.Address()},
Expand Down Expand Up @@ -402,7 +402,7 @@ func TestAddUpdateAndRemoveNops(t *testing.T) {
},
},
commoncs.Configure(
cldf.CreateLegacyChangeSet(commoncs.TransferToMCMSWithTimelock),
cldf.CreateLegacyChangeSet(commoncs.TransferToMCMSWithTimelockV2),
commoncs.TransferToMCMSWithTimelockConfig{
ContractsByChain: map[uint64][]common.Address{
e.HomeChainSel: {homeChain.CapabilityRegistry.Address()},
Expand Down Expand Up @@ -560,7 +560,7 @@ func TestRemoveNodes(t *testing.T) {
},
},
commoncs.Configure(
cldf.CreateLegacyChangeSet(commoncs.TransferToMCMSWithTimelock),
cldf.CreateLegacyChangeSet(commoncs.TransferToMCMSWithTimelockV2),
commoncs.TransferToMCMSWithTimelockConfig{
ContractsByChain: map[uint64][]common.Address{
e.HomeChainSel: {homeChain.CapabilityRegistry.Address()},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ func TestUpdateBidirectiConalLanesChangeset(t *testing.T) {
}
e, err = commonchangeset.Apply(t, e, timelockContracts,
commonchangeset.Configure(
cldf.CreateLegacyChangeSet(commoncs.TransferToMCMSWithTimelock),
cldf.CreateLegacyChangeSet(commoncs.TransferToMCMSWithTimelockV2),
commoncs.TransferToMCMSWithTimelockConfig{
ContractsByChain: contractsToTransfer,
MCMSConfig: proposalutils.TimelockConfig{
Expand Down
6 changes: 3 additions & 3 deletions deployment/ccip/shared/deployergroup/deployer_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ func TestDeployerGroupMCMS(t *testing.T) {

_, err = commonchangeset.Apply(t, e.Env, timelocksPerChain,
commonchangeset.Configure(
cldf.CreateLegacyChangeSet(commonchangeset.TransferToMCMSWithTimelock),
cldf.CreateLegacyChangeSet(commonchangeset.TransferToMCMSWithTimelockV2),
commonchangeset.TransferToMCMSWithTimelockConfig{
ContractsByChain: contractsByChain,
MCMSConfig: proposalutils.TimelockConfig{
Expand Down Expand Up @@ -322,7 +322,7 @@ func TestDeployerGroupGenerateMultipleProposals(t *testing.T) {

_, err = commonchangeset.Apply(t, e.Env, timelocksPerChain,
commonchangeset.Configure(
cldf.CreateLegacyChangeSet(commonchangeset.TransferToMCMSWithTimelock),
cldf.CreateLegacyChangeSet(commonchangeset.TransferToMCMSWithTimelockV2),
commonchangeset.TransferToMCMSWithTimelockConfig{
ContractsByChain: contractsByChain,
MCMSConfig: proposalutils.TimelockConfig{
Expand Down Expand Up @@ -388,7 +388,7 @@ func TestDeployerGroupMultipleProposalsMCMS(t *testing.T) {

_, err = commonchangeset.Apply(t, e.Env, timelocksPerChain,
commonchangeset.Configure(
cldf.CreateLegacyChangeSet(commonchangeset.TransferToMCMSWithTimelock),
cldf.CreateLegacyChangeSet(commonchangeset.TransferToMCMSWithTimelockV2),
commonchangeset.TransferToMCMSWithTimelockConfig{
ContractsByChain: contractsByChain,
MCMSConfig: proposalutils.TimelockConfig{
Expand Down
75 changes: 1 addition & 74 deletions deployment/common/changeset/transfer_to_mcms_with_timelock.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,13 @@ import (
"github.com/ethereum/go-ethereum/common"
gethtypes "github.com/ethereum/go-ethereum/core/types"
owner_helpers "github.com/smartcontractkit/ccip-owner-contracts/pkg/gethwrappers"
"github.com/smartcontractkit/ccip-owner-contracts/pkg/proposal/mcms"
"github.com/smartcontractkit/ccip-owner-contracts/pkg/proposal/timelock"
mcmslib "github.com/smartcontractkit/mcms"
"github.com/smartcontractkit/mcms/sdk"
"github.com/smartcontractkit/mcms/sdk/evm"
mcmstypes "github.com/smartcontractkit/mcms/types"

"github.com/smartcontractkit/chainlink-evm/gethwrappers/shared/generated/burn_mint_erc677"

cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment"

"github.com/smartcontractkit/chainlink-evm/gethwrappers/shared/generated/burn_mint_erc677"
"github.com/smartcontractkit/chainlink/deployment/common/proposalutils"
"github.com/smartcontractkit/chainlink/deployment/common/types"
)
Expand Down Expand Up @@ -83,75 +79,6 @@ func (t TransferToMCMSWithTimelockConfig) Validate(e cldf.Environment) error {
return nil
}

var _ cldf.ChangeSet[TransferToMCMSWithTimelockConfig] = TransferToMCMSWithTimelock

// TransferToMCMSWithTimelock creates a changeset that transfers ownership of all the
// contracts in the provided configuration to the timelock on the chain and generates
// a corresponding accept ownership proposal to complete the transfer.
// It assumes that DeployMCMSWithTimelockV2 has already been run s.t.
// the timelock and mcmses exist on the chain and that the proposed addresses to transfer ownership
// are currently owned by the deployer key.
// Deprecated: Use TransferToMCMSWithTimelockV2 instead.
func TransferToMCMSWithTimelock(
e cldf.Environment,
cfg TransferToMCMSWithTimelockConfig,
) (cldf.ChangesetOutput, error) {
if err := cfg.Validate(e); err != nil {
return cldf.ChangesetOutput{}, err
}
var batches []timelock.BatchChainOperation
timelocksByChain := make(map[uint64]common.Address)
proposersByChain := make(map[uint64]*owner_helpers.ManyChainMultiSig)
for chainSelector, contracts := range cfg.ContractsByChain {
// Already validated that the timelock/proposer exists.
timelockAddr, _ := cldf.SearchAddressBook(e.ExistingAddresses, chainSelector, types.RBACTimelock)
proposerAddr, _ := cldf.SearchAddressBook(e.ExistingAddresses, chainSelector, types.ProposerManyChainMultisig)
timelocksByChain[chainSelector] = common.HexToAddress(timelockAddr)
proposer, err := owner_helpers.NewManyChainMultiSig(common.HexToAddress(proposerAddr), e.Chains[chainSelector].Client)
if err != nil {
return cldf.ChangesetOutput{}, fmt.Errorf("failed to create proposer mcms: %w", err)
}
proposersByChain[chainSelector] = proposer

var ops []mcms.Operation
for _, contract := range contracts {
// Just using the ownership interface.
// Already validated is ownable.
owner, c, _ := LoadOwnableContract(contract, e.Chains[chainSelector].Client)
if owner.String() == timelockAddr {
// Already owned by timelock.
e.Logger.Infof("contract %s already owned by timelock", contract)
continue
}
tx, err := c.TransferOwnership(e.Chains[chainSelector].DeployerKey, common.HexToAddress(timelockAddr))
_, err = cldf.ConfirmIfNoError(e.Chains[chainSelector], tx, err)
if err != nil {
return cldf.ChangesetOutput{}, fmt.Errorf("failed to transfer ownership of contract %T: %w", contract, err)
}
tx, err = c.AcceptOwnership(cldf.SimTransactOpts())
if err != nil {
return cldf.ChangesetOutput{}, fmt.Errorf("failed to generate accept ownership calldata of %s: %w", contract, err)
}
ops = append(ops, mcms.Operation{
To: contract,
Data: tx.Data(),
Value: big.NewInt(0),
})
}
batches = append(batches, timelock.BatchChainOperation{
ChainIdentifier: mcms.ChainIdentifier(chainSelector),
Batch: ops,
})
}
proposal, err := proposalutils.BuildProposalFromBatches(
timelocksByChain, proposersByChain, batches, "Transfer ownership to timelock", cfg.MCMSConfig.MinDelay)
if err != nil {
return cldf.ChangesetOutput{}, fmt.Errorf("failed to build proposal from batch: %w, batches: %+v", err, batches)
}

return cldf.ChangesetOutput{Proposals: []timelock.MCMSWithTimelockProposal{*proposal}}, nil
}

var _ cldf.ChangeSet[TransferToMCMSWithTimelockConfig] = TransferToMCMSWithTimelockV2

// TransferToMCMSWithTimelockV2 is a reimplementation of TransferToMCMSWithTimelock which uses the new MCMS library.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,71 +19,6 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/logger"
)

func TestTransferToMCMSWithTimelock(t *testing.T) {
lggr := logger.TestLogger(t)
e := memory.NewMemoryEnvironment(t, lggr, 0, memory.MemoryEnvironmentConfig{
Chains: 1,
Nodes: 1,
})
chain1 := e.AllChainSelectors()[0]
e, err := Apply(t, e, nil,
Configure(
cldf.CreateLegacyChangeSet(DeployLinkToken),
[]uint64{chain1},
),
Configure(
cldf.CreateLegacyChangeSet(DeployMCMSWithTimelockV2),
map[uint64]types.MCMSWithTimelockConfigV2{
chain1: proposalutils.SingleGroupTimelockConfigV2(t),
},
),
)
require.NoError(t, err)
addrs, err := e.ExistingAddresses.AddressesForChain(chain1)
require.NoError(t, err)
state, err := MaybeLoadMCMSWithTimelockChainState(e.Chains[chain1], addrs)
require.NoError(t, err)
link, err := MaybeLoadLinkTokenChainState(e.Chains[chain1], addrs)
require.NoError(t, err)
e, err = Apply(t, e,
map[uint64]*proposalutils.TimelockExecutionContracts{
chain1: {Timelock: state.Timelock, CallProxy: state.CallProxy},
},
Configure(
cldf.CreateLegacyChangeSet(TransferToMCMSWithTimelock),
TransferToMCMSWithTimelockConfig{
ContractsByChain: map[uint64][]common.Address{
chain1: {link.LinkToken.Address()},
},
MCMSConfig: proposalutils.TimelockConfig{MinDelay: 0},
},
),
)
require.NoError(t, err)
// We expect now that the link token is owned by the MCMS timelock.
link, err = MaybeLoadLinkTokenChainState(e.Chains[chain1], addrs)
require.NoError(t, err)
o, err := link.LinkToken.Owner(nil)
require.NoError(t, err)
require.Equal(t, state.Timelock.Address(), o)

// Try a rollback to the deployer.
e, err = Apply(t, e, nil,
Configure(
cldf.CreateLegacyChangeSet(TransferToDeployer),
TransferToDeployerConfig{
ContractAddress: link.LinkToken.Address(),
ChainSel: chain1,
},
),
)
require.NoError(t, err)

o, err = link.LinkToken.Owner(nil)
require.NoError(t, err)
require.Equal(t, e.Chains[chain1].DeployerKey.From, o)
}

func TestTransferToMCMSWithTimelockV2(t *testing.T) {
lggr := logger.TestLogger(t)
e := memory.NewMemoryEnvironment(t, lggr, 0, memory.MemoryEnvironmentConfig{
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/smoke/ccip/ccip_add_chain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ func transferToMCMSAndRenounceTimelockDeployer(
cfg.ContractsByChain[e.HomeChainSel] = chainContracts
}
apps = append(apps, commonchangeset.Configure(
cldf.CreateLegacyChangeSet(commonchangeset.TransferToMCMSWithTimelock),
cldf.CreateLegacyChangeSet(commonchangeset.TransferToMCMSWithTimelockV2),
cfg,
))
for _, chain := range chains {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ func transferRMNContractToMCMS(t *testing.T, e *testhelpers.DeployedEnv, state s
// This is required because RMN Contracts is initially owned by the deployer
_, err := commonchangeset.Apply(t, e.Env, timelocksPerChain,
commonchangeset.Configure(
cldf.CreateLegacyChangeSet(commonchangeset.TransferToMCMSWithTimelock),
cldf.CreateLegacyChangeSet(commonchangeset.TransferToMCMSWithTimelockV2),
commonchangeset.TransferToMCMSWithTimelockConfig{
ContractsByChain: contractsByChain,
MCMSConfig: proposalutils.TimelockConfig{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func updateRMNConfig(t *testing.T, tc updateRMNConfigTestCase) {
// This is required because RMNHome is initially owned by the deployer
_, err = commonchangeset.Apply(t, e.Env, timelocksPerChain,
commonchangeset.Configure(
cldf.CreateLegacyChangeSet(commonchangeset.TransferToMCMSWithTimelock),
cldf.CreateLegacyChangeSet(commonchangeset.TransferToMCMSWithTimelockV2),
commonchangeset.TransferToMCMSWithTimelockConfig{
ContractsByChain: contractsByChain,
MCMSConfig: proposalutils.TimelockConfig{
Expand Down Expand Up @@ -396,7 +396,7 @@ func TestSetRMNRemoteOnRMNProxy(t *testing.T) {
e.Env, err = commonchangeset.Apply(t, e.Env, timelockContractsPerChain,
// transfer ownership of RMNProxy to timelock
commonchangeset.Configure(
cldf.CreateLegacyChangeSet(commonchangeset.TransferToMCMSWithTimelock),
cldf.CreateLegacyChangeSet(commonchangeset.TransferToMCMSWithTimelockV2),
commonchangeset.TransferToMCMSWithTimelockConfig{
ContractsByChain: contractsByChain,
MCMSConfig: proposalutils.TimelockConfig{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ func TestMigrateFromV1_5ToV1_6(t *testing.T) {

e.Env, err = commonchangeset.Apply(t, e.Env, e.TimelockContracts(t),
commonchangeset.Configure(
cldf.CreateLegacyChangeSet(commonchangeset.TransferToMCMSWithTimelock),
cldf.CreateLegacyChangeSet(commonchangeset.TransferToMCMSWithTimelockV2),
commonchangeset.TransferToMCMSWithTimelockConfig{
ContractsByChain: contractsByChain,
MCMSConfig: proposalutils.TimelockConfig{
Expand Down
Loading