Skip to content

Commit 1306a2c

Browse files
tt-cllskudasovCopilot
authored
solana devenv + message passing (#1494)
* move to common * devenv-impl template integration * wip * up working * up working * svm->evm working * fix startup * e2e * cr * test * generate * consolidate * bump ton * ci * downgrade dep * remove ton * generate * Update devenv/tests/e2e/smoke_test.go Co-authored-by: Copilot <[email protected]> * Update integration-tests/deployment/set_token_transfer_fee_test.go Co-authored-by: Copilot <[email protected]> * gomod * gomod --------- Co-authored-by: skudasov <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 84e93ca commit 1306a2c

File tree

39 files changed

+2492
-667
lines changed

39 files changed

+2492
-667
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var ConfigureLaneLegAsSource = operations.NewSequence(
2323
"Configures lane leg as source on CCIP 1.6.0",
2424
func(b operations.Bundle, chains cldf_chain.BlockChains, input lanes.UpdateLanesInput) (sequences.OnChainOutput, error) {
2525
var result sequences.OnChainOutput
26-
b.Logger.Info("EVM Configuring lane leg as source:", input)
26+
b.Logger.Infof("EVM Configuring lane leg as source: %+v", input)
2727

2828
result, err := sequences.RunAndMergeSequence(b, chains, FeeQuoterApplyDestChainConfigUpdatesSequence, FeeQuoterApplyDestChainConfigUpdatesSequenceInput{
2929
Address: common.BytesToAddress(input.Source.FeeQuoter),
@@ -103,7 +103,7 @@ var ConfigureLaneLegAsDest = operations.NewSequence(
103103
"Configures lane leg as destination on CCIP 1.6.0",
104104
func(b operations.Bundle, chains cldf_chain.BlockChains, input lanes.UpdateLanesInput) (sequences.OnChainOutput, error) {
105105
var result sequences.OnChainOutput
106-
b.Logger.Info("EVM Configuring lane leg as destination:", input)
106+
b.Logger.Infof("EVM Configuring lane leg as destination: %+v", input)
107107

108108
result, err := sequences.RunAndMergeSequence(b, chains, OffRampApplySourceChainConfigUpdatesSequence, OffRampApplySourceChainConfigUpdatesSequenceInput{
109109
Address: common.BytesToAddress(input.Dest.OffRamp),

chains/solana/deployment/utils/deploy.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ func MaybeDeployContract(
2626
contractVersion *semver.Version,
2727
contractQualifier string,
2828
programName string,
29-
programSize int,
3029
) (datastore.AddressRef, error) {
3130
for _, ref := range input {
3231
if ref.Type == datastore.ContractType(contractType) &&
@@ -44,8 +43,7 @@ func MaybeDeployContract(
4443
}
4544
programID, err := chain.DeployProgram(b.Logger, cldf_solana.ProgramInfo{
4645
Name: programName,
47-
Bytes: programSize,
48-
}, false, true)
46+
}, false, false)
4947
if err != nil {
5048
return datastore.AddressRef{}, err
5149
}

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ var Deploy = operations.NewOperation(
4444
ContractType,
4545
Version,
4646
"",
47-
ProgramName,
48-
ProgramSize)
47+
ProgramName)
4948
},
5049
)
5150

@@ -135,7 +134,7 @@ var ConnectChains = operations.NewOperation(
135134
var destChainStateAccount fee_quoter.DestChain
136135
err := chain.GetAccountDataBorshInto(context.Background(), fqRemoteChainPDA, &destChainStateAccount)
137136
if err == nil {
138-
fmt.Println("Remote chain state account found:", destChainStateAccount)
137+
b.Logger.Infof("Remote chain state account found: %+v", destChainStateAccount)
139138
isUpdate = true
140139
}
141140
var ixn solana.Instruction

chains/solana/deployment/v1_6_0/operations/mcms/mcms.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ var AccessControllerDeploy = operations.NewOperation(
5050
utils.AccessControllerProgramType,
5151
common_utils.Version_1_6_0,
5252
"",
53-
AccessControllerProgramName,
54-
AccessControllerProgramSize)
53+
AccessControllerProgramName)
5554
},
5655
)
5756

@@ -67,8 +66,7 @@ var TimelockDeploy = operations.NewOperation(
6766
utils.TimelockProgramType,
6867
common_utils.Version_1_6_0,
6968
"",
70-
TimelockProgramName,
71-
TimelockProgramSize)
69+
TimelockProgramName)
7270
},
7371
)
7472

@@ -84,8 +82,7 @@ var McmDeploy = operations.NewOperation(
8482
utils.McmProgramType,
8583
common_utils.Version_1_6_0,
8684
"",
87-
McmProgramName,
88-
McmProgramSize)
85+
McmProgramName)
8986
},
9087
)
9188

chains/solana/deployment/v1_6_0/operations/offramp/offramp.go

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,11 @@ type Params struct {
3838
}
3939

4040
type ConnectChainsParams struct {
41-
OffRamp solana.PublicKey
42-
RemoteChainSelector uint64
43-
SourceOnRamp []byte
44-
EnabledAsSource bool
41+
OffRamp solana.PublicKey
42+
RemoteChainSelector uint64
43+
SourceOnRamp []byte
44+
EnabledAsSource bool
45+
IsRMNVerificationDisabled bool
4546
}
4647

4748
type SetOcr3Params struct {
@@ -61,8 +62,7 @@ var Deploy = operations.NewOperation(
6162
ContractType,
6263
Version,
6364
"",
64-
ProgramName,
65-
ProgramSize)
65+
ProgramName)
6666
},
6767
)
6868

@@ -156,6 +156,7 @@ var ConnectChains = operations.NewOperation(
156156
Version,
157157
"Connects the OffRamp 1.6.0 contract to other chains",
158158
func(b operations.Bundle, chain cldf_solana.Chain, input ConnectChainsParams) (sequences.OnChainOutput, error) {
159+
b.Logger.Infof("Connecting OffRamp to remote chain %+v", input)
159160
ccip_offramp.SetProgramID(input.OffRamp)
160161
isUpdate := false
161162
authority := GetAuthority(chain, input.OffRamp)
@@ -164,21 +165,24 @@ var ConnectChains = operations.NewOperation(
164165
var sourceChainAccount ccip_offramp.SourceChain
165166
err := chain.GetAccountDataBorshInto(context.Background(), offRampSourceChainPDA, &sourceChainAccount)
166167
if err == nil {
167-
fmt.Println("Remote chain state account found:", sourceChainAccount)
168+
b.Logger.Infof("Remote chain state account found: %+v", sourceChainAccount)
168169
isUpdate = true
169170
}
170171
var onRampAddress ccip_offramp.OnRampAddress
171172
copy(onRampAddress.Bytes[:], input.SourceOnRamp)
172-
addressBytesLen := len(onRampAddress.Bytes)
173+
addressBytesLen := len(input.SourceOnRamp)
173174
if addressBytesLen < 0 || addressBytesLen > math.MaxUint32 {
174175
return sequences.OnChainOutput{}, fmt.Errorf("invalid on ramp address length: %d", addressBytesLen)
175176
}
176177
onRampAddress.Len = uint32(addressBytesLen)
177178
validSourceChainConfig := ccip_offramp.SourceChainConfig{
178-
OnRamp: onRampAddress,
179-
IsEnabled: input.EnabledAsSource,
179+
OnRamp: onRampAddress,
180+
IsEnabled: input.EnabledAsSource,
181+
IsRmnVerificationDisabled: input.IsRMNVerificationDisabled,
180182
}
183+
b.Logger.Infof("Source chain config to be set: %+v", validSourceChainConfig)
181184
var ixn solana.Instruction
185+
var addressRefs []datastore.AddressRef
182186
batches := make([]types.BatchOperation, 0)
183187
if isUpdate {
184188
ixn, err = ccip_offramp.NewUpdateSourceChainConfigInstruction(
@@ -207,6 +211,13 @@ var ConnectChains = operations.NewOperation(
207211
if err != nil {
208212
return sequences.OnChainOutput{}, fmt.Errorf("failed to extend OffRamp lookup table: %w", err)
209213
}
214+
addressRefs = append(addressRefs, datastore.AddressRef{
215+
Address: offRampSourceChainPDA.String(),
216+
ChainSelector: chain.Selector,
217+
Type: datastore.ContractType(SourceChainType),
218+
Version: Version,
219+
Qualifier: strconv.FormatUint(input.RemoteChainSelector, 10),
220+
})
210221
}
211222
if authority != chain.DeployerKey.PublicKey() {
212223
b, err := utils.BuildMCMSBatchOperation(
@@ -225,16 +236,9 @@ var ConnectChains = operations.NewOperation(
225236
return sequences.OnChainOutput{}, fmt.Errorf("failed to confirm add price updater: %w", err)
226237
}
227238
}
228-
sourceRef := datastore.AddressRef{
229-
Address: offRampSourceChainPDA.String(),
230-
ChainSelector: chain.Selector,
231-
Type: datastore.ContractType(SourceChainType),
232-
Version: Version,
233-
Qualifier: strconv.FormatUint(input.RemoteChainSelector, 10),
234-
}
235239
return sequences.OnChainOutput{
236240
BatchOps: batches,
237-
Addresses: []datastore.AddressRef{sourceRef},
241+
Addresses: addressRefs,
238242
}, nil
239243
},
240244
)

chains/solana/deployment/v1_6_0/operations/rmn_remote/rmn_remote.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ var Deploy = operations.NewOperation(
4343
ContractType,
4444
Version,
4545
"",
46-
ProgramName,
47-
ProgramSize)
46+
ProgramName)
4847
},
4948
)
5049

chains/solana/deployment/v1_6_0/operations/router/router.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ var Deploy = operations.NewOperation(
4646
ContractType,
4747
Version,
4848
"",
49-
ProgramName,
50-
ProgramSize)
49+
ProgramName)
5150
},
5251
)
5352

@@ -99,14 +98,15 @@ var ConnectChains = operations.NewOperation(
9998
var destChainAccount ccip_router.DestChain
10099
err := chain.GetAccountDataBorshInto(context.Background(), routerDestChainPDA, &destChainAccount)
101100
if err == nil {
102-
fmt.Println("Remote chain state account found:", destChainAccount)
101+
b.Logger.Infof("Remote chain state account found: %+v", destChainAccount)
103102
isUpdate = true
104103
}
105104
destChainConfig := ccip_router.DestChainConfig{
106105
AllowedSenders: input.AllowedSenders,
107106
AllowListEnabled: input.AllowlistEnabled,
108107
}
109108
var ixn solana.Instruction
109+
var addressRefs []datastore.AddressRef
110110
batches := make([]types.BatchOperation, 0)
111111
if isUpdate {
112112
ixn, err = ccip_router.NewUpdateDestChainConfigInstruction(
@@ -136,13 +136,13 @@ var ConnectChains = operations.NewOperation(
136136
if err != nil {
137137
return sequences.OnChainOutput{}, fmt.Errorf("failed to extend OffRamp lookup table: %w", err)
138138
}
139-
}
140-
sourceRef := datastore.AddressRef{
141-
Address: routerDestChainPDA.String(),
142-
ChainSelector: chain.Selector,
143-
Type: datastore.ContractType(DestChainType),
144-
Version: Version,
145-
Qualifier: strconv.FormatUint(input.RemoteChainSelector, 10),
139+
addressRefs = append(addressRefs, datastore.AddressRef{
140+
Address: routerDestChainPDA.String(),
141+
ChainSelector: chain.Selector,
142+
Type: datastore.ContractType(DestChainType),
143+
Version: Version,
144+
Qualifier: strconv.FormatUint(input.RemoteChainSelector, 10),
145+
})
146146
}
147147
if authority != chain.DeployerKey.PublicKey() {
148148
b, err := utils.BuildMCMSBatchOperation(
@@ -163,7 +163,7 @@ var ConnectChains = operations.NewOperation(
163163
}
164164
return sequences.OnChainOutput{
165165
BatchOps: batches,
166-
Addresses: []datastore.AddressRef{sourceRef},
166+
Addresses: addressRefs,
167167
}, nil
168168
},
169169
)
@@ -179,7 +179,7 @@ var AddOffRamp = operations.NewOperation(
179179
offRampSourceChainPDA, _, _ := state.FindOfframpSourceChainPDA(input.RemoteChainSelector, input.OffRamp)
180180
err := chain.GetAccountDataBorshInto(context.Background(), offRampSourceChainPDA, &sourceChainAccount)
181181
if err == nil {
182-
b.Logger.Info("Remote chain state account found:", sourceChainAccount)
182+
b.Logger.Infof("Remote chain state account found: %+v", sourceChainAccount)
183183
return sequences.OnChainOutput{}, nil
184184
}
185185
routerConfigPDA, _, _ := state.FindConfigPDA(input.Router)
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
package test_receiver
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/Masterminds/semver/v3"
7+
"github.com/gagliardetto/solana-go"
8+
"github.com/smartcontractkit/chainlink-ccip/chains/solana/deployment/utils"
9+
"github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings/latest/test_ccip_receiver"
10+
"github.com/smartcontractkit/chainlink-ccip/deployment/utils/sequences"
11+
cldf_solana "github.com/smartcontractkit/chainlink-deployments-framework/chain/solana"
12+
"github.com/smartcontractkit/chainlink-deployments-framework/datastore"
13+
cldf_deployment "github.com/smartcontractkit/chainlink-deployments-framework/deployment"
14+
"github.com/smartcontractkit/chainlink-deployments-framework/operations"
15+
)
16+
17+
var ContractType cldf_deployment.ContractType = "TestReceiver"
18+
var Version *semver.Version = semver.MustParse("1.6.0")
19+
var ProgramName = "test_ccip_receiver"
20+
21+
var Deploy = operations.NewOperation(
22+
"receiver:deploy",
23+
Version,
24+
"Deploys the Receiver program",
25+
func(b operations.Bundle, chain cldf_solana.Chain, input []datastore.AddressRef) (datastore.AddressRef, error) {
26+
return utils.MaybeDeployContract(
27+
b,
28+
chain,
29+
input,
30+
ContractType,
31+
Version,
32+
"",
33+
ProgramName)
34+
},
35+
)
36+
37+
var Initialize = operations.NewOperation(
38+
"receiver:initialize",
39+
Version,
40+
"Initializes the Receiver 1.6.0 contract",
41+
func(b operations.Bundle, chain cldf_solana.Chain, input Params) (sequences.OnChainOutput, error) {
42+
test_ccip_receiver.SetProgramID(input.Receiver)
43+
externalExecutionConfigPDA, _, _ := solana.FindProgramAddress([][]byte{[]byte("external_execution_config")}, input.Receiver)
44+
receiverTargetAccount, _, _ := solana.FindProgramAddress([][]byte{[]byte("counter")}, input.Receiver)
45+
instruction, err := test_ccip_receiver.NewInitializeInstruction(
46+
input.Router,
47+
receiverTargetAccount,
48+
externalExecutionConfigPDA,
49+
chain.DeployerKey.PublicKey(),
50+
solana.SystemProgramID,
51+
).ValidateAndBuild()
52+
if err != nil {
53+
return sequences.OnChainOutput{}, fmt.Errorf("failed to build initialize instruction: %w", err)
54+
}
55+
if err := chain.Confirm([]solana.Instruction{instruction}); err != nil {
56+
return sequences.OnChainOutput{}, fmt.Errorf("failed to confirm instructions: %w", err)
57+
}
58+
return sequences.OnChainOutput{}, nil
59+
},
60+
)
61+
62+
type Params struct {
63+
Router solana.PublicKey
64+
Receiver solana.PublicKey
65+
}

chains/solana/deployment/v1_6_0/operations/tokens/tokens.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ var DeployLINK = operations.NewOperation(
4545
return datastore.AddressRef{
4646
ChainSelector: chain.Selector,
4747
Address: input.TokenPrivKey.PublicKey().String(),
48+
Version: Version,
4849
Type: datastore.ContractType(LinkContractType),
4950
}, nil
5051
},

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var ConfigureLaneLegAsSource = operations.NewSequence(
2424
"Configures lane leg as source on CCIP 1.6.0",
2525
func(b operations.Bundle, chains cldf_chain.BlockChains, input lanes.UpdateLanesInput) (sequences.OnChainOutput, error) {
2626
var result sequences.OnChainOutput
27-
b.Logger.Info("SVM Configuring lane leg as source:", input)
27+
b.Logger.Infof("SVM Configuring lane leg as source: %+v", input)
2828
feeQuoterAddress := solana.PublicKeyFromBytes(input.Source.FeeQuoter)
2929
offRampAddress := solana.PublicKeyFromBytes(input.Source.OffRamp)
3030
ccipRouterProgram := solana.PublicKeyFromBytes(input.Source.Router)
@@ -66,7 +66,7 @@ var ConfigureLaneLegAsDest = operations.NewSequence(
6666
"Configures lane leg as destination on CCIP 1.6.0",
6767
func(b operations.Bundle, chains cldf_chain.BlockChains, input lanes.UpdateLanesInput) (sequences.OnChainOutput, error) {
6868
var result sequences.OnChainOutput
69-
b.Logger.Info("SVM Configuring lane leg as destination:", input)
69+
b.Logger.Infof("SVM Configuring lane leg as destination: %+v", input)
7070
offRampAddress := solana.PublicKeyFromBytes(input.Dest.OffRamp)
7171
ccipRouterProgram := solana.PublicKeyFromBytes(input.Dest.Router)
7272

@@ -88,8 +88,9 @@ var ConfigureLaneLegAsDest = operations.NewSequence(
8888
offRampOut, err := operations.ExecuteOperation(b, offrampops.ConnectChains, chains.SolanaChains()[input.Dest.Selector], offrampops.ConnectChainsParams{
8989
RemoteChainSelector: input.Source.Selector,
9090
OffRamp: offRampAddress,
91-
SourceOnRamp: input.Source.OffRamp,
91+
SourceOnRamp: input.Source.OnRamp,
9292
EnabledAsSource: !input.IsDisabled,
93+
IsRMNVerificationDisabled: !input.Source.RMNVerificationEnabled,
9394
})
9495
if err != nil {
9596
return sequences.OnChainOutput{}, fmt.Errorf("failed to initialize OffRamp: %w", err)

0 commit comments

Comments
 (0)