From 7c86b5d7370ad17ab5add506807dd13dd5a4169a Mon Sep 17 00:00:00 2001 From: Justin Traglia <95511699+jtraglia@users.noreply.github.com> Date: Tue, 30 Sep 2025 20:35:41 -0500 Subject: [PATCH] Add sources for `compute_fork_digest` to specrefs (#15699) * Add sources for compute_fork_digest to specrefs * Delete non-existant exception keys * Lint specref files --------- Co-authored-by: james-prysm <90280386+james-prysm@users.noreply.github.com> --- .../jtraglia_specrefs_compute_fork_digest.md | 3 + specrefs/.ethspecify.yml | 4 - specrefs/configs.yml | 77 +++++++++---------- specrefs/constants.yml | 1 - specrefs/dataclasses.yml | 1 - specrefs/functions.yml | 56 +++++++------- 6 files changed, 71 insertions(+), 71 deletions(-) create mode 100644 changelog/jtraglia_specrefs_compute_fork_digest.md diff --git a/changelog/jtraglia_specrefs_compute_fork_digest.md b/changelog/jtraglia_specrefs_compute_fork_digest.md new file mode 100644 index 0000000000..040deebf31 --- /dev/null +++ b/changelog/jtraglia_specrefs_compute_fork_digest.md @@ -0,0 +1,3 @@ +### Changed + +- Add sources for compute_fork_digest to specrefs diff --git a/specrefs/.ethspecify.yml b/specrefs/.ethspecify.yml index 8cb5c29a3f..c775c4ab13 100644 --- a/specrefs/.ethspecify.yml +++ b/specrefs/.ethspecify.yml @@ -18,7 +18,6 @@ exceptions: - UPDATE_TIMEOUT#altair # Not implemented: gloas (future fork) - - KZG_COMMITMENTS_INCLUSION_PROOF_DEPTH_GLOAS#gloas - MAX_PAYLOAD_ATTESTATIONS#gloas - PTC_SIZE#gloas @@ -215,7 +214,6 @@ exceptions: # Not implemented: altair - compute_sync_committee_period_at_slot#altair - - compute_timestamp_at_slot#bellatrix - get_contribution_and_proof#altair - get_contribution_due_ms#altair - get_index_for_new_validator#altair @@ -285,12 +283,10 @@ exceptions: - upgrade_lc_update_to_electra#electra # Not implemented: fulu - - compute_fork_digest#fulu - compute_matrix#fulu - get_blob_parameters#fulu - get_data_column_sidecars_from_block#fulu - get_data_column_sidecars_from_column_sidecar#fulu - - get_extended_sample_count#fulu - recover_matrix#fulu # Not implemented: gloas (future fork) diff --git a/specrefs/configs.yml b/specrefs/configs.yml index b3177e8db2..a23916fd4a 100644 --- a/specrefs/configs.yml +++ b/specrefs/configs.yml @@ -1,3 +1,10 @@ +- name: AGGREGATE_DUE_BPS + sources: [] + spec: | + + AGGREGATE_DUE_BPS: uint64 = 6667 + + - name: ALTAIR_FORK_EPOCH sources: - file: config/params/config.go @@ -18,11 +25,11 @@ ALTAIR_FORK_VERSION: Version = '0x01000000' -- name: AGGREGATE_DUE_BPS +- name: ATTESTATION_DUE_BPS sources: [] spec: | - - AGGREGATE_DUE_BPS: uint64 = 6667 + + ATTESTATION_DUE_BPS: uint64 = 3333 - name: ATTESTATION_PROPAGATION_SLOT_RANGE @@ -65,13 +72,6 @@ ATTESTATION_SUBNET_PREFIX_BITS: int = 6 -- name: ATTESTATION_DUE_BPS - sources: [] - spec: | - - ATTESTATION_DUE_BPS: uint64 = 3333 - - - name: BALANCE_PER_ADDITIONAL_CUSTODY_GROUP sources: - file: config/params/config.go @@ -163,6 +163,13 @@ CHURN_LIMIT_QUOTIENT: uint64 = 65536 +- name: CONTRIBUTION_DUE_BPS + sources: [] + spec: | + + CONTRIBUTION_DUE_BPS: uint64 = 6667 + + - name: CUSTODY_REQUIREMENT sources: - file: config/params/config.go @@ -533,6 +540,13 @@ NUMBER_OF_CUSTODY_GROUPS = 128 +- name: PROPOSER_REORG_CUTOFF_BPS + sources: [] + spec: | + + PROPOSER_REORG_CUTOFF_BPS: uint64 = 1667 + + - name: PROPOSER_SCORE_BOOST sources: - file: config/params/config.go @@ -543,13 +557,6 @@ PROPOSER_SCORE_BOOST: uint64 = 40 -- name: PROPOSER_REORG_CUTOFF_BPS - sources: [] - spec: | - - PROPOSER_REORG_CUTOFF_BPS: uint64 = 1667 - - - name: REORG_HEAD_WEIGHT_THRESHOLD sources: - file: config/params/config.go @@ -610,13 +617,6 @@ SECONDS_PER_SLOT: uint64 = 12 -- name: SLOT_DURATION_MS - sources: [] - spec: | - - SLOT_DURATION_MS: uint64 = 12000 - - - name: SHARD_COMMITTEE_PERIOD sources: - file: config/params/config.go @@ -627,6 +627,13 @@ SHARD_COMMITTEE_PERIOD: uint64 = 256 +- name: SLOT_DURATION_MS + sources: [] + spec: | + + SLOT_DURATION_MS: uint64 = 12000 + + - name: SUBNETS_PER_NODE sources: - file: config/params/config.go @@ -637,6 +644,13 @@ SUBNETS_PER_NODE = 2 +- name: SYNC_MESSAGE_DUE_BPS + sources: [] + spec: | + + SYNC_MESSAGE_DUE_BPS: uint64 = 3333 + + - name: TERMINAL_BLOCK_HASH sources: - file: config/params/config.go @@ -676,18 +690,3 @@ VALIDATOR_CUSTODY_REQUIREMENT = 8 - -- name: CONTRIBUTION_DUE_BPS - sources: [] - spec: | - - CONTRIBUTION_DUE_BPS: uint64 = 6667 - - -- name: SYNC_MESSAGE_DUE_BPS - sources: [] - spec: | - - SYNC_MESSAGE_DUE_BPS: uint64 = 3333 - - diff --git a/specrefs/constants.yml b/specrefs/constants.yml index 8618de243a..dbd26df6e9 100644 --- a/specrefs/constants.yml +++ b/specrefs/constants.yml @@ -1,4 +1,3 @@ - - name: BASE_REWARDS_PER_EPOCH sources: - file: config/params/config.go diff --git a/specrefs/dataclasses.yml b/specrefs/dataclasses.yml index 6bf99b0f01..f9a3448582 100644 --- a/specrefs/dataclasses.yml +++ b/specrefs/dataclasses.yml @@ -1,4 +1,3 @@ - - name: BlobParameters sources: [] spec: | diff --git a/specrefs/functions.yml b/specrefs/functions.yml index a9ad2a63e2..7f8e9c3ff5 100644 --- a/specrefs/functions.yml +++ b/specrefs/functions.yml @@ -527,7 +527,11 @@ - name: compute_fork_digest#fulu - sources: [] + sources: + - file: config/params/fork.go + search: func ForkDigest( + - file: config/params/config.go + search: func entryWithForkDigest( spec: | def compute_fork_digest( @@ -3140,6 +3144,17 @@ return hash(domain_type + uint_to_bytes(epoch) + mix) +- name: get_slot_component_duration_ms + sources: [] + spec: | + + def get_slot_component_duration_ms(basis_points: uint64) -> uint64: + """ + Calculate the duration of a slot component in milliseconds. + """ + return basis_points * SLOT_DURATION_MS // BASIS_POINTS + + - name: get_slot_signature sources: [] spec: | @@ -3160,17 +3175,6 @@ return (store.time - store.genesis_time) // SECONDS_PER_SLOT -- name: get_slot_component_duration_ms - sources: [] - spec: | - - def get_slot_component_duration_ms(basis_points: uint64) -> uint64: - """ - Calculate the duration of a slot component in milliseconds. - """ - return basis_points * SLOT_DURATION_MS // BASIS_POINTS - - - name: get_source_deltas sources: - file: beacon-chain/core/epoch/precompute/reward_penalty.go @@ -7279,6 +7283,20 @@ return a - b if a > b else 0 +- name: seconds_to_milliseconds + sources: [] + spec: | + + def seconds_to_milliseconds(seconds: uint64) -> uint64: + """ + Convert seconds to milliseconds with overflow protection. + Returns ``UINT64_MAX`` if the result would overflow. + """ + if seconds > UINT64_MAX // 1000: + return UINT64_MAX + return seconds * 1000 + + - name: set_or_append_list sources: [] spec: | @@ -7516,20 +7534,6 @@ assert block.state_root == hash_tree_root(state) -- name: seconds_to_milliseconds - sources: [] - spec: | - - def seconds_to_milliseconds(seconds: uint64) -> uint64: - """ - Convert seconds to milliseconds with overflow protection. - Returns ``UINT64_MAX`` if the result would overflow. - """ - if seconds > UINT64_MAX // 1000: - return UINT64_MAX - return seconds * 1000 - - - name: store_target_checkpoint_state sources: [] spec: |