From b0c08a3d29535f50a3b82d3654f849eca80d3909 Mon Sep 17 00:00:00 2001 From: Balamurali Gopalswami <167726375+b-gopalswami@users.noreply.github.com> Date: Wed, 26 Feb 2025 21:50:04 -0500 Subject: [PATCH] CCIP-2573: Adding Test router setup (#16503) * CCIP-2573: Adding Test router setup add validation * Adding USDCTokenPools view * lint fix * fix side-effects * Fix state view * lint fix * review comments * additonal check --- .../v1_5_1/cs_deploy_usdc_token_pools.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/deployment/ccip/changeset/v1_5_1/cs_deploy_usdc_token_pools.go b/deployment/ccip/changeset/v1_5_1/cs_deploy_usdc_token_pools.go index 68ae0f08a40..2708a2c25a3 100644 --- a/deployment/ccip/changeset/v1_5_1/cs_deploy_usdc_token_pools.go +++ b/deployment/ccip/changeset/v1_5_1/cs_deploy_usdc_token_pools.go @@ -80,7 +80,8 @@ func (i DeployUSDCTokenPoolInput) Validate(ctx context.Context, chain deployment // DeployUSDCTokenPoolContractsConfig defines the USDC token pool contracts that need to be deployed on each chain. type DeployUSDCTokenPoolContractsConfig struct { // USDCPools defines the per-chain configuration of each new USDC pool. - USDCPools map[uint64]DeployUSDCTokenPoolInput + USDCPools map[uint64]DeployUSDCTokenPoolInput + IsTestRouter bool } func (c DeployUSDCTokenPoolContractsConfig) Validate(env deployment.Environment) error { @@ -101,9 +102,12 @@ func (c DeployUSDCTokenPoolContractsConfig) Validate(env deployment.Environment) if !ok { return fmt.Errorf("chain with selector %d does not exist in state", chainSelector) } - if chainState.Router == nil { + if !c.IsTestRouter && chainState.Router == nil { return fmt.Errorf("missing router on %s", chain) } + if c.IsTestRouter && chainState.TestRouter == nil { + return fmt.Errorf("missing test router on %s", chain) + } if chainState.RMNProxy == nil { return fmt.Errorf("missing rmnProxy on %s", chain) } @@ -130,12 +134,15 @@ func DeployUSDCTokenPoolContractsChangeset(env deployment.Environment, c DeployU for chainSelector, poolConfig := range c.USDCPools { chain := env.Chains[chainSelector] chainState := state.Chains[chainSelector] - + router := chainState.Router + if c.IsTestRouter { + router = chainState.TestRouter + } _, err := deployment.DeployContract(env.Logger, chain, newAddresses, func(chain deployment.Chain) deployment.ContractDeploy[*usdc_token_pool.USDCTokenPool] { poolAddress, tx, usdcTokenPool, err := usdc_token_pool.DeployUSDCTokenPool( chain.DeployerKey, chain.Client, poolConfig.TokenMessenger, poolConfig.TokenAddress, - poolConfig.AllowList, chainState.RMNProxy.Address(), chainState.Router.Address(), + poolConfig.AllowList, chainState.RMNProxy.Address(), router.Address(), ) return deployment.ContractDeploy[*usdc_token_pool.USDCTokenPool]{ Address: poolAddress,