-
Notifications
You must be signed in to change notification settings - Fork 9
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
feat: remove txs which do not end up in a block out of the mempool #15
Changes from 1 commit
4527d59
490cb0a
b98ed0e
67d9f9e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -810,6 +810,8 @@ func (w *worker) commitAstriaTransactions(env *environment, txs *types.Transacti | |
// If we don't have enough gas for any further transactions then we're done. | ||
if env.gasPool.Gas() < params.TxGas { | ||
log.Trace("Not enough gas for further transactions", "have", env.gasPool, "want", params.TxGas) | ||
// remove txs from the mempool if they are too big for this block | ||
w.eth.TxPool().UpdateAstriaInvalid(tx) | ||
break | ||
} | ||
|
||
|
@@ -821,7 +823,7 @@ func (w *worker) commitAstriaTransactions(env *environment, txs *types.Transacti | |
// phase, start ignoring the sender until we do. | ||
if tx.Protected() && !w.chainConfig.IsEIP155(env.header.Number) { | ||
log.Trace("Ignoring reply protected transaction", "hash", tx.Hash(), "eip155", w.chainConfig.EIP155Block) | ||
|
||
w.eth.TxPool().UpdateAstriaInvalid(tx) | ||
continue | ||
} | ||
// Start executing the transaction | ||
|
@@ -839,7 +841,7 @@ func (w *worker) commitAstriaTransactions(env *environment, txs *types.Transacti | |
|
||
case errors.Is(err, core.ErrNonceTooHigh): | ||
// Reorg notification data race between the transaction pool and miner, skip account = | ||
log.Trace("Skipping account with hight nonce", "sender", from, "nonce", tx.Nonce()) | ||
log.Trace("Skipping account with high nonce", "sender", from, "nonce", tx.Nonce()) | ||
|
||
case errors.Is(err, nil): | ||
// Everything ok, collect the logs and shift in the next transaction from the same account | ||
|
@@ -855,6 +857,10 @@ func (w *worker) commitAstriaTransactions(env *environment, txs *types.Transacti | |
// nonce-too-high clause will prevent us from executing in vain). | ||
log.Debug("Transaction failed, account skipped", "hash", tx.Hash(), "err", err) | ||
} | ||
if err != nil { | ||
log.Trace("Marking transaction as invalid", "hash", tx.Hash(), "err", err) | ||
w.eth.TxPool().UpdateAstriaInvalid(tx) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we also remove if a tx is skipped because of a high nonce or low nonce? or only because it exceeded the gas limit? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We ideally should to maintain 1:1 block determinism. So we should include all of these cases. |
||
} | ||
} | ||
if !w.isRunning() && len(coalescedLogs) > 0 { | ||
// We don't push the pendingLogsEvent while we are sealing. The reason is that | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In vanilla geth, an empty block is created and then a full block is created. This is mainly to spend more time to optimize for gas fees and also to return at least an empty block if we were not able to create a full block on time.
We don't need this astria since we just blindly use the txs received from ExecuteBlock. so fullParams makes more sense than emptyParams over here.