more 0.10.1 updates
This commit is contained in:
parent
1ba2cebd85
commit
dab107fa1e
|
@ -1,5 +1,5 @@
|
||||||
# beacon_chain
|
# beacon_chain
|
||||||
# Copyright (c) 2018-2019 Status Research & Development GmbH
|
# Copyright (c) 2018-2020 Status Research & Development GmbH
|
||||||
# Licensed and distributed under either of
|
# Licensed and distributed under either of
|
||||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# beacon_chain
|
# beacon_chain
|
||||||
# Copyright (c) 2018-2019 Status Research & Development GmbH
|
# Copyright (c) 2018-2020 Status Research & Development GmbH
|
||||||
# Licensed and distributed under either of
|
# Licensed and distributed under either of
|
||||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||||
|
@ -136,7 +136,7 @@ const
|
||||||
|
|
||||||
# Reward and penalty quotients
|
# Reward and penalty quotients
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/configs/mainnet.yaml#L110
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.10.1/configs/mainnet.yaml#L114
|
||||||
BASE_REWARD_FACTOR* = 2'u64^6
|
BASE_REWARD_FACTOR* = 2'u64^6
|
||||||
WHISTLEBLOWER_REWARD_QUOTIENT* = 2'u64^9
|
WHISTLEBLOWER_REWARD_QUOTIENT* = 2'u64^9
|
||||||
PROPOSER_REWARD_QUOTIENT* = 2'u64^3
|
PROPOSER_REWARD_QUOTIENT* = 2'u64^3
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# beacon_chain
|
# beacon_chain
|
||||||
# Copyright (c) 2018-2019 Status Research & Development GmbH
|
# Copyright (c) 2018-2020 Status Research & Development GmbH
|
||||||
# Licensed and distributed under either of
|
# Licensed and distributed under either of
|
||||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||||
|
@ -118,7 +118,7 @@ const
|
||||||
|
|
||||||
# Max operations per block
|
# Max operations per block
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/configs/minimal.yaml#L127
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.10.1/configs/minimal.yaml#L131
|
||||||
|
|
||||||
MAX_PROPOSER_SLASHINGS* = 2^4
|
MAX_PROPOSER_SLASHINGS* = 2^4
|
||||||
MAX_ATTESTER_SLASHINGS* = 2^0
|
MAX_ATTESTER_SLASHINGS* = 2^0
|
||||||
|
@ -135,7 +135,7 @@ const
|
||||||
|
|
||||||
# Validators
|
# Validators
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/specs/validator/0_beacon-chain-validator.md#misc
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.10.1/configs/minimal.yaml#L32
|
||||||
|
|
||||||
# Changed
|
# Changed
|
||||||
ETH1_FOLLOW_DISTANCE* = 16 # blocks
|
ETH1_FOLLOW_DISTANCE* = 16 # blocks
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# beacon_chain
|
# beacon_chain
|
||||||
# Copyright (c) 2018-2019 Status Research & Development GmbH
|
# Copyright (c) 2018-2020 Status Research & Development GmbH
|
||||||
# Licensed and distributed under either of
|
# Licensed and distributed under either of
|
||||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||||
|
@ -71,7 +71,7 @@ func get_total_active_balance*(state: BeaconState): Gwei =
|
||||||
state,
|
state,
|
||||||
get_active_validator_indices(state, get_current_epoch(state)))
|
get_active_validator_indices(state, get_current_epoch(state)))
|
||||||
|
|
||||||
# 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.10.1/specs/phase0/beacon-chain.md#helper-functions-1
|
||||||
func get_matching_source_attestations(state: BeaconState, epoch: Epoch):
|
func get_matching_source_attestations(state: BeaconState, epoch: Epoch):
|
||||||
seq[PendingAttestation] =
|
seq[PendingAttestation] =
|
||||||
doAssert epoch in [get_current_epoch(state), get_previous_epoch(state)]
|
doAssert epoch in [get_current_epoch(state), get_previous_epoch(state)]
|
||||||
|
@ -233,7 +233,7 @@ proc process_justification_and_finalization*(
|
||||||
checkpoint = shortLog(state.finalized_checkpoint),
|
checkpoint = shortLog(state.finalized_checkpoint),
|
||||||
cat = "finalization"
|
cat = "finalization"
|
||||||
|
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/specs/core/0_beacon-chain.md#rewards-and-penalties-1
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.10.1/specs/phase0/beacon-chain.md#rewards-and-penalties-1
|
||||||
func get_base_reward(state: BeaconState, index: ValidatorIndex,
|
func get_base_reward(state: BeaconState, index: ValidatorIndex,
|
||||||
total_balance: auto): Gwei =
|
total_balance: auto): Gwei =
|
||||||
# Spec function recalculates total_balance every time, which creates an
|
# Spec function recalculates total_balance every time, which creates an
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# beacon_chain
|
# beacon_chain
|
||||||
# Copyright (c) 2018-2019 Status Research & Development GmbH
|
# Copyright (c) 2018-2020 Status Research & Development GmbH
|
||||||
# Licensed and distributed under either of
|
# Licensed and distributed under either of
|
||||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||||
|
@ -22,7 +22,7 @@ func shortLog*(x: Checkpoint): string =
|
||||||
# Helpers used in epoch transition and trace-level block transition
|
# Helpers used in epoch transition and trace-level block transition
|
||||||
# --------------------------------------------------------
|
# --------------------------------------------------------
|
||||||
|
|
||||||
# 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.10.1/specs/phase0/beacon-chain.md#helper-functions-1
|
||||||
func get_attesting_indices*(
|
func get_attesting_indices*(
|
||||||
state: BeaconState, attestations: openarray[PendingAttestation],
|
state: BeaconState, attestations: openarray[PendingAttestation],
|
||||||
stateCache: var StateCache): HashSet[ValidatorIndex] =
|
stateCache: var StateCache): HashSet[ValidatorIndex] =
|
||||||
|
@ -32,7 +32,7 @@ func get_attesting_indices*(
|
||||||
result = result.union(get_attesting_indices(
|
result = result.union(get_attesting_indices(
|
||||||
state, a.data, a.aggregation_bits, stateCache))
|
state, a.data, a.aggregation_bits, stateCache))
|
||||||
|
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.9.4/specs/core/0_beacon-chain.md#helper-functions-1
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.10.1/specs/phase0/beacon-chain.md#helper-functions-1
|
||||||
func get_unslashed_attesting_indices*(
|
func get_unslashed_attesting_indices*(
|
||||||
state: BeaconState, attestations: openarray[PendingAttestation],
|
state: BeaconState, attestations: openarray[PendingAttestation],
|
||||||
stateCache: var StateCache): HashSet[ValidatorIndex] =
|
stateCache: var StateCache): HashSet[ValidatorIndex] =
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright (c) 2018-2019 Status Research & Development GmbH
|
# Copyright (c) 2018-2020 Status Research & Development GmbH
|
||||||
# Licensed and distributed under either of
|
# Licensed and distributed under either of
|
||||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||||
|
@ -146,7 +146,7 @@ func get_empty_per_epoch_cache*(): StateCache =
|
||||||
initTable[Epoch, seq[ValidatorIndex]]()
|
initTable[Epoch, seq[ValidatorIndex]]()
|
||||||
result.committee_count_cache = initTable[Epoch, uint64]()
|
result.committee_count_cache = initTable[Epoch, uint64]()
|
||||||
|
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/specs/core/0_beacon-chain.md#compute_proposer_index
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.10.1/specs/phase0/beacon-chain.md#compute_proposer_index
|
||||||
func compute_proposer_index(state: BeaconState, indices: seq[ValidatorIndex],
|
func compute_proposer_index(state: BeaconState, indices: seq[ValidatorIndex],
|
||||||
seed: Eth2Digest, stateCache: var StateCache): Option[ValidatorIndex] =
|
seed: Eth2Digest, stateCache: var StateCache): Option[ValidatorIndex] =
|
||||||
# Return from ``indices`` a random index sampled by effective balance.
|
# Return from ``indices`` a random index sampled by effective balance.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# beacon_chain
|
# beacon_chain
|
||||||
# Copyright (c) 2018-2019 Status Research & Development GmbH
|
# Copyright (c) 2018-2020 Status Research & Development GmbH
|
||||||
# Licensed and distributed under either of
|
# Licensed and distributed under either of
|
||||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||||
|
@ -44,7 +44,7 @@ declareGauge beacon_previous_validators, """Number of status="pending|active|exi
|
||||||
# Canonical state transition functions
|
# Canonical state transition functions
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
|
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/specs/core/0_beacon-chain.md#beacon-chain-state-transition-function
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.10.1/specs/phase0/beacon-chain.md#beacon-chain-state-transition-function
|
||||||
func process_slot*(state: var BeaconState) {.nbench.}=
|
func process_slot*(state: var BeaconState) {.nbench.}=
|
||||||
# Cache state root
|
# Cache state root
|
||||||
let previous_state_root = hash_tree_root(state)
|
let previous_state_root = hash_tree_root(state)
|
||||||
|
@ -81,7 +81,7 @@ func get_epoch_validator_count(state: BeaconState): int64 =
|
||||||
validator.withdrawable_epoch > get_current_epoch(state):
|
validator.withdrawable_epoch > get_current_epoch(state):
|
||||||
result += 1
|
result += 1
|
||||||
|
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/specs/core/0_beacon-chain.md#beacon-chain-state-transition-function
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.10.1/specs/phase0/beacon-chain.md#beacon-chain-state-transition-function
|
||||||
proc process_slots*(state: var BeaconState, slot: Slot) {.nbench.}=
|
proc process_slots*(state: var BeaconState, slot: Slot) {.nbench.}=
|
||||||
doAssert state.slot <= slot
|
doAssert state.slot <= slot
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 0328f9d525c74e14f36a5a63408b699483376f82
|
Subproject commit 1359bab0ae93cec24183e7ae8dd12be3b8275198
|
|
@ -122,5 +122,5 @@ proc checkConfig() =
|
||||||
else:
|
else:
|
||||||
check: ConstsToCheck[constant] == value.getBiggestInt().uint64()
|
check: ConstsToCheck[constant] == value.getBiggestInt().uint64()
|
||||||
|
|
||||||
suite "Official - 0.10.0 - constants & config " & preset():
|
suite "Official - 0.10.1 - constants & config " & preset():
|
||||||
checkConfig()
|
checkConfig()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# beacon_chain
|
# beacon_chain
|
||||||
# Copyright (c) 2018-2019 Status Research & Development GmbH
|
# Copyright (c) 2018-2020 Status Research & Development GmbH
|
||||||
# Licensed and distributed under either of
|
# Licensed and distributed under either of
|
||||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||||
|
@ -104,5 +104,5 @@ proc runSSZtests() =
|
||||||
else:
|
else:
|
||||||
raise newException(ValueError, "Unsupported test: " & sszType)
|
raise newException(ValueError, "Unsupported test: " & sszType)
|
||||||
|
|
||||||
suite "Official - 0.10.0 - SSZ consensus objects " & preset():
|
suite "Official - 0.10.1 - SSZ consensus objects " & preset():
|
||||||
runSSZtests()
|
runSSZtests()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# beacon_chain
|
# beacon_chain
|
||||||
# Copyright (c) 2018 Status Research & Development GmbH
|
# Copyright (c) 2018-2020 Status Research & Development GmbH
|
||||||
# Licensed and distributed under either of
|
# Licensed and distributed under either of
|
||||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||||
|
|
Loading…
Reference in New Issue