From c9cec88a23fa05bcc7b811ee54b4b20256f513cc Mon Sep 17 00:00:00 2001 From: tersec Date: Thu, 1 Jul 2021 08:55:16 +0000 Subject: [PATCH] update some spec refs to v1.1.0-alpha.8 (#2689) --- beacon_chain/networking/eth2_network.nim | 3 +-- beacon_chain/spec/beaconstate.nim | 9 +++++---- beacon_chain/spec/datatypes/altair.nim | 18 +++++++++--------- beacon_chain/spec/datatypes/base.nim | 2 +- beacon_chain/spec/helpers.nim | 2 +- beacon_chain/spec/presets/altair/mainnet.nim | 2 +- beacon_chain/spec/presets/altair/minimal.nim | 4 ++-- beacon_chain/spec/state_transition_epoch.nim | 6 +++--- 8 files changed, 23 insertions(+), 23 deletions(-) diff --git a/beacon_chain/networking/eth2_network.nim b/beacon_chain/networking/eth2_network.nim index e6d31f25e..8b6490dc7 100644 --- a/beacon_chain/networking/eth2_network.nim +++ b/beacon_chain/networking/eth2_network.nim @@ -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] diff --git a/beacon_chain/spec/beaconstate.nim b/beacon_chain/spec/beaconstate.nim index 926a5fe48..05113ce4c 100644 --- a/beacon_chain/spec/beaconstate.nim +++ b/beacon_chain/spec/beaconstate.nim @@ -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 diff --git a/beacon_chain/spec/datatypes/altair.nim b/beacon_chain/spec/datatypes/altair.nim index 8849deb84..c9e099774 100644 --- a/beacon_chain/spec/datatypes/altair.nim +++ b/beacon_chain/spec/datatypes/altair.nim @@ -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 diff --git a/beacon_chain/spec/datatypes/base.nim b/beacon_chain/spec/datatypes/base.nim index 3f2824e08..64233ec05 100644 --- a/beacon_chain/spec/datatypes/base.nim +++ b/beacon_chain/spec/datatypes/base.nim @@ -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 diff --git a/beacon_chain/spec/helpers.nim b/beacon_chain/spec/helpers.nim index b52bad574..9e6233f36 100644 --- a/beacon_chain/spec/helpers.nim +++ b/beacon_chain/spec/helpers.nim @@ -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 diff --git a/beacon_chain/spec/presets/altair/mainnet.nim b/beacon_chain/spec/presets/altair/mainnet.nim index 200125104..6d9887ca0 100644 --- a/beacon_chain/spec/presets/altair/mainnet.nim +++ b/beacon_chain/spec/presets/altair/mainnet.nim @@ -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 diff --git a/beacon_chain/spec/presets/altair/minimal.nim b/beacon_chain/spec/presets/altair/minimal.nim index 16c5922af..0668fcce8 100644 --- a/beacon_chain/spec/presets/altair/minimal.nim +++ b/beacon_chain/spec/presets/altair/minimal.nim @@ -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 diff --git a/beacon_chain/spec/state_transition_epoch.nim b/beacon_chain/spec/state_transition_epoch.nim index 580266b81..82c997338 100644 --- a/beacon_chain/spec/state_transition_epoch.nim +++ b/beacon_chain/spec/state_transition_epoch.nim @@ -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: