mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-02-08 20:54:33 +00:00
a dozen spec URL updates to v1.1.5 (#3078)
This commit is contained in:
parent
59db4b4f9c
commit
5c48982280
@ -4,7 +4,7 @@ This folder holds the various consensus object pools needed for a blockchain cli
|
|||||||
|
|
||||||
Object in those pools have passed the "gossip validation" filter according
|
Object in those pools have passed the "gossip validation" filter according
|
||||||
to specs:
|
to specs:
|
||||||
- blocks: https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/p2p-interface.md#beacon_block
|
- blocks: https://github.com/ethereum/consensus-specs/blob/v1.1.5/specs/phase0/p2p-interface.md#beacon_block
|
||||||
- aggregate attestations: https://github.com/ethereum/consensus-specs/blob/v1.1.5/specs/phase0/p2p-interface.md#beacon_aggregate_and_proof
|
- aggregate attestations: https://github.com/ethereum/consensus-specs/blob/v1.1.5/specs/phase0/p2p-interface.md#beacon_aggregate_and_proof
|
||||||
- unaggregated attestation: https://github.com/ethereum/consensus-specs/blob/v1.1.5/specs/phase0/p2p-interface.md#beacon_attestation_subnet_id
|
- unaggregated attestation: https://github.com/ethereum/consensus-specs/blob/v1.1.5/specs/phase0/p2p-interface.md#beacon_attestation_subnet_id
|
||||||
- voluntary exits: https://github.com/ethereum/consensus-specs/blob/v1.1.5/specs/phase0/p2p-interface.md#voluntary_exit
|
- voluntary exits: https://github.com/ethereum/consensus-specs/blob/v1.1.5/specs/phase0/p2p-interface.md#voluntary_exit
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
{.push raises: [Defect].}
|
{.push raises: [Defect].}
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.2/tests/core/pyspec/eth2spec/utils/merkle_minimal.py
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.5/tests/core/pyspec/eth2spec/utils/merkle_minimal.py
|
||||||
|
|
||||||
# Merkle tree helpers
|
# Merkle tree helpers
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
|
@ -63,7 +63,7 @@ func get_validator_from_deposit*(deposit: DepositData):
|
|||||||
effective_balance: effective_balance
|
effective_balance: effective_balance
|
||||||
)
|
)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#compute_activation_exit_epoch
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.5/specs/phase0/beacon-chain.md#compute_activation_exit_epoch
|
||||||
func compute_activation_exit_epoch*(epoch: Epoch): Epoch =
|
func compute_activation_exit_epoch*(epoch: Epoch): Epoch =
|
||||||
## Return the epoch during which validator activations and exits initiated in
|
## Return the epoch during which validator activations and exits initiated in
|
||||||
## ``epoch`` take effect.
|
## ``epoch`` take effect.
|
||||||
|
@ -56,7 +56,7 @@ const
|
|||||||
FINALIZED_ROOT_INDEX* = 105.GeneralizedIndex
|
FINALIZED_ROOT_INDEX* = 105.GeneralizedIndex
|
||||||
NEXT_SYNC_COMMITTEE_INDEX* = 55.GeneralizedIndex
|
NEXT_SYNC_COMMITTEE_INDEX* = 55.GeneralizedIndex
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/altair/beacon-chain.md#participation-flag-indices
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.5/specs/altair/beacon-chain.md#participation-flag-indices
|
||||||
TIMELY_SOURCE_FLAG_INDEX* = 0
|
TIMELY_SOURCE_FLAG_INDEX* = 0
|
||||||
TIMELY_TARGET_FLAG_INDEX* = 1
|
TIMELY_TARGET_FLAG_INDEX* = 1
|
||||||
TIMELY_HEAD_FLAG_INDEX* = 2
|
TIMELY_HEAD_FLAG_INDEX* = 2
|
||||||
|
@ -183,7 +183,7 @@ type
|
|||||||
attestation_1*: TrustedIndexedAttestation
|
attestation_1*: TrustedIndexedAttestation
|
||||||
attestation_2*: TrustedIndexedAttestation
|
attestation_2*: TrustedIndexedAttestation
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#indexedattestation
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.5/specs/phase0/beacon-chain.md#indexedattestation
|
||||||
IndexedAttestation* = object
|
IndexedAttestation* = object
|
||||||
attesting_indices*: List[uint64, Limit MAX_VALIDATORS_PER_COMMITTEE]
|
attesting_indices*: List[uint64, Limit MAX_VALIDATORS_PER_COMMITTEE]
|
||||||
data*: AttestationData
|
data*: AttestationData
|
||||||
@ -392,7 +392,7 @@ type
|
|||||||
branch*: array[DEPOSIT_CONTRACT_TREE_DEPTH, Eth2Digest]
|
branch*: array[DEPOSIT_CONTRACT_TREE_DEPTH, Eth2Digest]
|
||||||
deposit_count*: array[32, byte] # Uint256
|
deposit_count*: array[32, byte] # Uint256
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.5/specs/phase0/beacon-chain.md#validator
|
||||||
ValidatorStatus* = object
|
ValidatorStatus* = object
|
||||||
# This is a validator without the expensive, immutable, append-only parts
|
# This is a validator without the expensive, immutable, append-only parts
|
||||||
# serialized. They're represented in memory to allow in-place SSZ reading
|
# serialized. They're represented in memory to allow in-place SSZ reading
|
||||||
|
@ -33,7 +33,7 @@ import
|
|||||||
json_serialization/types as jsonTypes
|
json_serialization/types as jsonTypes
|
||||||
|
|
||||||
type
|
type
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#beaconstate
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.5/specs/phase0/beacon-chain.md#beaconstate
|
||||||
BeaconState* = object
|
BeaconState* = object
|
||||||
# Versioning
|
# Versioning
|
||||||
genesis_time*: uint64
|
genesis_time*: uint64
|
||||||
|
@ -518,14 +518,14 @@ func is_merge_block(
|
|||||||
not is_merge_complete(state) and
|
not is_merge_complete(state) and
|
||||||
body.execution_payload != default(merge.ExecutionPayload)
|
body.execution_payload != default(merge.ExecutionPayload)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.2/specs/merge/beacon-chain.md#is_execution_enabled
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.5/specs/merge/beacon-chain.md#is_execution_enabled
|
||||||
func is_execution_enabled*(
|
func is_execution_enabled*(
|
||||||
state: merge.BeaconState,
|
state: merge.BeaconState,
|
||||||
body: merge.BeaconBlockBody | merge.TrustedBeaconBlockBody |
|
body: merge.BeaconBlockBody | merge.TrustedBeaconBlockBody |
|
||||||
merge.SigVerifiedBeaconBlockBody): bool =
|
merge.SigVerifiedBeaconBlockBody): bool =
|
||||||
is_merge_block(state, body) or is_merge_complete(state)
|
is_merge_block(state, body) or is_merge_complete(state)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0-beta.4/specs/merge/beacon-chain.md#compute_timestamp_at_slot
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.5/specs/merge/beacon-chain.md#compute_timestamp_at_slot
|
||||||
func compute_timestamp_at_slot*(state: ForkyBeaconState, slot: Slot): uint64 =
|
func compute_timestamp_at_slot*(state: ForkyBeaconState, slot: Slot): uint64 =
|
||||||
# Note: This function is unsafe with respect to overflows and underflows.
|
# Note: This function is unsafe with respect to overflows and underflows.
|
||||||
let slots_since_genesis = slot - GENESIS_SLOT
|
let slots_since_genesis = slot - GENESIS_SLOT
|
||||||
|
@ -158,7 +158,7 @@ func contribution_and_proof_signing_root*(
|
|||||||
genesis_validators_root)
|
genesis_validators_root)
|
||||||
compute_signing_root(msg, domain)
|
compute_signing_root(msg, domain)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0-alpha.7/specs/altair/validator.md#aggregation-selection
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.5/specs/altair/validator.md#aggregation-selection
|
||||||
proc sync_committee_selection_proof_signing_root*(
|
proc sync_committee_selection_proof_signing_root*(
|
||||||
fork: Fork,
|
fork: Fork,
|
||||||
genesis_validators_root: Eth2Digest,
|
genesis_validators_root: Eth2Digest,
|
||||||
|
@ -29,7 +29,7 @@ func apply_randao_reveal(state: ForkyBeaconState, blck: var ForkySignedBeaconBlo
|
|||||||
blck.message.slot.compute_epoch_at_slot,
|
blck.message.slot.compute_epoch_at_slot,
|
||||||
privkey).toValidatorSig()
|
privkey).toValidatorSig()
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.4/tests/core/pyspec/eth2spec/test/helpers/block.py#L38-L54
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.5/tests/core/pyspec/eth2spec/test/helpers/block.py#L38-L54
|
||||||
func sign_block(state: ForkyBeaconState, blck: var ForkySignedBeaconBlock) =
|
func sign_block(state: ForkyBeaconState, blck: var ForkySignedBeaconBlock) =
|
||||||
let
|
let
|
||||||
proposer_index = blck.message.proposer_index.ValidatorIndex
|
proposer_index = blck.message.proposer_index.ValidatorIndex
|
||||||
@ -43,7 +43,7 @@ func sign_block(state: ForkyBeaconState, blck: var ForkySignedBeaconBlock) =
|
|||||||
blck.root,
|
blck.root,
|
||||||
privkey).toValidatorSig()
|
privkey).toValidatorSig()
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/tests/core/pyspec/eth2spec/test/helpers/execution_payload.py#L1-L31
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.5/tests/core/pyspec/eth2spec/test/helpers/execution_payload.py#L1-L31
|
||||||
func build_empty_execution_payload(state: merge.BeaconState): ExecutionPayload =
|
func build_empty_execution_payload(state: merge.BeaconState): ExecutionPayload =
|
||||||
## Assuming a pre-state of the same slot, build a valid ExecutionPayload
|
## Assuming a pre-state of the same slot, build a valid ExecutionPayload
|
||||||
## without any transactions.
|
## without any transactions.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user