From 6ca140d2b32237d11e7084297825241775e1627f Mon Sep 17 00:00:00 2001 From: Dimitris Date: Thu, 19 Dec 2024 19:13:35 +0200 Subject: [PATCH] Fix beholder transmission --- core/chains/evm/txm/txm.go | 2 +- core/chains/evm/txm/txm_test.go | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/core/chains/evm/txm/txm.go b/core/chains/evm/txm/txm.go index 1c0bc939613..ff65b3e6b2b 100644 --- a/core/chains/evm/txm/txm.go +++ b/core/chains/evm/txm/txm.go @@ -358,7 +358,7 @@ func (t *Txm) sendTransactionWithError(ctx context.Context, tx *types.Transactio } t.metrics.IncrementNumBroadcastedTxs(ctx) - if bErr := t.metrics.EmitTxMessage(ctx, attempt.Hash, address, tx.ToAddress, *tx.Nonce); bErr != nil { + if bErr := t.metrics.EmitTxMessage(ctx, attempt.Hash, address, *attempt.SignedTransaction.To(), *tx.Nonce); bErr != nil { t.lggr.Errorw("Beholder error emitting tx message", "err", bErr) } return t.txStore.UpdateTransactionBroadcast(ctx, attempt.TxID, *tx.Nonce, attempt.Hash, address) diff --git a/core/chains/evm/txm/txm_test.go b/core/chains/evm/txm/txm_test.go index 458c0ca97ef..43f19ea1efa 100644 --- a/core/chains/evm/txm/txm_test.go +++ b/core/chains/evm/txm/txm_test.go @@ -7,6 +7,7 @@ import ( "time" "github.com/ethereum/go-ethereum/common" + evmtypes "github.com/ethereum/go-ethereum/core/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" @@ -191,10 +192,14 @@ func TestBroadcastTransaction(t *testing.T) { } tx, err := txm.CreateTransaction(tests.Context(t), txRequest) require.NoError(t, err) + legacyTx := evmtypes.LegacyTx{ + To: &address, + } attempt := &types.Attempt{ - TxID: tx.ID, - Fee: gas.EvmFee{GasPrice: assets.NewWeiI(1)}, - GasLimit: 22000, + TxID: tx.ID, + Fee: gas.EvmFee{GasPrice: assets.NewWeiI(1)}, + GasLimit: 22000, + SignedTransaction: evmtypes.NewTx(&legacyTx), } ab.On("NewAttempt", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(attempt, nil).Once() client.On("SendTransaction", mock.Anything, mock.Anything, mock.Anything).Return(nil).Once()