Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove synchronizer dependency from eth tx manager to confirm monitored tx #3658

Merged
merged 2 commits into from
May 29, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 3 additions & 20 deletions ethtxmanager/ethtxmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
Loading