Skip to content

Commit

Permalink
bump geth v1.13.14; rm hack; fix simulated backend; run make generate
Browse files Browse the repository at this point in the history
  • Loading branch information
jmank88 committed May 14, 2024
1 parent e778a32 commit fdca8cb
Show file tree
Hide file tree
Showing 30 changed files with 225 additions and 150 deletions.
5 changes: 5 additions & 0 deletions .changeset/purple-shrimps-invent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

bump geth to 1.13.14
70 changes: 41 additions & 29 deletions core/chains/evm/client/simulated_backend_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,6 @@ func (c *SimulatedBackendClient) SubscribeFilterLogs(ctx context.Context, q ethe
return c.b.SubscribeFilterLogs(ctx, q, channel)
}

// currentBlockNumber returns index of *pending* block in simulated blockchain
func (c *SimulatedBackendClient) currentBlockNumber() *big.Int {
return c.b.Blockchain().CurrentBlock().Number
}

func (c *SimulatedBackendClient) finalizedBlockNumber() *big.Int {
return c.b.Blockchain().CurrentFinalBlock().Number
}

func (c *SimulatedBackendClient) TokenBalance(ctx context.Context, address common.Address, contractAddress common.Address) (balance *big.Int, err error) {
callData, err := balanceOfABI.Pack("balanceOf", address)
if err != nil {
Expand All @@ -139,7 +130,7 @@ func (c *SimulatedBackendClient) TokenBalance(ctx context.Context, address commo
}
b, err := c.b.CallContract(ctx, ethereum.CallMsg{
To: &contractAddress, Data: callData},
c.currentBlockNumber())
big.NewInt(int64(rpc.LatestBlockNumber)))
if err != nil {
return nil, fmt.Errorf("%w: while calling ERC20 balanceOf method on %s "+
"for balance of %s", err, contractAddress, address)
Expand All @@ -166,19 +157,37 @@ func (c *SimulatedBackendClient) TransactionByHash(ctx context.Context, txHash c
return
}

func (c *SimulatedBackendClient) blockNumber(number interface{}) (blockNumber *big.Int, err error) {
func (c *SimulatedBackendClient) blockNumber(ctx context.Context, number interface{}) (blockNumber *big.Int, err error) {
switch n := number.(type) {
case string:
switch n {
case "latest":
return c.currentBlockNumber(), nil
var n uint64
n, err = c.b.BlockNumber(ctx)
if err != nil {
return
}
blockNumber = new(big.Int)
blockNumber.SetUint64(n)
return
case "earliest":
return big.NewInt(0), nil
case "pending":
panic("pending block not supported by simulated backend client") // I don't understand the semantics of this.
// return big.NewInt(0).Add(c.currentBlockNumber(), big.NewInt(1)), nil
var h *types.Header
h, err = c.b.HeaderByNumber(ctx, new(big.Int).SetInt64(rpc.PendingBlockNumber.Int64()))
if err != nil {
return
}
blockNumber = h.Number
return
case "finalized":
return c.finalizedBlockNumber(), nil
var h *types.Header
h, err = c.b.HeaderByNumber(ctx, new(big.Int).SetInt64(rpc.FinalizedBlockNumber.Int64()))
if err != nil {
return
}
blockNumber = h.Number
return
default:
blockNumber, err := hexutil.DecodeBig(n)
if err != nil {
Expand All @@ -202,7 +211,7 @@ func (c *SimulatedBackendClient) blockNumber(number interface{}) (blockNumber *b
// HeadByNumber returns our own header type.
func (c *SimulatedBackendClient) HeadByNumber(ctx context.Context, n *big.Int) (*evmtypes.Head, error) {
if n == nil {
n = c.currentBlockNumber()
n = big.NewInt(int64(rpc.LatestBlockNumber))
}
header, err := c.b.HeaderByNumber(ctx, n)
if err != nil {
Expand Down Expand Up @@ -520,11 +529,11 @@ func (c *SimulatedBackendClient) IsL2() bool {
func (c *SimulatedBackendClient) fetchHeader(ctx context.Context, blockNumOrTag string) (*types.Header, error) {
switch blockNumOrTag {
case rpc.SafeBlockNumber.String():
return c.b.Blockchain().CurrentSafeBlock(), nil
return c.b.HeaderByNumber(ctx, big.NewInt(int64(rpc.SafeBlockNumber)))
case rpc.LatestBlockNumber.String():
return c.b.Blockchain().CurrentHeader(), nil
return c.b.HeaderByNumber(ctx, big.NewInt(int64(rpc.LatestBlockNumber)))
case rpc.FinalizedBlockNumber.String():
return c.b.Blockchain().CurrentFinalBlock(), nil
return c.b.HeaderByNumber(ctx, big.NewInt(int64(rpc.FinalizedBlockNumber)))
default:
blockNum, ok := new(big.Int).SetString(blockNumOrTag, 0)
if !ok {
Expand Down Expand Up @@ -611,7 +620,7 @@ func (c *SimulatedBackendClient) ethEstimateGas(ctx context.Context, result inte
return fmt.Errorf("SimulatedBackendClient expected first arg to be map[string]interface{} for eth_call, got: %T", args[0])
}

_, err := c.blockNumber(args[1])
_, err := c.blockNumber(ctx, args[1])
if err != nil {
return fmt.Errorf("SimulatedBackendClient expected second arg to be the string 'latest' or a *big.Int for eth_call, got: %T", args[1])
}
Expand Down Expand Up @@ -643,7 +652,7 @@ func (c *SimulatedBackendClient) ethCall(ctx context.Context, result interface{}
return fmt.Errorf("SimulatedBackendClient expected first arg to be map[string]interface{} for eth_call, got: %T", args[0])
}

if _, err := c.blockNumber(args[1]); err != nil {
if _, err := c.blockNumber(ctx, args[1]); err != nil {
return fmt.Errorf("SimulatedBackendClient expected second arg to be the string 'latest' or a *big.Int for eth_call, got: %T", args[1])
}

Expand Down Expand Up @@ -673,7 +682,7 @@ func (c *SimulatedBackendClient) ethGetHeaderByNumber(ctx context.Context, resul
return fmt.Errorf("SimulatedBackendClient expected 1 arg, got %d for eth_getHeaderByNumber", len(args))
}

blockNumber, err := c.blockNumber(args[0])
blockNumber, err := c.blockNumber(ctx, args[0])
if err != nil {
return fmt.Errorf("SimulatedBackendClient expected first arg to be a string for eth_getHeaderByNumber: %w", err)
}
Expand All @@ -694,13 +703,16 @@ func (c *SimulatedBackendClient) ethGetHeaderByNumber(ctx context.Context, resul
}

func (c *SimulatedBackendClient) LatestFinalizedBlock(ctx context.Context) (*evmtypes.Head, error) {
block := c.b.Blockchain().CurrentFinalBlock()
h, err := c.b.HeaderByNumber(ctx, big.NewInt(rpc.FinalizedBlockNumber.Int64()))
if err != nil {
return nil, err
}
return &evmtypes.Head{
EVMChainID: ubig.NewI(c.chainId.Int64()),
Hash: block.Hash(),
Number: block.Number.Int64(),
ParentHash: block.ParentHash,
Timestamp: time.Unix(int64(block.Time), 0),
Hash: h.Hash(),
Number: h.Number.Int64(),
ParentHash: h.ParentHash,
Timestamp: time.Unix(int64(h.Time), 0),
}, nil
}

Expand All @@ -720,14 +732,14 @@ func (c *SimulatedBackendClient) ethGetLogs(ctx context.Context, result interfac
}

if fromBlock, ok := params["fromBlock"]; ok {
from, err = c.blockNumber(fromBlock)
from, err = c.blockNumber(ctx, fromBlock)
if err != nil {
return fmt.Errorf("SimulatedBackendClient expected 'fromBlock' to be a string: %w", err)
}
}

if toBlock, ok := params["toBlock"]; ok {
to, err = c.blockNumber(toBlock)
to, err = c.blockNumber(ctx, toBlock)
if err != nil {
return fmt.Errorf("SimulatedBackendClient expected 'toBlock' to be a string: %w", err)
}
Expand Down
12 changes: 4 additions & 8 deletions core/chains/evm/logpoller/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

Expand All @@ -43,7 +41,6 @@ type TestHarness struct {
Owner *bind.TransactOpts
Emitter1, Emitter2 *log_emitter.LogEmitter
EmitterAddress1, EmitterAddress2 common.Address
EthDB ethdb.Database
}

func SetupTH(t testing.TB, opts logpoller.Opts) TestHarness {
Expand All @@ -55,8 +52,7 @@ func SetupTH(t testing.TB, opts logpoller.Opts) TestHarness {
o := logpoller.NewORM(chainID, db, lggr)
o2 := logpoller.NewORM(chainID2, db, lggr)
owner := testutils.MustNewSimTransactor(t)
ethDB := rawdb.NewMemoryDatabase()
ec := backends.NewSimulatedBackendWithDatabase(ethDB, map[common.Address]core.GenesisAccount{
ec := backends.NewSimulatedBackend(map[common.Address]core.GenesisAccount{
owner.From: {
Balance: big.NewInt(0).Mul(big.NewInt(10), big.NewInt(1e18)),
},
Expand All @@ -65,8 +61,9 @@ func SetupTH(t testing.TB, opts logpoller.Opts) TestHarness {
// Set it to some insanely high value to not interfere with any tests.
esc := client.NewSimulatedBackendClient(t, ec, chainID)
// Mark genesis block as finalized to avoid any nulls in the tests
head := esc.Backend().Blockchain().CurrentHeader()
esc.Backend().Blockchain().SetFinalized(head)
//TODO OK to drop?
//head := esc.Backend().Blockchain().CurrentHeader()
//esc.Backend().Blockchain().SetFinalized(head)

if opts.PollPeriod == 0 {
opts.PollPeriod = 1 * time.Hour
Expand All @@ -90,7 +87,6 @@ func SetupTH(t testing.TB, opts logpoller.Opts) TestHarness {
Emitter2: emitter2,
EmitterAddress1: emitterAddress1,
EmitterAddress2: emitterAddress2,
EthDB: ethDB,
}
}

Expand Down
26 changes: 15 additions & 11 deletions core/chains/evm/logpoller/log_poller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,8 @@ func Test_BackupLogPoller(t *testing.T) {

th.Client.Commit() // commit block 34 with 3 tx's included

h := th.Client.Blockchain().CurrentHeader() // get latest header
h, err := th.Client.HeaderByNumber(ctx, nil) // get latest header
require.NoError(t, err)
require.Equal(t, uint64(34), h.Number.Uint64())

// save these 3 receipts for later
Expand Down Expand Up @@ -1470,8 +1471,7 @@ func TestLogPoller_DBErrorHandling(t *testing.T) {
o := logpoller.NewORM(chainID1, db, lggr)

owner := testutils.MustNewSimTransactor(t)
ethDB := rawdb.NewMemoryDatabase()
ec := backends.NewSimulatedBackendWithDatabase(ethDB, map[common.Address]core.GenesisAccount{
ec := backends.NewSimulatedBackend(map[common.Address]core.GenesisAccount{
owner.From: {
Balance: big.NewInt(0).Mul(big.NewInt(10), big.NewInt(1e18)),
},
Expand Down Expand Up @@ -1659,8 +1659,9 @@ func Test_PollAndQueryFinalizedBlocks(t *testing.T) {
}

// Mark current head as finalized
h := th.Client.Blockchain().CurrentHeader()
th.Client.Blockchain().SetFinalized(h)
//TODO can we skip?
//h := th.Client.Blockchain().CurrentHeader()
//th.Client.Blockchain().SetFinalized(h)

// Generate next blocks, not marked as finalized
for i := 0; i < secondBatchLen; i++ {
Expand Down Expand Up @@ -1740,8 +1741,9 @@ func Test_PollAndSavePersistsFinalityInBlocks(t *testing.T) {
require.Error(t, err)

// Mark first block as finalized
h := th.Client.Blockchain().CurrentHeader()
th.Client.Blockchain().SetFinalized(h)
//TODO OK to skip?
//h := th.Client.Blockchain().CurrentHeader()
//th.Client.Blockchain().SetFinalized(h)

// Create a couple of blocks
for i := 0; i < numberOfBlocks-1; i++ {
Expand Down Expand Up @@ -1910,15 +1912,17 @@ func Test_PruneOldBlocks(t *testing.T) {
}

func markBlockAsFinalized(t *testing.T, th TestHarness, blockNumber int64) {
b, err := th.Client.BlockByNumber(testutils.Context(t), big.NewInt(blockNumber))
_, err := th.Client.BlockByNumber(testutils.Context(t), big.NewInt(blockNumber))
require.NoError(t, err)
th.Client.Blockchain().SetFinalized(b.Header())
//TODO ok to skip?
//th.Client.Blockchain().SetFinalized(b.Header())
}

func markBlockAsFinalizedByHash(t *testing.T, th TestHarness, blockHash common.Hash) {
b, err := th.Client.BlockByHash(testutils.Context(t), blockHash)
_, err := th.Client.BlockByHash(testutils.Context(t), blockHash)
require.NoError(t, err)
th.Client.Blockchain().SetFinalized(b.Header())
//TODO ok to skip?
//th.Client.Blockchain().SetFinalized(b.Header())
}

func TestFindLCA(t *testing.T) {
Expand Down
3 changes: 1 addition & 2 deletions core/gethwrappers/abigen_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/stretchr/testify/require"

"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/log_emitter"
Expand All @@ -18,7 +17,7 @@ import (
// We perform this test using the generated LogEmitter wrapper.
func TestGeneratedDeployMethodAddressField(t *testing.T) {
owner := testutils.MustNewSimTransactor(t)
ec := backends.NewSimulatedBackendWithDatabase(rawdb.NewMemoryDatabase(), map[common.Address]core.GenesisAccount{
ec := backends.NewSimulatedBackend(map[common.Address]core.GenesisAccount{
owner.From: {
Balance: big.NewInt(0).Mul(big.NewInt(10), big.NewInt(1e18)),
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GETH_VERSION: 1.13.8
GETH_VERSION: 1.13.14
functions: ../../../contracts/solc/v0.8.19/functions/v1_X/FunctionsRequest.abi ../../../contracts/solc/v0.8.19/functions/v1_X/FunctionsRequest.bin 3c972870b0afeb6d73a29ebb182f24956a2cebb127b21c4f867d1ecf19a762db
functions_allow_list: ../../../contracts/solc/v0.8.19/functions/v1_X/TermsOfServiceAllowList.abi ../../../contracts/solc/v0.8.19/functions/v1_X/TermsOfServiceAllowList.bin 268de8b3c061b53a1a2a1ccc0149eff68545959e29cd41b5f2e9f5dab19075cf
functions_billing_registry_events_mock: ../../../contracts/solc/v0.8.6/functions/v0_0_0/FunctionsBillingRegistryEventsMock.abi ../../../contracts/solc/v0.8.6/functions/v0_0_0/FunctionsBillingRegistryEventsMock.bin 50deeb883bd9c3729702be335c0388f9d8553bab4be5e26ecacac496a89e2b77
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GETH_VERSION: 1.13.8
GETH_VERSION: 1.13.14
aggregator_v2v3_interface: ../../contracts/solc/v0.8.6/AggregatorV2V3Interface/AggregatorV2V3Interface.abi ../../contracts/solc/v0.8.6/AggregatorV2V3Interface/AggregatorV2V3Interface.bin 95e8814b408bb05bf21742ef580d98698b7db6a9bac6a35c3de12b23aec4ee28
aggregator_v3_interface: ../../contracts/solc/v0.8.6/AggregatorV2V3Interface/AggregatorV3Interface.abi ../../contracts/solc/v0.8.6/AggregatorV2V3Interface/AggregatorV3Interface.bin 351b55d3b0f04af67db6dfb5c92f1c64479400ca1fec77afc20bc0ce65cb49ab
arbitrum_module: ../../contracts/solc/v0.8.19/ArbitrumModule/ArbitrumModule.abi ../../contracts/solc/v0.8.19/ArbitrumModule/ArbitrumModule.bin b76cf77e3e8200c5f292e93af3f620f68f207f83634aacaaee43d682701dfea3
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
GETH_VERSION: 1.13.8
channel_config_store: ../../../contracts/solc/v0.8.19/ChannelConfigStore/ChannelConfigStore.abi ../../../contracts/solc/v0.8.19/ChannelConfigStore/ChannelConfigStore.bin c90e29d9f1a885098982b6175e0447416431b28c605273c807694ac7141e9167
GETH_VERSION: 1.13.14
channel_config_store: ../../../contracts/solc/v0.8.19/ChannelConfigStore/ChannelConfigStore.abi ../../../contracts/solc/v0.8.19/ChannelConfigStore/ChannelConfigStore.bin 4ae3e6ca866fdf48850d67c0c7a4bdaf4905c81a4e3ce5efb9ef9613a55d8454
channel_config_verifier_proxy: ../../../contracts/solc/v0.8.19/ChannelVerifierProxy/ChannelVerifierProxy.abi ../../../contracts/solc/v0.8.19/ChannelVerifierProxy/ChannelVerifierProxy.bin 655658e5f61dfadfe3268de04f948b7e690ad03ca45676e645d6cd6018154661
channel_verifier: ../../../contracts/solc/v0.8.19/ChannelVerifier/ChannelVerifier.abi ../../../contracts/solc/v0.8.19/ChannelVerifier/ChannelVerifier.bin e6020553bd8e3e6b250fcaffe7efd22aea955c8c1a0eb05d282fdeb0ab6550b7
errored_verifier: ../../../contracts/solc/v0.8.19/ErroredVerifier/ErroredVerifier.abi ../../../contracts/solc/v0.8.19/ErroredVerifier/ErroredVerifier.bin a3e5a77262e13ee30fe8d35551b32a3452d71929e43fd780bbfefeaf4aa62e43
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GETH_VERSION: 1.13.8
GETH_VERSION: 1.13.14
burn_mint_erc677: ../../../contracts/solc/v0.8.19/BurnMintERC677/BurnMintERC677.abi ../../../contracts/solc/v0.8.19/BurnMintERC677/BurnMintERC677.bin 405c9016171e614b17e10588653ef8d33dcea21dd569c3fddc596a46fcff68a3
erc20: ../../../contracts/solc/v0.8.19/ERC20/ERC20.abi ../../../contracts/solc/v0.8.19/ERC20/ERC20.bin 5b1a93d9b24f250e49a730c96335a8113c3f7010365cba578f313b483001d4fc
link_token: ../../../contracts/solc/v0.8.19/LinkToken/LinkToken.abi ../../../contracts/solc/v0.8.19/LinkToken/LinkToken.bin c0ef9b507103aae541ebc31d87d051c2764ba9d843076b30ec505d37cdfffaba
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
GETH_VERSION: 1.13.8
entry_point: ../../../contracts/solc/v0.8.19/EntryPoint/EntryPoint.abi ../../../contracts/solc/v0.8.19/EntryPoint/EntryPoint.bin e43da0e61256471b317cab1c87f2425cecba9b81ac21633334f889bab2f0777d
greeter: ../../../contracts/solc/v0.8.19/Greeter.abi ../../../contracts/solc/v0.8.19/Greeter.bin 653dcba5c33a46292073939ce1e639372cf521c0ec2814d4c9f20c72f796f18c
greeter_wrapper: ../../../contracts/solc/v0.8.19/Greeter/Greeter.abi ../../../contracts/solc/v0.8.19/Greeter/Greeter.bin 7f6def58e337a53553a46cb7992cf2d75ec951014d79376fcb869a2b16b53f6d
paymaster_wrapper: ../../../contracts/solc/v0.8.19/Paymaster/Paymaster.abi ../../../contracts/solc/v0.8.19/Paymaster/Paymaster.bin dbdd1341cfa2d5c09730e0decc32339f62d1a4ea89835a51ff774226ddfbd04b
sca: ../../../contracts/solc/v0.8.19/SCA.abi ../../../contracts/solc/v0.8.19/SCA.bin ae0f860cdac87d4ac505edbd228bd3ea1108550453aba67aebcb61f09cf70d0b
sca_wrapper: ../../../contracts/solc/v0.8.19/SCA/SCA.abi ../../../contracts/solc/v0.8.19/SCA/SCA.bin 6ef817bdefad1b5e84f06e0bdc40848000ab00e1a38371435b793946f425a8e6
smart_contract_account_factory: ../../../contracts/solc/v0.8.19/SmartContractAccountFactory/SmartContractAccountFactory.abi ../../../contracts/solc/v0.8.19/SmartContractAccountFactory/SmartContractAccountFactory.bin a357132e2782c462fa31ed80c270fe002e666a48ecfe407b71c278fc3a0d3679
smart_contract_account_helper: ../../../contracts/solc/v0.8.19/SmartContractAccountHelper/SmartContractAccountHelper.abi ../../../contracts/solc/v0.8.19/SmartContractAccountHelper/SmartContractAccountHelper.bin a06aff23aded74d53bd342fdc32d80c3b474ff38223df27f3395e9fd90abd12a
GETH_VERSION: 1.13.14
entry_point: ../../../contracts/solc/v0.8.15/EntryPoint/EntryPoint.abi ../../../contracts/solc/v0.8.15/EntryPoint/EntryPoint.bin 2cb4bb2ba3efa8df3dfb0a57eb3727d17b68fe202682024fa7cfb4faf026833e
greeter: ../../../contracts/solc/v0.8.15/Greeter.abi ../../../contracts/solc/v0.8.15/Greeter.bin 653dcba5c33a46292073939ce1e639372cf521c0ec2814d4c9f20c72f796f18c
greeter_wrapper: ../../../contracts/solc/v0.8.15/Greeter/Greeter.abi ../../../contracts/solc/v0.8.15/Greeter/Greeter.bin 653dcba5c33a46292073939ce1e639372cf521c0ec2814d4c9f20c72f796f18c
paymaster_wrapper: ../../../contracts/solc/v0.8.15/Paymaster/Paymaster.abi ../../../contracts/solc/v0.8.15/Paymaster/Paymaster.bin 189ef817a5b7a6ff53ddf35b1988465b8aec479c47b77236fe20bf7e67d48100
sca: ../../../contracts/solc/v0.8.15/SCA.abi ../../../contracts/solc/v0.8.15/SCA.bin ae0f860cdac87d4ac505edbd228bd3ea1108550453aba67aebcb61f09cf70d0b
sca_wrapper: ../../../contracts/solc/v0.8.15/SCA/SCA.abi ../../../contracts/solc/v0.8.15/SCA/SCA.bin 2a8100fbdb41e6ce917ed333a624eaa4a8984b07e2d8d8ca6bba9bc9f74b05d7
smart_contract_account_factory: ../../../contracts/solc/v0.8.15/SmartContractAccountFactory/SmartContractAccountFactory.abi ../../../contracts/solc/v0.8.15/SmartContractAccountFactory/SmartContractAccountFactory.bin a44d6fa2dbf9cb3441d6d637d89e1cd656f28b6bf4146f58d508067474bf845b
smart_contract_account_helper: ../../../contracts/solc/v0.8.15/SmartContractAccountHelper/SmartContractAccountHelper.abi ../../../contracts/solc/v0.8.15/SmartContractAccountHelper/SmartContractAccountHelper.bin 22f960a74bd1581a12aa4f8f438a3f265f32f43682f5c1897ca50707b9982d56
8 changes: 6 additions & 2 deletions core/internal/cltest/simulated_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ func NewApplicationWithConfigV2OnSimulatedBlockchain(
backend *backends.SimulatedBackend,
flagsAndDeps ...interface{},
) *TestApplication {
if bid := backend.Blockchain().Config().ChainID; bid.Cmp(testutils.SimulatedChainID) != 0 {
bid, err := backend.ChainID(testutils.Context(t))
require.NoError(t, err)
if bid.Cmp(testutils.SimulatedChainID) != 0 {
t.Fatalf("expected backend chain ID to be %s but it was %s", testutils.SimulatedChainID.String(), bid.String())
}

Expand All @@ -56,7 +58,9 @@ func NewApplicationWithConfigV2AndKeyOnSimulatedBlockchain(
backend *backends.SimulatedBackend,
flagsAndDeps ...interface{},
) *TestApplication {
if bid := backend.Blockchain().Config().ChainID; bid.Cmp(testutils.SimulatedChainID) != 0 {
bid, err := backend.ChainID(testutils.Context(t))
require.NoError(t, err)
if bid.Cmp(testutils.SimulatedChainID) != 0 {
t.Fatalf("expected backend chain ID to be %s but it was %s", testutils.SimulatedChainID.String(), bid.String())
}

Expand Down
5 changes: 3 additions & 2 deletions core/internal/features/features_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -778,8 +778,9 @@ func setupForwarderEnabledNode(t *testing.T, owner *bind.TransactOpts, portV2 in

// add forwarder address to be tracked in db
forwarderORM := forwarders.NewORM(app.GetDB())
chainID := ubig.Big(*b.Blockchain().Config().ChainID)
_, err = forwarderORM.CreateForwarder(testutils.Context(t), forwarder, chainID)
chainID, err := b.ChainID(testutils.Context(t))
require.NoError(t, err)
_, err = forwarderORM.CreateForwarder(testutils.Context(t), forwarder, ubig.Big(*chainID))
require.NoError(t, err)

return app, p2pKey.PeerID().Raw(), transmitter, forwarder, key
Expand Down
Loading

0 comments on commit fdca8cb

Please sign in to comment.