mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-10 22:36:01 +00:00
consensus spec ref URL update to v1.3.0-rc.5 (#4837)
This commit is contained in:
parent
45f89f1205
commit
4643a357ef
@ -52,7 +52,7 @@ This [guide](https://nimbus.guide/migration.html) will take you through the basi
|
|||||||
## Related projects
|
## Related projects
|
||||||
|
|
||||||
* [status-im/nimbus-eth1](https://github.com/status-im/nimbus-eth1/): Nimbus for Ethereum 1
|
* [status-im/nimbus-eth1](https://github.com/status-im/nimbus-eth1/): Nimbus for Ethereum 1
|
||||||
* [ethereum/consensus-specs](https://github.com/ethereum/consensus-specs/tree/v1.2.0-rc.1#phase-0): Consensus specification that this project implements
|
* [ethereum/consensus-specs](https://github.com/ethereum/consensus-specs/tree/v1.3.0-rc.5#stable-specifications): Consensus specification that this project implements
|
||||||
|
|
||||||
You can check where the beacon chain fits in the Ethereum ecosystem in our Two-Point-Oh series: https://our.status.im/tag/two-point-oh/
|
You can check where the beacon chain fits in the Ethereum ecosystem in our Two-Point-Oh series: https://our.status.im/tag/two-point-oh/
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ func get_validator_from_deposit*(deposit: DepositData):
|
|||||||
effective_balance: effective_balance
|
effective_balance: effective_balance
|
||||||
)
|
)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/phase0/beacon-chain.md#compute_activation_exit_epoch
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/phase0/beacon-chain.md#compute_activation_exit_epoch
|
||||||
func compute_activation_exit_epoch*(epoch: Epoch): Epoch =
|
func compute_activation_exit_epoch*(epoch: Epoch): Epoch =
|
||||||
## Return the epoch during which validator activations and exits initiated in
|
## Return the epoch during which validator activations and exits initiated in
|
||||||
## ``epoch`` take effect.
|
## ``epoch`` take effect.
|
||||||
@ -286,7 +286,7 @@ func get_initial_beacon_block*(state: ForkedHashedBeaconState):
|
|||||||
withState(state):
|
withState(state):
|
||||||
ForkedTrustedSignedBeaconBlock.init(get_initial_beacon_block(forkyState))
|
ForkedTrustedSignedBeaconBlock.init(get_initial_beacon_block(forkyState))
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/phase0/beacon-chain.md#get_block_root_at_slot
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/phase0/beacon-chain.md#get_block_root_at_slot
|
||||||
func get_block_root_at_slot*(state: ForkyBeaconState, slot: Slot): Eth2Digest =
|
func get_block_root_at_slot*(state: ForkyBeaconState, slot: Slot): Eth2Digest =
|
||||||
## Return the block root at a recent ``slot``.
|
## Return the block root at a recent ``slot``.
|
||||||
|
|
||||||
@ -1201,7 +1201,7 @@ func upgrade_to_bellatrix*(cfg: RuntimeConfig, pre: altair.BeaconState):
|
|||||||
latest_execution_payload_header: default(bellatrix.ExecutionPayloadHeader)
|
latest_execution_payload_header: default(bellatrix.ExecutionPayloadHeader)
|
||||||
)
|
)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/capella/fork.md#upgrading-the-state
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/capella/fork.md#upgrading-the-state
|
||||||
func upgrade_to_capella*(cfg: RuntimeConfig, pre: bellatrix.BeaconState):
|
func upgrade_to_capella*(cfg: RuntimeConfig, pre: bellatrix.BeaconState):
|
||||||
ref capella.BeaconState =
|
ref capella.BeaconState =
|
||||||
let
|
let
|
||||||
@ -1279,6 +1279,9 @@ func upgrade_to_capella*(cfg: RuntimeConfig, pre: bellatrix.BeaconState):
|
|||||||
# Withdrawals
|
# Withdrawals
|
||||||
next_withdrawal_index: 0,
|
next_withdrawal_index: 0,
|
||||||
next_withdrawal_validator_index: 0
|
next_withdrawal_validator_index: 0
|
||||||
|
|
||||||
|
# Deep history valid from Capella onwards [New in Capella]
|
||||||
|
# historical_summaries initialized to correct default automatically
|
||||||
)
|
)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/deneb/fork.md#upgrading-the-state
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/deneb/fork.md#upgrading-the-state
|
||||||
|
@ -203,7 +203,7 @@ func finish*(agg: AggregateSignature): CookedSig {.inline.} =
|
|||||||
sig.finish(agg)
|
sig.finish(agg)
|
||||||
CookedSig(sig)
|
CookedSig(sig)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/phase0/beacon-chain.md#bls-signatures
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/phase0/beacon-chain.md#bls-signatures
|
||||||
func blsVerify*(
|
func blsVerify*(
|
||||||
pubkey: CookedPubKey, message: openArray[byte],
|
pubkey: CookedPubKey, message: openArray[byte],
|
||||||
signature: CookedSig): bool =
|
signature: CookedSig): bool =
|
||||||
|
@ -472,7 +472,7 @@ type
|
|||||||
# [New in Altair]
|
# [New in Altair]
|
||||||
sync_aggregate*: TrustedSyncAggregate
|
sync_aggregate*: TrustedSyncAggregate
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/phase0/beacon-chain.md#signedbeaconblock
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/phase0/beacon-chain.md#signedbeaconblock
|
||||||
SignedBeaconBlock* = object
|
SignedBeaconBlock* = object
|
||||||
message*: BeaconBlock
|
message*: BeaconBlock
|
||||||
signature*: ValidatorSig
|
signature*: ValidatorSig
|
||||||
|
@ -126,7 +126,7 @@ template maxSize*(n: int) {.pragma.}
|
|||||||
# - broke the compiler in SSZ and nim-serialization
|
# - broke the compiler in SSZ and nim-serialization
|
||||||
|
|
||||||
type
|
type
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/phase0/beacon-chain.md#custom-types
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/phase0/beacon-chain.md#custom-types
|
||||||
Eth2Domain* = array[32, byte]
|
Eth2Domain* = array[32, byte]
|
||||||
|
|
||||||
ValidatorIndex* = distinct uint32
|
ValidatorIndex* = distinct uint32
|
||||||
@ -275,7 +275,7 @@ type
|
|||||||
# if the deposit should be added or not during processing
|
# if the deposit should be added or not during processing
|
||||||
signature*: ValidatorSig # Signing over DepositMessage
|
signature*: ValidatorSig # Signing over DepositMessage
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/phase0/beacon-chain.md#voluntaryexit
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/phase0/beacon-chain.md#voluntaryexit
|
||||||
VoluntaryExit* = object
|
VoluntaryExit* = object
|
||||||
epoch*: Epoch
|
epoch*: Epoch
|
||||||
## Earliest epoch when voluntary exit can be processed
|
## Earliest epoch when voluntary exit can be processed
|
||||||
|
@ -203,7 +203,7 @@ func compute_deposit_signing_root*(
|
|||||||
domain = compute_domain(DOMAIN_DEPOSIT, version)
|
domain = compute_domain(DOMAIN_DEPOSIT, version)
|
||||||
compute_signing_root(deposit_message, domain)
|
compute_signing_root(deposit_message, domain)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/phase0/beacon-chain.md#deposits
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/phase0/beacon-chain.md#deposits
|
||||||
func get_deposit_signature*(preset: RuntimeConfig,
|
func get_deposit_signature*(preset: RuntimeConfig,
|
||||||
deposit: DepositData,
|
deposit: DepositData,
|
||||||
privkey: ValidatorPrivKey): CookedSig =
|
privkey: ValidatorPrivKey): CookedSig =
|
||||||
|
@ -331,7 +331,7 @@ proc process_deposit*(cfg: RuntimeConfig,
|
|||||||
|
|
||||||
ok()
|
ok()
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/phase0/beacon-chain.md#voluntary-exits
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/phase0/beacon-chain.md#voluntary-exits
|
||||||
proc check_voluntary_exit*(
|
proc check_voluntary_exit*(
|
||||||
cfg: RuntimeConfig,
|
cfg: RuntimeConfig,
|
||||||
state: ForkyBeaconState,
|
state: ForkyBeaconState,
|
||||||
@ -380,7 +380,7 @@ proc check_voluntary_exit*(
|
|||||||
withState(state):
|
withState(state):
|
||||||
check_voluntary_exit(cfg, forkyState.data, signed_voluntary_exit, flags)
|
check_voluntary_exit(cfg, forkyState.data, signed_voluntary_exit, flags)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/phase0/beacon-chain.md#voluntary-exits
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/phase0/beacon-chain.md#voluntary-exits
|
||||||
proc process_voluntary_exit*(
|
proc process_voluntary_exit*(
|
||||||
cfg: RuntimeConfig,
|
cfg: RuntimeConfig,
|
||||||
state: var ForkyBeaconState,
|
state: var ForkyBeaconState,
|
||||||
@ -780,7 +780,7 @@ func is_data_available(
|
|||||||
|
|
||||||
true
|
true
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/phase0/beacon-chain.md#block-processing
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/phase0/beacon-chain.md#block-processing
|
||||||
# TODO workaround for https://github.com/nim-lang/Nim/issues/18095
|
# TODO workaround for https://github.com/nim-lang/Nim/issues/18095
|
||||||
# copy of datatypes/phase0.nim
|
# copy of datatypes/phase0.nim
|
||||||
type SomePhase0Block =
|
type SomePhase0Block =
|
||||||
@ -800,7 +800,7 @@ proc process_block*(
|
|||||||
|
|
||||||
ok()
|
ok()
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/altair/beacon-chain.md#block-processing
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/altair/beacon-chain.md#block-processing
|
||||||
# TODO workaround for https://github.com/nim-lang/Nim/issues/18095
|
# TODO workaround for https://github.com/nim-lang/Nim/issues/18095
|
||||||
# copy of datatypes/altair.nim
|
# copy of datatypes/altair.nim
|
||||||
type SomeAltairBlock =
|
type SomeAltairBlock =
|
||||||
|
@ -6,8 +6,10 @@
|
|||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
# State transition - epoch processing, as described in
|
# State transition - epoch processing, as described in
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/phase0/beacon-chain.md#epoch-processing and
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/phase0/beacon-chain.md#epoch-processing
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/altair/beacon-chain.md#epoch-processing
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/altair/beacon-chain.md#epoch-processing
|
||||||
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/bellatrix/beacon-chain.md#epoch-processing
|
||||||
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/capella/beacon-chain.md#epoch-processing
|
||||||
#
|
#
|
||||||
# The entry point is `process_epoch`, which is at the bottom of this file.
|
# The entry point is `process_epoch`, which is at the bottom of this file.
|
||||||
#
|
#
|
||||||
@ -653,7 +655,7 @@ func get_flag_index_reward*(
|
|||||||
else:
|
else:
|
||||||
0.Gwei
|
0.Gwei
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/altair/beacon-chain.md#get_flag_index_deltas
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/altair/beacon-chain.md#get_flag_index_deltas
|
||||||
func get_unslashed_participating_increment*(
|
func get_unslashed_participating_increment*(
|
||||||
info: altair.EpochInfo | bellatrix.BeaconState, flag_index: int): Gwei =
|
info: altair.EpochInfo | bellatrix.BeaconState, flag_index: int): Gwei =
|
||||||
info.balances.previous_epoch[flag_index] div EFFECTIVE_BALANCE_INCREMENT
|
info.balances.previous_epoch[flag_index] div EFFECTIVE_BALANCE_INCREMENT
|
||||||
@ -970,7 +972,7 @@ func process_randao_mixes_reset*(state: var ForkyBeaconState) =
|
|||||||
func compute_historical_root*(state: var ForkyBeaconState): Eth2Digest =
|
func compute_historical_root*(state: var ForkyBeaconState): Eth2Digest =
|
||||||
# Equivalent to hash_tree_root(foo: HistoricalBatch), but without using
|
# Equivalent to hash_tree_root(foo: HistoricalBatch), but without using
|
||||||
# significant additional stack or heap.
|
# significant additional stack or heap.
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/phase0/beacon-chain.md#historicalbatch
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/phase0/beacon-chain.md#historicalbatch
|
||||||
# In response to https://github.com/status-im/nimbus-eth2/issues/921
|
# In response to https://github.com/status-im/nimbus-eth2/issues/921
|
||||||
hash_tree_root([
|
hash_tree_root([
|
||||||
hash_tree_root(state.block_roots), hash_tree_root(state.state_roots)])
|
hash_tree_root(state.block_roots), hash_tree_root(state.state_roots)])
|
||||||
@ -995,7 +997,7 @@ func process_participation_record_updates*(state: var phase0.BeaconState) =
|
|||||||
state.previous_epoch_attestations.clear()
|
state.previous_epoch_attestations.clear()
|
||||||
swap(state.previous_epoch_attestations, state.current_epoch_attestations)
|
swap(state.previous_epoch_attestations, state.current_epoch_attestations)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/altair/beacon-chain.md#participation-flags-updates
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/altair/beacon-chain.md#participation-flags-updates
|
||||||
func process_participation_flag_updates*(
|
func process_participation_flag_updates*(
|
||||||
state: var (altair.BeaconState | bellatrix.BeaconState |
|
state: var (altair.BeaconState | bellatrix.BeaconState |
|
||||||
capella.BeaconState | deneb.BeaconState)) =
|
capella.BeaconState | deneb.BeaconState)) =
|
||||||
@ -1009,7 +1011,7 @@ func process_participation_flag_updates*(
|
|||||||
# grows. New elements are automatically initialized to 0, as required.
|
# grows. New elements are automatically initialized to 0, as required.
|
||||||
doAssert state.current_epoch_participation.asList.setLen(state.validators.len)
|
doAssert state.current_epoch_participation.asList.setLen(state.validators.len)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/altair/beacon-chain.md#sync-committee-updates
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/altair/beacon-chain.md#sync-committee-updates
|
||||||
func process_sync_committee_updates*(
|
func process_sync_committee_updates*(
|
||||||
state: var (altair.BeaconState | bellatrix.BeaconState |
|
state: var (altair.BeaconState | bellatrix.BeaconState |
|
||||||
capella.BeaconState | deneb.BeaconState)) =
|
capella.BeaconState | deneb.BeaconState)) =
|
||||||
@ -1055,7 +1057,7 @@ func process_inactivity_updates*(
|
|||||||
if pre_inactivity_score != inactivity_score:
|
if pre_inactivity_score != inactivity_score:
|
||||||
state.inactivity_scores[index] = inactivity_score
|
state.inactivity_scores[index] = inactivity_score
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/capella/beacon-chain.md#historical-summaries-updates
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/capella/beacon-chain.md#historical-summaries-updates
|
||||||
func process_historical_summaries_update*(
|
func process_historical_summaries_update*(
|
||||||
state: var (capella.BeaconState | deneb.BeaconState)):
|
state: var (capella.BeaconState | deneb.BeaconState)):
|
||||||
Result[void, cstring] =
|
Result[void, cstring] =
|
||||||
@ -1130,7 +1132,7 @@ func init*(
|
|||||||
deneb.BeaconState): T =
|
deneb.BeaconState): T =
|
||||||
init(result, state)
|
init(result, state)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/altair/beacon-chain.md#epoch-processing
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/altair/beacon-chain.md#epoch-processing
|
||||||
proc process_epoch*(
|
proc process_epoch*(
|
||||||
cfg: RuntimeConfig,
|
cfg: RuntimeConfig,
|
||||||
state: var (altair.BeaconState | bellatrix.BeaconState),
|
state: var (altair.BeaconState | bellatrix.BeaconState),
|
||||||
|
@ -1070,7 +1070,7 @@ proc handleAttestations(node: BeaconNode, head: BlockRef, slot: Slot) =
|
|||||||
# We need to run attestations exactly for the slot that we're attesting to.
|
# We need to run attestations exactly for the slot that we're attesting to.
|
||||||
# In case blocks went missing, this means advancing past the latest block
|
# In case blocks went missing, this means advancing past the latest block
|
||||||
# using empty slots as fillers.
|
# using empty slots as fillers.
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.4/specs/phase0/validator.md#validator-assignments
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/phase0/validator.md#validator-assignments
|
||||||
let
|
let
|
||||||
epochRef = node.dag.getEpochRef(
|
epochRef = node.dag.getEpochRef(
|
||||||
attestationHead.blck, slot.epoch, false).valueOr:
|
attestationHead.blck, slot.epoch, false).valueOr:
|
||||||
@ -1269,7 +1269,7 @@ proc signAndSendAggregate(
|
|||||||
return
|
return
|
||||||
res.get()
|
res.get()
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.4/specs/phase0/validator.md#aggregation-selection
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/phase0/validator.md#aggregation-selection
|
||||||
if not is_aggregator(
|
if not is_aggregator(
|
||||||
shufflingRef, slot, committee_index, selectionProof):
|
shufflingRef, slot, committee_index, selectionProof):
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user