Skip to content

Commit

Permalink
[NONEVM-1319] - Solana Contract Reader Dest and Source cfg (#16308)
Browse files Browse the repository at this point in the history
* Implement Solana Contract Reader config and bump chainlink-solana

* Update CR config

* Resolve more TODOs from Contract Reader config

* Bump solana

* Progress on CR config

* Add comments to CR config

* Bump chainlink-ccip/chains/solana in core too

* Use feeQuoterIDL

* Fix CR config issues

* Simplify CR config and add a TODO

* Remove CR config resolved TODOs and add serialisation test

* Add MethodNameOffRampLatestConfigDetails to CR config

* Fix cfg

* Upgraded chainlink-common dependency

* Bump common and resolve OffRampLatestConfigDetails issues

* Fixed linting

---------

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
Co-authored-by: amit-momin <amit.momin@smartcontract.com>
  • Loading branch information
3 people authored Feb 15, 2025
1 parent 13b7d5a commit 6272fc5
Show file tree
Hide file tree
Showing 14 changed files with 512 additions and 22 deletions.
4 changes: 2 additions & 2 deletions core/capabilities/ccip/configs/solana/chain_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,8 @@ func GetSolanaChainWriterConfig(offrampProgramAddress string, fromAddress string
Programs: map[string]chainwriter.ProgramConfig{
ccipconsts.ContractNameOffRamp: {
Methods: map[string]chainwriter.MethodConfig{
ccipconsts.MethodExecute: getExecuteMethodConfig(fromAddress, offrampProgramAddress),
ccipconsts.MethodCommit: getCommitMethodConfig(fromAddress, offrampProgramAddress, destChainSelector, false),
ccipconsts.MethodExecute: getExecuteMethodConfig(fromAddress, offrampProgramAddress),
ccipconsts.MethodCommit: getCommitMethodConfig(fromAddress, offrampProgramAddress, destChainSelector, false),
ccipconsts.MethodCommitPriceOnly: getCommitMethodConfig(fromAddress, offrampProgramAddress, destChainSelector, true),
},
IDL: ccipOfframpIDL,
Expand Down
458 changes: 456 additions & 2 deletions core/capabilities/ccip/configs/solana/contract_reader.go

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions core/capabilities/ccip/configs/solana/contract_reader_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package solana

import (
"encoding/json"
"testing"

"github.com/stretchr/testify/require"

"github.com/smartcontractkit/chainlink-solana/pkg/solana/config"
)

func TestContractReaderConfigRaw(t *testing.T) {
cfg, err := DestContractReaderConfig()
require.NoError(t, err)

raw, err := json.Marshal(cfg)
require.NoError(t, err)

var result config.ContractReader
require.NoError(t, json.Unmarshal(raw, &result))
require.EqualValues(t, cfg, result)

cfg, err = SourceContractReaderConfig()
require.NoError(t, err)

raw, err = json.Marshal(cfg)
require.NoError(t, err)
require.NoError(t, json.Unmarshal(raw, &result))
require.EqualValues(t, cfg, result)
}
12 changes: 9 additions & 3 deletions core/capabilities/ccip/oraclecreator/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,12 +540,18 @@ func getChainReaderConfig(

return marshaledConfig, nil
case relay.NetworkSolana:
// TODO update chain reader config in contract_reader.go
var err error
var cfg config.ContractReader
if chainID == destChainID {
cfg = solanaconfig.DestReaderConfig
cfg, err = solanaconfig.DestContractReaderConfig()
if err != nil {
return nil, fmt.Errorf("failed to get Solana dest contract reader config: %w", err)
}
} else {
cfg = solanaconfig.SourceReaderConfig
cfg, err = solanaconfig.SourceContractReaderConfig()
if err != nil {
return nil, fmt.Errorf("failed to get Solana source contract reader config: %w", err)
}
}

marshaledConfig, err := json.Marshal(cfg)
Expand Down
2 changes: 1 addition & 1 deletion core/scripts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ require (
github.com/prometheus/client_golang v1.20.5
github.com/shopspring/decimal v1.4.0
github.com/smartcontractkit/chainlink-automation v0.8.1
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250205141137-8f50d72601bb
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250214231858-f365e2bdecea
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20250128203428-08031923fbe5
github.com/smartcontractkit/chainlink-integrations/evm v0.0.0-20250213145514-41d874782c02
github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.22
Expand Down
4 changes: 2 additions & 2 deletions core/scripts/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1127,8 +1127,8 @@ github.com/smartcontractkit/chainlink-ccip v0.0.0-20250214202341-4190f2db1c01 h1
github.com/smartcontractkit/chainlink-ccip v0.0.0-20250214202341-4190f2db1c01/go.mod h1:Hht/OJq/PxC+gnBCIPyzHt4Otsw6mYwUVsmtOqIvlxo=
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250214202341-4190f2db1c01 h1:R3OD6Phi0ULIQ2uvHiKVWYdgpi/O1Mt46CUK1UApcXU=
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250214202341-4190f2db1c01/go.mod h1:Bmwq4lNb5tE47sydN0TKetcLEGbgl+VxHEWp4S0LI60=
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250205141137-8f50d72601bb h1:1VC/hN1ojPiEWCsjxhvcw4p1Zveo90O38VQhktvo3Ag=
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250205141137-8f50d72601bb/go.mod h1:Z2e1ynSJ4pg83b4Qldbmryc5lmnrI3ojOdg1FUloa68=
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250214231858-f365e2bdecea h1:/1f/pWf7vSV9acTR9UPn2exPAwQG/LHGa4l9OywhS00=
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250214231858-f365e2bdecea/go.mod h1:Z2e1ynSJ4pg83b4Qldbmryc5lmnrI3ojOdg1FUloa68=
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20250128203428-08031923fbe5 h1:CvDfgWoLoYPapOumE/UZCplfCu5oNmy9BuH+6V6+fJ8=
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20250128203428-08031923fbe5/go.mod h1:pDZagSGjs9U+l4YIFhveDznMHqxuuz+5vRxvVgpbdr8=
github.com/smartcontractkit/chainlink-feeds v0.1.1 h1:JzvUOM/OgGQA1sOqTXXl52R6AnNt+Wg64sVG+XSA49c=
Expand Down
2 changes: 1 addition & 1 deletion deployment/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ require (
github.com/smartcontractkit/chain-selectors v1.0.40
github.com/smartcontractkit/chainlink-ccip v0.0.0-20250214202341-4190f2db1c01
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250214202341-4190f2db1c01
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250205141137-8f50d72601bb
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250214231858-f365e2bdecea
github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20250211162441-3d6cea220efb
github.com/smartcontractkit/chainlink-integrations/evm v0.0.0-20250213145514-41d874782c02
github.com/smartcontractkit/chainlink-protos/job-distributor v0.6.0
Expand Down
4 changes: 2 additions & 2 deletions deployment/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1130,8 +1130,8 @@ github.com/smartcontractkit/chainlink-ccip v0.0.0-20250214202341-4190f2db1c01 h1
github.com/smartcontractkit/chainlink-ccip v0.0.0-20250214202341-4190f2db1c01/go.mod h1:Hht/OJq/PxC+gnBCIPyzHt4Otsw6mYwUVsmtOqIvlxo=
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250214202341-4190f2db1c01 h1:R3OD6Phi0ULIQ2uvHiKVWYdgpi/O1Mt46CUK1UApcXU=
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250214202341-4190f2db1c01/go.mod h1:Bmwq4lNb5tE47sydN0TKetcLEGbgl+VxHEWp4S0LI60=
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250205141137-8f50d72601bb h1:1VC/hN1ojPiEWCsjxhvcw4p1Zveo90O38VQhktvo3Ag=
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250205141137-8f50d72601bb/go.mod h1:Z2e1ynSJ4pg83b4Qldbmryc5lmnrI3ojOdg1FUloa68=
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250214231858-f365e2bdecea h1:/1f/pWf7vSV9acTR9UPn2exPAwQG/LHGa4l9OywhS00=
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250214231858-f365e2bdecea/go.mod h1:Z2e1ynSJ4pg83b4Qldbmryc5lmnrI3ojOdg1FUloa68=
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20250128203428-08031923fbe5 h1:CvDfgWoLoYPapOumE/UZCplfCu5oNmy9BuH+6V6+fJ8=
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20250128203428-08031923fbe5/go.mod h1:pDZagSGjs9U+l4YIFhveDznMHqxuuz+5vRxvVgpbdr8=
github.com/smartcontractkit/chainlink-feeds v0.1.1 h1:JzvUOM/OgGQA1sOqTXXl52R6AnNt+Wg64sVG+XSA49c=
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ require (
github.com/smartcontractkit/chainlink-automation v0.8.1
github.com/smartcontractkit/chainlink-ccip v0.0.0-20250214202341-4190f2db1c01
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250214202341-4190f2db1c01
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250205141137-8f50d72601bb
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250214231858-f365e2bdecea
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20250128203428-08031923fbe5
github.com/smartcontractkit/chainlink-feeds v0.1.1
github.com/smartcontractkit/chainlink-framework/chains v0.0.0-20250207205350-420ccacab78a
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1014,8 +1014,8 @@ github.com/smartcontractkit/chainlink-ccip v0.0.0-20250214202341-4190f2db1c01 h1
github.com/smartcontractkit/chainlink-ccip v0.0.0-20250214202341-4190f2db1c01/go.mod h1:Hht/OJq/PxC+gnBCIPyzHt4Otsw6mYwUVsmtOqIvlxo=
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250214202341-4190f2db1c01 h1:R3OD6Phi0ULIQ2uvHiKVWYdgpi/O1Mt46CUK1UApcXU=
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250214202341-4190f2db1c01/go.mod h1:Bmwq4lNb5tE47sydN0TKetcLEGbgl+VxHEWp4S0LI60=
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250205141137-8f50d72601bb h1:1VC/hN1ojPiEWCsjxhvcw4p1Zveo90O38VQhktvo3Ag=
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250205141137-8f50d72601bb/go.mod h1:Z2e1ynSJ4pg83b4Qldbmryc5lmnrI3ojOdg1FUloa68=
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250214231858-f365e2bdecea h1:/1f/pWf7vSV9acTR9UPn2exPAwQG/LHGa4l9OywhS00=
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250214231858-f365e2bdecea/go.mod h1:Z2e1ynSJ4pg83b4Qldbmryc5lmnrI3ojOdg1FUloa68=
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20250128203428-08031923fbe5 h1:CvDfgWoLoYPapOumE/UZCplfCu5oNmy9BuH+6V6+fJ8=
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20250128203428-08031923fbe5/go.mod h1:pDZagSGjs9U+l4YIFhveDznMHqxuuz+5vRxvVgpbdr8=
github.com/smartcontractkit/chainlink-feeds v0.1.1 h1:JzvUOM/OgGQA1sOqTXXl52R6AnNt+Wg64sVG+XSA49c=
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ require (
github.com/smartcontractkit/chain-selectors v1.0.40
github.com/smartcontractkit/chainlink-automation v0.8.1
github.com/smartcontractkit/chainlink-ccip v0.0.0-20250214202341-4190f2db1c01
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250205141137-8f50d72601bb
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250214231858-f365e2bdecea
github.com/smartcontractkit/chainlink-integrations/evm v0.0.0-20250213145514-41d874782c02
github.com/smartcontractkit/chainlink-protos/job-distributor v0.6.0
github.com/smartcontractkit/chainlink-testing-framework/framework v0.5.0
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1382,8 +1382,8 @@ github.com/smartcontractkit/chainlink-ccip v0.0.0-20250214202341-4190f2db1c01 h1
github.com/smartcontractkit/chainlink-ccip v0.0.0-20250214202341-4190f2db1c01/go.mod h1:Hht/OJq/PxC+gnBCIPyzHt4Otsw6mYwUVsmtOqIvlxo=
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250214202341-4190f2db1c01 h1:R3OD6Phi0ULIQ2uvHiKVWYdgpi/O1Mt46CUK1UApcXU=
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250214202341-4190f2db1c01/go.mod h1:Bmwq4lNb5tE47sydN0TKetcLEGbgl+VxHEWp4S0LI60=
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250205141137-8f50d72601bb h1:1VC/hN1ojPiEWCsjxhvcw4p1Zveo90O38VQhktvo3Ag=
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250205141137-8f50d72601bb/go.mod h1:Z2e1ynSJ4pg83b4Qldbmryc5lmnrI3ojOdg1FUloa68=
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250214231858-f365e2bdecea h1:/1f/pWf7vSV9acTR9UPn2exPAwQG/LHGa4l9OywhS00=
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250214231858-f365e2bdecea/go.mod h1:Z2e1ynSJ4pg83b4Qldbmryc5lmnrI3ojOdg1FUloa68=
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20250128203428-08031923fbe5 h1:CvDfgWoLoYPapOumE/UZCplfCu5oNmy9BuH+6V6+fJ8=
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20250128203428-08031923fbe5/go.mod h1:pDZagSGjs9U+l4YIFhveDznMHqxuuz+5vRxvVgpbdr8=
github.com/smartcontractkit/chainlink-feeds v0.1.1 h1:JzvUOM/OgGQA1sOqTXXl52R6AnNt+Wg64sVG+XSA49c=
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/load/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ require (
github.com/slack-go/slack v0.15.0
github.com/smartcontractkit/chain-selectors v1.0.40
github.com/smartcontractkit/chainlink-ccip v0.0.0-20250214202341-4190f2db1c01
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250205141137-8f50d72601bb
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250214231858-f365e2bdecea
github.com/smartcontractkit/chainlink-integrations/evm v0.0.0-20250213145514-41d874782c02
github.com/smartcontractkit/chainlink-testing-framework/lib v1.51.0
github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.10
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/load/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1365,8 +1365,8 @@ github.com/smartcontractkit/chainlink-ccip v0.0.0-20250214202341-4190f2db1c01 h1
github.com/smartcontractkit/chainlink-ccip v0.0.0-20250214202341-4190f2db1c01/go.mod h1:Hht/OJq/PxC+gnBCIPyzHt4Otsw6mYwUVsmtOqIvlxo=
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250214202341-4190f2db1c01 h1:R3OD6Phi0ULIQ2uvHiKVWYdgpi/O1Mt46CUK1UApcXU=
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250214202341-4190f2db1c01/go.mod h1:Bmwq4lNb5tE47sydN0TKetcLEGbgl+VxHEWp4S0LI60=
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250205141137-8f50d72601bb h1:1VC/hN1ojPiEWCsjxhvcw4p1Zveo90O38VQhktvo3Ag=
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250205141137-8f50d72601bb/go.mod h1:Z2e1ynSJ4pg83b4Qldbmryc5lmnrI3ojOdg1FUloa68=
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250214231858-f365e2bdecea h1:/1f/pWf7vSV9acTR9UPn2exPAwQG/LHGa4l9OywhS00=
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250214231858-f365e2bdecea/go.mod h1:Z2e1ynSJ4pg83b4Qldbmryc5lmnrI3ojOdg1FUloa68=
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20250128203428-08031923fbe5 h1:CvDfgWoLoYPapOumE/UZCplfCu5oNmy9BuH+6V6+fJ8=
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20250128203428-08031923fbe5/go.mod h1:pDZagSGjs9U+l4YIFhveDznMHqxuuz+5vRxvVgpbdr8=
github.com/smartcontractkit/chainlink-feeds v0.1.1 h1:JzvUOM/OgGQA1sOqTXXl52R6AnNt+Wg64sVG+XSA49c=
Expand Down

0 comments on commit 6272fc5

Please sign in to comment.