From 4f4c9f6671de5f8a0065ec95f586a4b26f4bcde9 Mon Sep 17 00:00:00 2001 From: Vladimir Shchukin Date: Tue, 8 Apr 2025 22:10:36 -0400 Subject: [PATCH 1/5] change hardcoded null client chain id --- pkg/client/chain_client_test.go | 2 +- pkg/client/clienttest/clienttest.go | 3 ++- pkg/client/null_client.go | 5 +++-- pkg/testutils/evmtypes.go | 2 +- pkg/types/utils.go | 2 ++ 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pkg/client/chain_client_test.go b/pkg/client/chain_client_test.go index c4ea1ec99e..d98dccef30 100644 --- a/pkg/client/chain_client_test.go +++ b/pkg/client/chain_client_test.go @@ -786,7 +786,7 @@ func TestEthClient_ErroringClient(t *testing.T) { require.Equal(t, multinode.ErrNodeError, err) id := erroringClient.ConfiguredChainID() - require.Equal(t, id, big.NewInt(0)) + require.Equal(t, id, big.NewInt(evmtypes.NullClientChainID)) _, err = erroringClient.CodeAt(ctx, common.Address{}, nil) require.Equal(t, multinode.ErrNodeError, err) diff --git a/pkg/client/clienttest/clienttest.go b/pkg/client/clienttest/clienttest.go index a3928bee98..460b98b317 100644 --- a/pkg/client/clienttest/clienttest.go +++ b/pkg/client/clienttest/clienttest.go @@ -7,12 +7,13 @@ import ( "testing" "github.com/ethereum/go-ethereum" + "github.com/smartcontractkit/chainlink-evm/pkg/types" "github.com/stretchr/testify/mock" ) func NewClientWithDefaultChainID(t testing.TB) *Client { c := NewClient(t) - c.On("ConfiguredChainID").Return(big.NewInt(0)).Maybe() + c.On("ConfiguredChainID").Return(big.NewInt(types.NullClientChainID)).Maybe() return c } diff --git a/pkg/client/null_client.go b/pkg/client/null_client.go index aab77b896a..ad1873b1a7 100644 --- a/pkg/client/null_client.go +++ b/pkg/client/null_client.go @@ -26,8 +26,9 @@ func NewNullClient(cid *big.Int, lggr logger.Logger) *NullClient { } // NullClientChainID the ChainID that nullclient will return -// 0 is never used as a real chain ID so makes sense as a dummy value here -const NullClientChainID = 0 +// hardcoded chainId is never used as a real chain ID so makes sense as a dummy value here +// can't use 0 because of introduced in geth 1.15.7 contraint 0 for chain id +const NullClientChainID = evmtypes.NullClientChainID // // Client methods diff --git a/pkg/testutils/evmtypes.go b/pkg/testutils/evmtypes.go index ecb7e8e475..8aca8721b5 100644 --- a/pkg/testutils/evmtypes.go +++ b/pkg/testutils/evmtypes.go @@ -22,7 +22,7 @@ import ( // FixtureChainID matches the chain always added by fixtures.sql // It is set to 0 since no real chain ever has this ID and allows a virtual // "test" chain ID to be used without clashes -var FixtureChainID = big.NewInt(0) +var FixtureChainID = big.NewInt(evmtypes.NullClientChainID) // SimulatedChainID is the chain ID for the go-ethereum simulated backend var SimulatedChainID = big.NewInt(1337) diff --git a/pkg/types/utils.go b/pkg/types/utils.go index 96e0a02e2c..9ca79f19aa 100644 --- a/pkg/types/utils.go +++ b/pkg/types/utils.go @@ -6,6 +6,8 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi" ) +const NullClientChainID = 1399100 + func MustGetABI(json string) abi.ABI { abi, err := abi.JSON(strings.NewReader(json)) if err != nil { From dcb8d73f1e0f4fcb7e008c3c252b6cc123b6d0a5 Mon Sep 17 00:00:00 2001 From: Vladimir Shchukin Date: Tue, 8 Apr 2025 22:12:59 -0400 Subject: [PATCH 2/5] bumped chainlink framework --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 7faae8042a..f5bb2bae21 100644 --- a/go.mod +++ b/go.mod @@ -22,7 +22,7 @@ require ( github.com/smartcontractkit/chainlink-common v0.6.1-0.20250407100046-dfdf9600557b github.com/smartcontractkit/chainlink-framework/capabilities v0.0.0-20250408161305-721208f43882 github.com/smartcontractkit/chainlink-framework/chains v0.0.0-20250325121830-cfa9bf24c4f5 - github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20250402142713-6529d36f91f3 + github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20250409021146-e25a5d371992 github.com/smartcontractkit/chainlink-integrations/evm v0.0.0-20250402183906-b7e976bc0c24 github.com/stretchr/testify v1.10.0 github.com/tidwall/gjson v1.18.0 diff --git a/go.sum b/go.sum index 3f3aca757b..5b13787910 100644 --- a/go.sum +++ b/go.sum @@ -570,6 +570,8 @@ github.com/smartcontractkit/chainlink-framework/chains v0.0.0-20250325121830-cfa github.com/smartcontractkit/chainlink-framework/chains v0.0.0-20250325121830-cfa9bf24c4f5/go.mod h1:tHem58EihQh63kR2LlAOKDAs9Vbghf1dJKZRGy6LG8g= github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20250402142713-6529d36f91f3 h1:8+2KFkPYdCK9lHMK5D/+adw02iIjEV+5Uw4s7nMNsRI= github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20250402142713-6529d36f91f3/go.mod h1:UsezB/51EAJ9FEBGn6ad2YtssgzWEIEpp3HyRM6a6iM= +github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20250409021146-e25a5d371992 h1:aEDHDN8IfY+vj8gPGbEWH4/Cj1HKh8KBKLqmbtCz+HM= +github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20250409021146-e25a5d371992/go.mod h1:UsezB/51EAJ9FEBGn6ad2YtssgzWEIEpp3HyRM6a6iM= github.com/smartcontractkit/chainlink-integrations/evm v0.0.0-20250402183906-b7e976bc0c24 h1:JSMEO8/cKgZ1upLcYSCaVF3QFakyZeV4TtWZGd64fHM= github.com/smartcontractkit/chainlink-integrations/evm v0.0.0-20250402183906-b7e976bc0c24/go.mod h1:t/sIZy/5hoqrgwlaAj3U/Jdo02Lc4/Yqlb3JvVkp+Lc= github.com/smartcontractkit/libocr v0.0.0-20250328171017-609ec10a5510 h1:gm8Jli0sdkrZYnrWBngAkPSDzFDkdNCy1/Dj86kVtYk= From 1ebd22e908b9437f9a50191280659b0922be0bda Mon Sep 17 00:00:00 2001 From: Vladimir Shchukin Date: Tue, 8 Apr 2025 22:42:06 -0400 Subject: [PATCH 3/5] tidy --- go.sum | 2 -- 1 file changed, 2 deletions(-) diff --git a/go.sum b/go.sum index 5b13787910..06abae85c9 100644 --- a/go.sum +++ b/go.sum @@ -568,8 +568,6 @@ github.com/smartcontractkit/chainlink-framework/capabilities v0.0.0-202504081613 github.com/smartcontractkit/chainlink-framework/capabilities v0.0.0-20250408161305-721208f43882/go.mod h1:NVoJQoPYr6BorpaXTusoIH1IYTySCmanQ8Q1yv3mNh4= github.com/smartcontractkit/chainlink-framework/chains v0.0.0-20250325121830-cfa9bf24c4f5 h1:3uQneNhdLsJToTKCV8/o2bsdn0e70sndSwxEiTEctgw= github.com/smartcontractkit/chainlink-framework/chains v0.0.0-20250325121830-cfa9bf24c4f5/go.mod h1:tHem58EihQh63kR2LlAOKDAs9Vbghf1dJKZRGy6LG8g= -github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20250402142713-6529d36f91f3 h1:8+2KFkPYdCK9lHMK5D/+adw02iIjEV+5Uw4s7nMNsRI= -github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20250402142713-6529d36f91f3/go.mod h1:UsezB/51EAJ9FEBGn6ad2YtssgzWEIEpp3HyRM6a6iM= github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20250409021146-e25a5d371992 h1:aEDHDN8IfY+vj8gPGbEWH4/Cj1HKh8KBKLqmbtCz+HM= github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20250409021146-e25a5d371992/go.mod h1:UsezB/51EAJ9FEBGn6ad2YtssgzWEIEpp3HyRM6a6iM= github.com/smartcontractkit/chainlink-integrations/evm v0.0.0-20250402183906-b7e976bc0c24 h1:JSMEO8/cKgZ1upLcYSCaVF3QFakyZeV4TtWZGd64fHM= From c07adef1eb79f0ae38cf1de35648eafb833e9c79 Mon Sep 17 00:00:00 2001 From: Vladimir Shchukin Date: Wed, 9 Apr 2025 08:48:34 -0400 Subject: [PATCH 4/5] update default chain scoped config --- pkg/config/configtest/configtest.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/config/configtest/configtest.go b/pkg/config/configtest/configtest.go index fa74f5bf11..f55f40c7c5 100644 --- a/pkg/config/configtest/configtest.go +++ b/pkg/config/configtest/configtest.go @@ -5,11 +5,12 @@ import ( "github.com/smartcontractkit/chainlink-evm/pkg/config" "github.com/smartcontractkit/chainlink-evm/pkg/config/toml" + "github.com/smartcontractkit/chainlink-evm/pkg/types" "github.com/smartcontractkit/chainlink-evm/pkg/utils/big" ) func NewChainScopedConfig(t testing.TB, overrideFn func(c *toml.EVMConfig)) *config.ChainScoped { - chainID := big.NewI(0) + chainID := big.NewI(types.NullClientChainID) evmCfg := &toml.EVMConfig{ ChainID: chainID, Chain: toml.Defaults(chainID), From cba34765290129ac6b0c70a9ead529ddd0038eb3 Mon Sep 17 00:00:00 2001 From: Vladimir Shchukin Date: Wed, 9 Apr 2025 09:48:41 -0400 Subject: [PATCH 5/5] fix lint --- pkg/client/clienttest/clienttest.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/client/clienttest/clienttest.go b/pkg/client/clienttest/clienttest.go index 460b98b317..f31d2447f7 100644 --- a/pkg/client/clienttest/clienttest.go +++ b/pkg/client/clienttest/clienttest.go @@ -7,8 +7,9 @@ import ( "testing" "github.com/ethereum/go-ethereum" - "github.com/smartcontractkit/chainlink-evm/pkg/types" "github.com/stretchr/testify/mock" + + "github.com/smartcontractkit/chainlink-evm/pkg/types" ) func NewClientWithDefaultChainID(t testing.TB) *Client {