From eec0ff946986dfbeeb46ed3d311ff9b8d0e21735 Mon Sep 17 00:00:00 2001 From: Will Winder Date: Tue, 1 Oct 2024 14:16:42 -0400 Subject: [PATCH] ccip: chain reader router discovery function. (#14607) * 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 * tidy --------- Co-authored-by: Makram --- .changeset/lemon-apples-explain.md | 5 +++ .../ccip/configs/evm/contract_reader.go | 38 ++++++++++++++++--- .../ccip/configs/evm/init_test.go | 12 ++++++ core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 +- go.mod | 2 +- go.sum | 4 +- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 +- integration-tests/load/go.mod | 2 +- integration-tests/load/go.sum | 4 +- 11 files changed, 61 insertions(+), 18 deletions(-) create mode 100644 .changeset/lemon-apples-explain.md create mode 100644 core/capabilities/ccip/configs/evm/init_test.go diff --git a/.changeset/lemon-apples-explain.md b/.changeset/lemon-apples-explain.md new file mode 100644 index 00000000000..75f2b874fc4 --- /dev/null +++ b/.changeset/lemon-apples-explain.md @@ -0,0 +1,5 @@ +--- +"chainlink": patch +--- + +#internal update ccip chainreader config. diff --git a/core/capabilities/ccip/configs/evm/contract_reader.go b/core/capabilities/ccip/configs/evm/contract_reader.go index fbfbf260b8a..a158e5bd5d4 100644 --- a/core/capabilities/ccip/configs/evm/contract_reader.go +++ b/core/capabilities/ccip/configs/evm/contract_reader.go @@ -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, }, @@ -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: { @@ -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, - }, }, }, }, diff --git a/core/capabilities/ccip/configs/evm/init_test.go b/core/capabilities/ccip/configs/evm/init_test.go new file mode 100644 index 00000000000..010592b6dc9 --- /dev/null +++ b/core/capabilities/ccip/configs/evm/init_test.go @@ -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 +} diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 290d8d3dba8..4d9e4fa5ebe 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -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 diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 29ef1473ef0..b3244647a49 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -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= diff --git a/go.mod b/go.mod index 7d6f82d28da..bc65ed6296f 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 32f170ae2e6..c528f8999cd 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index fe55b20b51a..708cba54dd2 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -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 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 411228d2b2d..1476373ca65 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -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= diff --git a/integration-tests/load/go.mod b/integration-tests/load/go.mod index cf5257669e8..57f186971a9 100644 --- a/integration-tests/load/go.mod +++ b/integration-tests/load/go.mod @@ -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 diff --git a/integration-tests/load/go.sum b/integration-tests/load/go.sum index e79a8455488..8e0d4eb37cf 100644 --- a/integration-tests/load/go.sum +++ b/integration-tests/load/go.sum @@ -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=