some spec refs to v1.1.3 (#3032)
This commit is contained in:
parent
8307e9c601
commit
968a5b3bec
|
@ -44,8 +44,8 @@ func decrease_balance*(
|
|||
if delta != 0: # avoid dirtying the balance cache if not needed
|
||||
decrease_balance(state.balances[index], delta)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#deposits
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/altair/beacon-chain.md#modified-process_deposit
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/beacon-chain.md#deposits
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/altair/beacon-chain.md#modified-process_deposit
|
||||
func get_validator_from_deposit*(deposit: DepositData):
|
||||
Validator =
|
||||
let
|
||||
|
@ -710,7 +710,7 @@ proc get_next_sync_committee*(state: altair.BeaconState | merge.BeaconState):
|
|||
res.aggregate_pubkey = finish(attestersAgg).toPubKey()
|
||||
res
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/altair/fork.md#upgrading-the-state
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/altair/fork.md#upgrading-the-state
|
||||
func translate_participation(
|
||||
state: var altair.BeaconState,
|
||||
pending_attestations: openArray[phase0.PendingAttestation]) =
|
||||
|
|
|
@ -344,7 +344,7 @@ type
|
|||
message*: VoluntaryExit
|
||||
signature*: TrustedSig
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#beaconblockheader
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/beacon-chain.md#beaconblockheader
|
||||
BeaconBlockHeader* = object
|
||||
slot*: Slot
|
||||
proposer_index*: uint64
|
||||
|
|
|
@ -94,7 +94,7 @@ type
|
|||
total_difficulty*: Eth2Digest # uint256
|
||||
difficulty*: Eth2Digest # uint256
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0-beta.4/specs/merge/beacon-chain.md#beaconstate
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/merge/beacon-chain.md#beaconstate
|
||||
BeaconState* = object
|
||||
# Versioning
|
||||
genesis_time*: uint64
|
||||
|
|
|
@ -24,7 +24,7 @@ import
|
|||
export
|
||||
phase0, altair, eth2_merkleization, ssz_codec
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#integer_squareroot
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/beacon-chain.md#integer_squareroot
|
||||
func integer_squareroot*(n: SomeInteger): SomeInteger =
|
||||
## Return the largest integer ``x`` such that ``x**2 <= n``.
|
||||
doAssert n >= 0'u64
|
||||
|
@ -299,7 +299,7 @@ func is_valid_merkle_branch*(leaf: Eth2Digest, branch: openArray[Eth2Digest],
|
|||
value = eth2digest(buf)
|
||||
value == root
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0-beta.4/tests/core/pyspec/eth2spec/test/helpers/merkle.py#L4-L21
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/tests/core/pyspec/eth2spec/test/helpers/merkle.py#L4-L21
|
||||
func build_proof_impl(anchor: object, leaf_index: uint64,
|
||||
proof: var openArray[Eth2Digest]) =
|
||||
let
|
||||
|
|
|
@ -74,7 +74,7 @@ proc apply_light_client_update(snapshot: var LightClientSnapshot, update: LightC
|
|||
snapshot.next_sync_committee = update.next_sync_committee
|
||||
snapshot.header = update.header
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0-beta.3/specs/altair/sync-protocol.md#process_light_client_update
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/altair/sync-protocol.md#process_light_client_update
|
||||
proc process_light_client_update*(store: var LightClientStore,
|
||||
update: LightClientUpdate,
|
||||
current_slot: Slot,
|
||||
|
|
|
@ -82,7 +82,7 @@ func compute_block_root*(
|
|||
fork, DOMAIN_BEACON_PROPOSER, epoch, genesis_validators_root)
|
||||
compute_signing_root(root, domain)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/validator.md#signature
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/validator.md#signature
|
||||
func get_block_signature*(
|
||||
fork: Fork, genesis_validators_root: Eth2Digest, slot: Slot,
|
||||
root: Eth2Digest, privkey: ValidatorPrivKey): CookedSig =
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||
|
||||
# State transition - block processing, as described in
|
||||
# https://github.com/ethereum/consensus-specs/blob/master/specs/core/0_beacon-chain.md#beacon-chain-state-transition-function
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/beacon-chain.md#block-processing
|
||||
#
|
||||
# The entry point is `process_block` which is at the bottom of this file.
|
||||
#
|
||||
|
@ -191,7 +191,7 @@ func is_slashable_attestation_data(
|
|||
(data_1.source.epoch < data_2.source.epoch and
|
||||
data_2.target.epoch < data_1.target.epoch)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#attester-slashings
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/beacon-chain.md#attester-slashings
|
||||
proc check_attester_slashing*(
|
||||
state: var SomeBeaconState,
|
||||
attester_slashing: SomeAttesterSlashing,
|
||||
|
@ -377,7 +377,7 @@ proc process_voluntary_exit*(
|
|||
cache)
|
||||
ok()
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#operations
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/beacon-chain.md#operations
|
||||
proc process_operations(cfg: RuntimeConfig,
|
||||
state: var SomeBeaconState,
|
||||
body: SomeSomeBeaconBlockBody,
|
||||
|
@ -501,7 +501,7 @@ func is_valid_gas_limit(
|
|||
|
||||
true
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0-beta.4/specs/merge/beacon-chain.md#process_execution_payload
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/merge/beacon-chain.md#process_execution_payload
|
||||
proc process_execution_payload*(
|
||||
state: var merge.BeaconState, payload: ExecutionPayload,
|
||||
execute_payload: ExecutePayload): Result[void, cstring] {.nbench.} =
|
||||
|
|
|
@ -795,7 +795,7 @@ func process_registry_updates*(
|
|||
compute_activation_exit_epoch(get_current_epoch(state))
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/beacon-chain.md#slashings
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0-beta.4/specs/altair/beacon-chain.md#slashings
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/altair/beacon-chain.md#slashings
|
||||
func process_slashings*(state: var SomeBeaconState, total_balance: Gwei) {.nbench.} =
|
||||
let
|
||||
epoch = get_current_epoch(state)
|
||||
|
|
|
@ -239,7 +239,7 @@ func compute_committee_len*(
|
|||
|
||||
(slice.b - slice.a + 1).uint64
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#get_beacon_committee
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/beacon-chain.md#get_beacon_committee
|
||||
iterator get_beacon_committee*(
|
||||
state: SomeBeaconState, slot: Slot, index: CommitteeIndex,
|
||||
cache: var StateCache): ValidatorIndex =
|
||||
|
@ -346,7 +346,7 @@ func compute_proposer_index(state: SomeBeaconState,
|
|||
return some(candidate_index)
|
||||
i += 1
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#get_beacon_proposer_index
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/beacon-chain.md#get_beacon_proposer_index
|
||||
func get_beacon_proposer_index*(
|
||||
state: SomeBeaconState, cache: var StateCache, slot: Slot):
|
||||
Option[ValidatorIndex] =
|
||||
|
|
|
@ -7,7 +7,7 @@ This is a WIP document to explain the attestation flows.
|
|||
It is important to distinguish attestation `validation` from attestation `verification`.
|
||||
- Attestation `validation` is defined in the P2P specs. Validated attestations can be forwarded on GossipSub.
|
||||
- Aggregated: https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/p2p-interface.md#beacon_aggregate_and_proof
|
||||
- Unaggregated: https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/p2p-interface.md#beacon_attestation_subnet_id
|
||||
- Unaggregated: https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/p2p-interface.md#beacon_attestation_subnet_id
|
||||
- Attestation `verification` is defined in the consensus specs. Verified attestations can affect fork choice and may be included in a block.
|
||||
- https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/beacon-chain.md#attestations
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ Important distinction:
|
|||
https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/p2p-interface.md#beacon_block.
|
||||
A validated block can be forwarded on gossipsub.
|
||||
- and we distinguish `verification` which is defined in consensus specs:
|
||||
https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#block-processing
|
||||
https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/beacon-chain.md#block-processing
|
||||
A block needs to be verified to enter fork choice, the DAG and the BeaconChainDB
|
||||
|
||||
In particular in terms of costly checks validating a block only requires checking:
|
||||
|
|
|
@ -207,7 +207,7 @@ suite "Ethereum Foundation - Altair - Unittests - Sync protocol" & preset():
|
|||
len(store.valid_updates) == 0
|
||||
store.snapshot.header == update.header
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/tests/core/pyspec/eth2spec/test/altair/unittests/test_sync_protocol.py#L150-L221
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/tests/core/pyspec/eth2spec/test/altair/unittests/test_sync_protocol.py#L150-L218
|
||||
test "process_light_client_update_finality_updated":
|
||||
var forked = assignClone(genesisState[])
|
||||
template state: untyped {.inject.} = forked[].altairData.data
|
||||
|
|
|
@ -32,7 +32,7 @@ func apply_randao_reveal(
|
|||
blck.message.slot.compute_epoch_at_slot,
|
||||
privkey).toValidatorSig()
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.2/tests/core/pyspec/eth2spec/test/helpers/block.py#L38-L54
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/tests/core/pyspec/eth2spec/test/helpers/block.py#L38-L54
|
||||
func sign_block(
|
||||
state: SomeBeaconState,
|
||||
blck: var (phase0.SignedBeaconBlock | altair.SignedBeaconBlock |
|
||||
|
|
|
@ -169,7 +169,7 @@ func makeAttestationData*(
|
|||
"Computed epoch was " & $slot.compute_epoch_at_slot &
|
||||
" while the state current_epoch was " & $current_epoch
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/validator.md#attestation-data
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/validator.md#attestation-data
|
||||
AttestationData(
|
||||
slot: slot,
|
||||
index: committee_index.uint64,
|
||||
|
|
Loading…
Reference in New Issue