From 849e6b9d6828a5f5b37d889880653063d7c10803 Mon Sep 17 00:00:00 2001 From: Cedric Date: Fri, 20 Oct 2023 12:35:12 +0100 Subject: [PATCH] [BCF-2705] Randomize addresses in EVM forwarders tests (#11018) --- core/cmd/forwarders_commands_test.go | 5 ++--- core/web/evm_forwarders_controller_test.go | 7 +++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/core/cmd/forwarders_commands_test.go b/core/cmd/forwarders_commands_test.go index 4381b5ca683..b08d94f64dc 100644 --- a/core/cmd/forwarders_commands_test.go +++ b/core/cmd/forwarders_commands_test.go @@ -6,7 +6,6 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/urfave/cli" @@ -23,7 +22,7 @@ func TestEVMForwarderPresenter_RenderTable(t *testing.T) { var ( id = "1" - address = common.HexToAddress("0x5431F5F973781809D18643b87B44921b11355d81") + address = utils.RandomAddress() evmChainID = utils.NewBigI(4) createdAt = time.Now() updatedAt = time.Now().Add(time.Second) @@ -76,7 +75,7 @@ func TestShell_TrackEVMForwarder(t *testing.T) { set := flag.NewFlagSet("test", 0) cltest.FlagSetApplyFromAction(client.TrackForwarder, set, "") - require.NoError(t, set.Set("address", "0x5431F5F973781809D18643b87B44921b11355d81")) + require.NoError(t, set.Set("address", utils.RandomAddress().Hex())) require.NoError(t, set.Set("evm-chain-id", id.String())) err := client.TrackForwarder(cli.NewContext(nil, set, nil)) diff --git a/core/web/evm_forwarders_controller_test.go b/core/web/evm_forwarders_controller_test.go index 1f4dd744d98..46820b42337 100644 --- a/core/web/evm_forwarders_controller_test.go +++ b/core/web/evm_forwarders_controller_test.go @@ -6,7 +6,6 @@ import ( "net/http" "testing" - "github.com/ethereum/go-ethereum/common" "github.com/manyminds/api2go/jsonapi" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -51,7 +50,7 @@ func Test_EVMForwardersController_Track(t *testing.T) { }) // Build EVMForwarderRequest - address := common.HexToAddress("0x5431F5F973781809D18643b87B44921b11355d81") + address := utils.RandomAddress() body, err := json.Marshal(web.TrackEVMForwarderRequest{ EVMChainID: chainId, Address: address, @@ -91,11 +90,11 @@ func Test_EVMForwardersController_Index(t *testing.T) { fwdrs := []web.TrackEVMForwarderRequest{ { EVMChainID: chainId, - Address: common.HexToAddress("0x5431F5F973781809D18643b87B44921b11355d81"), + Address: utils.RandomAddress(), }, { EVMChainID: chainId, - Address: common.HexToAddress("0x5431F5F973781809D18643b87B44921b11355d82"), + Address: utils.RandomAddress(), }, } for _, fwdr := range fwdrs {