Skip to content

builder payments tracking#626

Merged
pk910 merged 40 commits intogloas-supportfrom
pk910/withdrawals-tracking-gloas
Apr 11, 2026
Merged

builder payments tracking#626
pk910 merged 40 commits intogloas-supportfrom
pk910/withdrawals-tracking-gloas

Conversation

@pk910
Copy link
Copy Markdown
Member

@pk910 pk910 commented Apr 2, 2026

Full State Transition & Withdrawal Indexing for Fulu/Gloas

This branch implements a complete consensus-spec state transition engine and withdrawal indexing system for Fulu and Gloas (ePBS) forks, replacing the previous approach of loading epoch boundary states from the beacon API with local replay.

image

State Transition Engine (indexer/beacon/statetransition/)

New package implementing the full process_slots + process_block + process_epoch state transition for Fulu+ states. This allows dora to compute epoch boundary states locally by replaying blocks on top of a cached parent state, eliminating the dependency on beacon API state requests for every epoch.

Block processing (block.go):

  • process_slots with per-slot state/block root caching
  • Parent state root hint to skip expensive HTR computation (~2x speedup per block)
  • process_block_header, process_withdrawals, process_randao, process_eth1_data
  • process_execution_payload for Fulu (payload header caching) and Gloas (bid recording)
  • process_sync_aggregate with proper BLS aggregate pubkey computation

Epoch processing (statetransition.go, and per-function files):

  • All 17 Gloas epoch transition functions implemented:
    process_justification_and_finalization, process_inactivity_updates, process_rewards_and_penalties, process_registry_updates, process_slashings, process_eth1_data_reset, process_pending_deposits, process_pending_consolidations, process_builder_pending_payments, process_effective_balance_updates, process_slashings_reset, process_randao_mixes_reset, process_historical_summaries_update, process_participation_flag_updates, process_sync_committee_updates, process_proposer_lookahead, process_ptc_window

Operations (operations.go):

  • Electra+ attestation processing with correct Deneb EIP-7045 participation flags (TIMELY_TARGET has no delay constraint)
  • Gloas payload_matches and is_attestation_same_slot checks
  • Gloas builder payment weight accumulation in process_attestation
  • process_withdrawal_request with compute_exit_epoch_and_update_churn for partial withdrawals
  • process_consolidation_request with switch_to_compounding_validator and queue_excess_active_balance

Withdrawals (withdrawals.go):

  • Full Electra spec: is_fully_withdrawable_validator, is_partially_withdrawable_validator, is_eligible_for_partial_withdrawals
  • get_balance_after_withdrawals to account for prior withdrawals in the same batch
  • Correct pending partial withdrawal limit: min(prior + MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP, MAX_WITHDRAWALS_PER_PAYLOAD - 1)
  • Gloas builder pending/sweep withdrawals

Committees & shuffling (committees.go):

  • Batch swap-or-not shuffle with per-round pivot caching
  • Electra 16-bit sync committee sampling
  • BLS aggregate pubkey computation via bls12-381-util

Architecture:

  • StateTransition struct holds chain spec, dynamic-ssz encoder, and reusable caches
  • All internal functions are methods on StateTransition -- no parameter threading
  • stateAccessor provides unified field access across Fulu/Gloas state versions
  • Caches auto-invalidate on epoch boundaries and after effective balance updates

State Cache (statecache/)

Optional file-system-backed cache for beacon states. States are stored as gzip-compressed SSZ files keyed by (dependentRoot, targetEpoch). Configurable max states with LRU eviction. Eliminates redundant beacon API state requests on restart.

Epoch State Loading (indexer/beacon/epochstate.go, epochcache.go)

Reworked epoch state loading to prefer local replay over API requests:

  1. Load parent epoch's last-block state from cache or API
  2. Replay all in-epoch blocks using the state transition engine
  3. Apply epoch transition via PrepareEpochPreState
  4. Cache the result for future use
  5. Fall back to API on any failure

Gloas-specific: orphaned payloads are detected by checking next_block.bid.parent_block_hash before applying, ensuring only accepted payloads advance the state.

Withdrawal Indexing

Database schema (db/schema/):

  • New withdrawals table with type classification, reference slot tracking, and account-based filtering
  • Migration for ref_slot column addition

Withdrawal types (dbtypes/dbtypes.go):

  • Type 1: Full withdrawal (exited + withdrawable)
  • Type 2: Sweep withdrawal (excess balance)
  • Type 3: Requested withdrawal (EIP-7002)
  • Type 4: Builder full withdrawal (Gloas)
  • Type 5: Builder direct payment (payload delivered)
  • Type 6: Builder delayed payment (missed payload, quorum penalty)

State simulator (indexer/beacon/state_sim.go):

  • Builder payment classification with per-entry RefSlot tracking
  • Direct payments track source block UID through the queue via trackedBuilderWithdrawal
  • Delayed payments resolved by scanning source epoch blocks in FIFO order
  • Initial direct entries from epoch boundary resolved against previous epoch's delivered-payload blocks

Builder balances (indexer/beacon/indexer_getter.go):

  • GetRecentBuilderBalances returns epoch-start balances adjusted for in-epoch builder withdrawals
  • Builder detail page overrides stale cache balance with fresh computation

Bid extraction (indexer/beacon/writedb.go):

  • Execution payload bids extracted from Gloas block bodies during DB write
  • Previously bids were only captured via SSE events, causing 0-value display during sync

UI Pages

  • Withdrawal list page with type/validator/address filters (handlers/withdrawals_list.go)
  • Validator withdrawal tab (handlers/validator.go)
  • Builder withdrawal tab, recent blocks with bid values, recent bids (handlers/builder.go)
  • Slot page withdrawal section with type badges
  • Builder balance display on list and detail pages

dependabot Bot and others added 30 commits March 16, 2026 09:08
Bumps the dependencies group with 5 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [github.com/ethereum/go-ethereum](https://github.com/ethereum/go-ethereum) | `1.17.0` | `1.17.1` |
| [github.com/minio/minio-go/v7](https://github.com/minio/minio-go) | `7.0.98` | `7.0.99` |
| [github.com/pk910/dynamic-ssz](https://github.com/pk910/dynamic-ssz) | `1.2.1` | `1.2.2` |
| [golang.org/x/crypto](https://github.com/golang/crypto) | `0.48.0` | `0.49.0` |
| [golang.org/x/time](https://github.com/golang/time) | `0.14.0` | `0.15.0` |



Updates `github.com/ethereum/go-ethereum` from 1.17.0 to 1.17.1
- [Release notes](https://github.com/ethereum/go-ethereum/releases)
- [Commits](ethereum/go-ethereum@v1.17.0...v1.17.1)

Updates `github.com/minio/minio-go/v7` from 7.0.98 to 7.0.99
- [Release notes](https://github.com/minio/minio-go/releases)
- [Commits](minio/minio-go@v7.0.98...v7.0.99)

Updates `github.com/pk910/dynamic-ssz` from 1.2.1 to 1.2.2
- [Release notes](https://github.com/pk910/dynamic-ssz/releases)
- [Changelog](https://github.com/pk910/dynamic-ssz/blob/master/CHANGELOG.md)
- [Commits](pk910/dynamic-ssz@v1.2.1...v1.2.2)

Updates `golang.org/x/crypto` from 0.48.0 to 0.49.0
- [Commits](golang/crypto@v0.48.0...v0.49.0)

Updates `golang.org/x/text` from 0.34.0 to 0.35.0
- [Release notes](https://github.com/golang/text/releases)
- [Commits](golang/text@v0.34.0...v0.35.0)

Updates `golang.org/x/time` from 0.14.0 to 0.15.0
- [Commits](golang/time@v0.14.0...v0.15.0)

---
updated-dependencies:
- dependency-name: github.com/ethereum/go-ethereum
  dependency-version: 1.17.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: github.com/minio/minio-go/v7
  dependency-version: 7.0.99
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: github.com/pk910/dynamic-ssz
  dependency-version: 1.2.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: golang.org/x/crypto
  dependency-version: 0.49.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: golang.org/x/text
  dependency-version: 0.35.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: golang.org/x/time
  dependency-version: 0.15.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
…encies-21774bee80

Bump the dependencies group across 1 directory with 6 updates
Bumps the dependencies group with 2 updates in the / directory: [github.com/lib/pq](https://github.com/lib/pq) and [github.com/rs/zerolog](https://github.com/rs/zerolog).


Updates `github.com/lib/pq` from 1.11.2 to 1.12.0
- [Release notes](https://github.com/lib/pq/releases)
- [Changelog](https://github.com/lib/pq/blob/master/CHANGELOG.md)
- [Commits](lib/pq@v1.11.2...v1.12.0)

Updates `github.com/rs/zerolog` from 1.34.0 to 1.35.0
- [Commits](rs/zerolog@v1.34.0...v1.35.0)

---
updated-dependencies:
- dependency-name: github.com/lib/pq
  dependency-version: 1.12.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: github.com/rs/zerolog
  dependency-version: 1.35.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps the ui-package-dependencies group with 6 updates in the /ui-package directory:

| Package | From | To |
| --- | --- | --- |
| [@tanstack/react-query](https://github.com/TanStack/query/tree/HEAD/packages/react-query) | `5.90.21` | `5.95.2` |
| [viem](https://github.com/wevm/viem) | `2.47.4` | `2.47.6` |
| [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) | `7.29.0` | `7.29.2` |
| [mini-css-extract-plugin](https://github.com/webpack/mini-css-extract-plugin) | `2.10.1` | `2.10.2` |
| [typescript](https://github.com/microsoft/TypeScript) | `5.9.3` | `6.0.2` |
| [webpack-cli](https://github.com/webpack/webpack-cli) | `7.0.0` | `7.0.2` |



Updates `@tanstack/react-query` from 5.90.21 to 5.95.2
- [Release notes](https://github.com/TanStack/query/releases)
- [Changelog](https://github.com/TanStack/query/blob/main/packages/react-query/CHANGELOG.md)
- [Commits](https://github.com/TanStack/query/commits/@tanstack/react-query@5.95.2/packages/react-query)

Updates `viem` from 2.47.4 to 2.47.6
- [Release notes](https://github.com/wevm/viem/releases)
- [Commits](https://github.com/wevm/viem/compare/viem@2.47.4...viem@2.47.6)

Updates `@babel/preset-env` from 7.29.0 to 7.29.2
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.29.2/packages/babel-preset-env)

Updates `mini-css-extract-plugin` from 2.10.1 to 2.10.2
- [Release notes](https://github.com/webpack/mini-css-extract-plugin/releases)
- [Changelog](https://github.com/webpack/mini-css-extract-plugin/blob/main/CHANGELOG.md)
- [Commits](webpack/mini-css-extract-plugin@v2.10.1...v2.10.2)

Updates `typescript` from 5.9.3 to 6.0.2
- [Release notes](https://github.com/microsoft/TypeScript/releases)
- [Commits](microsoft/TypeScript@v5.9.3...v6.0.2)

Updates `webpack-cli` from 7.0.0 to 7.0.2
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/main/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-cli/compare/webpack-cli@7.0.0...webpack-cli@7.0.2)

---
updated-dependencies:
- dependency-name: "@tanstack/react-query"
  dependency-version: 5.95.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ui-package-dependencies
- dependency-name: viem
  dependency-version: 2.47.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ui-package-dependencies
- dependency-name: "@babel/preset-env"
  dependency-version: 7.29.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: ui-package-dependencies
- dependency-name: mini-css-extract-plugin
  dependency-version: 2.10.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: ui-package-dependencies
- dependency-name: typescript
  dependency-version: 6.0.2
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: ui-package-dependencies
- dependency-name: webpack-cli
  dependency-version: 7.0.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: ui-package-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps the actions group with 1 update: [actions/setup-go](https://github.com/actions/setup-go).


Updates `actions/setup-go` from 6.3.0 to 6.4.0
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](actions/setup-go@4b73464...4a36011)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-version: 6.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
…encies-6c5b23366b

Bump the dependencies group across 1 directory with 2 updates
…ackage/ui-package-dependencies-58b5f10517

Bump the ui-package-dependencies group across 1 directory with 6 updates
…tions-84ffaffffe

Bump actions/setup-go from 6.3.0 to 6.4.0 in the actions group
@pk910 pk910 added the build-docker-image Automatically build docker image for PR branch label Apr 3, 2026
@pk910 pk910 merged commit 272a5cd into gloas-support Apr 11, 2026
12 checks passed
@pk910 pk910 deleted the pk910/withdrawals-tracking-gloas branch April 11, 2026 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build-docker-image Automatically build docker image for PR branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants