update some consensus spec URLs to v1.4.0-beta.4 (#5631)
This commit is contained in:
parent
b92a0d631d
commit
ab5343d1bc
|
@ -557,7 +557,7 @@ proc getAttestationsForBlock*(pool: var AttestationPool,
|
||||||
cache: var StateCache): seq[Attestation] =
|
cache: var StateCache): seq[Attestation] =
|
||||||
## Retrieve attestations that may be added to a new block at the slot of the
|
## Retrieve attestations that may be added to a new block at the slot of the
|
||||||
## given state
|
## given state
|
||||||
## https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/validator.md#attestations
|
## https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/validator.md#attestations
|
||||||
let newBlockSlot = state.data.slot.uint64
|
let newBlockSlot = state.data.slot.uint64
|
||||||
|
|
||||||
if newBlockSlot < MIN_ATTESTATION_INCLUSION_DELAY:
|
if newBlockSlot < MIN_ATTESTATION_INCLUSION_DELAY:
|
||||||
|
|
|
@ -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.3/specs/phase0/fork-choice.md#get_ancestor
|
## https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/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
|
||||||
|
|
|
@ -198,7 +198,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.3/specs/phase0/validator.md#validator-assignments
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/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,
|
||||||
|
|
|
@ -153,7 +153,7 @@ typedef struct ETHBeaconState ETHBeaconState;
|
||||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/altair/beacon-chain.md#beaconstate
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/altair/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.3/specs/bellatrix/beacon-chain.md#beaconstate
|
||||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/capella/beacon-chain.md#beaconstate
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/capella/beacon-chain.md#beaconstate
|
||||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/configs/README.md
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/configs/README.md
|
||||||
*/
|
*/
|
||||||
ETH_RESULT_USE_CHECK
|
ETH_RESULT_USE_CHECK
|
||||||
ETHBeaconState *ETHBeaconStateCreateFromSsz(
|
ETHBeaconState *ETHBeaconStateCreateFromSsz(
|
||||||
|
@ -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.2/specs/phase0/beacon-chain.md#custom-types
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/beacon-chain.md#custom-types
|
||||||
*/
|
*/
|
||||||
void ETHRootDestroy(ETHRoot *root);
|
void ETHRootDestroy(ETHRoot *root);
|
||||||
|
|
||||||
|
@ -322,7 +322,7 @@ typedef struct ETHLightClientStore ETHLightClientStore;
|
||||||
*
|
*
|
||||||
* @see https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.4.1#/Beacon/getLightClientBootstrap
|
* @see https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.4.1#/Beacon/getLightClientBootstrap
|
||||||
* @see https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.4.1#/Events/eventstream
|
* @see https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.4.1#/Events/eventstream
|
||||||
* @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.4/specs/altair/light-client/light-client.md
|
||||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.0/specs/phase0/weak-subjectivity.md#weak-subjectivity-period
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.0/specs/phase0/weak-subjectivity.md#weak-subjectivity-period
|
||||||
*/
|
*/
|
||||||
ETH_RESULT_USE_CHECK
|
ETH_RESULT_USE_CHECK
|
||||||
|
@ -594,7 +594,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.4/specs/altair/light-client/sync-protocol.md#is_next_sync_committee_known
|
||||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/altair/light-client/light-client.md
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/altair/light-client/light-client.md
|
||||||
*/
|
*/
|
||||||
ETH_RESULT_USE_CHECK
|
ETH_RESULT_USE_CHECK
|
||||||
|
@ -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.3/specs/phase0/beacon-chain.md#hash_tree_root
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/beacon-chain.md#hash_tree_root
|
||||||
*/
|
*/
|
||||||
ETH_RESULT_USE_CHECK
|
ETH_RESULT_USE_CHECK
|
||||||
ETHRoot *ETHLightClientHeaderCopyBeaconRoot(
|
ETHRoot *ETHLightClientHeaderCopyBeaconRoot(
|
||||||
|
|
|
@ -947,7 +947,7 @@ proc ETHLightClientHeaderCopyExecutionHash(
|
||||||
## * Pointer to a copy of the given header's execution block hash.
|
## * Pointer to a copy of the given header's execution block hash.
|
||||||
##
|
##
|
||||||
## See:
|
## See:
|
||||||
## * 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.4/specs/deneb/beacon-chain.md#executionpayloadheader
|
||||||
discard cfg # Future-proof against SSZ execution block header, EIP-6404ff.
|
discard cfg # Future-proof against SSZ execution block header, EIP-6404ff.
|
||||||
let root = Eth2Digest.new()
|
let root = Eth2Digest.new()
|
||||||
root[] = header[].execution.block_hash
|
root[] = header[].execution.block_hash
|
||||||
|
@ -972,7 +972,7 @@ func ETHLightClientHeaderGetExecution(
|
||||||
## * Execution payload header.
|
## * Execution payload header.
|
||||||
##
|
##
|
||||||
## See:
|
## See:
|
||||||
## * 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.4/specs/deneb/beacon-chain.md#executionpayloadheader
|
||||||
addr header[].execution
|
addr header[].execution
|
||||||
|
|
||||||
func ETHExecutionPayloadHeaderGetParentHash(
|
func ETHExecutionPayloadHeaderGetParentHash(
|
||||||
|
|
|
@ -2244,7 +2244,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.4/specs/phase0/p2p-interface.md#topics-and-messages
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/altair/p2p-interface.md#topics-and-messages
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/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:
|
||||||
|
@ -2524,7 +2524,7 @@ proc broadcast(node: Eth2Node, topic: string, msg: auto):
|
||||||
|
|
||||||
proc subscribeAttestationSubnets*(
|
proc subscribeAttestationSubnets*(
|
||||||
node: Eth2Node, subnets: AttnetBits, forkDigest: ForkDigest) =
|
node: Eth2Node, subnets: AttnetBits, forkDigest: ForkDigest) =
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/p2p-interface.md#attestations-and-aggregation
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/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
|
||||||
|
|
||||||
|
|
|
@ -1650,7 +1650,7 @@ proc installMessageValidators(node: BeaconNode) =
|
||||||
MsgSource.gossip, signedBlock)))
|
MsgSource.gossip, signedBlock)))
|
||||||
|
|
||||||
# beacon_attestation_{subnet_id}
|
# beacon_attestation_{subnet_id}
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#beacon_attestation_subnet_id
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/p2p-interface.md#beacon_attestation_subnet_id
|
||||||
for it in SubnetId:
|
for it in SubnetId:
|
||||||
closureScope: # Needed for inner `proc`; don't lift it out of loop.
|
closureScope: # Needed for inner `proc`; don't lift it out of loop.
|
||||||
let subnet_id = it
|
let subnet_id = it
|
||||||
|
|
|
@ -182,7 +182,7 @@ func slotOrZero*(time: BeaconTime): Slot =
|
||||||
if exSlot.afterGenesis: exSlot.slot
|
if exSlot.afterGenesis: exSlot.slot
|
||||||
else: Slot(0)
|
else: Slot(0)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-alpha.3/specs/phase0/beacon-chain.md#compute_epoch_at_slot
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/beacon-chain.md#compute_epoch_at_slot
|
||||||
func epoch*(slot: Slot): Epoch = # aka compute_epoch_at_slot
|
func epoch*(slot: Slot): Epoch = # aka compute_epoch_at_slot
|
||||||
## Return the epoch number at ``slot``.
|
## Return the epoch number at ``slot``.
|
||||||
if slot == FAR_FUTURE_SLOT: FAR_FUTURE_EPOCH
|
if slot == FAR_FUTURE_SLOT: FAR_FUTURE_EPOCH
|
||||||
|
|
|
@ -51,7 +51,7 @@ const
|
||||||
PARTICIPATION_FLAG_WEIGHTS*: array[TimelyFlag, uint64] =
|
PARTICIPATION_FLAG_WEIGHTS*: array[TimelyFlag, uint64] =
|
||||||
[uint64 TIMELY_SOURCE_WEIGHT, TIMELY_TARGET_WEIGHT, TIMELY_HEAD_WEIGHT]
|
[uint64 TIMELY_SOURCE_WEIGHT, TIMELY_TARGET_WEIGHT, TIMELY_HEAD_WEIGHT]
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/altair/validator.md#misc
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/altair/validator.md#misc
|
||||||
TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE* = 16
|
TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE* = 16
|
||||||
SYNC_COMMITTEE_SUBNET_COUNT* = 4
|
SYNC_COMMITTEE_SUBNET_COUNT* = 4
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ type
|
||||||
message*: ContributionAndProof
|
message*: ContributionAndProof
|
||||||
signature*: ValidatorSig
|
signature*: ValidatorSig
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/altair/validator.md#syncaggregatorselectiondata
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/altair/validator.md#syncaggregatorselectiondata
|
||||||
SyncAggregatorSelectionData* = object
|
SyncAggregatorSelectionData* = object
|
||||||
slot*: Slot
|
slot*: Slot
|
||||||
subcommittee_index*: uint64 # `SyncSubcommitteeIndex` after validation
|
subcommittee_index*: uint64 # `SyncSubcommitteeIndex` after validation
|
||||||
|
|
|
@ -407,7 +407,7 @@ type
|
||||||
message*: BeaconBlockHeader
|
message*: BeaconBlockHeader
|
||||||
signature*: TrustedSig
|
signature*: TrustedSig
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/validator.md#aggregateandproof
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/validator.md#aggregateandproof
|
||||||
AggregateAndProof* = object
|
AggregateAndProof* = object
|
||||||
aggregator_index*: uint64 # `ValidatorIndex` after validation
|
aggregator_index*: uint64 # `ValidatorIndex` after validation
|
||||||
aggregate*: Attestation
|
aggregate*: Attestation
|
||||||
|
|
|
@ -441,7 +441,7 @@ type
|
||||||
# Capella operations
|
# Capella operations
|
||||||
bls_to_execution_changes*: SignedBLSToExecutionChangeList # [New in Capella]
|
bls_to_execution_changes*: SignedBLSToExecutionChangeList # [New in Capella]
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-alpha.3/specs/phase0/beacon-chain.md#signedbeaconblock
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/beacon-chain.md#signedbeaconblock
|
||||||
SignedBeaconBlock* = object
|
SignedBeaconBlock* = object
|
||||||
message*: BeaconBlock
|
message*: BeaconBlock
|
||||||
signature*: ValidatorSig
|
signature*: ValidatorSig
|
||||||
|
|
|
@ -62,7 +62,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.2/specs/deneb/p2p-interface.md#configuration
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/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
|
||||||
|
|
|
@ -44,7 +44,7 @@ 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.3/specs/deneb/beacon-chain.md#custom-types
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/deneb/beacon-chain.md#custom-types
|
||||||
BlobIndex* = uint64
|
BlobIndex* = uint64
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/deneb/polynomial-commitments.md#custom-types
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/deneb/polynomial-commitments.md#custom-types
|
||||||
|
|
|
@ -117,7 +117,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.3/specs/phase0/validator.md#broadcast-aggregate
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/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 =
|
||||||
|
|
|
@ -666,7 +666,7 @@ func get_active_increments*(
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/altair/beacon-chain.md#get_flag_index_deltas
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/altair/beacon-chain.md#get_flag_index_deltas
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/altair/beacon-chain.md#modified-get_inactivity_penalty_deltas
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/altair/beacon-chain.md#modified-get_inactivity_penalty_deltas
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/bellatrix/beacon-chain.md#modified-get_inactivity_penalty_deltas
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/bellatrix/beacon-chain.md#modified-get_inactivity_penalty_deltas
|
||||||
# Combines get_flag_index_deltas() and get_inactivity_penalty_deltas()
|
# Combines get_flag_index_deltas() and get_inactivity_penalty_deltas()
|
||||||
iterator get_flag_and_inactivity_deltas*(
|
iterator get_flag_and_inactivity_deltas*(
|
||||||
cfg: RuntimeConfig,
|
cfg: RuntimeConfig,
|
||||||
|
@ -893,7 +893,7 @@ 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-alpha.3/specs/phase0/beacon-chain.md#slashings
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/beacon-chain.md#slashings
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/altair/beacon-chain.md#slashings
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/altair/beacon-chain.md#slashings
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/bellatrix/beacon-chain.md#slashings
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/bellatrix/beacon-chain.md#slashings
|
||||||
func slashing_penalty_applies*(validator: Validator, epoch: Epoch): bool =
|
func slashing_penalty_applies*(validator: Validator, epoch: Epoch): bool =
|
||||||
|
@ -1000,7 +1000,7 @@ func process_historical_roots_update*(state: var ForkyBeaconState) =
|
||||||
if not state.historical_roots.add state.compute_historical_root():
|
if not state.historical_roots.add state.compute_historical_root():
|
||||||
raiseAssert "no more room for historical roots, so long and thanks for the fish!"
|
raiseAssert "no more room for historical roots, so long and thanks for the fish!"
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-alpha.3/specs/phase0/beacon-chain.md#participation-records-rotation
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/beacon-chain.md#participation-records-rotation
|
||||||
func process_participation_record_updates*(state: var phase0.BeaconState) =
|
func process_participation_record_updates*(state: var phase0.BeaconState) =
|
||||||
# Rotate current/previous epoch attestations - using swap avoids copying all
|
# Rotate current/previous epoch attestations - using swap avoids copying all
|
||||||
# elements using a slow genericSeqAssign
|
# elements using a slow genericSeqAssign
|
||||||
|
|
|
@ -281,7 +281,7 @@ p2pProtocol BeaconSync(version = 1,
|
||||||
{.libp2pProtocol("ping", 1, isRequired = true).} =
|
{.libp2pProtocol("ping", 1, isRequired = true).} =
|
||||||
return peer.network.metadata.seq_number
|
return peer.network.metadata.seq_number
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/altair/p2p-interface.md#transitioning-from-v1-to-v2
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/altair/p2p-interface.md#transitioning-from-v1-to-v2
|
||||||
proc getMetaData(peer: Peer): uint64
|
proc getMetaData(peer: Peer): uint64
|
||||||
{.libp2pProtocol("metadata", 1, isRequired = true).} =
|
{.libp2pProtocol("metadata", 1, isRequired = true).} =
|
||||||
raise newException(InvalidInputsError, "GetMetaData v1 unsupported")
|
raise newException(InvalidInputsError, "GetMetaData v1 unsupported")
|
||||||
|
|
|
@ -1235,7 +1235,7 @@ proc handleAttestations(node: BeaconNode, head: BlockRef, slot: Slot) =
|
||||||
# We need to run attestations exactly for the slot that we're attesting to.
|
# We need to run attestations exactly for the slot that we're attesting to.
|
||||||
# In case blocks went missing, this means advancing past the latest block
|
# In case blocks went missing, this means advancing past the latest block
|
||||||
# using empty slots as fillers.
|
# using empty slots as fillers.
|
||||||
# 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.4/specs/phase0/validator.md#validator-assignments
|
||||||
let
|
let
|
||||||
epochRef = node.dag.getEpochRef(
|
epochRef = node.dag.getEpochRef(
|
||||||
attestationHead.blck, slot.epoch, false).valueOr:
|
attestationHead.blck, slot.epoch, false).valueOr:
|
||||||
|
|
|
@ -489,7 +489,7 @@ proc signData(v: AttachedValidator,
|
||||||
else:
|
else:
|
||||||
v.signWithDistributedKey(request)
|
v.signWithDistributedKey(request)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/validator.md#signature
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/validator.md#signature
|
||||||
proc getBlockSignature*(v: AttachedValidator, fork: Fork,
|
proc getBlockSignature*(v: AttachedValidator, fork: Fork,
|
||||||
genesis_validators_root: Eth2Digest, slot: Slot,
|
genesis_validators_root: Eth2Digest, slot: Slot,
|
||||||
block_root: Eth2Digest,
|
block_root: Eth2Digest,
|
||||||
|
@ -629,7 +629,7 @@ proc getBlockSignature*(v: AttachedValidator, fork: Fork,
|
||||||
proofs)
|
proofs)
|
||||||
await v.signData(web3signerRequest)
|
await v.signData(web3signerRequest)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/validator.md#aggregate-signature
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/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
|
||||||
|
@ -645,7 +645,7 @@ proc getAttestationSignature*(v: AttachedValidator, fork: Fork,
|
||||||
let request = Web3SignerRequest.init(fork, genesis_validators_root, data)
|
let request = Web3SignerRequest.init(fork, genesis_validators_root, data)
|
||||||
await v.signData(request)
|
await v.signData(request)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/validator.md#broadcast-aggregate
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/validator.md#broadcast-aggregate
|
||||||
proc getAggregateAndProofSignature*(v: AttachedValidator,
|
proc getAggregateAndProofSignature*(v: AttachedValidator,
|
||||||
fork: Fork,
|
fork: Fork,
|
||||||
genesis_validators_root: Eth2Digest,
|
genesis_validators_root: Eth2Digest,
|
||||||
|
|
|
@ -6,7 +6,7 @@ This is a WIP document to explain the beacon block flows.
|
||||||
|
|
||||||
Important distinction:
|
Important distinction:
|
||||||
- We distinguish block `validation` which is defined in the P2P specs:
|
- We distinguish block `validation` which is defined in the P2P specs:
|
||||||
https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#beacon_block.
|
https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/p2p-interface.md#beacon_block.
|
||||||
A validated block can be forwarded on gossipsub.
|
A validated block can be forwarded on gossipsub.
|
||||||
- and we distinguish `verification` which is defined in consensus specs:
|
- and we distinguish `verification` which is defined in consensus specs:
|
||||||
https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/beacon-chain.md#block-processing
|
https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/beacon-chain.md#block-processing
|
||||||
|
@ -103,7 +103,7 @@ It is important to note that 3 data structures are sharing the same `AsyncQueue[
|
||||||
Blocks are listened to via the gossipsub topic `/eth2/{$forkDigest}/beacon_block/ssz_snappy` (`topicBeaconBlocks` variable)
|
Blocks are listened to via the gossipsub topic `/eth2/{$forkDigest}/beacon_block/ssz_snappy` (`topicBeaconBlocks` variable)
|
||||||
|
|
||||||
They are then:
|
They are then:
|
||||||
- validated by `blockValidator()` in the Eth2Processor by `validateBeaconBlock()` according to spec https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/p2p-interface.md#beacon_block
|
- validated by `blockValidator()` in the Eth2Processor by `validateBeaconBlock()` according to spec https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/p2p-interface.md#beacon_block
|
||||||
- Important: P2P validation is not full verification (state transition and internal cryptographic signatures were not checked)
|
- Important: P2P validation is not full verification (state transition and internal cryptographic signatures were not checked)
|
||||||
- enqueued in the shared block queue `AsyncQueue[BlockEntry]` in case of success
|
- enqueued in the shared block queue `AsyncQueue[BlockEntry]` in case of success
|
||||||
- dropped in case of error
|
- dropped in case of error
|
||||||
|
|
Loading…
Reference in New Issue