Skip to content

Support Glamsterdam (EIP-7732) in the oracle - #260

Open
Marketen wants to merge 20 commits into
glamsterdam-prepfrom
glamsterdam
Open

Marketen wants to merge 20 commits into
glamsterdam-prepfrom
glamsterdam

Conversation

@Marketen

@Marketen Marketen commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Stacked on the preparation PR (base branch glamsterdam-prep). Supersedes #258: its commits are kept as they were, with the changes below on top.

What Glamsterdam changes for the oracle

After the fork (EIP-7732) a beacon block no longer contains its execution payload. It carries the builder's bid: a promise to pay value to fee_recipient. The payload is published separately, and the protocol pays the bid from the builder's deposit as a withdrawal in a later payload, with no transaction and no event. The oracle keeps doing the same job, sharing what reaches the pool by effective balance, from this new evidence.

How a Gloas slot is processed

  • When. A slot is processed once the last slot of the next epoch is finalized, for every slot. Two facts are only settled after the slot: whether its payload was built on (the next block's bid names it as parent) and, if it was withheld, whether the bid is still paid. The protocol decides the second one at the end of the next epoch, when it compares the same-slot attestation weight with 60% of one slot's share of the active balance.
  • Payload. Read from /eth/v1/beacon/execution_payload_envelopes/{block_id}.
  • Is the bid paid. Read from /eth/v1/beacon/states/{state_id}/builder_pending_payments: the state of the slot itself when the payload was included, the last slot of the next epoch when it was withheld.
  • Builder payments in flight. A credited bid is tracked until its withdrawal (builder index and amount) reaches the pool. On-chain reconciliation counts in-flight payments as assets.

Verdicts

Slot Verdict Shared
Bid pays the pool, payload included OK Bid value, plus anything the payload paid the pool
Self-built, fee recipient is the pool OK Priority fees
Bid pays the pool, payload withheld, 60% or more OK Bid value
Bid pays the pool, payload withheld, under 60% Missed Nothing
No beacon block Missed Nothing
Bid with value > 0 paying another address Wrong fee recipient (ban if subscribed) What the payload still sent the pool is shared as a donation
Zero-value bid, payload pays the pool by a transaction OK What the transaction paid
Builder withdrawal to the pool that no bid promised not a proposal Shared as a donation, logged and counted in a metric

A validator is never banned for what a builder failed to do: a withheld payload or a trusted payment that never arrives is not a ban.

New since #258

  • Hoodi fork slot 4595712 (epoch 143616). The slot in Make the oracle Glamsterdam ready #258, 4235264, was cancelled upstream and would halt the oracle at its first block.
  • Startup check against the beacon node's GLOAS_FORK_EPOCH: refuses to run on a mismatch, or when the node schedules the fork and the oracle has no slot for the chain.
  • Unexpected builder withdrawals are donations. They used to stop the oracle. They are now shared, recorded in the state, logged at WARN and counted in oracle_unexpected_builder_withdrawals_total. The oracle still stops if the withdrawal matches a payment it judged unpaid within the last 8 epochs, since that means its own verdict was wrong.
  • A bid paying another address is a wrong fee recipient whatever the payload sent the pool. Make the oracle Glamsterdam ready #258 accepted it if the pool received anything, which let a validator keep the bid and stay in good standing with a dust payment.
  • Tips are allocated exactly once when the pool is the payload's fee recipient and the last transaction is MEV-shaped.
  • Robustness. The builder payments request uses the configured endpoint and a timeout; the inclusion check reuses the finalized slot the main loop already has.
  • Observability. oracle_late_builder_payments and oracle_late_builder_payments_wei for credited payments that have not arrived after 4 epochs.
  • API. Block endpoints return an optional builder_payment_wei.
  • Docs. README (node requirements, fork table, metrics and suggested alerts) and spec/README.md (the rules above).

What operators need

  • Beacon and execution nodes on releases that include the Hoodi fork epoch, serving the two endpoints above for past slots. Archive nodes as before.
  • For the rare case of a withheld payload whose bid pays the pool, the oracle fetches all active validators at a past state, which go-eth2-client does by downloading the full state from /eth/v2/debug/beacon/states/{state_id}.
  • A snapshot of the oracle state before the fork: once a builder payment is in the state file, older versions cannot load it.

Nothing changes before the fork

Chains with no fork slot (mainnet today) and every slot before it behave as on main. New state fields are omitted when empty, so states saved before the fork keep their hash.

Testing

  • go build ./... && go vet ./... && go test -count=1 ./... pass (196 tests).
  • The Gloas logic was audited against consensus-specs v1.7.0-beta.5; nothing that changed in the spec since Make the oracle Glamsterdam ready #258 was written affects the oracle.
  • Live Sepolia: blocks, payload envelopes, GLOAS_FORK_EPOCH and builder_pending_payments decode with go-eth2-client v0.30.2, and a pending payment at slot 11699231 was traced to the builder withdrawal of the same amount in the payload of slot 11699232.

Not verified yet

  • Behaviour against upgraded Hoodi nodes: no client release carries epoch 143616 at the time of writing.
  • Whether the full-state download above finishes within the 120 s client timeout on mainnet.

🤖 Generated with Claude Code

Marketen and others added 20 commits December 1, 2026 12:38
From Gloas, Glamsterdam's consensus fork, the beacon block no longer
carries the execution payload (EIP-7732). It carries a builder's bid,
which commits to the payload by its hash, and the builder publishes the
payload separately. A slot can now be full, empty (beacon block but no
execution payload) or missed.

- GloasForkSlot holds the fork slot per chain, only Hoodi for now. The
  oracle stops at a beacon block whose version doesn't match it, so a
  chain must be listed before it forks and history is never processed
  with the wrong rules.
- A slot is full when the next beacon block builds on its payload. Its
  payload is then fetched from the beacon node's envelope endpoint and
  checked against the bid. Empty slots have no execution block, so no
  events, txs or receipts are fetched for them.
- The FullBlock getters read the payload of Gloas slots, and the code
  reading the execution block (donations, forced payments, the latest
  processed block) now also skips empty slots, not only missed ones.
- The outcome of a Gloas slot is only settled after it is finalized:
  its payload's inclusion is decided by the next beacon block, and a
  withheld payload's payment at the end of the next epoch. The main loop
  waits until that epoch is finalized, trailing finality by ~1 epoch.

Classifying Gloas proposals needs the builder payment, which the next
commits add. Until then the oracle stops at the first Gloas proposal
rather than classifying it with pre-Gloas rules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From Gloas, a builder's bid promises a payment to the proposer's fee
recipient, which the protocol takes from the builder's deposit. It is
paid when the next beacon block builds on the bid's execution payload.
When the payload is withheld, the protocol still pays it if the beacon
block got 60% of its slot's stake in same-slot votes, deciding it in
the epoch transition after the next epoch. Slashing the proposer
cancels a payment not decided yet.

The oracle reproduces that decision instead of trusting it: it reads
the builder pending payments and the total active balance from the
beacon state right before the transition, at the last slot of the next
epoch, and applies the spec's quorum. Effective balances only change
after the payments are decided, so the quorum is the one the protocol
used. The active set is heavy to fetch, so this only happens for empty
slots whose bid paid the pool.

Only payments to the pool are recorded, in FullBlock.BuilderPayment.
Nothing uses them yet; the next commits classify proposals and track
the payments until they reach the pool.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Gloas proposal is judged on what the proposer chose, the bid and who
it pays, and never on what a builder failed to do:

- Self-built payload: judged as before Gloas, on the payload's fee
  recipient. If its payload was not included, the slot counts as missed.
- Bid paying the pool: a valid proposal, rewarded with whatever reached
  the pool: the bid value when the protocol paid it, plus anything the
  payload itself paid (an execution_payment tx, or the tips when the
  builder made the pool its fee recipient). An unpaid execution_payment
  is the builder's fault, so it no longer gets the validator banned.
- Bid paying the pool but withheld payload and dropped payment: missed,
  as the beacon block was too late to collect its votes.
- Bid paying someone else: wrong fee recipient, as before. If the
  payload still paid the pool, that ETH is credited rather than left
  unallocated.

Missed and wrong fee keep their existing consequences, so no new block
types or state machine events are introduced and the API is unchanged.

The part of a reward paid from the builder's deposit is stored in the
new SummarizedBlock.BuilderPaymentWei, since it arrives with no event.
The offchain reconciliation counts it as an asset. The field is omitted
when nil, so states saved before this change keep their hash.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A builder payment is credited when its slot is processed, but reaches
the pool later, as a withdrawal in another execution payload: usually
the next one, about an epoch later when the payload was withheld. Until
then the oracle owes ETH the pool doesn't hold yet, and the exact
onchain reconciliation run before every checkpoint would fail.

- Credited builder payments are kept in the state as in flight. They
  are removed when a builder withdrawal to the pool with the same
  builder and amount is processed. A builder withdrawal to the pool that
  matches no credited payment rejects the slot, as that ETH would
  otherwise be left unallocated.
- The onchain reconciliation counts the payments in flight as part of
  what the pool holds. It stays exact, with no tolerance.
- The forced payment detector reads the pool balance across a block,
  so it now explains builder withdrawals to the pool instead of
  rejecting them. Any other withdrawal to the pool is still rejected.

The state only keeps the payments in flight, so it doesn't grow. The
new field is omitted when empty, and a test checks states saved before
Gloas still load with their hash.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From the Gloas fork on, the oracle processes a slot only once the epoch
after it is finalized, so in sync it trails the finalized slot by 33
slots. The API still measured sync against the finalized slot:

- /status would report is_oracle_in_sync false forever, since it
  required the processed slot to equal the finalized one.
- OracleReady(64), which gates the proofs and validators endpoints,
  allows 64 slots behind finality. Right after each epoch is finalized
  the oracle is 65 behind until it processes it, so those endpoints
  would refuse requests briefly every epoch.

LatestSettledSlot returns the latest slot the oracle can process given
the finalized one. The main loop, /status and OracleReady now all use
it, so they can't disagree, and a test checks it against the per-slot
settlement rule by brute force. oracle_sync_distance_slots and the time
to the next checkpoint are counted from it too. Before the fork it is
the finalized slot, so nothing changes until then.

The distance_from_finalized_slot metric keeps its meaning, so from the
fork on it will read about 33 when the oracle is in sync.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A bid whose payload the next beacon block built on was assumed paid.
The next block does settle it before anything else, but slashing the
proposer cancels a pending payment, and a slashing of the proposer
included in its own beacon block happens before that. It is not as
unlikely as it sounds: a validator run on two machines gets slashed
with evidence that its own node may then include.

Had it happened, the oracle would have credited ETH that never comes,
and the onchain reconciliation would have counted it in flight forever,
hiding that the pool lacks it rather than stopping.

So a full slot's payment is now checked like a withheld one's, against
the beacon state: it is paid if its builder_pending_payments entry
survived its own beacon block. The exception, also from the spec, is a
next beacon block two or more epochs later, which appends the payment
directly whatever that entry says. Only read for bids paying the pool,
and the endpoint returns 64 entries.

A cancelled payment is not credited nor tracked. The proposer still
chose a bid paying the pool, so it is not banned.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A builder withdrawal of zero to the pool moves no ETH, so it is not
matched against credited payments. Before, it would have stopped the
oracle as an unknown payment. The forced payment check already skips
zero amounts.

Builder payments reach the pool within about two epochs. One credited
but still in flight after four is now logged once per epoch: it may
never arrive, and until it does it counts as a pool asset in the onchain
reconciliation. It only warns. Slots are processed in order, so stopping
would also stop the oracle from reaching the slot where a slow payment
lands, and with whether payments are made now decided exactly, one
missing would point at a consensus client bug.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Hoodi Glamsterdam activation at epoch 132352 was cancelled. It is
now scheduled at epoch 143616, slot 4595712, timestamp 1797361944, as
set by GLOAS_FORK_EPOCH in eth-clients/hoodi metadata/config.yaml.

The tests that spelled out the old epoch or a state of its first epochs
now use the new one. Mainnet has no date yet and stays unset.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The oracle has its own Gloas fork slot per chain, and the per block
check only fires once a Gloas beacon block shows up where it does not
expect one. A fork slot that is wrong or missing should stop the oracle
before it processes anything, not when the fork is reached.

At startup GLOAS_FORK_EPOCH is read from the beacon node's
/eth/v1/config/spec and compared with the configured slot:

- Both scheduled but different: stop, one of them is wrong.
- The node schedules it but the chain has no fork slot: stop, the fork
  slot has to be added before running.
- The node does not schedule it yet (far future, or a release without
  Gloas) while a slot is configured: a warning while the fork is still
  ahead of the finalized slot, so the node can be upgraded in time. If
  the fork is already finalized, stop: the node is outdated or on
  another chain, or the slot is wrong.

The per block check stays.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A builder withdrawal to the pool that matched no credited payment
stopped the oracle. Nothing would make it pass short of a code change,
and the ETH is in the pool either way: a builder exiting with the pool
as its execution address would do it, and anyone can set that.

Such a withdrawal is now shared among the eligible validators exactly
like an EtherReceived donation: same distribution function and pool
fee, handled right after the block's donations. It can't go into
Donations, which holds contract events and feeds /memory/donations:
the front end links each one to its tx and sender, and there are none.
So it is kept in a new state field, builder_withdrawal_donations, with
its slot, block, builder index, amount and withdrawal index. The
offchain reconciliation counts it as an asset, the pool balance
already holds it for the onchain one, and the forced payment detector
already leaves every builder withdrawal out. /memory/statistics counts
it in the donations and rewards totals.

Since none is expected, each one is logged as a warning with those
fields and counted in oracle_unexpected_builder_withdrawals_total, to
alert on. The README says so.

The exception is a withdrawal matching, by builder and amount, a
payment to the pool the oracle judged unpaid in the 256 slots before:
that verdict was wrong, so the slot is still rejected with the state
untouched. Unpaid payments were not kept until now, they are in
recent_unpaid_builder_payments for that window. A real payment arrives
within about two epochs plus any run of empty slots, so eight epochs
leave ample margin, while a longer window would mostly catch unrelated
withdrawals of the same builder and amount.

Both new fields are omitted when empty, so states saved before Gloas
keep their hash.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The activation slots of forced payment detection only list mainnet, and
a chain without one runs the latest detector from genesis. So on Hoodi
the any position detector already runs before the Gloas fork, and from
the fork on its Gloas path, which leaves builder withdrawals to the pool
out of the unexplained inflow. That path is exercised on the testnet
before mainnet with no change.

Listing Hoodi at its fork slot, as considered, would instead turn the
detection off for every Hoodi slot before the fork, and change how a
resync classifies those blocks. Say so next to the activation slots,
and test that both detectors stay active on Hoodi before and after the
fork.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
README: the consensus client must serve execution payload envelopes and
builder pending payments, both nodes stay archive nodes, the startup
fork check, the fork slot of each chain, and why an oracle in sync
trails finality by about an epoch from the fork on. The sync distance
is now described against the latest slot the oracle can process.

spec/README.md: how a Gloas slot is processed and a table of the
proposal outcomes, with when builder payments are credited and what
happens to builder withdrawals that pay none.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ments

fetchBuilderPendingPayments had the same two problems as the pending
consolidations call: a URL built from the masked address go-eth2-client
keeps for logging, and http.DefaultClient, with no timeout. It now uses
the configured endpoint and the same client with a 120 second timeout,
and reports failures without the URL.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A Gloas proposal whose bid paid another address still counted as a
correct one if its payload sent the pool anything. A subscriber could
take a bid of 0.5 ETH paid to its own address, with the pool as the
payload's fee recipient collecting a few wei of tips: a correct proposal
with a dust reward, no ban, and the real payment kept.

A bid of value above 0 whose fee_recipient is not the pool is now a
wrong fee recipient, whatever the payload did: a ban if the proposer is
subscribed, no auto subscription if not. Bids of value 0 promise no
payment, so self-built payloads and trusted bids paid by a tx keep their
rules.

What the payload still sent the pool is in the pool, so it is shared
among the eligible validators like a donation:

- A payment with an EtherReceived event, a tx to the pool or a forced
  payment, is left in the block's donations by GetDonations instead of
  being taken as the proposal's MEV reward. It is then an ordinary
  donation, with its real tx and sender in /memory/donations, and the
  offchain reconciliation already counts its event.
- Tips collected by the pool as the payload's fee recipient have no
  event nor tx. They are shared the same way and recorded in a new
  state field, tip_donations, which the offchain reconciliation counts
  as an asset and /memory/statistics as donations. Omitted when empty,
  so states saved before Gloas keep their hash.

The spec table says so.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A builder payment credited to the pool counts as a pool asset in the
onchain reconciliation until its withdrawal arrives. One that never
arrives would hide that the pool lacks it, and today that only shows as
a log warning once per epoch.

oracle_late_builder_payments and oracle_late_builder_payments_wei now
hold how many in flight payments are past the same 4 epoch threshold the
warning uses, and their amount, updated on every processed slot. The
README suggests an alert on them next to the other one. Nothing stops
the oracle: a late payment may still land in a later slot.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
IsExecutionPayloadIncluded fetched the finalized header again to know
how far to look for the next beacon block. The main loop had just
fetched one to decide the slot is settled. With a load balanced
endpoint the second answer can briefly be older, the scan then finds
no next beacon block, and the oracle stops.

FetchFullBlock now takes the finalized slot the main loop used and
passes it down, so both decisions rest on the same one. The scan can
reach the slot's settlement slot, as a new test checks. Before Gloas the
slot is not used. The manual tests that call FetchFullBlock against
live nodes read the finalized slot themselves.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
From Gloas, part of a proposal's reward can be a builder payment the
protocol made from the builder's deposit, but the block endpoints only
returned the total, so the front end could not tell it from ordinary
MEV. /memory/allblocks, /memory/proposedblocks, /memory/missedblocks
and /memory/wrongfeeblocks now return builder_payment_wei, a string
like reward_wei, from SummarizedBlock. It is omitted when there is
none, so responses for blocks before Gloas are unchanged.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Deciding whether the protocol pays a withheld payload's bid to the pool
needs the total active balance at a past state. go-eth2-client fetches
all validators by downloading the whole state from
/eth/v2/debug/beacon/states/{state_id}, so the consensus client must
serve that endpoint for historical states. The README says so with the
other Gloas node requirements.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
GetDonatedTips relied on GetSentRewardAndType, which returns a MEV
reward as soon as the payload's last tx looks like a MEV payment, eg one
sent by a whitelisted builder address. With the pool as the payload's
fee recipient its tips still reached the pool, but they were then left
out of everything: the onchain reconciliation failed by exactly their
amount, which stops the oracle. It happened when the bid paid another
address, and also when the bid paid the pool, whose reward then held the
bid and the MEV shaped tx but not the tips.

From Gloas, whenever the payload's fee recipient is the pool, its tips
are now allocated exactly once: as the proposal's reward when it is a
correct VanilaBlock one, as a tip donation in any other case. A payment
with an event is still allocated once, as the reward or as a donation,
and a tx's value is never part of the tips, so nothing is counted
twice. Self-built payloads keep being judged as before Gloas, only
their tips' allocation changes. Before Gloas nothing changes.

Tests reproduce the four failing cases, which failed the onchain
reconciliation by the tips, cover self-built payloads, and check that
the tips of a correct vanilla proposal are not donated on top.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The comment on unpaidBuilderPaymentWindowSlots said at most one builder
withdrawal is queued per slot. That only holds on average: an epoch
transition can queue up to 32 withheld payments at once, on top of the
one the next beacon block settles. Payloads take 15 each, so such a
burst drains in three full payloads, and the 8 epoch window still leaves
ample margin. Only the comment changes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant