update Validator to 0.8.0; update/refactor deposit contract/etc to constants category; mark process_rewards_and_penalties(...) as 0.8.0
This commit is contained in:
parent
607a7de5eb
commit
dc98ffb09b
|
@ -280,31 +280,28 @@ type
|
|||
eth1_data_votes*: seq[Eth1Data]
|
||||
deposit_index*: uint64
|
||||
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#validator
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.8.0/specs/core/0_beacon-chain.md#validator
|
||||
Validator* = object
|
||||
pubkey*: ValidatorPubKey ##\
|
||||
## BLS public key
|
||||
pubkey*: ValidatorPubKey
|
||||
|
||||
withdrawal_credentials*: Eth2Digest ##\
|
||||
## Withdrawal credentials
|
||||
## Commitment to pubkey for withdrawals and transfers
|
||||
|
||||
activation_eligibility_epoch*: Epoch ##\
|
||||
## Epoch when validator activated
|
||||
|
||||
activation_epoch*: Epoch ##\
|
||||
## Epoch when validator activated
|
||||
|
||||
exit_epoch*: Epoch ##\
|
||||
## Epoch when validator exited
|
||||
|
||||
withdrawable_epoch*: Epoch ##\
|
||||
## Epoch when validator is eligible to withdraw
|
||||
effective_balance*: uint64 ##\
|
||||
## Balance at stake
|
||||
|
||||
slashed*: bool ##\
|
||||
## Was the validator slashed
|
||||
|
||||
effective_balance*: uint64 ##\
|
||||
## Effective balance
|
||||
# Status epochs
|
||||
activation_eligibility_epoch*: Epoch ##\
|
||||
## When criteria for activation were met
|
||||
|
||||
activation_epoch*: Epoch
|
||||
exit_epoch*: Epoch
|
||||
|
||||
withdrawable_epoch*: Epoch ##\
|
||||
## When validator can withdraw or transfer funds
|
||||
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.8.0/specs/core/0_beacon-chain.md#crosslink
|
||||
Crosslink* = object
|
||||
|
|
|
@ -26,7 +26,7 @@ type
|
|||
const
|
||||
# Misc
|
||||
# ---------------------------------------------------------------
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#misc
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.8.0/specs/core/0_beacon-chain.md#misc
|
||||
|
||||
SHARD_COUNT* {.intdefine.} = 1024 ##\
|
||||
## Number of shards supported by the network - validators will jump around
|
||||
|
@ -51,16 +51,11 @@ const
|
|||
|
||||
CHURN_LIMIT_QUOTIENT* = 2^16
|
||||
|
||||
BASE_REWARDS_PER_EPOCH* = 5
|
||||
|
||||
SHUFFLE_ROUND_COUNT* = 90
|
||||
|
||||
# Deposit contract
|
||||
# ---------------------------------------------------------------
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/configs/constant_presets/mainnet.yaml#L24
|
||||
|
||||
DEPOSIT_CONTRACT_ADDRESS = "0x1234567890123456789012345678901234567890"
|
||||
# TODO
|
||||
# Constants (TODO: not actually configurable)
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.8.0/specs/core/0_beacon-chain.md#constants
|
||||
BASE_REWARDS_PER_EPOCH* = 5
|
||||
|
||||
DEPOSIT_CONTRACT_TREE_DEPTH* = 32
|
||||
|
||||
|
|
|
@ -41,10 +41,10 @@ const
|
|||
# Changed
|
||||
SHUFFLE_ROUND_COUNT* = 10
|
||||
|
||||
# Deposit contract
|
||||
# Constants
|
||||
# ---------------------------------------------------------------
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#deposit-contract
|
||||
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.8.0/specs/core/0_beacon-chain.md#constants
|
||||
# TODO "The following values are (non-configurable) constants" ...
|
||||
# Unchanged
|
||||
DEPOSIT_CONTRACT_TREE_DEPTH* = 32
|
||||
|
||||
|
|
|
@ -346,7 +346,7 @@ func get_crosslink_deltas(state: BeaconState, cache: var StateCache):
|
|||
|
||||
(rewards, penalties)
|
||||
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#rewards-and-penalties-1
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.8.0/specs/core/0_beacon-chain.md#rewards-and-penalties-1
|
||||
func process_rewards_and_penalties(
|
||||
state: var BeaconState, cache: var StateCache) =
|
||||
if get_current_epoch(state) == GENESIS_EPOCH:
|
||||
|
@ -447,7 +447,7 @@ func processEpoch*(state: var BeaconState) =
|
|||
# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#rewards-and-penalties-1
|
||||
process_rewards_and_penalties(state, per_epoch_cache)
|
||||
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#registry-updates
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.8.0/specs/core/0_beacon-chain.md#registry-updates
|
||||
# Don't rely on caching here.
|
||||
process_registry_updates(state)
|
||||
|
||||
|
|
Loading…
Reference in New Issue