mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-23 13:00:34 +00:00
v1.1.6 spec updates (minor, mostly URLs) (#3197)
This commit is contained in:
parent
6f75262a03
commit
36ade1c1c6
@ -511,7 +511,7 @@ proc validateAttestation*(
|
||||
|
||||
return ok((validator_index, sig))
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/p2p-interface.md#beacon_aggregate_and_proof
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/phase0/p2p-interface.md#beacon_aggregate_and_proof
|
||||
proc validateAggregate*(
|
||||
pool: ref AttestationPool,
|
||||
batchCrypto: ref BatchCrypto,
|
||||
@ -544,14 +544,6 @@ proc validateAggregate*(
|
||||
if v.isErr():
|
||||
return err(v.error())
|
||||
|
||||
# [IGNORE] The valid aggregate attestation defined by
|
||||
# hash_tree_root(aggregate) has not already been seen (via aggregate gossip,
|
||||
# within a verified block, or through the creation of an equivalent aggregate
|
||||
# locally).
|
||||
#
|
||||
# This is [IGNORE] and already checked by attestation pool when aggregate is
|
||||
# added.
|
||||
|
||||
# [IGNORE] The aggregate is the first valid aggregate received for the
|
||||
# aggregator with index aggregate_and_proof.aggregator_index for the epoch
|
||||
# aggregate.data.target.epoch.
|
||||
|
@ -24,7 +24,7 @@ import
|
||||
nimcrypto/utils
|
||||
|
||||
const
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.4/specs/merge/beacon-chain.md#execution
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/merge/beacon-chain.md#execution
|
||||
MAX_BYTES_PER_TRANSACTION* = 1073741824
|
||||
BYTES_PER_LOGS_BLOOM = 256
|
||||
MAX_EXTRA_DATA_BYTES = 32
|
||||
@ -162,7 +162,7 @@ type
|
||||
data*: BeaconState
|
||||
root*: Eth2Digest # hash_tree_root(data)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#beaconblock
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/phase0/beacon-chain.md#beaconblock
|
||||
BeaconBlock* = object
|
||||
## For each slot, a proposer is chosen from the validator pool to propose
|
||||
## a new block. Once the block as been proposed, it is transmitted to
|
||||
|
@ -48,7 +48,7 @@ template epoch*(slot: Slot): Epoch =
|
||||
template isEpoch*(slot: Slot): bool =
|
||||
(slot mod SLOTS_PER_EPOCH) == 0
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.5/ssz/merkle-proofs.md#generalized_index_sibling
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.6/ssz/merkle-proofs.md#generalized_index_sibling
|
||||
template generalized_index_sibling*(
|
||||
index: GeneralizedIndex): GeneralizedIndex =
|
||||
index xor 1.GeneralizedIndex
|
||||
@ -61,7 +61,7 @@ template generalized_index_sibling_right(
|
||||
index: GeneralizedIndex): GeneralizedIndex =
|
||||
index or 1.GeneralizedIndex
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.2/ssz/merkle-proofs.md#generalized_index_parent
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.6/ssz/merkle-proofs.md#generalized_index_parent
|
||||
template generalized_index_parent*(
|
||||
index: GeneralizedIndex): GeneralizedIndex =
|
||||
index shr 1
|
||||
@ -86,7 +86,7 @@ iterator get_path_indices*(
|
||||
yield index
|
||||
index = generalized_index_parent(index)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.5/ssz/merkle-proofs.md#merkle-multiproofs
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.6/ssz/merkle-proofs.md#merkle-multiproofs
|
||||
func get_helper_indices*(
|
||||
indices: openArray[GeneralizedIndex]): seq[GeneralizedIndex] =
|
||||
## Get the generalized indices of all "extra" chunks in the tree needed
|
||||
@ -506,8 +506,8 @@ func get_subtree_index*(idx: GeneralizedIndex): uint64 =
|
||||
doAssert idx > 0
|
||||
uint64(idx mod (type(idx)(1) shl log2trunc(idx)))
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.5/specs/merge/beacon-chain.md#is_merge_complete
|
||||
func is_merge_complete*(state: merge.BeaconState): bool =
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/merge/beacon-chain.md#is_merge_transition_complete
|
||||
func is_merge_transition_complete*(state: merge.BeaconState): bool =
|
||||
state.latest_execution_payload_header != default(ExecutionPayloadHeader)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.5/specs/merge/beacon-chain.md#is_merge_block
|
||||
@ -515,7 +515,7 @@ func is_merge_block(
|
||||
state: merge.BeaconState,
|
||||
body: merge.BeaconBlockBody | merge.TrustedBeaconBlockBody |
|
||||
merge.SigVerifiedBeaconBlockBody): bool =
|
||||
not is_merge_complete(state) and
|
||||
not is_merge_transition_complete(state) and
|
||||
body.execution_payload != default(merge.ExecutionPayload)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.5/specs/merge/beacon-chain.md#is_execution_enabled
|
||||
@ -523,7 +523,7 @@ func is_execution_enabled*(
|
||||
state: merge.BeaconState,
|
||||
body: merge.BeaconBlockBody | merge.TrustedBeaconBlockBody |
|
||||
merge.SigVerifiedBeaconBlockBody): bool =
|
||||
is_merge_block(state, body) or is_merge_complete(state)
|
||||
is_merge_block(state, body) or is_merge_transition_complete(state)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/merge/beacon-chain.md#compute_timestamp_at_slot
|
||||
func compute_timestamp_at_slot*(state: ForkyBeaconState, slot: Slot): uint64 =
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Minimal preset - Altair
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.5/presets/minimal/altair.yaml
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.6/presets/minimal/altair.yaml
|
||||
const
|
||||
# Updated penalty values
|
||||
# ---------------------------------------------------------------
|
||||
|
@ -494,7 +494,7 @@ proc process_execution_payload*(
|
||||
execute_payload: ExecutePayload): Result[void, cstring] =
|
||||
## Verify consistency of the parent hash with respect to the previous
|
||||
## execution payload header
|
||||
if is_merge_complete(state):
|
||||
if is_merge_transition_complete(state):
|
||||
if not (payload.parent_hash ==
|
||||
state.latest_execution_payload_header.block_hash):
|
||||
return err("process_execution_payload: payload and state parent hash mismatch")
|
||||
|
@ -43,7 +43,7 @@ func sign_block(state: ForkyBeaconState, blck: var ForkySignedBeaconBlock) =
|
||||
blck.root,
|
||||
privkey).toValidatorSig()
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.5/tests/core/pyspec/eth2spec/test/helpers/execution_payload.py#L1-L31
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.6/tests/core/pyspec/eth2spec/test/helpers/execution_payload.py#L1-L31
|
||||
func build_empty_execution_payload(state: merge.BeaconState): ExecutionPayload =
|
||||
## Assuming a pre-state of the same slot, build a valid ExecutionPayload
|
||||
## without any transactions.
|
||||
@ -70,7 +70,7 @@ func build_empty_execution_payload(state: merge.BeaconState): ExecutionPayload =
|
||||
|
||||
payload
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.5/tests/core/pyspec/eth2spec/test/helpers/block.py#L75-L104
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.6/tests/core/pyspec/eth2spec/test/helpers/block.py#L75-L104
|
||||
proc mockBlock*(
|
||||
state: ForkedHashedBeaconState,
|
||||
slot: Slot,
|
||||
@ -110,7 +110,7 @@ proc mockBlock*(
|
||||
|
||||
sign_block(state.data, blck)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.5/tests/core/pyspec/eth2spec/test/helpers/block.py#L107-L108
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.6/tests/core/pyspec/eth2spec/test/helpers/block.py#L107-L108
|
||||
proc mockBlockForNextSlot*(
|
||||
state: ForkedHashedBeaconState): ForkedSignedBeaconBlock =
|
||||
## Mock a BeaconBlock for the next slot
|
||||
|
Loading…
x
Reference in New Issue
Block a user