some consensus spec v1.4.0 spec URL updates (#6215)
This commit is contained in:
parent
603c83522e
commit
0132f5d689
|
@ -17,7 +17,7 @@ from ./spec/datatypes/deneb import ExecutionPayloadHeader
|
||||||
from ./spec/datatypes/electra import ExecutionPayloadHeader
|
from ./spec/datatypes/electra import ExecutionPayloadHeader
|
||||||
|
|
||||||
type
|
type
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#beaconstate
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/beacon-chain.md#beaconstate
|
||||||
# Memory-representation-equivalent to a phase0 BeaconState for in-place SSZ
|
# Memory-representation-equivalent to a phase0 BeaconState for in-place SSZ
|
||||||
# reading and writing
|
# reading and writing
|
||||||
Phase0BeaconStateNoImmutableValidators* = object
|
Phase0BeaconStateNoImmutableValidators* = object
|
||||||
|
|
|
@ -27,7 +27,7 @@ type
|
||||||
## which blocks are valid - in particular, blocks are not valid if they
|
## which blocks are valid - in particular, blocks are not valid if they
|
||||||
## come from the future as seen from the local clock.
|
## come from the future as seen from the local clock.
|
||||||
##
|
##
|
||||||
## https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/phase0/fork-choice.md#fork-choice
|
## https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/fork-choice.md#fork-choice
|
||||||
##
|
##
|
||||||
# TODO consider NTP and network-adjusted timestamps as outlined here:
|
# TODO consider NTP and network-adjusted timestamps as outlined here:
|
||||||
# https://ethresear.ch/t/network-adjusted-timestamps/4187
|
# https://ethresear.ch/t/network-adjusted-timestamps/4187
|
||||||
|
|
|
@ -8,7 +8,7 @@ to specs:
|
||||||
- aggregate attestations: https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/phase0/p2p-interface.md#beacon_aggregate_and_proof
|
- aggregate attestations: https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/phase0/p2p-interface.md#beacon_aggregate_and_proof
|
||||||
- unaggregated attestation: https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/phase0/p2p-interface.md#beacon_attestation_subnet_id
|
- unaggregated attestation: https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/phase0/p2p-interface.md#beacon_attestation_subnet_id
|
||||||
- voluntary exits: https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/p2p-interface.md#voluntary_exit
|
- voluntary exits: https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/p2p-interface.md#voluntary_exit
|
||||||
- Attester slashings: https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/phase0/p2p-interface.md#attester_slashing
|
- Attester slashings: https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/p2p-interface.md#attester_slashing
|
||||||
- Proposer slashings: https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/phase0/p2p-interface.md#proposer_slashing
|
- Proposer slashings: https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/phase0/p2p-interface.md#proposer_slashing
|
||||||
|
|
||||||
After "gossip validation" the consensus objects can be rebroadcasted as they are optimistically good, however for internal processing further verification is needed.
|
After "gossip validation" the consensus objects can be rebroadcasted as they are optimistically good, however for internal processing further verification is needed.
|
||||||
|
|
|
@ -198,7 +198,7 @@ ETHRoot *ETHBeaconStateCopyGenesisValidatorsRoot(const ETHBeaconState *state);
|
||||||
*
|
*
|
||||||
* @param root Merkle root.
|
* @param root Merkle root.
|
||||||
*
|
*
|
||||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#custom-types
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/beacon-chain.md#custom-types
|
||||||
*/
|
*/
|
||||||
void ETHRootDestroy(ETHRoot *root);
|
void ETHRootDestroy(ETHRoot *root);
|
||||||
|
|
||||||
|
@ -597,7 +597,7 @@ const ETHLightClientHeader *ETHLightClientStoreGetFinalizedHeader(
|
||||||
*
|
*
|
||||||
* @return Whether or not the next sync committee is currently known.
|
* @return Whether or not the next sync committee is currently known.
|
||||||
*
|
*
|
||||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/altair/light-client/sync-protocol.md#is_next_sync_committee_known
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/light-client/sync-protocol.md#is_next_sync_committee_known
|
||||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/light-client/light-client.md
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/light-client/light-client.md
|
||||||
*/
|
*/
|
||||||
ETH_RESULT_USE_CHECK
|
ETH_RESULT_USE_CHECK
|
||||||
|
|
|
@ -142,7 +142,7 @@ proc ETHBeaconStateCreateFromSsz(
|
||||||
## * `NULL` - If the given `sszBytes` is malformed.
|
## * `NULL` - If the given `sszBytes` is malformed.
|
||||||
##
|
##
|
||||||
## See:
|
## See:
|
||||||
## * https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#beaconstate
|
## * https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/beacon-chain.md#beaconstate
|
||||||
## * https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#beaconstate
|
## * https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#beaconstate
|
||||||
## * https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/bellatrix/beacon-chain.md#beaconstate
|
## * https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/bellatrix/beacon-chain.md#beaconstate
|
||||||
## * https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/capella/beacon-chain.md#beaconstate
|
## * https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/capella/beacon-chain.md#beaconstate
|
||||||
|
|
|
@ -196,7 +196,7 @@ func since_epoch_start*(slot: Slot): uint64 = # aka compute_slots_since_epoch_st
|
||||||
template is_epoch*(slot: Slot): bool =
|
template is_epoch*(slot: Slot): bool =
|
||||||
slot.since_epoch_start == 0
|
slot.since_epoch_start == 0
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#compute_start_slot_at_epoch
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/beacon-chain.md#compute_start_slot_at_epoch
|
||||||
func start_slot*(epoch: Epoch): Slot = # aka compute_start_slot_at_epoch
|
func start_slot*(epoch: Epoch): Slot = # aka compute_start_slot_at_epoch
|
||||||
## Return the start slot of ``epoch``.
|
## Return the start slot of ``epoch``.
|
||||||
const maxEpoch = Epoch(FAR_FUTURE_SLOT div SLOTS_PER_EPOCH)
|
const maxEpoch = Epoch(FAR_FUTURE_SLOT div SLOTS_PER_EPOCH)
|
||||||
|
|
|
@ -30,7 +30,7 @@ func increase_balance*(
|
||||||
if delta != 0.Gwei: # avoid dirtying the balance cache if not needed
|
if delta != 0.Gwei: # avoid dirtying the balance cache if not needed
|
||||||
increase_balance(state.balances.mitem(index), delta)
|
increase_balance(state.balances.mitem(index), delta)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#decrease_balance
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/beacon-chain.md#decrease_balance
|
||||||
func decrease_balance*(balance: var Gwei, delta: Gwei) =
|
func decrease_balance*(balance: var Gwei, delta: Gwei) =
|
||||||
balance =
|
balance =
|
||||||
if delta > balance:
|
if delta > balance:
|
||||||
|
@ -158,7 +158,7 @@ func initiate_validator_exit*(
|
||||||
|
|
||||||
from ./datatypes/deneb import BeaconState
|
from ./datatypes/deneb import BeaconState
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/beacon-chain.md#slash_validator
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#modified-slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#modified-slash_validator
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/bellatrix/beacon-chain.md#modified-slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/bellatrix/beacon-chain.md#modified-slash_validator
|
||||||
func get_slashing_penalty*(state: ForkyBeaconState,
|
func get_slashing_penalty*(state: ForkyBeaconState,
|
||||||
|
@ -341,7 +341,7 @@ func get_block_root_at_slot*(
|
||||||
withState(state):
|
withState(state):
|
||||||
get_block_root_at_slot(forkyState.data, slot)
|
get_block_root_at_slot(forkyState.data, slot)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#get_block_root
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/beacon-chain.md#get_block_root
|
||||||
func get_block_root*(state: ForkyBeaconState, epoch: Epoch): Eth2Digest =
|
func get_block_root*(state: ForkyBeaconState, epoch: Epoch): Eth2Digest =
|
||||||
## Return the block root at the start of a recent ``epoch``.
|
## Return the block root at the start of a recent ``epoch``.
|
||||||
get_block_root_at_slot(state, epoch.start_slot())
|
get_block_root_at_slot(state, epoch.start_slot())
|
||||||
|
@ -509,7 +509,7 @@ func check_attestation_target_epoch(
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#attestations
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#attestations
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#modified-process_attestation
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#modified-process_attestation
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.0/specs/deneb/beacon-chain.md#modified-process_attestation
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/deneb/beacon-chain.md#modified-process_attestation
|
||||||
func check_attestation_inclusion(
|
func check_attestation_inclusion(
|
||||||
consensusFork: static ConsensusFork, attestation_slot: Slot,
|
consensusFork: static ConsensusFork, attestation_slot: Slot,
|
||||||
current_slot: Slot): Result[void, cstring] =
|
current_slot: Slot): Result[void, cstring] =
|
||||||
|
@ -611,7 +611,7 @@ func get_attestation_participation_flag_indices(
|
||||||
# TODO these duplicate some stuff in state_transition_epoch which uses TotalBalances
|
# TODO these duplicate some stuff in state_transition_epoch which uses TotalBalances
|
||||||
# better to centralize around that if feasible
|
# better to centralize around that if feasible
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#get_total_active_balance
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/beacon-chain.md#get_total_active_balance
|
||||||
func get_total_active_balance*(state: ForkyBeaconState, cache: var StateCache): Gwei =
|
func get_total_active_balance*(state: ForkyBeaconState, cache: var StateCache): Gwei =
|
||||||
## Return the combined effective balance of the active validators.
|
## Return the combined effective balance of the active validators.
|
||||||
## Note: ``get_total_balance`` returns ``EFFECTIVE_BALANCE_INCREMENT`` Gwei
|
## Note: ``get_total_balance`` returns ``EFFECTIVE_BALANCE_INCREMENT`` Gwei
|
||||||
|
@ -838,7 +838,7 @@ func has_eth1_withdrawal_credential*(validator: Validator): bool =
|
||||||
## Check if ``validator`` has an 0x01 prefixed "eth1" withdrawal credential.
|
## Check if ``validator`` has an 0x01 prefixed "eth1" withdrawal credential.
|
||||||
validator.withdrawal_credentials.data[0] == ETH1_ADDRESS_WITHDRAWAL_PREFIX
|
validator.withdrawal_credentials.data[0] == ETH1_ADDRESS_WITHDRAWAL_PREFIX
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/capella/beacon-chain.md#is_fully_withdrawable_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/capella/beacon-chain.md#is_fully_withdrawable_validator
|
||||||
func is_fully_withdrawable_validator(
|
func is_fully_withdrawable_validator(
|
||||||
validator: Validator, balance: Gwei, epoch: Epoch): bool =
|
validator: Validator, balance: Gwei, epoch: Epoch): bool =
|
||||||
## Check if ``validator`` is fully withdrawable.
|
## Check if ``validator`` is fully withdrawable.
|
||||||
|
|
|
@ -161,7 +161,7 @@ type
|
||||||
NextSyncCommitteeBranch* =
|
NextSyncCommitteeBranch* =
|
||||||
array[log2trunc(NEXT_SYNC_COMMITTEE_GINDEX), Eth2Digest]
|
array[log2trunc(NEXT_SYNC_COMMITTEE_GINDEX), Eth2Digest]
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/altair/light-client/sync-protocol.md#lightclientheader
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/light-client/sync-protocol.md#lightclientheader
|
||||||
LightClientHeader* = object
|
LightClientHeader* = object
|
||||||
beacon*: BeaconBlockHeader
|
beacon*: BeaconBlockHeader
|
||||||
## Beacon block header
|
## Beacon block header
|
||||||
|
@ -665,7 +665,7 @@ chronicles.formatIt SyncCommitteeContribution: shortLog(it)
|
||||||
chronicles.formatIt ContributionAndProof: shortLog(it)
|
chronicles.formatIt ContributionAndProof: shortLog(it)
|
||||||
chronicles.formatIt SignedContributionAndProof: shortLog(it)
|
chronicles.formatIt SignedContributionAndProof: shortLog(it)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/altair/light-client/sync-protocol.md#is_valid_light_client_header
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/light-client/sync-protocol.md#is_valid_light_client_header
|
||||||
func is_valid_light_client_header*(
|
func is_valid_light_client_header*(
|
||||||
header: LightClientHeader, cfg: RuntimeConfig): bool =
|
header: LightClientHeader, cfg: RuntimeConfig): bool =
|
||||||
true
|
true
|
||||||
|
|
|
@ -257,7 +257,7 @@ type
|
||||||
current_version*: Version
|
current_version*: Version
|
||||||
genesis_validators_root*: Eth2Digest
|
genesis_validators_root*: Eth2Digest
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#checkpoint
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/beacon-chain.md#checkpoint
|
||||||
Checkpoint* = object
|
Checkpoint* = object
|
||||||
epoch*: Epoch
|
epoch*: Epoch
|
||||||
root*: Eth2Digest
|
root*: Eth2Digest
|
||||||
|
@ -298,7 +298,7 @@ type
|
||||||
signature*: ValidatorSig
|
signature*: ValidatorSig
|
||||||
## Signing over DepositMessage
|
## Signing over DepositMessage
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#voluntaryexit
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/beacon-chain.md#voluntaryexit
|
||||||
VoluntaryExit* = object
|
VoluntaryExit* = object
|
||||||
epoch*: Epoch
|
epoch*: Epoch
|
||||||
## Earliest epoch when voluntary exit can be processed
|
## Earliest epoch when voluntary exit can be processed
|
||||||
|
@ -354,7 +354,7 @@ type
|
||||||
withdrawable_epoch*: Epoch
|
withdrawable_epoch*: Epoch
|
||||||
## When validator can withdraw funds
|
## When validator can withdraw funds
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#pendingattestation
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/beacon-chain.md#pendingattestation
|
||||||
PendingAttestation* = object
|
PendingAttestation* = object
|
||||||
aggregation_bits*: CommitteeValidatorsBits
|
aggregation_bits*: CommitteeValidatorsBits
|
||||||
data*: AttestationData
|
data*: AttestationData
|
||||||
|
@ -406,7 +406,7 @@ type
|
||||||
|
|
||||||
GraffitiBytes* = distinct array[MAX_GRAFFITI_SIZE, byte]
|
GraffitiBytes* = distinct array[MAX_GRAFFITI_SIZE, byte]
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#signedbeaconblockheader
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/beacon-chain.md#signedbeaconblockheader
|
||||||
SignedBeaconBlockHeader* = object
|
SignedBeaconBlockHeader* = object
|
||||||
message*: BeaconBlockHeader
|
message*: BeaconBlockHeader
|
||||||
signature*: ValidatorSig
|
signature*: ValidatorSig
|
||||||
|
|
|
@ -52,7 +52,7 @@ type
|
||||||
from_bls_pubkey*: ValidatorPubKey
|
from_bls_pubkey*: ValidatorPubKey
|
||||||
to_execution_address*: ExecutionAddress
|
to_execution_address*: ExecutionAddress
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/capella/beacon-chain.md#signedblstoexecutionchange
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/capella/beacon-chain.md#signedblstoexecutionchange
|
||||||
SignedBLSToExecutionChange* = object
|
SignedBLSToExecutionChange* = object
|
||||||
message*: BLSToExecutionChange
|
message*: BLSToExecutionChange
|
||||||
signature*: ValidatorSig
|
signature*: ValidatorSig
|
||||||
|
|
|
@ -77,5 +77,5 @@ const
|
||||||
GOSSIP_MAX_SIZE* = 10'u64 * 1024 * 1024 # bytes
|
GOSSIP_MAX_SIZE* = 10'u64 * 1024 * 1024 # bytes
|
||||||
MAX_CHUNK_SIZE* = 10'u64 * 1024 * 1024 # bytes
|
MAX_CHUNK_SIZE* = 10'u64 * 1024 * 1024 # bytes
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/deneb/p2p-interface.md#configuration
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/deneb/p2p-interface.md#configuration
|
||||||
MAX_REQUEST_BLOCKS_DENEB*: uint64 = 128 # TODO Make use of in request code
|
MAX_REQUEST_BLOCKS_DENEB*: uint64 = 128 # TODO Make use of in request code
|
||||||
|
|
|
@ -53,7 +53,7 @@ type
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/deneb/polynomial-commitments.md#custom-types
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/deneb/polynomial-commitments.md#custom-types
|
||||||
Blob* = array[BYTES_PER_FIELD_ELEMENT * FIELD_ELEMENTS_PER_BLOB, byte]
|
Blob* = array[BYTES_PER_FIELD_ELEMENT * FIELD_ELEMENTS_PER_BLOB, byte]
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/deneb/p2p-interface.md#blobsidecar
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/deneb/p2p-interface.md#blobsidecar
|
||||||
BlobSidecar* = object
|
BlobSidecar* = object
|
||||||
index*: BlobIndex
|
index*: BlobIndex
|
||||||
## Index of blob in block
|
## Index of blob in block
|
||||||
|
|
|
@ -219,7 +219,7 @@ type
|
||||||
deposits*: List[Deposit, Limit MAX_DEPOSITS]
|
deposits*: List[Deposit, Limit MAX_DEPOSITS]
|
||||||
voluntary_exits*: List[TrustedSignedVoluntaryExit, Limit MAX_VOLUNTARY_EXITS]
|
voluntary_exits*: List[TrustedSignedVoluntaryExit, Limit MAX_VOLUNTARY_EXITS]
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#signedbeaconblock
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/beacon-chain.md#signedbeaconblock
|
||||||
SignedBeaconBlock* = object
|
SignedBeaconBlock* = object
|
||||||
message*: BeaconBlock
|
message*: BeaconBlock
|
||||||
signature*: ValidatorSig
|
signature*: ValidatorSig
|
||||||
|
|
|
@ -1389,7 +1389,7 @@ func readSszForkedSignedBeaconBlock*(
|
||||||
withBlck(result):
|
withBlck(result):
|
||||||
readSszBytes(data, forkyBlck)
|
readSszBytes(data, forkyBlck)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#compute_fork_data_root
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/beacon-chain.md#compute_fork_data_root
|
||||||
func compute_fork_data_root*(current_version: Version,
|
func compute_fork_data_root*(current_version: Version,
|
||||||
genesis_validators_root: Eth2Digest): Eth2Digest =
|
genesis_validators_root: Eth2Digest): Eth2Digest =
|
||||||
## Return the 32-byte fork data root for the ``current_version`` and
|
## Return the 32-byte fork data root for the ``current_version`` and
|
||||||
|
|
|
@ -107,7 +107,7 @@ func get_active_validator_indices_len*(
|
||||||
withState(state):
|
withState(state):
|
||||||
get_active_validator_indices_len(forkyState.data, epoch)
|
get_active_validator_indices_len(forkyState.data, epoch)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#get_current_epoch
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/beacon-chain.md#get_current_epoch
|
||||||
func get_current_epoch*(state: ForkyBeaconState): Epoch =
|
func get_current_epoch*(state: ForkyBeaconState): Epoch =
|
||||||
## Return the current epoch.
|
## Return the current epoch.
|
||||||
state.slot.epoch
|
state.slot.epoch
|
||||||
|
@ -271,7 +271,7 @@ template is_finality_update*(update: SomeForkyLightClientUpdate): bool =
|
||||||
else:
|
else:
|
||||||
false
|
false
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/altair/light-client/sync-protocol.md#is_next_sync_committee_known
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/light-client/sync-protocol.md#is_next_sync_committee_known
|
||||||
template is_next_sync_committee_known*(store: ForkyLightClientStore): bool =
|
template is_next_sync_committee_known*(store: ForkyLightClientStore): bool =
|
||||||
store.next_sync_committee !=
|
store.next_sync_committee !=
|
||||||
static(default(typeof(store.next_sync_committee)))
|
static(default(typeof(store.next_sync_committee)))
|
||||||
|
|
|
@ -779,7 +779,7 @@ proc readRuntimeConfig*(
|
||||||
"MAX_REQUEST_BLOB_SIDECARS"
|
"MAX_REQUEST_BLOB_SIDECARS"
|
||||||
checkCompatibility BLOB_SIDECAR_SUBNET_COUNT
|
checkCompatibility BLOB_SIDECAR_SUBNET_COUNT
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/phase0/fork-choice.md#configuration
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/fork-choice.md#configuration
|
||||||
# Isn't being used as a preset in the usual way: at any time, there's one correct value
|
# Isn't being used as a preset in the usual way: at any time, there's one correct value
|
||||||
checkCompatibility PROPOSER_SCORE_BOOST
|
checkCompatibility PROPOSER_SCORE_BOOST
|
||||||
checkCompatibility REORG_HEAD_WEIGHT_THRESHOLD
|
checkCompatibility REORG_HEAD_WEIGHT_THRESHOLD
|
||||||
|
|
|
@ -381,7 +381,7 @@ func partialBeaconBlock*(
|
||||||
when consensusFork >= ConsensusFork.Altair:
|
when consensusFork >= ConsensusFork.Altair:
|
||||||
res.body.sync_aggregate = sync_aggregate
|
res.body.sync_aggregate = sync_aggregate
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/bellatrix/validator.md#block-proposal
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/bellatrix/validator.md#block-proposal
|
||||||
when consensusFork >= ConsensusFork.Bellatrix:
|
when consensusFork >= ConsensusFork.Bellatrix:
|
||||||
res.body.execution_payload = execution_payload.executionPayload
|
res.body.execution_payload = execution_payload.executionPayload
|
||||||
|
|
||||||
|
|
|
@ -360,7 +360,7 @@ proc process_deposit*(
|
||||||
|
|
||||||
ok()
|
ok()
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#voluntary-exits
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/beacon-chain.md#voluntary-exits
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/deneb/beacon-chain.md#modified-process_voluntary_exit
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/deneb/beacon-chain.md#modified-process_voluntary_exit
|
||||||
proc check_voluntary_exit*(
|
proc check_voluntary_exit*(
|
||||||
cfg: RuntimeConfig,
|
cfg: RuntimeConfig,
|
||||||
|
|
|
@ -1012,7 +1012,7 @@ template effective_balance_might_update*(
|
||||||
balance + DOWNWARD_THRESHOLD < effective_balance or
|
balance + DOWNWARD_THRESHOLD < effective_balance or
|
||||||
effective_balance + UPWARD_THRESHOLD < balance
|
effective_balance + UPWARD_THRESHOLD < balance
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#effective-balances-updates
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/beacon-chain.md#effective-balances-updates
|
||||||
func process_effective_balance_updates*(state: var ForkyBeaconState) =
|
func process_effective_balance_updates*(state: var ForkyBeaconState) =
|
||||||
# Update effective balances with hysteresis
|
# Update effective balances with hysteresis
|
||||||
for vidx in state.validators.vindices:
|
for vidx in state.validators.vindices:
|
||||||
|
@ -1028,7 +1028,7 @@ func process_effective_balance_updates*(state: var ForkyBeaconState) =
|
||||||
if new_effective_balance != effective_balance:
|
if new_effective_balance != effective_balance:
|
||||||
state.validators.mitem(vidx).effective_balance = new_effective_balance
|
state.validators.mitem(vidx).effective_balance = new_effective_balance
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#slashings-balances-updates
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/beacon-chain.md#slashings-balances-updates
|
||||||
func process_slashings_reset*(state: var ForkyBeaconState) =
|
func process_slashings_reset*(state: var ForkyBeaconState) =
|
||||||
let next_epoch = get_current_epoch(state) + 1
|
let next_epoch = get_current_epoch(state) + 1
|
||||||
|
|
||||||
|
@ -1254,7 +1254,7 @@ proc process_epoch*(
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#rewards-and-penalties
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#rewards-and-penalties
|
||||||
process_rewards_and_penalties(cfg, state, info) # [Modified in Altair]
|
process_rewards_and_penalties(cfg, state, info) # [Modified in Altair]
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#registry-updates
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/beacon-chain.md#registry-updates
|
||||||
? process_registry_updates(cfg, state, cache)
|
? process_registry_updates(cfg, state, cache)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#slashings
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#slashings
|
||||||
|
|
|
@ -162,7 +162,7 @@ func count_active_validators*(state: ForkyBeaconState,
|
||||||
cache: var StateCache): uint64 =
|
cache: var StateCache): uint64 =
|
||||||
cache.get_shuffled_active_validator_indices(state, epoch).lenu64
|
cache.get_shuffled_active_validator_indices(state, epoch).lenu64
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#get_committee_count_per_slot
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/beacon-chain.md#get_committee_count_per_slot
|
||||||
func get_committee_count_per_slot*(num_active_validators: uint64): uint64 =
|
func get_committee_count_per_slot*(num_active_validators: uint64): uint64 =
|
||||||
clamp(
|
clamp(
|
||||||
num_active_validators div SLOTS_PER_EPOCH div TARGET_COMMITTEE_SIZE,
|
num_active_validators div SLOTS_PER_EPOCH div TARGET_COMMITTEE_SIZE,
|
||||||
|
|
|
@ -90,7 +90,7 @@ p2pProtocol LightClientSync(version = 1,
|
||||||
|
|
||||||
debug "LC bootstrap request done", peer, blockRoot
|
debug "LC bootstrap request done", peer, blockRoot
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/altair/light-client/p2p-interface.md#lightclientupdatesbyrange
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/light-client/p2p-interface.md#lightclientupdatesbyrange
|
||||||
proc lightClientUpdatesByRange(
|
proc lightClientUpdatesByRange(
|
||||||
peer: Peer,
|
peer: Peer,
|
||||||
startPeriod: SyncCommitteePeriod,
|
startPeriod: SyncCommitteePeriod,
|
||||||
|
|
|
@ -1530,7 +1530,7 @@ proc signAndSendAggregate(
|
||||||
shufflingRef, slot, committee_index, selectionProof):
|
shufflingRef, slot, committee_index, selectionProof):
|
||||||
return
|
return
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/validator.md#construct-aggregate
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/validator.md#construct-aggregate
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/validator.md#aggregateandproof
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/validator.md#aggregateandproof
|
||||||
var
|
var
|
||||||
msg = SignedAggregateAndProof(
|
msg = SignedAggregateAndProof(
|
||||||
|
|
|
@ -117,7 +117,7 @@ proc runVerifyBlobKzgProofBatchTest(suiteName, suitePath, path: string) =
|
||||||
commitments = data["input"]["commitments"].mapIt(fromHex[48](it.getStr))
|
commitments = data["input"]["commitments"].mapIt(fromHex[48](it.getStr))
|
||||||
proofs = data["input"]["proofs"].mapIt(fromHex[48](it.getStr))
|
proofs = data["input"]["proofs"].mapIt(fromHex[48](it.getStr))
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/tests/formats/kzg/verify_blob_kzg_proof_batch.md#condition
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/tests/formats/kzg/verify_blob_kzg_proof_batch.md#condition
|
||||||
# "If any of the commitments or proofs are invalid (e.g. not on the curve or
|
# "If any of the commitments or proofs are invalid (e.g. not on the curve or
|
||||||
# not in the G1 subgroup of the BLS curve) or any blob is invalid (e.g.
|
# not in the G1 subgroup of the BLS curve) or any blob is invalid (e.g.
|
||||||
# incorrect length or one of the 32-byte blocks does not represent a BLS
|
# incorrect length or one of the 32-byte blocks does not represent a BLS
|
||||||
|
|
Loading…
Reference in New Issue