Skip to content

Commit

Permalink
more fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AnieeG committed Nov 23, 2024
1 parent 6e25589 commit 9c02beb
Show file tree
Hide file tree
Showing 5 changed files with 197 additions and 115 deletions.
19 changes: 16 additions & 3 deletions .github/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -935,14 +935,27 @@ runner-test-matrix:

# START: CCIPv1.6 tests

- id: smoke/ccip/ccip_test.go:*
- id: smoke/ccip/ccip_test.go:^TestInitialDeployOnLocal$
path: integration-tests/smoke/ccip/ccip_test.go
test_env_type: docker
runs_on: ubuntu-latest
triggers:
- PR E2E Core Tests
- Nightly E2E Tests
test_cmd: cd integration-tests/smoke/ccip && go test ccip_test.go -timeout 12m -test.parallel=2 -count=1 -json
test_cmd: cd integration-tests/smoke/ccip && go test -test.run ^TestInitialDeployOnLocal$ -timeout 12m -test.parallel=2 -count=1 -json
pyroscope_env: ci-smoke-ccipv1_6-evm-simulated
test_env_vars:
E2E_TEST_SELECTED_NETWORK: SIMULATED_1,SIMULATED_2
E2E_JD_VERSION: 0.6.0

- id: smoke/ccip/ccip_test.go:^TestTokenTransfer$
path: integration-tests/smoke/ccip/ccip_test.go
test_env_type: docker
runs_on: ubuntu-latest
triggers:
- PR E2E Core Tests
- Nightly E2E Tests
test_cmd: cd integration-tests/smoke/ccip && go test -test.run ^TestTokenTransfer$ -timeout 12m -test.parallel=2 -count=1 -json
pyroscope_env: ci-smoke-ccipv1_6-evm-simulated
test_env_vars:
E2E_TEST_SELECTED_NETWORK: SIMULATED_1,SIMULATED_2
Expand Down Expand Up @@ -981,7 +994,7 @@ runner-test-matrix:
triggers:
- PR E2E Core Tests
- Nightly E2E Tests
test_cmd: cd integration-tests/smoke/ccip && go test ccip_usdc_test.go -timeout 18m -test.parallel=1 -count=1 -json
test_cmd: cd integration-tests/smoke/ccip && go test ccip_usdc_test.go -timeout 18m -test.parallel=5 -count=1 -json
pyroscope_env: ci-smoke-ccipv1_6-evm-simulated
test_env_vars:
E2E_TEST_SELECTED_NETWORK: SIMULATED_1,SIMULATED_2,SIMULATED_3
Expand Down
93 changes: 60 additions & 33 deletions deployment/ccip/changeset/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/pkg/errors"
"github.com/smartcontractkit/ccip-owner-contracts/pkg/gethwrappers"
"github.com/smartcontractkit/chainlink-ccip/pluginconfig"
"golang.org/x/sync/errgroup"

commonconfig "github.com/smartcontractkit/chainlink-common/pkg/config"

Expand Down Expand Up @@ -84,10 +85,11 @@ func Context(tb testing.TB) context.Context {
}

type DeployedEnv struct {
Env deployment.Environment
HomeChainSel uint64
FeedChainSel uint64
ReplayBlocks map[uint64]uint64
Env deployment.Environment
HomeChainSel uint64
FeedChainSel uint64
ReplayBlocks map[uint64]uint64
SenderAccounts map[uint64]*bind.TransactOpts
}

func (e *DeployedEnv) SetupJobs(t *testing.T) {
Expand Down Expand Up @@ -708,40 +710,65 @@ func DeployTransferableToken(
addresses deployment.AddressBook,
token string,
) (*burn_mint_erc677.BurnMintERC677, *burn_mint_token_pool.BurnMintTokenPool, *burn_mint_erc677.BurnMintERC677, *burn_mint_token_pool.BurnMintTokenPool, error) {
deployGrp := errgroup.Group{}
// Deploy token and pools
srcToken, srcPool, err := deployTransferTokenOneEnd(lggr, chains[src], addresses, token)
if err != nil {
return nil, nil, nil, nil, err
}
dstToken, dstPool, err := deployTransferTokenOneEnd(lggr, chains[dst], addresses, token)
if err != nil {
return nil, nil, nil, nil, err
}

// Attach token pools to registry
if err := attachTokenToTheRegistry(chains[src], state.Chains[src], chains[src].DeployerKey, srcToken.Address(), srcPool.Address()); err != nil {
return nil, nil, nil, nil, err
}

if err := attachTokenToTheRegistry(chains[dst], state.Chains[dst], chains[dst].DeployerKey, dstToken.Address(), dstPool.Address()); err != nil {
return nil, nil, nil, nil, err
}

// Connect pool to each other
if err := setTokenPoolCounterPart(chains[src], srcPool, dst, dstToken.Address(), dstPool.Address()); err != nil {
return nil, nil, nil, nil, err
}
var srcToken *burn_mint_erc677.BurnMintERC677
var srcPool *burn_mint_token_pool.BurnMintTokenPool
var dstToken *burn_mint_erc677.BurnMintERC677
var dstPool *burn_mint_token_pool.BurnMintTokenPool
deployGrp.Go(func() error {
var err error
srcToken, srcPool, err = deployTransferTokenOneEnd(lggr, chains[src], addresses, token)
if err != nil {
return err
}
// Attach token pools to registry
if err := attachTokenToTheRegistry(chains[src], state.Chains[src], chains[src].DeployerKey, srcToken.Address(), srcPool.Address()); err != nil {
return err
}
return nil
})
deployGrp.Go(func() error {
var err error
dstToken, dstPool, err = deployTransferTokenOneEnd(lggr, chains[dst], addresses, token)
if err != nil {
return err
}

if err := setTokenPoolCounterPart(chains[dst], dstPool, src, srcToken.Address(), srcPool.Address()); err != nil {
if err := attachTokenToTheRegistry(chains[dst], state.Chains[dst], chains[dst].DeployerKey, dstToken.Address(), dstPool.Address()); err != nil {
return err
}
return nil
})
if err := deployGrp.Wait(); err != nil {
return nil, nil, nil, nil, err
}

// Add burn/mint permissions
if err := grantMintBurnPermissions(lggr, chains[src], srcToken, srcPool.Address()); err != nil {
return nil, nil, nil, nil, err
if srcToken == nil || srcPool == nil || dstToken == nil || dstPool == nil {
return nil, nil, nil, nil, fmt.Errorf("failed to deploy token and pool")
}

if err := grantMintBurnPermissions(lggr, chains[dst], dstToken, dstPool.Address()); err != nil {
configurePoolGrp := errgroup.Group{}
configurePoolGrp.Go(func() error {
err := setTokenPoolCounterPart(chains[src], srcPool, dst, dstToken.Address(), dstPool.Address())
if err != nil {
return fmt.Errorf("failed to set token pool counter part chain %d: %w", src, err)
}
err = grantMintBurnPermissions(lggr, chains[src], srcToken, srcPool.Address())
if err != nil {
return fmt.Errorf("failed to grant mint burn permissions chain %d: %w", src, err)
}
return nil
})
configurePoolGrp.Go(func() error {
err := setTokenPoolCounterPart(chains[dst], dstPool, src, srcToken.Address(), srcPool.Address())
if err != nil {
return fmt.Errorf("failed to set token pool counter part chain %d: %w", dst, err)
}
if err := grantMintBurnPermissions(lggr, chains[dst], dstToken, dstPool.Address()); err != nil {
return fmt.Errorf("failed to grant mint burn permissions chain %d: %w", dst, err)
}
return nil
})
if err := configurePoolGrp.Wait(); err != nil {
return nil, nil, nil, nil, err
}

Expand Down
90 changes: 46 additions & 44 deletions deployment/ccip/changeset/test_usdc_helpers.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package changeset

import (
"fmt"
"math/big"

"github.com/ethereum/go-ethereum/common"
"golang.org/x/sync/errgroup"

"github.com/smartcontractkit/chainlink-ccip/pkg/reader"
"github.com/smartcontractkit/chainlink-common/pkg/logger"
Expand All @@ -26,53 +28,53 @@ func ConfigureUSDCTokenPools(
dstToken := state.Chains[dst].BurnMintTokens677[USDCSymbol]
srcPool := state.Chains[src].USDCTokenPool
dstPool := state.Chains[dst].USDCTokenPool

// Attach token pools to registry
if err := attachTokenToTheRegistry(chains[src], state.Chains[src], chains[src].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 nil, nil, err
}

if err := attachTokenToTheRegistry(chains[dst], state.Chains[dst], chains[dst].DeployerKey, dstToken.Address(), dstPool.Address()); err != nil {
lggr.Errorw("Failed to attach token to the registry", "err", err, "token", dstToken.Address(), "pool", dstPool.Address())
return nil, nil, err
}

// Connect pool to each other
if err := setUSDCTokenPoolCounterPart(chains[src], srcPool, dst, dstToken.Address(), dstPool.Address()); err != nil {
lggr.Errorw("Failed to set counter part", "err", err, "srcPool", srcPool.Address(), "dstPool", dstPool.Address())
return nil, nil, err
}

if err := setUSDCTokenPoolCounterPart(chains[dst], dstPool, src, srcToken.Address(), srcPool.Address()); err != nil {
lggr.Errorw("Failed to set counter part", "err", err, "srcPool", dstPool.Address(), "dstPool", srcPool.Address())
return nil, nil, err
}

// Add burn/mint permissions for source
for _, addr := range []common.Address{
srcPool.Address(),
state.Chains[src].MockUSDCTokenMessenger.Address(),
state.Chains[src].MockUSDCTransmitter.Address(),
} {
if err := grantMintBurnPermissions(lggr, chains[src], srcToken, addr); err != nil {
lggr.Errorw("Failed to grant mint/burn permissions", "err", err, "token", srcToken.Address(), "minter", addr)
return nil, nil, err
configureGrp := errgroup.Group{}
configureGrp.Go(func() error {
if err := attachTokenToTheRegistry(chains[src], state.Chains[src], chains[src].DeployerKey, srcToken.Address(), srcPool.Address()); err != nil {
lggr.Errorw("Failed to attach token to the registry", "chain", src, "err", err, "token", srcToken.Address(), "pool", srcPool.Address())
return err
}
}

// Add burn/mint permissions for dest
for _, addr := range []common.Address{
dstPool.Address(),
state.Chains[dst].MockUSDCTokenMessenger.Address(),
state.Chains[dst].MockUSDCTransmitter.Address(),
} {
if err := grantMintBurnPermissions(lggr, chains[dst], dstToken, addr); err != nil {
lggr.Errorw("Failed to grant mint/burn permissions", "err", err, "token", dstToken.Address(), "minter", addr)
return nil, nil, err
// Connect pool to each other
if err := setUSDCTokenPoolCounterPart(chains[src], srcPool, dst, dstToken.Address(), dstPool.Address()); err != nil {
lggr.Errorw("Failed to set counter part", "err", err, "srcPool", srcPool.Address(), "dstPool", dstPool.Address())
return err
}
for _, addr := range []common.Address{
srcPool.Address(),
state.Chains[src].MockUSDCTokenMessenger.Address(),
state.Chains[src].MockUSDCTransmitter.Address(),
} {
if err := grantMintBurnPermissions(lggr, chains[src], srcToken, addr); err != nil {
lggr.Errorw("Failed to grant mint/burn permissions", "err", err, "token", srcToken.Address(), "minter", addr)
return err
}
}
return nil
})
configureGrp.Go(func() error {
if err := attachTokenToTheRegistry(chains[dst], state.Chains[dst], chains[dst].DeployerKey, dstToken.Address(), dstPool.Address()); err != nil {
lggr.Errorw("Failed to attach token to the registry", "chain", dst, "err", err, "token", dstToken.Address(), "pool", dstPool.Address())
return err
}
if err := setUSDCTokenPoolCounterPart(chains[dst], dstPool, src, srcToken.Address(), srcPool.Address()); err != nil {
lggr.Errorw("Failed to set counter part", "err", err, "srcPool", dstPool.Address(), "dstPool", srcPool.Address())
return err
}
for _, addr := range []common.Address{
dstPool.Address(),
state.Chains[dst].MockUSDCTokenMessenger.Address(),
state.Chains[dst].MockUSDCTransmitter.Address(),
} {
if err := grantMintBurnPermissions(lggr, chains[dst], dstToken, addr); err != nil {
lggr.Errorw("Failed to grant mint/burn permissions", "err", err, "token", dstToken.Address(), "minter", addr)
return err
}
}
return nil
})
if err := configureGrp.Wait(); err != nil {
return nil, nil, fmt.Errorf("failed to configure USDC token pools: %w", err)
}

return srcToken, dstToken, nil
}

Expand Down
Loading

0 comments on commit 9c02beb

Please sign in to comment.