diff --git a/deployment/ccip/add_lane_test.go b/deployment/ccip/add_lane_test.go index 4b6f7671349..de47aa8e627 100644 --- a/deployment/ccip/add_lane_test.go +++ b/deployment/ccip/add_lane_test.go @@ -20,7 +20,7 @@ func TestAddLane(t *testing.T) { // We add more chains to the chainlink nodes than the number of chains where CCIP is deployed. e := NewMemoryEnvironmentWithJobs(t, logger.TestLogger(t), 4, 4) // Here we have CR + nodes set up, but no CCIP contracts deployed. - state, err := LoadOnchainState(e.Env, e.Ab) + state, err := LoadOnchainState(e.Env) require.NoError(t, err) selectors := e.Env.AllChainSelectors() @@ -30,24 +30,21 @@ func TestAddLane(t *testing.T) { feeds := state.Chains[e.FeedChainSel].USDFeeds tokenConfig := NewTestTokenConfig(feeds) - feeTokenContracts := make(map[uint64]FeeTokenContracts) - for _, sel := range []uint64{chain1, chain2} { - feeTokenContracts[sel] = e.FeeTokenContracts[sel] - } // Set up CCIP contracts and a DON per chain. - err = DeployCCIPContracts(e.Env, e.Ab, DeployCCIPContractConfig{ - HomeChainSel: e.HomeChainSel, - FeedChainSel: e.FeedChainSel, - TokenConfig: tokenConfig, - MCMSConfig: NewTestMCMSConfig(t, e.Env), - ExistingAddressBook: e.Ab, - ChainsToDeploy: []uint64{chain1, chain2}, - OCRSecrets: deployment.XXXGenerateTestOCRSecrets(), + newAddresses := deployment.NewMemoryAddressBook() + err = DeployCCIPContracts(e.Env, newAddresses, DeployCCIPContractConfig{ + HomeChainSel: e.HomeChainSel, + FeedChainSel: e.FeedChainSel, + TokenConfig: tokenConfig, + MCMSConfig: NewTestMCMSConfig(t, e.Env), + ChainsToDeploy: []uint64{chain1, chain2}, + OCRSecrets: deployment.XXXGenerateTestOCRSecrets(), }) require.NoError(t, err) + require.NoError(t, e.Env.ExistingAddresses.Merge(newAddresses)) // We expect no lanes available on any chain. - state, err = LoadOnchainState(e.Env, e.Ab) + state, err = LoadOnchainState(e.Env) require.NoError(t, err) for _, sel := range []uint64{chain1, chain2} { chain := state.Chains[sel] diff --git a/deployment/ccip/changeset/active_candidate_test.go b/deployment/ccip/changeset/active_candidate_test.go index 28a3e67bc66..19f41aa6820 100644 --- a/deployment/ccip/changeset/active_candidate_test.go +++ b/deployment/ccip/changeset/active_candidate_test.go @@ -10,9 +10,6 @@ import ( cctypes "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/types" - cciptypes "github.com/smartcontractkit/chainlink-ccip/pkg/types/ccipocr3" - "github.com/smartcontractkit/chainlink-ccip/pluginconfig" - "github.com/smartcontractkit/chainlink/deployment" "github.com/stretchr/testify/require" @@ -32,41 +29,25 @@ func TestActiveCandidate(t *testing.T) { tenv := ccdeploy.NewMemoryEnvironment(t, lggr, 3, 5) e := tenv.Env - state, err := ccdeploy.LoadOnchainState(tenv.Env, tenv.Ab) + state, err := ccdeploy.LoadOnchainState(tenv.Env) require.NoError(t, err) require.NotNil(t, state.Chains[tenv.HomeChainSel].LinkToken) feeds := state.Chains[tenv.FeedChainSel].USDFeeds - tokenConfig := ccdeploy.NewTokenConfig() - - tokenConfig.UpsertTokenInfo(ccdeploy.LinkSymbol, - pluginconfig.TokenInfo{ - AggregatorAddress: cciptypes.UnknownEncodedAddress(feeds[ccdeploy.LinkSymbol].Address().String()), - Decimals: ccdeploy.LinkDecimals, - DeviationPPB: cciptypes.NewBigIntFromInt64(1e9), - }, - ) - tokenConfig.UpsertTokenInfo(ccdeploy.WethSymbol, - pluginconfig.TokenInfo{ - AggregatorAddress: cciptypes.UnknownEncodedAddress(feeds[ccdeploy.WethSymbol].Address().String()), - Decimals: ccdeploy.WethDecimals, - DeviationPPB: cciptypes.NewBigIntFromInt64(4e9), - }, - ) + tokenConfig := ccdeploy.NewTestTokenConfig(feeds) output, err := InitialDeploy(tenv.Env, ccdeploy.DeployCCIPContractConfig{ - HomeChainSel: tenv.HomeChainSel, - FeedChainSel: tenv.FeedChainSel, - ChainsToDeploy: tenv.Env.AllChainSelectors(), - TokenConfig: tokenConfig, - MCMSConfig: ccdeploy.NewTestMCMSConfig(t, e), - ExistingAddressBook: tenv.Ab, - OCRSecrets: deployment.XXXGenerateTestOCRSecrets(), + HomeChainSel: tenv.HomeChainSel, + FeedChainSel: tenv.FeedChainSel, + ChainsToDeploy: tenv.Env.AllChainSelectors(), + TokenConfig: tokenConfig, + MCMSConfig: ccdeploy.NewTestMCMSConfig(t, e), + OCRSecrets: deployment.XXXGenerateTestOCRSecrets(), }) require.NoError(t, err) // Get new state after migration. - require.NoError(t, tenv.Ab.Merge(output.AddressBook)) - state, err = ccdeploy.LoadOnchainState(e, tenv.Ab) + require.NoError(t, tenv.Env.ExistingAddresses.Merge(output.AddressBook)) + state, err = ccdeploy.LoadOnchainState(tenv.Env) require.NoError(t, err) homeCS, destCS := tenv.HomeChainSel, tenv.FeedChainSel @@ -143,7 +124,7 @@ func TestActiveCandidate(t *testing.T) { require.Equal(t, 5, len(donInfo.NodeP2PIds)) require.Equal(t, uint32(4), donInfo.ConfigCount) - state, err = ccdeploy.LoadOnchainState(e, tenv.Ab) + state, err = ccdeploy.LoadOnchainState(e) require.NoError(t, err) // delete a non-bootstrap node diff --git a/deployment/ccip/changeset/add_chain_test.go b/deployment/ccip/changeset/add_chain_test.go index 16dec2d6ce4..69320bd4dac 100644 --- a/deployment/ccip/changeset/add_chain_test.go +++ b/deployment/ccip/changeset/add_chain_test.go @@ -29,7 +29,7 @@ import ( func TestAddChainInbound(t *testing.T) { // 4 chains where the 4th is added after initial deployment. e := ccipdeployment.NewMemoryEnvironmentWithJobs(t, logger.TestLogger(t), 4, 4) - state, err := ccipdeployment.LoadOnchainState(e.Env, e.Ab) + state, err := ccipdeployment.LoadOnchainState(e.Env) require.NoError(t, err) // Take first non-home chain as the new chain. newChain := e.Env.AllChainSelectorsExcluding([]uint64{e.HomeChainSel})[0] @@ -37,17 +37,18 @@ func TestAddChainInbound(t *testing.T) { initialDeploy := e.Env.AllChainSelectorsExcluding([]uint64{newChain}) tokenConfig := ccipdeployment.NewTestTokenConfig(state.Chains[e.FeedChainSel].USDFeeds) - err = ccipdeployment.DeployCCIPContracts(e.Env, e.Ab, ccipdeployment.DeployCCIPContractConfig{ - HomeChainSel: e.HomeChainSel, - FeedChainSel: e.FeedChainSel, - ChainsToDeploy: initialDeploy, - TokenConfig: tokenConfig, - MCMSConfig: ccipdeployment.NewTestMCMSConfig(t, e.Env), - ExistingAddressBook: e.Ab, - OCRSecrets: deployment.XXXGenerateTestOCRSecrets(), + newAddresses := deployment.NewMemoryAddressBook() + err = ccipdeployment.DeployCCIPContracts(e.Env, newAddresses, ccipdeployment.DeployCCIPContractConfig{ + HomeChainSel: e.HomeChainSel, + FeedChainSel: e.FeedChainSel, + ChainsToDeploy: initialDeploy, + TokenConfig: tokenConfig, + MCMSConfig: ccipdeployment.NewTestMCMSConfig(t, e.Env), + OCRSecrets: deployment.XXXGenerateTestOCRSecrets(), }) require.NoError(t, err) - state, err = ccipdeployment.LoadOnchainState(e.Env, e.Ab) + require.NoError(t, e.Env.ExistingAddresses.Merge(newAddresses)) + state, err = ccipdeployment.LoadOnchainState(e.Env) require.NoError(t, err) // Connect all the existing lanes. @@ -59,16 +60,23 @@ func TestAddChainInbound(t *testing.T) { } } - rmnHomeAddress, err := deployment.SearchAddressBook(e.Ab, e.HomeChainSel, ccipdeployment.RMNHome) + rmnHomeAddress, err := deployment.SearchAddressBook(e.Env.ExistingAddresses, e.HomeChainSel, ccipdeployment.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) require.NoError(t, err) // Deploy contracts to new chain - err = ccipdeployment.DeployChainContracts(e.Env, e.Env.Chains[newChain], e.Ab, e.FeeTokenContracts[newChain], ccipdeployment.NewTestMCMSConfig(t, e.Env), rmnHome) + newChainAddresses := deployment.NewMemoryAddressBook() + err = ccipdeployment.DeployChainContracts(e.Env, + e.Env.Chains[newChain], newChainAddresses, + ccipdeployment.FeeTokenContracts{ + LinkToken: state.Chains[newChain].LinkToken, + Weth9: state.Chains[newChain].Weth9, + }, ccipdeployment.NewTestMCMSConfig(t, e.Env), rmnHome) require.NoError(t, err) - state, err = ccipdeployment.LoadOnchainState(e.Env, e.Ab) + require.NoError(t, e.Env.ExistingAddresses.Merge(newChainAddresses)) + state, err = ccipdeployment.LoadOnchainState(e.Env) require.NoError(t, err) // Transfer onramp/fq ownership to timelock. @@ -187,7 +195,7 @@ func TestAddChainInbound(t *testing.T) { require.NoError(t, err) // Assert the inbound lanes to the new chain are wired correctly. - state, err = ccipdeployment.LoadOnchainState(e.Env, e.Ab) + state, err = ccipdeployment.LoadOnchainState(e.Env) require.NoError(t, err) for _, chain := range initialDeploy { cfg, err2 := state.Chains[chain].OnRamp.GetDestChainConfig(nil, newChain) diff --git a/deployment/ccip/changeset/initial_deploy.go b/deployment/ccip/changeset/initial_deploy.go index 23f517877b5..f9d7caf44a3 100644 --- a/deployment/ccip/changeset/initial_deploy.go +++ b/deployment/ccip/changeset/initial_deploy.go @@ -15,19 +15,19 @@ func InitialDeploy(env deployment.Environment, config interface{}) (deployment.C if !ok { return deployment.ChangesetOutput{}, deployment.ErrInvalidConfig } - ab := deployment.NewMemoryAddressBook() - err := ccipdeployment.DeployCCIPContracts(env, ab, c) + newAddresses := deployment.NewMemoryAddressBook() + err := ccipdeployment.DeployCCIPContracts(env, newAddresses, c) if err != nil { - env.Logger.Errorw("Failed to deploy CCIP contracts", "err", err, "addresses", ab) - return deployment.ChangesetOutput{AddressBook: ab}, deployment.MaybeDataErr(err) + env.Logger.Errorw("Failed to deploy CCIP contracts", "err", err, "newAddresses", newAddresses) + return deployment.ChangesetOutput{AddressBook: newAddresses}, deployment.MaybeDataErr(err) } js, err := ccipdeployment.NewCCIPJobSpecs(env.NodeIDs, env.Offchain) if err != nil { - return deployment.ChangesetOutput{AddressBook: ab}, err + return deployment.ChangesetOutput{AddressBook: newAddresses}, err } return deployment.ChangesetOutput{ Proposals: []timelock.MCMSWithTimelockProposal{}, - AddressBook: ab, + AddressBook: newAddresses, // Mapping of which nodes get which jobs. JobSpecs: js, }, nil diff --git a/deployment/ccip/changeset/initial_deploy_test.go b/deployment/ccip/changeset/initial_deploy_test.go index b220508b99e..65b6bf51e62 100644 --- a/deployment/ccip/changeset/initial_deploy_test.go +++ b/deployment/ccip/changeset/initial_deploy_test.go @@ -22,23 +22,22 @@ func TestInitialDeploy(t *testing.T) { tenv := ccdeploy.NewMemoryEnvironment(t, lggr, 3, 4) e := tenv.Env - state, err := ccdeploy.LoadOnchainState(tenv.Env, tenv.Ab) + state, err := ccdeploy.LoadOnchainState(tenv.Env) require.NoError(t, err) require.NotNil(t, state.Chains[tenv.HomeChainSel].LinkToken) output, err := InitialDeploy(tenv.Env, ccdeploy.DeployCCIPContractConfig{ - HomeChainSel: tenv.HomeChainSel, - FeedChainSel: tenv.FeedChainSel, - ChainsToDeploy: tenv.Env.AllChainSelectors(), - TokenConfig: ccdeploy.NewTestTokenConfig(state.Chains[tenv.FeedChainSel].USDFeeds), - MCMSConfig: ccdeploy.NewTestMCMSConfig(t, e), - ExistingAddressBook: tenv.Ab, - OCRSecrets: deployment.XXXGenerateTestOCRSecrets(), + HomeChainSel: tenv.HomeChainSel, + FeedChainSel: tenv.FeedChainSel, + ChainsToDeploy: tenv.Env.AllChainSelectors(), + TokenConfig: ccdeploy.NewTestTokenConfig(state.Chains[tenv.FeedChainSel].USDFeeds), + MCMSConfig: ccdeploy.NewTestMCMSConfig(t, e), + OCRSecrets: deployment.XXXGenerateTestOCRSecrets(), }) require.NoError(t, err) // Get new state after migration. - require.NoError(t, tenv.Ab.Merge(output.AddressBook)) - state, err = ccdeploy.LoadOnchainState(e, tenv.Ab) + require.NoError(t, tenv.Env.ExistingAddresses.Merge(output.AddressBook)) + state, err = ccdeploy.LoadOnchainState(e) require.NoError(t, err) // Ensure capreg logs are up to date. diff --git a/deployment/ccip/changeset/view.go b/deployment/ccip/changeset/view.go index 4524d2f7fd0..9d3eb8260c7 100644 --- a/deployment/ccip/changeset/view.go +++ b/deployment/ccip/changeset/view.go @@ -11,8 +11,8 @@ import ( var _ deployment.ViewState = ViewCCIP -func ViewCCIP(e deployment.Environment, ab deployment.AddressBook) (json.Marshaler, error) { - state, err := ccipdeployment.LoadOnchainState(e, ab) +func ViewCCIP(e deployment.Environment) (json.Marshaler, error) { + state, err := ccipdeployment.LoadOnchainState(e) if err != nil { return nil, err } diff --git a/deployment/ccip/deploy.go b/deployment/ccip/deploy.go index c3952c22156..a0c61cd5f96 100644 --- a/deployment/ccip/deploy.go +++ b/deployment/ccip/deploy.go @@ -118,11 +118,10 @@ func deployContract[C Contracts]( } type DeployCCIPContractConfig struct { - HomeChainSel uint64 - FeedChainSel uint64 - ChainsToDeploy []uint64 - TokenConfig TokenConfig - ExistingAddressBook deployment.AddressBook + HomeChainSel uint64 + FeedChainSel uint64 + ChainsToDeploy []uint64 + TokenConfig TokenConfig // I believe it makes sense to have the same signers across all chains // since that's the point MCMS. MCMSConfig MCMSConfig @@ -148,7 +147,7 @@ func DeployCCIPContracts(e deployment.Environment, ab deployment.AddressBook, c e.Logger.Errorw("Failed to get node info", "err", err) return err } - existingState, err := LoadOnchainState(e, c.ExistingAddressBook) + existingState, err := LoadOnchainState(e) if err != nil { e.Logger.Errorw("Failed to load existing onchain state", "err") return err @@ -364,16 +363,14 @@ func DeployMCMSContracts( }, nil } -func DeployFeeTokensToChains(lggr logger.Logger, ab deployment.AddressBook, chains map[uint64]deployment.Chain) (map[uint64]FeeTokenContracts, error) { - feeTokenContractsByChain := make(map[uint64]FeeTokenContracts) +func DeployFeeTokensToChains(lggr logger.Logger, ab deployment.AddressBook, chains map[uint64]deployment.Chain) error { for _, chain := range chains { - feeTokenContracts, err := DeployFeeTokens(lggr, chain, ab) + _, err := DeployFeeTokens(lggr, chain, ab) if err != nil { - return nil, err + return err } - feeTokenContractsByChain[chain.Selector] = feeTokenContracts } - return feeTokenContractsByChain, nil + return nil } // DeployFeeTokens deploys link and weth9. This is _usually_ for test environments only, diff --git a/deployment/ccip/deploy_test.go b/deployment/ccip/deploy_test.go index 40b4a2a9786..ecb17017193 100644 --- a/deployment/ccip/deploy_test.go +++ b/deployment/ccip/deploy_test.go @@ -22,28 +22,28 @@ func TestDeployCCIPContracts(t *testing.T) { Nodes: 4, }) // Deploy all the CCIP contracts. - ab := deployment.NewMemoryAddressBook() homeChainSel, feedChainSel := allocateCCIPChainSelectors(e.Chains) - _, _ = DeployTestContracts(t, lggr, ab, homeChainSel, feedChainSel, e.Chains) + _ = DeployTestContracts(t, lggr, e.ExistingAddresses, homeChainSel, feedChainSel, e.Chains) // Load the state after deploying the cap reg and feeds. - s, err := LoadOnchainState(e, ab) + s, err := LoadOnchainState(e) require.NoError(t, err) require.NotNil(t, s.Chains[homeChainSel].CapabilityRegistry) require.NotNil(t, s.Chains[homeChainSel].CCIPHome) require.NotNil(t, s.Chains[feedChainSel].USDFeeds) - err = DeployCCIPContracts(e, ab, DeployCCIPContractConfig{ - HomeChainSel: homeChainSel, - FeedChainSel: feedChainSel, - ChainsToDeploy: e.AllChainSelectors(), - TokenConfig: NewTokenConfig(), - ExistingAddressBook: ab, - MCMSConfig: NewTestMCMSConfig(t, e), - OCRSecrets: deployment.XXXGenerateTestOCRSecrets(), + newAddresses := deployment.NewMemoryAddressBook() + err = DeployCCIPContracts(e, newAddresses, DeployCCIPContractConfig{ + HomeChainSel: homeChainSel, + FeedChainSel: feedChainSel, + ChainsToDeploy: e.AllChainSelectors(), + TokenConfig: NewTokenConfig(), + MCMSConfig: NewTestMCMSConfig(t, e), + OCRSecrets: deployment.XXXGenerateTestOCRSecrets(), }) require.NoError(t, err) - state, err := LoadOnchainState(e, ab) + require.NoError(t, e.ExistingAddresses.Merge(newAddresses)) + state, err := LoadOnchainState(e) require.NoError(t, err) snap, err := state.View(e.AllChainSelectors()) require.NoError(t, err) diff --git a/deployment/ccip/state.go b/deployment/ccip/state.go index 22cc5cec9c1..fa299d2260f 100644 --- a/deployment/ccip/state.go +++ b/deployment/ccip/state.go @@ -201,12 +201,12 @@ func (s CCIPOnChainState) View(chains []uint64) (map[string]view.ChainView, erro return m, nil } -func LoadOnchainState(e deployment.Environment, ab deployment.AddressBook) (CCIPOnChainState, error) { +func LoadOnchainState(e deployment.Environment) (CCIPOnChainState, error) { state := CCIPOnChainState{ Chains: make(map[uint64]CCIPChainState), } for chainSelector, chain := range e.Chains { - addresses, err := ab.AddressesForChain(chainSelector) + addresses, err := e.ExistingAddresses.AddressesForChain(chainSelector) if err != nil { // Chain not found in address book, initialize empty if errors.Is(err, deployment.ErrChainNotFound) { diff --git a/deployment/ccip/test_helpers.go b/deployment/ccip/test_helpers.go index 84fd92bc626..55bbbcf91cb 100644 --- a/deployment/ccip/test_helpers.go +++ b/deployment/ccip/test_helpers.go @@ -61,12 +61,10 @@ func Context(tb testing.TB) context.Context { } type DeployedEnv struct { - Env deployment.Environment - Ab deployment.AddressBook - HomeChainSel uint64 - FeedChainSel uint64 - ReplayBlocks map[uint64]uint64 - FeeTokenContracts map[uint64]FeeTokenContracts + Env deployment.Environment + HomeChainSel uint64 + FeedChainSel uint64 + ReplayBlocks map[uint64]uint64 } func (e *DeployedEnv) SetupJobs(t *testing.T) { @@ -107,16 +105,16 @@ func DeployTestContracts(t *testing.T, homeChainSel, feedChainSel uint64, chains map[uint64]deployment.Chain, -) (map[uint64]FeeTokenContracts, deployment.CapabilityRegistryConfig) { +) deployment.CapabilityRegistryConfig { capReg, err := DeployCapReg(lggr, ab, chains[homeChainSel]) require.NoError(t, err) _, err = DeployFeeds(lggr, ab, chains[feedChainSel]) require.NoError(t, err) - feeTokenContracts, err := DeployFeeTokensToChains(lggr, ab, chains) + err = DeployFeeTokensToChains(lggr, ab, chains) require.NoError(t, err) evmChainID, err := chainsel.ChainIdFromSelector(homeChainSel) require.NoError(t, err) - return feeTokenContracts, deployment.CapabilityRegistryConfig{ + return deployment.CapabilityRegistryConfig{ EVMChainID: evmChainID, Contract: capReg.Address, } @@ -161,7 +159,7 @@ func NewMemoryEnvironment(t *testing.T, lggr logger.Logger, numChains int, numNo require.NoError(t, err) ab := deployment.NewMemoryAddressBook() - feeTokenContracts, crConfig := DeployTestContracts(t, lggr, ab, homeChainSel, feedSel, chains) + crConfig := DeployTestContracts(t, lggr, ab, homeChainSel, feedSel, chains) nodes := memory.NewNodes(t, zapcore.InfoLevel, chains, numNodes, 1, crConfig) for _, node := range nodes { require.NoError(t, node.App.Start(ctx)) @@ -171,13 +169,12 @@ func NewMemoryEnvironment(t *testing.T, lggr logger.Logger, numChains int, numNo } e := memory.NewMemoryEnvironmentFromChainsNodes(t, lggr, chains, nodes) + e.ExistingAddresses = ab return DeployedEnv{ - Ab: ab, - Env: e, - HomeChainSel: homeChainSel, - FeedChainSel: feedSel, - ReplayBlocks: replayBlocks, - FeeTokenContracts: feeTokenContracts, + Env: e, + HomeChainSel: homeChainSel, + FeedChainSel: feedSel, + ReplayBlocks: replayBlocks, } } diff --git a/deployment/ccip/view/view.go b/deployment/ccip/view/view.go index 1882e040a65..3fb2591573b 100644 --- a/deployment/ccip/view/view.go +++ b/deployment/ccip/view/view.go @@ -53,5 +53,7 @@ type CCIPView struct { } func (v CCIPView) MarshalJSON() ([]byte, error) { - return json.Marshal(v) + // Alias to avoid recursive calls + type Alias CCIPView + return json.MarshalIndent(&struct{ Alias }{Alias: Alias(v)}, "", " ") } diff --git a/deployment/changeset.go b/deployment/changeset.go index 308ce60f7a9..687d772bf73 100644 --- a/deployment/changeset.go +++ b/deployment/changeset.go @@ -21,13 +21,15 @@ var ( type ChangeSet func(e Environment, config interface{}) (ChangesetOutput, error) // ChangesetOutput is the output of a Changeset function. +// Think of it like a state transition output. +// The address book here should contain only new addresses created in +// this changeset. type ChangesetOutput struct { - JobSpecs map[string][]string - Proposals []timelock.MCMSWithTimelockProposal - // The address book here should contain only new addresses created in this changeset. + JobSpecs map[string][]string + Proposals []timelock.MCMSWithTimelockProposal AddressBook AddressBook } // ViewState produces a product specific JSON representation of // the on and offchain state of the environment. -type ViewState func(e Environment, ab AddressBook) (json.Marshaler, error) +type ViewState func(e Environment) (json.Marshaler, error) diff --git a/deployment/environment.go b/deployment/environment.go index 99c15233dfa..a975042dee2 100644 --- a/deployment/environment.go +++ b/deployment/environment.go @@ -27,22 +27,26 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/p2pkey" ) +// OnchainClient is an EVM chain client. +// For EVM specifically we can use existing geth interface +// to abstract chain clients. type OnchainClient interface { - // For EVM specifically we can use existing geth interface - // to abstract chain clients. bind.ContractBackend bind.DeployBackend BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error) } +// OffchainClient interacts with the job-distributor +// which is a family agnostic interface for performing +// DON operations. type OffchainClient interface { - // The job distributor grpc interface can be used to abstract offchain read/writes jobv1.JobServiceClient nodev1.NodeServiceClient csav1.CSAServiceClient } +// Chain represents an EVM chain. type Chain struct { // Selectors used as canonical chain identifier. Selector uint64 @@ -52,12 +56,44 @@ type Chain struct { Confirm func(tx *types.Transaction) (uint64, error) } +// 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 +// to all its chains. +// TODO: Add SolChains, AptosChain etc. +// using Go bindings/libraries from their respective +// repositories i.e. chainlink-solana, chainlink-cosmos +// You can think of ExistingAddresses as a set of +// family agnostic "onchain pointers" meant to be used in conjunction +// with chain fields to read/write relevant chain state. Similarly, +// you can think of NodeIDs as "offchain pointers" to be used in +// conjunction with the Offchain client to read/write relevant +// offchain state (i.e. state in the DON(s)). type Environment struct { - Name string - Chains map[uint64]Chain - Offchain OffchainClient - NodeIDs []string - Logger logger.Logger + Name string + Logger logger.Logger + ExistingAddresses AddressBook + Chains map[uint64]Chain + NodeIDs []string + Offchain OffchainClient +} + +func NewEnvironment( + name string, + logger logger.Logger, + existingAddrs AddressBook, + chains map[uint64]Chain, + nodeIDs []string, + offchain OffchainClient, +) *Environment { + return &Environment{ + Name: name, + Logger: logger, + ExistingAddresses: existingAddrs, + Chains: chains, + NodeIDs: nodeIDs, + Offchain: offchain, + } } func (e Environment) AllChainSelectors() []uint64 { diff --git a/deployment/environment/clo/env.go b/deployment/environment/clo/env.go index 201917d61aa..d1683ad4e1e 100644 --- a/deployment/environment/clo/env.go +++ b/deployment/environment/clo/env.go @@ -30,13 +30,14 @@ func NewDonEnv(t *testing.T, cfg DonEnvConfig) *deployment.Environment { } } } - out := deployment.Environment{ - Name: cfg.DonName, - Offchain: NewJobClient(cfg.Logger, cfg.Nops), - NodeIDs: make([]string, 0), - Chains: cfg.Chains, - Logger: cfg.Logger, - } + out := deployment.NewEnvironment( + cfg.DonName, + cfg.Logger, + deployment.NewMemoryAddressBook(), + cfg.Chains, + make([]string, 0), + NewJobClient(cfg.Logger, cfg.Nops), + ) // assume that all the nodes in the provided input nops are part of the don for _, nop := range cfg.Nops { for _, node := range nop.Nodes { @@ -44,7 +45,7 @@ func NewDonEnv(t *testing.T, cfg DonEnvConfig) *deployment.Environment { } } - return &out + return out } func NewDonEnvWithMemoryChains(t *testing.T, cfg DonEnvConfig, ignore func(*models.NodeChainConfig) bool) *deployment.Environment { @@ -87,18 +88,18 @@ type MultiDonEnvironment struct { } func (mde MultiDonEnvironment) Flatten(name string) *deployment.Environment { - return &deployment.Environment{ - Name: name, - Chains: mde.Chains, - Logger: mde.Logger, - - // TODO: KS-460 integrate with the clo offchain client impl - // may need to extend the Environment abstraction use maps rather than slices for Nodes - // somehow we need to capture the fact that each nodes belong to nodesets which have different capabilities - // purposely nil to catch misuse until we do that work - Offchain: nil, - NodeIDs: nil, - } + // TODO: KS-460 integrate with the clo offchain client impl + // may need to extend the Environment abstraction use maps rather than slices for Nodes + // somehow we need to capture the fact that each nodes belong to nodesets which have different capabilities + // purposely nil to catch misuse until we do that work + return deployment.NewEnvironment( + name, + mde.Logger, + deployment.NewMemoryAddressBook(), + mde.Chains, + nil, + nil, + ) } func newMultiDonEnvironment(logger logger.Logger, donToEnv map[string]*deployment.Environment) *MultiDonEnvironment { diff --git a/deployment/environment/devenv/environment.go b/deployment/environment/devenv/environment.go index fb54bac5b59..af39e59e3bf 100644 --- a/deployment/environment/devenv/environment.go +++ b/deployment/environment/devenv/environment.go @@ -44,11 +44,12 @@ func NewEnvironment(ctx context.Context, lggr logger.Logger, config EnvironmentC } nodeIDs := jd.don.NodeIds() - return &deployment.Environment{ - Name: DevEnv, - Offchain: offChain, - NodeIDs: nodeIDs, - Chains: chains, - Logger: lggr, - }, jd.don, nil + return deployment.NewEnvironment( + DevEnv, + lggr, + deployment.NewMemoryAddressBook(), + chains, + nodeIDs, + offChain, + ), jd.don, nil } diff --git a/deployment/environment/memory/environment.go b/deployment/environment/memory/environment.go index 79fe4d18838..22733571038 100644 --- a/deployment/environment/memory/environment.go +++ b/deployment/environment/memory/environment.go @@ -116,14 +116,14 @@ func NewMemoryEnvironmentFromChainsNodes(t *testing.T, for id := range nodes { nodeIDs = append(nodeIDs, id) } - return deployment.Environment{ - Name: Memory, - Offchain: NewMemoryJobClient(nodes), - // Note these have the p2p_ prefix. - NodeIDs: nodeIDs, - Chains: chains, - Logger: lggr, - } + return *deployment.NewEnvironment( + Memory, + lggr, + deployment.NewMemoryAddressBook(), + chains, + nodeIDs, // Note these have the p2p_ prefix. + NewMemoryJobClient(nodes), + ) } // To be used by tests and any kind of deployment logic. @@ -134,11 +134,12 @@ func NewMemoryEnvironment(t *testing.T, lggr logger.Logger, logLevel zapcore.Lev for id := range nodes { nodeIDs = append(nodeIDs, id) } - return deployment.Environment{ - Name: Memory, - Offchain: NewMemoryJobClient(nodes), - NodeIDs: nodeIDs, - Chains: chains, - Logger: lggr, - } + return *deployment.NewEnvironment( + Memory, + lggr, + deployment.NewMemoryAddressBook(), + chains, + nodeIDs, + NewMemoryJobClient(nodes), + ) } diff --git a/deployment/environment/memory/job_client.go b/deployment/environment/memory/job_client.go index 0bd4035c78d..d572f5f92f5 100644 --- a/deployment/environment/memory/job_client.go +++ b/deployment/environment/memory/job_client.go @@ -55,8 +55,18 @@ func (j JobClient) ListKeypairs(ctx context.Context, in *csav1.ListKeypairsReque } func (j JobClient) GetNode(ctx context.Context, in *nodev1.GetNodeRequest, opts ...grpc.CallOption) (*nodev1.GetNodeResponse, error) { - //TODO CCIP-3108 implement me - panic("implement me") + n, ok := j.Nodes[in.Id] + if !ok { + return nil, errors.New("node not found") + } + return &nodev1.GetNodeResponse{ + Node: &nodev1.Node{ + Id: in.Id, + PublicKey: n.Keys.OCRKeyBundle.ID(), // is this the correct val? + IsEnabled: true, + IsConnected: true, + }, + }, nil } func (j JobClient) ListNodes(ctx context.Context, in *nodev1.ListNodesRequest, opts ...grpc.CallOption) (*nodev1.ListNodesResponse, error) { diff --git a/deployment/keystone/changeset/configure_contracts.go b/deployment/keystone/changeset/configure_contracts.go index 885b87189cd..d5bcb32243b 100644 --- a/deployment/keystone/changeset/configure_contracts.go +++ b/deployment/keystone/changeset/configure_contracts.go @@ -14,7 +14,7 @@ func ConfigureInitialContracts(lggr logger.Logger, req *kslib.ConfigureContracts return deployment.ChangesetOutput{}, fmt.Errorf("failed to validate request: %w", err) } - regAddrs, err := req.AddressBook.AddressesForChain(req.RegistryChainSel) + regAddrs, err := req.Env.ExistingAddresses.AddressesForChain(req.RegistryChainSel) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("no addresses found for chain %d: %w", req.RegistryChainSel, err) } @@ -38,7 +38,7 @@ func ConfigureInitialContracts(lggr logger.Logger, req *kslib.ConfigureContracts // forwarder on all chains foundForwarder = false for _, c := range req.Env.Chains { - addrs, err2 := req.AddressBook.AddressesForChain(c.Selector) + addrs, err2 := req.Env.ExistingAddresses.AddressesForChain(c.Selector) if err2 != nil { return deployment.ChangesetOutput{}, fmt.Errorf("no addresses found for chain %d: %w", c.Selector, err2) } diff --git a/deployment/keystone/changeset/deploy_forwarder.go b/deployment/keystone/changeset/deploy_forwarder.go index 4646412db83..d6adbee0252 100644 --- a/deployment/keystone/changeset/deploy_forwarder.go +++ b/deployment/keystone/changeset/deploy_forwarder.go @@ -9,24 +9,19 @@ import ( var _ deployment.ChangeSet = DeployForwarder -type DeployRegistryConfig struct { - RegistryChainSelector uint64 - ExistingAddressBook deployment.AddressBook -} - func DeployForwarder(env deployment.Environment, config interface{}) (deployment.ChangesetOutput, error) { - c, ok := config.(DeployRegistryConfig) + registryChainSel, ok := config.(uint64) if !ok { return deployment.ChangesetOutput{}, deployment.ErrInvalidConfig } lggr := env.Logger // expect OCR3 to be deployed & capabilities registry - regAddrs, err := c.ExistingAddressBook.AddressesForChain(c.RegistryChainSelector) + regAddrs, err := env.ExistingAddresses.AddressesForChain(registryChainSel) if err != nil { - return deployment.ChangesetOutput{}, fmt.Errorf("no addresses found for chain %d: %w", c.RegistryChainSelector, err) + return deployment.ChangesetOutput{}, fmt.Errorf("no addresses found for chain %d: %w", registryChainSel, err) } if len(regAddrs) != 2 { - return deployment.ChangesetOutput{}, fmt.Errorf("expected 2 addresses for chain %d, got %d", c.RegistryChainSelector, len(regAddrs)) + return deployment.ChangesetOutput{}, fmt.Errorf("expected 2 addresses for chain %d, got %d", registryChainSel, len(regAddrs)) } ab := deployment.NewMemoryAddressBook() for _, chain := range env.Chains { diff --git a/deployment/keystone/changeset/deploy_forwarder_test.go b/deployment/keystone/changeset/deploy_forwarder_test.go index 62e946b8a7b..8d73134fc1d 100644 --- a/deployment/keystone/changeset/deploy_forwarder_test.go +++ b/deployment/keystone/changeset/deploy_forwarder_test.go @@ -35,12 +35,9 @@ func TestDeployForwarder(t *testing.T) { m[registrySel] = map[string]deployment.TypeAndVersion{ "0x0000000000000000000000000000000000000002": ocrTV, } - ab := deployment.NewMemoryAddressBookFromMap(m) + env.ExistingAddresses = deployment.NewMemoryAddressBookFromMap(m) // capabilities registry and ocr3 must be deployed on registry chain - _, err := changeset.DeployForwarder(env, changeset.DeployRegistryConfig{ - RegistryChainSelector: registrySel, - ExistingAddressBook: ab, - }) + _, err := changeset.DeployForwarder(env, registrySel) require.Error(t, err) }) @@ -49,12 +46,9 @@ func TestDeployForwarder(t *testing.T) { m[registrySel] = map[string]deployment.TypeAndVersion{ "0x0000000000000000000000000000000000000001": crTV, } - ab := deployment.NewMemoryAddressBookFromMap(m) + env.ExistingAddresses = deployment.NewMemoryAddressBookFromMap(m) // capabilities registry and ocr3 must be deployed on registry chain - _, err := changeset.DeployForwarder(env, changeset.DeployRegistryConfig{ - RegistryChainSelector: registrySel, - ExistingAddressBook: ab, - }) + _, err := changeset.DeployForwarder(env, registrySel) require.Error(t, err) }) @@ -68,10 +62,8 @@ func TestDeployForwarder(t *testing.T) { err = ab.Save(registrySel, "0x0000000000000000000000000000000000000002", ocrTV) require.NoError(t, err) // deploy forwarder - resp, err := changeset.DeployForwarder(env, changeset.DeployRegistryConfig{ - RegistryChainSelector: registrySel, - ExistingAddressBook: ab, - }) + env.ExistingAddresses = ab + resp, err := changeset.DeployForwarder(env, registrySel) require.NoError(t, err) require.NotNil(t, resp) // registry, ocr3, forwarder should be deployed on registry chain diff --git a/deployment/keystone/changeset/view.go b/deployment/keystone/changeset/view.go index 684fcd7fc62..3f8d3c256f5 100644 --- a/deployment/keystone/changeset/view.go +++ b/deployment/keystone/changeset/view.go @@ -13,10 +13,10 @@ import ( var _ deployment.ViewState = ViewKeystone -func ViewKeystone(e deployment.Environment, ab deployment.AddressBook) (json.Marshaler, error) { +func ViewKeystone(e deployment.Environment) (json.Marshaler, error) { state, err := keystone.GetContractSets(&keystone.GetContractSetsRequest{ Chains: e.Chains, - AddressBook: ab, + AddressBook: e.ExistingAddresses, }) if err != nil { return nil, err @@ -42,7 +42,7 @@ func ViewKeystone(e deployment.Environment, ab deployment.AddressBook) (json.Mar if err != nil { return nil, err } - return view.KeystoneView{ + return &view.KeystoneView{ Chains: chainViews, Nops: nopsView, }, nil diff --git a/deployment/keystone/changeset/view_test.go b/deployment/keystone/changeset/view_test.go new file mode 100644 index 00000000000..2d4569dfbec --- /dev/null +++ b/deployment/keystone/changeset/view_test.go @@ -0,0 +1,39 @@ +package changeset + +import ( + "testing" + + "github.com/stretchr/testify/require" + "go.uber.org/zap/zapcore" + + "github.com/smartcontractkit/chainlink-common/pkg/logger" + "github.com/smartcontractkit/chainlink/deployment/environment/memory" +) + +func TestKeystoneView(t *testing.T) { + t.Parallel() + env := memory.NewMemoryEnvironment(t, logger.Test(t), zapcore.DebugLevel, memory.MemoryEnvironmentConfig{ + Nodes: 1, + Chains: 2, + }) + registryChain := env.AllChainSelectors()[0] + resp, err := DeployCapabilityRegistry(env, registryChain) + require.NoError(t, err) + require.NotNil(t, resp) + require.NoError(t, env.ExistingAddresses.Merge(resp.AddressBook)) + resp, err = DeployOCR3(env, registryChain) + require.NoError(t, err) + require.NotNil(t, resp) + require.NoError(t, env.ExistingAddresses.Merge(resp.AddressBook)) + resp, err = DeployForwarder(env, registryChain) + require.NoError(t, err) + require.NotNil(t, resp) + require.NoError(t, env.ExistingAddresses.Merge(resp.AddressBook)) + + a, err := ViewKeystone(env) + require.NoError(t, err) + b, err := a.MarshalJSON() + require.NoError(t, err) + require.NotEmpty(t, b) + t.Log(string(b)) +} diff --git a/deployment/keystone/deploy.go b/deployment/keystone/deploy.go index 487ac333eda..d6a1b2bf157 100644 --- a/deployment/keystone/deploy.go +++ b/deployment/keystone/deploy.go @@ -39,7 +39,6 @@ type ConfigureContractsRequest struct { Dons []DonCapabilities // externally sourced based on the environment OCR3Config *OracleConfigWithSecrets // TODO: probably should be a map of don to config; but currently we only have one wf don therefore one config - AddressBook deployment.AddressBook DoContractDeploy bool // if false, the contracts are assumed to be deployed and the address book is used } @@ -50,9 +49,6 @@ func (r ConfigureContractsRequest) Validate() error { if r.Env == nil { return errors.New("environment is nil") } - if r.AddressBook == nil { - return errors.New("address book is nil") - } if len(r.Dons) == 0 { return errors.New("no DONS") } @@ -75,7 +71,7 @@ func ConfigureContracts(ctx context.Context, lggr logger.Logger, req ConfigureCo return nil, fmt.Errorf("invalid request: %w", err) } - addrBook := req.AddressBook + addrBook := req.Env.ExistingAddresses if req.DoContractDeploy { contractDeployCS, err := DeployContracts(lggr, req.Env, req.RegistryChainSel) if err != nil { diff --git a/deployment/keystone/deploy_test.go b/deployment/keystone/deploy_test.go index b873f6bad0a..7ca8a98498b 100644 --- a/deployment/keystone/deploy_test.go +++ b/deployment/keystone/deploy_test.go @@ -68,13 +68,14 @@ func TestDeploy(t *testing.T) { // explicitly deploy the contracts cs, err := keystone.DeployContracts(lggr, env, registryChainSel) require.NoError(t, err) + // Deploy successful these are now part of our env. + require.NoError(t, env.ExistingAddresses.Merge(cs.AddressBook)) deployReq := keystone.ConfigureContractsRequest{ RegistryChainSel: registryChainSel, Env: env, OCR3Config: &ocr3Config, Dons: []keystone.DonCapabilities{wfDon, cwDon, assetDon}, - AddressBook: cs.AddressBook, DoContractDeploy: false, } deployResp, err := keystone.ConfigureContracts(ctx, lggr, deployReq) diff --git a/deployment/keystone/state.go b/deployment/keystone/state.go index 1b88438ecd8..c9f94e5bb81 100644 --- a/deployment/keystone/state.go +++ b/deployment/keystone/state.go @@ -29,7 +29,7 @@ type ContractSet struct { } func (cs ContractSet) View() (view.KeystoneChainView, error) { - var out view.KeystoneChainView + out := view.NewKeystoneChainView() if cs.CapabilitiesRegistry != nil { capRegView, err := common_v1_0.GenerateCapRegView(cs.CapabilitiesRegistry) if err != nil { diff --git a/deployment/keystone/view/view.go b/deployment/keystone/view/view.go index 20d388d34b0..ae3f374a01f 100644 --- a/deployment/keystone/view/view.go +++ b/deployment/keystone/view/view.go @@ -12,11 +12,19 @@ type KeystoneChainView struct { // TODO forwarders etc } +func NewKeystoneChainView() KeystoneChainView { + return KeystoneChainView{ + CapabilityRegistry: make(map[string]common_v1_0.CapRegView), + } +} + type KeystoneView struct { Chains map[string]KeystoneChainView `json:"chains,omitempty"` Nops map[string]view.NopView `json:"nops,omitempty"` } func (v KeystoneView) MarshalJSON() ([]byte, error) { - return json.Marshal(v) + // Alias to avoid recursive calls + type Alias KeystoneView + return json.MarshalIndent(&struct{ Alias }{Alias: Alias(v)}, "", " ") } diff --git a/integration-tests/ccip-tests/testsetups/test_helpers.go b/integration-tests/ccip-tests/testsetups/test_helpers.go index 3f12e9fd3c8..4acefca0975 100644 --- a/integration-tests/ccip-tests/testsetups/test_helpers.go +++ b/integration-tests/ccip-tests/testsetups/test_helpers.go @@ -88,7 +88,7 @@ func NewLocalDevEnvironment(t *testing.T, lggr logger.Logger) (ccipdeployment.De require.NoError(t, err) ab := deployment.NewMemoryAddressBook() - feeContracts, crConfig := ccipdeployment.DeployTestContracts(t, lggr, ab, homeChainSel, feedSel, chains) + crConfig := ccipdeployment.DeployTestContracts(t, lggr, ab, homeChainSel, feedSel, chains) // start the chainlink nodes with the CR address err = StartChainlinkNodes(t, envConfig, @@ -99,17 +99,16 @@ func NewLocalDevEnvironment(t *testing.T, lggr logger.Logger) (ccipdeployment.De e, don, err := devenv.NewEnvironment(ctx, lggr, *envConfig) require.NoError(t, err) require.NotNil(t, e) + e.ExistingAddresses = ab zeroLogLggr := logging.GetTestLogger(t) // fund the nodes FundNodes(t, zeroLogLggr, testEnv, cfg, don.PluginNodes()) return ccipdeployment.DeployedEnv{ - Ab: ab, - Env: *e, - HomeChainSel: homeChainSel, - FeedChainSel: feedSel, - ReplayBlocks: replayBlocks, - FeeTokenContracts: feeContracts, + Env: *e, + HomeChainSel: homeChainSel, + FeedChainSel: feedSel, + ReplayBlocks: replayBlocks, }, testEnv, cfg } @@ -119,18 +118,18 @@ func NewLocalDevEnvironmentWithRMN( numRmnNodes int, ) (ccipdeployment.DeployedEnv, devenv.RMNCluster) { tenv, dockerenv, _ := NewLocalDevEnvironment(t, lggr) - state, err := ccipdeployment.LoadOnchainState(tenv.Env, tenv.Ab) + state, err := ccipdeployment.LoadOnchainState(tenv.Env) require.NoError(t, err) // Deploy CCIP contracts. - err = ccipdeployment.DeployCCIPContracts(tenv.Env, tenv.Ab, ccipdeployment.DeployCCIPContractConfig{ - HomeChainSel: tenv.HomeChainSel, - FeedChainSel: tenv.FeedChainSel, - ChainsToDeploy: tenv.Env.AllChainSelectors(), - TokenConfig: ccipdeployment.NewTestTokenConfig(state.Chains[tenv.FeedChainSel].USDFeeds), - MCMSConfig: ccipdeployment.NewTestMCMSConfig(t, tenv.Env), - ExistingAddressBook: tenv.Ab, - OCRSecrets: deployment.XXXGenerateTestOCRSecrets(), + newAddresses := deployment.NewMemoryAddressBook() + err = ccipdeployment.DeployCCIPContracts(tenv.Env, newAddresses, ccipdeployment.DeployCCIPContractConfig{ + HomeChainSel: tenv.HomeChainSel, + FeedChainSel: tenv.FeedChainSel, + ChainsToDeploy: tenv.Env.AllChainSelectors(), + TokenConfig: ccipdeployment.NewTestTokenConfig(state.Chains[tenv.FeedChainSel].USDFeeds), + MCMSConfig: ccipdeployment.NewTestMCMSConfig(t, tenv.Env), + OCRSecrets: deployment.XXXGenerateTestOCRSecrets(), }) require.NoError(t, err) l := logging.GetTestLogger(t) @@ -181,7 +180,7 @@ func GenerateTestRMNConfig(t *testing.T, nRMNNodes int, tenv ccipdeployment.Depl bootstrappers := nodes.BootstrapLocators() // Just set all RMN nodes to support all chains. - state, err := ccipdeployment.LoadOnchainState(tenv.Env, tenv.Ab) + state, err := ccipdeployment.LoadOnchainState(tenv.Env) require.NoError(t, err) var chainParams []devenv.ChainParam var remoteChains []devenv.RemoteChains diff --git a/integration-tests/smoke/ccip_rmn_test.go b/integration-tests/smoke/ccip_rmn_test.go index 61c6df304b8..53bf25a3ac5 100644 --- a/integration-tests/smoke/ccip_rmn_test.go +++ b/integration-tests/smoke/ccip_rmn_test.go @@ -61,7 +61,7 @@ func TestRMN(t *testing.T) { }) } - onChainState, err := ccipdeployment.LoadOnchainState(envWithRMN.Env, envWithRMN.Ab) + onChainState, err := ccipdeployment.LoadOnchainState(envWithRMN.Env) require.NoError(t, err) t.Logf("onChainState: %#v", onChainState) diff --git a/integration-tests/smoke/ccip_test.go b/integration-tests/smoke/ccip_test.go index 730484017fa..8d429b5a772 100644 --- a/integration-tests/smoke/ccip_test.go +++ b/integration-tests/smoke/ccip_test.go @@ -26,7 +26,7 @@ func TestInitialDeployOnLocal(t *testing.T) { tenv, _, _ := testsetups.NewLocalDevEnvironment(t, lggr) e := tenv.Env - state, err := ccdeploy.LoadOnchainState(tenv.Env, tenv.Ab) + state, err := ccdeploy.LoadOnchainState(tenv.Env) require.NoError(t, err) feeds := state.Chains[tenv.FeedChainSel].USDFeeds @@ -40,18 +40,17 @@ func TestInitialDeployOnLocal(t *testing.T) { ) // Apply migration output, err := changeset.InitialDeploy(tenv.Env, ccdeploy.DeployCCIPContractConfig{ - HomeChainSel: tenv.HomeChainSel, - FeedChainSel: tenv.FeedChainSel, - ChainsToDeploy: tenv.Env.AllChainSelectors(), - TokenConfig: tokenConfig, - MCMSConfig: ccdeploy.NewTestMCMSConfig(t, e), - ExistingAddressBook: tenv.Ab, - OCRSecrets: deployment.XXXGenerateTestOCRSecrets(), + HomeChainSel: tenv.HomeChainSel, + FeedChainSel: tenv.FeedChainSel, + ChainsToDeploy: tenv.Env.AllChainSelectors(), + TokenConfig: tokenConfig, + MCMSConfig: ccdeploy.NewTestMCMSConfig(t, e), + OCRSecrets: deployment.XXXGenerateTestOCRSecrets(), }) require.NoError(t, err) - require.NoError(t, tenv.Ab.Merge(output.AddressBook)) + require.NoError(t, tenv.Env.ExistingAddresses.Merge(output.AddressBook)) // Get new state after migration. - state, err = ccdeploy.LoadOnchainState(e, tenv.Ab) + state, err = ccdeploy.LoadOnchainState(e) require.NoError(t, err) // Ensure capreg logs are up to date.