diff --git a/beacon_chain/attestation_aggregation.nim b/beacon_chain/attestation_aggregation.nim index 23f0a54a2..3aecdd5e7 100644 --- a/beacon_chain/attestation_aggregation.nim +++ b/beacon_chain/attestation_aggregation.nim @@ -1,5 +1,5 @@ # beacon_chain -# Copyright (c) 2019 Status Research & Development GmbH +# Copyright (c) 2019-2020 Status Research & Development GmbH # Licensed and distributed under either of # * MIT license (license terms in the root directory or at http://opensource.org/licenses/MIT). # * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0). @@ -75,7 +75,7 @@ proc aggregate_attestations*( # https://github.com/ethereum/eth2.0-specs/blob/v0.9.4/specs/validator/0_beacon-chain-validator.md#construct-aggregate for attestation in getAttestationsForBlock(pool, state, slot): if attestation.data == attestation_data: - # https://github.com/ethereum/eth2.0-specs/blob/v0.9.4/specs/validator/0_beacon-chain-validator.md#aggregateandproof + # https://github.com/ethereum/eth2.0-specs/blob/v0.10.0/specs/phase0/validator.md#aggregateandproof return some(AggregateAndProof( aggregator_index: index, aggregate: attestation, diff --git a/beacon_chain/interop.nim b/beacon_chain/interop.nim index 7be0482a1..cf4986f72 100644 --- a/beacon_chain/interop.nim +++ b/beacon_chain/interop.nim @@ -39,7 +39,7 @@ const eth1BlockHash* = block: for v in x.data.mitems: v = 0x42 x -# https://github.com/ethereum/eth2.0-specs/blob/v0.9.4/specs/core/0_deposit-contract.md#withdrawal-credentials +# https://github.com/ethereum/eth2.0-specs/blob/v0.10.0/specs/phase0/deposit-contract.md#withdrawal-credentials func makeWithdrawalCredentials*(k: ValidatorPubKey): Eth2Digest = var bytes = eth2hash(k.getBytes()) bytes.data[0] = BLS_WITHDRAWAL_PREFIX.uint8 diff --git a/beacon_chain/spec/datatypes.nim b/beacon_chain/spec/datatypes.nim index 897f05061..8e0d23ebe 100644 --- a/beacon_chain/spec/datatypes.nim +++ b/beacon_chain/spec/datatypes.nim @@ -90,10 +90,10 @@ type DOMAIN_DEPOSIT = 3 DOMAIN_VOLUNTARY_EXIT = 4 # Phase 1 - Custody game - # https://github.com/ethereum/eth2.0-specs/blob/v0.9.4/specs/core/1_custody-game.md#signature-domain-types + # https://github.com/ethereum/eth2.0-specs/blob/v0.10.0/specs/phase1/custody-game.md#signature-domain-types DOMAIN_CUSTODY_BIT_CHALLENGE = 6 # Phase 1 - Sharding - # https://github.com/ethereum/eth2.0-specs/blob/v0.9.4/specs/core/1_shard-data-chains.md#signature-domain-types + # https://github.com/ethereum/eth2.0-specs/blob/v0.10.0/specs/phase1/shard-data-chains.md#signature-domain-types DOMAIN_SHARD_PROPOSER = 128 DOMAIN_SHARD_ATTESTER = 129 @@ -342,7 +342,7 @@ type message*: BeaconBlockHeader signature*: ValidatorSig - # https://github.com/ethereum/eth2.0-specs/blob/v0.9.4/specs/validator/0_beacon-chain-validator.md#aggregateandproof + # https://github.com/ethereum/eth2.0-specs/blob/v0.10.0/specs/phase0/validator.md#aggregateandproof AggregateAndProof* = object aggregator_index*: uint64 aggregate*: Attestation diff --git a/beacon_chain/spec/digest.nim b/beacon_chain/spec/digest.nim index a30c993ef..4c3f6505c 100644 --- a/beacon_chain/spec/digest.nim +++ b/beacon_chain/spec/digest.nim @@ -1,5 +1,5 @@ # beacon_chain -# Copyright (c) 2018-2019 Status Research & Development GmbH +# Copyright (c) 2018-2020 Status Research & Development GmbH # Licensed and distributed under either of # * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). @@ -7,7 +7,7 @@ # Serenity hash function / digest # -# https://github.com/ethereum/eth2.0-specs/blob/v0.9.4/specs/core/0_beacon-chain.md#hash +# https://github.com/ethereum/eth2.0-specs/blob/v0.10.0/specs/phase0/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/presets/mainnet.nim b/beacon_chain/spec/presets/mainnet.nim index bd04bbbc1..139c5d478 100644 --- a/beacon_chain/spec/presets/mainnet.nim +++ b/beacon_chain/spec/presets/mainnet.nim @@ -20,7 +20,7 @@ type const # Misc # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/configs/mainnet.yaml#L6 + # https://github.com/ethereum/eth2.0-specs/blob/v0.10.0/configs/mainnet.yaml#L6 MAX_COMMITTEES_PER_SLOT* {.intdefine.} = 64 @@ -45,7 +45,7 @@ const MIN_GENESIS_ACTIVE_VALIDATOR_COUNT* {.intdefine.} = 16384 # Constants (TODO: not actually configurable) - # https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/configs/mainnet.yaml#L110 + # https://github.com/ethereum/eth2.0-specs/blob/v0.10.0/specs/phase0/beacon-chain.md#constants BASE_REWARDS_PER_EPOCH* = 4 DEPOSIT_CONTRACT_TREE_DEPTH* = 32 @@ -69,8 +69,7 @@ const # Initial values # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/configs/mainnet.yaml#L62 - + # https://github.com/ethereum/eth2.0-specs/blob/v0.10.0/configs/mainnet.yaml#L64 GENESIS_SLOT* = 0.Slot GENESIS_FORK_VERSION* = 0x00000000 BLS_WITHDRAWAL_PREFIX* = 0'u8 @@ -146,7 +145,7 @@ const # Max operations per block # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/configs/mainnet.yaml#L124 + # https://github.com/ethereum/eth2.0-specs/blob/v0.10.0/configs/mainnet.yaml#L128 MAX_PROPOSER_SLASHINGS* = 2^4 MAX_ATTESTER_SLASHINGS* = 2^0 MAX_ATTESTATIONS* = 2^7 @@ -155,12 +154,12 @@ const # Fork choice # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.9.4/configs/mainnet.yaml#L26 + # https://github.com/ethereum/eth2.0-specs/blob/v0.10.0/configs/mainnet.yaml#L26 SAFE_SLOTS_TO_UPDATE_JUSTIFIED* = 8 # 96 seconds # Validators # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.9.4/configs/mainnet.yaml#L32 + # https://github.com/ethereum/eth2.0-specs/blob/v0.10.0/configs/mainnet.yaml#L32 ETH1_FOLLOW_DISTANCE* = 1024 # blocks ~ 4 hours TARGET_AGGREGATORS_PER_COMMITTEE* = 16 # validators RANDOM_SUBNETS_PER_VALIDATOR* = 1 # subnet @@ -169,7 +168,7 @@ const # Phase 1 - Sharding # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.9.4/specs/core/1_shard-data-chains.md#time-parameters + # https://github.com/ethereum/eth2.0-specs/blob/v0.10.0/specs/phase1/shard-data-chains.md#time-parameters # TODO those are included in minimal.yaml but not mainnet.yaml # Why? # SHARD_SLOTS_PER_BEACON_SLOT* = 2 # spec: SHARD_SLOTS_PER_EPOCH @@ -179,7 +178,7 @@ const # Phase 1 - Custody game # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.9.4/specs/core/1_custody-game.md#constants + # https://github.com/ethereum/eth2.0-specs/blob/v0.10.0/specs/phase1/custody-game.md#constants # TODO those are included in minimal.yaml but not mainnet.yaml # Why? # EARLY_DERIVED_SECRET_PENALTY_MAX_FUTURE_EPOCHS* = 4096 # epochs diff --git a/beacon_chain/spec/presets/minimal.nim b/beacon_chain/spec/presets/minimal.nim index 88cf6aded..a083d128d 100644 --- a/beacon_chain/spec/presets/minimal.nim +++ b/beacon_chain/spec/presets/minimal.nim @@ -38,7 +38,7 @@ const # Constants # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.9.4/specs/core/0_beacon-chain.md#constants + # https://github.com/ethereum/eth2.0-specs/blob/v0.10.0/specs/phase0/beacon-chain.md#constants # TODO "The following values are (non-configurable) constants" ... # Unchanged BASE_REWARDS_PER_EPOCH* = 4 @@ -66,7 +66,7 @@ const # Time parameters # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/configs/minimal.yaml#L69 + # https://github.com/ethereum/eth2.0-specs/blob/v0.10.0/configs/minimal.yaml#L71 # Changed: Faster to spin up testnets, but does not give validator # reasonable warning time for genesis MIN_GENESIS_DELAY* = 300 @@ -128,7 +128,7 @@ const # Fork choice # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.9.4/configs/minimal.yaml#L26 + # https://github.com/ethereum/eth2.0-specs/blob/v0.10.0/configs/minimal.yaml#L26 # Changed SAFE_SLOTS_TO_UPDATE_JUSTIFIED* = 2 @@ -148,7 +148,7 @@ const # Phase 1 - Sharding # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.9.4/configs/minimal.yaml#L153 + # https://github.com/ethereum/eth2.0-specs/blob/v0.10.0/configs/minimal.yaml#L157 # TODO those are included in minimal.yaml but not mainnet.yaml # Why? SHARD_SLOTS_PER_BEACON_SLOT* = 2 # spec: SHARD_SLOTS_PER_EPOCH diff --git a/beacon_chain/spec/state_transition_block.nim b/beacon_chain/spec/state_transition_block.nim index 16601ed67..beb2825ac 100644 --- a/beacon_chain/spec/state_transition_block.nim +++ b/beacon_chain/spec/state_transition_block.nim @@ -44,7 +44,7 @@ declareGauge beacon_previous_live_validators, "Number of active validators that declareGauge beacon_pending_deposits, "Number of pending deposits (state.eth1_data.deposit_count - state.eth1_deposit_index)" # On block declareGauge beacon_processed_deposits_total, "Number of total deposits included on chain" # On block -# https://github.com/ethereum/eth2.0-specs/blob/v0.9.4/specs/core/0_beacon-chain.md#block-header +# https://github.com/ethereum/eth2.0-specs/blob/v0.10.0/specs/phase0/beacon-chain.md#block-header proc process_block_header*( state: var BeaconState, blck: BeaconBlock, flags: UpdateFlags, stateCache: var StateCache): bool {.nbench.}= @@ -125,14 +125,14 @@ proc process_randao( true -# https://github.com/ethereum/eth2.0-specs/blob/v0.9.4/specs/core/0_beacon-chain.md#eth1-data +# https://github.com/ethereum/eth2.0-specs/blob/v0.10.0/specs/phase0/beacon-chain.md#eth1-data func process_eth1_data(state: var BeaconState, body: BeaconBlockBody) {.nbench.}= state.eth1_data_votes.add body.eth1_data if state.eth1_data_votes.count(body.eth1_data) * 2 > SLOTS_PER_ETH1_VOTING_PERIOD: state.eth1_data = body.eth1_data -# https://github.com/ethereum/eth2.0-specs/blob/v0.9.4/specs/core/0_beacon-chain.md#is_slashable_validator +# https://github.com/ethereum/eth2.0-specs/blob/v0.10.0/specs/phase0/beacon-chain.md#is_slashable_validator func is_slashable_validator(validator: Validator, epoch: Epoch): bool = # Check if ``validator`` is slashable. (not validator.slashed) and @@ -201,7 +201,7 @@ proc processProposerSlashings( true -# https://github.com/ethereum/eth2.0-specs/blob/v0.9.4/specs/core/0_beacon-chain.md#is_slashable_attestation_data +# https://github.com/ethereum/eth2.0-specs/blob/v0.10.0/specs/phase0/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 diff --git a/beacon_chain/spec/state_transition_epoch.nim b/beacon_chain/spec/state_transition_epoch.nim index 2e2daa9a8..5b5c3b370 100644 --- a/beacon_chain/spec/state_transition_epoch.nim +++ b/beacon_chain/spec/state_transition_epoch.nim @@ -140,11 +140,11 @@ proc process_justification_and_finalization*( ## matter -- in the next epoch, they'll be 2 epochs old, when BeaconState ## tracks current_epoch_attestations and previous_epoch_attestations only ## per - ## https://github.com/ethereum/eth2.0-specs/blob/v0.9.4/specs/core/0_beacon-chain.md#attestations + ## https://github.com/ethereum/eth2.0-specs/blob/v0.10.0/specs/phase0/beacon-chain.md#attestations ## and `get_matching_source_attestations(...)` via - ## https://github.com/ethereum/eth2.0-specs/blob/v0.9.4/specs/core/0_beacon-chain.md#helper-functions-1 + ## https://github.com/ethereum/eth2.0-specs/blob/v0.10.0/specs/phase0/beacon-chain.md#helper-functions-1 ## and - ## https://github.com/ethereum/eth2.0-specs/blob/v0.9.4/specs/core/0_beacon-chain.md#final-updates + ## https://github.com/ethereum/eth2.0-specs/blob/v0.10.0/specs/phase0/beacon-chain.md#final-updates ## after which the state.previous_epoch_attestations is replaced. trace "Non-attesting indices in previous epoch", missing_all_validators= @@ -338,7 +338,7 @@ func get_attestation_deltas(state: BeaconState, stateCache: var StateCache): (rewards, penalties) -# https://github.com/ethereum/eth2.0-specs/blob/v0.9.4/specs/core/0_beacon-chain.md#rewards-and-penalties-1 +# https://github.com/ethereum/eth2.0-specs/blob/v0.10.0/specs/phase0/beacon-chain.md#rewards-and-penalties-1 func process_rewards_and_penalties( state: var BeaconState, cache: var StateCache) {.nbench.}= if get_current_epoch(state) == GENESIS_EPOCH: @@ -425,7 +425,7 @@ proc process_epoch*(state: var BeaconState) {.nbench.}= # https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/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.9.4/specs/core/0_beacon-chain.md#registry-updates + # https://github.com/ethereum/eth2.0-specs/blob/v0.10.0/specs/phase0/beacon-chain.md#registry-updates # Don't rely on caching here. process_registry_updates(state) diff --git a/beacon_chain/spec/validator.nim b/beacon_chain/spec/validator.nim index 09b302488..fcb48495b 100644 --- a/beacon_chain/spec/validator.nim +++ b/beacon_chain/spec/validator.nim @@ -78,7 +78,7 @@ func get_shuffled_seq*(seed: Eth2Digest, result = shuffled_active_validator_indices -# https://github.com/ethereum/eth2.0-specs/blob/v0.9.4/specs/core/0_beacon-chain.md#get_previous_epoch +# https://github.com/ethereum/eth2.0-specs/blob/v0.10.0/specs/phase0/beacon-chain.md#get_previous_epoch func get_previous_epoch*(state: BeaconState): Epoch = # Return the previous epoch (unless the current epoch is ``GENESIS_EPOCH``). let current_epoch = get_current_epoch(state) diff --git a/beacon_chain/time.nim b/beacon_chain/time.nim index 8942c2501..c77fa9225 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.9.4/specs/core/0_fork-choice.md#fork-choice + ## https://github.com/ethereum/eth2.0-specs/blob/v0.10.0/specs/phase0/fork-choice.md#fork-choice ## # TODO replace time in chronos with a proper unit type, then this code can # follow: