Skip to content

Commit

Permalink
Merge branch 'develop' into CCIP-4256-extract-mcms-to-common-own-chan…
Browse files Browse the repository at this point in the history
…geset
  • Loading branch information
connorwstein committed Nov 19, 2024
2 parents c6918bf + d2feab9 commit 20eab5e
Show file tree
Hide file tree
Showing 16 changed files with 426 additions and 83 deletions.
100 changes: 100 additions & 0 deletions .github/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,106 @@ runner-test-matrix:
E2E_TEST_SELECTED_NETWORK: SIMULATED_1,SIMULATED_2
E2E_JD_VERSION: 0.4.0

- id: smoke/ccip_rmn_test.go:^TestRMN_TwoMessagesOnTwoLanesIncludingBatching$
path: integration-tests/smoke/ccip_rmn_test.go
test_env_type: docker
runs_on: ubuntu-latest
triggers:
- PR E2E Core Tests
- Merge Queue E2E Core Tests
- Nightly E2E Tests
test_cmd: cd integration-tests/smoke && 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.4.0
E2E_RMN_RAGEPROXY_VERSION: master-5208d09
E2E_RMN_AFN2PROXY_VERSION: master-5208d09

- id: smoke/ccip_rmn_test.go:^TestRMN_MultipleMessagesOnOneLaneNoWaitForExec$
path: integration-tests/smoke/ccip_rmn_test.go
test_env_type: docker
runs_on: ubuntu-latest
triggers:
- PR E2E Core Tests
- Merge Queue E2E Core Tests
- Nightly E2E Tests
test_cmd: cd integration-tests/smoke && 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.4.0
E2E_RMN_RAGEPROXY_VERSION: master-5208d09
E2E_RMN_AFN2PROXY_VERSION: master-5208d09

# Enable after flaking issue is resolved
# - id: smoke/ccip_rmn_test.go:^TestRMN_NotEnoughObservers$
# path: integration-tests/smoke/ccip_rmn_test.go
# test_env_type: docker
# runs_on: ubuntu-latest
# triggers:
# - PR E2E Core Tests
# - Merge Queue E2E Core Tests
# - Nightly E2E Tests
# test_cmd: cd integration-tests/smoke && 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.4.0
# E2E_RMN_RAGEPROXY_VERSION: master-5208d09
# E2E_RMN_AFN2PROXY_VERSION: master-5208d09

- id: smoke/ccip_rmn_test.go:^TestRMN_DifferentSigners$
path: integration-tests/smoke/ccip_rmn_test.go
test_env_type: docker
runs_on: ubuntu-latest
triggers:
- PR E2E Core Tests
- Merge Queue E2E Core Tests
- Nightly E2E Tests
test_cmd: cd integration-tests/smoke && go test -test.run ^TestRMN_DifferentSigners$ -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.4.0
E2E_RMN_RAGEPROXY_VERSION: master-5208d09
E2E_RMN_AFN2PROXY_VERSION: master-5208d09

# Enable after flaking issue is resolved
# - id: smoke/ccip_rmn_test.go:^TestRMN_NotEnoughSigners$
# path: integration-tests/smoke/ccip_rmn_test.go
# test_env_type: docker
# runs_on: ubuntu-latest
# triggers:
# - PR E2E Core Tests
# - Merge Queue E2E Core Tests
# - Nightly E2E Tests
# test_cmd: cd integration-tests/smoke && 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.4.0
# E2E_RMN_RAGEPROXY_VERSION: master-5208d09
# E2E_RMN_AFN2PROXY_VERSION: master-5208d09


- id: smoke/ccip_rmn_test.go:^TestRMN_DifferentRmnNodesForDifferentChains$
path: integration-tests/smoke/ccip_rmn_test.go
test_env_type: docker
runs_on: ubuntu-latest
triggers:
- PR E2E Core Tests
- Merge Queue E2E Core Tests
- Nightly E2E Tests
test_cmd: cd integration-tests/smoke/ && go test -test.run ^TestRMN_DifferentRmnNodesForDifferentChains$ -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.4.0
E2E_RMN_RAGEPROXY_VERSION: master-5208d09
E2E_RMN_AFN2PROXY_VERSION: master-5208d09


# END: CCIPv1.6 tests

# START: CCIP tests
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ jobs:
contents: read
needs: [build-chainlink, changes]
if: github.event_name == 'pull_request' && ( needs.changes.outputs.core_changes == 'true' || needs.changes.outputs.github_ci_changes == 'true')
uses: smartcontractkit/.github/.github/workflows/run-e2e-tests.yml@5412507526722a7b1c5d719fa686eed5a1bc4035 # [email protected]
uses: smartcontractkit/.github/.github/workflows/run-e2e-tests.yml@27467f0073162e0ca77d33ce26f649b3d0f4c188 #[email protected]
with:
workflow_name: Run Core E2E Tests For PR
chainlink_version: ${{ inputs.evm-ref || github.sha }}
Expand Down Expand Up @@ -251,7 +251,7 @@ jobs:
contents: read
needs: [build-chainlink, changes]
if: github.event_name == 'merge_group' && ( needs.changes.outputs.core_changes == 'true' || needs.changes.outputs.github_ci_changes == 'true')
uses: smartcontractkit/.github/.github/workflows/run-e2e-tests.yml@5412507526722a7b1c5d719fa686eed5a1bc4035 # ctf-run-tests@0.2.0
uses: smartcontractkit/.github/.github/workflows/run-e2e-tests.yml@27467f0073162e0ca77d33ce26f649b3d0f4c188 #ctf-run-tests@1.0.0
with:
workflow_name: Run Core E2E Tests For Merge Queue
chainlink_version: ${{ inputs.evm-ref || github.sha }}
Expand Down
43 changes: 43 additions & 0 deletions deployment/ccip/changeset/deploy_chain.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package changeset

import (
"fmt"

"github.com/smartcontractkit/ccip-owner-contracts/pkg/proposal/timelock"

"github.com/smartcontractkit/chainlink/deployment"
ccipdeployment "github.com/smartcontractkit/chainlink/deployment/ccip"
)

var _ deployment.ChangeSet[DeployChainContractsConfig] = DeployChainContracts

func DeployChainContracts(env deployment.Environment, c DeployChainContractsConfig) (deployment.ChangesetOutput, error) {
newAddresses := deployment.NewMemoryAddressBook()
err := ccipdeployment.DeployChainContractsForChains(env, newAddresses, c.HomeChainSelector, c.ChainSelectors)
if err != nil {
env.Logger.Errorw("Failed to deploy CCIP contracts", "err", err, "newAddresses", newAddresses)
return deployment.ChangesetOutput{AddressBook: newAddresses}, deployment.MaybeDataErr(err)
}
return deployment.ChangesetOutput{
Proposals: []timelock.MCMSWithTimelockProposal{},
AddressBook: newAddresses,
JobSpecs: nil,
}, nil
}

type DeployChainContractsConfig struct {
ChainSelectors []uint64
HomeChainSelector uint64
}

func (c DeployChainContractsConfig) Validate() error {
for _, cs := range c.ChainSelectors {
if err := deployment.IsValidChainSelector(cs); err != nil {
return fmt.Errorf("invalid chain selector: %d - %w", cs, err)
}
}
if err := deployment.IsValidChainSelector(c.HomeChainSelector); err != nil {
return fmt.Errorf("invalid home chain selector: %d - %w", c.HomeChainSelector, err)
}
return nil
}
78 changes: 78 additions & 0 deletions deployment/ccip/changeset/deploy_chain_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package changeset

import (
"testing"

"github.com/stretchr/testify/require"
"go.uber.org/zap/zapcore"

"github.com/smartcontractkit/chainlink/deployment"
ccdeploy "github.com/smartcontractkit/chainlink/deployment/ccip"
"github.com/smartcontractkit/chainlink/deployment/environment/memory"
"github.com/smartcontractkit/chainlink/v2/core/logger"
)

func TestDeployChainContractsChangeset(t *testing.T) {
lggr := logger.TestLogger(t)
e := memory.NewMemoryEnvironment(t, lggr, zapcore.InfoLevel, memory.MemoryEnvironmentConfig{
Bootstraps: 1,
Chains: 2,
Nodes: 4,
})
selectors := e.AllChainSelectors()
homeChainSel := selectors[0]
nodes, err := deployment.NodeInfo(e.NodeIDs, e.Offchain)
require.NoError(t, err)
p2pIds := nodes.NonBootstraps().PeerIDs()
// deploy home chain
homeChainCfg := DeployHomeChainConfig{
HomeChainSel: homeChainSel,
RMNStaticConfig: ccdeploy.NewTestRMNStaticConfig(),
RMNDynamicConfig: ccdeploy.NewTestRMNDynamicConfig(),
NodeOperators: ccdeploy.NewTestNodeOperator(e.Chains[homeChainSel].DeployerKey.From),
NodeP2PIDsPerNodeOpAdmin: map[string][][32]byte{
"NodeOperator": p2pIds,
},
}
output, err := DeployHomeChain(e, homeChainCfg)
require.NoError(t, err)
require.NoError(t, e.ExistingAddresses.Merge(output.AddressBook))

// deploy pre-requisites
prerequisites, err := DeployPrerequisites(e, DeployPrerequisiteConfig{
ChainSelectors: selectors,
})
require.NoError(t, err)
require.NoError(t, e.ExistingAddresses.Merge(prerequisites.AddressBook))

// deploy ccip chain contracts
output, err = DeployChainContracts(e, DeployChainContractsConfig{
ChainSelectors: selectors,
HomeChainSelector: homeChainSel,
MCMSCfg: ccdeploy.NewTestMCMSConfig(t, e),
})
require.NoError(t, err)
require.NoError(t, e.ExistingAddresses.Merge(output.AddressBook))

// load onchain state
state, err := ccdeploy.LoadOnchainState(e)
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)
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)
}
}
4 changes: 3 additions & 1 deletion deployment/ccip/changeset/home_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ func DeployHomeChain(env deployment.Environment, cfg DeployHomeChainConfig) (dep
_, err = ccipdeployment.DeployHomeChain(env.Logger, env, ab, env.Chains[cfg.HomeChainSel], cfg.RMNStaticConfig, cfg.RMNDynamicConfig, cfg.NodeOperators, cfg.NodeP2PIDsPerNodeOpAdmin)
if err != nil {
env.Logger.Errorw("Failed to deploy cap reg", "err", err, "addresses", env.ExistingAddresses)
return deployment.ChangesetOutput{}, err
return deployment.ChangesetOutput{
AddressBook: ab,
}, err
}

return deployment.ChangesetOutput{
Expand Down
21 changes: 21 additions & 0 deletions deployment/ccip/changeset/jobspec.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package changeset

import (
"github.com/pkg/errors"
"github.com/smartcontractkit/ccip-owner-contracts/pkg/proposal/timelock"

"github.com/smartcontractkit/chainlink/deployment"
ccipdeployment "github.com/smartcontractkit/chainlink/deployment/ccip"
)

func Jobspec(env deployment.Environment, _ any) (deployment.ChangesetOutput, error) {
js, err := ccipdeployment.NewCCIPJobSpecs(env.NodeIDs, env.Offchain)
if err != nil {
return deployment.ChangesetOutput{}, errors.Wrapf(err, "failed to create job specs")
}
return deployment.ChangesetOutput{
Proposals: []timelock.MCMSWithTimelockProposal{},
AddressBook: deployment.NewMemoryAddressBook(),
JobSpecs: js,
}, nil
}
35 changes: 35 additions & 0 deletions deployment/ccip/changeset/jobspec_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package changeset

import (
"testing"

"github.com/stretchr/testify/require"
"go.uber.org/zap/zapcore"

"github.com/smartcontractkit/chainlink/deployment"
"github.com/smartcontractkit/chainlink/deployment/environment/memory"
ccip "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/validate"
"github.com/smartcontractkit/chainlink/v2/core/logger"
)

func TestJobSpecChangeset(t *testing.T) {
lggr := logger.TestLogger(t)
e := memory.NewMemoryEnvironment(t, lggr, zapcore.InfoLevel, memory.MemoryEnvironmentConfig{
Chains: 1,
Nodes: 4,
})
output, err := Jobspec(e, nil)
require.NoError(t, err)
require.NotNil(t, output.JobSpecs)
nodes, err := deployment.NodeInfo(e.NodeIDs, e.Offchain)
require.NoError(t, err)
for _, node := range nodes {
jobs, exists := output.JobSpecs[node.NodeID]
require.True(t, exists)
require.NotNil(t, jobs)
for _, job := range jobs {
_, err = ccip.ValidatedCCIPSpec(job)
require.NoError(t, err)
}
}
}
12 changes: 4 additions & 8 deletions deployment/ccip/changeset/prerequisites.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/pkg/errors"
"github.com/smartcontractkit/ccip-owner-contracts/pkg/proposal/timelock"
chain_selectors "github.com/smartcontractkit/chain-selectors"

"github.com/smartcontractkit/chainlink/deployment"
ccipdeployment "github.com/smartcontractkit/chainlink/deployment/ccip"
Expand All @@ -27,7 +26,9 @@ func DeployPrerequisites(env deployment.Environment, cfg DeployPrerequisiteConfi
err = ccipdeployment.DeployPrerequisiteChainContracts(env, ab, cfg.ChainSelectors)
if err != nil {
env.Logger.Errorw("Failed to deploy prerequisite contracts", "err", err, "addressBook", ab)
return deployment.ChangesetOutput{}, fmt.Errorf("failed to deploy prerequisite contracts: %w", err)
return deployment.ChangesetOutput{
AddressBook: ab,
}, fmt.Errorf("failed to deploy prerequisite contracts: %w", err)
}
return deployment.ChangesetOutput{
Proposals: []timelock.MCMSWithTimelockProposal{},
Expand All @@ -45,14 +46,9 @@ type DeployPrerequisiteConfig struct {

func (c DeployPrerequisiteConfig) Validate() error {
for _, cs := range c.ChainSelectors {
if cs == 0 {
return fmt.Errorf("chain selector must be set")
}
_, err := chain_selectors.ChainIdFromSelector(cs)
if err != nil {
if err := deployment.IsValidChainSelector(cs); err != nil {
return fmt.Errorf("invalid chain selector: %d - %w", cs, err)
}

}
return nil
}
7 changes: 1 addition & 6 deletions deployment/ccip/changeset/save_existing.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/pkg/errors"
"github.com/smartcontractkit/ccip-owner-contracts/pkg/proposal/timelock"
chain_selectors "github.com/smartcontractkit/chain-selectors"

"github.com/smartcontractkit/chainlink/deployment"
)
Expand All @@ -27,11 +26,7 @@ type ExistingContractsConfig struct {

func (cfg ExistingContractsConfig) Validate() error {
for _, ec := range cfg.ExistingContracts {
if ec.ChainSelector == 0 {
return fmt.Errorf("chain selectors must be set")
}
_, err := chain_selectors.ChainIdFromSelector(ec.ChainSelector)
if err != nil {
if err := deployment.IsValidChainSelector(ec.ChainSelector); err != nil {
return fmt.Errorf("invalid chain selector: %d - %w", ec.ChainSelector, err)
}
if ec.Address == (common.Address{}) {
Expand Down
Loading

0 comments on commit 20eab5e

Please sign in to comment.