mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-02-23 11:48:33 +00:00
spec URL updates (#3254)
This commit is contained in:
parent
a4667d1840
commit
0fd8bf7b56
@ -141,7 +141,7 @@ func init*(
|
|||||||
of BeaconStateFork.Phase0: false
|
of BeaconStateFork.Phase0: false
|
||||||
of BeaconStateFork.Altair: false
|
of BeaconStateFork.Altair: false
|
||||||
of BeaconStateFork.Bellatrix:
|
of BeaconStateFork.Bellatrix:
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/merge/beacon-chain.md#is_merge_transition_complete
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.7/specs/merge/beacon-chain.md#is_merge_transition_complete
|
||||||
state.data.mergeData.data.latest_execution_payload_header !=
|
state.data.mergeData.data.latest_execution_payload_header !=
|
||||||
ExecutionPayloadHeader()
|
ExecutionPayloadHeader()
|
||||||
)
|
)
|
||||||
|
@ -186,7 +186,7 @@ template validateBeaconBlockBellatrix(
|
|||||||
altair.SignedBeaconBlock): untyped =
|
altair.SignedBeaconBlock): untyped =
|
||||||
discard
|
discard
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/merge/p2p-interface.md#beacon_block
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.7/specs/merge/p2p-interface.md#beacon_block
|
||||||
template validateBeaconBlockBellatrix(
|
template validateBeaconBlockBellatrix(
|
||||||
signed_beacon_block: merge.SignedBeaconBlock): untyped =
|
signed_beacon_block: merge.SignedBeaconBlock): untyped =
|
||||||
# If the execution is enabled for the block -- i.e.
|
# If the execution is enabled for the block -- i.e.
|
||||||
@ -212,7 +212,7 @@ template validateBeaconBlockBellatrix(
|
|||||||
of BeaconBlockFork.Altair:
|
of BeaconBlockFork.Altair:
|
||||||
false
|
false
|
||||||
of BeaconBlockFork.Bellatrix:
|
of BeaconBlockFork.Bellatrix:
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/merge/beacon-chain.md#process_execution_payload
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.7/specs/merge/beacon-chain.md#process_execution_payload
|
||||||
# shows how this gets folded into the state each block; checking this
|
# shows how this gets folded into the state each block; checking this
|
||||||
# is equivalent, without ever requiring state replay or any similarly
|
# is equivalent, without ever requiring state replay or any similarly
|
||||||
# expensive computation.
|
# expensive computation.
|
||||||
@ -231,7 +231,7 @@ template validateBeaconBlockBellatrix(
|
|||||||
return errReject("BeaconBlock: Mismatched execution payload timestamp")
|
return errReject("BeaconBlock: Mismatched execution payload timestamp")
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/p2p-interface.md#beacon_block
|
# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/p2p-interface.md#beacon_block
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/merge/p2p-interface.md#beacon_block
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.7/specs/merge/p2p-interface.md#beacon_block
|
||||||
proc validateBeaconBlock*(
|
proc validateBeaconBlock*(
|
||||||
dag: ChainDAGRef, quarantine: ref Quarantine,
|
dag: ChainDAGRef, quarantine: ref Quarantine,
|
||||||
signed_beacon_block: phase0.SignedBeaconBlock | altair.SignedBeaconBlock |
|
signed_beacon_block: phase0.SignedBeaconBlock | altair.SignedBeaconBlock |
|
||||||
|
@ -121,7 +121,7 @@ func initiate_validator_exit*(cfg: RuntimeConfig, state: var ForkyBeaconState,
|
|||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/phase0/beacon-chain.md#slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/phase0/beacon-chain.md#slash_validator
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/altair/beacon-chain.md#modified-slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/altair/beacon-chain.md#modified-slash_validator
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/merge/beacon-chain.md#modified-slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.7/specs/merge/beacon-chain.md#modified-slash_validator
|
||||||
proc slash_validator*(
|
proc slash_validator*(
|
||||||
cfg: RuntimeConfig, state: var ForkyBeaconState,
|
cfg: RuntimeConfig, state: var ForkyBeaconState,
|
||||||
slashed_index: ValidatorIndex, cache: var StateCache) =
|
slashed_index: ValidatorIndex, cache: var StateCache) =
|
||||||
@ -314,7 +314,7 @@ func get_initial_beacon_block*(state: altair.HashedBeaconState):
|
|||||||
altair.TrustedSignedBeaconBlock(
|
altair.TrustedSignedBeaconBlock(
|
||||||
message: message, root: hash_tree_root(message))
|
message: message, root: hash_tree_root(message))
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/merge/beacon-chain.md#testing
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.7/specs/merge/beacon-chain.md#testing
|
||||||
func get_initial_beacon_block*(state: bellatrix.HashedBeaconState):
|
func get_initial_beacon_block*(state: bellatrix.HashedBeaconState):
|
||||||
bellatrix.TrustedSignedBeaconBlock =
|
bellatrix.TrustedSignedBeaconBlock =
|
||||||
# The genesis block is implicitly trusted
|
# The genesis block is implicitly trusted
|
||||||
@ -840,7 +840,7 @@ proc upgrade_to_altair*(cfg: RuntimeConfig, pre: phase0.BeaconState): ref altair
|
|||||||
|
|
||||||
post
|
post
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/merge/fork.md#upgrading-the-state
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.7/specs/merge/fork.md#upgrading-the-state
|
||||||
func upgrade_to_merge*(cfg: RuntimeConfig, pre: altair.BeaconState):
|
func upgrade_to_merge*(cfg: RuntimeConfig, pre: altair.BeaconState):
|
||||||
ref bellatrix.BeaconState =
|
ref bellatrix.BeaconState =
|
||||||
let epoch = get_current_epoch(pre)
|
let epoch = get_current_epoch(pre)
|
||||||
|
@ -64,7 +64,7 @@ const
|
|||||||
INACTIVITY_SCORE_BIAS* = 4
|
INACTIVITY_SCORE_BIAS* = 4
|
||||||
INACTIVITY_SCORE_RECOVERY_RATE* = 16
|
INACTIVITY_SCORE_RECOVERY_RATE* = 16
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.7/specs/altair/sync-protocol.md#misc
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/altair/sync-protocol.md#misc
|
||||||
# MIN_SYNC_COMMITTEE_PARTICIPANTS defined in presets
|
# MIN_SYNC_COMMITTEE_PARTICIPANTS defined in presets
|
||||||
UPDATE_TIMEOUT* = SLOTS_PER_EPOCH * EPOCHS_PER_SYNC_COMMITTEE_PERIOD
|
UPDATE_TIMEOUT* = SLOTS_PER_EPOCH * EPOCHS_PER_SYNC_COMMITTEE_PERIOD
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ type
|
|||||||
|
|
||||||
PayloadID* = array[8, byte]
|
PayloadID* = array[8, byte]
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/merge/beacon-chain.md#executionpayload
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.7/specs/merge/beacon-chain.md#executionpayload
|
||||||
ExecutionPayload* = object
|
ExecutionPayload* = object
|
||||||
parent_hash*: Eth2Digest
|
parent_hash*: Eth2Digest
|
||||||
fee_recipient*: ExecutionAddress # 'beneficiary' in the yellow paper
|
fee_recipient*: ExecutionAddress # 'beneficiary' in the yellow paper
|
||||||
@ -52,7 +52,7 @@ type
|
|||||||
block_hash*: Eth2Digest # Hash of execution block
|
block_hash*: Eth2Digest # Hash of execution block
|
||||||
transactions*: List[Transaction, MAX_TRANSACTIONS_PER_PAYLOAD]
|
transactions*: List[Transaction, MAX_TRANSACTIONS_PER_PAYLOAD]
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/merge/beacon-chain.md#executionpayloadheader
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.7/specs/merge/beacon-chain.md#executionpayloadheader
|
||||||
ExecutionPayloadHeader* = object
|
ExecutionPayloadHeader* = object
|
||||||
parent_hash*: Eth2Digest
|
parent_hash*: Eth2Digest
|
||||||
fee_recipient*: ExecutionAddress
|
fee_recipient*: ExecutionAddress
|
||||||
@ -80,7 +80,7 @@ type
|
|||||||
parent_hash*: Eth2Digest
|
parent_hash*: Eth2Digest
|
||||||
total_difficulty*: Eth2Digest # uint256
|
total_difficulty*: Eth2Digest # uint256
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/merge/beacon-chain.md#beaconstate
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.7/specs/merge/beacon-chain.md#beaconstate
|
||||||
BeaconState* = object
|
BeaconState* = object
|
||||||
# Versioning
|
# Versioning
|
||||||
genesis_time*: uint64
|
genesis_time*: uint64
|
||||||
@ -206,7 +206,7 @@ type
|
|||||||
state_root*: Eth2Digest ##\
|
state_root*: Eth2Digest ##\
|
||||||
body*: TrustedBeaconBlockBody
|
body*: TrustedBeaconBlockBody
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/merge/beacon-chain.md#beaconblockbody
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.7/specs/merge/beacon-chain.md#beaconblockbody
|
||||||
BeaconBlockBody* = object
|
BeaconBlockBody* = object
|
||||||
randao_reveal*: ValidatorSig
|
randao_reveal*: ValidatorSig
|
||||||
eth1_data*: Eth1Data ##\
|
eth1_data*: Eth1Data ##\
|
||||||
|
@ -150,7 +150,7 @@ func process_attestations*(
|
|||||||
if v.flags.contains RewardFlags.isPreviousEpochHeadAttester:
|
if v.flags.contains RewardFlags.isPreviousEpochHeadAttester:
|
||||||
info.balances.previous_epoch_head_attesters_raw += validator_balance
|
info.balances.previous_epoch_head_attesters_raw += validator_balance
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#helpers
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.1/specs/phase0/beacon-chain.md#helpers
|
||||||
# get_eligible_validator_indices
|
# get_eligible_validator_indices
|
||||||
func is_eligible_validator*(validator: RewardStatus): bool =
|
func is_eligible_validator*(validator: RewardStatus): bool =
|
||||||
validator.flags.contains(RewardFlags.isActiveInPreviousEpoch) or
|
validator.flags.contains(RewardFlags.isActiveInPreviousEpoch) or
|
||||||
@ -491,7 +491,7 @@ func get_attestation_component_delta(is_unslashed_attester: bool,
|
|||||||
else:
|
else:
|
||||||
RewardDelta(penalties: base_reward)
|
RewardDelta(penalties: base_reward)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#components-of-attestation-deltas
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.1/specs/phase0/beacon-chain.md#components-of-attestation-deltas
|
||||||
func get_source_delta*(validator: RewardStatus,
|
func get_source_delta*(validator: RewardStatus,
|
||||||
base_reward: uint64,
|
base_reward: uint64,
|
||||||
balances: TotalBalances,
|
balances: TotalBalances,
|
||||||
@ -1061,7 +1061,7 @@ proc process_epoch*(
|
|||||||
|
|
||||||
process_inactivity_updates(cfg, state, info) # [New in Altair]
|
process_inactivity_updates(cfg, state, info) # [New in Altair]
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#rewards-and-penalties-1
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.1/specs/phase0/beacon-chain.md#rewards-and-penalties-1
|
||||||
process_rewards_and_penalties(cfg, state, info)
|
process_rewards_and_penalties(cfg, state, info)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/phase0/beacon-chain.md#registry-updates
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/phase0/beacon-chain.md#registry-updates
|
||||||
|
@ -334,7 +334,7 @@ proc signSyncCommitteeMessage*(v: AttachedValidator,
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.2/specs/altair/validator.md#aggregation-selection
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/altair/validator.md#aggregation-selection
|
||||||
proc getSyncCommitteeSelectionProof*(v: AttachedValidator,
|
proc getSyncCommitteeSelectionProof*(v: AttachedValidator,
|
||||||
fork: Fork,
|
fork: Fork,
|
||||||
genesis_validators_root: Eth2Digest,
|
genesis_validators_root: Eth2Digest,
|
||||||
@ -355,7 +355,7 @@ proc getSyncCommitteeSelectionProof*(v: AttachedValidator,
|
|||||||
else:
|
else:
|
||||||
SignatureResult.ok(res.get().toValidatorSig())
|
SignatureResult.ok(res.get().toValidatorSig())
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0-beta.4/specs/altair/validator.md#signature
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.1/specs/altair/validator.md#signature
|
||||||
proc sign*(v: AttachedValidator, msg: ref SignedContributionAndProof,
|
proc sign*(v: AttachedValidator, msg: ref SignedContributionAndProof,
|
||||||
fork: Fork, genesis_validators_root: Eth2Digest
|
fork: Fork, genesis_validators_root: Eth2Digest
|
||||||
): Future[SignatureResult] {.async.} =
|
): Future[SignatureResult] {.async.} =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user