From 13381c8feae78f74d8c0ed8abf0810879b8b117c Mon Sep 17 00:00:00 2001 From: Dustin Brody Date: Tue, 18 Jun 2019 15:34:30 +0000 Subject: [PATCH] update everything https://github.com/ethereum/eth2.0-specs/releases/tag/v0.7.1 leaves unchanged from v0.7.0 to v0.7.1 (#290) --- beacon_chain/spec/beaconstate.nim | 30 ++++++++++---------- beacon_chain/spec/bitfield.nim | 4 +-- beacon_chain/spec/crypto.nim | 6 ++-- beacon_chain/spec/datatypes.nim | 40 +++++++++++++-------------- beacon_chain/spec/digest.nim | 2 +- beacon_chain/spec/helpers.nim | 22 +++++++-------- beacon_chain/spec/presets/mainnet.nim | 20 +++++++------- beacon_chain/spec/presets/minimal.nim | 22 +++++++-------- beacon_chain/spec/validator.nim | 16 +++++------ beacon_chain/state_transition.nim | 40 +++++++++++++-------------- beacon_chain/time.nim | 2 +- 11 files changed, 102 insertions(+), 102 deletions(-) diff --git a/beacon_chain/spec/beaconstate.nim b/beacon_chain/spec/beaconstate.nim index 77a90c92d..34f3414eb 100644 --- a/beacon_chain/spec/beaconstate.nim +++ b/beacon_chain/spec/beaconstate.nim @@ -11,7 +11,7 @@ import ./bitfield, ./crypto, ./datatypes, ./digest, ./helpers, ./validator, tables -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#verify_merkle_branch +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#verify_merkle_branch func verify_merkle_branch(leaf: Eth2Digest, proof: openarray[Eth2Digest], depth: uint64, index: uint64, root: Eth2Digest): bool = ## Verify that the given ``leaf`` is on the merkle branch ``proof`` ## starting with the given ``root``. @@ -29,13 +29,13 @@ func verify_merkle_branch(leaf: Eth2Digest, proof: openarray[Eth2Digest], depth: value = eth2hash(buf) value == root -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#increase_balance +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#increase_balance func increase_balance*( state: var BeaconState, index: ValidatorIndex, delta: Gwei) = # Increase validator balance by ``delta``. state.balances[index] += delta -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#decrease_balance +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#decrease_balance func decrease_balance*( state: var BeaconState, index: ValidatorIndex, delta: Gwei) = # Decrease validator balance by ``delta`` with underflow protection. @@ -45,7 +45,7 @@ func decrease_balance*( else: state.balances[index] - delta -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#deposits +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#deposits func process_deposit*( state: var BeaconState, deposit: Deposit, flags: UpdateFlags = {}): bool = # Process an Eth1 deposit, registering a validator or increasing its balance. @@ -102,13 +102,13 @@ func process_deposit*( true -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#get_delayed_activation_exit_epoch +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#get_delayed_activation_exit_epoch func get_delayed_activation_exit_epoch*(epoch: Epoch): Epoch = ## Return the epoch at which an activation or exit triggered in ``epoch`` ## takes effect. epoch + 1 + ACTIVATION_EXIT_DELAY -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#get_churn_limit +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#get_churn_limit func get_churn_limit(state: BeaconState): uint64 = max( MIN_PER_EPOCH_CHURN_LIMIT, @@ -116,7 +116,7 @@ func get_churn_limit(state: BeaconState): uint64 = CHURN_LIMIT_QUOTIENT ).uint64 -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#initiate_validator_exit +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#initiate_validator_exit func initiate_validator_exit*(state: var BeaconState, index: ValidatorIndex) = # Initiate the validator of the given ``index``. @@ -147,7 +147,7 @@ func initiate_validator_exit*(state: var BeaconState, validator.withdrawable_epoch = validator.exit_epoch + MIN_VALIDATOR_WITHDRAWABILITY_DELAY -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#slash_validator +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#slash_validator func slash_validator*(state: var BeaconState, slashed_index: ValidatorIndex) = # Slash the validator with index ``index``. let current_epoch = get_current_epoch(state) @@ -297,7 +297,7 @@ func get_attestation_slot*(state: BeaconState, get_attestation_slot( state, attestation, get_epoch_committee_count(state, epoch)) -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#get_block_root_at_slot +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#get_block_root_at_slot func get_block_root_at_slot*(state: BeaconState, slot: Slot): Eth2Digest = # Return the block root at a recent ``slot``. @@ -306,12 +306,12 @@ func get_block_root_at_slot*(state: BeaconState, doAssert slot < state.slot state.latest_block_roots[slot mod SLOTS_PER_HISTORICAL_ROOT] -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#get_block_root +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#get_block_root func get_block_root*(state: BeaconState, epoch: Epoch): Eth2Digest = # Return the block root at a recent ``epoch``. get_block_root_at_slot(state, get_epoch_start_slot(epoch)) -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#get_total_balance +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#get_total_balance func get_total_balance*(state: BeaconState, validators: auto): Gwei = ## Return the combined effective balance of the ``indices``. (1 Gwei minimum ## to avoid divisions by zero.) @@ -319,7 +319,7 @@ func get_total_balance*(state: BeaconState, validators: auto): Gwei = foldl(validators, a + state.validator_registry[b].effective_balance, 0'u64) ) -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#registry-updates +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#registry-updates func process_registry_updates*(state: var BeaconState) = # Process activation eligibility and ejections for index, validator in state.validator_registry: @@ -357,7 +357,7 @@ func process_registry_updates*(state: var BeaconState) = validator.activation_epoch = get_delayed_activation_exit_epoch(get_current_epoch(state)) -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#validate_indexed_attestation +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#validate_indexed_attestation func validate_indexed_attestation*( state: BeaconState, indexed_attestation: IndexedAttestation): bool = # Verify validity of ``indexed_attestation`` fields. @@ -408,7 +408,7 @@ func validate_indexed_attestation*( ), ) -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#get_attesting_indices +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#get_attesting_indices func get_attesting_indices*(state: BeaconState, attestation_data: AttestationData, bitfield: BitField): HashSet[ValidatorIndex] = @@ -439,7 +439,7 @@ iterator get_attestation_participants_cached*( for participant in get_attesting_indices(state, attestation_data, bitfield): yield participant -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#convert_to_indexed +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#convert_to_indexed func convert_to_indexed(state: BeaconState, attestation: Attestation): IndexedAttestation = # Convert ``attestation`` to (almost) indexed-verifiable form. let diff --git a/beacon_chain/spec/bitfield.nim b/beacon_chain/spec/bitfield.nim index 5b4506841..906f1db12 100644 --- a/beacon_chain/spec/bitfield.nim +++ b/beacon_chain/spec/bitfield.nim @@ -17,14 +17,14 @@ func init*(T: type BitField, bits: int): BitField = #proc readValue*(r: var JsonReader, a: var BitField) {.inline.} = # a.bits = r.readValue(string).hexToSeqByte() -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#get_bitfield_bit +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#get_bitfield_bit func get_bitfield_bit*(bitfield: BitField, i: int): bool = # Extract the bit in ``bitfield`` at position ``i``. doAssert 0 <= i div 8, "i: " & $i & " i div 8: " & $(i div 8) doAssert i div 8 < bitfield.bits.len, "i: " & $i & " i div 8: " & $(i div 8) ((bitfield.bits[i div 8] shr (i mod 8)) mod 2) > 0'u8 -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#verify_bitfield +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#verify_bitfield func verify_bitfield*(bitfield: BitField, committee_size: int): bool = # Verify ``bitfield`` against the ``committee_size``. if len(bitfield.bits) != (committee_size + 7) div 8: diff --git a/beacon_chain/spec/crypto.nim b/beacon_chain/spec/crypto.nim index 372b5058b..57653e8b2 100644 --- a/beacon_chain/spec/crypto.nim +++ b/beacon_chain/spec/crypto.nim @@ -69,7 +69,7 @@ template hash*(k: ValidatorPubKey|ValidatorPrivKey): Hash = func pubKey*(pk: ValidatorPrivKey): ValidatorPubKey = pk.getKey() -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/bls_signature.md#bls_aggregate_pubkeys +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/bls_signature.md#bls_aggregate_pubkeys func bls_aggregate_pubkeys*(keys: openArray[ValidatorPubKey]): ValidatorPubKey = var empty = true for key in keys: @@ -79,14 +79,14 @@ func bls_aggregate_pubkeys*(keys: openArray[ValidatorPubKey]): ValidatorPubKey = else: result.combine(key) -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/bls_signature.md#bls_verify +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/bls_signature.md#bls_verify func bls_verify*( pubkey: ValidatorPubKey, msg: openArray[byte], sig: ValidatorSig, domain: uint64): bool = # name from spec! sig.verify(msg, domain, pubkey) -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/bls_signature.md#bls_verify_multiple +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/bls_signature.md#bls_verify_multiple func bls_verify_multiple*( pubkeys: seq[ValidatorPubKey], message_hashes: openArray[Eth2Digest], sig: ValidatorSig, domain: uint64): bool = diff --git a/beacon_chain/spec/datatypes.nim b/beacon_chain/spec/datatypes.nim index e41fa9df1..7ea6af53e 100644 --- a/beacon_chain/spec/datatypes.nim +++ b/beacon_chain/spec/datatypes.nim @@ -53,7 +53,7 @@ else: {.fatal: "Preset \"" & const_preset ".nim\" is not supported.".} const - SPEC_VERSION* = "0.7.0" ## \ + SPEC_VERSION* = "0.7.1" ## \ ## Spec version we're aiming to be compatible with, right now ## TODO: improve this scheme once we can negotiate versions in protocol @@ -62,7 +62,7 @@ const # Initial values # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#initial-values + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#initial-values GENESIS_EPOCH* = (GENESIS_SLOT.uint64 div SLOTS_PER_EPOCH).Epoch ##\ ## slot_to_epoch(GENESIS_SLOT) ZERO_HASH* = Eth2Digest() @@ -73,7 +73,7 @@ type Shard* = uint64 Gwei* = uint64 - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#proposerslashing + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#proposerslashing ProposerSlashing* = object proposer_index*: uint64 ##\ ## Proposer index @@ -84,14 +84,14 @@ type header_2*: BeaconBlockHeader ##\ # Second block header - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#attesterslashing + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#attesterslashing AttesterSlashing* = object attestation_1*: IndexedAttestation ## \ ## First attestation attestation_2*: IndexedAttestation ## \ ## Second attestation - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#indexedattestation + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#indexedattestation IndexedAttestation* = object # These probably should be seq[ValidatorIndex], but that throws RLP errors custody_bit_0_indices*: seq[uint64] @@ -103,7 +103,7 @@ type signature*: ValidatorSig ## \ ## Aggregate signature - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#attestation + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#attestation Attestation* = object aggregation_bitfield*: BitField ##\ ## Attester aggregation bitfield @@ -134,12 +134,12 @@ type previous_crosslink_root*: Eth2Digest crosslink_data_root*: Eth2Digest - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#attestationdataandcustodybit + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#attestationdataandcustodybit AttestationDataAndCustodyBit* = object data*: AttestationData custody_bit*: bool - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#deposit + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#deposit Deposit* = object proof*: array[DEPOSIT_CONTRACT_TREE_DEPTH, Eth2Digest] ##\ ## Branch in the deposit tree @@ -147,7 +147,7 @@ type data*: DepositData ##\ ## Data - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#depositdata + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#depositdata DepositData* = object pubkey*: ValidatorPubKey ##\ ## BLS pubkey @@ -163,7 +163,7 @@ type signature*: ValidatorSig ##\ ## Container self-signature - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#voluntaryexit + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#voluntaryexit VoluntaryExit* = object # Minimum epoch for processing exit epoch*: Epoch @@ -172,7 +172,7 @@ type # Validator signature signature*: ValidatorSig - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#transfer + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#transfer Transfer* = object sender*: uint64 ##\ ## Sender index @@ -195,7 +195,7 @@ type signature*: ValidatorSig ##\ ## Sender signature - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#beaconblock + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_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 @@ -216,7 +216,7 @@ type signature*: ValidatorSig ##\ ## Proposer signature - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#beaconblockheader + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#beaconblockheader BeaconBlockHeader* = object slot*: Slot parent_root*: Eth2Digest @@ -224,7 +224,7 @@ type body_root*: Eth2Digest signature*: ValidatorSig - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#beaconblockbody + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#beaconblockbody BeaconBlockBody* = object randao_reveal*: ValidatorSig eth1_data*: Eth1Data @@ -236,7 +236,7 @@ type voluntary_exits*: seq[VoluntaryExit] transfers*: seq[Transfer] - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#beaconstate + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#beaconstate BeaconState* = object slot*: Slot genesis_time*: uint64 @@ -283,7 +283,7 @@ type eth1_data_votes*: seq[Eth1Data] deposit_index*: uint64 - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#validator + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#validator Validator* = object pubkey*: ValidatorPubKey ##\ ## BLS public key @@ -320,14 +320,14 @@ type crosslink_data_root*: Eth2Digest ##\ ## Shard data since the previous crosslink - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#pendingattestation + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#pendingattestation PendingAttestation* = object aggregation_bitfield*: BitField ## Attester participation bitfield data*: AttestationData ## Attestation data inclusion_delay*: uint64 ## Inclusion delay proposer_index*: ValidatorIndex ## Proposer index - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#historicalbatch + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#historicalbatch HistoricalBatch* = object block_roots* : array[SLOTS_PER_HISTORICAL_ROOT, Eth2Digest] ##\ ## Block roots @@ -335,7 +335,7 @@ type state_roots* : array[SLOTS_PER_HISTORICAL_ROOT, Eth2Digest] ##\ ## State roots - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#fork + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#fork Fork* = object previous_version*: array[4, byte] ##\ ## Previous fork version @@ -346,7 +346,7 @@ type epoch*: Epoch ##\ ## Fork epoch number - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#eth1data + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#eth1data Eth1Data* = object deposit_root*: Eth2Digest ##\ ## Root of the deposit tree diff --git a/beacon_chain/spec/digest.nim b/beacon_chain/spec/digest.nim index 4f20e4e37..2bea2436a 100644 --- a/beacon_chain/spec/digest.nim +++ b/beacon_chain/spec/digest.nim @@ -7,7 +7,7 @@ # Serenity hash function / digest # -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#hash +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#hash # # In Phase 0 the beacon chain is deployed with SHA256 (SHA2-256). # Note that is is different from Keccak256 (often mistakenly called SHA3-256) diff --git a/beacon_chain/spec/helpers.nim b/beacon_chain/spec/helpers.nim index bb0d180c7..f62c16ad1 100644 --- a/beacon_chain/spec/helpers.nim +++ b/beacon_chain/spec/helpers.nim @@ -9,7 +9,7 @@ import ./datatypes, ./digest, sequtils, math -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#integer_squareroot +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#integer_squareroot func integer_squareroot*(n: SomeInteger): SomeInteger = ## The largest integer ``x`` such that ``x**2`` is less than or equal to ## ``n``. @@ -58,22 +58,22 @@ func merkle_root*(values: openArray[Eth2Digest]): Eth2Digest = o[1] -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#slot_to_epoch +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#slot_to_epoch func slot_to_epoch*(slot: Slot|uint64): Epoch = # Return the epoch number of the given ``slot``. (slot div SLOTS_PER_EPOCH).Epoch -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#get_epoch_start_slot +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#get_epoch_start_slot func get_epoch_start_slot*(epoch: Epoch): Slot = # Return the starting slot of the given ``epoch``. (epoch * SLOTS_PER_EPOCH).Slot -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#is_active_validator +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#is_active_validator func is_active_validator*(validator: Validator, epoch: Epoch): bool = ### Check if ``validator`` is active validator.activation_epoch <= epoch and epoch < validator.exit_epoch -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#get_active_validator_indices +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#get_active_validator_indices func get_active_validator_indices*(state: BeaconState, epoch: Epoch): seq[ValidatorIndex] = # Get active validator indices at ``epoch``. @@ -81,7 +81,7 @@ func get_active_validator_indices*(state: BeaconState, epoch: Epoch): if is_active_validator(val, epoch): result.add idx.ValidatorIndex -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#get_epoch_committee_count +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#get_epoch_committee_count func get_epoch_committee_count*(state: BeaconState, epoch: Epoch): uint64 = # Return the number of committees at ``epoch``. let active_validator_indices = get_active_validator_indices(state, epoch) @@ -89,13 +89,13 @@ func get_epoch_committee_count*(state: BeaconState, epoch: Epoch): uint64 = len(active_validator_indices) div SLOTS_PER_EPOCH div TARGET_COMMITTEE_SIZE, 1, SHARD_COUNT div SLOTS_PER_EPOCH).uint64 * SLOTS_PER_EPOCH -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#get_current_epoch +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#get_current_epoch func get_current_epoch*(state: BeaconState): Epoch = # Return the current epoch of the given ``state``. doAssert state.slot >= GENESIS_SLOT, $state.slot slot_to_epoch(state.slot) -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#get_randao_mix +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#get_randao_mix func get_randao_mix*(state: BeaconState, epoch: Epoch): Eth2Digest = ## Returns the randao mix at a recent ``epoch``. @@ -103,7 +103,7 @@ func get_randao_mix*(state: BeaconState, ## LATEST_RANDAO_MIXES_LENGTH, current_epoch]. state.latest_randao_mixes[epoch mod LATEST_RANDAO_MIXES_LENGTH] -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#get_active_index_root +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#get_active_index_root func get_active_index_root(state: BeaconState, epoch: Epoch): Eth2Digest = # Returns the index root at a recent ``epoch``. ## ``epoch`` expected to be between @@ -112,7 +112,7 @@ func get_active_index_root(state: BeaconState, epoch: Epoch): Eth2Digest = ## intentional state.latest_active_index_roots[epoch mod LATEST_ACTIVE_INDEX_ROOTS_LENGTH] -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#bytes_to_int +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#bytes_to_int func bytes_to_int*(data: openarray[byte]): uint64 = doAssert data.len == 8 @@ -159,7 +159,7 @@ func bls_domain(domain_type: SignatureDomain, fork_version: array[4, byte]): buf[4..7] = int_to_bytes4(domain_type.uint64) bytes_to_int(buf) -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#get_domain +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#get_domain func get_domain*( state: BeaconState, domain_type: SignatureDomain, message_epoch: Epoch): uint64 = ## Return the signature domain (fork version concatenated with domain type) diff --git a/beacon_chain/spec/presets/mainnet.nim b/beacon_chain/spec/presets/mainnet.nim index 8968ea7eb..b14f44475 100644 --- a/beacon_chain/spec/presets/mainnet.nim +++ b/beacon_chain/spec/presets/mainnet.nim @@ -22,11 +22,11 @@ type {.experimental: "codeReordering".} # SLOTS_PER_EPOCH is use before being defined in spec -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/configs/constant_presets/mainnet.yaml +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/configs/constant_presets/mainnet.yaml const # Misc # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#misc + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#misc SHARD_COUNT* {.intdefine.} = 1024 ##\ ## Number of shards supported by the network - validators will jump around @@ -57,7 +57,7 @@ const # Deposit contract # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/configs/constant_presets/mainnet.yaml#L24 + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/configs/constant_presets/mainnet.yaml#L24 DEPOSIT_CONTRACT_ADDRESS = "0x1234567890123456789012345678901234567890" # TODO @@ -66,7 +66,7 @@ const # Gwei values # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#gwei-values + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#gwei-values MIN_DEPOSIT_AMOUNT* = 2'u64^0 * 10'u64^9 ##\ ## Minimum amounth of ETH that can be deposited in one call - deposits can @@ -83,7 +83,7 @@ const # Initial values # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/configs/constant_presets/mainnet.yaml#L44 + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/configs/constant_presets/mainnet.yaml#L44 GENESIS_FORK_VERSION* = [0'u8, 0'u8, 0'u8, 0'u8] GENESIS_SLOT* = 0.Slot @@ -92,7 +92,7 @@ const # Time parameters # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_fork-choice.md#time-parameters + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_fork-choice.md#time-parameters SECONDS_PER_SLOT*{.intdefine.} = 6'u64 # Compile with -d:SECONDS_PER_SLOT=1 for 6x faster slots ## TODO consistent time unit across projects, similar to C++ chrono? @@ -141,14 +141,14 @@ const # State list lengths # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#state-list-lengths + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#state-list-lengths LATEST_RANDAO_MIXES_LENGTH* = 8192 LATEST_ACTIVE_INDEX_ROOTS_LENGTH* = 8192 # 2'u64^13, epochs LATEST_SLASHED_EXIT_LENGTH* = 8192 # epochs # Reward and penalty quotients # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#rewards-and-penalties + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#rewards-and-penalties BASE_REWARD_FACTOR* = 2'u64^5 WHISTLEBLOWING_REWARD_QUOTIENT* = 2'u64^9 PROPOSER_REWARD_QUOTIENT* = 2'u64^3 @@ -157,7 +157,7 @@ const # Max operations per block # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#max-operations-per-block + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#max-operations-per-block MAX_PROPOSER_SLASHINGS* = 2^4 MAX_ATTESTER_SLASHINGS* = 2^0 MAX_ATTESTATIONS* = 2^7 @@ -168,7 +168,7 @@ const type # Signature domains # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#signature-domains + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#signature-domains SignatureDomain* {.pure.} = enum DOMAIN_BEACON_PROPOSER = 0 DOMAIN_RANDAO = 1 diff --git a/beacon_chain/spec/presets/minimal.nim b/beacon_chain/spec/presets/minimal.nim index 880b0a894..b3fb68616 100644 --- a/beacon_chain/spec/presets/minimal.nim +++ b/beacon_chain/spec/presets/minimal.nim @@ -22,11 +22,11 @@ type {.experimental: "codeReordering".} # SLOTS_PER_EPOCH is use before being defined in spec -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/configs/constant_presets/minimal.yaml +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/configs/constant_presets/minimal.yaml const # Misc # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#misc + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#misc # Changed SHARD_COUNT* {.intdefine.} = 8 @@ -43,14 +43,14 @@ const # Deposit contract # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#deposit-contract + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#deposit-contract # Unchanged DEPOSIT_CONTRACT_TREE_DEPTH* = 32 # Gwei values # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#gwei-values + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#gwei-values # Unchanged MIN_DEPOSIT_AMOUNT* = 2'u64^0 * 10'u64^9 @@ -60,7 +60,7 @@ const # Initial values # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/configs/constant_presets/minimal.yaml#L43 + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/configs/constant_presets/minimal.yaml#L43 # Unchanged GENESIS_FORK_VERSION* = [0'u8, 0'u8, 0'u8, 0'u8] @@ -70,12 +70,12 @@ const # Time parameters # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_fork-choice.md#time-parameters + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_fork-choice.md#time-parameters # Unchanged SECONDS_PER_SLOT*{.intdefine.} = 6'u64 - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#time-parameters + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#time-parameters # Unchanged MIN_ATTESTATION_INCLUSION_DELAY* = 2'u64^2 @@ -98,7 +98,7 @@ const # State list lengths # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#state-list-lengths + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#state-list-lengths # Changed LATEST_RANDAO_MIXES_LENGTH* = 64 @@ -107,7 +107,7 @@ const # Reward and penalty quotients # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#rewards-and-penalties + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#rewards-and-penalties # Unchanged BASE_REWARD_FACTOR* = 2'u64^5 @@ -118,7 +118,7 @@ const # Max operations per block # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#max-operations-per-block + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#max-operations-per-block # Unchanged MAX_PROPOSER_SLASHINGS* = 2^4 @@ -131,7 +131,7 @@ const type # Signature domains # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#signature-domains + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#signature-domains SignatureDomain* {.pure.} = enum DOMAIN_BEACON_PROPOSER = 0 DOMAIN_RANDAO = 1 diff --git a/beacon_chain/spec/validator.nim b/beacon_chain/spec/validator.nim index b78f5da68..538bf4b1d 100644 --- a/beacon_chain/spec/validator.nim +++ b/beacon_chain/spec/validator.nim @@ -13,8 +13,8 @@ import ./crypto, ./datatypes, ./digest, ./helpers # TODO: Proceed to renaming and signature changes -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#get_shuffled_index -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#compute_committee +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#get_shuffled_index +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#compute_committee func get_shuffled_seq*(seed: Eth2Digest, list_size: uint64, ): seq[ValidatorIndex] = @@ -118,7 +118,7 @@ func get_shuffled_index(index: ValidatorIndex, index_count: uint64, seed: Eth2Di if bit != 0: result = flip -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#get_previous_epoch +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#get_previous_epoch func get_previous_epoch*(state: BeaconState): Epoch = ## Return the previous epoch of the given ``state``. ## Return the current epoch if it's genesis epoch. @@ -128,14 +128,14 @@ func get_previous_epoch*(state: BeaconState): Epoch = else: current_epoch - 1 -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#get_shard_delta +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#get_shard_delta func get_shard_delta*(state: BeaconState, epoch: Epoch): uint64 = ## Return the number of shards to increment ``state.latest_start_shard`` ## during ``epoch``. min(get_epoch_committee_count(state, epoch), (SHARD_COUNT - SHARD_COUNT div SLOTS_PER_EPOCH).uint64) -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#get_epoch_start_shard +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#get_epoch_start_shard func get_epoch_start_shard*(state: BeaconState, epoch: Epoch): Shard = doAssert epoch <= get_current_epoch(state) + 1 var @@ -149,7 +149,7 @@ func get_epoch_start_shard*(state: BeaconState, epoch: Epoch): Shard = SHARD_COUNT return shard -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#compute_committee +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#compute_committee func compute_committee(indices: seq[ValidatorIndex], seed: Eth2Digest, index: uint64, count: uint64): seq[ValidatorIndex] = let @@ -161,7 +161,7 @@ func compute_committee(indices: seq[ValidatorIndex], seed: Eth2Digest, indices[ get_shuffled_index(it.ValidatorIndex, len(indices).uint64, seed).int]) -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#get_crosslink_committee +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#get_crosslink_committee func get_crosslink_committee*(state: BeaconState, epoch: Epoch, shard: Shard): seq[ValidatorIndex] = compute_committee( @@ -212,7 +212,7 @@ iterator get_crosslink_committees_at_slot_cached*( cache.crosslink_committee_cache[key] = result for v in result: yield v -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#get_beacon_proposer_index +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#get_beacon_proposer_index func get_beacon_proposer_index*(state: BeaconState): ValidatorIndex = # Return the current beacon proposer index. const diff --git a/beacon_chain/state_transition.nim b/beacon_chain/state_transition.nim index 1bb393e55..b23b34879 100644 --- a/beacon_chain/state_transition.nim +++ b/beacon_chain/state_transition.nim @@ -35,7 +35,7 @@ import ./extras, ./ssz, ./beacon_node_types, ./spec/[beaconstate, bitfield, crypto, datatypes, digest, helpers, validator] -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#block-header +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#block-header proc processBlockHeader( state: var BeaconState, blck: BeaconBlock, flags: UpdateFlags): bool = # Verify that the slots match @@ -81,7 +81,7 @@ proc processBlockHeader( true -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#randao +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#randao proc processRandao( state: var BeaconState, body: BeaconBlockBody, flags: UpdateFlags): bool = let @@ -112,14 +112,14 @@ proc processRandao( true -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#eth1-data +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#eth1-data func processEth1Data(state: var BeaconState, body: BeaconBlockBody) = state.eth1_data_votes.add body.eth1_data if state.eth1_data_votes.count(body.eth1_data) * 2 > SLOTS_PER_ETH1_VOTING_PERIOD: state.latest_eth1_data = body.eth1_data -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#is_slashable_validator +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#is_slashable_validator func is_slashable_validator(validator: Validator, epoch: Epoch): bool = # Check if ``validator`` is slashable. (not validator.slashed) and @@ -170,7 +170,7 @@ proc processProposerSlashings( true -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#is_slashable_attestation_data +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#is_slashable_attestation_data func is_slashable_attestation_data( data_1: AttestationData, data_2: AttestationData): bool = ## Check if ``data_1`` and ``data_2`` are slashable according to Casper FFG @@ -182,7 +182,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/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#attester-slashings +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#attester-slashings proc processAttesterSlashings(state: var BeaconState, blck: BeaconBlock): bool = # Process ``AttesterSlashing`` operation. if len(blck.body.attester_slashings) > MAX_ATTESTER_SLASHINGS: @@ -332,7 +332,7 @@ proc processVoluntaryExits( true -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#transfers +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#transfers proc processTransfers(state: var BeaconState, blck: BeaconBlock, flags: UpdateFlags): bool = if not (len(blck.body.transfers) <= MAX_TRANSFERS): @@ -413,7 +413,7 @@ func advance_slot(state: var BeaconState) = state.slot += 1 -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#beacon-chain-state-transition-function +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#beacon-chain-state-transition-function func process_slot(state: var BeaconState) = # Cache state root let previous_state_root = hash_tree_root(state) @@ -614,7 +614,7 @@ func get_winning_crosslink_and_attesting_indices( get_unslashed_attesting_indices(state, get_attestations_for(winning_crosslink))) -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#justification-and-finalization +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#justification-and-finalization func process_justification_and_finalization(state: var BeaconState) = if get_current_epoch(state) <= GENESIS_EPOCH + 1: return @@ -679,7 +679,7 @@ func process_justification_and_finalization(state: var BeaconState) = state.finalized_epoch = old_current_justified_epoch state.finalized_root = get_block_root(state, state.finalized_epoch) -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#crosslinks +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#crosslinks func process_crosslinks(state: var BeaconState, per_epoch_cache: var StateCache) = ## TODO is there a semantic reason for this, or is this just a way to force ## copying? If so, why not just `list(foo)` or similar? This is strange. In @@ -706,7 +706,7 @@ func process_crosslinks(state: var BeaconState, per_epoch_cache: var StateCache) 2'u64 * get_total_balance(state, crosslink_committee): state.current_crosslinks[shard] = winning_crosslink -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#rewards-and-penalties-1 +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#rewards-and-penalties-1 func get_base_reward(state: BeaconState, index: ValidatorIndex): Gwei = let total_balance = get_total_active_balance(state) @@ -812,7 +812,7 @@ func get_crosslink_deltas(state: BeaconState, cache: var StateCache): (rewards, penalties) -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#rewards-and-penalties-1 +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#rewards-and-penalties-1 func process_rewards_and_penalties( state: var BeaconState, cache: var StateCache) = if get_current_epoch(state) == GENESIS_EPOCH: @@ -825,7 +825,7 @@ func process_rewards_and_penalties( increase_balance(state, i.ValidatorIndex, rewards1[i] + rewards2[i]) decrease_balance(state, i.ValidatorIndex, penalties1[i] + penalties2[i]) -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#slashings +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#slashings func process_slashings(state: var BeaconState) = let current_epoch = get_current_epoch(state) @@ -908,24 +908,24 @@ func processEpoch(state: var BeaconState) = (state.slot + 1) mod SLOTS_PER_EPOCH == 0): return - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#justification-and-finalization + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#justification-and-finalization process_justification_and_finalization(state) var per_epoch_cache = get_empty_per_epoch_cache() - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#crosslinks + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#crosslinks process_crosslinks(state, per_epoch_cache) - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#rewards-and-penalties-1 + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#rewards-and-penalties-1 process_rewards_and_penalties(state, per_epoch_cache) - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#registry-updates + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#registry-updates process_registry_updates(state) - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#slashings + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#slashings process_slashings(state) - # https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#final-updates + # https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#final-updates process_final_updates(state) # https://github.com/ethereum/eth2.0-specs/blob/v0.6.3/specs/core/0_beacon-chain.md#state-root-verification @@ -1033,7 +1033,7 @@ proc skipSlots*(state: var BeaconState, slot: Slot, # TODO hashed versions of above - not in spec -# https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_beacon-chain.md#beacon-chain-state-transition-function +# https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_beacon-chain.md#beacon-chain-state-transition-function func process_slot(state: var HashedBeaconState) = # Cache state root let previous_slot_state_root = state.root diff --git a/beacon_chain/time.nim b/beacon_chain/time.nim index 4d7eeb78b..38b90dafd 100644 --- a/beacon_chain/time.nim +++ b/beacon_chain/time.nim @@ -14,7 +14,7 @@ type ## which blocks are valid - in particular, blocks are not valid if they ## come from the future as seen from the local clock. ## - ## https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_fork-choice.md#beacon-chain-processing + ## https://github.com/ethereum/eth2.0-specs/blob/v0.7.1/specs/core/0_fork-choice.md#beacon-chain-processing ## # TODO replace time in chronos with a proper unit type, then this code can # follow: