We currently use the latest nonce from cometbft before submitting each batch to the sequencer. This can cause problems if there are pending transactions in the mempool, since the nonce returned from cometbft is only updated after successful execution. Instead, we should:
- Use the pending nonce functionality from the sequencer's grpc service.
- On startup, wait for the mempool to clear (by waiting until
pending nonce == latest nonce) before processing withdrawal batches.
This way the bridge withdrawer will only start processing transactions from the latest unprocessed batch regardless of pending submissions (e.g. caused by a mid-submission restart) and won't fail submissions due to mempool-related race conditions.
We currently use the latest nonce from cometbft before submitting each batch to the sequencer. This can cause problems if there are pending transactions in the mempool, since the nonce returned from cometbft is only updated after successful execution. Instead, we should:
pending nonce == latest nonce) before processing withdrawal batches.This way the bridge withdrawer will only start processing transactions from the latest unprocessed batch regardless of pending submissions (e.g. caused by a mid-submission restart) and won't fail submissions due to mempool-related race conditions.