Skip to content

Comments

feat(rpc-types-beacon): add proposer duties, state validators, and fork types#3688

Merged
mattsse merged 5 commits intomainfrom
mattsse/add-beacon-api-types
Feb 14, 2026
Merged

feat(rpc-types-beacon): add proposer duties, state validators, and fork types#3688
mattsse merged 5 commits intomainfrom
mattsse/add-beacon-api-types

Conversation

@gakonst
Copy link
Member

@gakonst gakonst commented Feb 14, 2026

Summary

Cross-reference all types with the Beacon API v4.0.0 spec and add all missing standard endpoint types.

Motivation

Identified missing types by comparing with rs-mev-relay primitives and then cross-referencing against the full Beacon Node OpenAPI spec. Many standard Beacon API endpoints had no type coverage.

Changes

New modules

  • state — types for /eth/v1/beacon/states/{state_id}/* endpoints:

    • CommitteesResponse, Committee (committees)
    • SyncCommitteesResponse, SyncCommittee (sync_committees)
    • FinalityCheckpointsResponse, FinalityCheckpoints (finality_checkpoints)
    • ValidatorBalancesResponse, ValidatorBalance (validator_balances)
    • RandaoResponse, RandaoData (randao)
    • StateRootResponse, StateRootData (root)
  • config — types for /eth/v1/config/* endpoints:

    • DepositContractResponse, DepositContract (deposit_contract)
    • ForkScheduleResponse (fork_schedule)
    • SpecResponse (spec)
  • duties — types for /eth/v1/validator/duties/* endpoints:

    • AttesterDutiesResponse, AttesterDuty (attester duties)
    • SyncCommitteeDutiesResponse, SyncCommitteeDuty (sync committee duties)
  • rewards — types for /eth/v1/beacon/rewards/* endpoints:

    • BlockRewardsResponse, BlockRewards (block rewards)
    • SyncCommitteeRewardsResponse, SyncCommitteeReward (sync committee rewards)
    • AttestationRewardsResponse, AttestationRewards, IdealAttestationReward, TotalAttestationReward (attestation rewards)
  • proposerProposerDutiesResponse, ProposerDuty (proposer duties)

  • validatorValidatorsResponse, ValidatorResponse, ValidatorData, Validator (state validators)

  • forkForkResponse, Fork (state fork)

Improved docs

  • Added Beacon API spec endpoint links to all existing types across block.rs, header.rs, genesis.rs, node.rs, sidecar.rs
  • Reorganized lib.rs module declarations by API category

Testing

cargo test -p alloy-rpc-types-beacon    # 63 passed
cargo clippy -p alloy-rpc-types-beacon  # clean
cargo fmt -p alloy-rpc-types-beacon     # clean

Prompted by: mattsse

…rk types

Add standard Beacon API types that were missing:

- `proposer`: ProposerDutiesResponse, ProposerDuty for /eth/v1/validator/duties/proposer/{epoch}
- `validator`: ValidatorsResponse, ValidatorResponse, ValidatorData, Validator for /eth/v1/beacon/states/{state_id}/validators
- `fork`: ForkResponse, Fork for /eth/v1/beacon/states/{state_id}/fork
gakonst and others added 3 commits February 14, 2026 11:41
Cross-referenced with the Beacon API v4.0.0 spec and added all missing
standard endpoint types:

New modules:
- `state`: Committee, SyncCommittee, FinalityCheckpoints, ValidatorBalance,
  Randao, StateRoot (for /eth/v1/beacon/states/* endpoints)
- `config`: DepositContract, ForkSchedule, Spec (for /eth/v1/config/* endpoints)
- `duties`: AttesterDuty, SyncCommitteeDuty (for /eth/v1/validator/duties/* endpoints)
- `rewards`: BlockRewards, SyncCommitteeReward, AttestationRewards
  (for /eth/v1/beacon/rewards/* endpoints)

Improved docs:
- Added Beacon API spec endpoint links to all existing types
- Reorganized lib.rs module declarations by API category
@github-project-automation github-project-automation bot moved this to Reviewed in Alloy Feb 14, 2026
@mattsse mattsse merged commit 5f508bf into main Feb 14, 2026
24 of 30 checks passed
@mattsse mattsse deleted the mattsse/add-beacon-api-types branch February 14, 2026 13:25
@github-project-automation github-project-automation bot moved this from Reviewed to Done in Alloy Feb 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants