mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-24 05:22:03 +00:00
mark get_attestation_data_slot(...), ProposerSlashing, AttesterSlashing, DepositData, BeaconBlock, Eth1Data, AttestationDataAndCustodyBit, and is_slashable_attestation_data(...) as 0.8.0; add Checkpoint object type
This commit is contained in:
parent
fa39eb82c4
commit
95dea4c165
@ -253,15 +253,16 @@ func get_initial_beacon_block*(state: BeaconState): BeaconBlock =
|
|||||||
# initialized to default values.
|
# initialized to default values.
|
||||||
)
|
)
|
||||||
|
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#get_attestation_data_slot
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.8.0/specs/core/0_beacon-chain.md#get_attestation_data_slot
|
||||||
func get_attestation_data_slot*(state: BeaconState,
|
func get_attestation_data_slot*(state: BeaconState,
|
||||||
data: AttestationData, committee_count: uint64): Slot =
|
data: AttestationData, committee_count: uint64): Slot =
|
||||||
|
# Return the slot corresponding to the attestation ``data``.
|
||||||
let
|
let
|
||||||
offset = (data.crosslink.shard + SHARD_COUNT -
|
offset = (data.crosslink.shard + SHARD_COUNT -
|
||||||
get_start_shard(state, data.target_epoch)) mod SHARD_COUNT
|
get_start_shard(state, data.target_epoch)) mod SHARD_COUNT
|
||||||
|
|
||||||
compute_start_slot_of_epoch(data.target_epoch) + offset div
|
(compute_start_slot_of_epoch(data.target_epoch) + offset div
|
||||||
(committee_count div SLOTS_PER_EPOCH)
|
(committee_count div SLOTS_PER_EPOCH)).Slot
|
||||||
|
|
||||||
# This is the slower (O(n)), spec-compatible signature.
|
# This is the slower (O(n)), spec-compatible signature.
|
||||||
func get_attestation_data_slot*(state: BeaconState,
|
func get_attestation_data_slot*(state: BeaconState,
|
||||||
|
@ -74,7 +74,7 @@ type
|
|||||||
Gwei* = uint64
|
Gwei* = uint64
|
||||||
Domain* = uint64
|
Domain* = uint64
|
||||||
|
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#proposerslashing
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.8.0/specs/core/0_beacon-chain.md#proposerslashing
|
||||||
ProposerSlashing* = object
|
ProposerSlashing* = object
|
||||||
proposer_index*: uint64 ##\
|
proposer_index*: uint64 ##\
|
||||||
## Proposer index
|
## Proposer index
|
||||||
@ -85,7 +85,7 @@ type
|
|||||||
header_2*: BeaconBlockHeader ##\
|
header_2*: BeaconBlockHeader ##\
|
||||||
# Second block header
|
# Second block header
|
||||||
|
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#attesterslashing
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.8.0/specs/core/0_beacon-chain.md#attesterslashing
|
||||||
AttesterSlashing* = object
|
AttesterSlashing* = object
|
||||||
attestation_1*: IndexedAttestation ## \
|
attestation_1*: IndexedAttestation ## \
|
||||||
## First attestation
|
## First attestation
|
||||||
@ -118,6 +118,11 @@ type
|
|||||||
signature*: ValidatorSig ##\
|
signature*: ValidatorSig ##\
|
||||||
## BLS aggregate signature
|
## BLS aggregate signature
|
||||||
|
|
||||||
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.8.0/specs/core/0_beacon-chain.md#checkpoint
|
||||||
|
Checkpoint* = object
|
||||||
|
epoch*: Epoch
|
||||||
|
root*: Eth2Digest
|
||||||
|
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#attestationdata
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#attestationdata
|
||||||
AttestationData* = object
|
AttestationData* = object
|
||||||
# LMD GHOST vote
|
# LMD GHOST vote
|
||||||
@ -132,10 +137,12 @@ type
|
|||||||
# Crosslink vote
|
# Crosslink vote
|
||||||
crosslink*: Crosslink
|
crosslink*: Crosslink
|
||||||
|
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#attestationdataandcustodybit
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.8.0/specs/core/0_beacon-chain.md#attestationdataandcustodybit
|
||||||
AttestationDataAndCustodyBit* = object
|
AttestationDataAndCustodyBit* = object
|
||||||
data*: AttestationData
|
data*: AttestationData
|
||||||
custody_bit*: bool
|
|
||||||
|
custody_bit*: bool ##\
|
||||||
|
## Challengeable bit (SSZ-bool, 1 byte) for the custody of crosslink data
|
||||||
|
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.8.0/specs/core/0_beacon-chain.md#deposit
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.8.0/specs/core/0_beacon-chain.md#deposit
|
||||||
Deposit* = object
|
Deposit* = object
|
||||||
@ -144,7 +151,7 @@ type
|
|||||||
|
|
||||||
data*: DepositData
|
data*: DepositData
|
||||||
|
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#depositdata
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.8.0/specs/core/0_beacon-chain.md#depositdata
|
||||||
DepositData* = object
|
DepositData* = object
|
||||||
pubkey*: ValidatorPubKey ##\
|
pubkey*: ValidatorPubKey ##\
|
||||||
## BLS pubkey
|
## BLS pubkey
|
||||||
@ -155,6 +162,7 @@ type
|
|||||||
amount*: uint64 ##\
|
amount*: uint64 ##\
|
||||||
## Amount in Gwei
|
## Amount in Gwei
|
||||||
|
|
||||||
|
# TODO remove, not in spec
|
||||||
dummy*: uint64
|
dummy*: uint64
|
||||||
|
|
||||||
signature*: ValidatorSig ##\
|
signature*: ValidatorSig ##\
|
||||||
@ -192,7 +200,7 @@ type
|
|||||||
signature*: ValidatorSig ##\
|
signature*: ValidatorSig ##\
|
||||||
## Signature checked against withdrawal pubkey
|
## Signature checked against withdrawal pubkey
|
||||||
|
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#beaconblock
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.8.0/specs/core/0_beacon-chain.md#beaconblock
|
||||||
BeaconBlock* = object
|
BeaconBlock* = object
|
||||||
## For each slot, a proposer is chosen from the validator pool to propose
|
## 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
|
## a new block. Once the block as been proposed, it is transmitted to
|
||||||
@ -343,7 +351,7 @@ type
|
|||||||
epoch*: Epoch ##\
|
epoch*: Epoch ##\
|
||||||
## Fork epoch number
|
## Fork epoch number
|
||||||
|
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#eth1data
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.8.0/specs/core/0_beacon-chain.md#eth1data
|
||||||
Eth1Data* = object
|
Eth1Data* = object
|
||||||
deposit_root*: Eth2Digest ##\
|
deposit_root*: Eth2Digest ##\
|
||||||
## Root of the deposit tree
|
## Root of the deposit tree
|
||||||
|
@ -177,7 +177,7 @@ proc processProposerSlashings(
|
|||||||
|
|
||||||
true
|
true
|
||||||
|
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#is_slashable_attestation_data
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.8.0/specs/core/0_beacon-chain.md#is_slashable_attestation_data
|
||||||
func is_slashable_attestation_data(
|
func is_slashable_attestation_data(
|
||||||
data_1: AttestationData, data_2: AttestationData): bool =
|
data_1: AttestationData, data_2: AttestationData): bool =
|
||||||
## Check if ``data_1`` and ``data_2`` are slashable according to Casper FFG
|
## Check if ``data_1`` and ``data_2`` are slashable according to Casper FFG
|
||||||
|
Loading…
x
Reference in New Issue
Block a user