diff --git a/deployment/ccip/changeset/accept_ownership_test.go b/deployment/ccip/changeset/accept_ownership_test.go index 796db6aed09..c4cf9e93217 100644 --- a/deployment/ccip/changeset/accept_ownership_test.go +++ b/deployment/ccip/changeset/accept_ownership_test.go @@ -30,8 +30,8 @@ func Test_NewAcceptOwnershipChangeset(t *testing.T) { dest := allChains[1] timelocks := map[uint64]*gethwrappers.RBACTimelock{ - source: state.Chains[source].Timelock, - dest: state.Chains[dest].Timelock, + source: state.EVMState.Chains[source].Timelock, + dest: state.EVMState.Chains[dest].Timelock, } // at this point we have the initial deploys done, now we need to transfer ownership @@ -64,23 +64,23 @@ func genTestTransferOwnershipConfig( // chain contracts for _, chain := range chains { - timelocksPerChain[chain] = state.Chains[chain].Timelock.Address() + timelocksPerChain[chain] = state.EVMState.Chains[chain].Timelock.Address() contracts[chain] = []common.Address{ - state.Chains[chain].OnRamp.Address(), - state.Chains[chain].OffRamp.Address(), - state.Chains[chain].FeeQuoter.Address(), - state.Chains[chain].NonceManager.Address(), - state.Chains[chain].RMNRemote.Address(), + state.EVMState.Chains[chain].OnRamp.Address(), + state.EVMState.Chains[chain].OffRamp.Address(), + state.EVMState.Chains[chain].FeeQuoter.Address(), + state.EVMState.Chains[chain].NonceManager.Address(), + state.EVMState.Chains[chain].RMNRemote.Address(), } } // home chain - homeChainTimelockAddress := state.Chains[e.HomeChainSel].Timelock.Address() + homeChainTimelockAddress := state.EVMState.Chains[e.HomeChainSel].Timelock.Address() timelocksPerChain[e.HomeChainSel] = homeChainTimelockAddress contracts[e.HomeChainSel] = append(contracts[e.HomeChainSel], - state.Chains[e.HomeChainSel].CapabilityRegistry.Address(), - state.Chains[e.HomeChainSel].CCIPHome.Address(), - state.Chains[e.HomeChainSel].RMNHome.Address(), + state.EVMState.Chains[e.HomeChainSel].CapabilityRegistry.Address(), + state.EVMState.Chains[e.HomeChainSel].CCIPHome.Address(), + state.EVMState.Chains[e.HomeChainSel].RMNHome.Address(), ) return commonchangeset.TransferToMCMSWithTimelockConfig{ @@ -99,26 +99,26 @@ func assertTimelockOwnership( // check that the ownership has been transferred correctly for _, chain := range chains { for _, contract := range []common.Address{ - state.Chains[chain].OnRamp.Address(), - state.Chains[chain].OffRamp.Address(), - state.Chains[chain].FeeQuoter.Address(), - state.Chains[chain].NonceManager.Address(), - state.Chains[chain].RMNRemote.Address(), + state.EVMState.Chains[chain].OnRamp.Address(), + state.EVMState.Chains[chain].OffRamp.Address(), + state.EVMState.Chains[chain].FeeQuoter.Address(), + state.EVMState.Chains[chain].NonceManager.Address(), + state.EVMState.Chains[chain].RMNRemote.Address(), } { - owner, _, err := commonchangeset.LoadOwnableContract(contract, e.Env.Chains[chain].Client) + owner, _, err := commonchangeset.LoadOwnableContract(contract, e.Env.Chains[chain].EVMChain.Client) require.NoError(t, err) - require.Equal(t, state.Chains[chain].Timelock.Address(), owner) + require.Equal(t, state.EVMState.Chains[chain].Timelock.Address(), owner) } } // check home chain contracts ownership - homeChainTimelockAddress := state.Chains[e.HomeChainSel].Timelock.Address() + homeChainTimelockAddress := state.EVMState.Chains[e.HomeChainSel].Timelock.Address() for _, contract := range []common.Address{ - state.Chains[e.HomeChainSel].CapabilityRegistry.Address(), - state.Chains[e.HomeChainSel].CCIPHome.Address(), - state.Chains[e.HomeChainSel].RMNHome.Address(), + state.EVMState.Chains[e.HomeChainSel].CapabilityRegistry.Address(), + state.EVMState.Chains[e.HomeChainSel].CCIPHome.Address(), + state.EVMState.Chains[e.HomeChainSel].RMNHome.Address(), } { - owner, _, err := commonchangeset.LoadOwnableContract(contract, e.Env.Chains[e.HomeChainSel].Client) + owner, _, err := commonchangeset.LoadOwnableContract(contract, e.Env.Chains[e.HomeChainSel].EVMChain.Client) require.NoError(t, err) require.Equal(t, homeChainTimelockAddress, owner) } diff --git a/deployment/ccip/changeset/cs_active_candidate.go b/deployment/ccip/changeset/cs_active_candidate.go index 29516b36736..2a14f0e0e26 100644 --- a/deployment/ccip/changeset/cs_active_candidate.go +++ b/deployment/ccip/changeset/cs_active_candidate.go @@ -26,8 +26,8 @@ func PromoteAllCandidatesChangeset( nodes deployment.Nodes, ) (deployment.ChangesetOutput, error) { promoteCandidateOps, err := promoteAllCandidatesForChainOps( - state.Chains[homeChainSel].CapabilityRegistry, - state.Chains[homeChainSel].CCIPHome, + state.EVMState.Chains[homeChainSel].CapabilityRegistry, + state.EVMState.Chains[homeChainSel].CCIPHome, newChainSel, nodes.NonBootstraps(), ) @@ -37,10 +37,10 @@ func PromoteAllCandidatesChangeset( var ( timelocksPerChain = map[uint64]common.Address{ - homeChainSel: state.Chains[homeChainSel].Timelock.Address(), + homeChainSel: state.EVMState.Chains[homeChainSel].Timelock.Address(), } proposerMCMSes = map[uint64]*gethwrappers.ManyChainMultiSig{ - homeChainSel: state.Chains[homeChainSel].ProposerMcm, + homeChainSel: state.EVMState.Chains[homeChainSel].ProposerMcm, } ) prop, err := proposalutils.BuildProposalFromBatches( @@ -76,15 +76,15 @@ func SetCandidatePluginChangeset( ) (deployment.ChangesetOutput, error) { ccipOCRParams := DefaultOCRParams( feedChainSel, - tokenConfig.GetTokenInfo(e.Logger, state.Chains[newChainSel].LinkToken, state.Chains[newChainSel].Weth9), + tokenConfig.GetTokenInfo(e.Logger, state.EVMState.Chains[newChainSel].LinkToken, state.EVMState.Chains[newChainSel].Weth9), nil, ) newDONArgs, err := internal.BuildOCR3ConfigForCCIPHome( ocrSecrets, - state.Chains[newChainSel].OffRamp, + state.EVMState.Chains[newChainSel].OffRamp, e.Chains[newChainSel], nodes.NonBootstraps(), - state.Chains[homeChainSel].RMNHome.Address(), + state.EVMState.Chains[homeChainSel].RMNHome.Address(), ccipOCRParams.OCRParameters, ccipOCRParams.CommitOffChainConfig, ccipOCRParams.ExecuteOffChainConfig, @@ -100,8 +100,8 @@ func SetCandidatePluginChangeset( setCandidateMCMSOps, err := setCandidateOnExistingDon( execConfig, - state.Chains[homeChainSel].CapabilityRegistry, - state.Chains[homeChainSel].CCIPHome, + state.EVMState.Chains[homeChainSel].CapabilityRegistry, + state.EVMState.Chains[homeChainSel].CCIPHome, newChainSel, nodes.NonBootstraps(), ) @@ -111,10 +111,10 @@ func SetCandidatePluginChangeset( var ( timelocksPerChain = map[uint64]common.Address{ - homeChainSel: state.Chains[homeChainSel].Timelock.Address(), + homeChainSel: state.EVMState.Chains[homeChainSel].Timelock.Address(), } proposerMCMSes = map[uint64]*gethwrappers.ManyChainMultiSig{ - homeChainSel: state.Chains[homeChainSel].ProposerMcm, + homeChainSel: state.EVMState.Chains[homeChainSel].ProposerMcm, } ) prop, err := proposalutils.BuildProposalFromBatches( diff --git a/deployment/ccip/changeset/cs_active_candidate_test.go b/deployment/ccip/changeset/cs_active_candidate_test.go index 4bd0c9fd7a4..8b1d835cb1f 100644 --- a/deployment/ccip/changeset/cs_active_candidate_test.go +++ b/deployment/ccip/changeset/cs_active_candidate_test.go @@ -53,12 +53,12 @@ func TestActiveCandidate(t *testing.T) { if src == dest { continue } - latesthdr, err := destChain.Client.HeaderByNumber(testcontext.Get(t), nil) + latesthdr, err := destChain.EVMChain.Client.HeaderByNumber(testcontext.Get(t), nil) require.NoError(t, err) block := latesthdr.Number.Uint64() startBlocks[dest] = &block msgSentEvent := TestSendRequest(t, e, state, src, dest, false, router.ClientEVM2AnyMessage{ - Receiver: common.LeftPadBytes(state.Chains[dest].Receiver.Address().Bytes(), 32), + Receiver: common.LeftPadBytes(state.EVMState.Chains[dest].Receiver.Address().Bytes(), 32), Data: []byte("hello world"), TokenAmounts: nil, FeeToken: common.HexToAddress("0x0"), @@ -80,8 +80,8 @@ func TestActiveCandidate(t *testing.T) { //After commit is reported on all chains, token prices should be updated in FeeQuoter. for dest := range e.Chains { - linkAddress := state.Chains[dest].LinkToken.Address() - feeQuoter := state.Chains[dest].FeeQuoter + linkAddress := state.EVMState.Chains[dest].LinkToken.Address() + feeQuoter := state.EVMState.Chains[dest].FeeQuoter timestampedPrice, err := feeQuoter.GetTokenPrice(nil, linkAddress) require.NoError(t, err) require.Equal(t, MockLinkPrice, timestampedPrice.Value) @@ -93,7 +93,7 @@ func TestActiveCandidate(t *testing.T) { // compose the transfer ownership and accept ownership changesets timelocks := make(map[uint64]*gethwrappers.RBACTimelock) for _, chain := range allChains { - timelocks[chain] = state.Chains[chain].Timelock + timelocks[chain] = state.EVMState.Chains[chain].Timelock } _, err = commonchangeset.ApplyChangesets(t, e, timelocks, []commonchangeset.ChangesetApplication{ // note this doesn't have proposals. @@ -109,10 +109,10 @@ func TestActiveCandidate(t *testing.T) { require.NoError(t, err) // [ACTIVE, CANDIDATE] setup by setting candidate through cap reg - capReg, ccipHome := state.Chains[tenv.HomeChainSel].CapabilityRegistry, state.Chains[tenv.HomeChainSel].CCIPHome + capReg, ccipHome := state.EVMState.Chains[tenv.HomeChainSel].CapabilityRegistry, state.EVMState.Chains[tenv.HomeChainSel].CCIPHome donID, err := internal.DonIDForChain(capReg, ccipHome, tenv.FeedChainSel) require.NoError(t, err) - donInfo, err := state.Chains[tenv.HomeChainSel].CapabilityRegistry.GetDON(nil, donID) + donInfo, err := state.EVMState.Chains[tenv.HomeChainSel].CapabilityRegistry.GetDON(nil, donID) require.NoError(t, err) require.Equal(t, 5, len(donInfo.NodeP2PIds)) require.Equal(t, uint32(4), donInfo.ConfigCount) @@ -136,16 +136,16 @@ func TestActiveCandidate(t *testing.T) { // this will construct ocr3 configurations for the // commit and exec plugin we will be using - rmnHomeAddress := state.Chains[tenv.HomeChainSel].RMNHome.Address() - tokenConfig := NewTestTokenConfig(state.Chains[tenv.FeedChainSel].USDFeeds) + rmnHomeAddress := state.EVMState.Chains[tenv.HomeChainSel].RMNHome.Address() + tokenConfig := NewTestTokenConfig(state.EVMState.Chains[tenv.FeedChainSel].USDFeeds) ccipOCRParams := DefaultOCRParams( tenv.FeedChainSel, - tokenConfig.GetTokenInfo(e.Logger, state.Chains[tenv.FeedChainSel].LinkToken, state.Chains[tenv.FeedChainSel].Weth9), + tokenConfig.GetTokenInfo(e.Logger, state.EVMState.Chains[tenv.FeedChainSel].LinkToken, state.EVMState.Chains[tenv.FeedChainSel].Weth9), nil, ) ocr3ConfigMap, err := internal.BuildOCR3ConfigForCCIPHome( deployment.XXXGenerateTestOCRSecrets(), - state.Chains[tenv.FeedChainSel].OffRamp, + state.EVMState.Chains[tenv.FeedChainSel].OffRamp, e.Chains[tenv.FeedChainSel], nodes.NonBootstraps(), rmnHomeAddress, @@ -157,16 +157,16 @@ func TestActiveCandidate(t *testing.T) { var ( timelocksPerChain = map[uint64]common.Address{ - tenv.HomeChainSel: state.Chains[tenv.HomeChainSel].Timelock.Address(), + tenv.HomeChainSel: state.EVMState.Chains[tenv.HomeChainSel].Timelock.Address(), } proposerMCMSes = map[uint64]*gethwrappers.ManyChainMultiSig{ - tenv.HomeChainSel: state.Chains[tenv.HomeChainSel].ProposerMcm, + tenv.HomeChainSel: state.EVMState.Chains[tenv.HomeChainSel].ProposerMcm, } ) setCommitCandidateOp, err := setCandidateOnExistingDon( ocr3ConfigMap[cctypes.PluginTypeCCIPCommit], - state.Chains[tenv.HomeChainSel].CapabilityRegistry, - state.Chains[tenv.HomeChainSel].CCIPHome, + state.EVMState.Chains[tenv.HomeChainSel].CapabilityRegistry, + state.EVMState.Chains[tenv.HomeChainSel].CCIPHome, tenv.FeedChainSel, nodes.NonBootstraps(), ) @@ -177,13 +177,13 @@ func TestActiveCandidate(t *testing.T) { }}, "set new candidates on commit plugin", 0) require.NoError(t, err) setCommitCandidateSigned := commonchangeset.SignProposal(t, e, setCommitCandidateProposal) - commonchangeset.ExecuteProposal(t, e, setCommitCandidateSigned, state.Chains[tenv.HomeChainSel].Timelock, tenv.HomeChainSel) + commonchangeset.ExecuteProposal(t, e, setCommitCandidateSigned, state.EVMState.Chains[tenv.HomeChainSel].Timelock, tenv.HomeChainSel) // create the op for the commit plugin as well setExecCandidateOp, err := setCandidateOnExistingDon( ocr3ConfigMap[cctypes.PluginTypeCCIPExec], - state.Chains[tenv.HomeChainSel].CapabilityRegistry, - state.Chains[tenv.HomeChainSel].CCIPHome, + state.EVMState.Chains[tenv.HomeChainSel].CapabilityRegistry, + state.EVMState.Chains[tenv.HomeChainSel].CCIPHome, tenv.FeedChainSel, nodes.NonBootstraps(), ) @@ -195,10 +195,10 @@ func TestActiveCandidate(t *testing.T) { }}, "set new candidates on commit and exec plugins", 0) require.NoError(t, err) setExecCandidateSigned := commonchangeset.SignProposal(t, e, setExecCandidateProposal) - commonchangeset.ExecuteProposal(t, e, setExecCandidateSigned, state.Chains[tenv.HomeChainSel].Timelock, tenv.HomeChainSel) + commonchangeset.ExecuteProposal(t, e, setExecCandidateSigned, state.EVMState.Chains[tenv.HomeChainSel].Timelock, tenv.HomeChainSel) // check setup was successful by confirming number of nodes from cap reg - donInfo, err = state.Chains[tenv.HomeChainSel].CapabilityRegistry.GetDON(nil, donID) + donInfo, err = state.EVMState.Chains[tenv.HomeChainSel].CapabilityRegistry.GetDON(nil, donID) require.NoError(t, err) require.Equal(t, 4, len(donInfo.NodeP2PIds)) require.Equal(t, uint32(6), donInfo.ConfigCount) @@ -211,10 +211,10 @@ func TestActiveCandidate(t *testing.T) { // [NEW ACTIVE, NO CANDIDATE] promote to active // confirm by getting old candidate digest and making sure new active matches - oldCandidateDigest, err := state.Chains[tenv.HomeChainSel].CCIPHome.GetCandidateDigest(nil, donID, uint8(cctypes.PluginTypeCCIPExec)) + oldCandidateDigest, err := state.EVMState.Chains[tenv.HomeChainSel].CCIPHome.GetCandidateDigest(nil, donID, uint8(cctypes.PluginTypeCCIPExec)) require.NoError(t, err) - promoteOps, err := promoteAllCandidatesForChainOps(state.Chains[tenv.HomeChainSel].CapabilityRegistry, state.Chains[tenv.HomeChainSel].CCIPHome, tenv.FeedChainSel, nodes.NonBootstraps()) + promoteOps, err := promoteAllCandidatesForChainOps(state.EVMState.Chains[tenv.HomeChainSel].CapabilityRegistry, state.EVMState.Chains[tenv.HomeChainSel].CCIPHome, tenv.FeedChainSel, nodes.NonBootstraps()) require.NoError(t, err) promoteProposal, err := proposalutils.BuildProposalFromBatches(timelocksPerChain, proposerMCMSes, []timelock.BatchChainOperation{{ ChainIdentifier: mcms.ChainIdentifier(tenv.HomeChainSel), @@ -222,21 +222,21 @@ func TestActiveCandidate(t *testing.T) { }}, "promote candidates and revoke actives", 0) require.NoError(t, err) promoteSigned := commonchangeset.SignProposal(t, e, promoteProposal) - commonchangeset.ExecuteProposal(t, e, promoteSigned, state.Chains[tenv.HomeChainSel].Timelock, tenv.HomeChainSel) + commonchangeset.ExecuteProposal(t, e, promoteSigned, state.EVMState.Chains[tenv.HomeChainSel].Timelock, tenv.HomeChainSel) // [NEW ACTIVE, NO CANDIDATE] done promoting // [NEW ACTIVE, NO CANDIDATE] check onchain state - newActiveDigest, err := state.Chains[tenv.HomeChainSel].CCIPHome.GetActiveDigest(nil, donID, uint8(cctypes.PluginTypeCCIPExec)) + newActiveDigest, err := state.EVMState.Chains[tenv.HomeChainSel].CCIPHome.GetActiveDigest(nil, donID, uint8(cctypes.PluginTypeCCIPExec)) require.NoError(t, err) require.Equal(t, oldCandidateDigest, newActiveDigest) - newCandidateDigest, err := state.Chains[tenv.HomeChainSel].CCIPHome.GetCandidateDigest(nil, donID, uint8(cctypes.PluginTypeCCIPCommit)) + newCandidateDigest, err := state.EVMState.Chains[tenv.HomeChainSel].CCIPHome.GetCandidateDigest(nil, donID, uint8(cctypes.PluginTypeCCIPCommit)) require.NoError(t, err) require.Equal(t, newCandidateDigest, [32]byte{}) // [NEW ACTIVE, NO CANDIDATE] done checking on chain state // [NEW ACTIVE, NO CANDIDATE] send successful request on new active - donInfo, err = state.Chains[tenv.HomeChainSel].CapabilityRegistry.GetDON(nil, donID) + donInfo, err = state.EVMState.Chains[tenv.HomeChainSel].CapabilityRegistry.GetDON(nil, donID) require.NoError(t, err) require.Equal(t, uint32(8), donInfo.ConfigCount) diff --git a/deployment/ccip/changeset/cs_add_chain.go b/deployment/ccip/changeset/cs_add_chain.go index 262d2e85e7e..f6cc1551e94 100644 --- a/deployment/ccip/changeset/cs_add_chain.go +++ b/deployment/ccip/changeset/cs_add_chain.go @@ -36,16 +36,16 @@ func NewChainInboundChangeset( // Generate proposal which enables new destination (from test router) on all source chains. var batches []timelock.BatchChainOperation for _, source := range sources { - enableOnRampDest, err := state.Chains[source].OnRamp.ApplyDestChainConfigUpdates(deployment.SimTransactOpts(), []onramp.OnRampDestChainConfigArgs{ + enableOnRampDest, err := state.EVMState.Chains[source].OnRamp.ApplyDestChainConfigUpdates(deployment.SimTransactOpts(), []onramp.OnRampDestChainConfigArgs{ { DestChainSelector: newChainSel, - Router: state.Chains[source].TestRouter.Address(), + Router: state.EVMState.Chains[source].TestRouter.Address(), }, }) if err != nil { return deployment.ChangesetOutput{}, err } - enableFeeQuoterDest, err := state.Chains[source].FeeQuoter.ApplyDestChainConfigUpdates( + enableFeeQuoterDest, err := state.EVMState.Chains[source].FeeQuoter.ApplyDestChainConfigUpdates( deployment.SimTransactOpts(), []fee_quoter.FeeQuoterDestChainConfigArgs{ { @@ -61,12 +61,12 @@ func NewChainInboundChangeset( Batch: []mcms.Operation{ { // Enable the source in on ramp - To: state.Chains[source].OnRamp.Address(), + To: state.EVMState.Chains[source].OnRamp.Address(), Data: enableOnRampDest.Data(), Value: big.NewInt(0), }, { - To: state.Chains[source].FeeQuoter.Address(), + To: state.EVMState.Chains[source].FeeQuoter.Address(), Data: enableFeeQuoterDest.Data(), Value: big.NewInt(0), }, @@ -91,8 +91,8 @@ func NewChainInboundChangeset( proposerMCMSes = make(map[uint64]*gethwrappers.ManyChainMultiSig) ) for _, chain := range append(sources, homeChainSel) { - timelocksPerChain[chain] = state.Chains[chain].Timelock.Address() - proposerMCMSes[chain] = state.Chains[chain].ProposerMcm + timelocksPerChain[chain] = state.EVMState.Chains[chain].Timelock.Address() + proposerMCMSes[chain] = state.EVMState.Chains[chain].ProposerMcm } prop, err := proposalutils.BuildProposalFromBatches( timelocksPerChain, @@ -123,16 +123,16 @@ func AddDonAndSetCandidateChangeset( ) (deployment.ChangesetOutput, error) { ccipOCRParams := DefaultOCRParams( feedChainSel, - tokenConfig.GetTokenInfo(e.Logger, state.Chains[newChainSel].LinkToken, state.Chains[newChainSel].Weth9), + tokenConfig.GetTokenInfo(e.Logger, state.EVMState.Chains[newChainSel].LinkToken, state.EVMState.Chains[newChainSel].Weth9), // TODO: Need USDC support. nil, ) newDONArgs, err := internal.BuildOCR3ConfigForCCIPHome( ocrSecrets, - state.Chains[newChainSel].OffRamp, + state.EVMState.Chains[newChainSel].OffRamp, e.Chains[newChainSel], nodes.NonBootstraps(), - state.Chains[homeChainSel].RMNHome.Address(), + state.EVMState.Chains[homeChainSel].RMNHome.Address(), ccipOCRParams.OCRParameters, ccipOCRParams.CommitOffChainConfig, ccipOCRParams.ExecuteOffChainConfig, @@ -140,7 +140,7 @@ func AddDonAndSetCandidateChangeset( if err != nil { return deployment.ChangesetOutput{}, err } - latestDon, err := internal.LatestCCIPDON(state.Chains[homeChainSel].CapabilityRegistry) + latestDon, err := internal.LatestCCIPDON(state.EVMState.Chains[homeChainSel].CapabilityRegistry) if err != nil { return deployment.ChangesetOutput{}, err } @@ -151,7 +151,7 @@ func AddDonAndSetCandidateChangeset( donID := latestDon.Id + 1 addDonOp, err := newDonWithCandidateOp( donID, commitConfig, - state.Chains[homeChainSel].CapabilityRegistry, + state.EVMState.Chains[homeChainSel].CapabilityRegistry, nodes.NonBootstraps(), ) if err != nil { @@ -160,10 +160,10 @@ func AddDonAndSetCandidateChangeset( var ( timelocksPerChain = map[uint64]common.Address{ - homeChainSel: state.Chains[homeChainSel].Timelock.Address(), + homeChainSel: state.EVMState.Chains[homeChainSel].Timelock.Address(), } proposerMCMSes = map[uint64]*gethwrappers.ManyChainMultiSig{ - homeChainSel: state.Chains[homeChainSel].ProposerMcm, + homeChainSel: state.EVMState.Chains[homeChainSel].ProposerMcm, } ) prop, err := proposalutils.BuildProposalFromBatches( @@ -210,7 +210,7 @@ func applyChainConfigUpdatesOp( chainConfigUpdates = append(chainConfigUpdates, chainConfig) } - addChain, err := state.Chains[homeChainSel].CCIPHome.ApplyChainConfigUpdates( + addChain, err := state.EVMState.Chains[homeChainSel].CCIPHome.ApplyChainConfigUpdates( deployment.SimTransactOpts(), nil, chainConfigUpdates, @@ -219,7 +219,7 @@ func applyChainConfigUpdatesOp( return mcms.Operation{}, err } return mcms.Operation{ - To: state.Chains[homeChainSel].CCIPHome.Address(), + To: state.EVMState.Chains[homeChainSel].CCIPHome.Address(), Data: addChain.Data(), Value: big.NewInt(0), }, nil diff --git a/deployment/ccip/changeset/cs_add_chain_test.go b/deployment/ccip/changeset/cs_add_chain_test.go index b8a845ac27c..fb979e59871 100644 --- a/deployment/ccip/changeset/cs_add_chain_test.go +++ b/deployment/ccip/changeset/cs_add_chain_test.go @@ -74,7 +74,7 @@ func TestAddChainInbound(t *testing.T) { }) require.NoError(t, err) newAddresses = deployment.NewMemoryAddressBook() - tokenConfig := NewTestTokenConfig(state.Chains[e.FeedChainSel].USDFeeds) + tokenConfig := NewTestTokenConfig(state.EVMState.Chains[e.FeedChainSel].USDFeeds) chainConfig := make(map[uint64]CCIPOCRParams) for _, chain := range initialDeploy { @@ -103,7 +103,7 @@ func TestAddChainInbound(t *testing.T) { rmnHomeAddress, err := deployment.SearchAddressBook(e.Env.ExistingAddresses, e.HomeChainSel, RMNHome) require.NoError(t, err) require.True(t, common.IsHexAddress(rmnHomeAddress)) - rmnHome, err := rmn_home.NewRMNHome(common.HexToAddress(rmnHomeAddress), e.Env.Chains[e.HomeChainSel].Client) + rmnHome, err := rmn_home.NewRMNHome(common.HexToAddress(rmnHomeAddress), e.Env.Chains[e.HomeChainSel].EVMChain.Client) require.NoError(t, err) // Deploy contracts to new chain @@ -135,10 +135,10 @@ func TestAddChainInbound(t *testing.T) { // configure the testrouter appropriately on each chain for _, source := range initialDeploy { - tx, err := state.Chains[source].TestRouter.ApplyRampUpdates(e.Env.Chains[source].DeployerKey, []router.RouterOnRamp{ + tx, err := state.EVMState.Chains[source].TestRouter.ApplyRampUpdates(e.Env.Chains[source].EVMChain.DeployerKey, []router.RouterOnRamp{ { DestChainSelector: newChain, - OnRamp: state.Chains[source].OnRamp.Address(), + OnRamp: state.EVMState.Chains[source].OnRamp.Address(), }, }, nil, nil) _, err = deployment.ConfirmIfNoError(e.Env.Chains[source], tx, err) @@ -147,9 +147,9 @@ func TestAddChainInbound(t *testing.T) { // transfer ownership to timelock _, err = commonchangeset.ApplyChangesets(t, e.Env, map[uint64]*gethwrappers.RBACTimelock{ - initialDeploy[0]: state.Chains[initialDeploy[0]].Timelock, - initialDeploy[1]: state.Chains[initialDeploy[1]].Timelock, - initialDeploy[2]: state.Chains[initialDeploy[2]].Timelock, + initialDeploy[0]: state.EVMState.Chains[initialDeploy[0]].Timelock, + initialDeploy[1]: state.EVMState.Chains[initialDeploy[1]].Timelock, + initialDeploy[2]: state.EVMState.Chains[initialDeploy[2]].Timelock, }, []commonchangeset.ChangesetApplication{ // note this doesn't have proposals. { @@ -190,8 +190,8 @@ func TestAddChainInbound(t *testing.T) { // verify if the configs are updated require.NoError(t, ValidateCCIPHomeConfigSetUp( - state.Chains[e.HomeChainSel].CapabilityRegistry, - state.Chains[e.HomeChainSel].CCIPHome, + state.EVMState.Chains[e.HomeChainSel].CapabilityRegistry, + state.EVMState.Chains[e.HomeChainSel].CCIPHome, newChain, )) replayBlocks, err := LatestBlocksByChain(testcontext.Get(t), e.Env.Chains) @@ -201,22 +201,22 @@ func TestAddChainInbound(t *testing.T) { var offRampEnables []offramp.OffRampSourceChainConfigArgs for _, source := range initialDeploy { offRampEnables = append(offRampEnables, offramp.OffRampSourceChainConfigArgs{ - Router: state.Chains[newChain].Router.Address(), + Router: state.EVMState.Chains[newChain].Router.Address(), SourceChainSelector: source, IsEnabled: true, - OnRamp: common.LeftPadBytes(state.Chains[source].OnRamp.Address().Bytes(), 32), + OnRamp: common.LeftPadBytes(state.EVMState.Chains[source].OnRamp.Address().Bytes(), 32), }) } - tx, err := state.Chains[newChain].OffRamp.ApplySourceChainConfigUpdates(e.Env.Chains[newChain].DeployerKey, offRampEnables) + tx, err := state.EVMState.Chains[newChain].OffRamp.ApplySourceChainConfigUpdates(e.Env.Chains[newChain].EVMChain.DeployerKey, offRampEnables) require.NoError(t, err) _, err = deployment.ConfirmIfNoError(e.Env.Chains[newChain], tx, err) require.NoError(t, err) // Set the OCR3 config on new 4th chain to enable the plugin. - latestDON, err := internal.LatestCCIPDON(state.Chains[e.HomeChainSel].CapabilityRegistry) + latestDON, err := internal.LatestCCIPDON(state.EVMState.Chains[e.HomeChainSel].CapabilityRegistry) require.NoError(t, err) - ocrConfigs, err := internal.BuildSetOCR3ConfigArgs(latestDON.Id, state.Chains[e.HomeChainSel].CCIPHome, newChain) + ocrConfigs, err := internal.BuildSetOCR3ConfigArgs(latestDON.Id, state.EVMState.Chains[e.HomeChainSel].CCIPHome, newChain) require.NoError(t, err) - tx, err = state.Chains[newChain].OffRamp.SetOCR3Configs(e.Env.Chains[newChain].DeployerKey, ocrConfigs) + tx, err = state.EVMState.Chains[newChain].OffRamp.SetOCR3Configs(e.Env.Chains[newChain].EVMChain.DeployerKey, ocrConfigs) require.NoError(t, err) _, err = deployment.ConfirmIfNoError(e.Env.Chains[newChain], tx, err) require.NoError(t, err) @@ -225,15 +225,15 @@ func TestAddChainInbound(t *testing.T) { state, err = LoadOnchainState(e.Env) require.NoError(t, err) for _, chain := range initialDeploy { - cfg, err2 := state.Chains[chain].OnRamp.GetDestChainConfig(nil, newChain) + cfg, err2 := state.EVMState.Chains[chain].OnRamp.GetDestChainConfig(nil, newChain) require.NoError(t, err2) - assert.Equal(t, cfg.Router, state.Chains[chain].TestRouter.Address()) - fqCfg, err2 := state.Chains[chain].FeeQuoter.GetDestChainConfig(nil, newChain) + assert.Equal(t, cfg.Router, state.EVMState.Chains[chain].TestRouter.Address()) + fqCfg, err2 := state.EVMState.Chains[chain].FeeQuoter.GetDestChainConfig(nil, newChain) require.NoError(t, err2) assert.True(t, fqCfg.IsEnabled) - s, err2 := state.Chains[newChain].OffRamp.GetSourceChainConfig(nil, chain) + s, err2 := state.EVMState.Chains[newChain].OffRamp.GetSourceChainConfig(nil, chain) require.NoError(t, err2) - assert.Equal(t, common.LeftPadBytes(state.Chains[chain].OnRamp.Address().Bytes(), 32), s.OnRamp) + assert.Equal(t, common.LeftPadBytes(state.EVMState.Chains[chain].OnRamp.Address().Bytes(), 32), s.OnRamp) } // Ensure job related logs are up to date. time.Sleep(30 * time.Second) @@ -241,18 +241,18 @@ func TestAddChainInbound(t *testing.T) { // TODO: Send via all inbound lanes and use parallel helper // Now that the proposal has been executed we expect to be able to send traffic to this new 4th chain. - latesthdr, err := e.Env.Chains[newChain].Client.HeaderByNumber(testcontext.Get(t), nil) + latesthdr, err := e.Env.Chains[newChain].EVMChain.Client.HeaderByNumber(testcontext.Get(t), nil) require.NoError(t, err) startBlock := latesthdr.Number.Uint64() msgSentEvent := TestSendRequest(t, e.Env, state, initialDeploy[0], newChain, true, router.ClientEVM2AnyMessage{ - Receiver: common.LeftPadBytes(state.Chains[newChain].Receiver.Address().Bytes(), 32), + Receiver: common.LeftPadBytes(state.EVMState.Chains[newChain].Receiver.Address().Bytes(), 32), Data: []byte("hello world"), TokenAmounts: nil, FeeToken: common.HexToAddress("0x0"), ExtraArgs: nil, }) require.NoError(t, - commonutils.JustError(ConfirmCommitWithExpectedSeqNumRange(t, e.Env.Chains[initialDeploy[0]], e.Env.Chains[newChain], state.Chains[newChain].OffRamp, &startBlock, cciptypes.SeqNumRange{ + commonutils.JustError(ConfirmCommitWithExpectedSeqNumRange(t, e.Env.Chains[initialDeploy[0]], e.Env.Chains[newChain], state.EVMState.Chains[newChain].OffRamp, &startBlock, cciptypes.SeqNumRange{ cciptypes.SeqNum(1), cciptypes.SeqNum(msgSentEvent.SequenceNumber), }, true))) @@ -262,15 +262,15 @@ func TestAddChainInbound(t *testing.T) { t, e.Env.Chains[initialDeploy[0]], e.Env.Chains[newChain], - state.Chains[newChain].OffRamp, + state.EVMState.Chains[newChain].OffRamp, &startBlock, []uint64{msgSentEvent.SequenceNumber}, ), ), ) - linkAddress := state.Chains[newChain].LinkToken.Address() - feeQuoter := state.Chains[newChain].FeeQuoter + linkAddress := state.EVMState.Chains[newChain].LinkToken.Address() + feeQuoter := state.EVMState.Chains[newChain].FeeQuoter timestampedPrice, err := feeQuoter.GetTokenPrice(nil, linkAddress) require.NoError(t, err) require.Equal(t, MockLinkPrice, timestampedPrice.Value) diff --git a/deployment/ccip/changeset/cs_add_lane.go b/deployment/ccip/changeset/cs_add_lane.go index 0bd03b56559..0a1cb6fd8c2 100644 --- a/deployment/ccip/changeset/cs_add_lane.go +++ b/deployment/ccip/changeset/cs_add_lane.go @@ -116,22 +116,22 @@ func addLane(e deployment.Environment, state CCIPOnChainState, config LaneConfig feeQuoterDestChainConfig := config.FeeQuoterDestChain initialPrices := config.InitialPricesBySource if isTestRouter { - fromRouter = state.Chains[from].TestRouter - toRouter = state.Chains[to].TestRouter + fromRouter = state.EVMState.Chains[from].TestRouter + toRouter = state.EVMState.Chains[to].TestRouter } else { - fromRouter = state.Chains[from].Router - toRouter = state.Chains[to].Router + fromRouter = state.EVMState.Chains[from].Router + toRouter = state.EVMState.Chains[to].Router } - tx, err := fromRouter.ApplyRampUpdates(e.Chains[from].DeployerKey, []router.RouterOnRamp{ + tx, err := fromRouter.ApplyRampUpdates(e.Chains[from].EVMChain.DeployerKey, []router.RouterOnRamp{ { DestChainSelector: to, - OnRamp: state.Chains[from].OnRamp.Address(), + OnRamp: state.EVMState.Chains[from].OnRamp.Address(), }, }, []router.RouterOffRamp{}, []router.RouterOffRamp{}) if _, err := deployment.ConfirmIfNoError(e.Chains[from], tx, err); err != nil { return err } - tx, err = state.Chains[from].OnRamp.ApplyDestChainConfigUpdates(e.Chains[from].DeployerKey, + tx, err = state.EVMState.Chains[from].OnRamp.ApplyDestChainConfigUpdates(e.Chains[from].EVMChain.DeployerKey, []onramp.OnRampDestChainConfigArgs{ { DestChainSelector: to, @@ -142,15 +142,15 @@ func addLane(e deployment.Environment, state CCIPOnChainState, config LaneConfig return err } - _, err = state.Chains[from].FeeQuoter.UpdatePrices( - e.Chains[from].DeployerKey, fee_quoter.InternalPriceUpdates{ + _, err = state.EVMState.Chains[from].FeeQuoter.UpdatePrices( + e.Chains[from].EVMChain.DeployerKey, fee_quoter.InternalPriceUpdates{ TokenPriceUpdates: []fee_quoter.InternalTokenPriceUpdate{ { - SourceToken: state.Chains[from].LinkToken.Address(), + SourceToken: state.EVMState.Chains[from].LinkToken.Address(), UsdPerToken: initialPrices.LinkPrice, }, { - SourceToken: state.Chains[from].Weth9.Address(), + SourceToken: state.EVMState.Chains[from].Weth9.Address(), UsdPerToken: initialPrices.WethPrice, }, }, @@ -159,13 +159,14 @@ func addLane(e deployment.Environment, state CCIPOnChainState, config LaneConfig DestChainSelector: to, UsdPerUnitGas: initialPrices.GasPrice, }, - }}) + }, + }) if _, err := deployment.ConfirmIfNoError(e.Chains[from], tx, err); err != nil { return err } // Enable dest in fee quoter - tx, err = state.Chains[from].FeeQuoter.ApplyDestChainConfigUpdates(e.Chains[from].DeployerKey, + tx, err = state.EVMState.Chains[from].FeeQuoter.ApplyDestChainConfigUpdates(e.Chains[from].EVMChain.DeployerKey, []fee_quoter.FeeQuoterDestChainConfigArgs{ { DestChainSelector: to, @@ -176,22 +177,22 @@ func addLane(e deployment.Environment, state CCIPOnChainState, config LaneConfig return err } - tx, err = state.Chains[to].OffRamp.ApplySourceChainConfigUpdates(e.Chains[to].DeployerKey, + tx, err = state.EVMState.Chains[to].OffRamp.ApplySourceChainConfigUpdates(e.Chains[to].EVMChain.DeployerKey, []offramp.OffRampSourceChainConfigArgs{ { Router: toRouter.Address(), SourceChainSelector: from, IsEnabled: true, - OnRamp: common.LeftPadBytes(state.Chains[from].OnRamp.Address().Bytes(), 32), + OnRamp: common.LeftPadBytes(state.EVMState.Chains[from].OnRamp.Address().Bytes(), 32), }, }) if _, err := deployment.ConfirmIfNoError(e.Chains[to], tx, err); err != nil { return err } - tx, err = toRouter.ApplyRampUpdates(e.Chains[to].DeployerKey, []router.RouterOnRamp{}, []router.RouterOffRamp{}, []router.RouterOffRamp{ + tx, err = toRouter.ApplyRampUpdates(e.Chains[to].EVMChain.DeployerKey, []router.RouterOnRamp{}, []router.RouterOffRamp{}, []router.RouterOffRamp{ { SourceChainSelector: from, - OffRamp: state.Chains[to].OffRamp.Address(), + OffRamp: state.EVMState.Chains[to].OffRamp.Address(), }, }) _, err = deployment.ConfirmIfNoError(e.Chains[to], tx, err) diff --git a/deployment/ccip/changeset/cs_add_lane_test.go b/deployment/ccip/changeset/cs_add_lane_test.go index fbceeaa8472..66d7cd216a8 100644 --- a/deployment/ccip/changeset/cs_add_lane_test.go +++ b/deployment/ccip/changeset/cs_add_lane_test.go @@ -46,12 +46,12 @@ func TestAddLanesWithTestRouter(t *testing.T) { startBlocks := make(map[uint64]*uint64) // Send a message from each chain to every other chain. expectedSeqNumExec := make(map[SourceDestPair][]uint64) - latesthdr, err := e.Env.Chains[chain2].Client.HeaderByNumber(testcontext.Get(t), nil) + latesthdr, err := e.Env.Chains[chain2].EVMChain.Client.HeaderByNumber(testcontext.Get(t), nil) require.NoError(t, err) block := latesthdr.Number.Uint64() startBlocks[chain2] = &block msgSentEvent := TestSendRequest(t, e.Env, state, chain1, chain2, true, router.ClientEVM2AnyMessage{ - Receiver: common.LeftPadBytes(state.Chains[chain2].Receiver.Address().Bytes(), 32), + Receiver: common.LeftPadBytes(state.EVMState.Chains[chain2].Receiver.Address().Bytes(), 32), Data: []byte("hello"), TokenAmounts: nil, FeeToken: common.HexToAddress("0x0"), @@ -86,7 +86,7 @@ func TestAddLane(t *testing.T) { // We expect no lanes available on any chain. for _, sel := range []uint64{chain1, chain2} { - chain := state.Chains[sel] + chain := state.EVMState.Chains[sel] offRamps, err := chain.Router.GetOffRamps(nil) require.NoError(t, err) require.Len(t, offRamps, 0) @@ -101,39 +101,39 @@ func TestAddLane(t *testing.T) { ReplayLogs(t, e.Env.Offchain, replayBlocks) time.Sleep(30 * time.Second) // disable the onRamp initially on OffRamp - disableRampTx, err := state.Chains[chain2].OffRamp.ApplySourceChainConfigUpdates(e.Env.Chains[chain2].DeployerKey, []offramp.OffRampSourceChainConfigArgs{ + disableRampTx, err := state.EVMState.Chains[chain2].OffRamp.ApplySourceChainConfigUpdates(e.Env.Chains[chain2].EVMChain.DeployerKey, []offramp.OffRampSourceChainConfigArgs{ { - Router: state.Chains[chain2].Router.Address(), + Router: state.EVMState.Chains[chain2].Router.Address(), SourceChainSelector: chain1, IsEnabled: false, - OnRamp: common.LeftPadBytes(state.Chains[chain1].OnRamp.Address().Bytes(), 32), + OnRamp: common.LeftPadBytes(state.EVMState.Chains[chain1].OnRamp.Address().Bytes(), 32), }, }) _, err = deployment.ConfirmIfNoError(e.Env.Chains[chain2], disableRampTx, err) require.NoError(t, err) for _, sel := range []uint64{chain1, chain2} { - chain := state.Chains[sel] + chain := state.EVMState.Chains[sel] offRamps, err := chain.Router.GetOffRamps(nil) require.NoError(t, err) if sel == chain2 { require.Len(t, offRamps, 1) srcCfg, err := chain.OffRamp.GetSourceChainConfig(nil, chain1) require.NoError(t, err) - require.Equal(t, common.LeftPadBytes(state.Chains[chain1].OnRamp.Address().Bytes(), 32), srcCfg.OnRamp) + require.Equal(t, common.LeftPadBytes(state.EVMState.Chains[chain1].OnRamp.Address().Bytes(), 32), srcCfg.OnRamp) require.False(t, srcCfg.IsEnabled) } else { require.Len(t, offRamps, 0) } } - latesthdr, err := e.Env.Chains[chain2].Client.HeaderByNumber(testcontext.Get(t), nil) + latesthdr, err := e.Env.Chains[chain2].EVMChain.Client.HeaderByNumber(testcontext.Get(t), nil) require.NoError(t, err) startBlock := latesthdr.Number.Uint64() // Send traffic on the first lane and it should not be processed by the plugin as onRamp is disabled // we will check this by confirming that the message is not executed by the end of the test msgSentEvent1 := TestSendRequest(t, e.Env, state, chain1, chain2, false, router.ClientEVM2AnyMessage{ - Receiver: common.LeftPadBytes(state.Chains[chain2].Receiver.Address().Bytes(), 32), + Receiver: common.LeftPadBytes(state.EVMState.Chains[chain2].Receiver.Address().Bytes(), 32), Data: []byte("hello world"), TokenAmounts: nil, FeeToken: common.HexToAddress("0x0"), @@ -145,11 +145,11 @@ func TestAddLane(t *testing.T) { require.NoError(t, AddLaneWithDefaultPricesAndFeeQuoterConfig(e.Env, state, chain2, chain1, false)) // Send traffic on the second lane and it should succeed - latesthdr, err = e.Env.Chains[chain1].Client.HeaderByNumber(testcontext.Get(t), nil) + latesthdr, err = e.Env.Chains[chain1].EVMChain.Client.HeaderByNumber(testcontext.Get(t), nil) require.NoError(t, err) startBlock2 := latesthdr.Number.Uint64() msgSentEvent2 := TestSendRequest(t, e.Env, state, chain2, chain1, false, router.ClientEVM2AnyMessage{ - Receiver: common.LeftPadBytes(state.Chains[chain2].Receiver.Address().Bytes(), 32), + Receiver: common.LeftPadBytes(state.EVMState.Chains[chain2].Receiver.Address().Bytes(), 32), Data: []byte("hello world"), TokenAmounts: nil, FeeToken: common.HexToAddress("0x0"), @@ -162,7 +162,7 @@ func TestAddLane(t *testing.T) { t, e.Env.Chains[chain2], e.Env.Chains[chain1], - state.Chains[chain1].OffRamp, + state.EVMState.Chains[chain1].OffRamp, &startBlock2, []uint64{msgSentEvent2.SequenceNumber}, ), @@ -170,23 +170,23 @@ func TestAddLane(t *testing.T) { ) // now check for the previous message from chain 1 to chain 2 that it has not been executed till now as the onRamp was disabled - ConfirmNoExecConsistentlyWithSeqNr(t, e.Env.Chains[chain1], e.Env.Chains[chain2], state.Chains[chain2].OffRamp, msgSentEvent1.SequenceNumber, 30*time.Second) + ConfirmNoExecConsistentlyWithSeqNr(t, e.Env.Chains[chain1], e.Env.Chains[chain2], state.EVMState.Chains[chain2].OffRamp, msgSentEvent1.SequenceNumber, 30*time.Second) // enable the onRamp on OffRamp - enableRampTx, err := state.Chains[chain2].OffRamp.ApplySourceChainConfigUpdates(e.Env.Chains[chain2].DeployerKey, []offramp.OffRampSourceChainConfigArgs{ + enableRampTx, err := state.EVMState.Chains[chain2].OffRamp.ApplySourceChainConfigUpdates(e.Env.Chains[chain2].EVMChain.DeployerKey, []offramp.OffRampSourceChainConfigArgs{ { - Router: state.Chains[chain2].Router.Address(), + Router: state.EVMState.Chains[chain2].Router.Address(), SourceChainSelector: chain1, IsEnabled: true, - OnRamp: common.LeftPadBytes(state.Chains[chain1].OnRamp.Address().Bytes(), 32), + OnRamp: common.LeftPadBytes(state.EVMState.Chains[chain1].OnRamp.Address().Bytes(), 32), }, }) _, err = deployment.ConfirmIfNoError(e.Env.Chains[chain2], enableRampTx, err) require.NoError(t, err) - srcCfg, err := state.Chains[chain2].OffRamp.GetSourceChainConfig(nil, chain1) + srcCfg, err := state.EVMState.Chains[chain2].OffRamp.GetSourceChainConfig(nil, chain1) require.NoError(t, err) - require.Equal(t, common.LeftPadBytes(state.Chains[chain1].OnRamp.Address().Bytes(), 32), srcCfg.OnRamp) + require.Equal(t, common.LeftPadBytes(state.EVMState.Chains[chain1].OnRamp.Address().Bytes(), 32), srcCfg.OnRamp) require.True(t, srcCfg.IsEnabled) // we need the replay here otherwise plugin is not able to locate the message @@ -199,7 +199,7 @@ func TestAddLane(t *testing.T) { t, e.Env.Chains[chain1], e.Env.Chains[chain2], - state.Chains[chain2].OffRamp, + state.EVMState.Chains[chain2].OffRamp, &startBlock, []uint64{msgSentEvent1.SequenceNumber}, ), diff --git a/deployment/ccip/changeset/cs_deploy_chain.go b/deployment/ccip/changeset/cs_deploy_chain.go index b57c00fd796..210612c9271 100644 --- a/deployment/ccip/changeset/cs_deploy_chain.go +++ b/deployment/ccip/changeset/cs_deploy_chain.go @@ -108,7 +108,7 @@ func deployChainContractsForChains( return err } - capReg := existingState.Chains[homeChainSel].CapabilityRegistry + capReg := existingState.EVMState.Chains[homeChainSel].CapabilityRegistry if capReg == nil { e.Logger.Errorw("Failed to get capability registry") return fmt.Errorf("capability registry not found") @@ -129,15 +129,15 @@ func deployChainContractsForChains( e.Logger.Errorw("Failed to get capability", "err", err) return err } - ccipHome, err := ccip_home.NewCCIPHome(capability.ConfigurationContract, e.Chains[homeChainSel].Client) + ccipHome, err := ccip_home.NewCCIPHome(capability.ConfigurationContract, e.Chains[homeChainSel].EVMChain.Client) if err != nil { e.Logger.Errorw("Failed to get ccip config", "err", err) return err } - if ccipHome.Address() != existingState.Chains[homeChainSel].CCIPHome.Address() { + if ccipHome.Address() != existingState.EVMState.Chains[homeChainSel].CCIPHome.Address() { return fmt.Errorf("ccip home address mismatch") } - rmnHome := existingState.Chains[homeChainSel].RMNHome + rmnHome := existingState.EVMState.Chains[homeChainSel].RMNHome if rmnHome == nil { e.Logger.Errorw("Failed to get rmn home", "err", err) return fmt.Errorf("rmn home not found") @@ -148,7 +148,7 @@ func deployChainContractsForChains( if !ok { return fmt.Errorf("chain %d not found", chainSel) } - if existingState.Chains[chainSel].LinkToken == nil || existingState.Chains[chainSel].Weth9 == nil { + if existingState.EVMState.Chains[chainSel].LinkToken == nil || existingState.EVMState.Chains[chainSel].Weth9 == nil { return fmt.Errorf("fee tokens not found for chain %d", chainSel) } deployGrp.Go( @@ -180,7 +180,7 @@ func deployChainContracts( e.Logger.Errorw("Failed to load existing onchain state", "err") return err } - chainState, chainExists := state.Chains[chain.Selector] + chainState, chainExists := state.EVMState.Chains[chain.Selector] if !chainExists { return fmt.Errorf("chain %d not found in existing state, deploy the prerequisites first", chain.Selector) } @@ -209,8 +209,8 @@ func deployChainContracts( ccipReceiver, err := deployment.DeployContract(e.Logger, chain, ab, func(chain deployment.Chain) deployment.ContractDeploy[*maybe_revert_message_receiver.MaybeRevertMessageReceiver] { receiverAddr, tx, receiver, err2 := maybe_revert_message_receiver.DeployMaybeRevertMessageReceiver( - chain.DeployerKey, - chain.Client, + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, false, ) return deployment.ContractDeploy[*maybe_revert_message_receiver.MaybeRevertMessageReceiver]{ @@ -231,8 +231,8 @@ func deployChainContracts( rmnRemote, err := deployment.DeployContract(e.Logger, chain, ab, func(chain deployment.Chain) deployment.ContractDeploy[*rmn_remote.RMNRemote] { rmnRemoteAddr, tx, rmnRemote, err2 := rmn_remote.DeployRMNRemote( - chain.DeployerKey, - chain.Client, + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, chain.Selector, // Indicates no legacy RMN contract common.HexToAddress("0x0"), @@ -257,7 +257,7 @@ func deployChainContracts( } e.Logger.Infow("setting active home digest to rmn remote", "digest", activeDigest) - tx, err := rmnRemoteContract.SetConfig(chain.DeployerKey, rmn_remote.RMNRemoteConfig{ + tx, err := rmnRemoteContract.SetConfig(chain.EVMChain.DeployerKey, rmn_remote.RMNRemoteConfig{ RmnHomeContractConfigDigest: activeDigest, Signers: []rmn_remote.RMNRemoteSigner{ {NodeIndex: 0, OnchainPublicKey: common.Address{1}}, @@ -277,8 +277,8 @@ func deployChainContracts( rmnProxy, err := deployment.DeployContract(e.Logger, chain, ab, func(chain deployment.Chain) deployment.ContractDeploy[*rmn_proxy_contract.RMNProxyContract] { rmnProxyAddr, tx, rmnProxy, err2 := rmn_proxy_contract.DeployRMNProxyContract( - chain.DeployerKey, - chain.Client, + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, rmnRemoteContract.Address(), ) return deployment.ContractDeploy[*rmn_proxy_contract.RMNProxyContract]{ @@ -298,8 +298,8 @@ func deployChainContracts( testRouterContract, err := deployment.DeployContract(e.Logger, chain, ab, func(chain deployment.Chain) deployment.ContractDeploy[*router.Router] { routerAddr, tx2, routerC, err2 := router.DeployRouter( - chain.DeployerKey, - chain.Client, + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, weth9Contract.Address(), rmnProxyContract.Address(), ) @@ -321,8 +321,8 @@ func deployChainContracts( nonceManager, err := deployment.DeployContract(e.Logger, chain, ab, func(chain deployment.Chain) deployment.ContractDeploy[*nonce_manager.NonceManager] { nonceManagerAddr, tx2, nonceManager, err2 := nonce_manager.DeployNonceManager( - chain.DeployerKey, - chain.Client, + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, []common.Address{}, // Need to add onRamp after ) return deployment.ContractDeploy[*nonce_manager.NonceManager]{ @@ -343,15 +343,15 @@ func deployChainContracts( feeQuoter, err := deployment.DeployContract(e.Logger, chain, ab, func(chain deployment.Chain) deployment.ContractDeploy[*fee_quoter.FeeQuoter] { prAddr, tx2, pr, err2 := fee_quoter.DeployFeeQuoter( - chain.DeployerKey, - chain.Client, + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, fee_quoter.FeeQuoterStaticConfig{ MaxFeeJuelsPerMsg: big.NewInt(0).Mul(big.NewInt(2e2), big.NewInt(1e18)), LinkToken: linkTokenContract.Address(), TokenPriceStalenessThreshold: uint32(24 * 60 * 60), }, - []common.Address{state.Chains[chain.Selector].Timelock.Address()}, // timelock should be able to update, ramps added after - []common.Address{weth9Contract.Address(), linkTokenContract.Address()}, // fee tokens + []common.Address{state.EVMState.Chains[chain.Selector].Timelock.Address()}, // timelock should be able to update, ramps added after + []common.Address{weth9Contract.Address(), linkTokenContract.Address()}, // fee tokens []fee_quoter.FeeQuoterTokenPriceFeedUpdate{}, []fee_quoter.FeeQuoterTokenTransferFeeConfigArgs{}, // TODO: tokens []fee_quoter.FeeQuoterPremiumMultiplierWeiPerEthArgs{ @@ -384,8 +384,8 @@ func deployChainContracts( onRamp, err := deployment.DeployContract(e.Logger, chain, ab, func(chain deployment.Chain) deployment.ContractDeploy[*onramp.OnRamp] { onRampAddr, tx2, onRamp, err2 := onramp.DeployOnRamp( - chain.DeployerKey, - chain.Client, + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, onramp.OnRampStaticConfig{ ChainSelector: chain.Selector, RmnRemote: rmnProxyContract.Address(), @@ -416,8 +416,8 @@ func deployChainContracts( offRamp, err := deployment.DeployContract(e.Logger, chain, ab, func(chain deployment.Chain) deployment.ContractDeploy[*offramp.OffRamp] { offRampAddr, tx2, offRamp, err2 := offramp.DeployOffRamp( - chain.DeployerKey, - chain.Client, + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, offramp.OffRampStaticConfig{ ChainSelector: chain.Selector, RmnRemote: rmnProxyContract.Address(), @@ -445,17 +445,17 @@ func deployChainContracts( e.Logger.Infow("offramp already deployed", "addr", chainState.OffRamp.Address) } // Basic wiring is always needed. - tx, err = feeQuoterContract.ApplyAuthorizedCallerUpdates(chain.DeployerKey, fee_quoter.AuthorizedCallersAuthorizedCallerArgs{ + tx, err = feeQuoterContract.ApplyAuthorizedCallerUpdates(chain.EVMChain.DeployerKey, fee_quoter.AuthorizedCallersAuthorizedCallerArgs{ // TODO: We enable the deployer initially to set prices // Should be removed after. - AddedCallers: []common.Address{offRampContract.Address(), chain.DeployerKey.From}, + AddedCallers: []common.Address{offRampContract.Address(), chain.EVMChain.DeployerKey.From}, }) if _, err := deployment.ConfirmIfNoError(chain, tx, err); err != nil { e.Logger.Errorw("Failed to confirm fee quoter authorized caller update", "err", err) return err } - tx, err = nmContract.ApplyAuthorizedCallerUpdates(chain.DeployerKey, nonce_manager.AuthorizedCallersAuthorizedCallerArgs{ + tx, err = nmContract.ApplyAuthorizedCallerUpdates(chain.EVMChain.DeployerKey, nonce_manager.AuthorizedCallersAuthorizedCallerArgs{ AddedCallers: []common.Address{offRampContract.Address(), onRampContract.Address()}, }) if _, err := deployment.ConfirmIfNoError(chain, tx, err); err != nil { diff --git a/deployment/ccip/changeset/cs_deploy_chain_test.go b/deployment/ccip/changeset/cs_deploy_chain_test.go index 234d73cc4b5..2e9faba80fb 100644 --- a/deployment/ccip/changeset/cs_deploy_chain_test.go +++ b/deployment/ccip/changeset/cs_deploy_chain_test.go @@ -45,7 +45,7 @@ func TestDeployChainContractsChangeset(t *testing.T) { HomeChainSel: homeChainSel, RMNStaticConfig: NewTestRMNStaticConfig(), RMNDynamicConfig: NewTestRMNDynamicConfig(), - NodeOperators: NewTestNodeOperator(e.Chains[homeChainSel].DeployerKey.From), + NodeOperators: NewTestNodeOperator(e.Chains[homeChainSel].EVMChain.DeployerKey.From), NodeP2PIDsPerNodeOpAdmin: map[string][][32]byte{ "NodeOperator": p2pIds, }, @@ -80,21 +80,21 @@ func TestDeployChainContractsChangeset(t *testing.T) { require.NoError(t, err) // verify all contracts populated - require.NotNil(t, state.Chains[homeChainSel].CapabilityRegistry) - require.NotNil(t, state.Chains[homeChainSel].CCIPHome) - require.NotNil(t, state.Chains[homeChainSel].RMNHome) + require.NotNil(t, state.EVMState.Chains[homeChainSel].CapabilityRegistry) + require.NotNil(t, state.EVMState.Chains[homeChainSel].CCIPHome) + require.NotNil(t, state.EVMState.Chains[homeChainSel].RMNHome) for _, sel := range selectors { - require.NotNil(t, state.Chains[sel].LinkToken) - require.NotNil(t, state.Chains[sel].Weth9) - require.NotNil(t, state.Chains[sel].TokenAdminRegistry) - require.NotNil(t, state.Chains[sel].RegistryModule) - require.NotNil(t, state.Chains[sel].Router) - require.NotNil(t, state.Chains[sel].RMNRemote) - require.NotNil(t, state.Chains[sel].TestRouter) - require.NotNil(t, state.Chains[sel].NonceManager) - require.NotNil(t, state.Chains[sel].FeeQuoter) - require.NotNil(t, state.Chains[sel].OffRamp) - require.NotNil(t, state.Chains[sel].OnRamp) + require.NotNil(t, state.EVMState.Chains[sel].LinkToken) + require.NotNil(t, state.EVMState.Chains[sel].Weth9) + require.NotNil(t, state.EVMState.Chains[sel].TokenAdminRegistry) + require.NotNil(t, state.EVMState.Chains[sel].RegistryModule) + require.NotNil(t, state.EVMState.Chains[sel].Router) + require.NotNil(t, state.EVMState.Chains[sel].RMNRemote) + require.NotNil(t, state.EVMState.Chains[sel].TestRouter) + require.NotNil(t, state.EVMState.Chains[sel].NonceManager) + require.NotNil(t, state.EVMState.Chains[sel].FeeQuoter) + require.NotNil(t, state.EVMState.Chains[sel].OffRamp) + require.NotNil(t, state.EVMState.Chains[sel].OnRamp) } } diff --git a/deployment/ccip/changeset/cs_home_chain.go b/deployment/ccip/changeset/cs_home_chain.go index 0df8d87affb..e73caaeea81 100644 --- a/deployment/ccip/changeset/cs_home_chain.go +++ b/deployment/ccip/changeset/cs_home_chain.go @@ -90,7 +90,7 @@ func deployCapReg( ab deployment.AddressBook, chain deployment.Chain, ) (*deployment.ContractDeploy[*capabilities_registry.CapabilitiesRegistry], error) { - homeChainState, exists := state.Chains[chain.Selector] + homeChainState, exists := state.EVMState.Chains[chain.Selector] if exists { cr := homeChainState.CapabilityRegistry if cr != nil { @@ -103,8 +103,8 @@ func deployCapReg( capReg, err := deployment.DeployContract(lggr, chain, ab, func(chain deployment.Chain) deployment.ContractDeploy[*capabilities_registry.CapabilitiesRegistry] { crAddr, tx, cr, err2 := capabilities_registry.DeployCapabilitiesRegistry( - chain.DeployerKey, - chain.Client, + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, ) return deployment.ContractDeploy[*capabilities_registry.CapabilitiesRegistry]{ Address: crAddr, Contract: cr, Tv: deployment.NewTypeAndVersion(CapabilitiesRegistry, deployment.Version1_0_0), Tx: tx, Err: err2, @@ -143,8 +143,8 @@ func deployHomeChain( lggr, chain, ab, func(chain deployment.Chain) deployment.ContractDeploy[*ccip_home.CCIPHome] { ccAddr, tx, cc, err2 := ccip_home.DeployCCIPHome( - chain.DeployerKey, - chain.Client, + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, capReg.Address, ) return deployment.ContractDeploy[*ccip_home.CCIPHome]{ @@ -161,8 +161,8 @@ func deployHomeChain( lggr, chain, ab, func(chain deployment.Chain) deployment.ContractDeploy[*rmn_home.RMNHome] { rmnAddr, tx, rmn, err2 := rmn_home.DeployRMNHome( - chain.DeployerKey, - chain.Client, + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, ) return deployment.ContractDeploy[*rmn_home.RMNHome]{ Address: rmnAddr, Tv: deployment.NewTypeAndVersion(RMNHome, deployment.Version1_6_0_dev), Tx: tx, Err: err2, Contract: rmn, @@ -176,7 +176,7 @@ func deployHomeChain( lggr.Infow("deployed RMNHome", "addr", rmnHome.Address) // considering the RMNHome is recently deployed, there is no digest to overwrite - tx, err := rmnHome.Contract.SetCandidate(chain.DeployerKey, rmnHomeStatic, rmnHomeDynamic, [32]byte{}) + tx, err := rmnHome.Contract.SetCandidate(chain.EVMChain.DeployerKey, rmnHomeStatic, rmnHomeDynamic, [32]byte{}) if _, err := deployment.ConfirmIfNoError(chain, tx, err); err != nil { lggr.Errorw("Failed to set candidate on RMNHome", "err", err) return nil, err @@ -188,7 +188,7 @@ func deployHomeChain( return nil, err } - tx, err = rmnHome.Contract.PromoteCandidateAndRevokeActive(chain.DeployerKey, rmnCandidateDigest, [32]byte{}) + tx, err = rmnHome.Contract.PromoteCandidateAndRevokeActive(chain.EVMChain.DeployerKey, rmnCandidateDigest, [32]byte{}) if _, err := deployment.ConfirmIfNoError(chain, tx, err); err != nil { lggr.Errorw("Failed to promote candidate and revoke active on RMNHome", "err", err) return nil, err @@ -207,7 +207,7 @@ func deployHomeChain( return nil, errors.New("RMNHome active digest does not match candidate digest") } - tx, err = capReg.Contract.AddCapabilities(chain.DeployerKey, []capabilities_registry.CapabilitiesRegistryCapability{ + tx, err = capReg.Contract.AddCapabilities(chain.EVMChain.DeployerKey, []capabilities_registry.CapabilitiesRegistryCapability{ { LabelledName: internal.CapabilityLabelledName, Version: internal.CapabilityVersion, @@ -221,7 +221,7 @@ func deployHomeChain( return nil, err } - tx, err = capReg.Contract.AddNodeOperators(chain.DeployerKey, nodeOps) + tx, err = capReg.Contract.AddNodeOperators(chain.EVMChain.DeployerKey, nodeOps) txBlockNum, err := deployment.ConfirmIfNoError(chain, tx, err) if err != nil { lggr.Errorw("Failed to add node operators", "err", err) @@ -315,11 +315,11 @@ func addNodes( lggr.Infow("No new nodes to add") return nil } - tx, err := capReg.AddNodes(chain.DeployerKey, nodeParams) + tx, err := capReg.AddNodes(chain.EVMChain.DeployerKey, nodeParams) if err != nil { lggr.Errorw("Failed to add nodes", "err", deployment.MaybeDataErr(err)) return err } - _, err = chain.Confirm(tx) + _, err = chain.EVMChain.Confirm(tx) return err } diff --git a/deployment/ccip/changeset/cs_home_chain_test.go b/deployment/ccip/changeset/cs_home_chain_test.go index 55bc7466837..2a010d02609 100644 --- a/deployment/ccip/changeset/cs_home_chain_test.go +++ b/deployment/ccip/changeset/cs_home_chain_test.go @@ -28,7 +28,7 @@ func TestDeployHomeChain(t *testing.T) { HomeChainSel: homeChainSel, RMNStaticConfig: NewTestRMNStaticConfig(), RMNDynamicConfig: NewTestRMNDynamicConfig(), - NodeOperators: NewTestNodeOperator(e.Chains[homeChainSel].DeployerKey.From), + NodeOperators: NewTestNodeOperator(e.Chains[homeChainSel].EVMChain.DeployerKey.From), NodeP2PIDsPerNodeOpAdmin: map[string][][32]byte{ "NodeOperator": p2pIds, }, @@ -38,9 +38,9 @@ func TestDeployHomeChain(t *testing.T) { require.NoError(t, e.ExistingAddresses.Merge(output.AddressBook)) state, err := LoadOnchainState(e) require.NoError(t, err) - require.NotNil(t, state.Chains[homeChainSel].CapabilityRegistry) - require.NotNil(t, state.Chains[homeChainSel].CCIPHome) - require.NotNil(t, state.Chains[homeChainSel].RMNHome) + require.NotNil(t, state.EVMState.Chains[homeChainSel].CapabilityRegistry) + require.NotNil(t, state.EVMState.Chains[homeChainSel].CCIPHome) + require.NotNil(t, state.EVMState.Chains[homeChainSel].RMNHome) snap, err := state.View([]uint64{homeChainSel}) require.NoError(t, err) chainid, err := chainsel.ChainIdFromSelector(homeChainSel) @@ -49,12 +49,12 @@ func TestDeployHomeChain(t *testing.T) { require.NoError(t, err) _, ok := snap[chainName] require.True(t, ok) - capRegSnap, ok := snap[chainName].CapabilityRegistry[state.Chains[homeChainSel].CapabilityRegistry.Address().String()] + capRegSnap, ok := snap[chainName].CapabilityRegistry[state.EVMState.Chains[homeChainSel].CapabilityRegistry.Address().String()] require.True(t, ok) require.NotNil(t, capRegSnap) require.Equal(t, capRegSnap.Nops, []v1_0.NopView{ { - Admin: e.Chains[homeChainSel].DeployerKey.From, + Admin: e.Chains[homeChainSel].EVMChain.DeployerKey.From, Name: "NodeOperator", }, }) diff --git a/deployment/ccip/changeset/cs_initial_add_chain.go b/deployment/ccip/changeset/cs_initial_add_chain.go index 0e425aef8c7..9d10046f844 100644 --- a/deployment/ccip/changeset/cs_initial_add_chain.go +++ b/deployment/ccip/changeset/cs_initial_add_chain.go @@ -178,17 +178,17 @@ func configureChain( e.Logger.Errorw("Failed to load existing onchain state", "err") return err } - capReg := existingState.Chains[c.HomeChainSel].CapabilityRegistry + capReg := existingState.EVMState.Chains[c.HomeChainSel].CapabilityRegistry if capReg == nil { e.Logger.Errorw("Failed to get capability registry") return fmt.Errorf("capability registry not found") } - ccipHome := existingState.Chains[c.HomeChainSel].CCIPHome + ccipHome := existingState.EVMState.Chains[c.HomeChainSel].CCIPHome if ccipHome == nil { e.Logger.Errorw("Failed to get ccip home", "err", err) return fmt.Errorf("ccip home not found") } - rmnHome := existingState.Chains[c.HomeChainSel].RMNHome + rmnHome := existingState.EVMState.Chains[c.HomeChainSel].RMNHome if rmnHome == nil { e.Logger.Errorw("Failed to get rmn home", "err", err) return fmt.Errorf("rmn home not found") @@ -196,7 +196,7 @@ func configureChain( for chainSel, chainConfig := range c.ChainConfigByChain { chain, _ := e.Chains[chainSel] - chainState, ok := existingState.Chains[chain.Selector] + chainState, ok := existingState.EVMState.Chains[chain.Selector] if !ok { return fmt.Errorf("chain state not found for chain %d", chain.Selector) } @@ -261,7 +261,7 @@ func addChainConfig( return ccip_home.CCIPHomeChainConfigArgs{}, err } chainConfig := setupConfigInfo(chainSelector, p2pIDs, uint8(len(p2pIDs)/3), encodedExtraChainConfig) - tx, err := ccipConfig.ApplyChainConfigUpdates(h.DeployerKey, nil, []ccip_home.CCIPHomeChainConfigArgs{ + tx, err := ccipConfig.ApplyChainConfigUpdates(h.EVMChain.DeployerKey, nil, []ccip_home.CCIPHomeChainConfigArgs{ chainConfig, }) if _, err := deployment.ConfirmIfNoError(h, tx, err); err != nil { @@ -352,7 +352,7 @@ func addDON( "chainSelector", dest.Selector, ) - tx, err := offRamp.SetOCR3Configs(dest.DeployerKey, offrampOCR3Configs) + tx, err := offRamp.SetOCR3Configs(dest.EVMChain.DeployerKey, offrampOCR3Configs) if _, err := deployment.ConfirmIfNoError(dest, tx, err); err != nil { return err } diff --git a/deployment/ccip/changeset/cs_prerequisites.go b/deployment/ccip/changeset/cs_prerequisites.go index e610dfaaeeb..94f18cc097d 100644 --- a/deployment/ccip/changeset/cs_prerequisites.go +++ b/deployment/ccip/changeset/cs_prerequisites.go @@ -122,7 +122,7 @@ func deployPrerequisiteContracts(e deployment.Environment, ab deployment.Address } } lggr := e.Logger - chainState, chainExists := state.Chains[chain.Selector] + chainState, chainExists := state.EVMState.Chains[chain.Selector] var weth9Contract *weth9.WETH9 var tokenAdminReg *token_admin_registry.TokenAdminRegistry var registryModule *registry_module_owner_custom.RegistryModuleOwnerCustom @@ -145,8 +145,8 @@ func deployPrerequisiteContracts(e deployment.Environment, ab deployment.Address rmn, err := deployment.DeployContract(lggr, chain, ab, func(chain deployment.Chain) deployment.ContractDeploy[*mock_rmn_contract.MockRMNContract] { rmnAddr, tx2, rmn, err2 := mock_rmn_contract.DeployMockRMNContract( - chain.DeployerKey, - chain.Client, + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, ) return deployment.ContractDeploy[*mock_rmn_contract.MockRMNContract]{ rmnAddr, rmn, tx2, deployment.NewTypeAndVersion(MockRMN, deployment.Version1_0_0), err2, @@ -160,8 +160,8 @@ func deployPrerequisiteContracts(e deployment.Environment, ab deployment.Address rmnProxyContract, err := deployment.DeployContract(lggr, chain, ab, func(chain deployment.Chain) deployment.ContractDeploy[*rmn_proxy_contract.RMNProxyContract] { rmnProxyAddr, tx2, rmnProxy, err2 := rmn_proxy_contract.DeployRMNProxyContract( - chain.DeployerKey, - chain.Client, + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, rmn.Address, ) return deployment.ContractDeploy[*rmn_proxy_contract.RMNProxyContract]{ @@ -179,8 +179,8 @@ func deployPrerequisiteContracts(e deployment.Environment, ab deployment.Address tokenAdminRegistry, err := deployment.DeployContract(e.Logger, chain, ab, func(chain deployment.Chain) deployment.ContractDeploy[*token_admin_registry.TokenAdminRegistry] { tokenAdminRegistryAddr, tx2, tokenAdminRegistry, err2 := token_admin_registry.DeployTokenAdminRegistry( - chain.DeployerKey, - chain.Client) + chain.EVMChain.DeployerKey, + chain.EVMChain.Client) return deployment.ContractDeploy[*token_admin_registry.TokenAdminRegistry]{ tokenAdminRegistryAddr, tokenAdminRegistry, tx2, deployment.NewTypeAndVersion(TokenAdminRegistry, deployment.Version1_5_0), err2, } @@ -198,8 +198,8 @@ func deployPrerequisiteContracts(e deployment.Environment, ab deployment.Address customRegistryModule, err := deployment.DeployContract(e.Logger, chain, ab, func(chain deployment.Chain) deployment.ContractDeploy[*registry_module_owner_custom.RegistryModuleOwnerCustom] { regModAddr, tx2, regMod, err2 := registry_module_owner_custom.DeployRegistryModuleOwnerCustom( - chain.DeployerKey, - chain.Client, + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, tokenAdminReg.Address()) return deployment.ContractDeploy[*registry_module_owner_custom.RegistryModuleOwnerCustom]{ regModAddr, regMod, tx2, deployment.NewTypeAndVersion(RegistryModule, deployment.Version1_5_0), err2, @@ -220,13 +220,13 @@ func deployPrerequisiteContracts(e deployment.Environment, ab deployment.Address return fmt.Errorf("failed to check if registry module is added on token admin registry: %w", err) } if !isRegistryAdded { - tx, err := tokenAdminReg.AddRegistryModule(chain.DeployerKey, registryModule.Address()) + tx, err := tokenAdminReg.AddRegistryModule(chain.EVMChain.DeployerKey, registryModule.Address()) if err != nil { e.Logger.Errorw("Failed to assign registry module on token admin registry", "err", err) return fmt.Errorf("failed to assign registry module on token admin registry: %w", err) } - _, err = chain.Confirm(tx) + _, err = chain.EVMChain.Confirm(tx) if err != nil { e.Logger.Errorw("Failed to confirm assign registry module on token admin registry", "err", err) return fmt.Errorf("failed to confirm assign registry module on token admin registry: %w", err) @@ -237,8 +237,8 @@ func deployPrerequisiteContracts(e deployment.Environment, ab deployment.Address weth, err := deployment.DeployContract(lggr, chain, ab, func(chain deployment.Chain) deployment.ContractDeploy[*weth9.WETH9] { weth9Addr, tx2, weth9c, err2 := weth9.DeployWETH9( - chain.DeployerKey, - chain.Client, + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, ) return deployment.ContractDeploy[*weth9.WETH9]{ weth9Addr, weth9c, tx2, deployment.NewTypeAndVersion(WETH9, deployment.Version1_0_0), err2, @@ -258,8 +258,8 @@ func deployPrerequisiteContracts(e deployment.Environment, ab deployment.Address routerContract, err := deployment.DeployContract(e.Logger, chain, ab, func(chain deployment.Chain) deployment.ContractDeploy[*router.Router] { routerAddr, tx2, routerC, err2 := router.DeployRouter( - chain.DeployerKey, - chain.Client, + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, weth9Contract.Address(), rmnProxy.Address(), ) @@ -280,8 +280,8 @@ func deployPrerequisiteContracts(e deployment.Environment, ab deployment.Address multicall3Contract, err := deployment.DeployContract(e.Logger, chain, ab, func(chain deployment.Chain) deployment.ContractDeploy[*multicall3.Multicall3] { multicall3Addr, tx2, multicall3Wrapper, err2 := multicall3.DeployMulticall3( - chain.DeployerKey, - chain.Client, + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, ) return deployment.ContractDeploy[*multicall3.Multicall3]{ multicall3Addr, multicall3Wrapper, tx2, deployment.NewTypeAndVersion(Multicall3, deployment.Version1_0_0), err2, diff --git a/deployment/ccip/changeset/cs_prerequisites_test.go b/deployment/ccip/changeset/cs_prerequisites_test.go index da1ff9c83a9..870c540e151 100644 --- a/deployment/ccip/changeset/cs_prerequisites_test.go +++ b/deployment/ccip/changeset/cs_prerequisites_test.go @@ -28,8 +28,8 @@ func TestDeployPrerequisites(t *testing.T) { require.NoError(t, err) state, err := LoadOnchainState(e) require.NoError(t, err) - require.NotNil(t, state.Chains[newChain].Weth9) - require.NotNil(t, state.Chains[newChain].TokenAdminRegistry) - require.NotNil(t, state.Chains[newChain].RegistryModule) - require.NotNil(t, state.Chains[newChain].Router) + require.NotNil(t, state.EVMState.Chains[newChain].Weth9) + require.NotNil(t, state.EVMState.Chains[newChain].TokenAdminRegistry) + require.NotNil(t, state.EVMState.Chains[newChain].RegistryModule) + require.NotNil(t, state.EVMState.Chains[newChain].Router) } diff --git a/deployment/ccip/changeset/initial_deploy_test.go b/deployment/ccip/changeset/initial_deploy_test.go index 97e516c8f94..aff05a113f2 100644 --- a/deployment/ccip/changeset/initial_deploy_test.go +++ b/deployment/ccip/changeset/initial_deploy_test.go @@ -38,7 +38,7 @@ func TestInitialDeploy(t *testing.T) { if src == dest { continue } - latesthdr, err := destChain.Client.HeaderByNumber(testcontext.Get(t), nil) + latesthdr, err := destChain.EVMChain.Client.HeaderByNumber(testcontext.Get(t), nil) require.NoError(t, err) block := latesthdr.Number.Uint64() startBlocks[dest] = &block @@ -48,7 +48,7 @@ func TestInitialDeploy(t *testing.T) { WithSourceChain(src), WithDestChain(dest), WithEvm2AnyMessage(router.ClientEVM2AnyMessage{ - Receiver: common.LeftPadBytes(state.Chains[dest].Receiver.Address().Bytes(), 32), + Receiver: common.LeftPadBytes(state.EVMState.Chains[dest].Receiver.Address().Bytes(), 32), Data: []byte("hello"), TokenAmounts: nil, FeeToken: common.HexToAddress("0x0"), diff --git a/deployment/ccip/changeset/internal/deploy_home_chain.go b/deployment/ccip/changeset/internal/deploy_home_chain.go index 27052b04d07..67f3ada316c 100644 --- a/deployment/ccip/changeset/internal/deploy_home_chain.go +++ b/deployment/ccip/changeset/internal/deploy_home_chain.go @@ -193,7 +193,7 @@ func SetupExecDON( // set candidate call tx, err := capReg.UpdateDON( - home.DeployerKey, + home.EVMChain.DeployerKey, donID, nodes.PeerIDs(), []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration{ @@ -235,7 +235,7 @@ func SetupExecDON( } tx, err = capReg.UpdateDON( - home.DeployerKey, + home.EVMChain.DeployerKey, donID, nodes.PeerIDs(), []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration{ @@ -318,7 +318,7 @@ func SetupCommitDON( if err != nil { return fmt.Errorf("pack set candidate call: %w", err) } - tx, err := capReg.AddDON(home.DeployerKey, nodes.PeerIDs(), []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration{ + tx, err := capReg.AddDON(home.EVMChain.DeployerKey, nodes.PeerIDs(), []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration{ { CapabilityId: CCIPCapabilityID, Config: encodedSetCandidateCall, @@ -354,7 +354,7 @@ func SetupCommitDON( } tx, err = capReg.UpdateDON( - home.DeployerKey, + home.EVMChain.DeployerKey, donID, nodes.PeerIDs(), []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration{ diff --git a/deployment/ccip/changeset/save_existing_test.go b/deployment/ccip/changeset/save_existing_test.go index 080ed80481a..617abd536f0 100644 --- a/deployment/ccip/changeset/save_existing_test.go +++ b/deployment/ccip/changeset/save_existing_test.go @@ -62,9 +62,9 @@ func TestSaveExistingCCIP(t *testing.T) { require.NoError(t, err) state, err := LoadOnchainState(e) require.NoError(t, err) - require.Equal(t, state.Chains[chain1].LinkToken.Address(), common.BigToAddress(big.NewInt(1))) - require.Equal(t, state.Chains[chain1].Weth9.Address(), common.BigToAddress(big.NewInt(2))) - require.Equal(t, state.Chains[chain1].TokenAdminRegistry.Address(), common.BigToAddress(big.NewInt(3))) - require.Equal(t, state.Chains[chain2].RegistryModule.Address(), common.BigToAddress(big.NewInt(4))) - require.Equal(t, state.Chains[chain2].Router.Address(), common.BigToAddress(big.NewInt(5))) + require.Equal(t, state.EVMState.Chains[chain1].LinkToken.Address(), common.BigToAddress(big.NewInt(1))) + require.Equal(t, state.EVMState.Chains[chain1].Weth9.Address(), common.BigToAddress(big.NewInt(2))) + require.Equal(t, state.EVMState.Chains[chain1].TokenAdminRegistry.Address(), common.BigToAddress(big.NewInt(3))) + require.Equal(t, state.EVMState.Chains[chain2].RegistryModule.Address(), common.BigToAddress(big.NewInt(4))) + require.Equal(t, state.EVMState.Chains[chain2].Router.Address(), common.BigToAddress(big.NewInt(5))) } diff --git a/deployment/ccip/changeset/state.go b/deployment/ccip/changeset/state.go index 20763523141..3e370bd7db6 100644 --- a/deployment/ccip/changeset/state.go +++ b/deployment/ccip/changeset/state.go @@ -233,12 +233,20 @@ func (c CCIPChainState) GenerateView() (view.ChainView, error) { // Offchain state always derivable from a list of nodeIds. // Note can translate this into Go struct needed for MCMS/Docs/UI. type CCIPOnChainState struct { + SolanaState SolanaCCIPOnChainState + EVMState EVMCCIPOnChainState +} + +type EVMCCIPOnChainState struct { // Populated go bindings for the appropriate version for all contracts. // We would hold 2 versions of each contract here. Once we upgrade we can phase out the old one. // When generating bindings, make sure the package name corresponds to the version. Chains map[uint64]CCIPChainState } +type SolanaCCIPOnChainState struct { +} + func (s CCIPOnChainState) View(chains []uint64) (map[string]view.ChainView, error) { m := make(map[string]view.ChainView) for _, chainSelector := range chains { @@ -251,10 +259,10 @@ func (s CCIPOnChainState) View(chains []uint64) (map[string]view.ChainView, erro if err != nil { return m, err } - if _, ok := s.Chains[chainSelector]; !ok { + if _, ok := s.EVMState.Chains[chainSelector]; !ok { return m, fmt.Errorf("chain not supported %d", chainSelector) } - chainState := s.Chains[chainSelector] + chainState := s.EVMState.Chains[chainSelector] chainView, err := chainState.GenerateView() if err != nil { return m, err @@ -266,7 +274,9 @@ func (s CCIPOnChainState) View(chains []uint64) (map[string]view.ChainView, erro func LoadOnchainState(e deployment.Environment) (CCIPOnChainState, error) { state := CCIPOnChainState{ - Chains: make(map[uint64]CCIPChainState), + EVMState: EVMCCIPOnChainState{ + Chains: make(map[uint64]CCIPChainState), + }, } for chainSelector, chain := range e.Chains { addresses, err := e.ExistingAddresses.AddressesForChain(chainSelector) @@ -282,7 +292,7 @@ func LoadOnchainState(e deployment.Environment) (CCIPOnChainState, error) { if err != nil { return state, err } - state.Chains[chainSelector] = chainState + state.EVMState.Chains[chainSelector] = chainState } return state, nil } @@ -310,109 +320,109 @@ func LoadChainState(chain deployment.Chain, addresses map[string]deployment.Type deployment.NewTypeAndVersion(commontypes.LinkToken, deployment.Version1_0_0).String(): continue case deployment.NewTypeAndVersion(CapabilitiesRegistry, deployment.Version1_0_0).String(): - cr, err := capabilities_registry.NewCapabilitiesRegistry(common.HexToAddress(address), chain.Client) + cr, err := capabilities_registry.NewCapabilitiesRegistry(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return state, err } state.CapabilityRegistry = cr case deployment.NewTypeAndVersion(OnRamp, deployment.Version1_6_0_dev).String(): - onRampC, err := onramp.NewOnRamp(common.HexToAddress(address), chain.Client) + onRampC, err := onramp.NewOnRamp(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return state, err } state.OnRamp = onRampC case deployment.NewTypeAndVersion(OffRamp, deployment.Version1_6_0_dev).String(): - offRamp, err := offramp.NewOffRamp(common.HexToAddress(address), chain.Client) + offRamp, err := offramp.NewOffRamp(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return state, err } state.OffRamp = offRamp case deployment.NewTypeAndVersion(ARMProxy, deployment.Version1_0_0).String(): - armProxy, err := rmn_proxy_contract.NewRMNProxyContract(common.HexToAddress(address), chain.Client) + armProxy, err := rmn_proxy_contract.NewRMNProxyContract(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return state, err } state.RMNProxyExisting = armProxy case deployment.NewTypeAndVersion(ARMProxy, deployment.Version1_6_0_dev).String(): - armProxy, err := rmn_proxy_contract.NewRMNProxyContract(common.HexToAddress(address), chain.Client) + armProxy, err := rmn_proxy_contract.NewRMNProxyContract(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return state, err } state.RMNProxyNew = armProxy case deployment.NewTypeAndVersion(ARMProxy, deployment.Version1_6_0_dev).String(): - armProxy, err := rmn_proxy_contract.NewRMNProxyContract(common.HexToAddress(address), chain.Client) + armProxy, err := rmn_proxy_contract.NewRMNProxyContract(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return state, err } state.RMNProxyNew = armProxy case deployment.NewTypeAndVersion(MockRMN, deployment.Version1_0_0).String(): - mockRMN, err := mock_rmn_contract.NewMockRMNContract(common.HexToAddress(address), chain.Client) + mockRMN, err := mock_rmn_contract.NewMockRMNContract(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return state, err } state.MockRMN = mockRMN case deployment.NewTypeAndVersion(RMNRemote, deployment.Version1_6_0_dev).String(): - rmnRemote, err := rmn_remote.NewRMNRemote(common.HexToAddress(address), chain.Client) + rmnRemote, err := rmn_remote.NewRMNRemote(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return state, err } state.RMNRemote = rmnRemote case deployment.NewTypeAndVersion(RMNHome, deployment.Version1_6_0_dev).String(): - rmnHome, err := rmn_home.NewRMNHome(common.HexToAddress(address), chain.Client) + rmnHome, err := rmn_home.NewRMNHome(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return state, err } state.RMNHome = rmnHome case deployment.NewTypeAndVersion(WETH9, deployment.Version1_0_0).String(): - weth9, err := weth9.NewWETH9(common.HexToAddress(address), chain.Client) + weth9, err := weth9.NewWETH9(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return state, err } state.Weth9 = weth9 case deployment.NewTypeAndVersion(NonceManager, deployment.Version1_6_0_dev).String(): - nm, err := nonce_manager.NewNonceManager(common.HexToAddress(address), chain.Client) + nm, err := nonce_manager.NewNonceManager(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return state, err } state.NonceManager = nm case deployment.NewTypeAndVersion(CommitStore, deployment.Version1_5_0).String(): - cs, err := commit_store.NewCommitStore(common.HexToAddress(address), chain.Client) + cs, err := commit_store.NewCommitStore(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return state, err } state.CommitStore = cs case deployment.NewTypeAndVersion(TokenAdminRegistry, deployment.Version1_5_0).String(): - tm, err := token_admin_registry.NewTokenAdminRegistry(common.HexToAddress(address), chain.Client) + tm, err := token_admin_registry.NewTokenAdminRegistry(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return state, err } state.TokenAdminRegistry = tm case deployment.NewTypeAndVersion(RegistryModule, deployment.Version1_5_0).String(): - rm, err := registry_module_owner_custom.NewRegistryModuleOwnerCustom(common.HexToAddress(address), chain.Client) + rm, err := registry_module_owner_custom.NewRegistryModuleOwnerCustom(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return state, err } state.RegistryModule = rm case deployment.NewTypeAndVersion(Router, deployment.Version1_2_0).String(): - r, err := router.NewRouter(common.HexToAddress(address), chain.Client) + r, err := router.NewRouter(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return state, err } state.Router = r case deployment.NewTypeAndVersion(TestRouter, deployment.Version1_2_0).String(): - r, err := router.NewRouter(common.HexToAddress(address), chain.Client) + r, err := router.NewRouter(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return state, err } state.TestRouter = r case deployment.NewTypeAndVersion(FeeQuoter, deployment.Version1_6_0_dev).String(): - fq, err := fee_quoter.NewFeeQuoter(common.HexToAddress(address), chain.Client) + fq, err := fee_quoter.NewFeeQuoter(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return state, err } state.FeeQuoter = fq case deployment.NewTypeAndVersion(USDCToken, deployment.Version1_0_0).String(): - ut, err := burn_mint_erc677.NewBurnMintERC677(common.HexToAddress(address), chain.Client) + ut, err := burn_mint_erc677.NewBurnMintERC677(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return state, err } @@ -420,50 +430,50 @@ func LoadChainState(chain deployment.Chain, addresses map[string]deployment.Type USDCSymbol: ut, } case deployment.NewTypeAndVersion(USDCTokenPool, deployment.Version1_0_0).String(): - utp, err := usdc_token_pool.NewUSDCTokenPool(common.HexToAddress(address), chain.Client) + utp, err := usdc_token_pool.NewUSDCTokenPool(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return state, err } state.USDCTokenPool = utp case deployment.NewTypeAndVersion(USDCMockTransmitter, deployment.Version1_0_0).String(): - umt, err := mock_usdc_token_transmitter.NewMockE2EUSDCTransmitter(common.HexToAddress(address), chain.Client) + umt, err := mock_usdc_token_transmitter.NewMockE2EUSDCTransmitter(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return state, err } state.MockUSDCTransmitter = umt case deployment.NewTypeAndVersion(USDCTokenMessenger, deployment.Version1_0_0).String(): - utm, err := mock_usdc_token_messenger.NewMockE2EUSDCTokenMessenger(common.HexToAddress(address), chain.Client) + utm, err := mock_usdc_token_messenger.NewMockE2EUSDCTokenMessenger(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return state, err } state.MockUSDCTokenMessenger = utm case deployment.NewTypeAndVersion(CCIPHome, deployment.Version1_6_0_dev).String(): - ccipHome, err := ccip_home.NewCCIPHome(common.HexToAddress(address), chain.Client) + ccipHome, err := ccip_home.NewCCIPHome(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return state, err } state.CCIPHome = ccipHome case deployment.NewTypeAndVersion(CCIPConfig, deployment.Version1_0_0).String(): // TODO: Remove once staging upgraded. - ccipConfig, err := ccip_config.NewCCIPConfig(common.HexToAddress(address), chain.Client) + ccipConfig, err := ccip_config.NewCCIPConfig(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return state, err } state.CCIPConfig = ccipConfig case deployment.NewTypeAndVersion(CCIPReceiver, deployment.Version1_0_0).String(): - mr, err := maybe_revert_message_receiver.NewMaybeRevertMessageReceiver(common.HexToAddress(address), chain.Client) + mr, err := maybe_revert_message_receiver.NewMaybeRevertMessageReceiver(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return state, err } state.Receiver = mr case deployment.NewTypeAndVersion(Multicall3, deployment.Version1_0_0).String(): - mc, err := multicall3.NewMulticall3(common.HexToAddress(address), chain.Client) + mc, err := multicall3.NewMulticall3(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return state, err } state.Multicall3 = mc case deployment.NewTypeAndVersion(PriceFeed, deployment.Version1_0_0).String(): - feed, err := aggregator_v3_interface.NewAggregatorV3Interface(common.HexToAddress(address), chain.Client) + feed, err := aggregator_v3_interface.NewAggregatorV3Interface(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return state, err } @@ -480,7 +490,7 @@ func LoadChainState(chain deployment.Chain, addresses map[string]deployment.Type } state.USDFeeds[key] = feed case deployment.NewTypeAndVersion(BurnMintTokenPool, deployment.Version1_5_1).String(): - pool, err := burn_mint_token_pool.NewBurnMintTokenPool(common.HexToAddress(address), chain.Client) + pool, err := burn_mint_token_pool.NewBurnMintTokenPool(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return state, err } @@ -491,7 +501,7 @@ func LoadChainState(chain deployment.Chain, addresses map[string]deployment.Type if err != nil { return state, err } - tok, err := erc20.NewERC20(tokAddress, chain.Client) + tok, err := erc20.NewERC20(tokAddress, chain.EVMChain.Client) if err != nil { return state, err } @@ -501,7 +511,7 @@ func LoadChainState(chain deployment.Chain, addresses map[string]deployment.Type } state.BurnMintTokenPools[TokenSymbol(symbol)] = pool case deployment.NewTypeAndVersion(BurnMintToken, deployment.Version1_0_0).String(): - tok, err := burn_mint_erc677.NewBurnMintERC677(common.HexToAddress(address), chain.Client) + tok, err := burn_mint_erc677.NewBurnMintERC677(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return state, err } diff --git a/deployment/ccip/changeset/test_assertions.go b/deployment/ccip/changeset/test_assertions.go index ad2ea4257ea..4c18658c1b4 100644 --- a/deployment/ccip/changeset/test_assertions.go +++ b/deployment/ccip/changeset/test_assertions.go @@ -46,7 +46,7 @@ func ConfirmGasPriceUpdatedForAll( return ConfirmGasPriceUpdated( t, dstChain, - state.Chains[srcChain.Selector].FeeQuoter, + state.EVMState.Chains[srcChain.Selector].FeeQuoter, *startBlock, gasPrice, ) @@ -92,15 +92,15 @@ func ConfirmTokenPriceUpdatedForAll( if startBlocks != nil { startBlock = startBlocks[chain.Selector] } - linkAddress := state.Chains[chain.Selector].LinkToken.Address() - wethAddress := state.Chains[chain.Selector].Weth9.Address() + linkAddress := state.EVMState.Chains[chain.Selector].LinkToken.Address() + wethAddress := state.EVMState.Chains[chain.Selector].Weth9.Address() tokenToPrice := make(map[common.Address]*big.Int) tokenToPrice[linkAddress] = linkPrice tokenToPrice[wethAddress] = wethPrice return ConfirmTokenPriceUpdated( t, chain, - state.Chains[chain.Selector].FeeQuoter, + state.EVMState.Chains[chain.Selector].FeeQuoter, *startBlock, tokenToPrice, ) @@ -194,7 +194,7 @@ func ConfirmCommitForAllWithExpectedSeqNums( t, srcChain, dstChain, - state.Chains[dstChain.Selector].OffRamp, + state.EVMState.Chains[dstChain.Selector].OffRamp, startBlock, ccipocr3.SeqNumRange{ ccipocr3.SeqNum(expectedSeqNum), @@ -299,10 +299,10 @@ func ConfirmCommitWithExpectedSeqNumRange( select { case <-ticker.C: // if it's simulated backend, commit to ensure mining - if backend, ok := src.Client.(*memory.Backend); ok { + if backend, ok := src.EVMChain.Client.(*memory.Backend); ok { backend.Commit() } - if backend, ok := dest.Client.(*memory.Backend); ok { + if backend, ok := dest.EVMChain.Client.(*memory.Backend); ok { backend.Commit() } t.Logf("Waiting for commit report on chain selector %d from source selector %d expected seq nr range %s", @@ -410,7 +410,7 @@ func ConfirmExecWithSeqNrsForAll( t, srcChain, dstChain, - state.Chains[dstChain.Selector].OffRamp, + state.EVMState.Chains[dstChain.Selector].OffRamp, startBlock, expectedSeqNum, ) @@ -534,10 +534,10 @@ func ConfirmNoExecConsistentlyWithSeqNr( func GetExecutionState(t *testing.T, source, dest deployment.Chain, offRamp *offramp.OffRamp, expectedSeqNr uint64) (offramp.OffRampSourceChainConfig, uint8) { // if it's simulated backend, commit to ensure mining - if backend, ok := source.Client.(*memory.Backend); ok { + if backend, ok := source.EVMChain.Client.(*memory.Backend); ok { backend.Commit() } - if backend, ok := dest.Client.(*memory.Backend); ok { + if backend, ok := dest.EVMChain.Client.(*memory.Backend); ok { backend.Commit() } scc, err := offRamp.GetSourceChainConfig(nil, source.Selector) diff --git a/deployment/ccip/changeset/test_helpers.go b/deployment/ccip/changeset/test_helpers.go index 742fe39200a..05bb17b75dd 100644 --- a/deployment/ccip/changeset/test_helpers.go +++ b/deployment/ccip/changeset/test_helpers.go @@ -141,7 +141,9 @@ func DeployTestContracts(t *testing.T, capReg, err := deployCapReg(lggr, // deploying cap reg for the first time on a blank chain state CCIPOnChainState{ - Chains: make(map[uint64]CCIPChainState), + EVMState: EVMCCIPOnChainState{ + Chains: make(map[uint64]CCIPChainState), + }, }, ab, chains[homeChainSel]) require.NoError(t, err) @@ -161,7 +163,7 @@ func DeployTestContracts(t *testing.T, func LatestBlocksByChain(ctx context.Context, chains map[uint64]deployment.Chain) (map[uint64]uint64, error) { latestBlocks := make(map[uint64]uint64) for _, chain := range chains { - latesthdr, err := chain.Client.HeaderByNumber(ctx, nil) + latesthdr, err := chain.EVMChain.Client.HeaderByNumber(ctx, nil) if err != nil { return nil, errors.Wrapf(err, "failed to get latest header for chain %d", chain.Selector) } @@ -217,7 +219,7 @@ func NewMemoryEnvironment( _, err = deployHomeChain(lggr, e, e.ExistingAddresses, chains[homeChainSel], NewTestRMNStaticConfig(), NewTestRMNDynamicConfig(), - NewTestNodeOperator(chains[homeChainSel].DeployerKey.From), + NewTestNodeOperator(chains[homeChainSel].EVMChain.DeployerKey.From), map[string][][32]byte{ "NodeOperator": envNodes.NonBootstraps().PeerIDs(), }, @@ -324,15 +326,15 @@ func NewMemoryEnvironmentWithJobsAndContracts(t *testing.T, lggr logger.Logger, require.NoError(t, err) // Assert USDC set up as expected. for _, chain := range usdcChains { - require.NotNil(t, state.Chains[chain].MockUSDCTokenMessenger) - require.NotNil(t, state.Chains[chain].MockUSDCTransmitter) - require.NotNil(t, state.Chains[chain].USDCTokenPool) + require.NotNil(t, state.EVMState.Chains[chain].MockUSDCTokenMessenger) + require.NotNil(t, state.EVMState.Chains[chain].MockUSDCTransmitter) + require.NotNil(t, state.EVMState.Chains[chain].USDCTokenPool) } // Assert link present - require.NotNil(t, state.Chains[e.FeedChainSel].LinkToken) - require.NotNil(t, state.Chains[e.FeedChainSel].Weth9) + require.NotNil(t, state.EVMState.Chains[e.FeedChainSel].LinkToken) + require.NotNil(t, state.EVMState.Chains[e.FeedChainSel].Weth9) - tokenConfig := NewTestTokenConfig(state.Chains[e.FeedChainSel].USDFeeds) + tokenConfig := NewTestTokenConfig(state.EVMState.Chains[e.FeedChainSel].USDFeeds) var tokenDataProviders []pluginconfig.TokenDataObserverConfig if len(usdcChains) > 0 { server := mockAttestationResponse(tCfg.IsUSDCAttestationMissing) @@ -343,8 +345,8 @@ func NewMemoryEnvironmentWithJobsAndContracts(t *testing.T, lggr logger.Logger, cctpContracts := make(map[cciptypes.ChainSelector]pluginconfig.USDCCCTPTokenConfig) for _, usdcChain := range usdcChains { cctpContracts[cciptypes.ChainSelector(usdcChain)] = pluginconfig.USDCCCTPTokenConfig{ - SourcePoolAddress: state.Chains[usdcChain].USDCTokenPool.Address().String(), - SourceMessageTransmitterAddr: state.Chains[usdcChain].MockUSDCTransmitter.Address().String(), + SourcePoolAddress: state.EVMState.Chains[usdcChain].USDCTokenPool.Address().String(), + SourceMessageTransmitterAddr: state.EVMState.Chains[usdcChain].MockUSDCTransmitter.Address().String(), } } tokenDataProviders = append(tokenDataProviders, pluginconfig.TokenDataObserverConfig{ @@ -361,8 +363,8 @@ func NewMemoryEnvironmentWithJobsAndContracts(t *testing.T, lggr logger.Logger, chainConfigs := make(map[uint64]CCIPOCRParams) timelocksPerChain := make(map[uint64]*gethwrappers.RBACTimelock) for _, chain := range allChains { - timelocksPerChain[chain] = state.Chains[chain].Timelock - tokenInfo := tokenConfig.GetTokenInfo(e.Env.Logger, state.Chains[chain].LinkToken, state.Chains[chain].Weth9) + timelocksPerChain[chain] = state.EVMState.Chains[chain].Timelock + tokenInfo := tokenConfig.GetTokenInfo(e.Env.Logger, state.EVMState.Chains[chain].LinkToken, state.EVMState.Chains[chain].Weth9) chainConfigs[chain] = DefaultOCRParams(e.FeedChainSel, tokenInfo, tokenDataProviders) } // Deploy second set of changesets to deploy and configure the CCIP contracts. @@ -384,21 +386,21 @@ func NewMemoryEnvironmentWithJobsAndContracts(t *testing.T, lggr logger.Logger, state, err = LoadOnchainState(e.Env) require.NoError(t, err) - require.NotNil(t, state.Chains[e.HomeChainSel].CapabilityRegistry) - require.NotNil(t, state.Chains[e.HomeChainSel].CCIPHome) - require.NotNil(t, state.Chains[e.HomeChainSel].RMNHome) + require.NotNil(t, state.EVMState.Chains[e.HomeChainSel].CapabilityRegistry) + require.NotNil(t, state.EVMState.Chains[e.HomeChainSel].CCIPHome) + require.NotNil(t, state.EVMState.Chains[e.HomeChainSel].RMNHome) for _, chain := range allChains { - require.NotNil(t, state.Chains[chain].LinkToken) - require.NotNil(t, state.Chains[chain].Weth9) - require.NotNil(t, state.Chains[chain].TokenAdminRegistry) - require.NotNil(t, state.Chains[chain].RegistryModule) - require.NotNil(t, state.Chains[chain].Router) - require.NotNil(t, state.Chains[chain].RMNRemote) - require.NotNil(t, state.Chains[chain].TestRouter) - require.NotNil(t, state.Chains[chain].NonceManager) - require.NotNil(t, state.Chains[chain].FeeQuoter) - require.NotNil(t, state.Chains[chain].OffRamp) - require.NotNil(t, state.Chains[chain].OnRamp) + require.NotNil(t, state.EVMState.Chains[chain].LinkToken) + require.NotNil(t, state.EVMState.Chains[chain].Weth9) + require.NotNil(t, state.EVMState.Chains[chain].TokenAdminRegistry) + require.NotNil(t, state.EVMState.Chains[chain].RegistryModule) + require.NotNil(t, state.EVMState.Chains[chain].Router) + require.NotNil(t, state.EVMState.Chains[chain].RMNRemote) + require.NotNil(t, state.EVMState.Chains[chain].TestRouter) + require.NotNil(t, state.EVMState.Chains[chain].NonceManager) + require.NotNil(t, state.EVMState.Chains[chain].FeeQuoter) + require.NotNil(t, state.EVMState.Chains[chain].OffRamp) + require.NotNil(t, state.EVMState.Chains[chain].OnRamp) } return e } @@ -415,9 +417,9 @@ func CCIPSendRequest( FeeToken: cfg.Evm2AnyMessage.FeeToken, ExtraArgs: cfg.Evm2AnyMessage.ExtraArgs, } - r := state.Chains[cfg.SourceChain].Router + r := state.EVMState.Chains[cfg.SourceChain].Router if cfg.IsTestRouter { - r = state.Chains[cfg.SourceChain].TestRouter + r = state.EVMState.Chains[cfg.SourceChain].TestRouter } if msg.FeeToken == common.HexToAddress("0x0") { // fee is in native token @@ -428,7 +430,7 @@ func CCIPSendRequest( if err != nil { return nil, 0, errors.Wrap(err, "failed to send CCIP message") } - blockNum, err := e.Chains[cfg.SourceChain].Confirm(tx) + blockNum, err := e.Chains[cfg.SourceChain].EVMChain.Confirm(tx) if err != nil { return tx, 0, errors.Wrap(err, "failed to confirm CCIP message") } @@ -459,7 +461,7 @@ func retryCcipSendUntilNativeFeeIsSufficient( return nil, 0, fmt.Errorf("failed to send CCIP message: %w", err) } - blockNum, err := e.Chains[cfg.SourceChain].Confirm(tx) + blockNum, err := e.Chains[cfg.SourceChain].EVMChain.Confirm(tx) if err != nil { if strings.Contains(err.Error(), errCodeInsufficientFee) { continue @@ -499,7 +501,7 @@ func TestSendRequest( evm2AnyMessage router.ClientEVM2AnyMessage, ) (msgSentEvent *onramp.OnRampCCIPMessageSent) { msgSentEvent, err := DoSendRequest(t, e, state, - WithSender(e.Chains[src].DeployerKey), + WithSender(e.Chains[src].EVMChain.DeployerKey), WithSourceChain(src), WithDestChain(dest), WithTestRouter(testRouter), @@ -561,7 +563,7 @@ func DoSendRequest( } // Set default sender if not provided if cfg.Sender == nil { - cfg.Sender = e.Chains[cfg.SourceChain].DeployerKey + cfg.Sender = e.Chains[cfg.SourceChain].EVMChain.DeployerKey } t.Logf("Sending CCIP request from chain selector %d to chain selector %d from sender %s", cfg.SourceChain, cfg.DestChain, cfg.Sender.From.String()) @@ -570,7 +572,7 @@ func DoSendRequest( return nil, err } - it, err := state.Chains[cfg.SourceChain].OnRamp.FilterCCIPMessageSent(&bind.FilterOpts{ + it, err := state.EVMState.Chains[cfg.SourceChain].OnRamp.FilterCCIPMessageSent(&bind.FilterOpts{ Start: blockNum, End: &blockNum, Context: context.Background(), @@ -687,12 +689,12 @@ func DeployFeeds( linkTV := deployment.NewTypeAndVersion(PriceFeed, deployment.Version1_0_0) mockLinkFeed := func(chain deployment.Chain) deployment.ContractDeploy[*aggregator_v3_interface.AggregatorV3Interface] { linkFeed, tx, _, err1 := mock_v3_aggregator_contract.DeployMockV3Aggregator( - chain.DeployerKey, - chain.Client, + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, LinkDecimals, // decimals linkPrice, // initialAnswer ) - aggregatorCr, err2 := aggregator_v3_interface.NewAggregatorV3Interface(linkFeed, chain.Client) + aggregatorCr, err2 := aggregator_v3_interface.NewAggregatorV3Interface(linkFeed, chain.EVMChain.Client) return deployment.ContractDeploy[*aggregator_v3_interface.AggregatorV3Interface]{ Address: linkFeed, Contract: aggregatorCr, Tv: linkTV, Tx: tx, Err: multierr.Append(err1, err2), @@ -701,11 +703,11 @@ func DeployFeeds( mockWethFeed := func(chain deployment.Chain) deployment.ContractDeploy[*aggregator_v3_interface.AggregatorV3Interface] { wethFeed, tx, _, err1 := mock_ethusd_aggregator_wrapper.DeployMockETHUSDAggregator( - chain.DeployerKey, - chain.Client, + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, wethPrice, // initialAnswer ) - aggregatorCr, err2 := aggregator_v3_interface.NewAggregatorV3Interface(wethFeed, chain.Client) + aggregatorCr, err2 := aggregator_v3_interface.NewAggregatorV3Interface(wethFeed, chain.EVMChain.Client) return deployment.ContractDeploy[*aggregator_v3_interface.AggregatorV3Interface]{ Address: wethFeed, Contract: aggregatorCr, Tv: linkTV, Tx: tx, Err: multierr.Append(err1, err2), @@ -761,12 +763,12 @@ func deploySingleFeed( } func ConfirmRequestOnSourceAndDest(t *testing.T, env deployment.Environment, state CCIPOnChainState, sourceCS, destCS, expectedSeqNr uint64) error { - latesthdr, err := env.Chains[destCS].Client.HeaderByNumber(testcontext.Get(t), nil) + latesthdr, err := env.Chains[destCS].EVMChain.Client.HeaderByNumber(testcontext.Get(t), nil) require.NoError(t, err) startBlock := latesthdr.Number.Uint64() fmt.Printf("startblock %d", startBlock) msgSentEvent := TestSendRequest(t, env, state, sourceCS, destCS, false, router.ClientEVM2AnyMessage{ - Receiver: common.LeftPadBytes(state.Chains[destCS].Receiver.Address().Bytes(), 32), + Receiver: common.LeftPadBytes(state.EVMState.Chains[destCS].Receiver.Address().Bytes(), 32), Data: []byte("hello world"), TokenAmounts: nil, FeeToken: common.HexToAddress("0x0"), @@ -776,7 +778,7 @@ func ConfirmRequestOnSourceAndDest(t *testing.T, env deployment.Environment, sta fmt.Printf("Request sent for seqnr %d", msgSentEvent.SequenceNumber) require.NoError(t, - commonutils.JustError(ConfirmCommitWithExpectedSeqNumRange(t, env.Chains[sourceCS], env.Chains[destCS], state.Chains[destCS].OffRamp, &startBlock, cciptypes.SeqNumRange{ + commonutils.JustError(ConfirmCommitWithExpectedSeqNumRange(t, env.Chains[sourceCS], env.Chains[destCS], state.EVMState.Chains[destCS].OffRamp, &startBlock, cciptypes.SeqNumRange{ cciptypes.SeqNum(msgSentEvent.SequenceNumber), cciptypes.SeqNum(msgSentEvent.SequenceNumber), }, true))) @@ -789,7 +791,7 @@ func ConfirmRequestOnSourceAndDest(t *testing.T, env deployment.Environment, sta t, env.Chains[sourceCS], env.Chains[destCS], - state.Chains[destCS].OffRamp, + state.EVMState.Chains[destCS].OffRamp, &startBlock, []uint64{msgSentEvent.SequenceNumber}, ), @@ -816,7 +818,7 @@ func ProcessChangeset(t *testing.T, e deployment.Environment, c deployment.Chang signed := commonchangeset.SignProposal(t, e, &prop) for _, sel := range chains.ToSlice() { - commonchangeset.ExecuteProposal(t, e, signed, state.Chains[sel].Timelock, sel) + commonchangeset.ExecuteProposal(t, e, signed, state.EVMState.Chains[sel].Timelock, sel) } } } @@ -900,7 +902,7 @@ func deployTokenPoolsInParallel( if err != nil { return err } - if err := attachTokenToTheRegistry(chains[src], state.Chains[src], srcActor, srcToken.Address(), srcPool.Address()); err != nil { + if err := attachTokenToTheRegistry(chains[src], state.EVMState.Chains[src], srcActor, srcToken.Address(), srcPool.Address()); err != nil { return err } return nil @@ -911,7 +913,7 @@ func deployTokenPoolsInParallel( if err != nil { return err } - if err := attachTokenToTheRegistry(chains[dst], state.Chains[dst], dstActor, dstToken.Address(), dstPool.Address()); err != nil { + if err := attachTokenToTheRegistry(chains[dst], state.EVMState.Chains[dst], dstActor, dstToken.Address(), dstPool.Address()); err != nil { return err } return nil @@ -931,7 +933,7 @@ func grantMintBurnPermissions(lggr logger.Logger, chain deployment.Chain, token if err != nil { return err } - _, err = chain.Confirm(tx) + _, err = chain.EVMChain.Confirm(tx) return err } @@ -957,17 +959,17 @@ func setUSDCTokenPoolCounterPart( Enabled: true, }, } - tx, err := tokenPool.SetDomains(chain.DeployerKey, domains) + tx, err := tokenPool.SetDomains(chain.EVMChain.DeployerKey, domains) if err != nil { return err } - _, err = chain.Confirm(tx) + _, err = chain.EVMChain.Confirm(tx) if err != nil { return err } - pool, err := burn_mint_token_pool.NewBurnMintTokenPool(tokenPool.Address(), chain.Client) + pool, err := burn_mint_token_pool.NewBurnMintTokenPool(tokenPool.Address(), chain.EVMChain.Client) if err != nil { return err } @@ -1001,7 +1003,7 @@ func setTokenPoolCounterPart(chain deployment.Chain, tokenPool *burn_mint_token_ return fmt.Errorf("failed to apply chain updates on token pool %s: %w", tokenPool.Address(), err) } - _, err = chain.Confirm(tx) + _, err = chain.EVMChain.Confirm(tx) if err != nil { return err } @@ -1015,7 +1017,7 @@ func setTokenPoolCounterPart(chain deployment.Chain, tokenPool *burn_mint_token_ return fmt.Errorf("failed to set remote pool on token pool %s: %w", tokenPool.Address(), err) } - _, err = chain.Confirm(tx) + _, err = chain.EVMChain.Confirm(tx) return err } @@ -1039,7 +1041,7 @@ func attachTokenToTheRegistry( if err != nil { return err } - _, err = chain.Confirm(tx) + _, err = chain.EVMChain.Confirm(tx) if err != nil { return err } @@ -1048,7 +1050,7 @@ func attachTokenToTheRegistry( if err != nil { return err } - _, err = chain.Confirm(tx) + _, err = chain.EVMChain.Confirm(tx) if err != nil { return err } @@ -1057,7 +1059,7 @@ func attachTokenToTheRegistry( if err != nil { return err } - _, err = chain.Confirm(tx) + _, err = chain.EVMChain.Confirm(tx) if err != nil { return err } @@ -1094,7 +1096,7 @@ func deployTransferTokenOneEnd( func(chain deployment.Chain) deployment.ContractDeploy[*burn_mint_erc677.BurnMintERC677] { tokenAddress, tx, token, err2 := burn_mint_erc677.DeployBurnMintERC677( deployer, - chain.Client, + chain.EVMChain.Client, tokenSymbol, tokenSymbol, tokenDecimals, @@ -1113,7 +1115,7 @@ func deployTransferTokenOneEnd( if err != nil { return nil, nil, err } - _, err = chain.Confirm(tx) + _, err = chain.EVMChain.Confirm(tx) if err != nil { return nil, nil, err } @@ -1122,7 +1124,7 @@ func deployTransferTokenOneEnd( func(chain deployment.Chain) deployment.ContractDeploy[*burn_mint_token_pool.BurnMintTokenPool] { tokenPoolAddress, tx, tokenPoolContract, err2 := burn_mint_token_pool.DeployBurnMintTokenPool( deployer, - chain.Client, + chain.EVMChain.Client, tokenContract.Address, tokenDecimals, []common.Address{}, @@ -1172,7 +1174,7 @@ func MintAndAllow( for _, mintTokenInfo := range mintTokenInfos { sender := mintTokenInfo.sender if sender == nil { - sender = e.Chains[chain].DeployerKey + sender = e.Chains[chain].EVMChain.DeployerKey } for _, token := range mintTokenInfo.tokens { @@ -1182,12 +1184,12 @@ func MintAndAllow( new(big.Int).Mul(tenCoins, big.NewInt(10)), ) require.NoError(t, err) - _, err = e.Chains[chain].Confirm(tx) + _, err = e.Chains[chain].EVMChain.Confirm(tx) require.NoError(t, err) - tx, err = token.Approve(sender, state.Chains[chain].Router.Address(), tenCoins) + tx, err = token.Approve(sender, state.EVMState.Chains[chain].Router.Address(), tenCoins) require.NoError(t, err) - _, err = e.Chains[chain].Confirm(tx) + _, err = e.Chains[chain].EVMChain.Confirm(tx) require.NoError(t, err) } } @@ -1210,7 +1212,7 @@ func Transfer( ) (*onramp.OnRampCCIPMessageSent, map[uint64]*uint64) { startBlocks := make(map[uint64]*uint64) - latesthdr, err := env.Chains[destChain].Client.HeaderByNumber(ctx, nil) + latesthdr, err := env.Chains[destChain].EVMChain.Client.HeaderByNumber(ctx, nil) require.NoError(t, err) block := latesthdr.Number.Uint64() startBlocks[destChain] = &block @@ -1266,7 +1268,7 @@ func WaitForTheTokenBalance( chain deployment.Chain, expected *big.Int, ) { - tokenContract, err := burn_mint_erc677.NewBurnMintERC677(token, chain.Client) + tokenContract, err := burn_mint_erc677.NewBurnMintERC677(token, chain.EVMChain.Client) require.NoError(t, err) require.Eventually(t, func() bool { @@ -1291,7 +1293,7 @@ func GetTokenBalance( receiver common.Address, chain deployment.Chain, ) *big.Int { - tokenContract, err := burn_mint_erc677.NewBurnMintERC677(token, chain.Client) + tokenContract, err := burn_mint_erc677.NewBurnMintERC677(token, chain.EVMChain.Client) require.NoError(t, err) balance, err := tokenContract.BalanceOf(&bind.CallOpts{Context: ctx}, receiver) diff --git a/deployment/ccip/changeset/test_usdc_helpers.go b/deployment/ccip/changeset/test_usdc_helpers.go index 75994ec9356..0742731a98a 100644 --- a/deployment/ccip/changeset/test_usdc_helpers.go +++ b/deployment/ccip/changeset/test_usdc_helpers.go @@ -24,10 +24,10 @@ func ConfigureUSDCTokenPools( src, dst uint64, state CCIPOnChainState, ) (*burn_mint_erc677.BurnMintERC677, *burn_mint_erc677.BurnMintERC677, error) { - srcToken := state.Chains[src].BurnMintTokens677[USDCSymbol] - dstToken := state.Chains[dst].BurnMintTokens677[USDCSymbol] - srcPool := state.Chains[src].USDCTokenPool - dstPool := state.Chains[dst].USDCTokenPool + srcToken := state.EVMState.Chains[src].BurnMintTokens677[USDCSymbol] + dstToken := state.EVMState.Chains[dst].BurnMintTokens677[USDCSymbol] + srcPool := state.EVMState.Chains[src].USDCTokenPool + dstPool := state.EVMState.Chains[dst].USDCTokenPool args := []struct { sourceChain deployment.Chain @@ -41,7 +41,7 @@ func ConfigureUSDCTokenPools( { chains[src], dst, - state.Chains[src], + state.EVMState.Chains[src], srcToken, srcPool, dstToken, @@ -50,7 +50,7 @@ func ConfigureUSDCTokenPools( { chains[dst], src, - state.Chains[dst], + state.EVMState.Chains[dst], dstToken, dstPool, srcToken, @@ -79,12 +79,12 @@ func configureSingleChain( dstPool *usdc_token_pool.USDCTokenPool, ) func() error { return func() error { - if err := attachTokenToTheRegistry(sourceChain, state, sourceChain.DeployerKey, srcToken.Address(), srcPool.Address()); err != nil { + if err := attachTokenToTheRegistry(sourceChain, state, sourceChain.EVMChain.DeployerKey, srcToken.Address(), srcPool.Address()); err != nil { lggr.Errorw("Failed to attach token to the registry", "err", err, "token", srcToken.Address(), "pool", srcPool.Address()) return err } - if err := setUSDCTokenPoolCounterPart(sourceChain, srcPool, dstChainSel, sourceChain.DeployerKey, dstToken.Address(), dstPool.Address()); err != nil { + if err := setUSDCTokenPoolCounterPart(sourceChain, srcPool, dstChainSel, sourceChain.EVMChain.DeployerKey, dstToken.Address(), dstPool.Address()); err != nil { lggr.Errorw("Failed to set counter part", "err", err, "srcPool", srcPool.Address(), "dstPool", dstPool.Address()) return err } @@ -94,7 +94,7 @@ func configureSingleChain( state.MockUSDCTokenMessenger.Address(), state.MockUSDCTransmitter.Address(), } { - if err := grantMintBurnPermissions(lggr, sourceChain, srcToken, sourceChain.DeployerKey, addr); err != nil { + if err := grantMintBurnPermissions(lggr, sourceChain, srcToken, sourceChain.EVMChain.DeployerKey, addr); err != nil { lggr.Errorw("Failed to grant mint/burn permissions", "err", err, "token", srcToken.Address(), "address", addr) return err } @@ -130,7 +130,7 @@ func UpdateFeeQuoterForUSDC( } tx, err := state.FeeQuoter.ApplyTokenTransferFeeConfigUpdates( - chain.DeployerKey, + chain.EVMChain.DeployerKey, config, []fee_quoter.FeeQuoterTokenTransferFeeConfigRemoveArgs{}, ) @@ -139,7 +139,7 @@ func UpdateFeeQuoterForUSDC( return err } - _, err = chain.Confirm(tx) + _, err = chain.EVMChain.Confirm(tx) return err } @@ -159,8 +159,8 @@ func DeployUSDC( token, err := deployment.DeployContract(lggr, chain, addresses, func(chain deployment.Chain) deployment.ContractDeploy[*burn_mint_erc677.BurnMintERC677] { tokenAddress, tx, tokenContract, err2 := burn_mint_erc677.DeployBurnMintERC677( - chain.DeployerKey, - chain.Client, + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, USDCName, string(USDCSymbol), UsdcDecimals, @@ -179,12 +179,12 @@ func DeployUSDC( return nil, nil, nil, nil, err } - tx, err := token.Contract.GrantMintRole(chain.DeployerKey, chain.DeployerKey.From) + tx, err := token.Contract.GrantMintRole(chain.EVMChain.DeployerKey, chain.EVMChain.DeployerKey.From) if err != nil { lggr.Errorw("Failed to grant mint role", "token", token.Contract.Address(), "err", err) return nil, nil, nil, nil, err } - _, err = chain.Confirm(tx) + _, err = chain.EVMChain.Confirm(tx) if err != nil { return nil, nil, nil, nil, err } @@ -192,8 +192,8 @@ func DeployUSDC( transmitter, err := deployment.DeployContract(lggr, chain, addresses, func(chain deployment.Chain) deployment.ContractDeploy[*mock_usdc_token_transmitter.MockE2EUSDCTransmitter] { transmitterAddress, tx, transmitterContract, err2 := mock_usdc_token_transmitter.DeployMockE2EUSDCTransmitter( - chain.DeployerKey, - chain.Client, + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, 0, reader.AllAvailableDomains()[chain.Selector], token.Address, @@ -216,8 +216,8 @@ func DeployUSDC( messenger, err := deployment.DeployContract(lggr, chain, addresses, func(chain deployment.Chain) deployment.ContractDeploy[*mock_usdc_token_messenger.MockE2EUSDCTokenMessenger] { messengerAddress, tx, messengerContract, err2 := mock_usdc_token_messenger.DeployMockE2EUSDCTokenMessenger( - chain.DeployerKey, - chain.Client, + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, 0, transmitter.Address, ) @@ -238,8 +238,8 @@ func DeployUSDC( tokenPool, err := deployment.DeployContract(lggr, chain, addresses, func(chain deployment.Chain) deployment.ContractDeploy[*usdc_token_pool.USDCTokenPool] { tokenPoolAddress, tx, tokenPoolContract, err2 := usdc_token_pool.DeployUSDCTokenPool( - chain.DeployerKey, - chain.Client, + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, messenger.Address, token.Address, []common.Address{}, diff --git a/deployment/common/changeset/deploy_link_token.go b/deployment/common/changeset/deploy_link_token.go index 5728e977c47..67881172856 100644 --- a/deployment/common/changeset/deploy_link_token.go +++ b/deployment/common/changeset/deploy_link_token.go @@ -40,8 +40,8 @@ func deployLinkTokenContract( linkToken, err := deployment.DeployContract[*link_token.LinkToken](lggr, chain, ab, func(chain deployment.Chain) deployment.ContractDeploy[*link_token.LinkToken] { linkTokenAddr, tx, linkToken, err2 := link_token.DeployLinkToken( - chain.DeployerKey, - chain.Client, + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, ) return deployment.ContractDeploy[*link_token.LinkToken]{ Address: linkTokenAddr, diff --git a/deployment/common/changeset/deploy_link_token_test.go b/deployment/common/changeset/deploy_link_token_test.go index 29a9ece1478..36e09eea7f3 100644 --- a/deployment/common/changeset/deploy_link_token_test.go +++ b/deployment/common/changeset/deploy_link_token_test.go @@ -32,7 +32,7 @@ func TestDeployLinkToken(t *testing.T) { require.NoError(t, err) view, err := state.GenerateLinkView() require.NoError(t, err) - assert.Equal(t, view.Owner, e.Chains[chain1].DeployerKey.From) + assert.Equal(t, view.Owner, e.Chains[chain1].EVMChain.DeployerKey.From) assert.Equal(t, view.TypeAndVersion, "LinkToken 1.0.0") // Initially nothing minted. assert.Equal(t, view.Supply.String(), "0") diff --git a/deployment/common/changeset/internal/mcms.go b/deployment/common/changeset/internal/mcms.go index 5694f83786b..d3e3dc11021 100644 --- a/deployment/common/changeset/internal/mcms.go +++ b/deployment/common/changeset/internal/mcms.go @@ -22,8 +22,8 @@ func DeployMCMSWithConfig( mcm, err := deployment.DeployContract[*owner_helpers.ManyChainMultiSig](lggr, chain, ab, func(chain deployment.Chain) deployment.ContractDeploy[*owner_helpers.ManyChainMultiSig] { mcmAddr, tx, mcm, err2 := owner_helpers.DeployManyChainMultiSig( - chain.DeployerKey, - chain.Client, + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, ) return deployment.ContractDeploy[*owner_helpers.ManyChainMultiSig]{ mcmAddr, mcm, tx, deployment.NewTypeAndVersion(contractType, deployment.Version1_0_0), err2, @@ -33,7 +33,7 @@ func DeployMCMSWithConfig( lggr.Errorw("Failed to deploy mcm", "err", err) return mcm, err } - mcmsTx, err := mcm.Contract.SetConfig(chain.DeployerKey, + mcmsTx, err := mcm.Contract.SetConfig(chain.EVMChain.DeployerKey, signerAddresses, // Signer 1 is int group 0 (root group) with quorum 1. signerGroups, @@ -98,13 +98,13 @@ func DeployMCMSWithTimelockContracts( timelock, err := deployment.DeployContract(lggr, chain, ab, func(chain deployment.Chain) deployment.ContractDeploy[*owner_helpers.RBACTimelock] { timelock, tx2, cc, err2 := owner_helpers.DeployRBACTimelock( - chain.DeployerKey, - chain.Client, + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, config.TimelockMinDelay, // Deployer is the initial admin. // TODO: Could expose this as config? // Or keep this enforced to follow the same pattern? - chain.DeployerKey.From, + chain.EVMChain.DeployerKey.From, []common.Address{proposer.Address}, // proposers config.TimelockExecutors, //executors []common.Address{canceller.Address}, // cancellers @@ -120,7 +120,7 @@ func DeployMCMSWithTimelockContracts( } lggr.Infow("deployed timelock", "addr", timelock.Address) // We grant the timelock the admin role on the MCMS contracts. - tx, err := timelock.Contract.GrantRole(chain.DeployerKey, + tx, err := timelock.Contract.GrantRole(chain.EVMChain.DeployerKey, v1_0.ADMIN_ROLE.ID, timelock.Address) if _, err := deployment.ConfirmIfNoError(chain, tx, err); err != nil { lggr.Errorw("Failed to grant timelock admin role", "err", err) diff --git a/deployment/common/changeset/internal/mcms_test.go b/deployment/common/changeset/internal/mcms_test.go index 9969a0e5bc9..ca145e854dc 100644 --- a/deployment/common/changeset/internal/mcms_test.go +++ b/deployment/common/changeset/internal/mcms_test.go @@ -41,7 +41,7 @@ func TestDeployMCMSWithTimelockContracts(t *testing.T) { Bypasser: changeset.SingleGroupMCMS(t), Proposer: changeset.SingleGroupMCMS(t), TimelockExecutors: []common.Address{ - chains[chainsel.TEST_90000001.Selector].DeployerKey.From, + chains[chainsel.TEST_90000001.Selector].EVMChain.DeployerKey.From, }, TimelockMinDelay: big.NewInt(0), }) diff --git a/deployment/common/changeset/mcms_test_helpers.go b/deployment/common/changeset/mcms_test_helpers.go index 3951149815c..1ef384b9f36 100644 --- a/deployment/common/changeset/mcms_test_helpers.go +++ b/deployment/common/changeset/mcms_test_helpers.go @@ -48,7 +48,7 @@ func SignProposal(t *testing.T, env deployment.Environment, proposal *timelock.M chainselc, exists := chainsel.ChainBySelector(chain.Selector) require.True(t, exists) chainSel := mcms.ChainIdentifier(chainselc.Selector) - executorClients[chainSel] = chain.Client + executorClients[chainSel] = chain.EVMChain.Client } executor, err := proposal.ToExecutor(true) require.NoError(t, err) @@ -68,11 +68,11 @@ func ExecuteProposal(t *testing.T, env deployment.Environment, executor *mcms.Ex timelock *owner_helpers.RBACTimelock, sel uint64) { t.Log("Executing proposal on chain", sel) // Set the root. - tx, err2 := executor.SetRootOnChain(env.Chains[sel].Client, env.Chains[sel].DeployerKey, mcms.ChainIdentifier(sel)) + tx, err2 := executor.SetRootOnChain(env.Chains[sel].EVMChain.Client, env.Chains[sel].EVMChain.DeployerKey, mcms.ChainIdentifier(sel)) if err2 != nil { require.NoError(t, deployment.MaybeDataErr(err2)) } - _, err2 = env.Chains[sel].Confirm(tx) + _, err2 = env.Chains[sel].EVMChain.Confirm(tx) require.NoError(t, err2) // TODO: This sort of helper probably should move to the MCMS lib. @@ -80,9 +80,9 @@ 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].Client, env.Chains[sel].DeployerKey, idx) + opTx, err3 := executor.ExecuteOnChain(env.Chains[sel].EVMChain.Client, env.Chains[sel].EVMChain.DeployerKey, idx) require.NoError(t, err3) - block, err3 := env.Chains[sel].Confirm(opTx) + block, err3 := env.Chains[sel].EVMChain.Confirm(opTx) require.NoError(t, err3) t.Log("executed", chainOp) it, err3 := timelock.FilterCallScheduled(&bind.FilterOpts{ @@ -105,9 +105,9 @@ func ExecuteProposal(t *testing.T, env deployment.Environment, executor *mcms.Ex }) } tx, err := timelock.ExecuteBatch( - env.Chains[sel].DeployerKey, calls, pred, salt) + env.Chains[sel].EVMChain.DeployerKey, calls, pred, salt) require.NoError(t, err) - _, err = env.Chains[sel].Confirm(tx) + _, err = env.Chains[sel].EVMChain.Confirm(tx) require.NoError(t, err) } } diff --git a/deployment/common/changeset/state.go b/deployment/common/changeset/state.go index f553e124a38..bbc9fadb1a8 100644 --- a/deployment/common/changeset/state.go +++ b/deployment/common/changeset/state.go @@ -71,25 +71,25 @@ func LoadMCMSWithTimelockState(chain deployment.Chain, addresses map[string]depl for address, tvStr := range addresses { switch tvStr.String() { case deployment.NewTypeAndVersion(types.RBACTimelock, deployment.Version1_0_0).String(): - tl, err := owner_helpers.NewRBACTimelock(common.HexToAddress(address), chain.Client) + tl, err := owner_helpers.NewRBACTimelock(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return nil, err } state.Timelock = tl case deployment.NewTypeAndVersion(types.ProposerManyChainMultisig, deployment.Version1_0_0).String(): - mcms, err := owner_helpers.NewManyChainMultiSig(common.HexToAddress(address), chain.Client) + mcms, err := owner_helpers.NewManyChainMultiSig(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return nil, err } state.ProposerMcm = mcms case deployment.NewTypeAndVersion(types.BypasserManyChainMultisig, deployment.Version1_0_0).String(): - mcms, err := owner_helpers.NewManyChainMultiSig(common.HexToAddress(address), chain.Client) + mcms, err := owner_helpers.NewManyChainMultiSig(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return nil, err } state.BypasserMcm = mcms case deployment.NewTypeAndVersion(types.CancellerManyChainMultisig, deployment.Version1_0_0).String(): - mcms, err := owner_helpers.NewManyChainMultiSig(common.HexToAddress(address), chain.Client) + mcms, err := owner_helpers.NewManyChainMultiSig(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return nil, err } @@ -114,7 +114,7 @@ func LoadLinkTokenState(chain deployment.Chain, addresses map[string]deployment. state := LinkTokenState{} for address, tvStr := range addresses { if tvStr.String() == deployment.NewTypeAndVersion(types.LinkToken, deployment.Version1_0_0).String() { - lt, err := link_token.NewLinkToken(common.HexToAddress(address), chain.Client) + lt, err := link_token.NewLinkToken(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return nil, err } diff --git a/deployment/common/changeset/transfer_to_mcms_with_timelock.go b/deployment/common/changeset/transfer_to_mcms_with_timelock.go index e48d29af92b..437a9d5e194 100644 --- a/deployment/common/changeset/transfer_to_mcms_with_timelock.go +++ b/deployment/common/changeset/transfer_to_mcms_with_timelock.go @@ -55,11 +55,11 @@ func (t TransferToMCMSWithTimelockConfig) Validate(e deployment.Environment) err } return fmt.Errorf("contract %s not found in address book", contract) } - owner, _, err := LoadOwnableContract(contract, e.Chains[chainSelector].Client) + owner, _, err := LoadOwnableContract(contract, e.Chains[chainSelector].EVMChain.Client) if err != nil { return fmt.Errorf("failed to load ownable: %v", err) } - if owner != e.Chains[chainSelector].DeployerKey.From { + if owner != e.Chains[chainSelector].EVMChain.DeployerKey.From { return fmt.Errorf("contract %s is not owned by the deployer key", contract) } } @@ -98,7 +98,7 @@ func TransferToMCMSWithTimelock( timelockAddr, _ := deployment.SearchAddressBook(e.ExistingAddresses, chainSelector, types.RBACTimelock) proposerAddr, _ := deployment.SearchAddressBook(e.ExistingAddresses, chainSelector, types.ProposerManyChainMultisig) timelocksByChain[chainSelector] = common.HexToAddress(timelockAddr) - proposer, err := owner_helpers.NewManyChainMultiSig(common.HexToAddress(proposerAddr), e.Chains[chainSelector].Client) + proposer, err := owner_helpers.NewManyChainMultiSig(common.HexToAddress(proposerAddr), e.Chains[chainSelector].EVMChain.Client) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to create proposer mcms: %v", err) } @@ -108,13 +108,13 @@ func TransferToMCMSWithTimelock( for _, contract := range contracts { // Just using the ownership interface. // Already validated is ownable. - owner, c, _ := LoadOwnableContract(contract, e.Chains[chainSelector].Client) + owner, c, _ := LoadOwnableContract(contract, e.Chains[chainSelector].EVMChain.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)) + tx, err := c.TransferOwnership(e.Chains[chainSelector].EVMChain.DeployerKey, common.HexToAddress(timelockAddr)) _, err = deployment.ConfirmIfNoError(e.Chains[chainSelector], tx, err) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to transfer ownership of contract %T: %v", contract, err) diff --git a/deployment/environment.go b/deployment/environment.go index bdf9fe6d5de..c1c8728a1ae 100644 --- a/deployment/environment.go +++ b/deployment/environment.go @@ -46,16 +46,24 @@ type OffchainClient interface { csav1.CSAServiceClient } -// Chain represents an EVM chain. -type Chain struct { - // Selectors used as canonical chain identifier. - Selector uint64 - Client OnchainClient +type EVMChain struct { + Client OnchainClient // Note the Sign function can be abstract supporting a variety of key storage mechanisms (e.g. KMS etc). DeployerKey *bind.TransactOpts Confirm func(tx *types.Transaction) (uint64, error) } +type SolanaChain struct{} + +// Chain represents an EVM chain. +type Chain struct { + // Selectors used as canonical chain identifier. + Family string + Selector uint64 + EVMChain EVMChain + SolanaChain SolanaChain +} + // Environment represents an instance of a deployed product // including on and offchain components. It is intended to be // cross-family to enable a coherent view of a product deployed @@ -133,7 +141,7 @@ func (e Environment) AllChainSelectorsExcluding(excluding []uint64) []uint64 { func (e Environment) AllDeployerKeys() []common.Address { var deployerKeys []common.Address for sel := range e.Chains { - deployerKeys = append(deployerKeys, e.Chains[sel].DeployerKey.From) + deployerKeys = append(deployerKeys, e.Chains[sel].EVMChain.DeployerKey.From) } return deployerKeys } @@ -148,7 +156,7 @@ func ConfirmIfNoError(chain Chain, tx *types.Transaction, err error) (uint64, er } return 0, err } - return chain.Confirm(tx) + return chain.EVMChain.Confirm(tx) } func MaybeDataErr(err error) error { diff --git a/deployment/environment/devenv/chain.go b/deployment/environment/devenv/chain.go index 407b898cb04..d0050667302 100644 --- a/deployment/environment/devenv/chain.go +++ b/deployment/environment/devenv/chain.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "math/big" + "strings" "time" "github.com/ethereum/go-ethereum/accounts/abi/bind" @@ -109,36 +110,39 @@ func NewChains(logger logger.Logger, configs []ChainConfig) (map[uint64]deployme return nil, fmt.Errorf("failed to connect to chain %s", chainCfg.ChainName) } chains[selector] = deployment.Chain{ - Selector: selector, - Client: ec, - DeployerKey: chainCfg.DeployerKey, - Confirm: func(tx *types.Transaction) (uint64, error) { - var blockNumber uint64 - if tx == nil { - return 0, fmt.Errorf("tx was nil, nothing to confirm") - } - ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute) - defer cancel() - chainId, err := ec.ChainID(ctx) - if err != nil { - return blockNumber, fmt.Errorf("failed to get chain id: %w", err) - } - receipt, err := bind.WaitMined(ctx, ec, tx) - if err != nil { - return blockNumber, fmt.Errorf("failed to get confirmed receipt for chain %d: %w", chainId, err) - } - if receipt == nil { - return blockNumber, fmt.Errorf("receipt was nil for tx %s", tx.Hash().Hex()) - } - blockNumber = receipt.BlockNumber.Uint64() - if receipt.Status == 0 { - errReason, err := deployment.GetErrorReasonFromTx(ec, chainCfg.DeployerKey.From, tx, receipt) - if err == nil && errReason != "" { - return blockNumber, fmt.Errorf("tx %s reverted,error reason: %s", tx.Hash().Hex(), errReason) + Selector: selector, + Family: strings.ToLower(chainCfg.ChainType), + EVMChain: deployment.EVMChain{ + Client: ec, + DeployerKey: chainCfg.DeployerKey, + Confirm: func(tx *types.Transaction) (uint64, error) { + var blockNumber uint64 + if tx == nil { + return 0, fmt.Errorf("tx was nil, nothing to confirm") } - return blockNumber, fmt.Errorf("tx %s reverted, could not decode error reason", tx.Hash().Hex()) - } - return blockNumber, nil + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute) + defer cancel() + chainId, err := ec.ChainID(ctx) + if err != nil { + return blockNumber, fmt.Errorf("failed to get chain id: %w", err) + } + receipt, err := bind.WaitMined(ctx, ec, tx) + if err != nil { + return blockNumber, fmt.Errorf("failed to get confirmed receipt for chain %d: %w", chainId, err) + } + if receipt == nil { + return blockNumber, fmt.Errorf("receipt was nil for tx %s", tx.Hash().Hex()) + } + blockNumber = receipt.BlockNumber.Uint64() + if receipt.Status == 0 { + errReason, err := deployment.GetErrorReasonFromTx(ec, chainCfg.DeployerKey.From, tx, receipt) + if err == nil && errReason != "" { + return blockNumber, fmt.Errorf("tx %s reverted,error reason: %s", tx.Hash().Hex(), errReason) + } + return blockNumber, fmt.Errorf("tx %s reverted, could not decode error reason", tx.Hash().Hex()) + } + return blockNumber, nil + }, }, } } diff --git a/deployment/environment/memory/environment.go b/deployment/environment/memory/environment.go index f4692998d34..5bcaeb8d0f7 100644 --- a/deployment/environment/memory/environment.go +++ b/deployment/environment/memory/environment.go @@ -3,6 +3,7 @@ package memory import ( "context" "fmt" + "strings" "testing" "github.com/ethereum/go-ethereum/accounts/abi/bind" @@ -16,6 +17,7 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" "github.com/smartcontractkit/chainlink/deployment" + "github.com/smartcontractkit/chainlink/deployment/environment/devenv" "github.com/smartcontractkit/chainlink-common/pkg/logger" ) @@ -35,11 +37,14 @@ type MemoryEnvironmentConfig struct { // For placeholders like aptos func NewMemoryChain(t *testing.T, selector uint64) deployment.Chain { return deployment.Chain{ - Selector: selector, - Client: nil, - DeployerKey: &bind.TransactOpts{}, - Confirm: func(tx *types.Transaction) (uint64, error) { - return 0, nil + Selector: selector, + Family: strings.ToLower(devenv.EVMChainType), + EVMChain: deployment.EVMChain{ + Client: nil, + DeployerKey: &bind.TransactOpts{}, + Confirm: func(tx *types.Transaction) (uint64, error) { + return 0, nil + }, }, } } @@ -70,29 +75,32 @@ func generateMemoryChain(t *testing.T, inputs map[uint64]EVMChain) map[uint64]de require.NoError(t, err) backend := NewBackend(chain.Backend) chains[sel] = deployment.Chain{ - Selector: sel, - Client: backend, - DeployerKey: chain.DeployerKey, - Confirm: func(tx *types.Transaction) (uint64, error) { - if tx == nil { - return 0, fmt.Errorf("tx was nil, nothing to confirm") - } - for { - backend.Commit() - receipt, err := backend.TransactionReceipt(context.Background(), tx.Hash()) - if err != nil { - t.Log("failed to get receipt", err) - continue + Selector: sel, + Family: strings.ToLower(devenv.EVMChainType), + EVMChain: deployment.EVMChain{ + Client: backend, + DeployerKey: chain.DeployerKey, + Confirm: func(tx *types.Transaction) (uint64, error) { + if tx == nil { + return 0, fmt.Errorf("tx was nil, nothing to confirm") } - if receipt.Status == 0 { - errReason, err := deployment.GetErrorReasonFromTx(chain.Backend.Client(), chain.DeployerKey.From, tx, receipt) - if err == nil && errReason != "" { - return 0, fmt.Errorf("tx %s reverted,error reason: %s", tx.Hash().Hex(), errReason) + for { + backend.Commit() + receipt, err := backend.TransactionReceipt(context.Background(), tx.Hash()) + if err != nil { + t.Log("failed to get receipt", err) + continue + } + if receipt.Status == 0 { + errReason, err := deployment.GetErrorReasonFromTx(chain.Backend.Client(), chain.DeployerKey.From, tx, receipt) + if err == nil && errReason != "" { + return 0, fmt.Errorf("tx %s reverted,error reason: %s", tx.Hash().Hex(), errReason) + } + return 0, fmt.Errorf("tx %s reverted, could not decode error reason", tx.Hash().Hex()) } - return 0, fmt.Errorf("tx %s reverted, could not decode error reason", tx.Hash().Hex()) + return receipt.BlockNumber.Uint64(), nil } - return receipt.BlockNumber.Uint64(), nil - } + }, }, } } diff --git a/deployment/environment/memory/node.go b/deployment/environment/memory/node.go index fd08d3cf17b..28db52fde49 100644 --- a/deployment/environment/memory/node.go +++ b/deployment/environment/memory/node.go @@ -87,8 +87,8 @@ func NewNode( t.Fatal(err) } evmchains[evmChainID] = EVMChain{ - Backend: chain.Client.(*Backend).Sim, - DeployerKey: chain.DeployerKey, + Backend: chain.EVMChain.Client.(*Backend).Sim, + DeployerKey: chain.EVMChain.DeployerKey, } } @@ -284,8 +284,8 @@ func CreateKeys(t *testing.T, require.Len(t, sendingKeys, 1) transmitters[evmChainID] = sendingKeys[0] } - backend := chain.Client.(*Backend).Sim - fundAddress(t, chain.DeployerKey, transmitters[evmChainID], assets.Ether(1000).ToInt(), backend) + backend := chain.EVMChain.Client.(*Backend).Sim + fundAddress(t, chain.EVMChain.DeployerKey, transmitters[evmChainID], assets.Ether(1000).ToInt(), backend) } return Keys{ diff --git a/deployment/helpers.go b/deployment/helpers.go index e8d2d8c8d59..366af948766 100644 --- a/deployment/helpers.go +++ b/deployment/helpers.go @@ -141,7 +141,7 @@ func DeployContract[C any]( lggr.Errorw("Failed to deploy contract", "err", contractDeploy.Err) return nil, contractDeploy.Err } - _, err := chain.Confirm(contractDeploy.Tx) + _, err := chain.EVMChain.Confirm(contractDeploy.Tx) if err != nil { lggr.Errorw("Failed to confirm deployment", "err", err) return nil, err diff --git a/deployment/keystone/capability_management.go b/deployment/keystone/capability_management.go index 4e15ea897ab..3890ddc57e0 100644 --- a/deployment/keystone/capability_management.go +++ b/deployment/keystone/capability_management.go @@ -25,7 +25,7 @@ func AddCapabilities(lggr logger.Logger, registry *kcr.CapabilitiesRegistry, cha } } - tx, err := registry.AddCapabilities(chain.DeployerKey, deduped) + tx, err := registry.AddCapabilities(chain.EVMChain.DeployerKey, deduped) if err != nil { err = DecodeErr(kcr.CapabilitiesRegistryABI, err) // no typed errors in the abi, so we have to do string matching @@ -35,7 +35,7 @@ func AddCapabilities(lggr logger.Logger, registry *kcr.CapabilitiesRegistry, cha } lggr.Warnw("capabilities already exist, falling back to 1-by-1", "capabilities", deduped) for _, cap := range deduped { - tx, err = registry.AddCapabilities(chain.DeployerKey, []kcr.CapabilitiesRegistryCapability{cap}) + tx, err = registry.AddCapabilities(chain.EVMChain.DeployerKey, []kcr.CapabilitiesRegistryCapability{cap}) if err != nil { err = DecodeErr(kcr.CapabilitiesRegistryABI, err) if strings.Contains(err.Error(), "CapabilityAlreadyExists") { @@ -45,7 +45,7 @@ func AddCapabilities(lggr logger.Logger, registry *kcr.CapabilitiesRegistry, cha return fmt.Errorf("failed to call AddCapabilities for capability %v: %w", cap, err) } // 1-by-1 tx is pending and we need to wait for it to be mined - _, err = chain.Confirm(tx) + _, err = chain.EVMChain.Confirm(tx) if err != nil { return fmt.Errorf("failed to confirm AddCapabilities confirm transaction %s: %w", tx.Hash().String(), err) } @@ -54,7 +54,7 @@ func AddCapabilities(lggr logger.Logger, registry *kcr.CapabilitiesRegistry, cha } } else { // the bulk add tx is pending and we need to wait for it to be mined - _, err = chain.Confirm(tx) + _, err = chain.EVMChain.Confirm(tx) if err != nil { return fmt.Errorf("failed to confirm AddCapabilities confirm transaction %s: %w", tx.Hash().String(), err) } diff --git a/deployment/keystone/capability_registry_deployer.go b/deployment/keystone/capability_registry_deployer.go index 11c85453927..a5cd60a840a 100644 --- a/deployment/keystone/capability_registry_deployer.go +++ b/deployment/keystone/capability_registry_deployer.go @@ -32,20 +32,20 @@ func (c *CapabilitiesRegistryDeployer) Contract() *capabilities_registry.Capabil } func (c *CapabilitiesRegistryDeployer) Deploy(req DeployRequest) (*DeployResponse, error) { - est, err := estimateDeploymentGas(req.Chain.Client, capabilities_registry.CapabilitiesRegistryABI) + est, err := estimateDeploymentGas(req.Chain.EVMChain.Client, capabilities_registry.CapabilitiesRegistryABI) if err != nil { return nil, fmt.Errorf("failed to estimate gas: %w", err) } c.lggr.Debugf("Capability registry estimated gas: %d", est) capabilitiesRegistryAddr, tx, capabilitiesRegistry, err := capabilities_registry.DeployCapabilitiesRegistry( - req.Chain.DeployerKey, - req.Chain.Client) + req.Chain.EVMChain.DeployerKey, + req.Chain.EVMChain.Client) if err != nil { return nil, fmt.Errorf("failed to deploy CapabilitiesRegistry: %w", err) } - _, err = req.Chain.Confirm(tx) + _, err = req.Chain.EVMChain.Confirm(tx) if err != nil { return nil, fmt.Errorf("failed to confirm and save CapabilitiesRegistry: %w", err) } diff --git a/deployment/keystone/changeset/addrbook_utils.go b/deployment/keystone/changeset/addrbook_utils.go index 4b6d6d151b1..b35b3c07108 100644 --- a/deployment/keystone/changeset/addrbook_utils.go +++ b/deployment/keystone/changeset/addrbook_utils.go @@ -36,7 +36,7 @@ func getContractsFromAddrBook[T any]( for addr, typeAndVersion := range chainAddresses { if typeAndVersion.Type == desiredType { address := common.HexToAddress(addr) - contractInstance, err := constructor(address, chain.Client) + contractInstance, err := constructor(address, chain.EVMChain.Client) if err != nil { return nil, fmt.Errorf("failed to construct %s at %s: %w", desiredType, addr, err) } diff --git a/deployment/keystone/changeset/internal/test/utils.go b/deployment/keystone/changeset/internal/test/utils.go index df01266043a..e411b07324f 100644 --- a/deployment/keystone/changeset/internal/test/utils.go +++ b/deployment/keystone/changeset/internal/test/utils.go @@ -135,12 +135,12 @@ func addNops(t *testing.T, lggr logger.Logger, chain deployment.Chain, registry } func addNodes(t *testing.T, lggr logger.Logger, chain deployment.Chain, registry *kcr.CapabilitiesRegistry, nodes []kcr.CapabilitiesRegistryNodeParams) { - tx, err := registry.AddNodes(chain.DeployerKey, nodes) + tx, err := registry.AddNodes(chain.EVMChain.DeployerKey, nodes) if err != nil { err2 := kslib.DecodeErr(kcr.CapabilitiesRegistryABI, err) require.Fail(t, fmt.Sprintf("failed to call AddNodes: %s: %s", err, err2)) } - _, err = chain.Confirm(tx) + _, err = chain.EVMChain.Confirm(tx) require.NoError(t, err) } @@ -169,12 +169,12 @@ func addDons(t *testing.T, lggr logger.Logger, chain deployment.Chain, registry // add the don isPublic := true f := len(don.P2PIDs)/3 + 1 - tx, err := registry.AddDON(chain.DeployerKey, internal.PeerIDsToBytes(don.P2PIDs), capConfigs, isPublic, acceptsWorkflows, uint8(f)) + tx, err := registry.AddDON(chain.EVMChain.DeployerKey, internal.PeerIDsToBytes(don.P2PIDs), capConfigs, isPublic, acceptsWorkflows, uint8(f)) if err != nil { err2 := kslib.DecodeErr(kcr.CapabilitiesRegistryABI, err) require.Fail(t, fmt.Sprintf("failed to call AddDON: %s: %s", err, err2)) } - _, err = chain.Confirm(tx) + _, err = chain.EVMChain.Confirm(tx) require.NoError(t, err) } } @@ -232,12 +232,12 @@ func (cc *CapabilityCache) AddCapabilities(lggr logger.Logger, chain deployment. if len(toRegister) == 0 { return out } - tx, err := registry.AddCapabilities(chain.DeployerKey, toRegister) + tx, err := registry.AddCapabilities(chain.EVMChain.DeployerKey, toRegister) if err != nil { err2 := kslib.DecodeErr(kcr.CapabilitiesRegistryABI, err) require.Fail(t, fmt.Sprintf("failed to call AddCapabilities: %s: %s", err, err2)) } - _, err = chain.Confirm(tx) + _, err = chain.EVMChain.Confirm(tx) require.NoError(t, err) // get the registered capabilities diff --git a/deployment/keystone/changeset/internal/update_don.go b/deployment/keystone/changeset/internal/update_don.go index 4883368dc4d..f66df64ca34 100644 --- a/deployment/keystone/changeset/internal/update_don.go +++ b/deployment/keystone/changeset/internal/update_don.go @@ -88,13 +88,13 @@ func UpdateDon(lggr logger.Logger, req *UpdateDonRequest) (*UpdateDonResponse, e return nil, fmt.Errorf("failed to append node capabilities: %w", err) } - tx, err := req.Registry.UpdateDON(req.Chain.DeployerKey, don.Id, don.NodeP2PIds, cfgs, don.IsPublic, don.F) + tx, err := req.Registry.UpdateDON(req.Chain.EVMChain.DeployerKey, don.Id, don.NodeP2PIds, cfgs, don.IsPublic, don.F) if err != nil { err = kslib.DecodeErr(kcr.CapabilitiesRegistryABI, err) return nil, fmt.Errorf("failed to call UpdateDON: %w", err) } - _, err = req.Chain.Confirm(tx) + _, err = req.Chain.EVMChain.Confirm(tx) if err != nil { return nil, fmt.Errorf("failed to confirm UpdateDON transaction %s: %w", tx.Hash().String(), err) } diff --git a/deployment/keystone/changeset/internal/update_nodes.go b/deployment/keystone/changeset/internal/update_nodes.go index b8a08c37e50..cfee97b4f3f 100644 --- a/deployment/keystone/changeset/internal/update_nodes.go +++ b/deployment/keystone/changeset/internal/update_nodes.go @@ -94,13 +94,13 @@ func UpdateNodes(lggr logger.Logger, req *UpdateNodesRequest) (*UpdateNodesRespo err = kslib.DecodeErr(kcr.CapabilitiesRegistryABI, err) return nil, fmt.Errorf("failed to make node params: %w", err) } - tx, err := req.Registry.UpdateNodes(req.Chain.DeployerKey, params) + tx, err := req.Registry.UpdateNodes(req.Chain.EVMChain.DeployerKey, params) if err != nil { err = kslib.DecodeErr(kcr.CapabilitiesRegistryABI, err) return nil, fmt.Errorf("failed to call UpdateNodes: %w", err) } - _, err = req.Chain.Confirm(tx) + _, err = req.Chain.EVMChain.Confirm(tx) if err != nil { return nil, fmt.Errorf("failed to confirm UpdateNodes confirm transaction %s: %w", tx.Hash().String(), err) } @@ -114,7 +114,7 @@ func AppendCapabilities(lggr logger.Logger, registry *kcr.CapabilitiesRegistry, if err != nil { return nil, fmt.Errorf("failed to GetCapabilities from registry: %w", err) } - var capMap = make(map[[32]byte]kcr.CapabilitiesRegistryCapability) + capMap := make(map[[32]byte]kcr.CapabilitiesRegistryCapability) for _, cap := range allCapabilities { capMap[cap.HashedId] = kcr.CapabilitiesRegistryCapability{ LabelledName: cap.LabelledName, diff --git a/deployment/keystone/changeset/internal/update_nodes_test.go b/deployment/keystone/changeset/internal/update_nodes_test.go index b167f210811..804e12c69bf 100644 --- a/deployment/keystone/changeset/internal/update_nodes_test.go +++ b/deployment/keystone/changeset/internal/update_nodes_test.go @@ -567,12 +567,12 @@ func TestUpdateNodes(t *testing.T) { // update the capabilities, there should be then be one capability // first update registers the new capability toRegister := p2pToCapabilitiesUpdated[testPeerID(t, "peerID_1")] - tx, err := registry.AddCapabilities(chain.DeployerKey, toRegister) + tx, err := registry.AddCapabilities(chain.EVMChain.DeployerKey, toRegister) if err != nil { err2 := kslib.DecodeErr(kcr.CapabilitiesRegistryABI, err) require.Fail(t, fmt.Sprintf("failed to call AddCapabilities: %s: %s", err, err2)) } - _, err = chain.Confirm(tx) + _, err = chain.EVMChain.Confirm(tx) require.NoError(t, err) var req = &internal.UpdateNodesRequest{ diff --git a/deployment/keystone/consumer_deployer.go b/deployment/keystone/consumer_deployer.go index 12d148144b5..ad24c56019a 100644 --- a/deployment/keystone/consumer_deployer.go +++ b/deployment/keystone/consumer_deployer.go @@ -23,20 +23,20 @@ func NewKeystoneFeedsConsumerDeployer() (*KeystoneFeedsConsumerDeployer, error) } func (c *KeystoneFeedsConsumerDeployer) deploy(req DeployRequest) (*DeployResponse, error) { - est, err := estimateDeploymentGas(req.Chain.Client, feeds_consumer.KeystoneFeedsConsumerABI) + est, err := estimateDeploymentGas(req.Chain.EVMChain.Client, feeds_consumer.KeystoneFeedsConsumerABI) if err != nil { return nil, fmt.Errorf("failed to estimate gas: %w", err) } c.lggr.Debugf("Feeds Consumer estimated gas: %d", est) consumerAddr, tx, consumer, err := feeds_consumer.DeployKeystoneFeedsConsumer( - req.Chain.DeployerKey, - req.Chain.Client) + req.Chain.EVMChain.DeployerKey, + req.Chain.EVMChain.Client) if err != nil { return nil, fmt.Errorf("failed to deploy feeds consumer: %w", err) } - _, err = req.Chain.Confirm(tx) + _, err = req.Chain.EVMChain.Confirm(tx) if err != nil { return nil, fmt.Errorf("failed to confirm and save feeds consumer: %w", err) } diff --git a/deployment/keystone/deploy.go b/deployment/keystone/deploy.go index 374f7f06460..c0b5fd5e3b9 100644 --- a/deployment/keystone/deploy.go +++ b/deployment/keystone/deploy.go @@ -528,19 +528,19 @@ func RegisterNOPS(ctx context.Context, lggr logger.Logger, req RegisterNOPSReque lggr.Debug("no new node operators to register") return resp, nil } - tx, err := registry.AddNodeOperators(registryChain.DeployerKey, nops) + tx, err := registry.AddNodeOperators(registryChain.EVMChain.DeployerKey, nops) if err != nil { err = DecodeErr(kcr.CapabilitiesRegistryABI, err) return nil, fmt.Errorf("failed to call AddNodeOperators: %w", err) } // for some reason that i don't understand, the confirm must be called before the WaitMined or the latter will hang // (at least for a simulated backend chain) - _, err = registryChain.Confirm(tx) + _, err = registryChain.EVMChain.Confirm(tx) if err != nil { return nil, fmt.Errorf("failed to confirm AddNodeOperators confirm transaction %s: %w", tx.Hash().String(), err) } - receipt, err := bind.WaitMined(ctx, registryChain.Client, tx) + receipt, err := bind.WaitMined(ctx, registryChain.EVMChain.Client, tx) if err != nil { return nil, fmt.Errorf("failed to mine AddNodeOperators confirm transaction %s: %w", tx.Hash().String(), err) } @@ -727,7 +727,7 @@ func registerNodes(lggr logger.Logger, req *registerNodesRequest) (*registerNode uniqueNodeParams = append(uniqueNodeParams, v) } lggr.Debugw("unique node params to add", "count", len(uniqueNodeParams)) - tx, err := req.registry.AddNodes(req.chain.DeployerKey, uniqueNodeParams) + tx, err := req.registry.AddNodes(req.chain.EVMChain.DeployerKey, uniqueNodeParams) if err != nil { err = DecodeErr(kcr.CapabilitiesRegistryABI, err) // no typed errors in the abi, so we have to do string matching @@ -737,7 +737,7 @@ func registerNodes(lggr logger.Logger, req *registerNodesRequest) (*registerNode } lggr.Warn("nodes already exist, falling back to 1-by-1") for _, singleNodeParams := range uniqueNodeParams { - tx, err = req.registry.AddNodes(req.chain.DeployerKey, []kcr.CapabilitiesRegistryNodeParams{singleNodeParams}) + tx, err = req.registry.AddNodes(req.chain.EVMChain.DeployerKey, []kcr.CapabilitiesRegistryNodeParams{singleNodeParams}) if err != nil { err = DecodeErr(kcr.CapabilitiesRegistryABI, err) if strings.Contains(err.Error(), "NodeAlreadyExists") { @@ -747,7 +747,7 @@ func registerNodes(lggr logger.Logger, req *registerNodesRequest) (*registerNode return nil, fmt.Errorf("failed to call AddNode for node with p2pid %v: %w", singleNodeParams.P2pId, err) } // 1-by-1 tx is pending and we need to wait for it to be mined - _, err = req.chain.Confirm(tx) + _, err = req.chain.EVMChain.Confirm(tx) if err != nil { return nil, fmt.Errorf("failed to confirm AddNode of p2pid node %v transaction %s: %w", singleNodeParams.P2pId, tx.Hash().String(), err) } @@ -755,7 +755,7 @@ func registerNodes(lggr logger.Logger, req *registerNodesRequest) (*registerNode } } else { // the bulk add tx is pending and we need to wait for it to be mined - _, err = req.chain.Confirm(tx) + _, err = req.chain.EVMChain.Confirm(tx) if err != nil { return nil, fmt.Errorf("failed to confirm AddNode confirm transaction %s: %w", tx.Hash().String(), err) } @@ -851,12 +851,12 @@ func registerDons(lggr logger.Logger, req registerDonsRequest) (*registerDonsRes } f := len(p2pIds) / 3 // assuming n=3f+1. TODO should come for some config. - tx, err := req.registry.AddDON(req.chain.DeployerKey, p2pIds, cfgs, true, wfSupported, uint8(f)) + tx, err := req.registry.AddDON(req.chain.EVMChain.DeployerKey, p2pIds, cfgs, true, wfSupported, uint8(f)) if err != nil { err = DecodeErr(kcr.CapabilitiesRegistryABI, err) return nil, fmt.Errorf("failed to call AddDON for don '%s' p2p2Id hash %s capability %v: %w", don, p2pSortedHash, cfgs, err) } - _, err = req.chain.Confirm(tx) + _, err = req.chain.EVMChain.Confirm(tx) if err != nil { return nil, fmt.Errorf("failed to confirm AddDON transaction %s for don %s: %w", tx.Hash().String(), don, err) } @@ -926,12 +926,12 @@ func configureForwarder(lggr logger.Logger, chain deployment.Chain, fwdr *kf.Key } ver := dn.Info.ConfigCount // note config count on the don info is the version on the forwarder signers := dn.signers(chainsel.FamilyEVM) - tx, err := fwdr.SetConfig(chain.DeployerKey, dn.Info.Id, ver, dn.Info.F, signers) + tx, err := fwdr.SetConfig(chain.EVMChain.DeployerKey, dn.Info.Id, ver, dn.Info.F, signers) if err != nil { err = DecodeErr(kf.KeystoneForwarderABI, err) return fmt.Errorf("failed to call SetConfig for forwarder %s on chain %d: %w", fwdr.Address().String(), chain.Selector, err) } - _, err = chain.Confirm(tx) + _, err = chain.EVMChain.Confirm(tx) if err != nil { err = DecodeErr(kf.KeystoneForwarderABI, err) return fmt.Errorf("failed to confirm SetConfig for forwarder %s: %w", fwdr.Address().String(), err) diff --git a/deployment/keystone/forwarder_deployer.go b/deployment/keystone/forwarder_deployer.go index cf29b20c693..910caef7a3d 100644 --- a/deployment/keystone/forwarder_deployer.go +++ b/deployment/keystone/forwarder_deployer.go @@ -23,20 +23,20 @@ func NewKeystoneForwarderDeployer() (*KeystoneForwarderDeployer, error) { return &KeystoneForwarderDeployer{lggr: lggr}, nil } func (c *KeystoneForwarderDeployer) deploy(req DeployRequest) (*DeployResponse, error) { - est, err := estimateDeploymentGas(req.Chain.Client, forwarder.KeystoneForwarderABI) + est, err := estimateDeploymentGas(req.Chain.EVMChain.Client, forwarder.KeystoneForwarderABI) if err != nil { return nil, fmt.Errorf("failed to estimate gas: %w", err) } c.lggr.Debugf("Forwarder estimated gas: %d", est) forwarderAddr, tx, forwarder, err := forwarder.DeployKeystoneForwarder( - req.Chain.DeployerKey, - req.Chain.Client) + req.Chain.EVMChain.DeployerKey, + req.Chain.EVMChain.Client) if err != nil { return nil, fmt.Errorf("failed to deploy KeystoneForwarder: %w", err) } - _, err = req.Chain.Confirm(tx) + _, err = req.Chain.EVMChain.Confirm(tx) if err != nil { return nil, fmt.Errorf("failed to confirm and save KeystoneForwarder: %w", err) } diff --git a/deployment/keystone/ocr3_deployer.go b/deployment/keystone/ocr3_deployer.go index 227894f7c67..7f9c18a3827 100644 --- a/deployment/keystone/ocr3_deployer.go +++ b/deployment/keystone/ocr3_deployer.go @@ -24,20 +24,20 @@ func NewOCR3Deployer() (*OCR3Deployer, error) { } func (c *OCR3Deployer) deploy(req DeployRequest) (*DeployResponse, error) { - est, err := estimateDeploymentGas(req.Chain.Client, ocr3_capability.OCR3CapabilityABI) + est, err := estimateDeploymentGas(req.Chain.EVMChain.Client, ocr3_capability.OCR3CapabilityABI) if err != nil { return nil, fmt.Errorf("failed to estimate gas: %w", err) } c.lggr.Infof("ocr3 capability estimated gas: %d", est) ocr3Addr, tx, ocr3, err := ocr3_capability.DeployOCR3Capability( - req.Chain.DeployerKey, - req.Chain.Client) + req.Chain.EVMChain.DeployerKey, + req.Chain.EVMChain.Client) if err != nil { return nil, fmt.Errorf("failed to deploy OCR3Capability: %w", err) } - _, err = req.Chain.Confirm(tx) + _, err = req.Chain.EVMChain.Confirm(tx) if err != nil { return nil, fmt.Errorf("failed to confirm transaction %s: %w", tx.Hash().String(), err) } diff --git a/deployment/keystone/ocr3config.go b/deployment/keystone/ocr3config.go index a281a69ed8a..908e1f6d45f 100644 --- a/deployment/keystone/ocr3config.go +++ b/deployment/keystone/ocr3config.go @@ -267,7 +267,7 @@ func configureOCR3contract(req configureOCR3Request) (*configureOCR3Response, er if req.dryRun { return &configureOCR3Response{ocrConfig}, nil } - tx, err := req.contract.SetConfig(req.chain.DeployerKey, + tx, err := req.contract.SetConfig(req.chain.EVMChain.DeployerKey, ocrConfig.Signers, ocrConfig.Transmitters, ocrConfig.F, @@ -279,7 +279,7 @@ func configureOCR3contract(req configureOCR3Request) (*configureOCR3Response, er err = DecodeErr(kocr3.OCR3CapabilityABI, err) return nil, fmt.Errorf("failed to call SetConfig for OCR3 contract %s: %w", req.contract.Address().String(), err) } - _, err = req.chain.Confirm(tx) + _, err = req.chain.EVMChain.Confirm(tx) if err != nil { err = DecodeErr(kocr3.OCR3CapabilityABI, err) return nil, fmt.Errorf("failed to confirm SetConfig for OCR3 contract %s: %w", req.contract.Address().String(), err) diff --git a/deployment/keystone/ocr3config_test.go b/deployment/keystone/ocr3config_test.go index 4046787724a..be54c9d8291 100644 --- a/deployment/keystone/ocr3config_test.go +++ b/deployment/keystone/ocr3config_test.go @@ -13,6 +13,7 @@ import ( chain_selectors "github.com/smartcontractkit/chain-selectors" "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/common/view" + "github.com/smartcontractkit/chainlink/deployment/environment/devenv" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/p2pkey" types2 "github.com/smartcontractkit/libocr/offchainreporting2/types" "github.com/smartcontractkit/libocr/offchainreporting2plus/types" @@ -88,6 +89,7 @@ func Test_configureOCR3Request_generateOCR3Config(t *testing.T) { cfg: &OracleConfigWithSecrets{OracleConfig: cfg, OCRSecrets: deployment.XXXGenerateTestOCRSecrets()}, nodes: nodes, chain: deployment.Chain{ + Family: strings.ToLower(devenv.EVMChainType), Selector: chain_selectors.ETHEREUM_TESTNET_SEPOLIA.Selector, }, } diff --git a/deployment/keystone/state.go b/deployment/keystone/state.go index 68f2ab97a5d..c57ae974c2e 100644 --- a/deployment/keystone/state.go +++ b/deployment/keystone/state.go @@ -67,19 +67,19 @@ func loadContractSet(lggr logger.Logger, chain deployment.Chain, addresses map[s // todo handle versions switch tv.Type { case CapabilitiesRegistry: - c, err := capabilities_registry.NewCapabilitiesRegistry(common.HexToAddress(addr), chain.Client) + c, err := capabilities_registry.NewCapabilitiesRegistry(common.HexToAddress(addr), chain.EVMChain.Client) if err != nil { return nil, fmt.Errorf("failed to create capability registry contract from address %s: %w", addr, err) } out.CapabilitiesRegistry = c case KeystoneForwarder: - c, err := forwarder.NewKeystoneForwarder(common.HexToAddress(addr), chain.Client) + c, err := forwarder.NewKeystoneForwarder(common.HexToAddress(addr), chain.EVMChain.Client) if err != nil { return nil, fmt.Errorf("failed to create forwarder contract from address %s: %w", addr, err) } out.Forwarder = c case OCR3Capability: - c, err := ocr3_capability.NewOCR3Capability(common.HexToAddress(addr), chain.Client) + c, err := ocr3_capability.NewOCR3Capability(common.HexToAddress(addr), chain.EVMChain.Client) if err != nil { return nil, fmt.Errorf("failed to create OCR3Capability contract from address %s: %w", addr, err) } diff --git a/deployment/keystone/test/changeset/capability_registry.go b/deployment/keystone/test/changeset/capability_registry.go index 28ee711dc75..9205b50a51a 100644 --- a/deployment/keystone/test/changeset/capability_registry.go +++ b/deployment/keystone/test/changeset/capability_registry.go @@ -48,13 +48,13 @@ func HydrateCapabilityRegistry(t *testing.T, v v1_0.CapabilityRegistryView, env deployedContract := cs.CapabilitiesRegistry nopsParams := v.NopsToNopsParams() - tx, err := deployedContract.AddNodeOperators(chain.DeployerKey, nopsParams) + tx, err := deployedContract.AddNodeOperators(chain.EVMChain.DeployerKey, nopsParams) if _, err = deployment.ConfirmIfNoError(chain, tx, keystone.DecodeErr(capabilities_registry.CapabilitiesRegistryABI, err)); err != nil { return nil, fmt.Errorf("failed to add node operators: %w", err) } capabilitiesParams := v.CapabilitiesToCapabilitiesParams() - tx, err = deployedContract.AddCapabilities(chain.DeployerKey, capabilitiesParams) + tx, err = deployedContract.AddCapabilities(chain.EVMChain.DeployerKey, capabilitiesParams) if _, err = deployment.ConfirmIfNoError(chain, tx, keystone.DecodeErr(capabilities_registry.CapabilitiesRegistryABI, err)); err != nil { return nil, fmt.Errorf("failed to add capabilities: %w", err) } @@ -63,7 +63,7 @@ func HydrateCapabilityRegistry(t *testing.T, v v1_0.CapabilityRegistryView, env if err != nil { return nil, fmt.Errorf("failed to convert nodes to nodes params: %w", err) } - tx, err = deployedContract.AddNodes(chain.DeployerKey, nodesParams) + tx, err = deployedContract.AddNodes(chain.EVMChain.DeployerKey, nodesParams) if _, err = deployment.ConfirmIfNoError(chain, tx, keystone.DecodeErr(capabilities_registry.CapabilitiesRegistryABI, err)); err != nil { return nil, fmt.Errorf("failed to add nodes: %w", err) } @@ -77,7 +77,7 @@ func HydrateCapabilityRegistry(t *testing.T, v v1_0.CapabilityRegistryView, env for _, id := range don.NodeP2PIds { peerIds = append(peerIds, id) } - tx, err = deployedContract.AddDON(chain.DeployerKey, peerIds, cfgs, don.IsPublic, don.AcceptsWorkflows, don.F) + tx, err = deployedContract.AddDON(chain.EVMChain.DeployerKey, peerIds, cfgs, don.IsPublic, don.AcceptsWorkflows, don.F) if _, err = deployment.ConfirmIfNoError(chain, tx, keystone.DecodeErr(capabilities_registry.CapabilitiesRegistryABI, err)); err != nil { return nil, fmt.Errorf("failed to add don: %w", err) } diff --git a/deployment/llo/deploy.go b/deployment/llo/deploy.go index b361e38d9e1..57b5d215833 100644 --- a/deployment/llo/deploy.go +++ b/deployment/llo/deploy.go @@ -83,8 +83,8 @@ func DeployChannelConfigStore(e deployment.Environment, ab deployment.AddressBoo func deployChannelConfigStoreToChain(e deployment.Environment, chain deployment.Chain, ab deployment.AddressBook) (*ContractDeploy[*channel_config_store.ChannelConfigStore], error) { return deployContract(e.Logger, chain, ab, func(chain deployment.Chain) ContractDeploy[*channel_config_store.ChannelConfigStore] { ccsAddr, ccsTx, ccs, err := channel_config_store.DeployChannelConfigStore( - chain.DeployerKey, - chain.Client, + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, ) if err != nil { return ContractDeploy[*channel_config_store.ChannelConfigStore]{ @@ -112,7 +112,7 @@ func deployContract[C LLOContract]( lggr.Errorw("Failed to deploy contract", "err", contractDeploy.Err) return nil, contractDeploy.Err } - _, err := chain.Confirm(contractDeploy.Tx) + _, err := chain.EVMChain.Confirm(contractDeploy.Tx) if err != nil { lggr.Errorw("Failed to confirm deployment", "err", err) return nil, err diff --git a/deployment/llo/state.go b/deployment/llo/state.go index 4cf8fdb9694..72768be125d 100644 --- a/deployment/llo/state.go +++ b/deployment/llo/state.go @@ -21,7 +21,7 @@ func LoadChainState(chain deployment.Chain, addresses map[string]deployment.Type for address, tvStr := range addresses { switch tvStr.String() { case deployment.NewTypeAndVersion(ChannelConfigStore, deployment.Version1_0_0).String(): - ccs, err := channel_config_store.NewChannelConfigStore(common.HexToAddress(address), chain.Client) + ccs, err := channel_config_store.NewChannelConfigStore(common.HexToAddress(address), chain.EVMChain.Client) if err != nil { return state, err } diff --git a/integration-tests/contracts/ccipreader_test.go b/integration-tests/contracts/ccipreader_test.go index 3028f4707a4..3ffb47a329e 100644 --- a/integration-tests/contracts/ccipreader_test.go +++ b/integration-tests/contracts/ccipreader_test.go @@ -479,6 +479,7 @@ func TestCCIPReader_GetExpectedNextSequenceNumber(t *testing.T) { Bootstraps: 1, }, nil) state, err := changeset.LoadOnchainState(env.Env) + require.NoError(t, err) selectors := env.Env.AllChainSelectors() @@ -494,7 +495,7 @@ func TestCCIPReader_GetExpectedNextSequenceNumber(t *testing.T) { map[cciptypes.ChainSelector][]types.BoundContract{ cciptypes.ChainSelector(srcChain): { { - Address: state.Chains[srcChain].OnRamp.Address().String(), + Address: state.EVMState.Chains[srcChain].OnRamp.Address().String(), Name: consts.ContractNameOnRamp, }, }, @@ -506,7 +507,7 @@ func TestCCIPReader_GetExpectedNextSequenceNumber(t *testing.T) { maxExpectedSeqNum := uint64(10) var i uint64 for i = 1; i < maxExpectedSeqNum; i++ { - msg := changeset.DefaultRouterMessage(state.Chains[destChain].Receiver.Address()) + msg := changeset.DefaultRouterMessage(state.EVMState.Chains[destChain].Receiver.Address()) msgSentEvent := changeset.TestSendRequest(t, env.Env, state, srcChain, destChain, false, msg) require.Equal(t, uint64(i), msgSentEvent.SequenceNumber) require.Equal(t, uint64(i), msgSentEvent.Message.Header.Nonce) // check outbound nonce incremented @@ -602,9 +603,9 @@ func Test_GetChainFeePriceUpdates(t *testing.T) { require.NoError(t, changeset.AddLaneWithDefaultPricesAndFeeQuoterConfig(env.Env, state, chain2, chain1, false)) // Change the gas price for chain2 - feeQuoter := state.Chains[chain1].FeeQuoter + feeQuoter := state.EVMState.Chains[chain1].FeeQuoter _, err = feeQuoter.UpdatePrices( - env.Env.Chains[chain1].DeployerKey, fee_quoter.InternalPriceUpdates{ + env.Env.Chains[chain1].EVMChain.DeployerKey, fee_quoter.InternalPriceUpdates{ GasPriceUpdates: []fee_quoter.InternalGasPriceUpdate{ { DestChainSelector: chain2, @@ -614,7 +615,7 @@ func Test_GetChainFeePriceUpdates(t *testing.T) { }, ) require.NoError(t, err) - be := env.Env.Chains[chain1].Client.(*memory.Backend) + be := env.Env.Chains[chain1].EVMChain.Client.(*memory.Backend) be.Commit() gas, err := feeQuoter.GetDestinationChainGasPrice(&bind.CallOpts{}, chain2) @@ -629,7 +630,7 @@ func Test_GetChainFeePriceUpdates(t *testing.T) { map[cciptypes.ChainSelector][]types.BoundContract{ cciptypes.ChainSelector(chain1): { { - Address: state.Chains[chain1].FeeQuoter.Address().String(), + Address: state.EVMState.Chains[chain1].FeeQuoter.Address().String(), Name: consts.ContractNameFeeQuoter, }, }, @@ -668,7 +669,7 @@ func Test_LinkPriceUSD(t *testing.T) { map[cciptypes.ChainSelector][]types.BoundContract{ cciptypes.ChainSelector(chain1): { { - Address: state.Chains[chain1].FeeQuoter.Address().String(), + Address: state.EVMState.Chains[chain1].FeeQuoter.Address().String(), Name: consts.ContractNameFeeQuoter, }, }, @@ -703,7 +704,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 + feeQuoter := state.EVMState.Chains[selector].FeeQuoter destChainCfg := changeset.DefaultFeeQuoterDestChainConfig() //nolint:gosec // disable G115 destChainCfg.DestDataAvailabilityOverheadGas = uint32(100 + i) @@ -711,14 +712,14 @@ func Test_GetMedianDataAvailabilityGasConfig(t *testing.T) { destChainCfg.DestGasPerDataAvailabilityByte = uint16(200 + i) //nolint:gosec // disable G115 destChainCfg.DestDataAvailabilityMultiplierBps = uint16(1 + i) - _, err2 := feeQuoter.ApplyDestChainConfigUpdates(env.Env.Chains[selector].DeployerKey, []fee_quoter.FeeQuoterDestChainConfigArgs{ + _, err2 := feeQuoter.ApplyDestChainConfigUpdates(env.Env.Chains[selector].EVMChain.DeployerKey, []fee_quoter.FeeQuoterDestChainConfigArgs{ { DestChainSelector: destChain, DestChainConfig: destChainCfg, }, }) require.NoError(t, err2) - be := env.Env.Chains[selector].Client.(*memory.Backend) + be := env.Env.Chains[selector].EVMChain.Client.(*memory.Backend) be.Commit() boundContracts[cs(selector)] = []types.BoundContract{ { @@ -770,11 +771,11 @@ func Test_GetWrappedNativeTokenPriceUSD(t *testing.T) { map[cciptypes.ChainSelector][]types.BoundContract{ cciptypes.ChainSelector(chain1): { { - Address: state.Chains[chain1].FeeQuoter.Address().String(), + Address: state.EVMState.Chains[chain1].FeeQuoter.Address().String(), Name: consts.ContractNameFeeQuoter, }, { - Address: state.Chains[chain1].Router.Address().String(), + Address: state.EVMState.Chains[chain1].Router.Address().String(), Name: consts.ContractNameRouter, }, }, @@ -1259,7 +1260,7 @@ func testSetupRealContracts( var crs = make(map[cciptypes.ChainSelector]contractreader.Extended) for chain, bindings := range toBindContracts { - be := env.Env.Chains[uint64(chain)].Client.(*memory.Backend) + be := env.Env.Chains[uint64(chain)].EVMChain.Client.(*memory.Backend) cl := client.NewSimulatedBackendClient(t, be.Sim, big.NewInt(0).SetUint64(uint64(chain))) headTracker := headtracker.NewSimulatedHeadTracker(cl, lpOpts.UseFinalityTag, lpOpts.FinalityDepth) lp := logpoller.NewLogPoller(logpoller.NewORM(big.NewInt(0).SetUint64(uint64(chain)), db, lggr), diff --git a/integration-tests/smoke/ccip/ccip_batching_test.go b/integration-tests/smoke/ccip/ccip_batching_test.go index c801e899585..24f9bdccf7b 100644 --- a/integration-tests/smoke/ccip/ccip_batching_test.go +++ b/integration-tests/smoke/ccip/ccip_batching_test.go @@ -79,13 +79,13 @@ func Test_CCIPBatching(t *testing.T) { ctx, t, e.Env.Chains[sourceChain], - e.Env.Chains[sourceChain].DeployerKey, - state.Chains[sourceChain].OnRamp, - state.Chains[sourceChain].Router, - state.Chains[sourceChain].Multicall3, + e.Env.Chains[sourceChain].EVMChain.DeployerKey, + state.EVMState.Chains[sourceChain].OnRamp, + state.EVMState.Chains[sourceChain].Router, + state.EVMState.Chains[sourceChain].Multicall3, destChain, numMessages, - common.LeftPadBytes(state.Chains[destChain].Receiver.Address().Bytes(), 32), + common.LeftPadBytes(state.EVMState.Chains[destChain].Receiver.Address().Bytes(), 32), ) require.NoError(t, err) @@ -93,7 +93,7 @@ func Test_CCIPBatching(t *testing.T) { t, e.Env.Chains[sourceChain], e.Env.Chains[destChain], - state.Chains[destChain].OffRamp, + state.EVMState.Chains[destChain].OffRamp, nil, ccipocr3.NewSeqNumRange(startSeqNum[sourceChain], startSeqNum[sourceChain]+numMessages-1), true, @@ -104,7 +104,7 @@ func Test_CCIPBatching(t *testing.T) { t, e.Env.Chains[sourceChain], e.Env.Chains[destChain], - state.Chains[destChain].OffRamp, + state.EVMState.Chains[destChain].OffRamp, nil, genSeqNrRange(startSeqNum[sourceChain], startSeqNum[sourceChain]+numMessages-1), ) @@ -245,7 +245,7 @@ func Test_CCIPBatching(t *testing.T) { sourceChain = sourceChain1 otherSender = mustNewTransactor(t, e.Env.Chains[sourceChain]) transactors = []*bind.TransactOpts{ - e.Env.Chains[sourceChain].DeployerKey, + e.Env.Chains[sourceChain].EVMChain.DeployerKey, otherSender, } errs = make(chan error, len(transactors)) @@ -256,7 +256,7 @@ func Test_CCIPBatching(t *testing.T) { ctx, t, e.Env.Chains[sourceChain], - e.Env.Chains[sourceChain].DeployerKey, + e.Env.Chains[sourceChain].EVMChain.DeployerKey, otherSender.From, assets.Ether(20).ToInt(), ) @@ -268,12 +268,12 @@ func Test_CCIPBatching(t *testing.T) { t, e.Env.Chains[sourceChain], transactor, - state.Chains[sourceChain].OnRamp, - state.Chains[sourceChain].Router, - state.Chains[sourceChain].Multicall3, + state.EVMState.Chains[sourceChain].OnRamp, + state.EVMState.Chains[sourceChain].Router, + state.EVMState.Chains[sourceChain].Multicall3, destChain, merklemulti.MaxNumberTreeLeaves/2, - common.LeftPadBytes(state.Chains[destChain].Receiver.Address().Bytes(), 32), + common.LeftPadBytes(state.EVMState.Chains[destChain].Receiver.Address().Bytes(), 32), ) t.Log("sendMessages error:", err, ", writing to channel") errs <- err @@ -296,7 +296,7 @@ func Test_CCIPBatching(t *testing.T) { t, e.Env.Chains[sourceChain], e.Env.Chains[destChain], - state.Chains[destChain].OffRamp, + state.EVMState.Chains[destChain].OffRamp, nil, // startBlock ccipocr3.NewSeqNumRange( startSeqNum[sourceChain], @@ -328,7 +328,7 @@ func assertExecAsync( t, e.Env.Chains[sourceChainSelector], e.Env.Chains[destChainSelector], - state.Chains[destChainSelector].OffRamp, + state.EVMState.Chains[destChainSelector].OffRamp, nil, seqNums, ) @@ -352,7 +352,7 @@ func assertCommitReportsAsync( t, e.Env.Chains[sourceChainSelector], e.Env.Chains[destChainSelector], - state.Chains[destChainSelector].OffRamp, + state.EVMState.Chains[destChainSelector].OffRamp, nil, ccipocr3.NewSeqNumRange(startSeqNum, endSeqNum), true, @@ -377,13 +377,13 @@ func sendMessagesAsync( ctx, t, e.Env.Chains[sourceChainSelector], - e.Env.Chains[sourceChainSelector].DeployerKey, - state.Chains[sourceChainSelector].OnRamp, - state.Chains[sourceChainSelector].Router, - state.Chains[sourceChainSelector].Multicall3, + e.Env.Chains[sourceChainSelector].EVMChain.DeployerKey, + state.EVMState.Chains[sourceChainSelector].OnRamp, + state.EVMState.Chains[sourceChainSelector].Router, + state.EVMState.Chains[sourceChainSelector].Multicall3, destChainSelector, numMessages, - common.LeftPadBytes(state.Chains[destChainSelector].Receiver.Address().Bytes(), 32), + common.LeftPadBytes(state.EVMState.Chains[destChainSelector].Receiver.Address().Bytes(), 32), ) t.Log("sendMessagesAsync error:", err, ", writing to channel") out <- err @@ -516,16 +516,16 @@ func sendEth( to common.Address, value *big.Int, ) { - balance, err := chain.Client.BalanceAt(ctx, from.From, nil) + balance, err := chain.EVMChain.Client.BalanceAt(ctx, from.From, nil) require.NoError(t, err) if balance.Cmp(value) < 0 { t.Fatalf("insufficient balance: %s < %s", balance.String(), value.String()) } t.Logf("balance of from account %s: %s", from.From.String(), balance.String()) - nonce, err := chain.Client.PendingNonceAt(ctx, from.From) + nonce, err := chain.EVMChain.Client.PendingNonceAt(ctx, from.From) require.NoError(t, err) - gp, err := chain.Client.SuggestGasPrice(ctx) + gp, err := chain.EVMChain.Client.SuggestGasPrice(ctx) require.NoError(t, err) tx := gethtypes.NewTx(&gethtypes.LegacyTx{ Nonce: nonce, @@ -537,7 +537,7 @@ func sendEth( }) signedTx, err := from.Signer(from.From, tx) require.NoError(t, err) - err = chain.Client.SendTransaction(ctx, signedTx) + err = chain.EVMChain.Client.SendTransaction(ctx, signedTx) require.NoError(t, err) t.Log("sent funding tx:", signedTx.Hash().Hex()) _, err = deployment.ConfirmIfNoError(chain, signedTx, err) diff --git a/integration-tests/smoke/ccip/ccip_fee_boosting_test.go b/integration-tests/smoke/ccip/ccip_fee_boosting_test.go index 1fe9d5817c9..f0e29ef7dbf 100644 --- a/integration-tests/smoke/ccip/ccip_fee_boosting_test.go +++ b/integration-tests/smoke/ccip/ccip_fee_boosting_test.go @@ -72,7 +72,7 @@ func Test_CCIPFeeBoosting(t *testing.T) { ", dest chain selector:", destChain, ) - fetchedGasPriceDest, err := e.Env.Chains[destChain].Client.SuggestGasPrice(tests.Context(t)) + fetchedGasPriceDest, err := e.Env.Chains[destChain].EVMChain.Client.SuggestGasPrice(tests.Context(t)) require.NoError(t, err) originalGasPriceDestUSD := new(big.Int).Div( new(big.Int).Mul(fetchedGasPriceDest, wethPrice), @@ -112,8 +112,8 @@ func Test_CCIPFeeBoosting(t *testing.T) { // Update token prices in destination chain FeeQuoter err = updateTokensPrices(e, state, destChain, map[common.Address]*big.Int{ - state.Chains[destChain].LinkToken.Address(): linkPrice, - state.Chains[destChain].Weth9.Address(): wethPrice, + state.EVMState.Chains[destChain].LinkToken.Address(): linkPrice, + state.EVMState.Chains[destChain].Weth9.Address(): wethPrice, }) require.NoError(t, err) @@ -121,11 +121,11 @@ func Test_CCIPFeeBoosting(t *testing.T) { expectedSeqNum := make(map[changeset.SourceDestPair]uint64) expectedSeqNumExec := make(map[changeset.SourceDestPair][]uint64) - latesthdr, err := e.Env.Chains[sourceChain].Client.HeaderByNumber(testcontext.Get(t), nil) + latesthdr, err := e.Env.Chains[sourceChain].EVMChain.Client.HeaderByNumber(testcontext.Get(t), nil) require.NoError(t, err) block := latesthdr.Number.Uint64() msgSentEvent := changeset.TestSendRequest(t, e.Env, state, sourceChain, destChain, false, router.ClientEVM2AnyMessage{ - Receiver: common.LeftPadBytes(state.Chains[destChain].Receiver.Address().Bytes(), 32), + Receiver: common.LeftPadBytes(state.EVMState.Chains[destChain].Receiver.Address().Bytes(), 32), Data: []byte("message that needs fee boosting"), TokenAmounts: nil, FeeToken: common.HexToAddress("0x0"), @@ -145,7 +145,7 @@ func Test_CCIPFeeBoosting(t *testing.T) { require.NoError(t, err) // Confirm gas prices are updated - srcFeeQuoter := state.Chains[sourceChain].FeeQuoter + srcFeeQuoter := state.EVMState.Chains[sourceChain].FeeQuoter err = changeset.ConfirmGasPriceUpdated(t, e.Env.Chains[destChain], srcFeeQuoter, 0, originalGasPriceDestUSD) require.NoError(t, err) @@ -176,7 +176,7 @@ func willTriggerFeeBoosting( t.Logf("Dest Chain: %d", msg.Header.DestChainSelector) ep := ccipevm.NewGasEstimateProvider() - chainState, exists := state.Chains[srcChain] + chainState, exists := state.EVMState.Chains[srcChain] require.True(t, exists) feeQuoter := chainState.FeeQuoter @@ -276,14 +276,14 @@ func convertToMessage(msg onramp.InternalEVM2AnyRampMessage) cciptypes.Message { } func updateGasPrice(env changeset.DeployedEnv, state changeset.CCIPOnChainState, srcChain, destChain uint64, gasPrice *big.Int) error { - chainState, exists := state.Chains[srcChain] + chainState, exists := state.EVMState.Chains[srcChain] if !exists { return fmt.Errorf("chain state not found for selector: %d", srcChain) } feeQuoter := chainState.FeeQuoter // Update gas price - auth := env.Env.Chains[srcChain].DeployerKey + auth := env.Env.Chains[srcChain].EVMChain.DeployerKey tx, err := feeQuoter.UpdatePrices(auth, fee_quoter.InternalPriceUpdates{ TokenPriceUpdates: nil, GasPriceUpdates: []fee_quoter.InternalGasPriceUpdate{ @@ -304,14 +304,14 @@ func updateGasPrice(env changeset.DeployedEnv, state changeset.CCIPOnChainState, } func updateTokensPrices(env changeset.DeployedEnv, state changeset.CCIPOnChainState, chain uint64, tokenPrices map[common.Address]*big.Int) error { - chainState, exists := state.Chains[chain] + chainState, exists := state.EVMState.Chains[chain] if !exists { return fmt.Errorf("chain state not found for selector: %d", chain) } feeQuoter := chainState.FeeQuoter // Update token prices - auth := env.Env.Chains[chain].DeployerKey + auth := env.Env.Chains[chain].EVMChain.DeployerKey tokenPricesUpdates := make([]fee_quoter.InternalTokenPriceUpdate, 0, len(tokenPrices)) for token, price := range tokenPrices { tokenPricesUpdates = append(tokenPricesUpdates, fee_quoter.InternalTokenPriceUpdate{ diff --git a/integration-tests/smoke/ccip/ccip_fees_test.go b/integration-tests/smoke/ccip/ccip_fees_test.go index 791ba8f2619..7f095161698 100644 --- a/integration-tests/smoke/ccip/ccip_fees_test.go +++ b/integration-tests/smoke/ccip/ccip_fees_test.go @@ -44,19 +44,19 @@ func setupTokens( tenv.Env.Chains, src, dest, - tenv.Env.Chains[src].DeployerKey, - tenv.Env.Chains[dest].DeployerKey, + tenv.Env.Chains[src].EVMChain.DeployerKey, + tenv.Env.Chains[dest].EVMChain.DeployerKey, state, tenv.Env.ExistingAddresses, "MY_TOKEN", ) require.NoError(t, err) - linkToken := state.Chains[src].LinkToken + linkToken := state.EVMState.Chains[src].LinkToken tx, err := srcToken.Mint( - e.Chains[src].DeployerKey, - e.Chains[src].DeployerKey.From, + e.Chains[src].EVMChain.DeployerKey, + e.Chains[src].EVMChain.DeployerKey.From, transferTokenMintAmount, ) _, err = deployment.ConfirmIfNoError(e.Chains[src], tx, err) @@ -64,8 +64,8 @@ func setupTokens( // Mint a destination token tx, err = dstToken.Mint( - e.Chains[dest].DeployerKey, - e.Chains[dest].DeployerKey.From, + e.Chains[dest].EVMChain.DeployerKey, + e.Chains[dest].EVMChain.DeployerKey.From, transferTokenMintAmount, ) _, err = deployment.ConfirmIfNoError(e.Chains[dest], tx, err) @@ -73,24 +73,24 @@ func setupTokens( // Approve the router to spend the tokens and confirm the tx's // To prevent having to approve the router for every transfer, we approve a sufficiently large amount - tx, err = srcToken.Approve(e.Chains[src].DeployerKey, state.Chains[src].Router.Address(), math.MaxBig256) + tx, err = srcToken.Approve(e.Chains[src].EVMChain.DeployerKey, state.EVMState.Chains[src].Router.Address(), math.MaxBig256) _, err = deployment.ConfirmIfNoError(e.Chains[src], tx, err) require.NoError(t, err) - tx, err = dstToken.Approve(e.Chains[dest].DeployerKey, state.Chains[dest].Router.Address(), math.MaxBig256) + tx, err = dstToken.Approve(e.Chains[dest].EVMChain.DeployerKey, state.EVMState.Chains[dest].Router.Address(), math.MaxBig256) _, err = deployment.ConfirmIfNoError(e.Chains[dest], tx, err) require.NoError(t, err) // Grant mint and burn roles to the deployer key for the newly deployed linkToken // Since those roles are not granted automatically - tx, err = linkToken.GrantMintAndBurnRoles(e.Chains[src].DeployerKey, e.Chains[src].DeployerKey.From) + tx, err = linkToken.GrantMintAndBurnRoles(e.Chains[src].EVMChain.DeployerKey, e.Chains[src].EVMChain.DeployerKey.From) _, err = deployment.ConfirmIfNoError(e.Chains[src], tx, err) require.NoError(t, err) // Mint link token and confirm the tx tx, err = linkToken.Mint( - e.Chains[src].DeployerKey, - e.Chains[src].DeployerKey.From, + e.Chains[src].EVMChain.DeployerKey, + e.Chains[src].EVMChain.DeployerKey.From, feeTokenMintAmount, ) _, err = deployment.ConfirmIfNoError(e.Chains[src], tx, err) @@ -145,9 +145,9 @@ func Test_CCIPFees(t *testing.T) { Amount: deployment.E18Mult(2), }, }, - feeToken: state.Chains[sourceChain].LinkToken.Address(), + feeToken: state.EVMState.Chains[sourceChain].LinkToken.Address(), data: []byte("hello ptt world"), - receiver: common.LeftPadBytes(state.Chains[destChain].Receiver.Address().Bytes(), 32), + receiver: common.LeftPadBytes(state.EVMState.Chains[destChain].Receiver.Address().Bytes(), 32), srcToken: srcToken, dstToken: dstToken, assertTokenBalance: true, @@ -171,7 +171,7 @@ func Test_CCIPFees(t *testing.T) { }, feeToken: common.HexToAddress("0x0"), data: []byte("hello ptt world"), - receiver: common.LeftPadBytes(state.Chains[sourceChain].Receiver.Address().Bytes(), 32), + receiver: common.LeftPadBytes(state.EVMState.Chains[sourceChain].Receiver.Address().Bytes(), 32), // note the order of src and dest is reversed here srcToken: dstToken, @@ -192,9 +192,9 @@ func Test_CCIPFees(t *testing.T) { Amount: deployment.E18Mult(2), }, }, - feeToken: state.Chains[sourceChain].Weth9.Address(), + feeToken: state.EVMState.Chains[sourceChain].Weth9.Address(), data: []byte("hello ptt world"), - receiver: common.LeftPadBytes(state.Chains[destChain].Receiver.Address().Bytes(), 32), + receiver: common.LeftPadBytes(state.EVMState.Chains[destChain].Receiver.Address().Bytes(), 32), srcToken: srcToken, dstToken: dstToken, assertTokenBalance: true, @@ -204,9 +204,9 @@ func Test_CCIPFees(t *testing.T) { t.Run("Send programmable token transfer but revert not enough tokens", func(t *testing.T) { // Send to the receiver on the destination chain paying with LINK token var ( - receiver = common.LeftPadBytes(state.Chains[destChain].Receiver.Address().Bytes(), 32) + receiver = common.LeftPadBytes(state.EVMState.Chains[destChain].Receiver.Address().Bytes(), 32) data = []byte("") - feeToken = state.Chains[sourceChain].LinkToken.Address() + feeToken = state.EVMState.Chains[sourceChain].LinkToken.Address() ) // Increase the token send amount to more than available to intentionally cause a revert @@ -227,7 +227,7 @@ func Test_CCIPFees(t *testing.T) { e, state, &changeset.CCIPSendReqConfig{ - Sender: e.Chains[sourceChain].DeployerKey, + Sender: e.Chains[sourceChain].EVMChain.DeployerKey, IsTestRouter: true, SourceChain: sourceChain, DestChain: destChain, @@ -245,9 +245,9 @@ func Test_CCIPFees(t *testing.T) { env: tenv, // no tokens, only data tokenAmounts: nil, - feeToken: state.Chains[sourceChain].LinkToken.Address(), + feeToken: state.EVMState.Chains[sourceChain].LinkToken.Address(), data: []byte("hello link world"), - receiver: common.LeftPadBytes(state.Chains[destChain].Receiver.Address().Bytes(), 32), + receiver: common.LeftPadBytes(state.EVMState.Chains[destChain].Receiver.Address().Bytes(), 32), srcToken: srcToken, dstToken: dstToken, assertTokenBalance: false, @@ -264,7 +264,7 @@ func Test_CCIPFees(t *testing.T) { tokenAmounts: nil, feeToken: common.HexToAddress("0x0"), data: []byte("hello native world"), - receiver: common.LeftPadBytes(state.Chains[destChain].Receiver.Address().Bytes(), 32), + receiver: common.LeftPadBytes(state.EVMState.Chains[destChain].Receiver.Address().Bytes(), 32), srcToken: srcToken, dstToken: dstToken, assertTokenBalance: false, @@ -279,9 +279,9 @@ func Test_CCIPFees(t *testing.T) { env: tenv, // no tokens, only data tokenAmounts: nil, - feeToken: state.Chains[sourceChain].Weth9.Address(), + feeToken: state.EVMState.Chains[sourceChain].Weth9.Address(), data: []byte("hello wrapped native world"), - receiver: common.LeftPadBytes(state.Chains[destChain].Receiver.Address().Bytes(), 32), + receiver: common.LeftPadBytes(state.EVMState.Chains[destChain].Receiver.Address().Bytes(), 32), srcToken: srcToken, dstToken: dstToken, assertTokenBalance: false, @@ -317,46 +317,46 @@ func runFeeTokenTestCase(tc feeTokenTestCase) { var dstTokBalanceBefore *big.Int if tc.assertTokenBalance { var err error - dstTokBalanceBefore, err = tc.dstToken.BalanceOf(nil, state.Chains[tc.dst].Receiver.Address()) + dstTokBalanceBefore, err = tc.dstToken.BalanceOf(nil, state.EVMState.Chains[tc.dst].Receiver.Address()) require.NoError(tc.t, err) tc.t.Logf("destination token balance before of receiver %s: %s", - state.Chains[tc.dst].Receiver.Address(), + state.EVMState.Chains[tc.dst].Receiver.Address(), dstTokBalanceBefore.String()) } // if fee token is not native then approve the router to spend the fee token from the sender. var feeTokenWrapper *burn_mint_erc677.BurnMintERC677 if tc.feeToken != common.HexToAddress("0x0") { - if tc.feeToken == state.Chains[tc.src].Weth9.Address() { + if tc.feeToken == state.EVMState.Chains[tc.src].Weth9.Address() { // Deposit some ETH into the WETH contract - weth9, err := weth9_wrapper.NewWETH9(state.Chains[tc.src].Weth9.Address(), srcChain.Client) + weth9, err := weth9_wrapper.NewWETH9(state.EVMState.Chains[tc.src].Weth9.Address(), srcChain.EVMChain.Client) require.NoError(tc.t, err) - balance, err := srcChain.Client.BalanceAt(ctx, srcChain.DeployerKey.From, nil) + balance, err := srcChain.EVMChain.Client.BalanceAt(ctx, srcChain.EVMChain.DeployerKey.From, nil) require.NoError(tc.t, err) tc.t.Logf("balance before deposit: %s", balance.String()) - srcChain.DeployerKey.Value = assets.Ether(100).ToInt() - tx, err := weth9.Deposit(srcChain.DeployerKey) + srcChain.EVMChain.DeployerKey.Value = assets.Ether(100).ToInt() + tx, err := weth9.Deposit(srcChain.EVMChain.DeployerKey) _, err = deployment.ConfirmIfNoError(srcChain, tx, err) require.NoError(tc.t, err) - srcChain.DeployerKey.Value = big.NewInt(0) + srcChain.EVMChain.DeployerKey.Value = big.NewInt(0) } var err error - feeTokenWrapper, err = burn_mint_erc677.NewBurnMintERC677(tc.feeToken, srcChain.Client) + feeTokenWrapper, err = burn_mint_erc677.NewBurnMintERC677(tc.feeToken, srcChain.EVMChain.Client) require.NoError(tc.t, err) // Approve the router to spend fee token - tx, err := feeTokenWrapper.Approve(srcChain.DeployerKey, state.Chains[tc.src].Router.Address(), math.MaxBig256) + tx, err := feeTokenWrapper.Approve(srcChain.EVMChain.DeployerKey, state.EVMState.Chains[tc.src].Router.Address(), math.MaxBig256) _, err = deployment.ConfirmIfNoError(srcChain, tx, err) require.NoError(tc.t, err) } // get the header for the destination chain and the relevant block number - latesthdr, err := dstChain.Client.HeaderByNumber(testcontext.Get(tc.t), nil) + latesthdr, err := dstChain.EVMChain.Client.HeaderByNumber(testcontext.Get(tc.t), nil) require.NoError(tc.t, err) block := latesthdr.Number.Uint64() startBlocks[tc.dst] = &block @@ -366,10 +366,10 @@ func runFeeTokenTestCase(tc feeTokenTestCase) { if feeTokenWrapper != nil { feeTokenBalanceBefore, err = feeTokenWrapper.BalanceOf(&bind.CallOpts{ Context: ctx, - }, srcChain.DeployerKey.From) + }, srcChain.EVMChain.DeployerKey.From) require.NoError(tc.t, err) } else { - feeTokenBalanceBefore, err = srcChain.Client.BalanceAt(ctx, srcChain.DeployerKey.From, nil) + feeTokenBalanceBefore, err = srcChain.EVMChain.Client.BalanceAt(ctx, srcChain.EVMChain.DeployerKey.From, nil) require.NoError(tc.t, err) } tc.t.Logf("fee token balance before: %s, fee token enabled: %s", @@ -405,10 +405,10 @@ func runFeeTokenTestCase(tc feeTokenTestCase) { if feeTokenWrapper != nil { feeTokenBalanceAfter, err = feeTokenWrapper.BalanceOf(&bind.CallOpts{ Context: ctx, - }, srcChain.DeployerKey.From) + }, srcChain.EVMChain.DeployerKey.From) require.NoError(tc.t, err) } else { - feeTokenBalanceAfter, err = srcChain.Client.BalanceAt(ctx, srcChain.DeployerKey.From, nil) + feeTokenBalanceAfter, err = srcChain.EVMChain.Client.BalanceAt(ctx, srcChain.EVMChain.DeployerKey.From, nil) require.NoError(tc.t, err) } tc.t.Logf("fee token balance after: %s, fee token: %s, fee paid: %s", @@ -416,7 +416,7 @@ func runFeeTokenTestCase(tc feeTokenTestCase) { // in the case we have no fee token, native is also used to pay for the tx, // so we have to subtract that as well if feeTokenWrapper == nil { - receipt, err := srcChain.Client.TransactionReceipt(ctx, msgSentEvent.Raw.TxHash) + receipt, err := srcChain.EVMChain.Client.TransactionReceipt(ctx, msgSentEvent.Raw.TxHash) require.NoError(tc.t, err) txCostWei := new(big.Int).Mul(new(big.Int).SetUint64(receipt.GasUsed), receipt.EffectiveGasPrice) feeTokenBalanceBefore.Sub(feeTokenBalanceBefore, txCostWei) @@ -431,8 +431,8 @@ func runFeeTokenTestCase(tc feeTokenTestCase) { changeset.ConfirmCommitForAllWithExpectedSeqNums(tc.t, tc.env.Env, state, expectedSeqNum, startBlocks) // After commit is reported on all chains, token prices should be updated in FeeQuoter. - linkAddress := state.Chains[tc.dst].LinkToken.Address() - feeQuoter := state.Chains[tc.dst].FeeQuoter + linkAddress := state.EVMState.Chains[tc.dst].LinkToken.Address() + feeQuoter := state.EVMState.Chains[tc.dst].FeeQuoter timestampedPrice, err := feeQuoter.GetTokenPrice(&bind.CallOpts{ Context: ctx, }, linkAddress) @@ -448,7 +448,7 @@ func runFeeTokenTestCase(tc feeTokenTestCase) { balanceAfter, err := tc.dstToken.BalanceOf(&bind.CallOpts{ Context: ctx, - }, state.Chains[tc.dst].Receiver.Address()) + }, state.EVMState.Chains[tc.dst].Receiver.Address()) require.NoError(tc.t, err) require.Equal( tc.t, 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 221d35bd992..40080b6ca5e 100644 --- a/integration-tests/smoke/ccip/ccip_gas_price_updates_test.go +++ b/integration-tests/smoke/ccip/ccip_gas_price_updates_test.go @@ -43,8 +43,8 @@ func Test_CCIPGasPriceUpdates(t *testing.T) { sourceChain1 := allChainSelectors[0] sourceChain2 := allChainSelectors[1] - feeQuoter1 := state.Chains[sourceChain1].FeeQuoter - feeQuoter2 := state.Chains[sourceChain2].FeeQuoter + feeQuoter1 := state.EVMState.Chains[sourceChain1].FeeQuoter + feeQuoter2 := state.EVMState.Chains[sourceChain2].FeeQuoter // get initial chain fees initialChain2Fee, err := feeQuoter1.GetDestinationChainGasPrice(callOpts, sourceChain2) @@ -55,8 +55,8 @@ func Test_CCIPGasPriceUpdates(t *testing.T) { t.Logf("initial chain2 fee (stored in chain1): %v", initialChain2Fee) // get latest price updates sequence number from the offRamps - offRampChain1 := state.Chains[sourceChain1].OffRamp - offRampChain2 := state.Chains[sourceChain2].OffRamp + offRampChain1 := state.EVMState.Chains[sourceChain1].OffRamp + offRampChain2 := state.EVMState.Chains[sourceChain2].OffRamp priceUpdatesSeqNumChain1, err := offRampChain1.GetLatestPriceSequenceNumber(callOpts) require.NoError(t, err) priceUpdatesSeqNumChain2, err := offRampChain2.GetLatestPriceSequenceNumber(callOpts) @@ -65,7 +65,7 @@ func Test_CCIPGasPriceUpdates(t *testing.T) { t.Logf("priceUpdatesSeqNumChain2: %v", priceUpdatesSeqNumChain2) // update the price of chain2 - tx, err := feeQuoter1.UpdatePrices(e.Env.Chains[sourceChain1].DeployerKey, fee_quoter.InternalPriceUpdates{ + tx, err := feeQuoter1.UpdatePrices(e.Env.Chains[sourceChain1].EVMChain.DeployerKey, fee_quoter.InternalPriceUpdates{ TokenPriceUpdates: nil, GasPriceUpdates: []fee_quoter.InternalGasPriceUpdate{ {DestChainSelector: sourceChain2, UsdPerUnitGas: big.NewInt(5123)}, diff --git a/integration-tests/smoke/ccip/ccip_message_limitations_test.go b/integration-tests/smoke/ccip/ccip_message_limitations_test.go index 902d07aec5c..36ab4c82024 100644 --- a/integration-tests/smoke/ccip/ccip_message_limitations_test.go +++ b/integration-tests/smoke/ccip/ccip_message_limitations_test.go @@ -43,7 +43,7 @@ func Test_CCIPMessageLimitations(t *testing.T) { deployment.E18Mult(10_000), ) - chain0DestConfig, err := onChainState.Chains[chains[0]].FeeQuoter.GetDestChainConfig(callOpts, chains[1]) + chain0DestConfig, err := onChainState.EVMState.Chains[chains[0]].FeeQuoter.GetDestChainConfig(callOpts, chains[1]) require.NoError(t, err) t.Logf("0->1 destination config: %+v", chain0DestConfig) @@ -59,7 +59,7 @@ func Test_CCIPMessageLimitations(t *testing.T) { fromChain: chains[0], toChain: chains[1], msg: router.ClientEVM2AnyMessage{ - Receiver: common.LeftPadBytes(onChainState.Chains[chains[1]].Receiver.Address().Bytes(), 32), + Receiver: common.LeftPadBytes(onChainState.EVMState.Chains[chains[1]].Receiver.Address().Bytes(), 32), Data: []byte(strings.Repeat("0", int(chain0DestConfig.MaxDataBytes))), FeeToken: common.HexToAddress("0x0"), }, @@ -69,7 +69,7 @@ func Test_CCIPMessageLimitations(t *testing.T) { fromChain: chains[0], toChain: chains[1], msg: router.ClientEVM2AnyMessage{ - Receiver: common.LeftPadBytes(onChainState.Chains[chains[1]].Receiver.Address().Bytes(), 32), + Receiver: common.LeftPadBytes(onChainState.EVMState.Chains[chains[1]].Receiver.Address().Bytes(), 32), TokenAmounts: slices.Repeat([]router.ClientEVMTokenAmount{ {Token: srcToken.Address(), Amount: big.NewInt(1)}, }, int(chain0DestConfig.MaxNumberOfTokensPerMsg)), @@ -81,7 +81,7 @@ func Test_CCIPMessageLimitations(t *testing.T) { fromChain: chains[0], toChain: chains[1], msg: router.ClientEVM2AnyMessage{ - Receiver: common.LeftPadBytes(onChainState.Chains[chains[1]].Receiver.Address().Bytes(), 32), + Receiver: common.LeftPadBytes(onChainState.EVMState.Chains[chains[1]].Receiver.Address().Bytes(), 32), Data: []byte(strings.Repeat("0", int(chain0DestConfig.MaxDataBytes))), FeeToken: common.HexToAddress("0x0"), ExtraArgs: changeset.MakeEVMExtraArgsV2(uint64(chain0DestConfig.MaxPerMsgGasLimit), true), @@ -106,7 +106,7 @@ func Test_CCIPMessageLimitations(t *testing.T) { fromChain: chains[0], toChain: chains[1], msg: router.ClientEVM2AnyMessage{ - Receiver: common.LeftPadBytes(onChainState.Chains[chains[1]].Receiver.Address().Bytes(), 32), + Receiver: common.LeftPadBytes(onChainState.EVMState.Chains[chains[1]].Receiver.Address().Bytes(), 32), Data: []byte(strings.Repeat("0", int(chain0DestConfig.MaxDataBytes)+1)), TokenAmounts: []router.ClientEVMTokenAmount{}, FeeToken: common.HexToAddress("0x0"), @@ -119,7 +119,7 @@ func Test_CCIPMessageLimitations(t *testing.T) { fromChain: chains[0], toChain: chains[1], msg: router.ClientEVM2AnyMessage{ - Receiver: common.LeftPadBytes(onChainState.Chains[chains[1]].Receiver.Address().Bytes(), 32), + Receiver: common.LeftPadBytes(onChainState.EVMState.Chains[chains[1]].Receiver.Address().Bytes(), 32), Data: []byte("abc"), TokenAmounts: slices.Repeat([]router.ClientEVMTokenAmount{ {Token: srcToken.Address(), Amount: big.NewInt(1)}, @@ -134,7 +134,7 @@ func Test_CCIPMessageLimitations(t *testing.T) { fromChain: chains[0], toChain: chains[1], msg: router.ClientEVM2AnyMessage{ - Receiver: common.LeftPadBytes(onChainState.Chains[chains[1]].Receiver.Address().Bytes(), 32), + Receiver: common.LeftPadBytes(onChainState.EVMState.Chains[chains[1]].Receiver.Address().Bytes(), 32), Data: []byte("abc"), TokenAmounts: []router.ClientEVMTokenAmount{}, FeeToken: common.HexToAddress("0x0"), diff --git a/integration-tests/smoke/ccip/ccip_messaging_test.go b/integration-tests/smoke/ccip/ccip_messaging_test.go index 07e237451c8..8df82f8ca91 100644 --- a/integration-tests/smoke/ccip/ccip_messaging_test.go +++ b/integration-tests/smoke/ccip/ccip_messaging_test.go @@ -73,7 +73,7 @@ func Test_CCIPMessaging(t *testing.T) { var ( replayed bool nonce uint64 - sender = common.LeftPadBytes(e.Env.Chains[sourceChain].DeployerKey.From.Bytes(), 32) + sender = common.LeftPadBytes(e.Env.Chains[sourceChain].EVMChain.DeployerKey.From.Bytes(), 32) out messagingTestCaseOutput setup = testCaseSetup{ t: t, @@ -105,7 +105,7 @@ func Test_CCIPMessaging(t *testing.T) { replayed: out.replayed, nonce: out.nonce, }, - state.Chains[destChain].FeeQuoter.Address(), + state.EVMState.Chains[destChain].FeeQuoter.Address(), []byte("hello FeeQuoter"), nil, // default extraArgs changeset.EXECUTION_STATE_SUCCESS, // success because offRamp won't call a contract not implementing CCIPReceiver @@ -113,7 +113,7 @@ func Test_CCIPMessaging(t *testing.T) { }) t.Run("message to contract implementing CCIPReceiver", func(t *testing.T) { - latestHead, err := e.Env.Chains[destChain].Client.HeaderByNumber(ctx, nil) + latestHead, err := e.Env.Chains[destChain].EVMChain.Client.HeaderByNumber(ctx, nil) require.NoError(t, err) out = runMessagingTestCase( messagingTestCase{ @@ -121,12 +121,12 @@ func Test_CCIPMessaging(t *testing.T) { replayed: out.replayed, nonce: out.nonce, }, - state.Chains[destChain].Receiver.Address(), + state.EVMState.Chains[destChain].Receiver.Address(), []byte("hello CCIPReceiver"), nil, // default extraArgs changeset.EXECUTION_STATE_SUCCESS, func(t *testing.T) { - iter, err := state.Chains[destChain].Receiver.FilterMessageReceived(&bind.FilterOpts{ + iter, err := state.EVMState.Chains[destChain].Receiver.FilterMessageReceived(&bind.FilterOpts{ Context: ctx, Start: latestHead.Number.Uint64(), }) @@ -138,7 +138,7 @@ func Test_CCIPMessaging(t *testing.T) { }) t.Run("message to contract implementing CCIPReceiver with low exec gas", func(t *testing.T) { - latestHead, err := e.Env.Chains[destChain].Client.HeaderByNumber(ctx, nil) + latestHead, err := e.Env.Chains[destChain].EVMChain.Client.HeaderByNumber(ctx, nil) require.NoError(t, err) out = runMessagingTestCase( messagingTestCase{ @@ -146,7 +146,7 @@ func Test_CCIPMessaging(t *testing.T) { replayed: out.replayed, nonce: out.nonce, }, - state.Chains[destChain].Receiver.Address(), + state.EVMState.Chains[destChain].Receiver.Address(), []byte("hello CCIPReceiver with low exec gas"), changeset.MakeEVMExtraArgsV2(1, false), // 1 gas is too low. changeset.EXECUTION_STATE_FAILURE, // state would be failed onchain due to low gas @@ -173,14 +173,14 @@ func manuallyExecute( merkleRoot := getMerkleRoot( ctx, t, - state.Chains[destChain].OffRamp, + state.EVMState.Chains[destChain].OffRamp, out.msgSentEvent.SequenceNumber, startBlock, ) messageHash := getMessageHash( ctx, t, - state.Chains[destChain].OffRamp, + state.EVMState.Chains[destChain].OffRamp, sourceChain, out.msgSentEvent.SequenceNumber, out.msgSentEvent.Message.Header.MessageId, @@ -192,8 +192,8 @@ func manuallyExecute( require.NoError(t, err) require.Equal(t, merkleRoot, tree.Root()) - tx, err := state.Chains[destChain].OffRamp.ManuallyExecute( - e.Env.Chains[destChain].DeployerKey, + tx, err := state.EVMState.Chains[destChain].OffRamp.ManuallyExecute( + e.Env.Chains[destChain].EVMChain.DeployerKey, []offramp.InternalExecutionReport{ { SourceChainSelector: sourceChain, @@ -208,7 +208,7 @@ func manuallyExecute( }, Sender: sender, Data: []byte("hello CCIPReceiver with low exec gas"), - Receiver: state.Chains[destChain].Receiver.Address(), + Receiver: state.EVMState.Chains[destChain].Receiver.Address(), GasLimit: big.NewInt(1), TokenAmounts: []offramp.InternalAny2EVMTokenTransfer{}, }, @@ -232,7 +232,7 @@ func manuallyExecute( _, err = deployment.ConfirmIfNoError(e.Env.Chains[destChain], tx, err) require.NoError(t, err, "failed to send/confirm manuallyExecute tx") - newExecutionState, err := state.Chains[destChain].OffRamp.GetExecutionState(&bind.CallOpts{Context: ctx}, sourceChain, out.msgSentEvent.SequenceNumber) + newExecutionState, err := state.EVMState.Chains[destChain].OffRamp.GetExecutionState(&bind.CallOpts{Context: ctx}, sourceChain, out.msgSentEvent.SequenceNumber) require.NoError(t, err) require.Equal(t, uint8(changeset.EXECUTION_STATE_SUCCESS), newExecutionState) } @@ -307,7 +307,7 @@ func runMessagingTestCase( extraAssertions ...func(t *testing.T), ) (out messagingTestCaseOutput) { // check latest nonce - latestNonce, err := tc.onchainState.Chains[tc.destChain].NonceManager.GetInboundNonce(&bind.CallOpts{ + latestNonce, err := tc.onchainState.EVMState.Chains[tc.destChain].NonceManager.GetInboundNonce(&bind.CallOpts{ Context: tests.Context(tc.t), }, tc.sourceChain, tc.sender) require.NoError(tc.t, err) @@ -361,7 +361,7 @@ func runMessagingTestCase( ) // check the sender latestNonce on the dest, should be incremented - latestNonce, err = tc.onchainState.Chains[tc.destChain].NonceManager.GetInboundNonce(&bind.CallOpts{ + latestNonce, err = tc.onchainState.EVMState.Chains[tc.destChain].NonceManager.GetInboundNonce(&bind.CallOpts{ Context: tests.Context(tc.t), }, tc.sourceChain, tc.sender) require.NoError(tc.t, err) diff --git a/integration-tests/smoke/ccip/ccip_ooo_execution_test.go b/integration-tests/smoke/ccip/ccip_ooo_execution_test.go index 6a3a6b869cd..743a5f6875f 100644 --- a/integration-tests/smoke/ccip/ccip_ooo_execution_test.go +++ b/integration-tests/smoke/ccip/ccip_ooo_execution_test.go @@ -46,8 +46,8 @@ func Test_OutOfOrderExecution(t *testing.T) { allChainSelectors := maps.Keys(e.Chains) sourceChain, destChain := allChainSelectors[0], allChainSelectors[1] - ownerSourceChain := e.Chains[sourceChain].DeployerKey - ownerDestChain := e.Chains[destChain].DeployerKey + ownerSourceChain := e.Chains[sourceChain].EVMChain.DeployerKey + ownerDestChain := e.Chains[destChain].EVMChain.DeployerKey anotherSender, err := pickFirstAvailableUser(tenv, sourceChain, e) require.NoError(t, err) @@ -70,9 +70,9 @@ func Test_OutOfOrderExecution(t *testing.T) { srcUSDC, destUSDC, err := changeset.ConfigureUSDCTokenPools(lggr, e.Chains, sourceChain, destChain, state) require.NoError(t, err) - err = changeset.UpdateFeeQuoterForUSDC(lggr, e.Chains[sourceChain], state.Chains[sourceChain], destChain, srcUSDC) + err = changeset.UpdateFeeQuoterForUSDC(lggr, e.Chains[sourceChain], state.EVMState.Chains[sourceChain], destChain, srcUSDC) require.NoError(t, err) - err = changeset.UpdateFeeQuoterForUSDC(lggr, e.Chains[destChain], state.Chains[destChain], sourceChain, destUSDC) + err = changeset.UpdateFeeQuoterForUSDC(lggr, e.Chains[destChain], state.EVMState.Chains[destChain], sourceChain, destUSDC) require.NoError(t, err) changeset.MintAndAllow( @@ -109,7 +109,7 @@ func Test_OutOfOrderExecution(t *testing.T) { startBlocks := make(map[uint64]*uint64) expectedStatuses := make(map[uint64]int) - latesthdr, err := e.Chains[destChain].Client.HeaderByNumber(ctx, nil) + latesthdr, err := e.Chains[destChain].EVMChain.Client.HeaderByNumber(ctx, nil) require.NoError(t, err) block := latesthdr.Number.Uint64() startBlocks[destChain] = &block @@ -170,7 +170,7 @@ func Test_OutOfOrderExecution(t *testing.T) { ) // Out of order programmable token transfer should be executed - fourthReceiver := state.Chains[destChain].Receiver.Address() + fourthReceiver := state.EVMState.Chains[destChain].Receiver.Address() fourthMessage, _ := changeset.Transfer( ctx, t, @@ -212,7 +212,7 @@ func Test_OutOfOrderExecution(t *testing.T) { t, e.Chains[sourceChain], e.Chains[destChain], - state.Chains[destChain].OffRamp, + state.EVMState.Chains[destChain].OffRamp, startBlocks[destChain], ccipocr3.NewSeqNumRange( ccipocr3.SeqNum(firstMessage.SequenceNumber), @@ -238,11 +238,11 @@ func Test_OutOfOrderExecution(t *testing.T) { ) require.Equal(t, expectedStatuses, execStates[identifier]) - secondMsgState, err := state.Chains[destChain].OffRamp.GetExecutionState(&bind.CallOpts{Context: ctx}, sourceChain, secondMsg.SequenceNumber) + secondMsgState, err := state.EVMState.Chains[destChain].OffRamp.GetExecutionState(&bind.CallOpts{Context: ctx}, sourceChain, secondMsg.SequenceNumber) require.NoError(t, err) require.Equal(t, uint8(changeset.EXECUTION_STATE_UNTOUCHED), secondMsgState) - thirdMsgState, err := state.Chains[destChain].OffRamp.GetExecutionState(&bind.CallOpts{Context: ctx}, sourceChain, thirdMessage.SequenceNumber) + thirdMsgState, err := state.EVMState.Chains[destChain].OffRamp.GetExecutionState(&bind.CallOpts{Context: ctx}, sourceChain, thirdMessage.SequenceNumber) require.NoError(t, err) require.Equal(t, uint8(changeset.EXECUTION_STATE_UNTOUCHED), thirdMsgState) @@ -262,7 +262,7 @@ func pickFirstAvailableUser( if user == nil { continue } - if user.From != e.Chains[sourceChain].DeployerKey.From { + if user.From != e.Chains[sourceChain].EVMChain.DeployerKey.From { return user, nil } } diff --git a/integration-tests/smoke/ccip/ccip_rmn_test.go b/integration-tests/smoke/ccip/ccip_rmn_test.go index 6cd6bd9d63f..3150f827e9f 100644 --- a/integration-tests/smoke/ccip/ccip_rmn_test.go +++ b/integration-tests/smoke/ccip/ccip_rmn_test.go @@ -256,7 +256,7 @@ func runRmnTestCase(t *testing.T, tc rmnTestCase) { homeChain, ok := envWithRMN.Env.Chains[envWithRMN.HomeChainSel] require.True(t, ok) - homeChainState, ok := onChainState.Chains[envWithRMN.HomeChainSel] + homeChainState, ok := onChainState.EVMState.Chains[envWithRMN.HomeChainSel] require.True(t, ok) allDigests, err := homeChainState.RMNHome.GetConfigDigests(&bind.CallOpts{Context: ctx}) @@ -269,7 +269,7 @@ func runRmnTestCase(t *testing.T, tc rmnTestCase) { dynamicConfig := rmn_home.RMNHomeDynamicConfig{SourceChains: tc.pf.rmnHomeSourceChains, OffchainConfig: []byte{}} t.Logf("Setting RMNHome candidate with staticConfig: %+v, dynamicConfig: %+v, current candidateDigest: %x", staticConfig, dynamicConfig, allDigests.CandidateConfigDigest[:]) - tx, err := homeChainState.RMNHome.SetCandidate(homeChain.DeployerKey, staticConfig, dynamicConfig, allDigests.CandidateConfigDigest) + tx, err := homeChainState.RMNHome.SetCandidate(homeChain.EVMChain.DeployerKey, staticConfig, dynamicConfig, allDigests.CandidateConfigDigest) require.NoError(t, err) _, err = deployment.ConfirmIfNoError(homeChain, tx, err) @@ -282,7 +282,7 @@ func runRmnTestCase(t *testing.T, tc rmnTestCase) { t.Logf("Promoting RMNHome candidate with candidateDigest: %x", candidateDigest[:]) tx, err = homeChainState.RMNHome.PromoteCandidateAndRevokeActive( - homeChain.DeployerKey, candidateDigest, allDigests.ActiveConfigDigest) + homeChain.EVMChain.DeployerKey, candidateDigest, allDigests.ActiveConfigDigest) require.NoError(t, err) _, err = deployment.ConfirmIfNoError(homeChain, tx, err) @@ -507,7 +507,7 @@ func (tc rmnTestCase) setRmnRemoteConfig( envWithRMN changeset.DeployedEnv) { for _, remoteCfg := range tc.remoteChainsConfig { remoteSel := tc.pf.chainSelectors[remoteCfg.chainIdx] - chState, ok := onChainState.Chains[remoteSel] + chState, ok := onChainState.EVMState.Chains[remoteSel] require.True(t, ok) if remoteCfg.f < 0 { t.Fatalf("negative F: %d", remoteCfg.f) @@ -521,7 +521,7 @@ func (tc rmnTestCase) setRmnRemoteConfig( chain := envWithRMN.Env.Chains[tc.pf.chainSelectors[remoteCfg.chainIdx]] t.Logf("Setting RMNRemote config with RMNHome active digest: %x, cfg: %+v", activeDigest[:], rmnRemoteConfig) - tx2, err2 := chState.RMNRemote.SetConfig(chain.DeployerKey, rmnRemoteConfig) + tx2, err2 := chState.RMNRemote.SetConfig(chain.EVMChain.DeployerKey, rmnRemoteConfig) require.NoError(t, err2) _, err2 = deployment.ConfirmIfNoError(chain, tx2, err2) require.NoError(t, err2) @@ -582,7 +582,7 @@ func (tc rmnTestCase) sendMessages(t *testing.T, onChainState changeset.CCIPOnCh for i := 0; i < msg.count; i++ { msgSentEvent := changeset.TestSendRequest(t, envWithRMN.Env, onChainState, fromChain, toChain, false, router.ClientEVM2AnyMessage{ - Receiver: common.LeftPadBytes(onChainState.Chains[toChain].Receiver.Address().Bytes(), 32), + Receiver: common.LeftPadBytes(onChainState.EVMState.Chains[toChain].Receiver.Address().Bytes(), 32), Data: []byte("hello world"), TokenAmounts: nil, FeeToken: common.HexToAddress("0x0"), @@ -609,7 +609,7 @@ func (tc rmnTestCase) sendMessages(t *testing.T, onChainState changeset.CCIPOnCh func (tc rmnTestCase) callContractsToCurseChains(ctx context.Context, t *testing.T, onChainState changeset.CCIPOnChainState, envWithRMN changeset.DeployedEnv) { for _, remoteCfg := range tc.remoteChainsConfig { remoteSel := tc.pf.chainSelectors[remoteCfg.chainIdx] - chState, ok := onChainState.Chains[remoteSel] + chState, ok := onChainState.EVMState.Chains[remoteSel] require.True(t, ok) chain, ok := envWithRMN.Env.Chains[remoteSel] require.True(t, ok) @@ -625,7 +625,7 @@ func (tc rmnTestCase) callContractsToCurseChains(ctx context.Context, t *testing subj = chainSelectorToBytes16(tc.pf.chainSelectors[subjectDescription]) } t.Logf("cursing subject %d (%d)", subj, subjectDescription) - txCurse, errCurse := chState.RMNRemote.Curse(chain.DeployerKey, subj) + txCurse, errCurse := chState.RMNRemote.Curse(chain.EVMChain.DeployerKey, subj) _, errConfirm := deployment.ConfirmIfNoError(chain, txCurse, errCurse) require.NoError(t, errConfirm) } diff --git a/integration-tests/smoke/ccip/ccip_test.go b/integration-tests/smoke/ccip/ccip_test.go index ca30c9281c4..1ae6f8e76ac 100644 --- a/integration-tests/smoke/ccip/ccip_test.go +++ b/integration-tests/smoke/ccip/ccip_test.go @@ -35,7 +35,7 @@ func TestInitialDeployOnLocal(t *testing.T) { if src == dest { continue } - latesthdr, err := destChain.Client.HeaderByNumber(testcontext.Get(t), nil) + latesthdr, err := destChain.EVMChain.Client.HeaderByNumber(testcontext.Get(t), nil) require.NoError(t, err) block := latesthdr.Number.Uint64() startBlocks[dest] = &block @@ -46,7 +46,7 @@ func TestInitialDeployOnLocal(t *testing.T) { changeset.WithDestChain(dest), changeset.WithTestRouter(false), changeset.WithEvm2AnyMessage(router.ClientEVM2AnyMessage{ - Receiver: common.LeftPadBytes(state.Chains[dest].Receiver.Address().Bytes(), 32), + Receiver: common.LeftPadBytes(state.EVMState.Chains[dest].Receiver.Address().Bytes(), 32), Data: []byte("hello world"), TokenAmounts: nil, FeeToken: common.HexToAddress("0x0"), @@ -69,8 +69,8 @@ func TestInitialDeployOnLocal(t *testing.T) { // After commit is reported on all chains, token prices should be updated in FeeQuoter. for dest := range e.Chains { - linkAddress := state.Chains[dest].LinkToken.Address() - feeQuoter := state.Chains[dest].FeeQuoter + linkAddress := state.EVMState.Chains[dest].LinkToken.Address() + feeQuoter := state.EVMState.Chains[dest].FeeQuoter timestampedPrice, err := feeQuoter.GetTokenPrice(nil, linkAddress) require.NoError(t, err) require.Equal(t, changeset.MockLinkPrice, timestampedPrice.Value) 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 6a193397d7e..29c985b7edd 100644 --- a/integration-tests/smoke/ccip/ccip_token_price_updates_test.go +++ b/integration-tests/smoke/ccip/ccip_token_price_updates_test.go @@ -44,7 +44,7 @@ func Test_CCIPTokenPriceUpdates(t *testing.T) { sourceChain1 := allChainSelectors[0] - feeQuoter1 := state.Chains[sourceChain1].FeeQuoter + feeQuoter1 := state.EVMState.Chains[sourceChain1].FeeQuoter feeTokensChain1, err := feeQuoter1.GetFeeTokens(callOpts) require.NoError(t, err) @@ -80,7 +80,7 @@ func Test_CCIPTokenPriceUpdates(t *testing.T) { assert.Eventually(t, func() bool { // manually update token prices by setting values to maxUint64 and 0 - tx, err := feeQuoter1.UpdatePrices(e.Env.Chains[sourceChain1].DeployerKey, fee_quoter.InternalPriceUpdates{ + tx, err := feeQuoter1.UpdatePrices(e.Env.Chains[sourceChain1].EVMChain.DeployerKey, fee_quoter.InternalPriceUpdates{ TokenPriceUpdates: []fee_quoter.InternalTokenPriceUpdate{ {SourceToken: feeTokensChain1[0], UsdPerToken: big.NewInt(0).SetUint64(math.MaxUint64)}, {SourceToken: feeTokensChain1[1], UsdPerToken: big.NewInt(0)}, diff --git a/integration-tests/smoke/ccip/ccip_token_transfer_test.go b/integration-tests/smoke/ccip/ccip_token_transfer_test.go index 06ee06297ae..b4942be92ef 100644 --- a/integration-tests/smoke/ccip/ccip_token_transfer_test.go +++ b/integration-tests/smoke/ccip/ccip_token_transfer_test.go @@ -41,8 +41,8 @@ func TestTokenTransfer(t *testing.T) { allChainSelectors := maps.Keys(e.Chains) sourceChain, destChain := allChainSelectors[0], allChainSelectors[1] - ownerSourceChain := e.Chains[sourceChain].DeployerKey - ownerDestChain := e.Chains[destChain].DeployerKey + ownerSourceChain := e.Chains[sourceChain].EVMChain.DeployerKey + ownerDestChain := e.Chains[destChain].EVMChain.DeployerKey oneE18 := new(big.Int).SetUint64(1e18) funds := new(big.Int).Mul(oneE18, new(big.Int).SetUint64(10)) @@ -133,7 +133,7 @@ func TestTokenTransfer(t *testing.T) { Amount: oneE18, }, }, - receiver: state.Chains[destChain].Receiver.Address(), + receiver: state.EVMState.Chains[destChain].Receiver.Address(), expectedTokenBalances: map[common.Address]*big.Int{ destToken.Address(): oneE18, }, @@ -157,7 +157,7 @@ func TestTokenTransfer(t *testing.T) { Amount: oneE18, }, }, - receiver: state.Chains[sourceChain].Receiver.Address(), + receiver: state.EVMState.Chains[sourceChain].Receiver.Address(), extraData: changeset.MakeEVMExtraArgsV2(300_000, false), expectedTokenBalances: map[common.Address]*big.Int{ selfServeSrcToken.Address(): new(big.Int).Add(oneE18, oneE18), @@ -201,7 +201,7 @@ func TestTokenTransfer(t *testing.T) { Amount: oneE18, }, }, - receiver: state.Chains[sourceChain].Receiver.Address(), + receiver: state.EVMState.Chains[sourceChain].Receiver.Address(), data: []byte("this should be reverted because gasLimit is too low, no tokens are transferred as well"), extraData: changeset.MakeEVMExtraArgsV2(1, false), expectedTokenBalances: map[common.Address]*big.Int{ @@ -265,10 +265,10 @@ func createAndFundSelfServeActor( actor, err := bind.NewKeyedTransactorWithChainID(key, chainID) require.NoError(t, err) - nonce, err := chain.Client.PendingNonceAt(ctx, deployer.From) + nonce, err := chain.EVMChain.Client.PendingNonceAt(ctx, deployer.From) require.NoError(t, err) - gasPrice, err := chain.Client.SuggestGasPrice(ctx) + gasPrice, err := chain.EVMChain.Client.SuggestGasPrice(ctx) require.NoError(t, err) tx := types.NewTx(&types.LegacyTx{ @@ -283,10 +283,10 @@ func createAndFundSelfServeActor( signedTx, err := deployer.Signer(deployer.From, tx) require.NoError(t, err) - err = chain.Client.SendTransaction(ctx, signedTx) + err = chain.EVMChain.Client.SendTransaction(ctx, signedTx) require.NoError(t, err) - _, err = chain.Confirm(signedTx) + _, err = chain.EVMChain.Confirm(signedTx) require.NoError(t, err) return actor diff --git a/integration-tests/smoke/ccip/ccip_usdc_test.go b/integration-tests/smoke/ccip/ccip_usdc_test.go index d1df2a6da92..3a009d17188 100644 --- a/integration-tests/smoke/ccip/ccip_usdc_test.go +++ b/integration-tests/smoke/ccip/ccip_usdc_test.go @@ -48,9 +48,9 @@ func TestUSDCTokenTransfer(t *testing.T) { chainC := allChainSelectors[1] chainB := allChainSelectors[2] - ownerChainA := e.Chains[chainA].DeployerKey - ownerChainC := e.Chains[chainC].DeployerKey - ownerChainB := e.Chains[chainB].DeployerKey + ownerChainA := e.Chains[chainA].EVMChain.DeployerKey + ownerChainC := e.Chains[chainC].EVMChain.DeployerKey + ownerChainB := e.Chains[chainB].EVMChain.DeployerKey aChainUSDC, cChainUSDC, err := changeset.ConfigureUSDCTokenPools(lggr, e.Chains, chainA, chainC, state) require.NoError(t, err) @@ -166,7 +166,7 @@ func TestUSDCTokenTransfer(t *testing.T) { }, { name: "programmable token transfer to valid contract receiver", - receiver: state.Chains[chainC].Receiver.Address(), + receiver: state.EVMState.Chains[chainC].Receiver.Address(), sourceChain: chainA, destChain: chainC, tokens: []router.ClientEVMTokenAmount{ @@ -233,7 +233,7 @@ func TestUSDCTokenTransfer(t *testing.T) { expectedSeqNum := make(map[changeset.SourceDestPair]uint64) expectedSeqNumExec := make(map[changeset.SourceDestPair][]uint64) - latesthdr, err := e.Chains[chainC].Client.HeaderByNumber(testcontext.Get(t), nil) + latesthdr, err := e.Chains[chainC].EVMChain.Client.HeaderByNumber(testcontext.Get(t), nil) require.NoError(t, err) block := latesthdr.Number.Uint64() startBlocks[chainC] = &block @@ -268,13 +268,13 @@ func updateFeeQuoters( ) error { updateFeeQtrGrp := errgroup.Group{} updateFeeQtrGrp.Go(func() error { - return changeset.UpdateFeeQuoterForUSDC(lggr, e.Chains[chainA], state.Chains[chainA], chainC, aChainUSDC) + return changeset.UpdateFeeQuoterForUSDC(lggr, e.Chains[chainA], state.EVMState.Chains[chainA], chainC, aChainUSDC) }) updateFeeQtrGrp.Go(func() error { - return changeset.UpdateFeeQuoterForUSDC(lggr, e.Chains[chainB], state.Chains[chainB], chainC, bChainUSDC) + return changeset.UpdateFeeQuoterForUSDC(lggr, e.Chains[chainB], state.EVMState.Chains[chainB], chainC, bChainUSDC) }) updateFeeQtrGrp.Go(func() error { - return changeset.UpdateFeeQuoterForUSDC(lggr, e.Chains[chainC], state.Chains[chainC], chainA, cChainUSDC) + return changeset.UpdateFeeQuoterForUSDC(lggr, e.Chains[chainC], state.EVMState.Chains[chainC], chainA, cChainUSDC) }) return updateFeeQtrGrp.Wait() } diff --git a/integration-tests/testsetups/ccip/test_helpers.go b/integration-tests/testsetups/ccip/test_helpers.go index 4d51093d419..d93d3c1753e 100644 --- a/integration-tests/testsetups/ccip/test_helpers.go +++ b/integration-tests/testsetups/ccip/test_helpers.go @@ -163,7 +163,7 @@ func NewLocalDevEnvironment( HomeChainSel: homeChainSel, RMNStaticConfig: changeset.NewTestRMNStaticConfig(), RMNDynamicConfig: changeset.NewTestRMNDynamicConfig(), - NodeOperators: changeset.NewTestNodeOperator(chains[homeChainSel].DeployerKey.From), + NodeOperators: changeset.NewTestNodeOperator(chains[homeChainSel].EVMChain.DeployerKey.From), NodeP2PIDsPerNodeOpAdmin: map[string][][32]byte{ "NodeOperator": envNodes.NonBootstraps().PeerIDs(), }, @@ -208,8 +208,8 @@ func NewLocalDevEnvironment( cctpContracts := make(map[cciptypes.ChainSelector]pluginconfig.USDCCCTPTokenConfig) for _, usdcChain := range usdcChains { cctpContracts[cciptypes.ChainSelector(usdcChain)] = pluginconfig.USDCCCTPTokenConfig{ - SourcePoolAddress: state.Chains[usdcChain].USDCTokenPool.Address().String(), - SourceMessageTransmitterAddr: state.Chains[usdcChain].MockUSDCTransmitter.Address().String(), + SourcePoolAddress: state.EVMState.Chains[usdcChain].USDCTokenPool.Address().String(), + SourceMessageTransmitterAddr: state.EVMState.Chains[usdcChain].MockUSDCTransmitter.Address().String(), } } tokenDataProviders = append(tokenDataProviders, pluginconfig.TokenDataObserverConfig{ @@ -224,12 +224,12 @@ func NewLocalDevEnvironment( } // Build the per chain config. - tokenConfig := changeset.NewTestTokenConfig(state.Chains[feedSel].USDFeeds) + tokenConfig := changeset.NewTestTokenConfig(state.EVMState.Chains[feedSel].USDFeeds) chainConfigs := make(map[uint64]changeset.CCIPOCRParams) timelocksPerChain := make(map[uint64]*gethwrappers.RBACTimelock) for _, chain := range allChains { - timelocksPerChain[chain] = state.Chains[chain].Timelock - tokenInfo := tokenConfig.GetTokenInfo(e.Logger, state.Chains[chain].LinkToken, state.Chains[chain].Weth9) + timelocksPerChain[chain] = state.EVMState.Chains[chain].Timelock + tokenInfo := tokenConfig.GetTokenInfo(e.Logger, state.EVMState.Chains[chain].LinkToken, state.EVMState.Chains[chain].Weth9) ocrParams := changeset.DefaultOCRParams(feedSel, tokenInfo, tokenDataProviders) if tCfg.OCRConfigOverride != nil { ocrParams = tCfg.OCRConfigOverride(ocrParams) @@ -330,7 +330,7 @@ func GenerateTestRMNConfig(t *testing.T, nRMNNodes int, tenv changeset.DeployedE var remoteChains []devenv.RemoteChains var rpcs []devenv.Chain - for chainSel, chain := range state.Chains { + for chainSel, chain := range state.EVMState.Chains { c, _ := chainsel.ChainBySelector(chainSel) rmnName := MustCCIPNameToRMNName(c.Name) chainParams = append(chainParams, devenv.ChainParam{ @@ -360,9 +360,9 @@ func GenerateTestRMNConfig(t *testing.T, nRMNNodes int, tenv changeset.DeployedE }, HomeChain: devenv.HomeChain{ Name: MustCCIPNameToRMNName(hc.Name), - CapabilitiesRegistry: state.Chains[tenv.HomeChainSel].CapabilityRegistry.Address().String(), - CCIPHome: state.Chains[tenv.HomeChainSel].CCIPHome.Address().String(), - RMNHome: state.Chains[tenv.HomeChainSel].RMNHome.Address().String(), + CapabilitiesRegistry: state.EVMState.Chains[tenv.HomeChainSel].CapabilityRegistry.Address().String(), + CCIPHome: state.EVMState.Chains[tenv.HomeChainSel].CCIPHome.Address().String(), + RMNHome: state.EVMState.Chains[tenv.HomeChainSel].RMNHome.Address().String(), }, RemoteChains: remoteChains, ChainParams: chainParams,