consensus-spec URL updates to v1.4.0-beta.3 (#5541)
This commit is contained in:
parent
b0d5001571
commit
62d59daaa7
|
@ -127,7 +127,7 @@ type
|
||||||
current_sync_committee*: SyncCommittee # [New in Altair]
|
current_sync_committee*: SyncCommittee # [New in Altair]
|
||||||
next_sync_committee*: SyncCommittee # [New in Altair]
|
next_sync_committee*: SyncCommittee # [New in Altair]
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/bellatrix/beacon-chain.md#beaconstate
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/bellatrix/beacon-chain.md#beaconstate
|
||||||
# Memory-representation-equivalent to a Bellatrix BeaconState for in-place SSZ
|
# Memory-representation-equivalent to a Bellatrix BeaconState for in-place SSZ
|
||||||
# reading and writing
|
# reading and writing
|
||||||
BellatrixBeaconStateNoImmutableValidators* = object
|
BellatrixBeaconStateNoImmutableValidators* = object
|
||||||
|
|
|
@ -739,7 +739,7 @@ func getAggregatedAttestation*(pool: var AttestationPool,
|
||||||
index: CommitteeIndex): Opt[Attestation] =
|
index: CommitteeIndex): Opt[Attestation] =
|
||||||
## Select the attestation that has the most votes going for it in the given
|
## Select the attestation that has the most votes going for it in the given
|
||||||
## slot/index
|
## slot/index
|
||||||
## https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/validator.md#construct-aggregate
|
## https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/validator.md#construct-aggregate
|
||||||
let candidateIdx = pool.candidateIdx(slot)
|
let candidateIdx = pool.candidateIdx(slot)
|
||||||
if candidateIdx.isNone:
|
if candidateIdx.isNone:
|
||||||
return Opt.none(Attestation)
|
return Opt.none(Attestation)
|
||||||
|
|
|
@ -134,7 +134,7 @@ func link*(parent, child: BlockRef) =
|
||||||
func get_ancestor*(blck: BlockRef, slot: Slot,
|
func get_ancestor*(blck: BlockRef, slot: Slot,
|
||||||
maxDepth = 100'i64 * 365 * 24 * 60 * 60 div SECONDS_PER_SLOT.int):
|
maxDepth = 100'i64 * 365 * 24 * 60 * 60 div SECONDS_PER_SLOT.int):
|
||||||
BlockRef =
|
BlockRef =
|
||||||
## https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/fork-choice.md#get_ancestor
|
## https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/fork-choice.md#get_ancestor
|
||||||
## Return the most recent block as of the time at `slot` that not more recent
|
## Return the most recent block as of the time at `slot` that not more recent
|
||||||
## than `blck` itself
|
## than `blck` itself
|
||||||
if isNil(blck): return nil
|
if isNil(blck): return nil
|
||||||
|
|
|
@ -2613,7 +2613,7 @@ func aggregateAll*(
|
||||||
# Aggregation spec requires non-empty collection
|
# Aggregation spec requires non-empty collection
|
||||||
# - https://tools.ietf.org/html/draft-irtf-cfrg-bls-signature-04
|
# - https://tools.ietf.org/html/draft-irtf-cfrg-bls-signature-04
|
||||||
# Consensus specs require at least one attesting index in attestation
|
# Consensus specs require at least one attesting index in attestation
|
||||||
# - https://github.com/ethereum/consensus-specs/blob/v1.4.0-alpha.3/specs/phase0/beacon-chain.md#is_valid_indexed_attestation
|
# - https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/beacon-chain.md#is_valid_indexed_attestation
|
||||||
return err("aggregate: no attesting keys")
|
return err("aggregate: no attesting keys")
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
|
@ -191,7 +191,7 @@ func makeAttestationData*(
|
||||||
epoch: current_epoch,
|
epoch: current_epoch,
|
||||||
root: epoch_boundary_block.blck.root))
|
root: epoch_boundary_block.blck.root))
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/validator.md#validator-assignments
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/validator.md#validator-assignments
|
||||||
iterator get_committee_assignments*(
|
iterator get_committee_assignments*(
|
||||||
shufflingRef: ShufflingRef, validator_indices: HashSet[ValidatorIndex]):
|
shufflingRef: ShufflingRef, validator_indices: HashSet[ValidatorIndex]):
|
||||||
tuple[committee_index: CommitteeIndex,
|
tuple[committee_index: CommitteeIndex,
|
||||||
|
|
|
@ -423,7 +423,7 @@ template toGaugeValue(x: Quantity): int64 =
|
||||||
# doAssert SECONDS_PER_ETH1_BLOCK * cfg.ETH1_FOLLOW_DISTANCE < GENESIS_DELAY,
|
# doAssert SECONDS_PER_ETH1_BLOCK * cfg.ETH1_FOLLOW_DISTANCE < GENESIS_DELAY,
|
||||||
# "Invalid configuration: GENESIS_DELAY is set too low"
|
# "Invalid configuration: GENESIS_DELAY is set too low"
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/validator.md#get_eth1_data
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/validator.md#get_eth1_data
|
||||||
func compute_time_at_slot(genesis_time: uint64, slot: Slot): uint64 =
|
func compute_time_at_slot(genesis_time: uint64, slot: Slot): uint64 =
|
||||||
genesis_time + slot * SECONDS_PER_SLOT
|
genesis_time + slot * SECONDS_PER_SLOT
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ This folder holds a collection of modules to:
|
||||||
|
|
||||||
Gossip validation is different from consensus verification in particular for blocks.
|
Gossip validation is different from consensus verification in particular for blocks.
|
||||||
|
|
||||||
- Blocks: https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#beacon_block
|
- Blocks: https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/p2p-interface.md#beacon_block
|
||||||
- Attestations (aggregated): https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#beacon_aggregate_and_proof
|
- Attestations (aggregated): https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#beacon_aggregate_and_proof
|
||||||
- Attestations (unaggregated): https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#attestation-subnets
|
- Attestations (unaggregated): https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#attestation-subnets
|
||||||
- Voluntary exits: https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#voluntary_exit
|
- Voluntary exits: https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#voluntary_exit
|
||||||
|
|
|
@ -276,7 +276,7 @@ template validateBeaconBlockBellatrix(
|
||||||
#
|
#
|
||||||
# `is_merge_transition_complete(state)` tests for
|
# `is_merge_transition_complete(state)` tests for
|
||||||
# `state.latest_execution_payload_header != ExecutionPayloadHeader()`, while
|
# `state.latest_execution_payload_header != ExecutionPayloadHeader()`, while
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/bellatrix/beacon-chain.md#block-processing
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/bellatrix/beacon-chain.md#block-processing
|
||||||
# shows that `state.latest_execution_payload_header` being default or not is
|
# shows that `state.latest_execution_payload_header` being default or not is
|
||||||
# exactly equivalent to whether that block's execution payload is default or
|
# exactly equivalent to whether that block's execution payload is default or
|
||||||
# not, so test cached block information rather than reconstructing a state.
|
# not, so test cached block information rather than reconstructing a state.
|
||||||
|
@ -1012,7 +1012,7 @@ proc validateAttesterSlashing*(
|
||||||
|
|
||||||
ok()
|
ok()
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/p2p-interface.md#proposer_slashing
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/p2p-interface.md#proposer_slashing
|
||||||
proc validateProposerSlashing*(
|
proc validateProposerSlashing*(
|
||||||
pool: ValidatorChangePool, proposer_slashing: ProposerSlashing):
|
pool: ValidatorChangePool, proposer_slashing: ProposerSlashing):
|
||||||
Result[void, ValidationError] =
|
Result[void, ValidationError] =
|
||||||
|
|
|
@ -149,11 +149,11 @@ typedef struct ETHBeaconState ETHBeaconState;
|
||||||
* representation - If successful.
|
* representation - If successful.
|
||||||
* @return `NULL` - If the given `sszBytes` is malformed.
|
* @return `NULL` - If the given `sszBytes` is malformed.
|
||||||
*
|
*
|
||||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/phase0/beacon-chain.md#beaconstate
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/beacon-chain.md#beaconstate
|
||||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/altair/beacon-chain.md#beaconstate
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/altair/beacon-chain.md#beaconstate
|
||||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/bellatrix/beacon-chain.md#beaconstate
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/bellatrix/beacon-chain.md#beaconstate
|
||||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/capella/beacon-chain.md#beaconstate
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/capella/beacon-chain.md#beaconstate
|
||||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/configs/README.md
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/configs/README.md
|
||||||
*/
|
*/
|
||||||
ETH_RESULT_USE_CHECK
|
ETH_RESULT_USE_CHECK
|
||||||
ETHBeaconState *ETHBeaconStateCreateFromSsz(
|
ETHBeaconState *ETHBeaconStateCreateFromSsz(
|
||||||
|
@ -595,7 +595,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.1/specs/altair/light-client/sync-protocol.md#is_next_sync_committee_known
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/altair/light-client/sync-protocol.md#is_next_sync_committee_known
|
||||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/altair/light-client/light-client.md
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/altair/light-client/light-client.md
|
||||||
*/
|
*/
|
||||||
ETH_RESULT_USE_CHECK
|
ETH_RESULT_USE_CHECK
|
||||||
bool ETHLightClientStoreIsNextSyncCommitteeKnown(const ETHLightClientStore *store);
|
bool ETHLightClientStoreIsNextSyncCommitteeKnown(const ETHLightClientStore *store);
|
||||||
|
@ -669,7 +669,7 @@ void ETHLightClientHeaderDestroy(ETHLightClientHeader *header);
|
||||||
*
|
*
|
||||||
* @return Pointer to a copy of the given header's beacon block root.
|
* @return Pointer to a copy of the given header's beacon block root.
|
||||||
*
|
*
|
||||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/beacon-chain.md#hash_tree_root
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/beacon-chain.md#hash_tree_root
|
||||||
*/
|
*/
|
||||||
ETH_RESULT_USE_CHECK
|
ETH_RESULT_USE_CHECK
|
||||||
ETHRoot *ETHLightClientHeaderCopyBeaconRoot(
|
ETHRoot *ETHLightClientHeaderCopyBeaconRoot(
|
||||||
|
|
|
@ -174,7 +174,7 @@ type
|
||||||
MounterProc* = proc(network: Eth2Node) {.gcsafe, raises: [CatchableError].}
|
MounterProc* = proc(network: Eth2Node) {.gcsafe, raises: [CatchableError].}
|
||||||
MessageContentPrinter* = proc(msg: pointer): string {.gcsafe, raises: [].}
|
MessageContentPrinter* = proc(msg: pointer): string {.gcsafe, raises: [].}
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#goodbye
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/p2p-interface.md#goodbye
|
||||||
DisconnectionReason* = enum
|
DisconnectionReason* = enum
|
||||||
# might see other values on the wire!
|
# might see other values on the wire!
|
||||||
ClientShutDown = 1
|
ClientShutDown = 1
|
||||||
|
@ -2263,7 +2263,7 @@ proc getPersistentNetKeys*(
|
||||||
func gossipId(
|
func gossipId(
|
||||||
data: openArray[byte], phase0Prefix, topic: string): seq[byte] =
|
data: openArray[byte], phase0Prefix, topic: string): seq[byte] =
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#topics-and-messages
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#topics-and-messages
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/altair/p2p-interface.md#topics-and-messages
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/altair/p2p-interface.md#topics-and-messages
|
||||||
const MESSAGE_DOMAIN_VALID_SNAPPY = [0x01'u8, 0x00, 0x00, 0x00]
|
const MESSAGE_DOMAIN_VALID_SNAPPY = [0x01'u8, 0x00, 0x00, 0x00]
|
||||||
let messageDigest = withEth2Hash:
|
let messageDigest = withEth2Hash:
|
||||||
h.update(MESSAGE_DOMAIN_VALID_SNAPPY)
|
h.update(MESSAGE_DOMAIN_VALID_SNAPPY)
|
||||||
|
|
|
@ -188,7 +188,7 @@ func epoch*(slot: Slot): Epoch = # aka compute_epoch_at_slot
|
||||||
if slot == FAR_FUTURE_SLOT: FAR_FUTURE_EPOCH
|
if slot == FAR_FUTURE_SLOT: FAR_FUTURE_EPOCH
|
||||||
else: Epoch(slot div SLOTS_PER_EPOCH)
|
else: Epoch(slot div SLOTS_PER_EPOCH)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/fork-choice.md#compute_slots_since_epoch_start
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/fork-choice.md#compute_slots_since_epoch_start
|
||||||
func since_epoch_start*(slot: Slot): uint64 = # aka compute_slots_since_epoch_start
|
func since_epoch_start*(slot: Slot): uint64 = # aka compute_slots_since_epoch_start
|
||||||
## How many slots since the beginning of the epoch (`[0..SLOTS_PER_EPOCH-1]`)
|
## How many slots since the beginning of the epoch (`[0..SLOTS_PER_EPOCH-1]`)
|
||||||
(slot mod SLOTS_PER_EPOCH)
|
(slot mod SLOTS_PER_EPOCH)
|
||||||
|
|
|
@ -142,7 +142,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-alpha.3/specs/phase0/beacon-chain.md#slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/beacon-chain.md#slash_validator
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/altair/beacon-chain.md#modified-slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/altair/beacon-chain.md#modified-slash_validator
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/bellatrix/beacon-chain.md#modified-slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/bellatrix/beacon-chain.md#modified-slash_validator
|
||||||
func get_slashing_penalty*(state: ForkyBeaconState,
|
func get_slashing_penalty*(state: ForkyBeaconState,
|
||||||
|
@ -342,7 +342,7 @@ func is_eligible_for_activation_queue*(validator: Validator): bool =
|
||||||
validator.activation_eligibility_epoch == FAR_FUTURE_EPOCH and
|
validator.activation_eligibility_epoch == FAR_FUTURE_EPOCH and
|
||||||
validator.effective_balance == MAX_EFFECTIVE_BALANCE
|
validator.effective_balance == MAX_EFFECTIVE_BALANCE
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-alpha.3/specs/phase0/beacon-chain.md#is_eligible_for_activation
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/beacon-chain.md#is_eligible_for_activation
|
||||||
func is_eligible_for_activation*(
|
func is_eligible_for_activation*(
|
||||||
state: ForkyBeaconState, validator: Validator): bool =
|
state: ForkyBeaconState, validator: Validator): bool =
|
||||||
## Check if ``validator`` is eligible for activation.
|
## Check if ``validator`` is eligible for activation.
|
||||||
|
@ -1342,7 +1342,7 @@ func upgrade_to_capella*(cfg: RuntimeConfig, pre: bellatrix.BeaconState):
|
||||||
# historical_summaries initialized to correct default automatically
|
# historical_summaries initialized to correct default automatically
|
||||||
)
|
)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-alpha.1/specs/deneb/fork.md#upgrading-the-state
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/deneb/fork.md#upgrading-the-state
|
||||||
func upgrade_to_deneb*(cfg: RuntimeConfig, pre: capella.BeaconState):
|
func upgrade_to_deneb*(cfg: RuntimeConfig, pre: capella.BeaconState):
|
||||||
ref deneb.BeaconState =
|
ref deneb.BeaconState =
|
||||||
let
|
let
|
||||||
|
|
|
@ -102,7 +102,7 @@ type
|
||||||
pubkeys*: HashArray[Limit SYNC_COMMITTEE_SIZE, ValidatorPubKey]
|
pubkeys*: HashArray[Limit SYNC_COMMITTEE_SIZE, ValidatorPubKey]
|
||||||
aggregate_pubkey*: ValidatorPubKey
|
aggregate_pubkey*: ValidatorPubKey
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/altair/validator.md#synccommitteemessage
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/altair/validator.md#synccommitteemessage
|
||||||
SyncCommitteeMessage* = object
|
SyncCommitteeMessage* = object
|
||||||
slot*: Slot
|
slot*: Slot
|
||||||
## Slot to which this contribution pertains
|
## Slot to which this contribution pertains
|
||||||
|
@ -456,7 +456,7 @@ type
|
||||||
|
|
||||||
SyncnetBits* = BitArray[SYNC_COMMITTEE_SUBNET_COUNT]
|
SyncnetBits* = BitArray[SYNC_COMMITTEE_SUBNET_COUNT]
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/altair/p2p-interface.md#metadata
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/altair/p2p-interface.md#metadata
|
||||||
MetaData* = object
|
MetaData* = object
|
||||||
seq_number*: uint64
|
seq_number*: uint64
|
||||||
attnets*: AttnetBits
|
attnets*: AttnetBits
|
||||||
|
|
|
@ -16,7 +16,7 @@ type
|
||||||
DomainType* = distinct array[4, byte]
|
DomainType* = distinct array[4, byte]
|
||||||
|
|
||||||
const
|
const
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#constants
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/p2p-interface.md#constants
|
||||||
NODE_ID_BITS* = 256
|
NODE_ID_BITS* = 256
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#configuration
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#configuration
|
||||||
|
|
|
@ -47,13 +47,13 @@ type
|
||||||
# current spec doesn't ever SSZ-serialize it or hash_tree_root it
|
# current spec doesn't ever SSZ-serialize it or hash_tree_root it
|
||||||
VersionedHash* = array[32, byte]
|
VersionedHash* = array[32, byte]
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/deneb/beacon-chain.md#custom-types
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/deneb/beacon-chain.md#custom-types
|
||||||
BlobIndex* = uint64
|
BlobIndex* = uint64
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/deneb/polynomial-commitments.md#custom-types
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/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.3.0/specs/deneb/p2p-interface.md#blobsidecar
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/deneb/p2p-interface.md#blobsidecar
|
||||||
BlobSidecar* = object
|
BlobSidecar* = object
|
||||||
block_root*: Eth2Digest
|
block_root*: Eth2Digest
|
||||||
index*: BlobIndex
|
index*: BlobIndex
|
||||||
|
@ -110,7 +110,7 @@ type
|
||||||
proofs*:seq[KZGProof]
|
proofs*:seq[KZGProof]
|
||||||
blobs*: Blobs
|
blobs*: Blobs
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/deneb/beacon-chain.md#executionpayloadheader
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/deneb/beacon-chain.md#executionpayloadheader
|
||||||
ExecutionPayloadHeader* = object
|
ExecutionPayloadHeader* = object
|
||||||
# Execution block header fields
|
# Execution block header fields
|
||||||
parent_hash*: Eth2Digest
|
parent_hash*: Eth2Digest
|
||||||
|
|
|
@ -1385,7 +1385,7 @@ proc createWallet*(kdfKind: KdfKind,
|
||||||
crypto: crypto,
|
crypto: crypto,
|
||||||
nextAccount: nextAccount.get(0))
|
nextAccount: nextAccount.get(0))
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/validator.md#bls_withdrawal_prefix
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/validator.md#bls_withdrawal_prefix
|
||||||
func makeWithdrawalCredentials*(k: ValidatorPubKey): Eth2Digest =
|
func makeWithdrawalCredentials*(k: ValidatorPubKey): Eth2Digest =
|
||||||
var bytes = eth2digest(k.toRaw())
|
var bytes = eth2digest(k.toRaw())
|
||||||
bytes.data[0] = BLS_WITHDRAWAL_PREFIX.uint8
|
bytes.data[0] = BLS_WITHDRAWAL_PREFIX.uint8
|
||||||
|
|
|
@ -44,7 +44,7 @@ func compute_slot_signing_root*(
|
||||||
fork, DOMAIN_SELECTION_PROOF, epoch, genesis_validators_root)
|
fork, DOMAIN_SELECTION_PROOF, epoch, genesis_validators_root)
|
||||||
compute_signing_root(slot, domain)
|
compute_signing_root(slot, domain)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/validator.md#aggregation-selection
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/validator.md#aggregation-selection
|
||||||
func get_slot_signature*(
|
func get_slot_signature*(
|
||||||
fork: Fork, genesis_validators_root: Eth2Digest, slot: Slot,
|
fork: Fork, genesis_validators_root: Eth2Digest, slot: Slot,
|
||||||
privkey: ValidatorPrivKey): CookedSig =
|
privkey: ValidatorPrivKey): CookedSig =
|
||||||
|
@ -97,7 +97,7 @@ func compute_blob_signing_root(
|
||||||
genesis_validators_root)
|
genesis_validators_root)
|
||||||
compute_signing_root(blob, domain)
|
compute_signing_root(blob, domain)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/validator.md#signature
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/validator.md#signature
|
||||||
func get_block_signature*(
|
func get_block_signature*(
|
||||||
fork: Fork, genesis_validators_root: Eth2Digest, slot: Slot,
|
fork: Fork, genesis_validators_root: Eth2Digest, slot: Slot,
|
||||||
root: Eth2Digest, privkey: ValidatorPrivKey): CookedSig =
|
root: Eth2Digest, privkey: ValidatorPrivKey): CookedSig =
|
||||||
|
@ -106,7 +106,7 @@ func get_block_signature*(
|
||||||
|
|
||||||
blsSign(privkey, signing_root.data)
|
blsSign(privkey, signing_root.data)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-alpha.3/specs/deneb/validator.md#constructing-the-signedblobsidecars
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/deneb/validator.md#constructing-the-signedblobsidecars
|
||||||
proc get_blob_sidecar_signature*(
|
proc get_blob_sidecar_signature*(
|
||||||
fork: Fork, genesis_validators_root: Eth2Digest, slot: Slot,
|
fork: Fork, genesis_validators_root: Eth2Digest, slot: Slot,
|
||||||
blob: BlindedBlobSidecar | BlobSidecar, privkey: ValidatorPrivKey):
|
blob: BlindedBlobSidecar | BlobSidecar, privkey: ValidatorPrivKey):
|
||||||
|
@ -147,7 +147,7 @@ func compute_aggregate_and_proof_signing_root*(
|
||||||
fork, DOMAIN_AGGREGATE_AND_PROOF, epoch, genesis_validators_root)
|
fork, DOMAIN_AGGREGATE_AND_PROOF, epoch, genesis_validators_root)
|
||||||
compute_signing_root(aggregate_and_proof, domain)
|
compute_signing_root(aggregate_and_proof, domain)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/validator.md#broadcast-aggregate
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/validator.md#broadcast-aggregate
|
||||||
func get_aggregate_and_proof_signature*(fork: Fork, genesis_validators_root: Eth2Digest,
|
func get_aggregate_and_proof_signature*(fork: Fork, genesis_validators_root: Eth2Digest,
|
||||||
aggregate_and_proof: AggregateAndProof,
|
aggregate_and_proof: AggregateAndProof,
|
||||||
privkey: ValidatorPrivKey): CookedSig =
|
privkey: ValidatorPrivKey): CookedSig =
|
||||||
|
@ -175,7 +175,7 @@ func compute_attestation_signing_root*(
|
||||||
fork, DOMAIN_BEACON_ATTESTER, epoch, genesis_validators_root)
|
fork, DOMAIN_BEACON_ATTESTER, epoch, genesis_validators_root)
|
||||||
compute_signing_root(attestation_data, domain)
|
compute_signing_root(attestation_data, domain)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/validator.md#aggregate-signature
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/validator.md#aggregate-signature
|
||||||
func get_attestation_signature*(
|
func get_attestation_signature*(
|
||||||
fork: Fork, genesis_validators_root: Eth2Digest,
|
fork: Fork, genesis_validators_root: Eth2Digest,
|
||||||
attestation_data: AttestationData,
|
attestation_data: AttestationData,
|
||||||
|
@ -265,7 +265,7 @@ proc verify_voluntary_exit_signature*(
|
||||||
|
|
||||||
blsVerify(pubkey, signing_root.data, signature)
|
blsVerify(pubkey, signing_root.data, signature)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/altair/validator.md#prepare-sync-committee-message
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/altair/validator.md#prepare-sync-committee-message
|
||||||
func compute_sync_committee_message_signing_root*(
|
func compute_sync_committee_message_signing_root*(
|
||||||
fork: Fork, genesis_validators_root: Eth2Digest,
|
fork: Fork, genesis_validators_root: Eth2Digest,
|
||||||
slot: Slot, beacon_block_root: Eth2Digest): Eth2Digest =
|
slot: Slot, beacon_block_root: Eth2Digest): Eth2Digest =
|
||||||
|
|
|
@ -747,7 +747,7 @@ func tx_peek_blob_versioned_hashes(opaque_tx: Transaction):
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/deneb/beacon-chain.md#kzg_commitment_to_versioned_hash
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/deneb/beacon-chain.md#kzg_commitment_to_versioned_hash
|
||||||
func kzg_commitment_to_versioned_hash*(
|
func kzg_commitment_to_versioned_hash*(
|
||||||
kzg_commitment: KzgCommitment): VersionedHash =
|
kzg_commitment: KzgCommitment): VersionedHash =
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/deneb/beacon-chain.md#blob
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/deneb/beacon-chain.md#blob
|
||||||
const VERSIONED_HASH_VERSION_KZG = 0x01'u8
|
const VERSIONED_HASH_VERSION_KZG = 0x01'u8
|
||||||
|
|
||||||
var res: VersionedHash
|
var res: VersionedHash
|
||||||
|
|
|
@ -1152,7 +1152,7 @@ proc process_epoch*(
|
||||||
|
|
||||||
info.init(state)
|
info.init(state)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/altair/beacon-chain.md#justification-and-finalization
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/altair/beacon-chain.md#justification-and-finalization
|
||||||
# [Modified in Altair]
|
# [Modified in Altair]
|
||||||
process_justification_and_finalization(state, info.balances, flags)
|
process_justification_and_finalization(state, info.balances, flags)
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import
|
||||||
# - https://notes.ethereum.org/@djrtwo/Bkn3zpwxB#Validator-responsibilities
|
# - https://notes.ethereum.org/@djrtwo/Bkn3zpwxB#Validator-responsibilities
|
||||||
#
|
#
|
||||||
# Phase 0 spec - Honest Validator - how to avoid slashing
|
# Phase 0 spec - Honest Validator - how to avoid slashing
|
||||||
# - https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/validator.md#how-to-avoid-slashing
|
# - https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/validator.md#how-to-avoid-slashing
|
||||||
#
|
#
|
||||||
# In-depth reading on slashing conditions
|
# In-depth reading on slashing conditions
|
||||||
#
|
#
|
||||||
|
|
|
@ -640,7 +640,7 @@ proc getBlobSignature*(v: AttachedValidator, fork: Fork,
|
||||||
of ValidatorKind.Remote:
|
of ValidatorKind.Remote:
|
||||||
return SignatureResult.err("web3signer not supported for blobs")
|
return SignatureResult.err("web3signer not supported for blobs")
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/validator.md#aggregate-signature
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/validator.md#aggregate-signature
|
||||||
proc getAttestationSignature*(v: AttachedValidator, fork: Fork,
|
proc getAttestationSignature*(v: AttachedValidator, fork: Fork,
|
||||||
genesis_validators_root: Eth2Digest,
|
genesis_validators_root: Eth2Digest,
|
||||||
data: AttestationData
|
data: AttestationData
|
||||||
|
|
|
@ -52,7 +52,7 @@ These GossipSub topics are used to listen for attestations:
|
||||||
|
|
||||||
The attestations are then validated by `validateAttestation()` or `validateAggregate()` in either `attestationValidator()` or `aggregateValidator()` according to the P2P specs.
|
The attestations are then validated by `validateAttestation()` or `validateAggregate()` in either `attestationValidator()` or `aggregateValidator()` according to the P2P specs.
|
||||||
- https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/p2p-interface.md#beacon_aggregate_and_proof
|
- https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/p2p-interface.md#beacon_aggregate_and_proof
|
||||||
- https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#attestation-subnets
|
- https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/p2p-interface.md#attestation-subnets
|
||||||
|
|
||||||
Finally, valid attestations are added to the local `attestationPool`.
|
Finally, valid attestations are added to the local `attestationPool`.
|
||||||
Attestations are dropped in case of an error.
|
Attestations are dropped in case of an error.
|
||||||
|
|
|
@ -75,7 +75,7 @@ type
|
||||||
rewards*: List[uint64, Limit VALIDATOR_REGISTRY_LIMIT]
|
rewards*: List[uint64, Limit VALIDATOR_REGISTRY_LIMIT]
|
||||||
penalties*: List[uint64, Limit VALIDATOR_REGISTRY_LIMIT]
|
penalties*: List[uint64, Limit VALIDATOR_REGISTRY_LIMIT]
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/validator.md#eth1block
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/validator.md#eth1block
|
||||||
Eth1Block* = object
|
Eth1Block* = object
|
||||||
timestamp*: uint64
|
timestamp*: uint64
|
||||||
deposit_root*: Eth2Digest
|
deposit_root*: Eth2Digest
|
||||||
|
|
Loading…
Reference in New Issue