From b634d368a786624c4edd5f07581fe735094b61a2 Mon Sep 17 00:00:00 2001 From: Connor Stein Date: Mon, 23 Sep 2024 17:50:33 -0400 Subject: [PATCH] Bump owner dep (#14531) * Bump owner dep * Address mcms lib changes --- .../deployment/ccip/add_chain.go | 33 ++++++++------ integration-tests/deployment/ccip/propose.go | 44 +++++++++++-------- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 +- 4 files changed, 48 insertions(+), 35 deletions(-) diff --git a/integration-tests/deployment/ccip/add_chain.go b/integration-tests/deployment/ccip/add_chain.go index 550d6168a15..0ae87d38344 100644 --- a/integration-tests/deployment/ccip/add_chain.go +++ b/integration-tests/deployment/ccip/add_chain.go @@ -3,6 +3,7 @@ package ccipdeployment import ( "math/big" + "github.com/ethereum/go-ethereum/common" "github.com/smartcontractkit/ccip-owner-contracts/tools/proposal/mcms" "github.com/smartcontractkit/ccip-owner-contracts/tools/proposal/timelock" @@ -33,7 +34,8 @@ func NewChainInboundProposal( ) (*timelock.MCMSWithTimelockProposal, error) { // Generate proposal which enables new destination (from test router) on all source chains. var batches []timelock.BatchChainOperation - metaDataPerChain := make(map[mcms.ChainIdentifier]timelock.MCMSWithTimelockChainMetadata) + metaDataPerChain := make(map[mcms.ChainIdentifier]mcms.ChainMetadata) + timelockAddresses := make(map[mcms.ChainIdentifier]common.Address) for _, source := range sources { chain, _ := chainsel.ChainBySelector(source) enableOnRampDest, err := state.Chains[source].OnRamp.ApplyDestChainConfigUpdates(SimTransactOpts(), []onramp.OnRampDestChainConfigArgs{ @@ -92,13 +94,15 @@ func NewChainInboundProposal( }, }, }) - metaDataPerChain[mcms.ChainIdentifier(chain.Selector)] = timelock.MCMSWithTimelockChainMetadata{ - ChainMetadata: mcms.ChainMetadata{ - NonceOffset: 0, - MCMAddress: state.Chains[source].Mcm.Address(), - }, - TimelockAddress: state.Chains[source].Timelock.Address(), + opCount, err := state.Chains[source].Mcm.GetOpCount(nil) + if err != nil { + return nil, err + } + metaDataPerChain[mcms.ChainIdentifier(chain.Selector)] = mcms.ChainMetadata{ + StartingOpCount: opCount.Uint64(), + MCMAddress: state.Chains[source].Mcm.Address(), } + timelockAddresses[mcms.ChainIdentifier(chain.Selector)] = state.Chains[source].Timelock.Address() } // Home chain new don. @@ -146,13 +150,15 @@ func NewChainInboundProposal( return nil, err } homeChain, _ := chainsel.ChainBySelector(homeChainSel) - metaDataPerChain[mcms.ChainIdentifier(homeChain.Selector)] = timelock.MCMSWithTimelockChainMetadata{ - ChainMetadata: mcms.ChainMetadata{ - NonceOffset: 0, - MCMAddress: state.Chains[homeChainSel].Mcm.Address(), - }, - TimelockAddress: state.Chains[homeChainSel].Timelock.Address(), + opCount, err := state.Chains[homeChainSel].Mcm.GetOpCount(nil) + if err != nil { + return nil, err + } + metaDataPerChain[mcms.ChainIdentifier(homeChain.Selector)] = mcms.ChainMetadata{ + StartingOpCount: opCount.Uint64(), + MCMAddress: state.Chains[homeChainSel].Mcm.Address(), } + timelockAddresses[mcms.ChainIdentifier(homeChain.Selector)] = state.Chains[homeChainSel].Timelock.Address() batches = append(batches, timelock.BatchChainOperation{ ChainIdentifier: mcms.ChainIdentifier(homeChain.Selector), Batch: []mcms.Operation{ @@ -175,6 +181,7 @@ func NewChainInboundProposal( []mcms.Signature{}, false, metaDataPerChain, + timelockAddresses, "blah", // TODO batches, timelock.Schedule, diff --git a/integration-tests/deployment/ccip/propose.go b/integration-tests/deployment/ccip/propose.go index eced93dde0f..fca971aaf0d 100644 --- a/integration-tests/deployment/ccip/propose.go +++ b/integration-tests/deployment/ccip/propose.go @@ -34,9 +34,7 @@ func SignProposal(t *testing.T, env deployment.Environment, proposal *timelock.M chainSel := mcms.ChainIdentifier(chainselc.Selector) executorClients[chainSel] = chain.Client } - realProposal, err := proposal.ToMCMSOnlyProposal() - require.NoError(t, err) - executor, err := realProposal.ToExecutor(executorClients) + executor, err := proposal.ToExecutor(true) require.NoError(t, err) payload, err := executor.SigningHash() require.NoError(t, err) @@ -45,7 +43,7 @@ func SignProposal(t *testing.T, env deployment.Environment, proposal *timelock.M require.NoError(t, err) mcmSig, err := mcms.NewSignatureFromBytes(sig) require.NoError(t, err) - executor.Proposal.Signatures = append(executor.Proposal.Signatures, mcmSig) + executor.Proposal.AddSignature(mcmSig) require.NoError(t, executor.Proposal.Validate()) return executor } @@ -53,7 +51,7 @@ func SignProposal(t *testing.T, env deployment.Environment, proposal *timelock.M func ExecuteProposal(t *testing.T, env deployment.Environment, executor *mcms.Executor, state CCIPOnChainState, sel uint64) { // Set the root. - tx, err2 := executor.SetRootOnChain(env.Chains[sel].DeployerKey, mcms.ChainIdentifier(sel)) + tx, err2 := executor.SetRootOnChain(env.Chains[sel].Client, env.Chains[sel].DeployerKey, mcms.ChainIdentifier(sel)) require.NoError(t, err2) _, err2 = env.Chains[sel].Confirm(tx) require.NoError(t, err2) @@ -63,7 +61,7 @@ func ExecuteProposal(t *testing.T, env deployment.Environment, executor *mcms.Ex for _, chainOp := range executor.Operations[mcms.ChainIdentifier(sel)] { for idx, op := range executor.ChainAgnosticOps { if bytes.Equal(op.Data, chainOp.Data) && op.To == chainOp.To { - opTx, err3 := executor.ExecuteOnChain(env.Chains[sel].DeployerKey, idx) + opTx, err3 := executor.ExecuteOnChain(env.Chains[sel].Client, env.Chains[sel].DeployerKey, idx) require.NoError(t, err3) block, err3 := env.Chains[sel].Confirm(opTx) require.NoError(t, err3) @@ -104,7 +102,8 @@ func GenerateAcceptOwnershipProposal( ) (*timelock.MCMSWithTimelockProposal, error) { // TODO: Accept rest of contracts var batches []timelock.BatchChainOperation - metaDataPerChain := make(map[mcms.ChainIdentifier]timelock.MCMSWithTimelockChainMetadata) + metaDataPerChain := make(map[mcms.ChainIdentifier]mcms.ChainMetadata) + timelockAddresses := make(map[mcms.ChainIdentifier]common.Address) for _, sel := range chains { chain, _ := chainsel.ChainBySelector(sel) acceptOnRamp, err := state.Chains[sel].OnRamp.AcceptOwnership(SimTransactOpts()) @@ -116,13 +115,15 @@ func GenerateAcceptOwnershipProposal( return nil, err } chainSel := mcms.ChainIdentifier(chain.Selector) - metaDataPerChain[chainSel] = timelock.MCMSWithTimelockChainMetadata{ - ChainMetadata: mcms.ChainMetadata{ - NonceOffset: 0, - MCMAddress: state.Chains[sel].Mcm.Address(), - }, - TimelockAddress: state.Chains[sel].Timelock.Address(), + opCount, err := state.Chains[sel].Mcm.GetOpCount(nil) + if err != nil { + return nil, err + } + metaDataPerChain[chainSel] = mcms.ChainMetadata{ + MCMAddress: state.Chains[sel].Mcm.Address(), + StartingOpCount: opCount.Uint64(), } + timelockAddresses[chainSel] = state.Chains[sel].Timelock.Address() batches = append(batches, timelock.BatchChainOperation{ ChainIdentifier: chainSel, Batch: []mcms.Operation{ @@ -139,6 +140,7 @@ func GenerateAcceptOwnershipProposal( }, }) } + acceptCR, err := state.Chains[homeChain].CapabilityRegistry.AcceptOwnership(SimTransactOpts()) if err != nil { return nil, err @@ -148,13 +150,15 @@ func GenerateAcceptOwnershipProposal( return nil, err } homeChainID := mcms.ChainIdentifier(homeChain) - metaDataPerChain[homeChainID] = timelock.MCMSWithTimelockChainMetadata{ - ChainMetadata: mcms.ChainMetadata{ - NonceOffset: 0, - MCMAddress: state.Chains[homeChain].Mcm.Address(), - }, - TimelockAddress: state.Chains[homeChain].Timelock.Address(), + opCount, err := state.Chains[homeChain].Mcm.GetOpCount(nil) + if err != nil { + return nil, err } + metaDataPerChain[homeChainID] = mcms.ChainMetadata{ + StartingOpCount: opCount.Uint64(), + MCMAddress: state.Chains[homeChain].Mcm.Address(), + } + timelockAddresses[homeChainID] = state.Chains[homeChain].Timelock.Address() batches = append(batches, timelock.BatchChainOperation{ ChainIdentifier: homeChainID, Batch: []mcms.Operation{ @@ -170,12 +174,14 @@ func GenerateAcceptOwnershipProposal( }, }, }) + return timelock.NewMCMSWithTimelockProposal( "1", 2004259681, // TODO []mcms.Signature{}, false, metaDataPerChain, + timelockAddresses, "blah", // TODO batches, timelock.Schedule, "0s") diff --git a/integration-tests/go.mod b/integration-tests/go.mod index dbfda153c5a..6188a31caef 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -36,7 +36,7 @@ require ( github.com/sethvargo/go-retry v0.2.4 github.com/shopspring/decimal v1.4.0 github.com/slack-go/slack v0.12.2 - github.com/smartcontractkit/ccip-owner-contracts v0.0.0-20240910151738-3f318badcfb5 + github.com/smartcontractkit/ccip-owner-contracts v0.0.0-20240919155713-f4bf4ae0b9c6 github.com/smartcontractkit/chain-selectors v1.0.23 github.com/smartcontractkit/chainlink-automation v1.0.4 github.com/smartcontractkit/chainlink-ccip v0.0.0-20240920150748-cf2125c094fe diff --git a/integration-tests/go.sum b/integration-tests/go.sum index dace088e6dc..9f7881750d6 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1417,8 +1417,8 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/slack-go/slack v0.12.2 h1:x3OppyMyGIbbiyFhsBmpf9pwkUzMhthJMRNmNlA4LaQ= github.com/slack-go/slack v0.12.2/go.mod h1:hlGi5oXA+Gt+yWTPP0plCdRKmjsDxecdHxYQdlMQKOw= -github.com/smartcontractkit/ccip-owner-contracts v0.0.0-20240910151738-3f318badcfb5 h1:m0HuGuVdRHqBBkHJpSR/QBV7gtLB+hFkXZQ9tEkjdzo= -github.com/smartcontractkit/ccip-owner-contracts v0.0.0-20240910151738-3f318badcfb5/go.mod h1:N60/wwocvZ5A3RGmYaMWo0fPFa5tTMlhI9lJ22DRktM= +github.com/smartcontractkit/ccip-owner-contracts v0.0.0-20240919155713-f4bf4ae0b9c6 h1:e4lR/xTK7iOeCniSwH6hdaNZZ/sJs1eYWpnJoz3CXxI= +github.com/smartcontractkit/ccip-owner-contracts v0.0.0-20240919155713-f4bf4ae0b9c6/go.mod h1:nlRI0m23HFMAHf7cKYdE58mPbXsTyY1y3ZLJxnuuoCM= github.com/smartcontractkit/chain-selectors v1.0.23 h1:D2Eaex4Cw/O7Lg3tX6WklOqnjjIQAEBnutCtksPzVDY= github.com/smartcontractkit/chain-selectors v1.0.23/go.mod h1:d4Hi+E1zqjy9HqMkjBE5q1vcG9VGgxf5VxiRHfzi2kE= github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8umfIfVVlwC7+n5izbLSFgjw8=