diff --git a/ethtxmanager/ethtxmanager.go b/ethtxmanager/ethtxmanager.go index 1c48071cf0..79f9262962 100644 --- a/ethtxmanager/ethtxmanager.go +++ b/ethtxmanager/ethtxmanager.go @@ -13,7 +13,6 @@ import ( "time" "github.com/0xPolygonHermez/zkevm-node/log" - "github.com/0xPolygonHermez/zkevm-node/state" "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" @@ -457,25 +456,9 @@ func (c *Client) monitorTx(ctx context.Context, mTx monitoredTx, logger *log.Log // if mined, check receipt and mark as Failed or Confirmed if lastReceiptChecked.Status == types.ReceiptStatusSuccessful { - receiptBlockNum := lastReceiptChecked.BlockNumber.Uint64() - - // check if state is already synchronized until the block - // where the tx was mined - block, err := c.state.GetLastBlock(ctx, nil) - if errors.Is(err, state.ErrStateNotSynchronized) { - logger.Debugf("state not synchronized yet, waiting for L1 block %v to be synced", receiptBlockNum) - return - } else if err != nil { - logger.Errorf("failed to check if L1 block %v is already synced: %v", receiptBlockNum, err) - return - } else if block.BlockNumber < receiptBlockNum { - logger.Debugf("L1 block %v not synchronized yet, waiting for L1 block to be synced in order to confirm monitored tx", receiptBlockNum) - return - } else { - mTx.status = MonitoredTxStatusConfirmed - mTx.blockNumber = lastReceiptChecked.BlockNumber - logger.Info("confirmed") - } + mTx.status = MonitoredTxStatusConfirmed + mTx.blockNumber = lastReceiptChecked.BlockNumber + logger.Info("confirmed") } else { // if we should continue to monitor, we move to the next one and this will // be reviewed in the next monitoring cycle diff --git a/ethtxmanager/ethtxmanager_test.go b/ethtxmanager/ethtxmanager_test.go index 0ca53086fd..350332aae7 100644 --- a/ethtxmanager/ethtxmanager_test.go +++ b/ethtxmanager/ethtxmanager_test.go @@ -9,7 +9,6 @@ import ( "time" "github.com/0xPolygonHermez/zkevm-node/config/types" - "github.com/0xPolygonHermez/zkevm-node/state" "github.com/0xPolygonHermez/zkevm-node/test/dbutils" "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/common" @@ -118,14 +117,6 @@ func TestTxGetMined(t *testing.T) { Return("", nil). Once() - block := &state.Block{ - BlockNumber: blockNumber.Uint64(), - } - st. - On("GetLastBlock", ctx, nil). - Return(block, nil). - Once() - err = ethTxManagerClient.Add(ctx, owner, id, from, to, value, data, gasOffset, nil) require.NoError(t, err) @@ -263,14 +254,6 @@ func TestTxGetMinedAfterReviewed(t *testing.T) { Return(receipt, nil). Once() - block := &state.Block{ - BlockNumber: blockNumber.Uint64(), - } - st. - On("GetLastBlock", ctx, nil). - Return(block, nil). - Once() - // Build result etherman. On("GetTx", ctx, firstSignedTx.Hash()). @@ -383,16 +366,8 @@ func TestTxGetMinedAfterConfirmedAndReorged(t *testing.T) { } etherman. On("GetTxReceipt", ctx, signedTx.Hash()). - Return(receipt, nil). - Once() - - block := &state.Block{ - BlockNumber: blockNumber.Uint64(), - } - st. - On("GetLastBlock", ctx, nil). Run(func(args mock.Arguments) { ethTxManagerClient.Stop() }). // stops the management cycle to avoid problems with mocks - Return(block, nil). + Return(receipt, nil). Once() // Build Result 1 @@ -433,12 +408,8 @@ func TestTxGetMinedAfterConfirmedAndReorged(t *testing.T) { // Monitoring Cycle 3 etherman. On("CheckTxWasMined", ctx, signedTx.Hash()). - Return(true, receipt, nil). - Once() - st. - On("GetLastBlock", ctx, nil). Run(func(args mock.Arguments) { ethTxManagerClient.Stop() }). // stops the management cycle to avoid problems with mocks - Return(block, nil). + Return(true, receipt, nil). Once() // Build Result 3 @@ -643,14 +614,6 @@ func TestExecutionReverted(t *testing.T) { Return(receipt, nil). Once() - block := &state.Block{ - BlockNumber: blockNumber.Uint64(), - } - st. - On("GetLastBlock", ctx, nil). - Return(block, nil). - Once() - // Build result etherman. On("GetTx", ctx, firstSignedTx.Hash()). @@ -959,14 +922,6 @@ func TestFailedToEstimateTxWithForcedGasGetMined(t *testing.T) { Return("", nil). Once() - block := &state.Block{ - BlockNumber: blockNumber.Uint64(), - } - st. - On("GetLastBlock", ctx, nil). - Return(block, nil). - Once() - err = ethTxManagerClient.Add(ctx, owner, id, from, to, value, data, gasOffset, nil) require.NoError(t, err)