Skip to content

Commit

Permalink
Merge branch 'develop' into ccipreader-tests2
Browse files Browse the repository at this point in the history
  • Loading branch information
asoliman92 committed Nov 29, 2024
2 parents 461eb43 + 1ed47a6 commit 0e42634
Show file tree
Hide file tree
Showing 11 changed files with 930 additions and 416 deletions.
91 changes: 52 additions & 39 deletions .github/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -987,65 +987,51 @@ runner-test-matrix:
E2E_TEST_SELECTED_NETWORK: SIMULATED_1,SIMULATED_2,SIMULATED_3
E2E_JD_VERSION: 0.6.0

- id: smoke/ccip/fee_boosting_test.go:*
path: integration-tests/smoke/ccip/fee_boosting_test.go
- id: smoke/ccip/ccip_rmn_test.go:^TestRMN_TwoMessagesOnTwoLanesIncludingBatching$
path: integration-tests/smoke/ccip/ccip_rmn_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 fee_boosting_test.go -timeout 15m -test.parallel=1 -count=1 -json
test_cmd: cd integration-tests/smoke/ccip && go test -test.run ^TestRMN_TwoMessagesOnTwoLanesIncludingBatching$ -timeout 12m -test.parallel=1 -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
E2E_RMN_RAGEPROXY_VERSION: master-f461a9e
E2E_RMN_AFN2PROXY_VERSION: master-f461a9e

- id: smoke/ccip/ccip_rmn_test.go:^TestRMN_TwoMessagesOnTwoLanesIncludingBatching$
- id: smoke/ccip/ccip_rmn_test.go:^TestRMN_MultipleMessagesOnOneLaneNoWaitForExec$
path: integration-tests/smoke/ccip/ccip_rmn_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 ^TestRMN_TwoMessagesOnTwoLanesIncludingBatching$ -timeout 12m -test.parallel=1 -count=1 -json
test_cmd: cd integration-tests/smoke/ccip && go test -test.run ^TestRMN_MultipleMessagesOnOneLaneNoWaitForExec$ -timeout 12m -test.parallel=1 -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
E2E_RMN_RAGEPROXY_VERSION: master-f461a9e
E2E_RMN_AFN2PROXY_VERSION: master-f461a9e

- id: smoke/ccip/ccip_rmn_test.go:^TestRMN_MultipleMessagesOnOneLaneNoWaitForExec$
- id: smoke/ccip/ccip_rmn_test.go:^TestRMN_NotEnoughObservers$
path: integration-tests/smoke/ccip/ccip_rmn_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 ^TestRMN_MultipleMessagesOnOneLaneNoWaitForExec$ -timeout 12m -test.parallel=1 -count=1 -json
test_cmd: cd integration-tests/smoke/ccip && go test -test.run ^TestRMN_NotEnoughObservers$ -timeout 12m -test.parallel=1 -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
E2E_RMN_RAGEPROXY_VERSION: master-f461a9e
E2E_RMN_AFN2PROXY_VERSION: master-f461a9e

# Enable after flaking issue is resolved
# - id: smoke/ccip/ccip_rmn_test.go:^TestRMN_NotEnoughObservers$
# path: integration-tests/smoke/ccip/ccip_rmn_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 ^TestRMN_NotEnoughObservers$ -timeout 12m -test.parallel=1 -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
# E2E_RMN_RAGEPROXY_VERSION: master-f461a9e
# E2E_RMN_AFN2PROXY_VERSION: master-f461a9e

- id: smoke/ccip/ccip_rmn_test.go:^TestRMN_DifferentSigners$
path: integration-tests/smoke/ccip/ccip_rmn_test.go
test_env_type: docker
Expand All @@ -1061,22 +1047,20 @@ runner-test-matrix:
E2E_RMN_RAGEPROXY_VERSION: master-f461a9e
E2E_RMN_AFN2PROXY_VERSION: master-f461a9e

# Enable after flaking issue is resolved
# - id: smoke/ccip/ccip_rmn_test.go:^TestRMN_NotEnoughSigners$
# path: integration-tests/smoke/ccip/ccip_rmn_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 ^TestRMN_NotEnoughSigners$ -timeout 12m -test.parallel=1 -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
# E2E_RMN_RAGEPROXY_VERSION: master-f461a9e
# E2E_RMN_AFN2PROXY_VERSION: master-f461a9e

- id: smoke/ccip/ccip_rmn_test.go:^TestRMN_NotEnoughSigners$
path: integration-tests/smoke/ccip/ccip_rmn_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 ^TestRMN_NotEnoughSigners$ -timeout 12m -test.parallel=1 -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
E2E_RMN_RAGEPROXY_VERSION: master-f461a9e
E2E_RMN_AFN2PROXY_VERSION: master-f461a9e

- id: smoke/ccip/ccip_rmn_test.go:^TestRMN_DifferentRmnNodesForDifferentChains$
path: integration-tests/smoke/ccip/ccip_rmn_test.go
Expand All @@ -1093,6 +1077,35 @@ runner-test-matrix:
E2E_RMN_RAGEPROXY_VERSION: master-f461a9e
E2E_RMN_AFN2PROXY_VERSION: master-f461a9e

- id: smoke/ccip/ccip_rmn_test.go:^TestRMN_TwoMessagesOneSourceChainCursed$
path: integration-tests/smoke/ccip/ccip_rmn_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 ^TestRMN_TwoMessagesOneSourceChainCursed$ -timeout 12m -test.parallel=1 -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
E2E_RMN_RAGEPROXY_VERSION: master-f461a9e
E2E_RMN_AFN2PROXY_VERSION: master-f461a9e

- id: smoke/ccip/ccip_rmn_test.go:^TestRMN_GlobalCurseTwoMessagesOnTwoLanes$
path: integration-tests/smoke/ccip/ccip_rmn_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 ^TestRMN_GlobalCurseTwoMessagesOnTwoLanes$ -timeout 12m -test.parallel=1 -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
E2E_RMN_RAGEPROXY_VERSION: master-f461a9e
E2E_RMN_AFN2PROXY_VERSION: master-f461a9e

# END: CCIPv1.6 tests

Expand Down
9 changes: 9 additions & 0 deletions .github/integration-in-memory-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,20 @@ runner-test-matrix:
- PR Integration CCIP Tests
test_cmd: cd integration-tests/smoke/ccip && go test ccip_messaging_test.go -timeout 12m -test.parallel=2 -count=1 -json

- id: smoke/ccip/ccip_fee_boosting_test.go:*
path: integration-tests/smoke/ccip/ccip_fee_boosting_test.go
test_env_type: in-memory
runs_on: ubuntu-latest
triggers:
- PR Integration CCIP Tests
test_cmd: cd integration-tests/smoke/ccip && go test ccip_fee_boosting_test.go -timeout 12m -test.parallel=2 -count=1 -json

- id: contracts/ccipreader_test.go:*
path: integration-tests/contracts/ccipreader_test.go
test_env_type: in-memory
runs_on: ubuntu-latest
triggers:
- PR Integration CCIP Tests
test_cmd: cd integration-tests/contracts && go test ccipreader_test.go -timeout 5m -test.parallel=1 -count=1 -json

# END: CCIP tests
2 changes: 1 addition & 1 deletion .github/workflows/crib-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
echo $GITHUB_WORKSPACE
- name: Deploy and validate CRIB Environment for Core
uses: smartcontractkit/.github/actions/crib-deploy-environment@c1c5e0952dfb1f7748cdad9789fd2a2ae8dc7348 # crib-deploy-environment@2.1.1
uses: smartcontractkit/.github/actions/crib-deploy-environment@d4d9ce3fad044642d8d2f7ae5aca9f8c78b0073a # crib-deploy-environment@2.1.2
id: deploy-crib
with:
github-token: ${{ steps.token.outputs.access-token }}
Expand Down
163 changes: 106 additions & 57 deletions deployment/ccip/changeset/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
"testing"
"time"

"golang.org/x/sync/errgroup"

mapset "github.com/deckarep/golang-set/v2"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common/hexutil"
Expand All @@ -33,11 +35,12 @@ import (

chainsel "github.com/smartcontractkit/chain-selectors"

"github.com/smartcontractkit/chainlink-ccip/pkg/reader"
cciptypes "github.com/smartcontractkit/chainlink-ccip/pkg/types/ccipocr3"
jobv1 "github.com/smartcontractkit/chainlink-protos/job-distributor/v1/job"
"github.com/smartcontractkit/chainlink-testing-framework/lib/utils/testcontext"

"github.com/smartcontractkit/chainlink-ccip/pkg/reader"
cciptypes "github.com/smartcontractkit/chainlink-ccip/pkg/types/ccipocr3"

"github.com/smartcontractkit/chainlink-common/pkg/logger"
commonutils "github.com/smartcontractkit/chainlink-common/pkg/utils"
"github.com/smartcontractkit/chainlink-common/pkg/utils/tests"
Expand Down Expand Up @@ -256,8 +259,9 @@ func mockAttestationResponse() *httptest.Server {
}

type TestConfigs struct {
IsUSDC bool
IsMultiCall3 bool
IsUSDC bool
IsMultiCall3 bool
OCRConfigOverride func(CCIPOCRParams) CCIPOCRParams
}

func NewMemoryEnvironmentWithJobsAndContracts(t *testing.T, lggr logger.Logger, numChains int, numNodes int, tCfg *TestConfigs) DeployedEnv {
Expand Down Expand Up @@ -750,58 +754,96 @@ func DeployTransferableToken(
token string,
) (*burn_mint_erc677.BurnMintERC677, *burn_mint_token_pool.BurnMintTokenPool, *burn_mint_erc677.BurnMintERC677, *burn_mint_token_pool.BurnMintTokenPool, error) {
// Deploy token and pools
srcToken, srcPool, err := deployTransferTokenOneEnd(lggr, chains[src], srcActor, addresses, token)
if err != nil {
return nil, nil, nil, nil, err
}
dstToken, dstPool, err := deployTransferTokenOneEnd(lggr, chains[dst], dstActor, addresses, token)
srcToken, srcPool, dstToken, dstPool, err := deployTokenPoolsInParallel(lggr, chains, src, dst, srcActor, dstActor, state, addresses, token)
if err != nil {
return nil, nil, nil, nil, err
}

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

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

// Connect pool to each other
if err := setTokenPoolCounterPart(chains[src], srcPool, srcActor, dst, dstToken.Address(), dstPool.Address()); err != nil {
return nil, nil, nil, nil, err
}

if err := setTokenPoolCounterPart(chains[dst], dstPool, dstActor, src, srcToken.Address(), srcPool.Address()); err != nil {
// Configure pools in parallel
configurePoolGrp := errgroup.Group{}
configurePoolGrp.Go(func() error {
err := setTokenPoolCounterPart(chains[src], srcPool, srcActor, 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, srcActor, 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, dstActor, 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, dstActor, 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
}
return srcToken, srcPool, dstToken, dstPool, nil
}

// Add burn/mint permissions
if err := grantMintBurnPermissions(lggr, chains[src], srcToken, srcActor, srcPool.Address()); err != nil {
func deployTokenPoolsInParallel(
lggr logger.Logger,
chains map[uint64]deployment.Chain,
src, dst uint64,
srcActor, dstActor *bind.TransactOpts,
state CCIPOnChainState,
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
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], srcActor, addresses, token)
if err != nil {
return err
}
if err := attachTokenToTheRegistry(chains[src], state.Chains[src], srcActor, srcToken.Address(), srcPool.Address()); err != nil {
return err
}
return nil
})
deployGrp.Go(func() error {
var err error
dstToken, dstPool, err = deployTransferTokenOneEnd(lggr, chains[dst], dstActor, addresses, token)
if err != nil {
return err
}
if err := attachTokenToTheRegistry(chains[dst], state.Chains[dst], dstActor, dstToken.Address(), dstPool.Address()); err != nil {
return err
}
return nil
})
if err := deployGrp.Wait(); err != nil {
return nil, nil, nil, nil, err
}

if err := grantMintBurnPermissions(lggr, chains[dst], dstToken, dstActor, dstPool.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")
}

return srcToken, srcPool, dstToken, dstPool, nil
}

func grantMintBurnPermissions(lggr logger.Logger, chain deployment.Chain, token *burn_mint_erc677.BurnMintERC677, actor *bind.TransactOpts, address common.Address) error {
lggr.Infow("Granting burn permissions", "token", token.Address(), "burner", address)
tx, err := token.GrantBurnRole(actor, address)
if err != nil {
return err
}
_, err = chain.Confirm(tx)
if err != nil {
return err
}

lggr.Infow("Granting mint permissions", "token", token.Address(), "minter", address)
tx, err = token.GrantMintRole(actor, address)
lggr.Infow("Granting burn/mint permissions", "token", token.Address(), "address", address)
tx, err := token.GrantMintAndBurnRoles(actor, address)
if err != nil {
return err
}
Expand Down Expand Up @@ -1023,28 +1065,35 @@ func MintAndAllow(
owners map[uint64]*bind.TransactOpts,
tkMap map[uint64][]*burn_mint_erc677.BurnMintERC677,
) {
configurePoolGrp := errgroup.Group{}
tenCoins := new(big.Int).Mul(big.NewInt(1e18), big.NewInt(10))

for chain, tokens := range tkMap {
owner, ok := owners[chain]
require.True(t, ok)

for _, token := range tokens {
tx, err := token.Mint(
owner,
e.Chains[chain].DeployerKey.From,
new(big.Int).Mul(tenCoins, big.NewInt(10)),
)
require.NoError(t, err)
_, err = e.Chains[chain].Confirm(tx)
require.NoError(t, err)

tx, err = token.Approve(e.Chains[chain].DeployerKey, state.Chains[chain].Router.Address(), tenCoins)
require.NoError(t, err)
_, err = e.Chains[chain].Confirm(tx)
require.NoError(t, err)
}
tokens := tokens
configurePoolGrp.Go(func() error {
for _, token := range tokens {
tx, err := token.Mint(
owner,
e.Chains[chain].DeployerKey.From,
new(big.Int).Mul(tenCoins, big.NewInt(10)),
)
require.NoError(t, err)
_, err = e.Chains[chain].Confirm(tx)
require.NoError(t, err)

tx, err = token.Approve(e.Chains[chain].DeployerKey, state.Chains[chain].Router.Address(), tenCoins)
require.NoError(t, err)
_, err = e.Chains[chain].Confirm(tx)
require.NoError(t, err)
}
return nil
})
}

require.NoError(t, configurePoolGrp.Wait())
}

// TransferAndWaitForSuccess sends a message from sourceChain to destChain and waits for it to be executed
Expand Down
Loading

0 comments on commit 0e42634

Please sign in to comment.