Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ccip-4110 migration test #15854

Open
wants to merge 32 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
ded3f4c
Merge branch 'develop' of github.com:smartcontractkit/chainlink into …
AnieeG Dec 7, 2024
10314c8
Merge branch 'develop' of github.com:smartcontractkit/chainlink into …
AnieeG Dec 10, 2024
5f14bf0
remove deployCCIPContracts
AnieeG Dec 10, 2024
75c676f
Merge branch 'develop' of github.com:smartcontractkit/chainlink into …
AnieeG Dec 10, 2024
b31ec5a
Merge branch 'develop' of github.com:smartcontractkit/chainlink into …
AnieeG Dec 10, 2024
5f6d2d5
Merge branch 'develop' of github.com:smartcontractkit/chainlink into …
AnieeG Dec 13, 2024
65616ff
Merge branch 'develop' of github.com:smartcontractkit/chainlink into …
AnieeG Dec 13, 2024
6dd9c4a
Merge branch 'develop' of github.com:smartcontractkit/chainlink into …
AnieeG Dec 13, 2024
813cc6e
Merge branch 'develop' of github.com:smartcontractkit/chainlink into …
AnieeG Dec 18, 2024
a299e7c
Merge branch 'develop' of github.com:smartcontractkit/chainlink into …
AnieeG Dec 19, 2024
1837b21
deprecate existing add lane
AnieeG Dec 20, 2024
bda53fc
Merge branch 'develop' of github.com:smartcontractkit/chainlink into …
AnieeG Jan 3, 2025
e171316
Merge branch 'develop' of github.com:smartcontractkit/chainlink into …
AnieeG Jan 6, 2025
f8574e7
new migration test
AnieeG Jan 6, 2025
950caa3
first version
AnieeG Jan 7, 2025
0b75a79
more updates
AnieeG Jan 8, 2025
1216211
fix tests
AnieeG Jan 8, 2025
e45b045
more fixes
AnieeG Jan 8, 2025
dfe7a2a
include in pipeline
AnieeG Jan 8, 2025
f0ecc26
enabling test
AnieeG Jan 8, 2025
d5d1df3
merge
AnieeG Jan 8, 2025
843e228
upgrade chainlink ccip fixing router binding issues in migration
asoliman92 Jan 9, 2025
ec2391a
Merge branch 'develop' into ccip-4110-migration-test
asoliman92 Jan 9, 2025
810fda5
Merge branch 'develop' into ccip-4110-migration-test
asoliman92 Jan 9, 2025
7558959
upgrade chainlink ccip fixing router binding issues in migration
asoliman92 Jan 9, 2025
7d74ac6
Merge branch 'develop' of github.com:smartcontractkit/chainlink into …
AnieeG Jan 9, 2025
06cbc31
review comments
AnieeG Jan 9, 2025
d9f7594
Merge branch 'ccip-4110-migration-test' of github.com:smartcontractki…
AnieeG Jan 9, 2025
f48873e
review comments
AnieeG Jan 9, 2025
f8c83b3
review comments
AnieeG Jan 9, 2025
c8f0217
fix
AnieeG Jan 9, 2025
fcecd8f
fix imports
AnieeG Jan 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/integration-in-memory-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
#
runner-test-matrix:
# START: CCIPv1.6 tests
- id: smoke/ccip/ccip_migration_to_v_1_6_test.go:*
path: integration-tests/smoke/ccip/ccip_migration_to_v_1_6_test.go.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_migration_to_v_1_6_test.go -timeout 12m -test.parallel=1 -count=1 -json

- id: smoke/ccip/ccip_fees_test.go:*
path: integration-tests/smoke/ccip/ccip_fees_test.go
Expand Down
2 changes: 1 addition & 1 deletion core/scripts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ require (
github.com/shirou/gopsutil/v3 v3.24.3 // indirect
github.com/smartcontractkit/ccip-owner-contracts v0.0.0-salt-fix // indirect
github.com/smartcontractkit/chain-selectors v1.0.36 // indirect
github.com/smartcontractkit/chainlink-ccip v0.0.0-20250109124515-ff9d86b874ba // indirect
github.com/smartcontractkit/chainlink-ccip v0.0.0-20250109175726-b72c6bfaec00 // indirect
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250103152858-8973fd0c912b // indirect
github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241202195413-82468150ac1e // indirect
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241216163550-fa030d178ba3 // indirect
Expand Down
4 changes: 2 additions & 2 deletions core/scripts/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1111,8 +1111,8 @@ github.com/smartcontractkit/chain-selectors v1.0.36 h1:KSpO8I+JOiuyN4FuXsV471sPo
github.com/smartcontractkit/chain-selectors v1.0.36/go.mod h1:xsKM0aN3YGcQKTPRPDDtPx2l4mlTN1Djmg0VVXV40b8=
github.com/smartcontractkit/chainlink-automation v0.8.1 h1:sTc9LKpBvcKPc1JDYAmgBc2xpDKBco/Q4h4ydl6+UUU=
github.com/smartcontractkit/chainlink-automation v0.8.1/go.mod h1:Iij36PvWZ6blrdC5A/nrQUBuf3MH3JvsBB9sSyc9W08=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20250109124515-ff9d86b874ba h1:gisAer1YxKKui6LhxDgfuZ3OyrHVjHm/oK/0idusFeI=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20250109124515-ff9d86b874ba/go.mod h1:ncjd6mPZSRlelEqH/2KeLE1pU3UlqzBSn8RYkEoECzY=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20250109175726-b72c6bfaec00 h1:w/KQPjK1sqRggWO87ntSNmYTNhLfgIspii4VpCqZkfU=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20250109175726-b72c6bfaec00/go.mod h1:ncjd6mPZSRlelEqH/2KeLE1pU3UlqzBSn8RYkEoECzY=
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250103152858-8973fd0c912b h1:UBXi9Yj8YSMHDDaxQLu273x1fWjyEL9xP58nuJsqZfg=
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250103152858-8973fd0c912b/go.mod h1:Bmwq4lNb5tE47sydN0TKetcLEGbgl+VxHEWp4S0LI60=
github.com/smartcontractkit/chainlink-common v0.4.1-0.20250108194320-2ebd63bbb16e h1:8BStiP1F4W8AvjBRga0TYtjvAtkwN8oHYnHJztAlSF4=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ type JobType string
const (
Commit JobType = "commit"
Execution JobType = "exec"
Boostrap JobType = "bootstrap"
Bootstrap JobType = "bootstrap"
)

func JobName(jobType JobType, source string, destination, version string) string {
Expand Down Expand Up @@ -323,7 +323,7 @@ func (params CCIPJobSpecParams) BootstrapJob(contractID string) *OCR2TaskJobSpec
},
}
return &OCR2TaskJobSpec{
Name: fmt.Sprintf("%s-%s", Boostrap, params.DestChainName),
Name: fmt.Sprintf("%s-%s-%s", Bootstrap, params.SourceChainName, params.DestChainName),
JobType: "bootstrap",
OCR2OracleSpec: bootstrapSpec,
}
Expand Down
2 changes: 1 addition & 1 deletion deployment/ccip/changeset/accept_ownership_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

func Test_NewAcceptOwnershipChangeset(t *testing.T) {
t.Parallel()
e := NewMemoryEnvironment(t)
e, _ := NewMemoryEnvironment(t)
state, err := LoadOnchainState(e.Env)
require.NoError(t, err)

Expand Down
3 changes: 2 additions & 1 deletion deployment/ccip/changeset/cs_active_candidate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"golang.org/x/exp/maps"

"github.com/smartcontractkit/chainlink-testing-framework/lib/utils/testcontext"

"github.com/smartcontractkit/chainlink/deployment/ccip/changeset/internal"
commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset"

Expand All @@ -25,7 +26,7 @@ func Test_ActiveCandidate(t *testing.T) {
// We want to have the active instance execute a few messages
// and then setup a candidate instance. The candidate instance
// should not be able to transmit anything until we make it active.
tenv := NewMemoryEnvironment(t,
tenv, _ := NewMemoryEnvironment(t,
WithChains(2),
WithNodes(4))
state, err := LoadOnchainState(tenv.Env)
Expand Down
84 changes: 2 additions & 82 deletions deployment/ccip/changeset/cs_add_lane_test.go
Original file line number Diff line number Diff line change
@@ -1,106 +1,26 @@
package changeset

import (
"math/big"
"testing"

"github.com/ethereum/go-ethereum/common"
"github.com/stretchr/testify/require"

"github.com/smartcontractkit/chainlink-testing-framework/lib/utils/testcontext"

commoncs "github.com/smartcontractkit/chainlink/deployment/common/changeset"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/fee_quoter"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/router"
)

func TestAddLanesWithTestRouter(t *testing.T) {
t.Parallel()
e := NewMemoryEnvironment(t)
e, _ := NewMemoryEnvironment(t)
// Here we have CR + nodes set up, but no CCIP contracts deployed.
state, err := LoadOnchainState(e.Env)
require.NoError(t, err)

selectors := e.Env.AllChainSelectors()
chain1, chain2 := selectors[0], selectors[1]

stateChain1 := state.Chains[chain1]
e.Env, err = commoncs.ApplyChangesets(t, e.Env, e.TimelockContracts(t), []commoncs.ChangesetApplication{
{
Changeset: commoncs.WrapChangeSet(UpdateOnRampsDests),
Config: UpdateOnRampDestsConfig{
UpdatesByChain: map[uint64]map[uint64]OnRampDestinationUpdate{
chain1: {
chain2: {
IsEnabled: true,
TestRouter: true,
AllowListEnabled: false,
},
},
},
},
},
{
Changeset: commoncs.WrapChangeSet(UpdateFeeQuoterPricesCS),
Config: UpdateFeeQuoterPricesConfig{
PricesByChain: map[uint64]FeeQuoterPriceUpdatePerSource{
chain1: {
TokenPrices: map[common.Address]*big.Int{
stateChain1.LinkToken.Address(): DefaultLinkPrice,
stateChain1.Weth9.Address(): DefaultWethPrice,
},
GasPrices: map[uint64]*big.Int{
chain2: DefaultGasPrice,
},
},
},
},
},
{
Changeset: commoncs.WrapChangeSet(UpdateFeeQuoterDests),
Config: UpdateFeeQuoterDestsConfig{
UpdatesByChain: map[uint64]map[uint64]fee_quoter.FeeQuoterDestChainConfig{
chain1: {
chain2: DefaultFeeQuoterDestChainConfig(),
},
},
},
},
{
Changeset: commoncs.WrapChangeSet(UpdateOffRampSources),
Config: UpdateOffRampSourcesConfig{
UpdatesByChain: map[uint64]map[uint64]OffRampSourceUpdate{
chain2: {
chain1: {
IsEnabled: true,
TestRouter: true,
},
},
},
},
},
{
Changeset: commoncs.WrapChangeSet(UpdateRouterRamps),
Config: UpdateRouterRampsConfig{
TestRouter: true,
UpdatesByChain: map[uint64]RouterUpdates{
// onRamp update on source chain
chain1: {
OnRampUpdates: map[uint64]bool{
chain2: true,
},
},
// offramp update on dest chain
chain2: {
OffRampUpdates: map[uint64]bool{
chain1: true,
},
},
},
},
},
})
require.NoError(t, err)
AddLaneWithDefaultPricesAndFeeQuoterConfig(t, &e, state, chain1, chain2, true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha we removed this and now its back, I actually copy/pasted the above code for my PR but I guess having this helper is fine.

// Need to keep track of the block number for each chain so that event subscription can be done from that block.
startBlocks := make(map[uint64]*uint64)
// Send a message from each chain to every other chain.
Expand Down
8 changes: 4 additions & 4 deletions deployment/ccip/changeset/cs_ccip_home_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func Test_PromoteCandidate(t *testing.T) {
} {
t.Run(tc.name, func(t *testing.T) {
ctx := testcontext.Get(t)
tenv := NewMemoryEnvironment(t,
tenv, _ := NewMemoryEnvironment(t,
WithChains(2),
WithNodes(4))
state, err := LoadOnchainState(tenv.Env)
Expand Down Expand Up @@ -130,7 +130,7 @@ func Test_SetCandidate(t *testing.T) {
} {
t.Run(tc.name, func(t *testing.T) {
ctx := testcontext.Get(t)
tenv := NewMemoryEnvironment(t,
tenv, _ := NewMemoryEnvironment(t,
WithChains(2),
WithNodes(4))
state, err := LoadOnchainState(tenv.Env)
Expand Down Expand Up @@ -251,7 +251,7 @@ func Test_RevokeCandidate(t *testing.T) {
} {
t.Run(tc.name, func(t *testing.T) {
ctx := testcontext.Get(t)
tenv := NewMemoryEnvironment(t,
tenv, _ := NewMemoryEnvironment(t,
WithChains(2),
WithNodes(4))
state, err := LoadOnchainState(tenv.Env)
Expand Down Expand Up @@ -442,7 +442,7 @@ func Test_UpdateChainConfigs(t *testing.T) {
},
} {
t.Run(tc.name, func(t *testing.T) {
tenv := NewMemoryEnvironment(t, WithChains(3))
tenv, _ := NewMemoryEnvironment(t, WithChains(3))
state, err := LoadOnchainState(tenv.Env)
require.NoError(t, err)

Expand Down
10 changes: 8 additions & 2 deletions deployment/ccip/changeset/cs_chain_contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -792,8 +792,14 @@ func (cfg UpdateRouterRampsConfig) Validate(e deployment.Environment) error {
if chainState.OffRamp == nil {
return fmt.Errorf("missing onramp onramp for chain %d", chainSel)
}
if err := commoncs.ValidateOwnership(e.GetContext(), cfg.MCMS != nil, e.Chains[chainSel].DeployerKey.From, chainState.Timelock.Address(), chainState.Router); err != nil {
return err
if cfg.TestRouter {
if err := commoncs.ValidateOwnership(e.GetContext(), cfg.MCMS != nil, e.Chains[chainSel].DeployerKey.From, chainState.Timelock.Address(), chainState.TestRouter); err != nil {
return err
}
} else {
if err := commoncs.ValidateOwnership(e.GetContext(), cfg.MCMS != nil, e.Chains[chainSel].DeployerKey.From, chainState.Timelock.Address(), chainState.Router); err != nil {
return err
}
}
Comment on lines +795 to 803
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

q: if TestRouter is enabled why not validate ownership of it + the real router? Instead of either/or

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The real router can be owned by MCMS and test router can be owned by deployer key.


for source := range update.OffRampUpdates {
Expand Down
10 changes: 5 additions & 5 deletions deployment/ccip/changeset/cs_chain_contracts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestUpdateOnRampsDests(t *testing.T) {
ctx := testcontext.Get(t)
// Default env just has 2 chains with all contracts
// deployed but no lanes.
tenv := NewMemoryEnvironment(t)
tenv, _ := NewMemoryEnvironment(t)
state, err := LoadOnchainState(tenv.Env)
require.NoError(t, err)

Expand Down Expand Up @@ -106,7 +106,7 @@ func TestUpdateOffRampsSources(t *testing.T) {
} {
t.Run(tc.name, func(t *testing.T) {
ctx := testcontext.Get(t)
tenv := NewMemoryEnvironment(t)
tenv, _ := NewMemoryEnvironment(t)
state, err := LoadOnchainState(tenv.Env)
require.NoError(t, err)

Expand Down Expand Up @@ -176,7 +176,7 @@ func TestUpdateFQDests(t *testing.T) {
} {
t.Run(tc.name, func(t *testing.T) {
ctx := testcontext.Get(t)
tenv := NewMemoryEnvironment(t)
tenv, _ := NewMemoryEnvironment(t)
state, err := LoadOnchainState(tenv.Env)
require.NoError(t, err)

Expand Down Expand Up @@ -244,7 +244,7 @@ func TestUpdateRouterRamps(t *testing.T) {
} {
t.Run(tc.name, func(t *testing.T) {
ctx := testcontext.Get(t)
tenv := NewMemoryEnvironment(t)
tenv, _ := NewMemoryEnvironment(t)
state, err := LoadOnchainState(tenv.Env)
require.NoError(t, err)

Expand Down Expand Up @@ -320,7 +320,7 @@ func TestUpdateNonceManagersCS(t *testing.T) {
},
} {
t.Run(tc.name, func(t *testing.T) {
tenv := NewMemoryEnvironment(t)
tenv, _ := NewMemoryEnvironment(t)
state, err := LoadOnchainState(tenv.Env)
require.NoError(t, err)

Expand Down
2 changes: 1 addition & 1 deletion deployment/ccip/changeset/cs_deploy_chain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func TestDeployChainContractsChangeset(t *testing.T) {

func TestDeployCCIPContracts(t *testing.T) {
t.Parallel()
e := NewMemoryEnvironment(t)
e, _ := NewMemoryEnvironment(t)
// Deploy all the CCIP contracts.
state, err := LoadOnchainState(e.Env)
require.NoError(t, err)
Expand Down
4 changes: 2 additions & 2 deletions deployment/ccip/changeset/cs_home_chain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func TestDeployHomeChain(t *testing.T) {
}

func TestRemoveDonsValidate(t *testing.T) {
e := NewMemoryEnvironment(t)
e, _ := NewMemoryEnvironment(t)
s, err := LoadOnchainState(e.Env)
require.NoError(t, err)
homeChain := s.Chains[e.HomeChainSel]
Expand Down Expand Up @@ -117,7 +117,7 @@ func TestRemoveDonsValidate(t *testing.T) {
}

func TestRemoveDons(t *testing.T) {
e := NewMemoryEnvironment(t)
e, _ := NewMemoryEnvironment(t)
s, err := LoadOnchainState(e.Env)
require.NoError(t, err)
homeChain := s.Chains[e.HomeChainSel]
Expand Down
19 changes: 17 additions & 2 deletions deployment/ccip/changeset/cs_update_rmn_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TestUpdateRMNConfig(t *testing.T) {
}

func updateRMNConfig(t *testing.T, tc updateRMNConfigTestCase) {
e := NewMemoryEnvironment(t)
e, _ := NewMemoryEnvironment(t)

state, err := LoadOnchainState(e.Env)
require.NoError(t, err)
Expand Down Expand Up @@ -220,7 +220,7 @@ func buildRMNRemoteAddressPerChain(e deployment.Environment, state CCIPOnChainSt

func TestSetRMNRemoteOnRMNProxy(t *testing.T) {
t.Parallel()
e := NewMemoryEnvironment(t, WithNoJobsAndContracts())
e, _ := NewMemoryEnvironment(t, WithNoJobsAndContracts())
allChains := e.Env.AllChainSelectors()
mcmsCfg := make(map[uint64]commontypes.MCMSWithTimelockConfig)
var err error
Expand Down Expand Up @@ -265,6 +265,8 @@ func TestSetRMNRemoteOnRMNProxy(t *testing.T) {
CallProxy: state.Chains[chain].CallProxy,
}
}
envNodes, err := deployment.NodeInfo(e.Env.NodeIDs, e.Env.Offchain)
require.NoError(t, err)
e.Env, err = commonchangeset.ApplyChangesets(t, e.Env, timelockContractsPerChain, []commonchangeset.ChangesetApplication{
// transfer ownership of RMNProxy to timelock
{
Expand All @@ -274,6 +276,19 @@ func TestSetRMNRemoteOnRMNProxy(t *testing.T) {
MinDelay: 0,
},
},

{
Changeset: commonchangeset.WrapChangeSet(DeployHomeChain),
Config: DeployHomeChainConfig{
HomeChainSel: e.HomeChainSel,
RMNDynamicConfig: NewTestRMNDynamicConfig(),
RMNStaticConfig: NewTestRMNStaticConfig(),
NodeOperators: NewTestNodeOperator(e.Env.Chains[e.HomeChainSel].DeployerKey.From),
NodeP2PIDsPerNodeOpAdmin: map[string][][32]byte{
"NodeOperator": envNodes.NonBootstraps().PeerIDs(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is "NodeOperator" the name of the nop or something? Would be nice as a constant or determined via some other way?

},
},
},
{
Changeset: commonchangeset.WrapChangeSet(DeployChainContracts),
Config: DeployChainContractsConfig{
Expand Down
2 changes: 1 addition & 1 deletion deployment/ccip/changeset/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

func TestSmokeState(t *testing.T) {
tenv := NewMemoryEnvironment(t, WithChains(3))
tenv, _ := NewMemoryEnvironment(t, WithChains(3))
state, err := LoadOnchainState(tenv.Env)
require.NoError(t, err)
_, err = state.View(tenv.Env.AllChainSelectors())
Expand Down
Loading
Loading