update 30 spec URLs to v1.1.0 (#2914)
This commit is contained in:
parent
dc46559706
commit
ca4c6b4c5c
|
@ -5,8 +5,8 @@ This folder holds the various consensus object pools needed for a blockchain cli
|
|||
Object in those pools have passed the "gossip validation" filter according
|
||||
to specs:
|
||||
- blocks: https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/p2p-interface.md#beacon_block
|
||||
- aggregate attestations: https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/p2p-interface.md#beacon_aggregate_and_proof
|
||||
- unaggregate attestation: https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/p2p-interface.md#beacon_attestation_subnet_id
|
||||
- aggregate attestations: https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/p2p-interface.md#beacon_aggregate_and_proof
|
||||
- unaggregated attestation: https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/p2p-interface.md#beacon_attestation_subnet_id
|
||||
- voluntary exits https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/p2p-interface.md#voluntary_exit
|
||||
- Attester slashings https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/p2p-interface.md#attester_slashing
|
||||
- Proposer slashins https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/p2p-interface.md#proposer_slashing
|
||||
|
|
|
@ -159,7 +159,7 @@ func makeAttestationData*(
|
|||
|
||||
doAssert current_epoch == epochRef.epoch
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/validator.md#attestation-data
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/validator.md#attestation-data
|
||||
AttestationData(
|
||||
slot: slot,
|
||||
index: committee_index.uint64,
|
||||
|
|
|
@ -12,7 +12,7 @@ Gossip validation is different from consensus verification in particular for blo
|
|||
- Blocks: https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/p2p-interface.md#beacon_block
|
||||
- Attestations (aggregated): https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/p2p-interface.md#beacon_aggregate_and_proof
|
||||
- Attestations (unaggregated): https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/p2p-interface.md#attestation-subnets
|
||||
- Voluntary exits: https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/p2p-interface.md#voluntary_exit
|
||||
- Voluntary exits: https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/p2p-interface.md#voluntary_exit
|
||||
- Proposer slashings: https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/p2p-interface.md#proposer_slashing
|
||||
- Attester slashing: https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/p2p-interface.md#attester_slashing
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ func initiate_validator_exit*(cfg: RuntimeConfig, state: var SomeBeaconState,
|
|||
validator.withdrawable_epoch =
|
||||
validator.exit_epoch + cfg.MIN_VALIDATOR_WITHDRAWABILITY_DELAY
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#slash_validator
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#slash_validator
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0-beta.4/specs/altair/beacon-chain.md#modified-slash_validator
|
||||
proc slash_validator*(
|
||||
cfg: RuntimeConfig, state: var SomeBeaconState,
|
||||
|
@ -584,7 +584,7 @@ func get_total_active_balance*(state: SomeBeaconState, cache: var StateCache): G
|
|||
get_total_balance(
|
||||
state, cache.get_shuffled_active_validator_indices(state, epoch))
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0-beta.4/specs/altair/beacon-chain.md#get_base_reward_per_increment
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/altair/beacon-chain.md#get_base_reward_per_increment
|
||||
func get_base_reward_per_increment*(
|
||||
state: altair.BeaconState | merge.BeaconState, cache: var StateCache): Gwei =
|
||||
EFFECTIVE_BALANCE_INCREMENT * BASE_REWARD_FACTOR div
|
||||
|
|
|
@ -75,7 +75,7 @@ static: doAssert TIMELY_SOURCE_WEIGHT + TIMELY_TARGET_WEIGHT +
|
|||
type
|
||||
### New types
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0-beta.4/specs/altair/beacon-chain.md#custom-types
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/altair/beacon-chain.md#custom-types
|
||||
ParticipationFlags* = uint8
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0-beta.4/specs/altair/beacon-chain.md#syncaggregate
|
||||
|
@ -142,7 +142,7 @@ type
|
|||
|
||||
### Modified/overloaded
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0-beta.4/specs/altair/sync-protocol.md#lightclientsnapshot
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/altair/sync-protocol.md#lightclientsnapshot
|
||||
LightClientSnapshot* = object
|
||||
header*: BeaconBlockHeader ##\
|
||||
## Beacon block header
|
||||
|
@ -174,7 +174,7 @@ type
|
|||
fork_version*: Version ##\
|
||||
## Fork version for the aggregate signature
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0-beta.4/specs/altair/sync-protocol.md#lightclientstore
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/altair/sync-protocol.md#lightclientstore
|
||||
LightClientStore* = object
|
||||
snapshot*: LightClientSnapshot
|
||||
valid_updates*: HashSet[LightClientUpdate]
|
||||
|
@ -306,7 +306,7 @@ type
|
|||
state_root*: Eth2Digest ##\
|
||||
body*: TrustedBeaconBlockBody
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0-beta.4/specs/altair/beacon-chain.md#beaconblockbody
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/altair/beacon-chain.md#beaconblockbody
|
||||
BeaconBlockBody* = object
|
||||
randao_reveal*: ValidatorSig
|
||||
eth1_data*: Eth1Data ##\
|
||||
|
|
|
@ -131,7 +131,7 @@ type
|
|||
DOMAIN_SYNC_COMMITTEE_SELECTION_PROOF = 8
|
||||
DOMAIN_CONTRIBUTION_AND_PROOF = 9
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#custom-types
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#custom-types
|
||||
Eth2Domain* = array[32, byte]
|
||||
|
||||
# https://github.com/nim-lang/Nim/issues/574 and be consistent across
|
||||
|
@ -251,7 +251,7 @@ type
|
|||
withdrawal_credentials*: Eth2Digest
|
||||
amount*: Gwei
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#depositdata
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#depositdata
|
||||
DepositData* = object
|
||||
pubkey*: ValidatorPubKey
|
||||
withdrawal_credentials*: Eth2Digest
|
||||
|
@ -335,7 +335,7 @@ type
|
|||
deposit_count*: uint64
|
||||
block_hash*: Eth2Digest
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#signedvoluntaryexit
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#signedvoluntaryexit
|
||||
SignedVoluntaryExit* = object
|
||||
message*: VoluntaryExit
|
||||
signature*: ValidatorSig
|
||||
|
@ -352,7 +352,7 @@ type
|
|||
state_root*: Eth2Digest
|
||||
body_root*: Eth2Digest
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#signingdata
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#signingdata
|
||||
SigningData* = object
|
||||
object_root*: Eth2Digest
|
||||
domain*: Eth2Domain
|
||||
|
@ -374,7 +374,7 @@ type
|
|||
aggregate*: Attestation
|
||||
selection_proof*: ValidatorSig
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/validator.md#signedaggregateandproof
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/validator.md#signedaggregateandproof
|
||||
SignedAggregateAndProof* = object
|
||||
message*: AggregateAndProof
|
||||
signature*: ValidatorSig
|
||||
|
@ -392,7 +392,7 @@ type
|
|||
branch*: array[DEPOSIT_CONTRACT_TREE_DEPTH, Eth2Digest]
|
||||
deposit_count*: array[32, byte] # Uint256
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#validator
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#validator
|
||||
ValidatorStatus* = object
|
||||
# This is a validator without the expensive, immutable, append-only parts
|
||||
# serialized. They're represented in memory to allow in-place SSZ reading
|
||||
|
@ -418,7 +418,7 @@ type
|
|||
withdrawable_epoch*: Epoch ##\
|
||||
## When validator can withdraw or transfer funds
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/p2p-interface.md#eth2-field
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/p2p-interface.md#eth2-field
|
||||
ENRForkID* = object
|
||||
fork_digest*: ForkDigest
|
||||
next_fork_version*: Version
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
# Serenity hash function / digest
|
||||
#
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#hash
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#hash
|
||||
#
|
||||
# In Phase 0 the beacon chain is deployed with SHA256 (SHA2-256).
|
||||
# Note that is is different from Keccak256 (often mistakenly called SHA3-256)
|
||||
|
|
|
@ -4,7 +4,7 @@ import
|
|||
datatypes/altair,
|
||||
helpers
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0-beta.3/specs/altair/sync-protocol.md#validate_light_client_update
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/altair/sync-protocol.md#validate_light_client_update
|
||||
proc validate_light_client_update*(snapshot: LightClientSnapshot,
|
||||
update: LightClientUpdate,
|
||||
genesis_validators_root: Eth2Digest): bool =
|
||||
|
|
|
@ -110,7 +110,7 @@ func compute_aggregate_and_proof_root*(fork: Fork, genesis_validators_root: Eth2
|
|||
fork, DOMAIN_AGGREGATE_AND_PROOF, epoch, genesis_validators_root)
|
||||
compute_signing_root(aggregate_and_proof, domain)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/validator.md#broadcast-aggregate
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/validator.md#broadcast-aggregate
|
||||
func get_aggregate_and_proof_signature*(fork: Fork, genesis_validators_root: Eth2Digest,
|
||||
aggregate_and_proof: AggregateAndProof,
|
||||
privKey: ValidatorPrivKey): CookedSig =
|
||||
|
|
|
@ -72,7 +72,7 @@ func `xor`[T: array](a, b: T): T =
|
|||
for i in 0..<result.len:
|
||||
result[i] = a[i] xor b[i]
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#randao
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#randao
|
||||
proc process_randao(
|
||||
state: var SomeBeaconState, body: SomeSomeBeaconBlockBody, flags: UpdateFlags,
|
||||
cache: var StateCache): Result[void, cstring] {.nbench.} =
|
||||
|
|
|
@ -165,7 +165,7 @@ type
|
|||
current_epoch_TIMELY_TARGET: Gwei
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0-beta.2/specs/altair/beacon-chain.md#get_unslashed_participating_indices
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0-beta.4/specs/phase0/beacon-chain.md#get_total_balance
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#get_total_balance
|
||||
func get_unslashed_participating_balances*(state: altair.BeaconState | merge.BeaconState):
|
||||
UnslashedParticipatingBalances =
|
||||
let
|
||||
|
@ -242,7 +242,7 @@ proc process_justification_and_finalization*(state: var phase0.BeaconState,
|
|||
## state.justification_bits[1:] = state.justification_bits[:-1]
|
||||
## state.justification_bits[0] = 0b0
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#constants
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#misc
|
||||
const JUSTIFICATION_BITS_LENGTH = 4
|
||||
|
||||
state.justification_bits = (state.justification_bits shl 1) and
|
||||
|
@ -476,7 +476,7 @@ func get_attestation_component_delta(is_unslashed_attester: bool,
|
|||
else:
|
||||
RewardDelta(penalties: base_reward)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#components-of-attestation-deltas
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#components-of-attestation-deltas
|
||||
func get_source_delta*(validator: RewardStatus,
|
||||
base_reward: uint64,
|
||||
total_balances: TotalBalances,
|
||||
|
@ -701,7 +701,7 @@ func process_rewards_and_penalties(
|
|||
decrease_balance(balance, v.delta.penalties)
|
||||
state.balances.asSeq()[idx] = balance
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0-beta.4/specs/altair/beacon-chain.md#rewards-and-penalties
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/altair/beacon-chain.md#rewards-and-penalties
|
||||
func process_rewards_and_penalties(
|
||||
cfg: RuntimeConfig, state: var (altair.BeaconState | merge.BeaconState),
|
||||
total_active_balance: Gwei,
|
||||
|
@ -920,12 +920,22 @@ proc process_epoch*(
|
|||
# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#slashings
|
||||
process_slashings(state, rewards.total_balances.current_epoch)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#final-updates
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#eth1-data-votes-updates
|
||||
process_eth1_data_reset(state)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#effective-balances-updates
|
||||
process_effective_balance_updates(state)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#slashings-balances-updates
|
||||
process_slashings_reset(state)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#randao-mixes-updates
|
||||
process_randao_mixes_reset(state)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#historical-roots-updates
|
||||
process_historical_roots_update(state)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#participation-records-rotation
|
||||
process_participation_record_updates(state)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0-alpha.7/specs/altair/beacon-chain.md#epoch-processing
|
||||
|
|
|
@ -268,7 +268,7 @@ func get_beacon_committee*(
|
|||
committees_per_slot * SLOTS_PER_EPOCH
|
||||
)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#get_beacon_committee
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#get_beacon_committee
|
||||
func get_beacon_committee_len*(
|
||||
state: SomeBeaconState, slot: Slot, index: CommitteeIndex,
|
||||
cache: var StateCache): uint64 =
|
||||
|
|
|
@ -9,7 +9,7 @@ It is important to distinguish attestation `validation` from attestation `verifi
|
|||
- Aggregated: https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/p2p-interface.md#beacon_aggregate_and_proof
|
||||
- Unaggregated: https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/p2p-interface.md#beacon_attestation_subnet_id
|
||||
- Attestation `verification` is defined in the consensus specs. Verified attestations can affect fork choice and may be included in a block.
|
||||
- https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#attestations
|
||||
- https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#attestations
|
||||
|
||||
From the specs it seems like gossip attestation `validation` is a superset of consensus attestation `verification`.
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ This is a WIP document to explain the beacon block flows.
|
|||
|
||||
Important distinction:
|
||||
- We distinguish block `validation` which is defined in the P2P specs:
|
||||
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.0/specs/phase0/p2p-interface.md#beacon_block.
|
||||
A validated block can be forwarded on gossipsub.
|
||||
- and we distinguish `verification` which is defined in consensus specs:
|
||||
https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#block-processing
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||
|
||||
# process_attestation (beaconstate.nim)
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#attestations
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#attestations
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
{.used.}
|
||||
|
|
Loading…
Reference in New Issue