Update everything to latest spec change from July 21
This commit is contained in:
parent
65dbb086d1
commit
2438aaada8
|
@ -5,14 +5,17 @@
|
|||
# * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0).
|
||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||
|
||||
import intsets, stint, eth_common
|
||||
import intsets, eth_common, math
|
||||
|
||||
# Implementation based on WIP spec https://notes.ethereum.org/SCIg8AH5SA-O4C1G1LYZHQ?view
|
||||
# ⚠ Spec is updated very often, implementation might quickly be outdated
|
||||
|
||||
type
|
||||
AttestationVote* = object
|
||||
# Implementation pending https://ethresear.ch/t/implementations-of-proof-of-concept-beacon-chains/2509/5?u=mratsim
|
||||
|
||||
Keccak256_Digest* = distinct Hash256
|
||||
Blake2_256_Digest* = distinct Hash256
|
||||
Keccak256_Digest* = distinct Hash256 # TODO, previously Keccak256 fields used the "bytes" type
|
||||
Blake2_256_Digest* = distinct Hash256 # while Blake2 used hash32, but latest spec changed everything to hash32
|
||||
|
||||
BeaconBlock* = object
|
||||
parentHash*: Keccak256_Digest # Hash of the parent block
|
||||
|
@ -46,11 +49,11 @@ type
|
|||
activeValidators: seq[ValidatorRecord] # List of active validators
|
||||
queuedValidators: seq[ValidatorRecord] # List of joined but not yet inducted validators
|
||||
exitedValidators: seq[ValidatorRecord] # List of removed validators pending withdrawal
|
||||
curEpochShuffling: seq[int32] #int24 # The permutation of validators used to determine who cross-links what shard in this epoch
|
||||
currentEpoch: int64 # The current epoch
|
||||
currentEpochShuffling: seq[int32] #int24 # The permutation of validators used to determine who cross-links what shard in this epoch
|
||||
lastJustifiedEpoch: int64 # The last justified epoch
|
||||
lastFinalizedEpoch: int64 # The last finalized epoch
|
||||
dynasty: int64 # The current dynasty
|
||||
current_dynasty: int64 # The current dynasty
|
||||
next_shard: int16 # The next shard that cross-linking assignment will start from
|
||||
currentCheckpoint: Keccak256_Digest # The current FFG checkpoint
|
||||
crosslinkRecords: seq[CrosslinkRecord] # Records about the most recent crosslink `for each shard
|
||||
|
@ -73,3 +76,13 @@ type
|
|||
CrosslinkRecord* = object
|
||||
epoch: int64 # What epoch the crosslink was submitted in
|
||||
hash: Keccak256_Digest # The block hash
|
||||
|
||||
const
|
||||
ShardCount* = 1024 # a constant referring to the number of shards
|
||||
EthSupplyCap* = 2^27 # ~= 134 million
|
||||
DepositSize* = 32 # You need to deposit 32 ETH to be a validator in Casper
|
||||
MaxValidatorCount* = EthSupplyCap div DepositSize # 4_194_304
|
||||
EpochLength* = 64 # blocks
|
||||
SlotDuration* = 8 # seconds
|
||||
MinCommitteeSize* = 128 # (rationale: see recommended minimum 111 here https://vitalik.ca/files/Ithaca201807_Sharding.pdf)
|
||||
EndEpochGracePeriod = 8 # blocks
|
||||
|
|
Loading…
Reference in New Issue