convert 22 v0.12.1 spec refs to v0.12.2 and remove 1 unnecessary spec ref (#1384)

This commit is contained in:
tersec 2020-07-28 14:55:46 +00:00 committed by GitHub
parent 157ddd2ac4
commit b45de824a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 22 additions and 24 deletions

View File

@ -32,7 +32,7 @@ proc aggregate_attestations*(
cache: var StateCache): Option[AggregateAndProof] = cache: var StateCache): Option[AggregateAndProof] =
doAssert state.slot >= trailing_distance doAssert state.slot >= trailing_distance
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/p2p-interface.md#configuration # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/p2p-interface.md#configuration
doAssert trailing_distance <= ATTESTATION_PROPAGATION_SLOT_RANGE doAssert trailing_distance <= ATTESTATION_PROPAGATION_SLOT_RANGE
let let
@ -65,7 +65,7 @@ proc aggregate_attestations*(
for attestation in getAttestationsForBlock(pool, state): for attestation in getAttestationsForBlock(pool, state):
# getAttestationsForBlock(...) already aggregates # getAttestationsForBlock(...) already aggregates
if attestation.data == attestation_data: if attestation.data == attestation_data:
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/validator.md#aggregateandproof # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/validator.md#aggregateandproof
return some(AggregateAndProof( return some(AggregateAndProof(
aggregator_index: index.uint64, aggregator_index: index.uint64,
aggregate: attestation, aggregate: attestation,

View File

@ -731,7 +731,6 @@ proc installAttestationHandlers(node: BeaconNode) =
proc attestationValidator(attestation: Attestation, proc attestationValidator(attestation: Attestation,
committeeIndex: uint64): bool = committeeIndex: uint64): bool =
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/p2p-interface.md#attestation-subnets
let (afterGenesis, slot) = node.beaconClock.now().toSlot() let (afterGenesis, slot) = node.beaconClock.now().toSlot()
if not afterGenesis: if not afterGenesis:
return false return false

View File

@ -391,7 +391,7 @@ type
deposit_count*: uint64 deposit_count*: uint64
block_hash*: Eth2Digest block_hash*: Eth2Digest
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/validator.md#eth1block # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/validator.md#eth1block
Eth1Block* = object Eth1Block* = object
timestamp*: uint64 timestamp*: uint64
deposit_root*: Eth2Digest deposit_root*: Eth2Digest
@ -421,13 +421,13 @@ type
message*: BeaconBlockHeader message*: BeaconBlockHeader
signature*: ValidatorSig signature*: ValidatorSig
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/validator.md#aggregateandproof # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/validator.md#aggregateandproof
AggregateAndProof* = object AggregateAndProof* = object
aggregator_index*: uint64 aggregator_index*: uint64
aggregate*: Attestation aggregate*: Attestation
selection_proof*: ValidatorSig selection_proof*: ValidatorSig
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/validator.md#signedaggregateandproof # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/validator.md#signedaggregateandproof
SignedAggregateAndProof* = object SignedAggregateAndProof* = object
message*: AggregateAndProof message*: AggregateAndProof
signature*: ValidatorSig signature*: ValidatorSig

View File

@ -456,7 +456,7 @@ proc createWalletContent*(T: type[KdfParams],
T, rng, mnemonic, name, salt, iv, password, nextAccount, pretty) T, rng, mnemonic, name, salt, iv, password, nextAccount, pretty)
(wallet.uuid, WalletContent Json.encode(wallet, pretty = pretty)) (wallet.uuid, WalletContent Json.encode(wallet, pretty = pretty))
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/deposit-contract.md#withdrawal-credentials # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/deposit-contract.md#withdrawal-credentials
proc makeWithdrawalCredentials*(k: ValidatorPubKey): Eth2Digest = proc makeWithdrawalCredentials*(k: ValidatorPubKey): Eth2Digest =
var bytes = eth2digest(k.toRaw()) var bytes = eth2digest(k.toRaw())
bytes.data[0] = BLS_WITHDRAWAL_PREFIX.uint8 bytes.data[0] = BLS_WITHDRAWAL_PREFIX.uint8

View File

@ -12,14 +12,14 @@ import
./datatypes, ./helpers, ./validator ./datatypes, ./helpers, ./validator
const const
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/p2p-interface.md#topics-and-messages # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/p2p-interface.md#topics-and-messages
topicBeaconBlocksSuffix* = "beacon_block/ssz" topicBeaconBlocksSuffix* = "beacon_block/ssz"
topicVoluntaryExitsSuffix* = "voluntary_exit/ssz" topicVoluntaryExitsSuffix* = "voluntary_exit/ssz"
topicProposerSlashingsSuffix* = "proposer_slashing/ssz" topicProposerSlashingsSuffix* = "proposer_slashing/ssz"
topicAttesterSlashingsSuffix* = "attester_slashing/ssz" topicAttesterSlashingsSuffix* = "attester_slashing/ssz"
topicAggregateAndProofsSuffix* = "beacon_aggregate_and_proof/ssz" topicAggregateAndProofsSuffix* = "beacon_aggregate_and_proof/ssz"
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/validator.md#misc # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/validator.md#misc
ATTESTATION_SUBNET_COUNT* = 64 ATTESTATION_SUBNET_COUNT* = 64
defaultEth2TcpPort* = 9000 defaultEth2TcpPort* = 9000
@ -57,8 +57,7 @@ func getAggregateAndProofsTopic*(forkDigest: ForkDigest): string =
except ValueError as e: except ValueError as e:
raiseAssert e.msg raiseAssert e.msg
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/validator.md#broadcast-attestation # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/validator.md#broadcast-attestation
# https://github.com/ethereum/eth2.0-specs/pull/1876
func compute_subnet_for_attestation*( func compute_subnet_for_attestation*(
committees_per_slot: uint64, slot: Slot, committee_index: CommitteeIndex): committees_per_slot: uint64, slot: Slot, committee_index: CommitteeIndex):
uint64 = uint64 =
@ -73,7 +72,7 @@ func compute_subnet_for_attestation*(
(committees_since_epoch_start + committee_index.uint64) mod (committees_since_epoch_start + committee_index.uint64) mod
ATTESTATION_SUBNET_COUNT ATTESTATION_SUBNET_COUNT
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/validator.md#broadcast-attestation # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/validator.md#broadcast-attestation
func getAttestationTopic*(forkDigest: ForkDigest, subnetIndex: uint64): func getAttestationTopic*(forkDigest: ForkDigest, subnetIndex: uint64):
string = string =
# This is for subscribing or broadcasting manually to a known index. # This is for subscribing or broadcasting manually to a known index.

View File

@ -61,7 +61,7 @@ const
# Initial values # Initial values
# --------------------------------------------------------------- # ---------------------------------------------------------------
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/configs/mainnet.yaml#L70 # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/configs/mainnet/phase0.yaml#L73
BLS_WITHDRAWAL_PREFIX*: byte = 0 BLS_WITHDRAWAL_PREFIX*: byte = 0
# Time parameters # Time parameters
@ -113,7 +113,7 @@ const
# State vector lengths # State vector lengths
# --------------------------------------------------------------- # ---------------------------------------------------------------
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/configs/mainnet.yaml#L105 # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/configs/mainnet/phase0.yaml#L108
EPOCHS_PER_HISTORICAL_VECTOR*: uint64 = 65536 ##\ EPOCHS_PER_HISTORICAL_VECTOR*: uint64 = 65536 ##\
## epochs (~0.8 years) ## epochs (~0.8 years)
@ -128,7 +128,7 @@ const
# Reward and penalty quotients # Reward and penalty quotients
# --------------------------------------------------------------- # ---------------------------------------------------------------
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/configs/mainnet.yaml#L117 # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/configs/mainnet/phase0.yaml#L120
BASE_REWARD_FACTOR*: uint64 = 2'u64^6 BASE_REWARD_FACTOR*: uint64 = 2'u64^6
WHISTLEBLOWER_REWARD_QUOTIENT*: uint64 = 2'u64^9 WHISTLEBLOWER_REWARD_QUOTIENT*: uint64 = 2'u64^9
PROPOSER_REWARD_QUOTIENT*: uint64 = 2'u64^3 PROPOSER_REWARD_QUOTIENT*: uint64 = 2'u64^3

View File

@ -47,7 +47,7 @@ const
# Initial values # Initial values
# --------------------------------------------------------------- # ---------------------------------------------------------------
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/configs/minimal.yaml#L70 # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/configs/minimal/phase0.yaml#L73
BLS_WITHDRAWAL_PREFIX*: byte = 0 BLS_WITHDRAWAL_PREFIX*: byte = 0
@ -87,7 +87,7 @@ const
# State vector lengths # State vector lengths
# --------------------------------------------------------------- # ---------------------------------------------------------------
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/configs/minimal.yaml#L105 # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/configs/minimal/phase0.yaml#L108
# Changed # Changed
EPOCHS_PER_HISTORICAL_VECTOR*: uint64 = 64 EPOCHS_PER_HISTORICAL_VECTOR*: uint64 = 64
@ -99,7 +99,7 @@ const
# Reward and penalty quotients # Reward and penalty quotients
# --------------------------------------------------------------- # ---------------------------------------------------------------
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/configs/minimal.yaml#L117 # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/configs/minimal/phase0.yaml#L120
BASE_REWARD_FACTOR*: uint64 = 2'u64^6 BASE_REWARD_FACTOR*: uint64 = 2'u64^6
WHISTLEBLOWER_REWARD_QUOTIENT*: uint64 = 2'u64^9 WHISTLEBLOWER_REWARD_QUOTIENT*: uint64 = 2'u64^9
@ -109,7 +109,7 @@ const
# Max operations per block # Max operations per block
# --------------------------------------------------------------- # ---------------------------------------------------------------
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/configs/minimal.yaml#L131 # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/configs/minimal/phase0.yaml#L134
MAX_PROPOSER_SLASHINGS*: uint64 = 2'u64 ^ 4 MAX_PROPOSER_SLASHINGS*: uint64 = 2'u64 ^ 4
MAX_ATTESTER_SLASHINGS*: uint64 = 2'u64 ^ 1 MAX_ATTESTER_SLASHINGS*: uint64 = 2'u64 ^ 1
@ -127,7 +127,7 @@ const
# Fork choice # Fork choice
# --------------------------------------------------------------- # ---------------------------------------------------------------
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/configs/minimal.yaml#L32 # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/configs/minimal/phase0.yaml#L32
# Changed # Changed
SAFE_SLOTS_TO_UPDATE_JUSTIFIED*: uint64 = 2 SAFE_SLOTS_TO_UPDATE_JUSTIFIED*: uint64 = 2

View File

@ -7,7 +7,7 @@
# This module contains the parts necessary to create a merkle hash from the core # This module contains the parts necessary to create a merkle hash from the core
# SSZ types outlined in the spec: # SSZ types outlined in the spec:
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/ssz/simple-serialize.md#merkleization # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/ssz/simple-serialize.md#merkleization
{.push raises: [Defect].} {.push raises: [Defect].}

View File

@ -4,7 +4,7 @@
{.pragma: raisesssz, raises: [Defect, MalformedSszError, SszSizeMismatchError].} {.pragma: raisesssz, raises: [Defect, MalformedSszError, SszSizeMismatchError].}
## SSZ serialiazation for core SSZ types, as specified in: ## SSZ serialiazation for core SSZ types, as specified in:
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/ssz/simple-serialize.md#serialization # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/ssz/simple-serialize.md#serialization
import import
typetraits, options, typetraits, options,

View File

@ -51,8 +51,8 @@ TODO
## Specifications ## Specifications
We target v0.12.1 phase0 of [https://github.com/ethereum/eth2.0-specs](https://github.com/ethereum/eth2.0-specs) We target v0.12.2 phase0 of [https://github.com/ethereum/eth2.0-specs](https://github.com/ethereum/eth2.0-specs)
- [https://github.com/ethereum/eth2.0-specs/tree/v0.12.1/specs/phase0](https://github.com/ethereum/eth2.0-specs/tree/v0.12.1/specs/phase0) - [https://github.com/ethereum/eth2.0-specs/tree/v0.12.2/specs/phase0](https://github.com/ethereum/eth2.0-specs/tree/v0.12.2/specs/phase0)
The p2p-interface specs in particular describe the subset of libp2p spec that The p2p-interface specs in particular describe the subset of libp2p spec that
are used to implement Ethereum 2 are used to implement Ethereum 2