Skip to content

Commit 093ed1b

Browse files
authored
clarify lane hookup (#1324)
* update lanes * update lanes * 1.6.3 fq * tests
1 parent 520275e commit 093ed1b

File tree

9 files changed

+56
-55
lines changed

9 files changed

+56
-55
lines changed

chains/evm/deployment/v1_6_0/changesets/connect_chains_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
chain_selectors "github.com/smartcontractkit/chain-selectors"
1212
"github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment/v1_6_0/sequences"
1313
"github.com/smartcontractkit/chainlink-ccip/chains/evm/gobindings/generated/v1_2_0/router"
14-
"github.com/smartcontractkit/chainlink-ccip/chains/evm/gobindings/generated/v1_6_0/fee_quoter"
14+
"github.com/smartcontractkit/chainlink-ccip/chains/evm/gobindings/generated/v1_6_3/fee_quoter"
1515
"github.com/smartcontractkit/chainlink-ccip/chains/evm/gobindings/generated/v1_6_0/offramp"
1616
"github.com/smartcontractkit/chainlink-ccip/chains/evm/gobindings/generated/v1_6_0/onramp"
1717
cs_core "github.com/smartcontractkit/chainlink-ccip/deployment/utils/changesets"
@@ -180,8 +180,8 @@ func TestConnectChains_EVM2EVM_NoMCMS(t *testing.T) {
180180
Lanes: []lanesapi.LaneConfig{
181181
{
182182
Version: version,
183-
Source: chain1,
184-
Dest: chain2,
183+
ChainA: chain1,
184+
ChainB: chain2,
185185
},
186186
},
187187
})

chains/evm/deployment/v1_6_0/operations/fee_quoter/fee_quoter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"github.com/ethereum/go-ethereum/accounts/abi/bind"
1212

1313
"github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment/utils/operations/contract"
14-
"github.com/smartcontractkit/chainlink-ccip/chains/evm/gobindings/generated/v1_6_0/fee_quoter"
14+
"github.com/smartcontractkit/chainlink-ccip/chains/evm/gobindings/generated/v1_6_3/fee_quoter"
1515
cldf_deployment "github.com/smartcontractkit/chainlink-deployments-framework/deployment"
1616
)
1717

chains/evm/deployment/v1_6_0/sequences/deploy_chain_contracts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
offrampops "github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment/v1_6_0/operations/offramp"
1818
onrampops "github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment/v1_6_0/operations/onramp"
1919
"github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment/v1_6_0/operations/rmn_remote"
20-
"github.com/smartcontractkit/chainlink-ccip/chains/evm/gobindings/generated/v1_6_0/fee_quoter"
20+
"github.com/smartcontractkit/chainlink-ccip/chains/evm/gobindings/generated/v1_6_3/fee_quoter"
2121
deployops "github.com/smartcontractkit/chainlink-ccip/deployment/deploy"
2222
"github.com/smartcontractkit/chainlink-ccip/deployment/utils/sequences"
2323
cldf_chain "github.com/smartcontractkit/chainlink-deployments-framework/chain"

chains/evm/deployment/v1_6_0/sequences/fee_quoter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88

99
"github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment/utils/operations/contract"
1010
fqops "github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment/v1_6_0/operations/fee_quoter"
11-
"github.com/smartcontractkit/chainlink-ccip/chains/evm/gobindings/generated/v1_6_0/fee_quoter"
11+
"github.com/smartcontractkit/chainlink-ccip/chains/evm/gobindings/generated/v1_6_3/fee_quoter"
1212
"github.com/smartcontractkit/chainlink-ccip/deployment/utils/sequences"
1313
cldf_chain "github.com/smartcontractkit/chainlink-deployments-framework/chain"
1414
"github.com/smartcontractkit/chainlink-deployments-framework/operations"

chains/evm/deployment/v1_6_0/sequences/update_lanes.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"github.com/ethereum/go-ethereum/common"
99

1010
"github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment/v1_2_0/operations/router"
11-
"github.com/smartcontractkit/chainlink-ccip/chains/evm/gobindings/generated/v1_6_0/fee_quoter"
11+
"github.com/smartcontractkit/chainlink-ccip/chains/evm/gobindings/generated/v1_6_3/fee_quoter"
1212
"github.com/smartcontractkit/chainlink-ccip/chains/evm/gobindings/generated/v1_6_0/offramp"
1313
"github.com/smartcontractkit/chainlink-ccip/chains/evm/gobindings/generated/v1_6_0/onramp"
1414
"github.com/smartcontractkit/chainlink-ccip/deployment/lanes"
@@ -67,7 +67,7 @@ var ConfigureLaneLegAsSource = operations.NewSequence(
6767
{
6868
Router: common.BytesToAddress(input.Source.Router),
6969
DestChainSelector: input.Dest.Selector,
70-
AllowlistEnabled: input.Source.AllowListEnabled,
70+
AllowlistEnabled: input.Dest.AllowListEnabled,
7171
},
7272
},
7373
},
@@ -110,15 +110,15 @@ var ConfigureLaneLegAsDest = operations.NewSequence(
110110
b.Logger.Info("EVM Configuring lane leg as destination:", input)
111111

112112
result, err := sequences.RunAndMergeSequence(b, chains, OffRampApplySourceChainConfigUpdatesSequence, OffRampApplySourceChainConfigUpdatesSequenceInput{
113-
Address: common.BytesToAddress(input.Source.OffRamp),
113+
Address: common.BytesToAddress(input.Dest.OffRamp),
114114
UpdatesByChain: map[uint64][]offramp.OffRampSourceChainConfigArgs{
115-
input.Source.Selector: {
115+
input.Dest.Selector: {
116116
{
117-
Router: common.BytesToAddress(input.Source.Router),
118-
SourceChainSelector: input.Dest.Selector,
119-
OnRamp: input.Dest.OnRamp,
117+
Router: common.BytesToAddress(input.Dest.Router),
118+
SourceChainSelector: input.Source.Selector,
119+
OnRamp: input.Source.OnRamp,
120120
IsEnabled: !input.IsDisabled,
121-
IsRMNVerificationDisabled: !input.Dest.RMNVerificationEnabled,
121+
IsRMNVerificationDisabled: !input.Source.RMNVerificationEnabled,
122122
},
123123
},
124124
},
@@ -129,8 +129,8 @@ var ConfigureLaneLegAsDest = operations.NewSequence(
129129
b.Logger.Info("Destination configs updated on OffRamps")
130130

131131
offrampUpdate := router.OffRamp{
132-
SourceChainSelector: input.Dest.Selector,
133-
OffRamp: common.BytesToAddress(input.Dest.OffRamp),
132+
SourceChainSelector: input.Source.Selector,
133+
OffRamp: common.BytesToAddress(input.Source.OffRamp),
134134
}
135135
var offRampAdds []router.OffRamp
136136
var offRampRemoves []router.OffRamp
@@ -140,9 +140,9 @@ var ConfigureLaneLegAsDest = operations.NewSequence(
140140
offRampAdds = []router.OffRamp{offrampUpdate}
141141
}
142142
result, err = sequences.RunAndMergeSequence(b, chains, RouterApplyRampUpdatesSequence, RouterApplyRampUpdatesSequenceInput{
143-
Address: common.BytesToAddress(input.Source.Router),
143+
Address: common.BytesToAddress(input.Dest.Router),
144144
UpdatesByChain: map[uint64]router.ApplyRampsUpdatesArgs{
145-
input.Source.Selector: {
145+
input.Dest.Selector: {
146146
OffRampAdds: offRampAdds,
147147
OffRampRemoves: offRampRemoves,
148148
},

chains/solana/deployment/v1_6_0/sequences/connect_chains.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,18 @@ var ConfigureLaneLegAsDest = operations.NewSequence(
7272
func(b operations.Bundle, chains cldf_chain.BlockChains, input lanes.UpdateLanesInput) (sequences.OnChainOutput, error) {
7373
var result sequences.OnChainOutput
7474
b.Logger.Info("SVM Configuring lane leg as destination:", input)
75-
feeQuoterAddress := solana.PublicKeyFromBytes(input.Source.FeeQuoter)
76-
offRampAddress := solana.PublicKeyFromBytes(input.Source.OffRamp)
77-
ccipRouterProgram := solana.PublicKeyFromBytes(input.Source.Router)
75+
feeQuoterAddress := solana.PublicKeyFromBytes(input.Dest.FeeQuoter)
76+
offRampAddress := solana.PublicKeyFromBytes(input.Dest.OffRamp)
77+
ccipRouterProgram := solana.PublicKeyFromBytes(input.Dest.Router)
7878
fee_quoter.SetProgramID(feeQuoterAddress)
7979
ccip_offramp.SetProgramID(offRampAddress)
8080
ccip_router.SetProgramID(ccipRouterProgram)
8181

8282
// OffRamp must be added to Router before initialization
83-
out, err := operations.ExecuteOperation(b, routerops.AddOffRamp, chains.SolanaChains()[input.Source.Selector], routerops.ConnectChainsParams{
83+
out, err := operations.ExecuteOperation(b, routerops.AddOffRamp, chains.SolanaChains()[input.Dest.Selector], routerops.ConnectChainsParams{
8484
Router: ccipRouterProgram,
8585
OffRamp: offRampAddress,
86-
RemoteChainSelector: input.Dest.Selector,
86+
RemoteChainSelector: input.Source.Selector,
8787
AllowlistEnabled: input.Source.AllowListEnabled,
8888
AllowedSenders: TranslateAllowlist(input.Source.AllowList),
8989
})
@@ -94,10 +94,10 @@ var ConfigureLaneLegAsDest = operations.NewSequence(
9494
result.BatchOps = append(result.BatchOps, out.Output.BatchOps...)
9595

9696
// Add DestChain to OffRamp
97-
_, err = operations.ExecuteOperation(b, offrampops.ConnectChains, chains.SolanaChains()[input.Source.Selector], offrampops.ConnectChainsParams{
98-
RemoteChainSelector: input.Dest.Selector,
97+
_, err = operations.ExecuteOperation(b, offrampops.ConnectChains, chains.SolanaChains()[input.Dest.Selector], offrampops.ConnectChainsParams{
98+
RemoteChainSelector: input.Source.Selector,
9999
OffRamp: offRampAddress,
100-
SourceOnRamp: input.Dest.OffRamp,
100+
SourceOnRamp: input.Source.OffRamp,
101101
EnabledAsSource: !input.IsDisabled,
102102
})
103103
if err != nil {

deployment/lanes/connect_chains.go

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,62 +28,63 @@ func makeApply(laneRegistry *LaneAdapterRegistry, mcmsRegistry *changesets.MCMSR
2828
reports := make([]cldf_ops.Report[any, any], 0)
2929

3030
for _, lane := range cfg.Lanes {
31-
src, dest := &lane.Source, &lane.Dest
32-
srcFamily, err := chain_selectors.GetSelectorFamily(src.Selector)
31+
chainA, chainB := &lane.ChainA, &lane.ChainB
32+
chainAFamily, err := chain_selectors.GetSelectorFamily(chainA.Selector)
3333
if err != nil {
3434
return cldf.ChangesetOutput{}, err
3535
}
36-
srcAdapter, exists := laneRegistry.GetLaneAdapter(srcFamily, lane.Version)
36+
chainAAdapter, exists := laneRegistry.GetLaneAdapter(chainAFamily, lane.Version)
3737
if !exists {
38-
return cldf.ChangesetOutput{}, fmt.Errorf("no ChainAdapter registered for chain family '%s'", srcFamily)
38+
return cldf.ChangesetOutput{}, fmt.Errorf("no ChainAdapter registered for chain family '%s'", chainAFamily)
3939
}
40-
destFamily, err := chain_selectors.GetSelectorFamily(dest.Selector)
40+
chainBFamily, err := chain_selectors.GetSelectorFamily(chainB.Selector)
4141
if err != nil {
4242
return cldf.ChangesetOutput{}, err
4343
}
44-
destAdapter, exists := laneRegistry.GetLaneAdapter(destFamily, lane.Version)
44+
chainBAdapter, exists := laneRegistry.GetLaneAdapter(chainBFamily, lane.Version)
4545
if !exists {
46-
return cldf.ChangesetOutput{}, fmt.Errorf("no ChainAdapter registered for chain family '%s'", destFamily)
46+
return cldf.ChangesetOutput{}, fmt.Errorf("no ChainAdapter registered for chain family '%s'", chainBFamily)
4747
}
48-
err = populateAddresses(&e, src, srcAdapter)
48+
err = populateAddresses(&e, chainA, chainAAdapter)
4949
if err != nil {
50-
return cldf.ChangesetOutput{}, fmt.Errorf("error fetching address for src chain %d: %w", src.Selector, err)
50+
return cldf.ChangesetOutput{}, fmt.Errorf("error fetching address for src chain %d: %w", chainA.Selector, err)
5151
}
52-
err = populateAddresses(&e, dest, destAdapter)
52+
err = populateAddresses(&e, chainB, chainBAdapter)
5353
if err != nil {
54-
return cldf.ChangesetOutput{}, fmt.Errorf("error fetching address for dest chain %d: %w", dest.Selector, err)
54+
return cldf.ChangesetOutput{}, fmt.Errorf("error fetching address for dest chain %d: %w", chainB.Selector, err)
5555
}
5656
type lanePair struct {
57-
chainA *ChainDefinition
58-
chainB *ChainDefinition
59-
adapter LaneAdapter
57+
src *ChainDefinition
58+
dest *ChainDefinition
59+
srcAdapter LaneAdapter
60+
destAdapter LaneAdapter
6061
}
6162
for _, pair := range []lanePair{
62-
{chainA: src, chainB: dest, adapter: srcAdapter},
63-
{chainA: dest, chainB: src, adapter: destAdapter},
63+
{src: chainA, dest: chainB, srcAdapter: chainAAdapter, destAdapter: chainBAdapter},
64+
{src: chainB, dest: chainA, srcAdapter: chainBAdapter, destAdapter: chainAAdapter},
6465
} {
65-
configureLaneReport, err := cldf_ops.ExecuteSequence(e.OperationsBundle, pair.adapter.ConfigureLaneLegAsSource(), e.BlockChains, UpdateLanesInput{
66-
Source: pair.chainA,
67-
Dest: pair.chainB,
66+
configureLaneReport, err := cldf_ops.ExecuteSequence(e.OperationsBundle, pair.srcAdapter.ConfigureLaneLegAsSource(), e.BlockChains, UpdateLanesInput{
67+
Source: pair.src,
68+
Dest: pair.dest,
6869
IsDisabled: lane.IsDisabled,
6970
TestRouter: lane.TestRouter,
7071
ExtraConfigs: lane.ExtraConfigs,
7172
})
7273
if err != nil {
73-
return cldf.ChangesetOutput{}, fmt.Errorf("failed to configure token pool on chain with selector %d: %w", src.Selector, err)
74+
return cldf.ChangesetOutput{}, fmt.Errorf("failed to lane leg as source with selector %d: %w", pair.src.Selector, err)
7475
}
7576
batchOps = append(batchOps, configureLaneReport.Output.BatchOps...)
7677
reports = append(reports, configureLaneReport.ExecutionReports...)
7778

78-
configureLaneReport, err = cldf_ops.ExecuteSequence(e.OperationsBundle, pair.adapter.ConfigureLaneLegAsDest(), e.BlockChains, UpdateLanesInput{
79-
Source: pair.chainA,
80-
Dest: pair.chainB,
79+
configureLaneReport, err = cldf_ops.ExecuteSequence(e.OperationsBundle, pair.destAdapter.ConfigureLaneLegAsDest(), e.BlockChains, UpdateLanesInput{
80+
Source: pair.src,
81+
Dest: pair.dest,
8182
IsDisabled: lane.IsDisabled,
8283
TestRouter: lane.TestRouter,
8384
ExtraConfigs: lane.ExtraConfigs,
8485
})
8586
if err != nil {
86-
return cldf.ChangesetOutput{}, fmt.Errorf("failed to configure lane leg as on chain with selector %d: %w", dest.Selector, err)
87+
return cldf.ChangesetOutput{}, fmt.Errorf("failed to configure lane leg as dest with selector %d: %w", pair.dest.Selector, err)
8788
}
8889
batchOps = append(batchOps, configureLaneReport.Output.BatchOps...)
8990
reports = append(reports, configureLaneReport.ExecutionReports...)

deployment/lanes/lane_update.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ type ConnectChainsConfig struct {
7171
MCMS mcms.Input
7272
}
7373
type LaneConfig struct {
74-
Source ChainDefinition
75-
Dest ChainDefinition
74+
ChainA ChainDefinition
75+
ChainB ChainDefinition
7676
Version *semver.Version
7777
IsDisabled bool
7878
TestRouter bool

integration-tests/deployment/connect_chains_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"github.com/gagliardetto/solana-go"
1212
chain_selectors "github.com/smartcontractkit/chain-selectors"
1313
evmsequences "github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment/v1_6_0/sequences"
14-
evmfq "github.com/smartcontractkit/chainlink-ccip/chains/evm/gobindings/generated/v1_6_0/fee_quoter"
14+
evmfq "github.com/smartcontractkit/chainlink-ccip/chains/evm/gobindings/generated/v1_6_3/fee_quoter"
1515
"github.com/smartcontractkit/chainlink-ccip/chains/evm/gobindings/generated/v1_6_0/offramp"
1616
"github.com/smartcontractkit/chainlink-ccip/chains/evm/gobindings/generated/v1_6_0/onramp"
1717
_ "github.com/smartcontractkit/chainlink-ccip/chains/solana/deployment/v1_6_0/sequences"
@@ -196,8 +196,8 @@ func TestConnectChains_EVM2SVM_NoMCMS(t *testing.T) {
196196
Lanes: []lanesapi.LaneConfig{
197197
{
198198
Version: version,
199-
Source: chain1,
200-
Dest: chain2,
199+
ChainA: chain1,
200+
ChainB: chain2,
201201
},
202202
},
203203
})

0 commit comments

Comments
 (0)