Update consensus spec to v1.6.0-alpha.5 and adjust minimal config (#15621)

This commit is contained in:
terence
2025-08-22 18:19:07 -07:00
committed by GitHub
parent dbab624f3d
commit d48ed44c4c
10 changed files with 261 additions and 39 deletions

View File

@@ -253,16 +253,16 @@ filegroup(
url = "https://github.com/ethereum/EIPs/archive/5480440fe51742ed23342b68cf106cefd427e39d.tar.gz",
)
consensus_spec_version = "v1.6.0-alpha.4"
consensus_spec_version = "v1.6.0-alpha.5"
load("@prysm//tools:download_spectests.bzl", "consensus_spec_tests")
consensus_spec_tests(
name = "consensus_spec_tests",
flavors = {
"general": "sha256-MaN4zu3o0vWZypUHS5r4D8WzJF4wANoadM8qm6iyDs4=",
"minimal": "sha256-aZGNPp/bBvJgq3Wf6vyR0H6G3DOkbSuggEmOL4jEmtg=",
"mainnet": "sha256-C7jjosvpzUgw3GPajlsWBV02ZbkZ5Uv4ikmOqfDGajI=",
"general": "sha256-BXuEb1XbeSft0qzVFnoB8KC0YR1qM3ybT5lKUDbUWn8=",
"minimal": "sha256-EjwSHgBbWSoy5hm9V+A/bVMabyojaKsBNPrRtuPVq4k=",
"mainnet": "sha256-OGWMzarzaV1B9mVpy48/DCUbhjfX+b64pAxWwPLWhAs=",
},
version = consensus_spec_version,
)
@@ -278,7 +278,7 @@ filegroup(
visibility = ["//visibility:public"],
)
""",
integrity = "sha256-qreawRS77l8CebiNww8z727qUItw7KlHY1Xqj7IrPdk=",
integrity = "sha256-FQWR5EZuVcQGR0ol9vpd7eunnfGexJ/7J3xycrFEJbU=",
strip_prefix = "consensus-specs-" + consensus_spec_version[1:],
url = "https://github.com/ethereum/consensus-specs/archive/refs/tags/%s.tar.gz" % consensus_spec_version,
)

View File

@@ -0,0 +1,3 @@
### Changed
- Updated consensus spec from v1.6.0-alpha.4 to v1.6.0-alpha.5 with adjusted minimal config parameters

View File

@@ -26,13 +26,13 @@ const (
SyncCommitteeAggregationBytesLength = 1 // SyncCommitteeAggregationBytesLength defines the sync committee aggregate bytes.
SyncAggregateSyncCommitteeBytesLength = 4 // SyncAggregateSyncCommitteeBytesLength defines the length of sync committee bytes in a sync aggregate.
MaxWithdrawalsPerPayload = 4 // MaxWithdrawalsPerPayloadLength defines the maximum number of withdrawals that can be included in a payload.
MaxBlobCommitmentsPerBlock = 32 // MaxBlobCommitmentsPerBlock defines the theoretical limit of blobs can be included in a block.
LogMaxBlobCommitments = 5 // Log_2 of MaxBlobCommitmentsPerBlock
MaxBlobCommitmentsPerBlock = 4096 // MaxBlobCommitmentsPerBlock defines the theoretical limit of blobs can be included in a block.
LogMaxBlobCommitments = 12 // Log_2 of MaxBlobCommitmentsPerBlock
BlobLength = 131072 // BlobLength defines the byte length of a blob.
BlobSize = 131072 // defined to match blob.size in bazel ssz codegen
BlobSidecarSize = 131928 // defined to match blob sidecar size in bazel ssz codegen
KzgCommitmentSize = 48 // KzgCommitmentSize defines the byte length of a KZG commitment.
KzgCommitmentInclusionProofDepth = 10 // Merkle proof depth for blob_kzg_commitments list item
KzgCommitmentInclusionProofDepth = 17 // Merkle proof depth for blob_kzg_commitments list item
ExecutionBranchDepth = 4 // ExecutionBranchDepth defines the number of leaves in a merkle proof of the execution payload header.
SyncCommitteeBranchDepth = 5 // SyncCommitteeBranchDepth defines the number of leaves in a merkle proof of a sync committee.
SyncCommitteeBranchDepthElectra = 6 // SyncCommitteeBranchDepthElectra defines the number of leaves in a merkle proof of a sync committee.

View File

@@ -24,8 +24,14 @@ import (
// These are variables that we don't use in Prysm. (i.e. future hardfork, light client... etc)
// IMPORTANT: Use one field per line and sort these alphabetically to reduce conflicts.
var placeholderFields = []string{
"AGGREGRATE_DUE_BPS",
"AGGREGRATE_DUE_BPS_GLOAS",
"ATTESTATION_DEADLINE",
"ATTESTATION_DUE_BPS",
"ATTESTATION_DUE_BPS_GLOAS",
"BLOB_SIDECAR_SUBNET_COUNT_FULU",
"CONTRIBUTION_DUE_BPS",
"CONTRIBUTION_DUE_BPS_GLOAS",
"EIP6110_FORK_EPOCH",
"EIP6110_FORK_VERSION",
"EIP7002_FORK_EPOCH",
@@ -37,16 +43,26 @@ var placeholderFields = []string{
"EIP7805_FORK_EPOCH",
"EIP7805_FORK_VERSION",
"EPOCHS_PER_SHUFFLING_PHASE",
"GLOAS_FORK_EPOCH",
"GLOAS_FORK_VERSION",
"INCLUSION_LIST_SUBMISSION_DEADLINE",
"INCLUSION_LIST_SUBMISSION_DUE_BPS",
"MAX_BYTES_PER_INCLUSION_LIST",
"MAX_REQUEST_BLOB_SIDECARS_FULU",
"MAX_REQUEST_INCLUSION_LIST",
"MAX_REQUEST_PAYLOADS", // Compile time constant on BeaconBlockBody.ExecutionRequests
"PAYLOAD_ATTESTATION_DUE_BPS",
"PROPOSER_INCLUSION_LIST_CUTOFF",
"PROPOSER_INCLUSION_LIST_CUTOFF_BPS",
"PROPOSER_REORG_CUTOFF_BPS",
"PROPOSER_SCORE_BOOST_EIP7732",
"PROPOSER_SELECTION_GAP",
"SLOT_DURATION_MS",
"SYNC_MESSAGE_DUE_BPS",
"SYNC_MESSAGE_DUE_BPS_GLOAS",
"TARGET_NUMBER_OF_PEERS",
"UPDATE_TIMEOUT",
"VIEW_FREEZE_CUTOFF_BPS",
"VIEW_FREEZE_DEADLINE",
"WHISK_EPOCHS_PER_SHUFFLING_PHASE",
"WHISK_FORK_EPOCH",

View File

@@ -104,8 +104,8 @@ func MinimalSpecConfig() *BeaconChainConfig {
minimalConfig.MinEpochsForBlockRequests = 272
// New Deneb params
minimalConfig.MaxBlobCommitmentsPerBlock = 32
minimalConfig.KzgCommitmentInclusionProofDepth = 10
minimalConfig.MaxBlobCommitmentsPerBlock = 4096
minimalConfig.KzgCommitmentInclusionProofDepth = 17
// New Electra params
minimalConfig.MinPerEpochChurnLimitElectra = 64000000000

View File

@@ -63,9 +63,9 @@ minimal = {
"logs_bloom.size": "256",
"extra_data.size": "32",
"max_blobs_per_block.size": "6",
"max_blob_commitments.size": "32",
"max_blob_commitments.size": "4096",
"max_cell_proofs_length.size": "33554432", # FIELD_ELEMENTS_PER_EXT_BLOB * MAX_BLOB_COMMITMENTS_PER_BLOCK
"kzg_commitment_inclusion_proof_depth.size": "10",
"kzg_commitment_inclusion_proof_depth.size": "17",
"max_withdrawal_requests_per_payload.size": "16",
"max_deposit_requests_per_payload.size": "8192",
"max_attesting_indices.size": "8192",

View File

@@ -1,4 +1,4 @@
version: v1.6.0-alpha.4
version: v1.6.0-alpha.5
style: full
specrefs:
@@ -17,6 +17,11 @@ exceptions:
- CELLS_PER_EXT_BLOB#fulu
- UPDATE_TIMEOUT#altair
# Not implemented: gloas (future fork)
- KZG_COMMITMENTS_INCLUSION_PROOF_DEPTH_GLOAS#gloas
- MAX_PAYLOAD_ATTESTATIONS#gloas
- PTC_SIZE#gloas
constants:
# Constants in the KZG library
- BLS_MODULUS#deneb
@@ -34,6 +39,7 @@ exceptions:
- RANDOM_CHALLENGE_KZG_CELL_BATCH_DOMAIN#fulu
# Not implemented
- BASIS_POINTS#phase0
- ENDIANNESS#phase0
- MAX_CONCURRENT_REQUESTS#phase0
- PARTICIPATION_FLAG_WEIGHTS#altair
@@ -42,11 +48,57 @@ exceptions:
- UINT64_MAX#phase0
- UINT64_MAX_SQRT#phase0
# Not implemented: gloas (future fork)
- BUILDER_PAYMENT_THRESHOLD_DENOMINATOR#gloas
- BUILDER_PAYMENT_THRESHOLD_NUMERATOR#gloas
- BUILDER_PENDING_WITHDRAWALS_LIMIT#gloas
- BUILDER_WITHDRAWAL_PREFIX#gloas
- DOMAIN_BEACON_BUILDER#gloas
- DOMAIN_PTC_ATTESTER#gloas
- PAYLOAD_STATUS_EMPTY#gloas
- PAYLOAD_STATUS_FULL#gloas
- PAYLOAD_STATUS_PENDING#gloas
configs:
# Not implemented (placeholders)
- AGGREGRATE_DUE_BPS#phase0
- ATTESTATION_DUE_BPS#phase0
- CONTRIBUTION_DUE_BPS#altair
- PROPOSER_REORG_CUTOFF_BPS#phase0
- SLOT_DURATION_MS#phase0
- SYNC_MESSAGE_DUE_BPS#altair
# Not implemented: gloas (future fork)
- AGGREGRATE_DUE_BPS_GLOAS#gloas
- ATTESTATION_DUE_BPS_GLOAS#gloas
- CONTRIBUTION_DUE_BPS_GLOAS#gloas
- GLOAS_FORK_EPOCH#gloas
- GLOAS_FORK_VERSION#gloas
- MAX_REQUEST_PAYLOADS#gloas
- PAYLOAD_ATTESTATION_DUE_BPS#gloas
- SYNC_MESSAGE_DUE_BPS_GLOAS#gloas
ssz_objects:
# Not implemented
- Eth1Block#phase0
- MatrixEntry#fulu
# Not implemented: gloas (future fork)
- BeaconBlockBody#gloas
- BeaconState#gloas
- BuilderPendingPayment#gloas
- BuilderPendingWithdrawal#gloas
- DataColumnSidecar#gloas
- ExecutionPayloadEnvelope#gloas
- ExecutionPayloadHeader#gloas
- ForkChoiceNode#gloas
- IndexedPayloadAttestation#gloas
- PayloadAttestation#gloas
- PayloadAttestationData#gloas
- PayloadAttestationMessage#gloas
- SignedExecutionPayloadEnvelope#gloas
- SignedExecutionPayloadHeader#gloas
dataclasses:
# Not implemented
- BlobParameters#fulu
@@ -55,6 +107,10 @@ exceptions:
- OptimisticStore#bellatrix
- Store#phase0
# Not implemented: gloas (future fork)
- LatestMessage#gloas
- Store#gloas
functions:
# Functions implemented by KZG library for EIP-4844
- bit_reversal_permutation#deneb
@@ -130,6 +186,7 @@ exceptions:
- get_matching_target_attestations#phase0
- get_proposer_head#phase0
- get_proposer_score#phase0
- get_slot_component_duration_ms#phase0
- get_slot_signature#phase0
- get_unslashed_attesting_indices#phase0
- get_voting_source#phase0
@@ -145,6 +202,7 @@ exceptions:
- is_valid_merkle_branch#phase0
- on_tick#phase0
- on_tick_per_slot#phase0
- seconds_to_milliseconds#phase0
- store_target_checkpoint_state#phase0
- update_latest_messages#phase0
- validate_on_attestation#phase0
@@ -227,3 +285,64 @@ exceptions:
- get_data_column_sidecars_from_column_sidecar#fulu
- get_extended_sample_count#fulu
- recover_matrix#fulu
# Not implemented: gloas (future fork)
- compute_balance_weighted_acceptance#gloas
- compute_balance_weighted_selection#gloas
- compute_fork_version#gloas
- compute_proposer_indices#gloas
- get_ancestor#gloas
- get_attestation_participation_flag_indices#gloas
- get_builder_payment_quorum_threshold#gloas
- get_checkpoint_block#gloas
- get_data_column_sidecars#gloas
- get_data_column_sidecars_from_block#gloas
- get_execution_payload_envelope_signature#gloas
- get_execution_payload_header_signature#gloas
- get_expected_withdrawals#gloas
- get_forkchoice_store#gloas
- get_head#gloas
- get_indexed_payload_attestation#gloas
- get_next_sync_committee_indices#gloas
- get_node_children#gloas
- get_parent_payload_status#gloas
- get_payload_attestation_message_signature#gloas
- get_payload_status_tiebreaker#gloas
- get_ptc#gloas
- get_ptc_assignment#gloas
- get_weight#gloas
- has_builder_withdrawal_credential#gloas
- has_compounding_withdrawal_credential#gloas
- is_attestation_same_slot#gloas
- is_builder_payment_withdrawable#gloas
- is_builder_withdrawal_credential#gloas
- is_merge_transition_complete#gloas
- is_parent_block_full#gloas
- is_parent_node_full#gloas
- is_payload_timely#gloas
- is_supporting_vote#gloas
- is_valid_indexed_payload_attestation#gloas
- notify_ptc_messages#gloas
- on_block#gloas
- on_execution_payload#gloas
- on_payload_attestation_message#gloas
- prepare_execution_payload#gloas
- process_attestation#gloas
- process_block#gloas
- process_builder_pending_payments#gloas
- process_epoch#gloas
- process_execution_payload#gloas
- process_execution_payload_header#gloas
- process_operations#gloas
- process_payload_attestation#gloas
- process_slot#gloas
- process_withdrawals#gloas
- remove_flag#gloas
- should_extend_payload#gloas
- update_latest_messages#gloas
- upgrade_to_gloas#gloas
- validate_merge_block#gloas
- validate_on_attestation#gloas
- verify_data_column_sidecar_inclusion_proof#gloas
- verify_execution_payload_envelope_signature#gloas
- verify_execution_payload_header_signature#gloas

View File

@@ -18,6 +18,13 @@
ALTAIR_FORK_VERSION: Version = '0x01000000'
</spec>
- name: AGGREGRATE_DUE_BPS
sources: []
spec: |
<spec config_var="AGGREGRATE_DUE_BPS" fork="phase0" hash="74073466">
AGGREGRATE_DUE_BPS: uint64 = 6667
</spec>
- name: ATTESTATION_PROPAGATION_SLOT_RANGE
sources:
- file: config/params/config.go
@@ -58,6 +65,13 @@
ATTESTATION_SUBNET_PREFIX_BITS: int = 6
</spec>
- name: ATTESTATION_DUE_BPS
sources: []
spec: |
<spec config_var="ATTESTATION_DUE_BPS" fork="phase0" hash="929dd1c9">
ATTESTATION_DUE_BPS: uint64 = 3333
</spec>
- name: BALANCE_PER_ADDITIONAL_CUSTODY_GROUP
sources:
- file: config/params/config.go
@@ -529,6 +543,13 @@
PROPOSER_SCORE_BOOST: uint64 = 40
</spec>
- name: PROPOSER_REORG_CUTOFF_BPS
sources: []
spec: |
<spec config_var="PROPOSER_REORG_CUTOFF_BPS" fork="phase0" hash="a487cc43">
PROPOSER_REORG_CUTOFF_BPS: uint64 = 1667
</spec>
- name: REORG_HEAD_WEIGHT_THRESHOLD
sources:
- file: config/params/config.go
@@ -589,6 +610,13 @@
SECONDS_PER_SLOT: uint64 = 12
</spec>
- name: SLOT_DURATION_MS
sources: []
spec: |
<spec config_var="SLOT_DURATION_MS" fork="phase0" hash="b6d4ba6d">
SLOT_DURATION_MS: uint64 = 12000
</spec>
- name: SHARD_COMMITTEE_PERIOD
sources:
- file: config/params/config.go
@@ -648,3 +676,18 @@
<spec config_var="VALIDATOR_CUSTODY_REQUIREMENT" fork="fulu" hash="4dfc4457">
VALIDATOR_CUSTODY_REQUIREMENT = 8
</spec>
- name: CONTRIBUTION_DUE_BPS
sources: []
spec: |
<spec config_var="CONTRIBUTION_DUE_BPS" fork="altair" hash="a3808203">
CONTRIBUTION_DUE_BPS: uint64 = 6667
</spec>
- name: SYNC_MESSAGE_DUE_BPS
sources: []
spec: |
<spec config_var="SYNC_MESSAGE_DUE_BPS" fork="altair" hash="791b29d8">
SYNC_MESSAGE_DUE_BPS: uint64 = 3333
</spec>

View File

@@ -9,6 +9,13 @@
BASE_REWARDS_PER_EPOCH: uint64 = 4
</spec>
- name: BASIS_POINTS
sources: []
spec: |
<spec constant_var="BASIS_POINTS" fork="phase0" hash="cb0c8561">
BASIS_POINTS: uint64 = 10000
</spec>
- name: BLS_MODULUS
sources: []
spec: |

View File

@@ -3209,6 +3209,17 @@
return (store.time - store.genesis_time) // SECONDS_PER_SLOT
</spec>
- name: get_slot_component_duration_ms
sources: []
spec: |
<spec fn="get_slot_component_duration_ms" fork="phase0" hash="b81504df">
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
</spec>
- name: get_source_deltas
sources:
- file: beacon-chain/core/epoch/precompute/reward_penalty.go
@@ -4240,12 +4251,12 @@
- name: is_proposing_on_time
sources: []
spec: |
<spec fn="is_proposing_on_time" fork="phase0" hash="81d1985f">
<spec fn="is_proposing_on_time" fork="phase0" hash="cadfde05">
def is_proposing_on_time(store: Store) -> bool:
# Use half `SECONDS_PER_SLOT // INTERVALS_PER_SLOT` as the proposer reorg deadline
time_into_slot = (store.time - store.genesis_time) % SECONDS_PER_SLOT
proposer_reorg_cutoff = SECONDS_PER_SLOT // INTERVALS_PER_SLOT // 2
return time_into_slot <= proposer_reorg_cutoff
seconds_since_genesis = store.time - store.genesis_time
time_into_slot_ms = seconds_to_milliseconds(seconds_since_genesis) % SLOT_DURATION_MS
proposer_reorg_cutoff_ms = get_slot_component_duration_ms(PROPOSER_REORG_CUTOFF_BPS)
return time_into_slot_ms <= proposer_reorg_cutoff_ms
</spec>
- name: is_shuffling_stable
@@ -4695,7 +4706,7 @@
- file: beacon-chain/blockchain/receive_block.go
search: func (s *Service) ReceiveBlock(
spec: |
<spec fn="on_block" fork="phase0" hash="f44d049a">
<spec fn="on_block" fork="phase0" hash="0bd081f0">
def on_block(store: Store, signed_block: SignedBeaconBlock) -> None:
block = signed_block.message
# Parent block must be known
@@ -4726,8 +4737,10 @@
store.block_states[block_root] = state
# Add block timeliness to the store
time_into_slot = (store.time - store.genesis_time) % SECONDS_PER_SLOT
is_before_attesting_interval = time_into_slot < SECONDS_PER_SLOT // INTERVALS_PER_SLOT
seconds_since_genesis = store.time - store.genesis_time
time_into_slot_ms = seconds_to_milliseconds(seconds_since_genesis) % SLOT_DURATION_MS
attestation_threshold_ms = get_slot_component_duration_ms(ATTESTATION_DUE_BPS)
is_before_attesting_interval = time_into_slot_ms < attestation_threshold_ms
is_timely = get_current_slot(store) == block.slot and is_before_attesting_interval
store.block_timeliness[hash_tree_root(block)] = is_timely
@@ -4748,7 +4761,7 @@
- file: beacon-chain/blockchain/receive_block.go
search: func (s *Service) ReceiveBlock(
spec: |
<spec fn="on_block" fork="bellatrix" hash="1b2d9640">
<spec fn="on_block" fork="bellatrix" hash="cceac63a">
def on_block(store: Store, signed_block: SignedBeaconBlock) -> None:
"""
Run ``on_block`` upon receiving a new block.
@@ -4790,8 +4803,10 @@
store.block_states[block_root] = state
# Add block timeliness to the store
time_into_slot = (store.time - store.genesis_time) % SECONDS_PER_SLOT
is_before_attesting_interval = time_into_slot < SECONDS_PER_SLOT // INTERVALS_PER_SLOT
seconds_since_genesis = store.time - store.genesis_time
time_into_slot_ms = seconds_to_milliseconds(seconds_since_genesis) % SLOT_DURATION_MS
attestation_threshold_ms = get_slot_component_duration_ms(ATTESTATION_DUE_BPS)
is_before_attesting_interval = time_into_slot_ms < attestation_threshold_ms
is_timely = get_current_slot(store) == block.slot and is_before_attesting_interval
store.block_timeliness[hash_tree_root(block)] = is_timely
@@ -4812,7 +4827,7 @@
- file: beacon-chain/blockchain/receive_block.go
search: func (s *Service) ReceiveBlock(
spec: |
<spec fn="on_block" fork="capella" hash="14995ab0">
<spec fn="on_block" fork="capella" hash="b051b7c6">
def on_block(store: Store, signed_block: SignedBeaconBlock) -> None:
"""
Run ``on_block`` upon receiving a new block.
@@ -4846,8 +4861,10 @@
store.block_states[block_root] = state
# Add block timeliness to the store
time_into_slot = (store.time - store.genesis_time) % SECONDS_PER_SLOT
is_before_attesting_interval = time_into_slot < SECONDS_PER_SLOT // INTERVALS_PER_SLOT
seconds_since_genesis = store.time - store.genesis_time
time_into_slot_ms = seconds_to_milliseconds(seconds_since_genesis) % SLOT_DURATION_MS
attestation_threshold_ms = get_slot_component_duration_ms(ATTESTATION_DUE_BPS)
is_before_attesting_interval = time_into_slot_ms < attestation_threshold_ms
is_timely = get_current_slot(store) == block.slot and is_before_attesting_interval
store.block_timeliness[hash_tree_root(block)] = is_timely
@@ -4868,7 +4885,7 @@
- file: beacon-chain/blockchain/receive_block.go
search: func (s *Service) ReceiveBlock(
spec: |
<spec fn="on_block" fork="deneb" hash="34d79a7b">
<spec fn="on_block" fork="deneb" hash="1f48df4d">
def on_block(store: Store, signed_block: SignedBeaconBlock) -> None:
"""
Run ``on_block`` upon receiving a new block.
@@ -4892,9 +4909,7 @@
# [New in Deneb:EIP4844]
# Check if blob data is available
# If not, this block MAY be queued and subsequently considered when blob data becomes available
# *Note*: Extraneous or invalid Blobs (in addition to the expected/referenced valid blobs)
# received on the p2p network MUST NOT invalidate a block that is otherwise valid and available
# If not, this payload MAY be queued and subsequently considered when blob data becomes available
assert is_data_available(hash_tree_root(block), block.body.blob_kzg_commitments)
# Check the block is valid and compute the post-state
@@ -4909,8 +4924,10 @@
store.block_states[block_root] = state
# Add block timeliness to the store
time_into_slot = (store.time - store.genesis_time) % SECONDS_PER_SLOT
is_before_attesting_interval = time_into_slot < SECONDS_PER_SLOT // INTERVALS_PER_SLOT
seconds_since_genesis = store.time - store.genesis_time
time_into_slot_ms = seconds_to_milliseconds(seconds_since_genesis) % SLOT_DURATION_MS
attestation_threshold_ms = get_slot_component_duration_ms(ATTESTATION_DUE_BPS)
is_before_attesting_interval = time_into_slot_ms < attestation_threshold_ms
is_timely = get_current_slot(store) == block.slot and is_before_attesting_interval
store.block_timeliness[hash_tree_root(block)] = is_timely
@@ -4931,7 +4948,7 @@
- file: beacon-chain/blockchain/receive_block.go
search: func (s *Service) ReceiveBlock(
spec: |
<spec fn="on_block" fork="fulu" hash="b01ca61f">
<spec fn="on_block" fork="fulu" hash="a27a9edb">
def on_block(store: Store, signed_block: SignedBeaconBlock) -> None:
"""
Run ``on_block`` upon receiving a new block.
@@ -4956,6 +4973,8 @@
assert store.finalized_checkpoint.root == finalized_checkpoint_block
# [Modified in Fulu:EIP7594]
# Check if blob data is available
# If not, this payload MAY be queued and subsequently considered when blob data becomes available
assert is_data_available(hash_tree_root(block))
# Check the block is valid and compute the post-state
@@ -4968,8 +4987,10 @@
store.block_states[block_root] = state
# Add block timeliness to the store
time_into_slot = (store.time - store.genesis_time) % SECONDS_PER_SLOT
is_before_attesting_interval = time_into_slot < SECONDS_PER_SLOT // INTERVALS_PER_SLOT
seconds_since_genesis = store.time - store.genesis_time
time_into_slot_ms = seconds_to_milliseconds(seconds_since_genesis) % SLOT_DURATION_MS
attestation_threshold_ms = get_slot_component_duration_ms(ATTESTATION_DUE_BPS)
is_before_attesting_interval = time_into_slot_ms < attestation_threshold_ms
is_timely = get_current_slot(store) == block.slot and is_before_attesting_interval
store.block_timeliness[hash_tree_root(block)] = is_timely
@@ -7540,6 +7561,20 @@
assert block.state_root == hash_tree_root(state)
</spec>
- name: seconds_to_milliseconds
sources: []
spec: |
<spec fn="seconds_to_milliseconds" fork="phase0" hash="b2cc9743">
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
</spec>
- name: store_target_checkpoint_state
sources: []
spec: |
@@ -8572,17 +8607,16 @@
- file: beacon-chain/core/peerdas/p2p_interface.go
search: func VerifyDataColumnSidecarInclusionProof(
spec: |
<spec fn="verify_data_column_sidecar_inclusion_proof" fork="fulu" hash="a6757e5e">
<spec fn="verify_data_column_sidecar_inclusion_proof" fork="fulu" hash="aaa9b8d8">
def verify_data_column_sidecar_inclusion_proof(sidecar: DataColumnSidecar) -> bool:
"""
Verify if the given KZG commitments included in the given beacon block.
"""
gindex = get_subtree_index(get_generalized_index(BeaconBlockBody, "blob_kzg_commitments"))
return is_valid_merkle_branch(
leaf=hash_tree_root(sidecar.kzg_commitments),
branch=sidecar.kzg_commitments_inclusion_proof,
depth=KZG_COMMITMENTS_INCLUSION_PROOF_DEPTH,
index=gindex,
index=get_subtree_index(get_generalized_index(BeaconBlockBody, "blob_kzg_commitments")),
root=sidecar.signed_block_header.message.body_root,
)
</spec>