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

feat(miner): compress the txlist bytes after checking the transaction is executable #269

Merged
merged 4 commits into from
Jun 6, 2024
Merged
Changes from 2 commits
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: 12 additions & 11 deletions miner/taiko_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,16 +265,6 @@ func (w *worker) commitL2Transactions(
// during transaction acceptance is the transaction pool.
from, _ := types.Sender(env.signer, tx)

b, err := encodeAndComporeessTxList(append(env.txs, tx))
if err != nil {
log.Trace("Failed to rlp encode and compress the pending transaction %s: %w", tx.Hash(), err)
txs.Pop()
continue
}
if len(b) > int(maxBytesPerTxList) {
break
}

// Check whether the tx is replay protected. If we're not in the EIP155 hf
// phase, start ignoring the sender until we do.
if tx.Protected() && !w.chainConfig.IsEIP155(env.header.Number) {
Expand All @@ -286,7 +276,7 @@ func (w *worker) commitL2Transactions(
// Start executing the transaction
env.state.SetTxContext(tx.Hash(), env.tcount)

_, err = w.commitTransaction(env, tx)
_, err := w.commitTransaction(env, tx)
switch {
case errors.Is(err, core.ErrNonceTooLow):
// New head notification data race between the transaction pool and miner, shift
Expand All @@ -304,6 +294,17 @@ func (w *worker) commitL2Transactions(
log.Trace("Transaction failed, account skipped", "hash", ltx.Hash, "err", err)
txs.Pop()
}

b, err := encodeAndComporeessTxList(append(env.txs, tx))
davidtaikocha marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
log.Trace("Failed to rlp encode and compress the pending transaction %s: %w", tx.Hash(), err)
txs.Pop()
continue
}
if len(b) > int(maxBytesPerTxList) {
env.txs = env.txs[0 : env.tcount-1]
break
}
}
}

Expand Down
Loading