diff --git a/beacon_chain/attestation_aggregation.nim b/beacon_chain/attestation_aggregation.nim index b9c58520d..7b1ed9806 100644 --- a/beacon_chain/attestation_aggregation.nim +++ b/beacon_chain/attestation_aggregation.nim @@ -1,5 +1,5 @@ # beacon_chain -# Copyright (c) 2018-2019 Status Research & Development GmbH +# Copyright (c) 2019 Status Research & Development GmbH # Licensed and distributed under either of # * MIT license (license terms in the root directory or at http://opensource.org/licenses/MIT). # * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0). @@ -33,7 +33,7 @@ const # https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/specs/networking/p2p-interface.md#configuration ATTESTATION_PROPAGATION_SLOT_RANGE = 32 -# https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/specs/validator/0_beacon-chain-validator.md#aggregation-selection +# https://github.com/ethereum/eth2.0-specs/blob/v0.9.3/specs/validator/0_beacon-chain-validator.md#aggregation-selection func get_slot_signature(state: BeaconState, slot: Slot, privkey: ValidatorPrivKey): ValidatorSig = let domain = diff --git a/beacon_chain/spec/beaconstate.nim b/beacon_chain/spec/beaconstate.nim index c9fd4c4f9..03927d0ec 100644 --- a/beacon_chain/spec/beaconstate.nim +++ b/beacon_chain/spec/beaconstate.nim @@ -11,7 +11,7 @@ import ../extras, ../ssz, ./crypto, ./datatypes, ./digest, ./helpers, ./validator -# https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/specs/core/0_beacon-chain.md#is_valid_merkle_branch +# https://github.com/ethereum/eth2.0-specs/blob/v0.9.3/specs/core/0_beacon-chain.md#is_valid_merkle_branch func is_valid_merkle_branch*(leaf: Eth2Digest, branch: openarray[Eth2Digest], depth: uint64, index: uint64, root: Eth2Digest): bool = ## Check if ``leaf`` at ``index`` verifies against the Merkle ``root`` and ## ``branch``. @@ -116,7 +116,7 @@ func get_validator_churn_limit(state: BeaconState): uint64 = max(MIN_PER_EPOCH_CHURN_LIMIT, len(active_validator_indices) div CHURN_LIMIT_QUOTIENT).uint64 -# https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/specs/core/0_beacon-chain.md#initiate_validator_exit +# https://github.com/ethereum/eth2.0-specs/blob/v0.9.3/specs/core/0_beacon-chain.md#initiate_validator_exit func initiate_validator_exit*(state: var BeaconState, index: ValidatorIndex) = # Initiate the exit of the validator with index ``index``. @@ -274,7 +274,7 @@ func get_initial_beacon_block*(state: BeaconState): SignedBeaconBlock = # parent_root, randao_reveal, eth1_data, signature, and body automatically # initialized to default values. -# https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/specs/core/0_beacon-chain.md#get_block_root_at_slot +# https://github.com/ethereum/eth2.0-specs/blob/v0.9.3/specs/core/0_beacon-chain.md#get_block_root_at_slot func get_block_root_at_slot*(state: BeaconState, slot: Slot): Eth2Digest = # Return the block root at a recent ``slot``. diff --git a/beacon_chain/spec/datatypes.nim b/beacon_chain/spec/datatypes.nim index 775a1d4b8..1098433c9 100644 --- a/beacon_chain/spec/datatypes.nim +++ b/beacon_chain/spec/datatypes.nim @@ -118,7 +118,7 @@ type attestation_1*: IndexedAttestation attestation_2*: IndexedAttestation - # https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/specs/core/0_beacon-chain.md#indexedattestation + # https://github.com/ethereum/eth2.0-specs/blob/v0.9.3/specs/core/0_beacon-chain.md#indexedattestation IndexedAttestation* = object # TODO ValidatorIndex, but that doesn't serialize properly attesting_indices*: List[uint64, MAX_VALIDATORS_PER_COMMITTEE] @@ -163,14 +163,14 @@ type withdrawal_credentials*: Eth2Digest amount*: Gwei - # https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/specs/core/0_beacon-chain.md#depositdata + # https://github.com/ethereum/eth2.0-specs/blob/v0.9.3/specs/core/0_beacon-chain.md#depositdata DepositData* = object pubkey*: ValidatorPubKey withdrawal_credentials*: Eth2Digest amount*: uint64 signature*: ValidatorSig # signing over DepositMessage - # https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/specs/core/0_beacon-chain.md#voluntaryexit + # https://github.com/ethereum/eth2.0-specs/blob/v0.9.3/specs/core/0_beacon-chain.md#voluntaryexit VoluntaryExit* = object epoch*: Epoch ##\ ## Earliest epoch when voluntary exit can be processed @@ -215,7 +215,7 @@ type deposits*: List[Deposit, MAX_DEPOSITS] voluntary_exits*: List[SignedVoluntaryExit, MAX_VOLUNTARY_EXITS] - # https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/specs/core/0_beacon-chain.md#beaconstate + # https://github.com/ethereum/eth2.0-specs/blob/v0.9.3/specs/core/0_beacon-chain.md#beaconstate BeaconState* = object # Versioning genesis_time*: uint64 @@ -242,7 +242,7 @@ type validators*: seq[Validator] balances*: seq[uint64] - # Shuffling + # Randomness randao_mixes*: array[EPOCHS_PER_HISTORICAL_VECTOR, Eth2Digest] # Slashings @@ -299,7 +299,7 @@ type proposer_index*: uint64 - # https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/specs/core/0_beacon-chain.md#historicalbatch + # https://github.com/ethereum/eth2.0-specs/blob/v0.9.3/specs/core/0_beacon-chain.md#historicalbatch HistoricalBatch* = object block_roots* : array[SLOTS_PER_HISTORICAL_ROOT, Eth2Digest] state_roots* : array[SLOTS_PER_HISTORICAL_ROOT, Eth2Digest] @@ -335,7 +335,7 @@ type message*: BeaconBlockHeader signature*: ValidatorSig - # https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/specs/validator/0_beacon-chain-validator.md#aggregateandproof + # https://github.com/ethereum/eth2.0-specs/blob/v0.9.3/specs/validator/0_beacon-chain-validator.md#aggregateandproof AggregateAndProof* = object aggregator_index*: uint64 aggregate*: Attestation diff --git a/beacon_chain/spec/helpers.nim b/beacon_chain/spec/helpers.nim index 904f23b5f..1ff782938 100644 --- a/beacon_chain/spec/helpers.nim +++ b/beacon_chain/spec/helpers.nim @@ -36,7 +36,7 @@ func compute_epoch_at_slot*(slot: Slot|uint64): Epoch = template epoch*(slot: Slot): Epoch = compute_epoch_at_slot(slot) -# https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/specs/core/0_beacon-chain.md#compute_start_slot_at_epoch +# https://github.com/ethereum/eth2.0-specs/blob/v0.9.3/specs/core/0_beacon-chain.md#compute_start_slot_at_epoch func compute_start_slot_at_epoch*(epoch: Epoch): Slot = # Return the start slot of ``epoch``. (epoch * SLOTS_PER_EPOCH).Slot @@ -54,7 +54,7 @@ func get_active_validator_indices*(state: BeaconState, epoch: Epoch): if is_active_validator(val, epoch): result.add idx.ValidatorIndex -# https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/specs/core/0_beacon-chain.md#get_committee_count_at_slot +# https://github.com/ethereum/eth2.0-specs/blob/v0.9.3/specs/core/0_beacon-chain.md#get_committee_count_at_slot func get_committee_count_at_slot*(state: BeaconState, slot: Slot): uint64 = # Return the number of committees at ``slot``. let epoch = compute_epoch_at_slot(slot) diff --git a/beacon_chain/spec/presets/mainnet.nim b/beacon_chain/spec/presets/mainnet.nim index 5db5ac2d4..812bf92c8 100644 --- a/beacon_chain/spec/presets/mainnet.nim +++ b/beacon_chain/spec/presets/mainnet.nim @@ -45,7 +45,7 @@ const MIN_GENESIS_ACTIVE_VALIDATOR_COUNT* {.intdefine.} = 16384 # Constants (TODO: not actually configurable) - # https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/specs/core/0_beacon-chain.md#constants + # https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/configs/mainnet.yaml#L110 BASE_REWARDS_PER_EPOCH* = 4 DEPOSIT_CONTRACT_TREE_DEPTH* = 32 @@ -153,7 +153,7 @@ const # Fork choice # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/specs/core/0_fork-choice.md#configuration + # https://github.com/ethereum/eth2.0-specs/blob/v0.9.3/configs/mainnet.yaml#L26 SAFE_SLOTS_TO_UPDATE_JUSTIFIED* = 8 # 96 seconds # Validators diff --git a/beacon_chain/spec/presets/minimal.nim b/beacon_chain/spec/presets/minimal.nim index 2fc5433bc..f93efce99 100644 --- a/beacon_chain/spec/presets/minimal.nim +++ b/beacon_chain/spec/presets/minimal.nim @@ -146,7 +146,7 @@ const # Phase 1 - Sharding # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/specs/core/1_shard-data-chains.md#time-parameters + # https://github.com/ethereum/eth2.0-specs/blob/v0.9.3/configs/minimal.yaml#L153 # TODO those are included in minimal.yaml but not mainnet.yaml # Why? SHARD_SLOTS_PER_BEACON_SLOT* = 2 # spec: SHARD_SLOTS_PER_EPOCH diff --git a/beacon_chain/spec/state_transition_block.nim b/beacon_chain/spec/state_transition_block.nim index f34558328..417415a65 100644 --- a/beacon_chain/spec/state_transition_block.nim +++ b/beacon_chain/spec/state_transition_block.nim @@ -124,7 +124,7 @@ proc process_randao( true -# https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/specs/core/0_beacon-chain.md#eth1-data +# https://github.com/ethereum/eth2.0-specs/blob/v0.9.3/specs/core/0_beacon-chain.md#eth1-data func process_eth1_data(state: var BeaconState, body: BeaconBlockBody) = state.eth1_data_votes.add body.eth1_data if state.eth1_data_votes.count(body.eth1_data) * 2 > diff --git a/beacon_chain/spec/state_transition_epoch.nim b/beacon_chain/spec/state_transition_epoch.nim index ef06470ec..019ba47d3 100644 --- a/beacon_chain/spec/state_transition_epoch.nim +++ b/beacon_chain/spec/state_transition_epoch.nim @@ -99,7 +99,7 @@ func get_attesting_balance( get_total_balance(state, get_unslashed_attesting_indices( state, attestations, stateCache)) -# https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/specs/core/0_beacon-chain.md#justification-and-finalization +# https://github.com/ethereum/eth2.0-specs/blob/v0.9.3/specs/core/0_beacon-chain.md#justification-and-finalization proc process_justification_and_finalization*( state: var BeaconState, stateCache: var StateCache) = @@ -348,7 +348,7 @@ func process_rewards_and_penalties( increase_balance(state, i.ValidatorIndex, rewards[i]) decrease_balance(state, i.ValidatorIndex, penalties[i]) -# https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/specs/core/0_beacon-chain.md#slashings +# https://github.com/ethereum/eth2.0-specs/blob/v0.9.3/specs/core/0_beacon-chain.md#slashings func process_slashings*(state: var BeaconState) = let epoch = get_current_epoch(state) diff --git a/beacon_chain/spec/state_transition_helpers.nim b/beacon_chain/spec/state_transition_helpers.nim index effcc3a99..7f608e43c 100644 --- a/beacon_chain/spec/state_transition_helpers.nim +++ b/beacon_chain/spec/state_transition_helpers.nim @@ -32,7 +32,7 @@ func get_attesting_indices*( result = result.union(get_attesting_indices( state, a.data, a.aggregation_bits, stateCache)) -# https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/specs/core/0_beacon-chain.md#helper-functions-1 +# https://github.com/ethereum/eth2.0-specs/blob/v0.9.3/specs/core/0_beacon-chain.md#helper-functions-1 func get_unslashed_attesting_indices*( state: BeaconState, attestations: openarray[PendingAttestation], stateCache: var StateCache): HashSet[ValidatorIndex] = diff --git a/beacon_chain/spec/validator.nim b/beacon_chain/spec/validator.nim index b19143f79..9d7c3ffb5 100644 --- a/beacon_chain/spec/validator.nim +++ b/beacon_chain/spec/validator.nim @@ -87,7 +87,7 @@ func get_previous_epoch*(state: BeaconState): Epoch = else: current_epoch - 1 -# https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/specs/core/0_beacon-chain.md#compute_committee +# https://github.com/ethereum/eth2.0-specs/blob/v0.9.3/specs/core/0_beacon-chain.md#compute_committee func compute_committee(indices: seq[ValidatorIndex], seed: Eth2Digest, index: uint64, count: uint64, stateCache: var StateCache): seq[ValidatorIndex] = ## Return the committee corresponding to ``indices``, ``seed``, ``index``,