some consensus spec v1.4.0-beta.7 spec URL updates (#5945)
This commit is contained in:
parent
3863373575
commit
0f155ebf95
|
@ -4,10 +4,10 @@ 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.4.0-beta.5/specs/phase0/p2p-interface.md#beacon_block
|
- blocks: https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/p2p-interface.md#beacon_block
|
||||||
- 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-beta.5/specs/phase0/p2p-interface.md#voluntary_exit
|
- voluntary exits: https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/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-beta.5/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
|
||||||
|
|
||||||
|
|
|
@ -2493,7 +2493,7 @@ proc subscribeAttestationSubnets*(
|
||||||
|
|
||||||
proc unsubscribeAttestationSubnets*(
|
proc unsubscribeAttestationSubnets*(
|
||||||
node: Eth2Node, subnets: AttnetBits, forkDigest: ForkDigest) =
|
node: Eth2Node, subnets: AttnetBits, forkDigest: ForkDigest) =
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/phase0/p2p-interface.md#attestations-and-aggregation
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/p2p-interface.md#attestations-and-aggregation
|
||||||
# Nimbus won't score attestation subnets for now; we just rely on block and
|
# Nimbus won't score attestation subnets for now; we just rely on block and
|
||||||
# aggregate which are more stable and reliable
|
# aggregate which are more stable and reliable
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ const
|
||||||
GENESIS_SLOT* = Slot(0)
|
GENESIS_SLOT* = Slot(0)
|
||||||
GENESIS_EPOCH* = Epoch(0) # compute_epoch_at_slot(GENESIS_SLOT)
|
GENESIS_EPOCH* = Epoch(0) # compute_epoch_at_slot(GENESIS_SLOT)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/phase0/fork-choice.md#constant
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/fork-choice.md#constant
|
||||||
INTERVALS_PER_SLOT* = 3
|
INTERVALS_PER_SLOT* = 3
|
||||||
|
|
||||||
FAR_FUTURE_BEACON_TIME* = BeaconTime(ns_since_genesis: int64.high())
|
FAR_FUTURE_BEACON_TIME* = BeaconTime(ns_since_genesis: int64.high())
|
||||||
|
@ -145,10 +145,10 @@ const
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/altair/validator.md#broadcast-sync-committee-contribution
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/altair/validator.md#broadcast-sync-committee-contribution
|
||||||
syncContributionSlotOffset* = TimeDiff(nanoseconds:
|
syncContributionSlotOffset* = TimeDiff(nanoseconds:
|
||||||
NANOSECONDS_PER_SLOT.int64 * 2 div INTERVALS_PER_SLOT)
|
NANOSECONDS_PER_SLOT.int64 * 2 div INTERVALS_PER_SLOT)
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/altair/light-client/p2p-interface.md#sync-committee
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/altair/light-client/p2p-interface.md#sync-committee
|
||||||
lightClientFinalityUpdateSlotOffset* = TimeDiff(nanoseconds:
|
lightClientFinalityUpdateSlotOffset* = TimeDiff(nanoseconds:
|
||||||
NANOSECONDS_PER_SLOT.int64 div INTERVALS_PER_SLOT)
|
NANOSECONDS_PER_SLOT.int64 div INTERVALS_PER_SLOT)
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/altair/light-client/p2p-interface.md#sync-committee
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/altair/light-client/p2p-interface.md#sync-committee
|
||||||
lightClientOptimisticUpdateSlotOffset* = TimeDiff(nanoseconds:
|
lightClientOptimisticUpdateSlotOffset* = TimeDiff(nanoseconds:
|
||||||
NANOSECONDS_PER_SLOT.int64 div INTERVALS_PER_SLOT)
|
NANOSECONDS_PER_SLOT.int64 div INTERVALS_PER_SLOT)
|
||||||
|
|
||||||
|
@ -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.5/specs/phase0/fork-choice.md#compute_slots_since_epoch_start
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/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)
|
||||||
|
@ -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.6/specs/phase0/beacon-chain.md#compute_start_slot_at_epoch
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/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)
|
||||||
|
|
|
@ -66,13 +66,13 @@ func get_validator_from_deposit*(deposit: DepositData):
|
||||||
effective_balance: effective_balance
|
effective_balance: effective_balance
|
||||||
)
|
)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#compute_activation_exit_epoch
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/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.
|
||||||
epoch + 1 + MAX_SEED_LOOKAHEAD
|
epoch + 1 + MAX_SEED_LOOKAHEAD
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#get_validator_churn_limit
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#get_validator_churn_limit
|
||||||
func get_validator_churn_limit*(
|
func get_validator_churn_limit*(
|
||||||
cfg: RuntimeConfig, state: ForkyBeaconState, cache: var StateCache):
|
cfg: RuntimeConfig, state: ForkyBeaconState, cache: var StateCache):
|
||||||
uint64 =
|
uint64 =
|
||||||
|
@ -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-beta.6/specs/phase0/beacon-chain.md#slash_validator
|
# 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-beta.7/specs/altair/beacon-chain.md#modified-slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/altair/beacon-chain.md#modified-slash_validator
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/bellatrix/beacon-chain.md#modified-slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/bellatrix/beacon-chain.md#modified-slash_validator
|
||||||
func get_slashing_penalty*(state: ForkyBeaconState,
|
func get_slashing_penalty*(state: ForkyBeaconState,
|
||||||
|
@ -159,13 +159,13 @@ func get_slashing_penalty*(state: ForkyBeaconState,
|
||||||
else:
|
else:
|
||||||
{.fatal: "invalid BeaconState type".}
|
{.fatal: "invalid BeaconState type".}
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#slash_validator
|
# 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-beta.7/specs/altair/beacon-chain.md#modified-slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/altair/beacon-chain.md#modified-slash_validator
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/bellatrix/beacon-chain.md#modified-slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/bellatrix/beacon-chain.md#modified-slash_validator
|
||||||
func get_whistleblower_reward*(validator_effective_balance: Gwei): Gwei =
|
func get_whistleblower_reward*(validator_effective_balance: Gwei): Gwei =
|
||||||
validator_effective_balance div WHISTLEBLOWER_REWARD_QUOTIENT
|
validator_effective_balance div WHISTLEBLOWER_REWARD_QUOTIENT
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#slash_validator
|
# 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-beta.7/specs/altair/beacon-chain.md#modified-slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/altair/beacon-chain.md#modified-slash_validator
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/bellatrix/beacon-chain.md#modified-slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/bellatrix/beacon-chain.md#modified-slash_validator
|
||||||
func get_proposer_reward(state: ForkyBeaconState, whistleblower_reward: Gwei): Gwei =
|
func get_proposer_reward(state: ForkyBeaconState, whistleblower_reward: Gwei): Gwei =
|
||||||
|
@ -177,7 +177,7 @@ func get_proposer_reward(state: ForkyBeaconState, whistleblower_reward: Gwei): G
|
||||||
else:
|
else:
|
||||||
{.fatal: "invalid BeaconState type".}
|
{.fatal: "invalid BeaconState type".}
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#slash_validator
|
# 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-beta.7/specs/altair/beacon-chain.md#modified-slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/altair/beacon-chain.md#modified-slash_validator
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/bellatrix/beacon-chain.md#modified-slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/bellatrix/beacon-chain.md#modified-slash_validator
|
||||||
proc slash_validator*(
|
proc slash_validator*(
|
||||||
|
|
|
@ -205,7 +205,7 @@ type
|
||||||
signed_header_1*: TrustedSignedBeaconBlockHeader
|
signed_header_1*: TrustedSignedBeaconBlockHeader
|
||||||
signed_header_2*: TrustedSignedBeaconBlockHeader
|
signed_header_2*: TrustedSignedBeaconBlockHeader
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#attesterslashing
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#attesterslashing
|
||||||
AttesterSlashing* = object
|
AttesterSlashing* = object
|
||||||
attestation_1*: IndexedAttestation
|
attestation_1*: IndexedAttestation
|
||||||
attestation_2*: IndexedAttestation
|
attestation_2*: IndexedAttestation
|
||||||
|
@ -285,7 +285,7 @@ type
|
||||||
withdrawal_credentials*: Eth2Digest
|
withdrawal_credentials*: Eth2Digest
|
||||||
amount*: Gwei
|
amount*: Gwei
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#depositdata
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#depositdata
|
||||||
DepositData* = object
|
DepositData* = object
|
||||||
pubkey*: ValidatorPubKey
|
pubkey*: ValidatorPubKey
|
||||||
withdrawal_credentials*: Eth2Digest
|
withdrawal_credentials*: Eth2Digest
|
||||||
|
@ -404,7 +404,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.6/specs/phase0/beacon-chain.md#signedbeaconblockheader
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#signedbeaconblockheader
|
||||||
SignedBeaconBlockHeader* = object
|
SignedBeaconBlockHeader* = object
|
||||||
message*: BeaconBlockHeader
|
message*: BeaconBlockHeader
|
||||||
signature*: ValidatorSig
|
signature*: ValidatorSig
|
||||||
|
@ -442,7 +442,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.4.0-beta.6/specs/phase0/beacon-chain.md#validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/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
|
||||||
|
|
|
@ -307,7 +307,7 @@ type
|
||||||
# Execution
|
# Execution
|
||||||
execution_payload*: ExecutionPayload # [New in Bellatrix]
|
execution_payload*: ExecutionPayload # [New in Bellatrix]
|
||||||
|
|
||||||
# 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-beta.7/specs/phase0/beacon-chain.md#signedbeaconblock
|
||||||
SignedBeaconBlock* = object
|
SignedBeaconBlock* = object
|
||||||
message*: BeaconBlock
|
message*: BeaconBlock
|
||||||
signature*: ValidatorSig
|
signature*: ValidatorSig
|
||||||
|
|
|
@ -23,7 +23,7 @@ const
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/phase0/p2p-interface.md#constants
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/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.5/specs/phase0/p2p-interface.md#configuration
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/p2p-interface.md#configuration
|
||||||
EPOCHS_PER_SUBNET_SUBSCRIPTION* = 256'u64
|
EPOCHS_PER_SUBNET_SUBSCRIPTION* = 256'u64
|
||||||
SUBNETS_PER_NODE* = 2'u64
|
SUBNETS_PER_NODE* = 2'u64
|
||||||
ATTESTATION_SUBNET_COUNT*: uint64 = 64
|
ATTESTATION_SUBNET_COUNT*: uint64 = 64
|
||||||
|
@ -40,7 +40,7 @@ const
|
||||||
FAR_FUTURE_EPOCH* = Epoch(not 0'u64)
|
FAR_FUTURE_EPOCH* = Epoch(not 0'u64)
|
||||||
FAR_FUTURE_PERIOD* = SyncCommitteePeriod(not 0'u64)
|
FAR_FUTURE_PERIOD* = SyncCommitteePeriod(not 0'u64)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#domain-types
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#domain-types
|
||||||
DOMAIN_BEACON_PROPOSER* = DomainType([byte 0x00, 0x00, 0x00, 0x00])
|
DOMAIN_BEACON_PROPOSER* = DomainType([byte 0x00, 0x00, 0x00, 0x00])
|
||||||
DOMAIN_BEACON_ATTESTER* = DomainType([byte 0x01, 0x00, 0x00, 0x00])
|
DOMAIN_BEACON_ATTESTER* = DomainType([byte 0x01, 0x00, 0x00, 0x00])
|
||||||
DOMAIN_RANDAO* = DomainType([byte 0x02, 0x00, 0x00, 0x00])
|
DOMAIN_RANDAO* = DomainType([byte 0x02, 0x00, 0x00, 0x00])
|
||||||
|
@ -64,7 +64,7 @@ const
|
||||||
REORG_PARENT_WEIGHT_THRESHOLD*: uint64 = 160
|
REORG_PARENT_WEIGHT_THRESHOLD*: uint64 = 160
|
||||||
REORG_MAX_EPOCHS_SINCE_FINALIZATION* = Epoch(2)
|
REORG_MAX_EPOCHS_SINCE_FINALIZATION* = Epoch(2)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/deneb/p2p-interface.md#configuration
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/deneb/p2p-interface.md#configuration
|
||||||
BLOB_SIDECAR_SUBNET_COUNT*: uint64 = 6
|
BLOB_SIDECAR_SUBNET_COUNT*: uint64 = 6
|
||||||
|
|
||||||
# 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
|
||||||
|
|
|
@ -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.5/specs/deneb/p2p-interface.md#blobsidecar
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/deneb/p2p-interface.md#blobsidecar
|
||||||
BlobSidecar* = object
|
BlobSidecar* = object
|
||||||
index*: BlobIndex
|
index*: BlobIndex
|
||||||
## Index of blob in block
|
## Index of blob in block
|
||||||
|
|
|
@ -65,7 +65,7 @@ func integer_squareroot*(n: SomeInteger): SomeInteger =
|
||||||
y = (x + n div x) div 2
|
y = (x + n div x) div 2
|
||||||
x
|
x
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#is_active_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#is_active_validator
|
||||||
func is_active_validator*(validator: Validator, epoch: Epoch): bool =
|
func is_active_validator*(validator: Validator, epoch: Epoch): bool =
|
||||||
## Check if ``validator`` is active.
|
## Check if ``validator`` is active.
|
||||||
validator.activation_epoch <= epoch and epoch < validator.exit_epoch
|
validator.activation_epoch <= epoch and epoch < validator.exit_epoch
|
||||||
|
@ -141,7 +141,7 @@ func uint_to_bytes*(x: uint32): array[4, byte] = toBytesLE(x)
|
||||||
func uint_to_bytes*(x: uint16): array[2, byte] = toBytesLE(x)
|
func uint_to_bytes*(x: uint16): array[2, byte] = toBytesLE(x)
|
||||||
func uint_to_bytes*(x: uint8): array[1, byte] = toBytesLE(x)
|
func uint_to_bytes*(x: uint8): array[1, byte] = toBytesLE(x)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#compute_domain
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#compute_domain
|
||||||
func compute_domain*(
|
func compute_domain*(
|
||||||
domain_type: DomainType,
|
domain_type: DomainType,
|
||||||
fork_version: Version,
|
fork_version: Version,
|
||||||
|
@ -185,7 +185,7 @@ func compute_signing_root*(ssz_object: auto, domain: Eth2Domain): Eth2Digest =
|
||||||
)
|
)
|
||||||
hash_tree_root(domain_wrapped_object)
|
hash_tree_root(domain_wrapped_object)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#get_seed
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#get_seed
|
||||||
func get_seed*(
|
func get_seed*(
|
||||||
state: ForkyBeaconState, epoch: Epoch, domain_type: DomainType,
|
state: ForkyBeaconState, epoch: Epoch, domain_type: DomainType,
|
||||||
mix: Eth2Digest): Eth2Digest =
|
mix: Eth2Digest): Eth2Digest =
|
||||||
|
|
|
@ -395,7 +395,7 @@ proc collectSignatureSets*(
|
||||||
|
|
||||||
sigs.add voluntary_exit_signature_set(
|
sigs.add voluntary_exit_signature_set(
|
||||||
# https://eips.ethereum.org/EIPS/eip-7044
|
# https://eips.ethereum.org/EIPS/eip-7044
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/deneb/beacon-chain.md#modified-process_voluntary_exit
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/deneb/beacon-chain.md#modified-process_voluntary_exit
|
||||||
(if state.kind >= ConsensusFork.Capella:
|
(if state.kind >= ConsensusFork.Capella:
|
||||||
capella_fork
|
capella_fork
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
{.push raises: [].}
|
{.push raises: [].}
|
||||||
|
|
||||||
# State transition, as described in
|
# State transition, as described in
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#beacon-chain-state-transition-function
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#beacon-chain-state-transition-function
|
||||||
#
|
#
|
||||||
# The entry point is `state_transition` which is at the bottom of the file!
|
# The entry point is `state_transition` which is at the bottom of the file!
|
||||||
#
|
#
|
||||||
|
@ -460,7 +460,7 @@ proc makeBeaconBlock*(
|
||||||
transactions_root.get
|
transactions_root.get
|
||||||
|
|
||||||
when executionPayload is deneb.ExecutionPayloadForSigning:
|
when executionPayload is deneb.ExecutionPayloadForSigning:
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/deneb/beacon-chain.md#beaconblockbody
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/deneb/beacon-chain.md#beaconblockbody
|
||||||
forkyState.data.latest_block_header.body_root = hash_tree_root(
|
forkyState.data.latest_block_header.body_root = hash_tree_root(
|
||||||
[hash_tree_root(randao_reveal),
|
[hash_tree_root(randao_reveal),
|
||||||
hash_tree_root(eth1_data),
|
hash_tree_root(eth1_data),
|
||||||
|
|
|
@ -8,10 +8,10 @@
|
||||||
{.push raises: [].}
|
{.push raises: [].}
|
||||||
|
|
||||||
# State transition - block processing, as described in
|
# State transition - block processing, as described in
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#block-processing
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#block-processing
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/altair/beacon-chain.md#block-processing
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/altair/beacon-chain.md#block-processing
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/bellatrix/beacon-chain.md#block-processing
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/bellatrix/beacon-chain.md#block-processing
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/capella/beacon-chain.md#block-processing
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/capella/beacon-chain.md#block-processing
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/deneb/beacon-chain.md#block-processing
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/deneb/beacon-chain.md#block-processing
|
||||||
#
|
#
|
||||||
# The entry point is `process_block` which is at the bottom of this file.
|
# The entry point is `process_block` which is at the bottom of this file.
|
||||||
|
@ -402,7 +402,7 @@ proc check_voluntary_exit*(
|
||||||
withState(state):
|
withState(state):
|
||||||
check_voluntary_exit(cfg, forkyState.data, signed_voluntary_exit, flags)
|
check_voluntary_exit(cfg, forkyState.data, signed_voluntary_exit, flags)
|
||||||
|
|
||||||
# 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-beta.7/specs/phase0/beacon-chain.md#voluntary-exits
|
||||||
proc process_voluntary_exit*(
|
proc process_voluntary_exit*(
|
||||||
cfg: RuntimeConfig,
|
cfg: RuntimeConfig,
|
||||||
state: var ForkyBeaconState,
|
state: var ForkyBeaconState,
|
||||||
|
@ -687,7 +687,7 @@ proc process_execution_payload*(
|
||||||
|
|
||||||
ok()
|
ok()
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/capella/beacon-chain.md#new-process_withdrawals
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/capella/beacon-chain.md#new-process_withdrawals
|
||||||
func process_withdrawals*(
|
func process_withdrawals*(
|
||||||
state: var (capella.BeaconState | deneb.BeaconState),
|
state: var (capella.BeaconState | deneb.BeaconState),
|
||||||
payload: capella.ExecutionPayload | deneb.ExecutionPayload):
|
payload: capella.ExecutionPayload | deneb.ExecutionPayload):
|
||||||
|
|
|
@ -901,7 +901,7 @@ func process_registry_updates*(
|
||||||
|
|
||||||
ok()
|
ok()
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#slashings
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#slashings
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/altair/beacon-chain.md#slashings
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/altair/beacon-chain.md#slashings
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/bellatrix/beacon-chain.md#slashings
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/bellatrix/beacon-chain.md#slashings
|
||||||
func get_adjusted_total_slashing_balance*(
|
func get_adjusted_total_slashing_balance*(
|
||||||
|
@ -920,14 +920,14 @@ func get_adjusted_total_slashing_balance*(
|
||||||
{.fatal: "process_slashings: incorrect BeaconState type".}
|
{.fatal: "process_slashings: incorrect BeaconState type".}
|
||||||
min(sum(state.slashings.data) * multiplier, total_balance)
|
min(sum(state.slashings.data) * multiplier, total_balance)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#slashings
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#slashings
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/altair/beacon-chain.md#slashings
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/altair/beacon-chain.md#slashings
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/bellatrix/beacon-chain.md#slashings
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/bellatrix/beacon-chain.md#slashings
|
||||||
func slashing_penalty_applies*(validator: Validator, epoch: Epoch): bool =
|
func slashing_penalty_applies*(validator: Validator, epoch: Epoch): bool =
|
||||||
validator.slashed and
|
validator.slashed and
|
||||||
epoch + EPOCHS_PER_SLASHINGS_VECTOR div 2 == validator.withdrawable_epoch
|
epoch + EPOCHS_PER_SLASHINGS_VECTOR div 2 == validator.withdrawable_epoch
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#slashings
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#slashings
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/altair/beacon-chain.md#slashings
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/altair/beacon-chain.md#slashings
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/bellatrix/beacon-chain.md#slashings
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/bellatrix/beacon-chain.md#slashings
|
||||||
func get_slashing_penalty*(validator: Validator,
|
func get_slashing_penalty*(validator: Validator,
|
||||||
|
@ -939,7 +939,7 @@ func get_slashing_penalty*(validator: Validator,
|
||||||
adjusted_total_slashing_balance
|
adjusted_total_slashing_balance
|
||||||
penalty_numerator div total_balance * increment
|
penalty_numerator div total_balance * increment
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#slashings
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#slashings
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/altair/beacon-chain.md#slashings
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/altair/beacon-chain.md#slashings
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/bellatrix/beacon-chain.md#slashings
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/bellatrix/beacon-chain.md#slashings
|
||||||
func process_slashings*(state: var ForkyBeaconState, total_balance: Gwei) =
|
func process_slashings*(state: var ForkyBeaconState, total_balance: Gwei) =
|
||||||
|
@ -963,7 +963,7 @@ func process_eth1_data_reset*(state: var ForkyBeaconState) =
|
||||||
if next_epoch mod EPOCHS_PER_ETH1_VOTING_PERIOD == 0:
|
if next_epoch mod EPOCHS_PER_ETH1_VOTING_PERIOD == 0:
|
||||||
state.eth1_data_votes = default(type state.eth1_data_votes)
|
state.eth1_data_votes = default(type state.eth1_data_votes)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#effective-balances-updates
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#effective-balances-updates
|
||||||
template effective_balance_might_update*(
|
template effective_balance_might_update*(
|
||||||
balance: Gwei, effective_balance: Gwei): bool =
|
balance: Gwei, effective_balance: Gwei): bool =
|
||||||
const
|
const
|
||||||
|
@ -973,7 +973,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.6/specs/phase0/beacon-chain.md#effective-balances-updates
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/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:
|
||||||
|
|
|
@ -156,13 +156,13 @@ func get_shuffled_active_validator_indices*(
|
||||||
withState(state):
|
withState(state):
|
||||||
cache.get_shuffled_active_validator_indices(forkyState.data, epoch)
|
cache.get_shuffled_active_validator_indices(forkyState.data, epoch)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#get_active_validator_indices
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#get_active_validator_indices
|
||||||
func count_active_validators*(state: ForkyBeaconState,
|
func count_active_validators*(state: ForkyBeaconState,
|
||||||
epoch: Epoch,
|
epoch: Epoch,
|
||||||
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.6/specs/phase0/beacon-chain.md#get_committee_count_per_slot
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/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,
|
||||||
|
|
|
@ -188,7 +188,7 @@ NTC 2022-11-21 18:04:03.982+01:00 New LC optimistic block opt
|
||||||
```
|
```
|
||||||
|
|
||||||
!!! note
|
!!! note
|
||||||
The [light client protocol](https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/altair/light-client/sync-protocol.md) depends on consensus layer (CL) full nodes to serve additional data.
|
The [light client protocol](https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/altair/light-client/sync-protocol.md) depends on consensus layer (CL) full nodes to serve additional data.
|
||||||
As this is a new protocol, not all implementations are supporting it yet.
|
As this is a new protocol, not all implementations are supporting it yet.
|
||||||
Therefore, it may take several minutes to discover supporting peers, during which no log messages may be produced.
|
Therefore, it may take several minutes to discover supporting peers, during which no log messages may be produced.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue