update some spec refs to v1.1.0-alpha.8 (#2689)

This commit is contained in:
tersec 2021-07-01 08:55:16 +00:00 committed by GitHub
parent 32702d37a3
commit c9cec88a23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 23 additions and 23 deletions

View File

@ -1504,8 +1504,7 @@ proc getPersistentNetKeys*(rng: var BrHmacDrbgContext,
func gossipId(data: openArray[byte], topic: string, valid: bool): seq[byte] =
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/specs/phase0/p2p-interface.md#topics-and-messages
# and
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.7/specs/altair/p2p-interface.md#topics-and-messages
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.8/specs/altair/p2p-interface.md#topics-and-messages
const
MESSAGE_DOMAIN_INVALID_SNAPPY = [0x00'u8, 0x00, 0x00, 0x00]
MESSAGE_DOMAIN_VALID_SNAPPY = [0x01'u8, 0x00, 0x00, 0x00]

View File

@ -649,12 +649,13 @@ 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/eth2.0-specs/blob/v1.1.0-alpha.7/specs/altair/beacon-chain.md#get_base_reward_per_increment
func get_base_reward_per_increment*(state: altair.BeaconState, cache: var StateCache): Gwei =
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.8/specs/altair/beacon-chain.md#get_base_reward_per_increment
func get_base_reward_per_increment*(
state: altair.BeaconState, cache: var StateCache): Gwei =
EFFECTIVE_BALANCE_INCREMENT * BASE_REWARD_FACTOR div
integer_squareroot(get_total_active_balance(state, cache))
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.7/specs/altair/beacon-chain.md#get_base_reward
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.8/specs/altair/beacon-chain.md#get_base_reward
func get_base_reward(
state: altair.BeaconState, index: ValidatorIndex,
base_reward_per_increment: Gwei): Gwei =
@ -848,7 +849,7 @@ func translate_participation(
proc upgrade_to_altair*(pre: phase0.BeaconState): ref altair.BeaconState =
let epoch = get_current_epoch(pre)
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.7/specs/altair/fork.md#configuration
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.8/specs/altair/fork.md#configuration
const ALTAIR_FORK_VERSION = Version [byte 1, 0, 0, 0]
var

View File

@ -38,7 +38,7 @@ import ./base, ./phase0
export base
const
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.7/specs/altair/beacon-chain.md#incentivization-weights
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.8/specs/altair/beacon-chain.md#incentivization-weights
TIMELY_SOURCE_WEIGHT* = 14
TIMELY_TARGET_WEIGHT* = 26
TIMELY_HEAD_WEIGHT* = 14
@ -53,16 +53,16 @@ const
TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE* = 4
SYNC_COMMITTEE_SUBNET_COUNT* = 4
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.7/setup.py#L473
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.8/setup.py#L473
FINALIZED_ROOT_INDEX* = 105'u16
NEXT_SYNC_COMMITTEE_INDEX* = 55'u16
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.7/specs/altair/beacon-chain.md#participation-flag-indices
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.8/specs/altair/beacon-chain.md#participation-flag-indices
TIMELY_SOURCE_FLAG_INDEX* = 0
TIMELY_TARGET_FLAG_INDEX* = 1
TIMELY_HEAD_FLAG_INDEX* = 2
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.7/specs/altair/beacon-chain.md#inactivity-penalties
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.8/specs/altair/beacon-chain.md#inactivity-penalties
INACTIVITY_SCORE_BIAS* = 4
INACTIVITY_SCORE_RECOVERY_RATE* = 16
@ -78,7 +78,7 @@ type
# TODO could be distinct
ParticipationFlags* = uint8
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.7/specs/altair/beacon-chain.md#syncaggregate
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.8/specs/altair/beacon-chain.md#syncaggregate
SyncAggregate* = object
sync_committee_bits*: BitArray[SYNC_COMMITTEE_SIZE]
sync_committee_signature*: ValidatorSig
@ -88,7 +88,7 @@ type
pubkeys*: HashArray[Limit SYNC_COMMITTEE_SIZE, ValidatorPubKey]
aggregate_pubkey*: ValidatorPubKey
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.7/specs/altair/validator.md#synccommitteemessage
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.8/specs/altair/validator.md#synccommitteemessage
SyncCommitteeMessage* = object
slot*: Slot ##\
## Slot to which this contribution pertains
@ -102,7 +102,7 @@ type
signature*: ValidatorSig ##\
## Signature by the validator over the block root of `slot`
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.7/specs/altair/validator.md#synccommitteecontribution
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.8/specs/altair/validator.md#synccommitteecontribution
SyncCommitteeContribution* = object
slot*: Slot ##\
## Slot to which this contribution pertains
@ -122,7 +122,7 @@ type
signature*: ValidatorSig ##\
## Signature by the validator(s) over the block root of `slot`
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.7/specs/altair/validator.md#contributionandproof
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.8/specs/altair/validator.md#contributionandproof
ContributionAndProof* = object
aggregator_index*: uint64
contribution*: SyncCommitteeContribution
@ -172,7 +172,7 @@ type
fork_version*: Version ##\
## Fork version for the aggregate signature
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.7/specs/altair/beacon-chain.md#beaconstate
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.8/specs/altair/beacon-chain.md#beaconstate
BeaconState* = object
# Versioning
genesis_time*: uint64

View File

@ -121,7 +121,7 @@ type
DOMAIN_SELECTION_PROOF = 5
DOMAIN_AGGREGATE_AND_PROOF = 6
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.7/specs/altair/beacon-chain.md#domain-types
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.8/specs/altair/beacon-chain.md#domain-types
DOMAIN_SYNC_COMMITTEE = 7
DOMAIN_SYNC_COMMITTEE_SELECTION_PROOF = 8
DOMAIN_CONTRIBUTION_AND_PROOF = 9

View File

@ -180,7 +180,7 @@ func get_seed*(state: SomeBeaconState, epoch: Epoch, domain_type: DomainType):
epoch + EPOCHS_PER_HISTORICAL_VECTOR - MIN_SEED_LOOKAHEAD - 1).data
eth2digest(seed_input)
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.7/specs/altair/beacon-chain.md#add_flag
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.8/specs/altair/beacon-chain.md#add_flag
func add_flag*(flags: ParticipationFlags, flag_index: int): ParticipationFlags =
let flag = ParticipationFlags(1'u8 shl flag_index)
flags or flag

View File

@ -22,7 +22,7 @@ const
# Sync Committee
# ---------------------------------------------------------------
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.7/presets/mainnet/altair.yaml#L13
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.8/presets/mainnet/altair.yaml#L13
SYNC_COMMITTEE_SIZE* = 512
EPOCHS_PER_SYNC_COMMITTEE_PERIOD* = 256

View File

@ -11,7 +11,7 @@
const
# Updated penalty values
# ---------------------------------------------------------------
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.7/presets/minimal/altair.yaml#L3
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.8/presets/minimal/altair.yaml#L3
CONFIG_NAME* = "minimal"
INACTIVITY_PENALTY_QUOTIENT_ALTAIR* = 50331648 ##\
@ -22,7 +22,7 @@ const
# Sync protocol
# ---------------------------------------------------------------
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.7/presets/minimal/altair.yaml#L13
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.8/presets/minimal/altair.yaml#L13
SYNC_COMMITTEE_SIZE* = 32
EPOCHS_PER_SYNC_COMMITTEE_PERIOD* = 8

View File

@ -382,7 +382,7 @@ proc process_justification_and_finalization*(state: var altair.BeaconState,
return
let
# these ultimately differ from phase0 only in these lines
# ref: https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.7/specs/phase0/beacon-chain.md#justification-and-finalization
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.8/specs/phase0/beacon-chain.md#justification-and-finalization
previous_indices = get_unslashed_participating_indices(
state, TIMELY_TARGET_FLAG_INDEX, get_previous_epoch(state))
current_indices = get_unslashed_participating_indices(
@ -559,7 +559,7 @@ func get_attestation_deltas(state: phase0.BeaconState, rewards: var RewardInfo)
rewards.statuses[proposer_index].delta.add(
proposer_delta.get()[1])
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.7/specs/altair/beacon-chain.md#get_base_reward_per_increment
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.8/specs/altair/beacon-chain.md#get_base_reward_per_increment
func get_base_reward_per_increment(
state: altair.BeaconState, total_active_balance: Gwei): Gwei =
# TODO hoist this integer_squareroot, as with phase 0
@ -798,7 +798,7 @@ func process_participation_flag_updates*(state: var altair.BeaconState) =
state.current_epoch_participation.resetCache()
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.7/specs/altair/beacon-chain.md#sync-committee-updates
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.8/specs/altair/beacon-chain.md#sync-committee-updates
proc process_sync_committee_updates*(state: var altair.BeaconState) =
let next_epoch = get_current_epoch(state) + 1
if next_epoch mod EPOCHS_PER_SYNC_COMMITTEE_PERIOD == 0: