From 3f1ec39acd7e9e10c8bd9e1b13db387c77ddcb41 Mon Sep 17 00:00:00 2001 From: Jordan Krage Date: Wed, 13 Sep 2023 20:38:59 -0500 Subject: [PATCH] test tweaks (#10636) --- core/cmd/shell_local_test.go | 1 - core/internal/cltest/cltest.go | 20 ++++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/core/cmd/shell_local_test.go b/core/cmd/shell_local_test.go index 3825a010c66..88e323ad5cf 100644 --- a/core/cmd/shell_local_test.go +++ b/core/cmd/shell_local_test.go @@ -480,7 +480,6 @@ func TestShell_RebroadcastTransactions_AddressCheck(t *testing.T) { } set := flag.NewFlagSet("test", 0) - set.Set("evmChainID", testutils.SimulatedChainID.String()) cltest.FlagSetApplyFromAction(client.RebroadcastTransactions, set, "") require.NoError(t, set.Set("address", fromAddress.Hex())) diff --git a/core/internal/cltest/cltest.go b/core/internal/cltest/cltest.go index e7a95d6254a..01228954640 100644 --- a/core/internal/cltest/cltest.go +++ b/core/internal/cltest/cltest.go @@ -530,15 +530,19 @@ func NewEthMocksWithTransactionsOnBlocksAssertions(t testing.TB) *evmclimocks.Cl c.On("HeadByHash", mock.Anything, h0.Hash).Maybe().Return(h0, nil) c.On("BatchCallContext", mock.Anything, mock.Anything).Maybe().Return(nil).Run(func(args mock.Arguments) { elems := args.Get(1).([]rpc.BatchElem) - elems[0].Result = &evmtypes.Block{ - Number: 42, - Hash: utils.NewHash(), - Transactions: LegacyTransactionsFromGasPrices(9001, 9002), + if len(elems) > 0 { + elems[0].Result = &evmtypes.Block{ + Number: 42, + Hash: utils.NewHash(), + Transactions: LegacyTransactionsFromGasPrices(9001, 9002), + } } - elems[1].Result = &evmtypes.Block{ - Number: 41, - Hash: utils.NewHash(), - Transactions: LegacyTransactionsFromGasPrices(9003, 9004), + if len(elems) > 1 { + elems[1].Result = &evmtypes.Block{ + Number: 41, + Hash: utils.NewHash(), + Transactions: LegacyTransactionsFromGasPrices(9003, 9004), + } } }) c.On("ConfiguredChainID").Maybe().Return(&FixtureChainID)