Build a block for each slot from the node's mempool - #557
Open
0w3n-d wants to merge 1 commit into
Open
Conversation
Reserve the payout gas by lowering `remaining_gas` before the fill and restoring it after. `fill_transactions` spends the whole budget. Raise the default subsidy to 0.001 ETH. At 1 gwei the old default could not cover the payout's own gas, so every idle slot was skipped. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
6 tasks
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.
Issue: #550 (step 3 of 6)
What this PR does
Builds a block for each slot the watcher publishes. The role now runs end to
end up to the point of submission: it fills from the node's mempool, pays the
proposer, and logs the block and its value.
The coinbase is the builder, so tips accrue here and the bid is
Reserving the full
payout_gas_reserverather than the actual 21000 isdeliberate: it under-credits the builder slightly and can never overdraw it.
fill_transactionsgates only onctx.remaining_gas, which ispub, so thereservation needs no ethrex change.
Two fixes to earlier steps
payout's own gas (21000 x base fee, around 2e13 wei), so every build with an
idle mempool failed. Raised to 0.001 ETH.
an_empty_mempool_still_bids_the_subsidycaught this; step 1's assertions are updated to match.
SlotContextdrain inmain.rsis replaced by the real consumer,so nothing is dead.
What this PR deliberately does not do
No signing and no submission —
BuiltBlock'sblobs_bundle,requestsandaccount_updatescarry#[allow(dead_code)]until step 4 consumes them. Nocustom ordering: this uses ethrex's tip-sorted
fill_transactions. No in-slotrebuilding; the block is built once per slot event.
Tests
13 new, written before the implementation and signed off first, all against a
real chain (
dev_genesis_store+funded_signers) with transactions admittedthrough
add_transaction_to_pool.the builder as coinbase; the header gas limit follows the registered limit
through ethrex's clamp.
recipient, and pays exactly the bid; the bid matches the formula; the fee
recipient's balance rises by the bid, checked against the parent state the
way the relay's
paid_by_balancedoes; and the reserve survives a full block— without it that test fails, which is the point.
tips is refused; an unaffordable payout is refused; paying ourselves is
refused. A bad slot is skipped with a typed error, never submitted broken.
with the sidecar the mempool holds.
127 pass in the crate.
Reviewer checklist
lint,unit-test) is green