Skip to content

Commit

Permalink
ccip: chain reader router discovery function. (#14607)
Browse files Browse the repository at this point in the history
* Add new ccip chain reader configs.

* Add changeset.

* Fix lint

* chainlink-ccip main branch

* Fix config and add a test.

* Update core/capabilities/ccip/configs/evm/contract_reader.go

Co-authored-by: Makram <makramkd@users.noreply.github.com>

* tidy

---------

Co-authored-by: Makram <makramkd@users.noreply.github.com>
  • Loading branch information
winder and makramkd authored Oct 1, 2024
1 parent 585f7aa commit eec0ff9
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .changeset/lemon-apples-explain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

#internal update ccip chainreader config.
38 changes: 32 additions & 6 deletions core/capabilities/ccip/configs/evm/contract_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ var DestReaderConfig = evmrelaytypes.ChainReaderConfig{
ChainSpecificName: mustGetMethodName("getLatestPriceSequenceNumber", offrampABI),
ReadType: evmrelaytypes.Method,
},
consts.MethodNameOfframpGetStaticConfig: {
consts.MethodNameOffRampGetStaticConfig: {
ChainSpecificName: mustGetMethodName("getStaticConfig", offrampABI),
ReadType: evmrelaytypes.Method,
},
consts.MethodNameOfframpGetDynamicConfig: {
consts.MethodNameOffRampGetDynamicConfig: {
ChainSpecificName: mustGetMethodName("getDynamicConfig", offrampABI),
ReadType: evmrelaytypes.Method,
},
Expand All @@ -113,6 +113,16 @@ var DestReaderConfig = evmrelaytypes.ChainReaderConfig{
ChainSpecificName: mustGetEventName(consts.EventNameExecutionStateChanged, offrampABI),
ReadType: evmrelaytypes.Event,
},
//nolint:staticcheck // TODO: remove deprecated config.
consts.MethodNameOfframpGetStaticConfig: {
ChainSpecificName: mustGetMethodName("getStaticConfig", offrampABI),
ReadType: evmrelaytypes.Method,
},
//nolint:staticcheck // TODO: remove deprecated config.
consts.MethodNameOfframpGetDynamicConfig: {
ChainSpecificName: mustGetMethodName("getDynamicConfig", offrampABI),
ReadType: evmrelaytypes.Method,
},
},
},
consts.ContractNameNonceManager: {
Expand Down Expand Up @@ -198,18 +208,34 @@ var SourceReaderConfig = evmrelaytypes.ChainReaderConfig{
ChainSpecificName: mustGetMethodName("getExpectedNextSequenceNumber", onrampABI),
ReadType: evmrelaytypes.Method,
},
consts.EventNameCCIPMessageSent: {
ChainSpecificName: mustGetEventName("CCIPMessageSent", onrampABI),
ReadType: evmrelaytypes.Event,
},
consts.MethodNameOnRampGetStaticConfig: {
ChainSpecificName: mustGetMethodName("getStaticConfig", onrampABI),
ReadType: evmrelaytypes.Method,
},
consts.MethodNameOnRampGetDynamicConfig: {
ChainSpecificName: mustGetMethodName("getDynamicConfig", onrampABI),
ReadType: evmrelaytypes.Method,
},
// TODO: swap with const.
"OnRampGetDestChainConfig": {
//consts.MethodNameOnRampGetDestChainConfig: {
ChainSpecificName: mustGetMethodName("getDestChainConfig", onrampABI),
ReadType: evmrelaytypes.Method,
},
//nolint:staticcheck // TODO: remove deprecated config.
consts.MethodNameOnrampGetStaticConfig: {
ChainSpecificName: mustGetMethodName("getStaticConfig", onrampABI),
ReadType: evmrelaytypes.Method,
},
//nolint:staticcheck // TODO: remove deprecated config.
consts.MethodNameOnrampGetDynamicConfig: {
ChainSpecificName: mustGetMethodName("getDynamicConfig", onrampABI),
ReadType: evmrelaytypes.Method,
},
consts.EventNameCCIPMessageSent: {
ChainSpecificName: mustGetEventName("CCIPMessageSent", onrampABI),
ReadType: evmrelaytypes.Event,
},
},
},
},
Expand Down
12 changes: 12 additions & 0 deletions core/capabilities/ccip/configs/evm/init_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package evm

import (
"testing"
)

func TestConfig(t *testing.T) {
// Config is created during initialization, the following functions may panic:
// MustGetABI
// mustGetMethodName
// mustGetEventName
}
2 changes: 1 addition & 1 deletion core/scripts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ require (
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
github.com/shirou/gopsutil/v3 v3.24.3 // indirect
github.com/smartcontractkit/chain-selectors v1.0.23 // indirect
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240930150148-1c731b9602dd // indirect
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240930203817-424892240cd1 // indirect
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 // indirect
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 // indirect
github.com/smartcontractkit/chainlink-feeds v0.0.0-20240910155501-42f20443189f // 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 @@ -1081,8 +1081,8 @@ github.com/smartcontractkit/chain-selectors v1.0.23 h1:D2Eaex4Cw/O7Lg3tX6WklOqnj
github.com/smartcontractkit/chain-selectors v1.0.23/go.mod h1:d4Hi+E1zqjy9HqMkjBE5q1vcG9VGgxf5VxiRHfzi2kE=
github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8umfIfVVlwC7+n5izbLSFgjw8=
github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240930150148-1c731b9602dd h1:16Hwnz4hdmWKOy5qVH9wHfyT1XXM0k31M3naexwzpVo=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240930150148-1c731b9602dd/go.mod h1:/nGkIe25kgtr+l6y30VH+aTVaxu0NjIEEEhtV1TDlaE=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240930203817-424892240cd1 h1:X07jKFIakpR7UyG/BnQ8wKZz395LsEcowqyQgDKHcT8=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240930203817-424892240cd1/go.mod h1:/nGkIe25kgtr+l6y30VH+aTVaxu0NjIEEEhtV1TDlaE=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20241001140426-35be2fad06ec h1:zmLmKLCpoV73AaGU8YBc86YPLJBzoZFv9lPC677Eqcs=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20241001140426-35be2fad06ec/go.mod h1:F6WUS6N4mP5ScwpwyTyAJc9/vjR+GXbMCRUOVekQi1g=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q=
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ require (
github.com/shopspring/decimal v1.4.0
github.com/smartcontractkit/chain-selectors v1.0.23
github.com/smartcontractkit/chainlink-automation v1.0.4
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240930150148-1c731b9602dd
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240930203817-424892240cd1
github.com/smartcontractkit/chainlink-common v0.2.3-0.20241001140426-35be2fad06ec
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1042,8 +1042,8 @@ github.com/smartcontractkit/chain-selectors v1.0.23 h1:D2Eaex4Cw/O7Lg3tX6WklOqnj
github.com/smartcontractkit/chain-selectors v1.0.23/go.mod h1:d4Hi+E1zqjy9HqMkjBE5q1vcG9VGgxf5VxiRHfzi2kE=
github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8umfIfVVlwC7+n5izbLSFgjw8=
github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240930150148-1c731b9602dd h1:16Hwnz4hdmWKOy5qVH9wHfyT1XXM0k31M3naexwzpVo=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240930150148-1c731b9602dd/go.mod h1:/nGkIe25kgtr+l6y30VH+aTVaxu0NjIEEEhtV1TDlaE=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240930203817-424892240cd1 h1:X07jKFIakpR7UyG/BnQ8wKZz395LsEcowqyQgDKHcT8=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240930203817-424892240cd1/go.mod h1:/nGkIe25kgtr+l6y30VH+aTVaxu0NjIEEEhtV1TDlaE=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20241001140426-35be2fad06ec h1:zmLmKLCpoV73AaGU8YBc86YPLJBzoZFv9lPC677Eqcs=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20241001140426-35be2fad06ec/go.mod h1:F6WUS6N4mP5ScwpwyTyAJc9/vjR+GXbMCRUOVekQi1g=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q=
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ require (
github.com/smartcontractkit/ccip-owner-contracts v0.0.0-20240926212305-a6deabdfce86
github.com/smartcontractkit/chain-selectors v1.0.23
github.com/smartcontractkit/chainlink-automation v1.0.4
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240930150148-1c731b9602dd
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240930203817-424892240cd1
github.com/smartcontractkit/chainlink-common v0.2.3-0.20241001140426-35be2fad06ec
github.com/smartcontractkit/chainlink-testing-framework/havoc v1.50.0
github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.9
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1423,8 +1423,8 @@ github.com/smartcontractkit/chain-selectors v1.0.23 h1:D2Eaex4Cw/O7Lg3tX6WklOqnj
github.com/smartcontractkit/chain-selectors v1.0.23/go.mod h1:d4Hi+E1zqjy9HqMkjBE5q1vcG9VGgxf5VxiRHfzi2kE=
github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8umfIfVVlwC7+n5izbLSFgjw8=
github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240930150148-1c731b9602dd h1:16Hwnz4hdmWKOy5qVH9wHfyT1XXM0k31M3naexwzpVo=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240930150148-1c731b9602dd/go.mod h1:/nGkIe25kgtr+l6y30VH+aTVaxu0NjIEEEhtV1TDlaE=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240930203817-424892240cd1 h1:X07jKFIakpR7UyG/BnQ8wKZz395LsEcowqyQgDKHcT8=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240930203817-424892240cd1/go.mod h1:/nGkIe25kgtr+l6y30VH+aTVaxu0NjIEEEhtV1TDlaE=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20241001140426-35be2fad06ec h1:zmLmKLCpoV73AaGU8YBc86YPLJBzoZFv9lPC677Eqcs=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20241001140426-35be2fad06ec/go.mod h1:F6WUS6N4mP5ScwpwyTyAJc9/vjR+GXbMCRUOVekQi1g=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q=
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 @@ -382,7 +382,7 @@ require (
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/smartcontractkit/chain-selectors v1.0.23 // indirect
github.com/smartcontractkit/chainlink-automation v1.0.4 // indirect
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240930150148-1c731b9602dd // indirect
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240930203817-424892240cd1 // indirect
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 // indirect
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 // indirect
github.com/smartcontractkit/chainlink-feeds v0.0.0-20240910155501-42f20443189f // indirect
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 @@ -1397,8 +1397,8 @@ github.com/smartcontractkit/chain-selectors v1.0.23 h1:D2Eaex4Cw/O7Lg3tX6WklOqnj
github.com/smartcontractkit/chain-selectors v1.0.23/go.mod h1:d4Hi+E1zqjy9HqMkjBE5q1vcG9VGgxf5VxiRHfzi2kE=
github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8umfIfVVlwC7+n5izbLSFgjw8=
github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240930150148-1c731b9602dd h1:16Hwnz4hdmWKOy5qVH9wHfyT1XXM0k31M3naexwzpVo=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240930150148-1c731b9602dd/go.mod h1:/nGkIe25kgtr+l6y30VH+aTVaxu0NjIEEEhtV1TDlaE=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240930203817-424892240cd1 h1:X07jKFIakpR7UyG/BnQ8wKZz395LsEcowqyQgDKHcT8=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240930203817-424892240cd1/go.mod h1:/nGkIe25kgtr+l6y30VH+aTVaxu0NjIEEEhtV1TDlaE=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20241001140426-35be2fad06ec h1:zmLmKLCpoV73AaGU8YBc86YPLJBzoZFv9lPC677Eqcs=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20241001140426-35be2fad06ec/go.mod h1:F6WUS6N4mP5ScwpwyTyAJc9/vjR+GXbMCRUOVekQi1g=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q=
Expand Down

0 comments on commit eec0ff9

Please sign in to comment.