feat(anvil): add --max-tx-inclusion-time-in-slot option#13402
Draft
spalladino wants to merge 1 commit intofoundry-rs:masterfrom
Draft
feat(anvil): add --max-tx-inclusion-time-in-slot option#13402spalladino wants to merge 1 commit intofoundry-rs:masterfrom
--max-tx-inclusion-time-in-slot option#13402spalladino wants to merge 1 commit intofoundry-rs:masterfrom
Conversation
mattsse
reviewed
Feb 9, 2026
Member
mattsse
left a comment
There was a problem hiding this comment.
I feel like this is kinda similar to sendRawTransactionConditional
so I wonder if we should just adopt this as meta info on the pooled tx type instead?
then we could still layer the cli arg behaviour on top later and make this the default for all incoming txs?
does that make sense?
Contributor
Author
|
Interesting! I didn't know ERC7796, but I think it makes sense. So, to double check I understood you correctly:
Does it make sense? |
…796) Replace the raw `timestamp: u64` field on `PoolTransaction` with `conditions: Option<TransactionConditional>` from alloy, moving the inclusion logic from mining-time timestamp comparison to submission-time `block_number_min` computation via `compute_tx_conditions()`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
8ee8095 to
a9fb407
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To simulate real-world inclusion, it'd be handy to have Anvil include txs in the next block only if these txs were sent with enough time in advance to be picked up. I asked Claude to add this to Anvil as a flag, and here's the work it produced.
The PR is flagged as draft since I still want to make another pass myself at Claude's code, but before I do so, I'm curious if this feature would be in scope for Anvil, or it's not something you'd be interested in merging.
Summary
--max-tx-inclusion-time-in-slotCLI option to anvil that simulates a validator transaction inclusion cutoff during interval miningslot_start + max_tx_inclusion_time_in_slotare excluded from the current block and reconsidered in the next oneSemantics
--max-tx-inclusion-time-in-slot <SECONDS>(requires--block-time)[block_timestamp - block_time, block_timestamp)tx.submission_timestamp <= slot_start + max_tx_inclusion_time_in_slotNone(disabled, preserving current behavior)Changes
crates/anvil/src/eth/pool/transactions.rstimestamp: u64toPoolTransactioncrates/anvil/src/eth/backend/time.rscurrent_time()method toTimeManagercrates/anvil/src/eth/api.rscrates/anvil/src/eth/backend/mem/mod.rsBackend, filter indo_mine_blockcrates/anvil/src/cmd.rs--max-tx-inclusion-time-in-slotCLI argcrates/anvil/src/config.rsNodeConfigfield and builder methodcrates/anvil/tests/it/anvil.rsTest plan
anvil --block-time 12 --max-tx-inclusion-time-in-slot 4🤖 Generated with Claude Code