update 24 v0.11.x spec refs to v0.12.1
This commit is contained in:
parent
8fbbd59885
commit
ffca27b45f
|
@ -290,7 +290,7 @@ proc isValidBeaconBlock*(
|
|||
# for the slot, signed_beacon_block.message.slot.
|
||||
#
|
||||
# While this condition is similar to the proposer slashing condition at
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/validator.md#proposer-slashing
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/validator.md#proposer-slashing
|
||||
# it's not identical, and this check does not address slashing:
|
||||
#
|
||||
# (1) The beacon blocks must be conflicting, i.e. different, for the same
|
||||
|
|
|
@ -101,7 +101,7 @@ func voting_period_start_time*(state: BeaconState): uint64 =
|
|||
state.slot - state.slot mod SLOTS_PER_ETH1_VOTING_PERIOD.uint64
|
||||
compute_time_at_slot(state, eth1_voting_period_start_slot)
|
||||
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/validator.md#get_eth1_data
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/validator.md#get_eth1_data
|
||||
func is_candidate_block(blk: Eth1Block, period_start: uint64): bool =
|
||||
(blk.timestamp + SECONDS_PER_ETH1_BLOCK.uint64 * ETH1_FOLLOW_DISTANCE.uint64 <= period_start) and
|
||||
(blk.timestamp + SECONDS_PER_ETH1_BLOCK.uint64 * ETH1_FOLLOW_DISTANCE.uint64 * 2 >= period_start)
|
||||
|
|
|
@ -111,7 +111,7 @@ template maxSize*(n: int) {.pragma.}
|
|||
type
|
||||
# Domains
|
||||
# ---------------------------------------------------------------
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.11.3/specs/phase0/beacon-chain.md#domain-types
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/beacon-chain.md#domain-types
|
||||
DomainType* = enum
|
||||
DOMAIN_BEACON_PROPOSER = 0
|
||||
DOMAIN_BEACON_ATTESTER = 1
|
||||
|
@ -121,12 +121,12 @@ type
|
|||
DOMAIN_SELECTION_PROOF = 5
|
||||
DOMAIN_AGGREGATE_AND_PROOF = 6
|
||||
# Phase 1 - Sharding
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.11.2/specs/phase1/beacon-chain.md#misc
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase1/beacon-chain.md#misc
|
||||
DOMAIN_SHARD_PROPOSAL = 128
|
||||
DOMAIN_SHARD_COMMITTEE = 129
|
||||
DOMAIN_LIGHT_CLIENT = 130
|
||||
# Phase 1 - Custody game
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.11.2/specs/phase1/custody-game.md#signature-domain-types
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase1/custody-game.md#signature-domain-types
|
||||
DOMAIN_CUSTODY_BIT_SLASHING = 0x83
|
||||
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.11.3/specs/phase0/beacon-chain.md#custom-types
|
||||
|
@ -153,7 +153,7 @@ type
|
|||
attestation_1*: IndexedAttestation
|
||||
attestation_2*: IndexedAttestation
|
||||
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.11.3/specs/phase0/beacon-chain.md#indexedattestation
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/beacon-chain.md#indexedattestation
|
||||
IndexedAttestation* = object
|
||||
# TODO ValidatorIndex, but that doesn't serialize properly
|
||||
attesting_indices*: List[uint64, MAX_VALIDATORS_PER_COMMITTEE]
|
||||
|
@ -176,7 +176,7 @@ type
|
|||
current_version*: Version
|
||||
genesis_validators_root*: Eth2Digest
|
||||
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.11.3/specs/phase0/beacon-chain.md#checkpoint
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/beacon-chain.md#checkpoint
|
||||
Checkpoint* = object
|
||||
epoch*: Epoch
|
||||
root*: Eth2Digest
|
||||
|
@ -216,7 +216,7 @@ type
|
|||
amount*: Gwei
|
||||
signature*: ValidatorSig # Signing over DepositMessage
|
||||
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.11.3/specs/phase0/beacon-chain.md#voluntaryexit
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/beacon-chain.md#voluntaryexit
|
||||
VoluntaryExit* = object
|
||||
epoch*: Epoch ##\
|
||||
## Earliest epoch when voluntary exit can be processed
|
||||
|
@ -342,7 +342,7 @@ type
|
|||
withdrawable_epoch*: Epoch ##\
|
||||
## When validator can withdraw or transfer funds
|
||||
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.11.3/specs/phase0/beacon-chain.md#pendingattestation
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/beacon-chain.md#pendingattestation
|
||||
PendingAttestation* = object
|
||||
aggregation_bits*: CommitteeValidatorsBits
|
||||
data*: AttestationData
|
||||
|
@ -352,7 +352,7 @@ type
|
|||
|
||||
proposer_index*: uint64
|
||||
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.11.3/specs/phase0/beacon-chain.md#historicalbatch
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/beacon-chain.md#historicalbatch
|
||||
HistoricalBatch* = object
|
||||
block_roots* : array[SLOTS_PER_HISTORICAL_ROOT, Eth2Digest]
|
||||
state_roots* : array[SLOTS_PER_HISTORICAL_ROOT, Eth2Digest]
|
||||
|
@ -394,7 +394,7 @@ type
|
|||
aggregate*: Attestation
|
||||
selection_proof*: ValidatorSig
|
||||
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.11.2/specs/phase0/validator.md#signedaggregateandproof
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/validator.md#signedaggregateandproof
|
||||
SignedAggregateAndProof* = object
|
||||
message*: AggregateAndProof
|
||||
signature*: ValidatorSig
|
||||
|
|
|
@ -377,7 +377,7 @@ proc generateCredentials*(entropy: openarray[byte] = @[],
|
|||
let mnemonic = generateMnemonic(englishWords, entropy)
|
||||
restoreCredentials(mnemonic, password)
|
||||
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/deposit-contract.md#withdrawal-credentials
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/deposit-contract.md#withdrawal-credentials
|
||||
proc makeWithdrawalCredentials*(k: ValidatorPubKey): Eth2Digest =
|
||||
var bytes = eth2digest(k.toRaw())
|
||||
bytes.data[0] = BLS_WITHDRAWAL_PREFIX.uint8
|
||||
|
|
|
@ -107,7 +107,7 @@ const
|
|||
|
||||
# Reward and penalty quotients
|
||||
# ---------------------------------------------------------------
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.11.3/configs/minimal.yaml#L117
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/configs/minimal.yaml#L117
|
||||
|
||||
BASE_REWARD_FACTOR* = 2'u64^6
|
||||
WHISTLEBLOWER_REWARD_QUOTIENT* = 2'u64^9
|
||||
|
@ -134,7 +134,7 @@ const
|
|||
|
||||
# Validators
|
||||
# ---------------------------------------------------------------
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.11.3/configs/minimal.yaml#L38
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/configs/minimal.yaml#L38
|
||||
|
||||
# Changed
|
||||
ETH1_FOLLOW_DISTANCE* = 16 # blocks
|
||||
|
@ -147,14 +147,14 @@ const
|
|||
|
||||
# Phase 1: Upgrade from Phase 0
|
||||
# ---------------------------------------------------------------
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.11.3/configs/minimal.yaml#L161
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/configs/minimal.yaml#L161
|
||||
PHASE_1_FORK_VERSION* = 16777217
|
||||
PHASE_1_GENESIS_SLOT* = 8
|
||||
INITIAL_ACTIVE_SHARDS* = 4
|
||||
|
||||
# Phase 1: General
|
||||
# ---------------------------------------------------------------
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.11.3/configs/minimal.yaml#L169
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/configs/minimal.yaml#L171
|
||||
MAX_SHARDS* = 8
|
||||
ONLINE_PERIOD* = 8 # epochs ~ 51 minutes
|
||||
LIGHT_CLIENT_COMMITTEE_SIZE* = 128
|
||||
|
@ -170,7 +170,7 @@ const
|
|||
# Phase 1 - Custody game
|
||||
# ---------------------------------------------------------------
|
||||
# Time parameters
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.11.3/configs/minimal.yaml#L202
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/configs/minimal.yaml#L202
|
||||
RANDAO_PENALTY_EPOCHS* = 2
|
||||
EARLY_DERIVED_SECRET_PENALTY_MAX_FUTURE_EPOCHS* = 4096 # epochs
|
||||
EPOCHS_PER_CUSTODY_PERIOD* = 2048
|
||||
|
@ -184,6 +184,6 @@ const
|
|||
MAX_CUSTODY_SLASHINGS* = 1
|
||||
|
||||
# Reward and penalty quotients
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.11.3/configs/minimal.yaml#L220
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/configs/minimal.yaml#L220
|
||||
EARLY_DERIVED_SECRET_REVEAL_SLOT_REWARD_MULTIPLE* = 2
|
||||
MINOR_REWARD_QUOTIENT* = 256
|
||||
|
|
|
@ -320,7 +320,7 @@ proc process_voluntary_exit*(
|
|||
|
||||
true
|
||||
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.11.3/specs/phase0/beacon-chain.md#operations
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/beacon-chain.md#operations
|
||||
proc process_operations(state: var BeaconState, body: BeaconBlockBody,
|
||||
flags: UpdateFlags, stateCache: var StateCache): bool {.nbench.} =
|
||||
# Verify that outstanding deposits are processed up to the maximum number of
|
||||
|
@ -355,7 +355,7 @@ proc process_operations(state: var BeaconState, body: BeaconBlockBody,
|
|||
|
||||
true
|
||||
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.11.3/specs/phase0/beacon-chain.md#block-processing
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/beacon-chain.md#block-processing
|
||||
proc process_block*(
|
||||
state: var BeaconState, blck: BeaconBlock, flags: UpdateFlags,
|
||||
stateCache: var StateCache): bool {.nbench.}=
|
||||
|
|
|
@ -16,7 +16,7 @@ type
|
|||
## which blocks are valid - in particular, blocks are not valid if they
|
||||
## come from the future as seen from the local clock.
|
||||
##
|
||||
## https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/fork-choice.md#fork-choice
|
||||
## https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/fork-choice.md#fork-choice
|
||||
##
|
||||
# TODO replace time in chronos with a proper unit type, then this code can
|
||||
# follow:
|
||||
|
|
|
@ -111,7 +111,7 @@ proc onSlotStart(vc: ValidatorClient, lastSlot, scheduledSlot: Slot) {.gcsafe, a
|
|||
|
||||
discard await vc.client.post_v1_beacon_blocks(newBlock)
|
||||
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/validator.md#attesting
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/validator.md#attesting
|
||||
# A validator should create and broadcast the attestation to the associated
|
||||
# attestation subnet when either (a) the validator has received a valid
|
||||
# block from the expected block proposer for the assigned slot or
|
||||
|
|
|
@ -454,7 +454,7 @@ proc handleValidatorDuties*(
|
|||
# with any clock discrepancies once only, at the start of slot timer
|
||||
# processing..
|
||||
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/validator.md#attesting
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/validator.md#attesting
|
||||
# A validator should create and broadcast the attestation to the associated
|
||||
# attestation subnet when either (a) the validator has received a valid
|
||||
# block from the expected block proposer for the assigned slot or
|
||||
|
@ -470,7 +470,7 @@ proc handleValidatorDuties*(
|
|||
|
||||
handleAttestations(node, head, slot)
|
||||
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/validator.md#broadcast-aggregate
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/validator.md#broadcast-aggregate
|
||||
# If the validator is selected to aggregate (is_aggregator), then they
|
||||
# broadcast their best aggregate as a SignedAggregateAndProof to the global
|
||||
# aggregate channel (beacon_aggregate_and_proof) two-thirds of the way
|
||||
|
|
Loading…
Reference in New Issue