From b8d4ce4c39b4539d696378d2a88a99ce0f23d506 Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Thu, 9 Jan 2020 12:38:56 -0700 Subject: [PATCH 1/6] fix default value when voting on eth1data --- specs/validator/0_beacon-chain-validator.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/specs/validator/0_beacon-chain-validator.md b/specs/validator/0_beacon-chain-validator.md index 55a061446..473699c5a 100644 --- a/specs/validator/0_beacon-chain-validator.md +++ b/specs/validator/0_beacon-chain-validator.md @@ -283,16 +283,20 @@ def is_candidate_block(block: Eth1Block, period_start: uint64) -> bool: ```python def get_eth1_vote(state: BeaconState, eth1_chain: Sequence[Eth1Block]) -> Eth1Data: period_start = voting_period_start_time(state) - # `eth1_chain` abstractly represents all blocks in the eth1 chain. + # `eth1_chain` abstractly represents all blocks in the eth1 chain sorted by ascending block height votes_to_consider = [get_eth1_data(block) for block in eth1_chain if is_candidate_block(block, period_start)] + # Valid votes already cast during this period valid_votes = [vote for vote in state.eth1_data_votes if vote in votes_to_consider] + # Default vote on latest eth1 block data in the period range unless eth1 chain is not live + default_vote = votes_to_consider[-1] if any(votes_to_consider) else state.eth1_data + return max( valid_votes, key=lambda v: (valid_votes.count(v), -valid_votes.index(v)), # Tiebreak by smallest distance - default=get_eth1_data(ETH1_FOLLOW_DISTANCE), + default=default_vote ) ``` From af702d42fd7f8b6f0735e25dfca7272722357be7 Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Thu, 9 Jan 2020 17:14:00 -0700 Subject: [PATCH 2/6] add slot validation condition for beacon block gossip sub channel --- specs/networking/p2p-interface.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/specs/networking/p2p-interface.md b/specs/networking/p2p-interface.md index 0a702ea61..8f61e179d 100644 --- a/specs/networking/p2p-interface.md +++ b/specs/networking/p2p-interface.md @@ -11,7 +11,7 @@ It consists of four main sections: ## Table of contents - + @@ -243,7 +243,9 @@ When processing incoming gossip, clients MAY descore or disconnect peers who fai There are two primary global topics used to propagate beacon blocks and aggregate attestations to all nodes on the network. Their `TopicName`s are: -- `beacon_block` - This topic is used solely for propagating new beacon blocks to all nodes on the networks. Blocks are sent in their entirety. Clients MUST validate the block proposer signature before forwarding it across the network. +- `beacon_block` - This topic is used solely for propagating new signed beacon blocks to all nodes on the networks. Signed blocks are sent in their entirety. The following validations MUST pass before forwarding the `signed_beacon_block` on the network + - The proposer signature, `signed_beacon_block.signature` is valid. + - The block is not from a future slot -- i.e. validate that `signed_beacon_block.message.slot < current_slot` (a client MAY queue future blocks for processing at the appropriate slot). - `beacon_aggregate_and_proof` - This topic is used to propagate aggregated attestations (as `AggregateAndProof`s) to subscribing nodes (typically validators) to be included in future blocks. The following validations MUST pass before forwarding the `aggregate_and_proof` on the network. - The aggregate attestation defined by `hash_tree_root(aggregate_and_proof.aggregate)` has _not_ already been seen (via aggregate gossip, within a block, or through the creation of an equivalent aggregate locally). - The block being voted for (`aggregate_and_proof.aggregate.data.beacon_block_root`) passes validation. From e0cd1090bd02d832ab0303a013e8ea1cde076e5d Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Thu, 9 Jan 2020 17:38:43 -0700 Subject: [PATCH 3/6] fix voluntary exit to be wrt signed voluntary exit in p2p spec --- specs/networking/p2p-interface.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/specs/networking/p2p-interface.md b/specs/networking/p2p-interface.md index 8f61e179d..2f0dc6d4a 100644 --- a/specs/networking/p2p-interface.md +++ b/specs/networking/p2p-interface.md @@ -223,15 +223,15 @@ where `base64` is the [URL-safe base64 alphabet](https://tools.ietf.org/html/rfc The payload is carried in the `data` field of a gossipsub message, and varies depending on the topic: -| Topic | Message Type | -|----------------------------------------|-------------------| -| beacon_block | SignedBeaconBlock | -| beacon_aggregate_and_proof | AggregateAndProof | -| beacon_attestation\* | Attestation | -| committee_index{subnet_id}\_beacon_attestation | Attestation | -| voluntary_exit | VoluntaryExit | -| proposer_slashing | ProposerSlashing | -| attester_slashing | AttesterSlashing | +| Topic | Message Type | +|------------------------------------------------|----------------------| +| beacon_block | SignedBeaconBlock | +| beacon_aggregate_and_proof | AggregateAndProof | +| beacon_attestation\* | Attestation | +| committee_index{subnet_id}\_beacon_attestation | Attestation | +| voluntary_exit | SignedVoluntaryExit | +| proposer_slashing | ProposerSlashing | +| attester_slashing | AttesterSlashing | Clients MUST reject (fail validation) messages containing an incorrect type, or invalid payload. @@ -245,7 +245,7 @@ There are two primary global topics used to propagate beacon blocks and aggregat - `beacon_block` - This topic is used solely for propagating new signed beacon blocks to all nodes on the networks. Signed blocks are sent in their entirety. The following validations MUST pass before forwarding the `signed_beacon_block` on the network - The proposer signature, `signed_beacon_block.signature` is valid. - - The block is not from a future slot -- i.e. validate that `signed_beacon_block.message.slot < current_slot` (a client MAY queue future blocks for processing at the appropriate slot). + - The block is not from a future slot -- i.e. validate that `signed_beacon_block.message.slot <= current_slot` (a client MAY queue future blocks for processing at the appropriate slot). - `beacon_aggregate_and_proof` - This topic is used to propagate aggregated attestations (as `AggregateAndProof`s) to subscribing nodes (typically validators) to be included in future blocks. The following validations MUST pass before forwarding the `aggregate_and_proof` on the network. - The aggregate attestation defined by `hash_tree_root(aggregate_and_proof.aggregate)` has _not_ already been seen (via aggregate gossip, within a block, or through the creation of an equivalent aggregate locally). - The block being voted for (`aggregate_and_proof.aggregate.data.beacon_block_root`) passes validation. @@ -257,7 +257,7 @@ There are two primary global topics used to propagate beacon blocks and aggregat Additional global topics are used to propagate lower frequency validator messages. Their `TopicName`s are: -- `voluntary_exit` - This topic is used solely for propagating voluntary validator exits to proposers on the network. Voluntary exits are sent in their entirety. Clients who receive a voluntary exit on this topic MUST validate the conditions within `process_voluntary_exit` before forwarding it across the network. +- `voluntary_exit` - This topic is used solely for propagating signed voluntary validator exits to proposers on the network. Signed voluntary exits are sent in their entirety. Clients who receive a signed voluntary exit on this topic MUST validate the conditions within `process_voluntary_exit` before forwarding it across the network. - `proposer_slashing` - This topic is used solely for propagating proposer slashings to proposers on the network. Proposer slashings are sent in their entirety. Clients who receive a proposer slashing on this topic MUST validate the conditions within `process_proposer_slashing` before forwarding it across the network. - `attester_slashing` - This topic is used solely for propagating attester slashings to proposers on the network. Attester slashings are sent in their entirety. Clients who receive an attester slashing on this topic MUST validate the conditions within `process_attester_slashing` before forwarding it across the network. From 5e96c08f41f61028fe5bcdf954b55dda8afeadf1 Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Fri, 10 Jan 2020 07:11:00 -0700 Subject: [PATCH 4/6] add MAXIMUM_GOSSIP_CLOCK_DISPARITY for gossip subnet validations --- specs/networking/p2p-interface.md | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/specs/networking/p2p-interface.md b/specs/networking/p2p-interface.md index 2f0dc6d4a..8e060a092 100644 --- a/specs/networking/p2p-interface.md +++ b/specs/networking/p2p-interface.md @@ -10,8 +10,7 @@ It consists of four main sections: 4. An analysis of the maturity/state of the libp2p features required by this spec across the languages in which Eth2 clients are being developed. ## Table of contents - - + @@ -82,6 +81,7 @@ It consists of four main sections: - [Why must all clients use the same gossip topic instead of one negotiated between each peer pair?](#why-must-all-clients-use-the-same-gossip-topic-instead-of-one-negotiated-between-each-peer-pair) - [Why are the topics strings and not hashes?](#why-are-the-topics-strings-and-not-hashes) - [Why are we overriding the default libp2p pubsub `message-id`?](#why-are-we-overriding-the-default-libp2p-pubsub-message-id) + - [Why is there `MAXIMUM_GOSSIP_CLOCK_DISPARITY` when validating slot ranges of messages in gossip subnets?](#why-is-there-maximum_gossip_clock_disparity-when-validating-slot-ranges-of-messages-in-gossip-subnets) - [Why are there `ATTESTATION_SUBNET_COUNT` attestation subnets?](#why-are-there-attestation_subnet_count-attestation-subnets) - [Why are attestations limited to be broadcast on gossip channels within `SLOTS_PER_EPOCH` slots?](#why-are-attestations-limited-to-be-broadcast-on-gossip-channels-within-slots_per_epoch-slots) - [Why are aggregate attestations broadcast to the global topic as `AggregateAndProof`s rather than just as `Attestation`s?](#why-are-aggregate-attestations-broadcast-to-the-global-topic-as-aggregateandproofs-rather-than-just-as-attestations) @@ -105,6 +105,7 @@ It consists of four main sections: - [libp2p implementations matrix](#libp2p-implementations-matrix) + # Network fundamentals @@ -186,6 +187,7 @@ This section outlines constants that are used in this spec. | `TTFB_TIMEOUT` | `5s` | The maximum time to wait for first byte of request response (time-to-first-byte). | | `RESP_TIMEOUT` | `10s` | The maximum time for complete response transfer. | | `ATTESTATION_PROPAGATION_SLOT_RANGE` | `32` | The maximum number of slots during which an attestation can be propagated. | +| `MAXIMUM_GOSSIP_CLOCK_DISPARITY` | `500ms` | The maximum milliseconds of clock disparity assumed between honest nodes. | ## The gossip domain: gossipsub @@ -245,11 +247,11 @@ There are two primary global topics used to propagate beacon blocks and aggregat - `beacon_block` - This topic is used solely for propagating new signed beacon blocks to all nodes on the networks. Signed blocks are sent in their entirety. The following validations MUST pass before forwarding the `signed_beacon_block` on the network - The proposer signature, `signed_beacon_block.signature` is valid. - - The block is not from a future slot -- i.e. validate that `signed_beacon_block.message.slot <= current_slot` (a client MAY queue future blocks for processing at the appropriate slot). + - The block is not from a future slot (with a `MAXIMUM_GOSSIP_CLOCK_DISPARITY` allowance) -- i.e. validate that `signed_beacon_block.message.slot <= current_slot` (a client MAY queue future blocks for processing at the appropriate slot). - `beacon_aggregate_and_proof` - This topic is used to propagate aggregated attestations (as `AggregateAndProof`s) to subscribing nodes (typically validators) to be included in future blocks. The following validations MUST pass before forwarding the `aggregate_and_proof` on the network. - The aggregate attestation defined by `hash_tree_root(aggregate_and_proof.aggregate)` has _not_ already been seen (via aggregate gossip, within a block, or through the creation of an equivalent aggregate locally). - The block being voted for (`aggregate_and_proof.aggregate.data.beacon_block_root`) passes validation. - - `aggregate_and_proof.aggregate.data.slot` is within the last `ATTESTATION_PROPAGATION_SLOT_RANGE` slots (`aggregate_and_proof.aggregate.data.slot + ATTESTATION_PROPAGATION_SLOT_RANGE >= current_slot >= aggregate_and_proof.aggregate.data.slot`). + - `aggregate_and_proof.aggregate.data.slot` is within the last `ATTESTATION_PROPAGATION_SLOT_RANGE` slots (with a `MAXIMUM_GOSSIP_CLOCK_DISPARITY` allowance) -- i.e. `aggregate_and_proof.aggregate.data.slot + ATTESTATION_PROPAGATION_SLOT_RANGE >= current_slot >= aggregate_and_proof.aggregate.data.slot`. - The validator index is within the aggregate's committee -- i.e. `aggregate_and_proof.aggregator_index in get_attesting_indices(state, aggregate_and_proof.aggregate.data, aggregate_and_proof.aggregate.aggregation_bits)`. - `aggregate_and_proof.selection_proof` selects the validator as an aggregator for the slot -- i.e. `is_aggregator(state, aggregate_and_proof.aggregate.data.slot, aggregate_and_proof.aggregate.data.index, aggregate_and_proof.selection_proof)` returns `True`. - The `aggregate_and_proof.selection_proof` is a valid signature of the `aggregate_and_proof.aggregate.data.slot` by the validator with index `aggregate_and_proof.aggregator_index`. @@ -269,7 +271,7 @@ Attestation subnets are used to propagate unaggregated attestations to subsectio - The attestation's committee index (`attestation.data.index`) is for the correct subnet. - The attestation is unaggregated -- that is, it has exactly one participating validator (`len([bit for bit in attestation.aggregation_bits if bit == 0b1]) == 1`). - The block being voted for (`attestation.data.beacon_block_root`) passes validation. - - `attestation.data.slot` is within the last `ATTESTATION_PROPAGATION_SLOT_RANGE` slots (`attestation.data.slot + ATTESTATION_PROPAGATION_SLOT_RANGE >= current_slot >= attestation.data.slot`). + - `attestation.data.slot` is within the last `ATTESTATION_PROPAGATION_SLOT_RANGE` slots (within a `MAXIMUM_GOSSIP_CLOCK_DISPARITY` allowance) -- i.e. `attestation.data.slot + ATTESTATION_PROPAGATION_SLOT_RANGE >= current_slot >= attestation.data.slot`. - The signature of `attestation` is valid. #### Interop @@ -767,6 +769,14 @@ Some examples of where messages could be duplicated: * Attestation aggregation strategies where clients partially aggregate attestations and propagate them. Partial aggregates could be duplicated * Clients re-publishing seen messages +### Why is there `MAXIMUM_GOSSIP_CLOCK_DISPARITY` when validating slot ranges of messages in gossip subnets? + +For some gossip channels (e.g. those for Attestations and BeaconBlocks), there are designated ranges of slots during which particular messages can be sent, limiting messages gossiped to those that can be reasonably used in the consensus at the current time/slot. This is to reduce optionality in DoS attacks. + +`MAXIMUM_GOSSIP_CLOCK_DISPARITY` provides some leeway in validating slot ranges to prevent the gossip network from becoming overly brittle with respect to clock disparity. For minimum and maximum allowable slot broadcast times, `MAXIMUM_GOSSIP_CLOCK_DISPARITY` MUST be subtracted and added respectively, marginally extending the valid range. Although messages can at times be eagerly gossiped to the network, the node's fork choice prevents integration of these messages into the actual consensus until the _actual local start_ of the designated slot. + +The value of this constant is currently a placeholder and will be tuned based on data observed in testnets. + ### Why are there `ATTESTATION_SUBNET_COUNT` attestation subnets? Depending on the number of validators, it may be more efficient to group shard subnets and might provide better stability for the gossipsub channel. The exact grouping will be dependent on more involved network tests. This constant allows for more flexibility in setting up the network topology for attestation aggregation (as aggregation should happen on each subnet). The value is currently set to to be equal `MAX_COMMITTEES_PER_SLOT` until network tests indicate otherwise. From 676e216beb0fd95932793ac271802fd48b07e4c5 Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Fri, 10 Jan 2020 11:42:55 -0700 Subject: [PATCH 5/6] reorg specs by fork and move ssz out to own folder. make all of the build and link changes to support move --- .circleci/config.yml | 38 +++++++++---------- .gitignore | 6 +-- Makefile | 17 +++++---- README.md | 29 +++++++------- deposit_contract/requirements-testing.txt | 2 +- scripts/build_spec.py | 24 ++++++------ .../beacon-chain.md} | 4 +- .../deposit-contract.md} | 2 +- .../fork-choice.md} | 4 +- specs/{networking => phase0}/p2p-interface.md | 4 +- .../validator.md} | 32 ++++++++-------- .../beacon-chain-misc.md} | 0 .../custody-game.md} | 2 +- .../light-client-sync.md} | 0 .../shard-data-chains.md} | 0 .../merkle_proofs.md => ssz/merkle-proofs.md | 0 {specs => ssz}/simple-serialize.md | 2 +- .../epoch_processing/requirements.txt | 3 -- test_generators/genesis/requirements.txt | 3 -- test_generators/operations/requirements.txt | 4 -- test_generators/sanity/requirements.txt | 3 -- test_generators/shuffling/requirements.txt | 4 -- test_generators/ssz_generic/requirements.txt | 4 -- test_generators/ssz_static/requirements.txt | 3 -- .../core}/config_helpers/README.md | 4 +- .../config_helpers/preset_loader}/__init__.py | 0 .../config_helpers/preset_loader/loader.py | 0 .../core}/config_helpers/requirements.txt | 0 .../core}/config_helpers/setup.py | 0 .../core}/gen_helpers/README.md | 2 +- .../core/gen_helpers/gen_base}/__init__.py | 0 .../core}/gen_helpers/gen_base/gen_runner.py | 0 .../core}/gen_helpers/gen_base/gen_typing.py | 0 .../gen_helpers/gen_from_tests}/__init__.py | 0 .../core}/gen_helpers/gen_from_tests/gen.py | 0 .../core}/gen_helpers/requirements.txt | 0 .../core}/gen_helpers/setup.py | 0 {test_libs => tests/core}/pyspec/README.md | 2 +- .../core/pyspec}/__init__.py | 0 .../core/pyspec/eth2spec}/__init__.py | 0 .../core/pyspec/eth2spec/debug}/__init__.py | 0 .../core}/pyspec/eth2spec/debug/decode.py | 0 .../core}/pyspec/eth2spec/debug/encode.py | 0 .../pyspec/eth2spec/debug/random_value.py | 0 .../core/pyspec/eth2spec/fuzzing}/__init__.py | 0 .../core}/pyspec/eth2spec/fuzzing/decoder.py | 0 .../pyspec/eth2spec/fuzzing/test_decoder.py | 0 .../core/pyspec/eth2spec/phase0}/__init__.py | 0 .../core/pyspec/eth2spec/phase1}/__init__.py | 0 .../core/pyspec/eth2spec/test}/__init__.py | 0 .../core}/pyspec/eth2spec/test/conftest.py | 2 +- .../core}/pyspec/eth2spec/test/context.py | 0 .../test/fork_choice/test_get_head.py | 0 .../test/fork_choice/test_on_attestation.py | 0 .../test/fork_choice/test_on_block.py | 0 .../eth2spec/test/fork_choice/test_on_tick.py | 0 .../pyspec/eth2spec/test/genesis}/__init__.py | 0 .../test/genesis/test_initialization.py | 0 .../eth2spec/test/genesis/test_validity.py | 0 .../pyspec/eth2spec/test/helpers}/__init__.py | 0 .../eth2spec/test/helpers/attestations.py | 0 .../test/helpers/attester_slashings.py | 0 .../pyspec/eth2spec/test/helpers/block.py | 0 .../eth2spec/test/helpers/block_header.py | 0 .../pyspec/eth2spec/test/helpers/custody.py | 0 .../pyspec/eth2spec/test/helpers/deposits.py | 0 .../pyspec/eth2spec/test/helpers/genesis.py | 0 .../pyspec/eth2spec/test/helpers/keys.py | 0 .../eth2spec/test/helpers/phase1}/__init__.py | 0 .../test/helpers/phase1/attestations.py | 0 .../test/helpers/phase1/shard_block.py | 0 .../test/helpers/phase1/shard_state.py | 0 .../test/helpers/proposer_slashings.py | 0 .../pyspec/eth2spec/test/helpers/state.py | 0 .../eth2spec/test/helpers/voluntary_exits.py | 0 .../eth2spec/test/merkle_proofs}/__init__.py | 0 .../test/merkle_proofs/test_merkle_proofs.py | 0 .../pyspec/eth2spec/test/phase_0}/__init__.py | 0 .../phase_0/block_processing}/__init__.py | 0 .../test_process_attestation.py | 0 .../test_process_attester_slashing.py | 0 .../test_process_block_header.py | 0 .../block_processing/test_process_deposit.py | 0 .../test_process_proposer_slashing.py | 0 .../test_process_voluntary_exit.py | 0 .../phase_0/epoch_processing}/__init__.py | 0 .../run_epoch_process_base.py | 0 .../test_process_final_updates.py | 0 ..._process_justification_and_finalization.py | 0 .../test_process_registry_updates.py | 0 .../test_process_rewards_and_penalties.py | 0 .../test_process_slashings.py | 0 .../pyspec/eth2spec/test/phase_1}/__init__.py | 0 .../phase_1/block_processing}/__init__.py | 0 .../test_process_bit_challenge.py | 0 .../test_process_custody_key_reveal.py | 0 ...est_process_early_derived_secret_reveal.py | 0 .../test/phase_1/sanity/test_shard_blocks.py | 0 .../pyspec/eth2spec/test/sanity}/__init__.py | 0 .../eth2spec/test/sanity/test_blocks.py | 0 .../pyspec/eth2spec/test/sanity/test_slots.py | 0 .../pyspec/eth2spec/test/test_finality.py | 0 .../core}/pyspec/eth2spec/test/utils.py | 0 .../core/pyspec/eth2spec/utils}/__init__.py | 0 .../core}/pyspec/eth2spec/utils/bls.py | 0 .../pyspec/eth2spec/utils/hash_function.py | 0 .../pyspec/eth2spec/utils/merkle_minimal.py | 0 .../pyspec/eth2spec/utils/ssz}/__init__.py | 0 .../pyspec/eth2spec/utils/ssz/ssz_impl.py | 0 .../pyspec/eth2spec/utils/ssz/ssz_typing.py | 0 .../eth2spec/utils/ssz/test_ssz_impl.py | 0 .../eth2spec/utils/ssz/test_ssz_typing.py | 0 .../eth2spec/utils/test_merkle_minimal.py | 0 .../core}/pyspec/requirements-testing.txt | 0 .../core}/pyspec/requirements.txt | 0 {test_libs => tests/core}/pyspec/setup.py | 0 .../test_formats => tests/formats}/README.md | 0 .../formats}/bls/README.md | 0 .../formats}/bls/aggregate_pubkeys.md | 0 .../formats}/bls/aggregate_sigs.md | 0 .../formats}/bls/msg_hash_g2_compressed.md | 0 .../formats}/bls/msg_hash_g2_uncompressed.md | 0 .../formats}/bls/priv_to_pub.md | 0 .../formats}/bls/sign_msg.md | 0 .../formats}/epoch_processing/README.md | 0 .../formats}/genesis/README.md | 0 .../formats}/genesis/initialization.md | 0 .../formats}/genesis/validity.md | 0 .../formats}/operations/README.md | 0 .../formats}/sanity/README.md | 0 .../formats}/sanity/blocks.md | 0 .../formats}/sanity/slots.md | 0 .../formats}/shuffling/README.md | 2 +- .../formats}/ssz_generic/README.md | 0 .../formats}/ssz_static/README.md | 2 +- .../formats}/ssz_static/core.md | 4 +- .../generators}/README.md | 8 ++-- .../generators}/bls/README.md | 0 .../generators}/bls/main.py | 0 .../generators}/bls/requirements.txt | 2 +- .../generators}/epoch_processing/README.md | 0 .../generators}/epoch_processing/main.py | 0 .../epoch_processing/requirements.txt | 3 ++ .../generators}/genesis/README.md | 4 +- .../generators}/genesis/main.py | 0 tests/generators/genesis/requirements.txt | 3 ++ .../generators}/operations/README.md | 0 .../generators}/operations/main.py | 0 tests/generators/operations/requirements.txt | 4 ++ .../generators}/sanity/README.md | 0 .../generators}/sanity/main.py | 0 tests/generators/sanity/requirements.txt | 3 ++ .../generators}/shuffling/README.md | 0 .../generators}/shuffling/main.py | 0 tests/generators/shuffling/requirements.txt | 4 ++ .../generators/ssz_generic}/__init__.py | 0 .../generators}/ssz_generic/main.py | 0 tests/generators/ssz_generic/requirements.txt | 4 ++ .../ssz_generic/ssz_basic_vector.py | 0 .../generators}/ssz_generic/ssz_bitlist.py | 0 .../generators}/ssz_generic/ssz_bitvector.py | 0 .../generators}/ssz_generic/ssz_boolean.py | 0 .../generators}/ssz_generic/ssz_container.py | 0 .../generators}/ssz_generic/ssz_test_case.py | 0 .../generators}/ssz_generic/ssz_uints.py | 0 .../ssz_generic/uint_test_cases.py | 0 .../generators}/ssz_static/README.md | 0 .../generators/ssz_static}/__init__.py | 0 .../generators}/ssz_static/main.py | 0 tests/generators/ssz_static/requirements.txt | 3 ++ 170 files changed, 123 insertions(+), 123 deletions(-) rename specs/{core/0_beacon-chain.md => phase0/beacon-chain.md} (99%) rename specs/{core/0_deposit-contract.md => phase0/deposit-contract.md} (94%) rename specs/{core/0_fork-choice.md => phase0/fork-choice.md} (97%) rename specs/{networking => phase0}/p2p-interface.md (99%) rename specs/{validator/0_beacon-chain-validator.md => phase0/validator.md} (87%) rename specs/{core/1_beacon-chain-misc.md => phase1/beacon-chain-misc.md} (100%) rename specs/{core/1_custody-game.md => phase1/custody-game.md} (99%) rename specs/{light_client/sync_protocol.md => phase1/light-client-sync.md} (100%) rename specs/{core/1_shard-data-chains.md => phase1/shard-data-chains.md} (100%) rename specs/light_client/merkle_proofs.md => ssz/merkle-proofs.md (100%) rename {specs => ssz}/simple-serialize.md (97%) delete mode 100644 test_generators/epoch_processing/requirements.txt delete mode 100644 test_generators/genesis/requirements.txt delete mode 100644 test_generators/operations/requirements.txt delete mode 100644 test_generators/sanity/requirements.txt delete mode 100644 test_generators/shuffling/requirements.txt delete mode 100644 test_generators/ssz_generic/requirements.txt delete mode 100644 test_generators/ssz_static/requirements.txt rename {test_libs => tests/core}/config_helpers/README.md (72%) rename {test_generators/ssz_generic => tests/core/config_helpers/preset_loader}/__init__.py (100%) rename {test_libs => tests/core}/config_helpers/preset_loader/loader.py (100%) rename {test_libs => tests/core}/config_helpers/requirements.txt (100%) rename {test_libs => tests/core}/config_helpers/setup.py (100%) rename {test_libs => tests/core}/gen_helpers/README.md (96%) rename {test_generators/ssz_static => tests/core/gen_helpers/gen_base}/__init__.py (100%) rename {test_libs => tests/core}/gen_helpers/gen_base/gen_runner.py (100%) rename {test_libs => tests/core}/gen_helpers/gen_base/gen_typing.py (100%) rename {test_libs/config_helpers/preset_loader => tests/core/gen_helpers/gen_from_tests}/__init__.py (100%) rename {test_libs => tests/core}/gen_helpers/gen_from_tests/gen.py (100%) rename {test_libs => tests/core}/gen_helpers/requirements.txt (100%) rename {test_libs => tests/core}/gen_helpers/setup.py (100%) rename {test_libs => tests/core}/pyspec/README.md (95%) rename {test_libs/gen_helpers/gen_base => tests/core/pyspec}/__init__.py (100%) rename {test_libs/gen_helpers/gen_from_tests => tests/core/pyspec/eth2spec}/__init__.py (100%) rename {test_libs/pyspec => tests/core/pyspec/eth2spec/debug}/__init__.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/debug/decode.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/debug/encode.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/debug/random_value.py (100%) rename {test_libs/pyspec/eth2spec => tests/core/pyspec/eth2spec/fuzzing}/__init__.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/fuzzing/decoder.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/fuzzing/test_decoder.py (100%) rename {test_libs/pyspec/eth2spec/debug => tests/core/pyspec/eth2spec/phase0}/__init__.py (100%) rename {test_libs/pyspec/eth2spec/fuzzing => tests/core/pyspec/eth2spec/phase1}/__init__.py (100%) rename {test_libs/pyspec/eth2spec/phase0 => tests/core/pyspec/eth2spec/test}/__init__.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/conftest.py (93%) rename {test_libs => tests/core}/pyspec/eth2spec/test/context.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/fork_choice/test_get_head.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/fork_choice/test_on_attestation.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/fork_choice/test_on_block.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/fork_choice/test_on_tick.py (100%) rename {test_libs/pyspec/eth2spec/phase1 => tests/core/pyspec/eth2spec/test/genesis}/__init__.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/genesis/test_initialization.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/genesis/test_validity.py (100%) rename {test_libs/pyspec/eth2spec/test => tests/core/pyspec/eth2spec/test/helpers}/__init__.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/helpers/attestations.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/helpers/attester_slashings.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/helpers/block.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/helpers/block_header.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/helpers/custody.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/helpers/deposits.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/helpers/genesis.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/helpers/keys.py (100%) rename {test_libs/pyspec/eth2spec/test/genesis => tests/core/pyspec/eth2spec/test/helpers/phase1}/__init__.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/helpers/phase1/attestations.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/helpers/phase1/shard_block.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/helpers/phase1/shard_state.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/helpers/proposer_slashings.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/helpers/state.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/helpers/voluntary_exits.py (100%) rename {test_libs/pyspec/eth2spec/test/helpers => tests/core/pyspec/eth2spec/test/merkle_proofs}/__init__.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/merkle_proofs/test_merkle_proofs.py (100%) rename {test_libs/pyspec/eth2spec/test/helpers/phase1 => tests/core/pyspec/eth2spec/test/phase_0}/__init__.py (100%) rename {test_libs/pyspec/eth2spec/test/merkle_proofs => tests/core/pyspec/eth2spec/test/phase_0/block_processing}/__init__.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/phase_0/block_processing/test_process_attestation.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/phase_0/block_processing/test_process_attester_slashing.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/phase_0/block_processing/test_process_block_header.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/phase_0/block_processing/test_process_deposit.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/phase_0/block_processing/test_process_proposer_slashing.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/phase_0/block_processing/test_process_voluntary_exit.py (100%) rename {test_libs/pyspec/eth2spec/test/phase_0 => tests/core/pyspec/eth2spec/test/phase_0/epoch_processing}/__init__.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/phase_0/epoch_processing/run_epoch_process_base.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/phase_0/epoch_processing/test_process_final_updates.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/phase_0/epoch_processing/test_process_justification_and_finalization.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/phase_0/epoch_processing/test_process_registry_updates.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/phase_0/epoch_processing/test_process_rewards_and_penalties.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/phase_0/epoch_processing/test_process_slashings.py (100%) rename {test_libs/pyspec/eth2spec/test/phase_0/block_processing => tests/core/pyspec/eth2spec/test/phase_1}/__init__.py (100%) rename {test_libs/pyspec/eth2spec/test/phase_0/epoch_processing => tests/core/pyspec/eth2spec/test/phase_1/block_processing}/__init__.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/phase_1/block_processing/test_process_bit_challenge.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/phase_1/block_processing/test_process_custody_key_reveal.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/phase_1/block_processing/test_process_early_derived_secret_reveal.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/phase_1/sanity/test_shard_blocks.py (100%) rename {test_libs/pyspec/eth2spec/test/phase_1 => tests/core/pyspec/eth2spec/test/sanity}/__init__.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/sanity/test_blocks.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/sanity/test_slots.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/test_finality.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/test/utils.py (100%) rename {test_libs/pyspec/eth2spec/test/phase_1/block_processing => tests/core/pyspec/eth2spec/utils}/__init__.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/utils/bls.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/utils/hash_function.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/utils/merkle_minimal.py (100%) rename {test_libs/pyspec/eth2spec/test/sanity => tests/core/pyspec/eth2spec/utils/ssz}/__init__.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/utils/ssz/ssz_impl.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/utils/ssz/ssz_typing.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/utils/ssz/test_ssz_impl.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/utils/ssz/test_ssz_typing.py (100%) rename {test_libs => tests/core}/pyspec/eth2spec/utils/test_merkle_minimal.py (100%) rename {test_libs => tests/core}/pyspec/requirements-testing.txt (100%) rename {test_libs => tests/core}/pyspec/requirements.txt (100%) rename {test_libs => tests/core}/pyspec/setup.py (100%) rename {specs/test_formats => tests/formats}/README.md (100%) rename {specs/test_formats => tests/formats}/bls/README.md (100%) rename {specs/test_formats => tests/formats}/bls/aggregate_pubkeys.md (100%) rename {specs/test_formats => tests/formats}/bls/aggregate_sigs.md (100%) rename {specs/test_formats => tests/formats}/bls/msg_hash_g2_compressed.md (100%) rename {specs/test_formats => tests/formats}/bls/msg_hash_g2_uncompressed.md (100%) rename {specs/test_formats => tests/formats}/bls/priv_to_pub.md (100%) rename {specs/test_formats => tests/formats}/bls/sign_msg.md (100%) rename {specs/test_formats => tests/formats}/epoch_processing/README.md (100%) rename {specs/test_formats => tests/formats}/genesis/README.md (100%) rename {specs/test_formats => tests/formats}/genesis/initialization.md (100%) rename {specs/test_formats => tests/formats}/genesis/validity.md (100%) rename {specs/test_formats => tests/formats}/operations/README.md (100%) rename {specs/test_formats => tests/formats}/sanity/README.md (100%) rename {specs/test_formats => tests/formats}/sanity/blocks.md (100%) rename {specs/test_formats => tests/formats}/sanity/slots.md (100%) rename {specs/test_formats => tests/formats}/shuffling/README.md (96%) rename {specs/test_formats => tests/formats}/ssz_generic/README.md (100%) rename {specs/test_formats => tests/formats}/ssz_static/README.md (81%) rename {specs/test_formats => tests/formats}/ssz_static/core.md (92%) rename {test_generators => tests/generators}/README.md (97%) rename {test_generators => tests/generators}/bls/README.md (100%) rename {test_generators => tests/generators}/bls/main.py (100%) rename {test_generators => tests/generators}/bls/requirements.txt (52%) rename {test_generators => tests/generators}/epoch_processing/README.md (100%) rename {test_generators => tests/generators}/epoch_processing/main.py (100%) create mode 100644 tests/generators/epoch_processing/requirements.txt rename {test_generators => tests/generators}/genesis/README.md (71%) rename {test_generators => tests/generators}/genesis/main.py (100%) create mode 100644 tests/generators/genesis/requirements.txt rename {test_generators => tests/generators}/operations/README.md (100%) rename {test_generators => tests/generators}/operations/main.py (100%) create mode 100644 tests/generators/operations/requirements.txt rename {test_generators => tests/generators}/sanity/README.md (100%) rename {test_generators => tests/generators}/sanity/main.py (100%) create mode 100644 tests/generators/sanity/requirements.txt rename {test_generators => tests/generators}/shuffling/README.md (100%) rename {test_generators => tests/generators}/shuffling/main.py (100%) create mode 100644 tests/generators/shuffling/requirements.txt rename {test_libs/pyspec/eth2spec/utils => tests/generators/ssz_generic}/__init__.py (100%) rename {test_generators => tests/generators}/ssz_generic/main.py (100%) create mode 100644 tests/generators/ssz_generic/requirements.txt rename {test_generators => tests/generators}/ssz_generic/ssz_basic_vector.py (100%) rename {test_generators => tests/generators}/ssz_generic/ssz_bitlist.py (100%) rename {test_generators => tests/generators}/ssz_generic/ssz_bitvector.py (100%) rename {test_generators => tests/generators}/ssz_generic/ssz_boolean.py (100%) rename {test_generators => tests/generators}/ssz_generic/ssz_container.py (100%) rename {test_generators => tests/generators}/ssz_generic/ssz_test_case.py (100%) rename {test_generators => tests/generators}/ssz_generic/ssz_uints.py (100%) rename {test_generators => tests/generators}/ssz_generic/uint_test_cases.py (100%) rename {test_generators => tests/generators}/ssz_static/README.md (100%) rename {test_libs/pyspec/eth2spec/utils/ssz => tests/generators/ssz_static}/__init__.py (100%) rename {test_generators => tests/generators}/ssz_static/main.py (100%) create mode 100644 tests/generators/ssz_static/requirements.txt diff --git a/.circleci/config.yml b/.circleci/config.yml index f3870d922..04d5bf799 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -35,27 +35,27 @@ commands: description: "Restore the cache with pyspec keys" steps: - restore_cached_venv: - venv_name: v5-pyspec - reqs_checksum: cache-{{ checksum "test_libs/pyspec/requirements.txt" }}-{{ checksum "test_libs/pyspec/requirements-testing.txt" }} + venv_name: v6-pyspec + reqs_checksum: cache-{{ checksum "tests/core/pyspec/requirements.txt" }}-{{ checksum "tests/core/pyspec/requirements-testing.txt" }} save_pyspec_cached_venv: description: Save a venv into a cache with pyspec keys" steps: - save_cached_venv: - venv_name: v5-pyspec - reqs_checksum: cache-{{ checksum "test_libs/pyspec/requirements.txt" }}-{{ checksum "test_libs/pyspec/requirements-testing.txt" }} - venv_path: ./test_libs/pyspec/venv + venv_name: v6-pyspec + reqs_checksum: cache-{{ checksum "tests/core/pyspec/requirements.txt" }}-{{ checksum "tests/core/pyspec/requirements-testing.txt" }} + venv_path: ./tests/core/pyspec/venv restore_deposit_contract_cached_venv: description: "Restore the cache with deposit_contract keys" steps: - restore_cached_venv: - venv_name: v8-deposit-contract - reqs_checksum: cache-{{ checksum "test_libs/pyspec/requirements.txt" }}-{{ checksum "deposit_contract/requirements-testing.txt" }} + venv_name: v9-deposit-contract + reqs_checksum: cache-{{ checksum "tests/core/pyspec/requirements.txt" }}-{{ checksum "deposit_contract/requirements-testing.txt" }} save_deposit_contract_cached_venv: description: Save a venv into a cache with deposit_contract keys" steps: - save_cached_venv: - venv_name: v8-deposit-contract - reqs_checksum: cache-{{ checksum "test_libs/pyspec/requirements.txt" }}-{{ checksum "deposit_contract/requirements-testing.txt" }} + venv_name: v9-deposit-contract + reqs_checksum: cache-{{ checksum "tests/core/pyspec/requirements.txt" }}-{{ checksum "deposit_contract/requirements-testing.txt" }} venv_path: ./deposit_contract/venv jobs: checkout_specs: @@ -66,16 +66,16 @@ jobs: # Restore git repo at point close to target branch/revision, to speed up checkout - restore_cache: keys: - - v1-specs-repo-{{ .Branch }}-{{ .Revision }} - - v1-specs-repo-{{ .Branch }}- - - v1-specs-repo- + - v2-specs-repo-{{ .Branch }}-{{ .Revision }} + - v2-specs-repo-{{ .Branch }}- + - v2-specs-repo- - checkout - run: name: Clean up git repo to reduce cache size command: git gc # Save the git checkout as a cache, to make cloning next time faster. - save_cache: - key: v1-specs-repo-{{ .Branch }}-{{ .Revision }} + key: v2-specs-repo-{{ .Branch }}-{{ .Revision }} paths: - ~/specs-repo install_pyspec_test: @@ -84,7 +84,7 @@ jobs: working_directory: ~/specs-repo steps: - restore_cache: - key: v1-specs-repo-{{ .Branch }}-{{ .Revision }} + key: v2-specs-repo-{{ .Branch }}-{{ .Revision }} - restore_pyspec_cached_venv - run: name: Install pyspec requirements @@ -96,13 +96,13 @@ jobs: working_directory: ~/specs-repo steps: - restore_cache: - key: v1-specs-repo-{{ .Branch }}-{{ .Revision }} + key: v2-specs-repo-{{ .Branch }}-{{ .Revision }} - restore_pyspec_cached_venv - run: name: Run py-tests command: make citest - store_test_results: - path: test_libs/pyspec/test-reports + path: tests/core/pyspec/test-reports table_of_contents: docker: - image: circleci/node:10.16.3 @@ -127,7 +127,7 @@ jobs: working_directory: ~/specs-repo steps: - restore_cache: - key: v1-specs-repo-{{ .Branch }}-{{ .Revision }} + key: v2-specs-repo-{{ .Branch }}-{{ .Revision }} - restore_pyspec_cached_venv - run: name: Run linter @@ -138,7 +138,7 @@ jobs: working_directory: ~/specs-repo steps: - restore_cache: - key: v1-specs-repo-{{ .Branch }}-{{ .Revision }} + key: v2-specs-repo-{{ .Branch }}-{{ .Revision }} - restore_deposit_contract_cached_venv - run: name: Install deposit contract requirements @@ -150,7 +150,7 @@ jobs: working_directory: ~/specs-repo steps: - restore_cache: - key: v1-specs-repo-{{ .Branch }}-{{ .Revision }} + key: v2-specs-repo-{{ .Branch }}-{{ .Revision }} - restore_deposit_contract_cached_venv - run: name: Run deposit contract test diff --git a/.gitignore b/.gitignore index 4dff5fbcb..ff1f2d9f8 100644 --- a/.gitignore +++ b/.gitignore @@ -14,12 +14,12 @@ eth2.0-spec-tests/ .mypy_cache # Dynamically built from Markdown spec -test_libs/pyspec/eth2spec/phase0/spec.py -test_libs/pyspec/eth2spec/phase1/spec.py +tests/core/pyspec/eth2spec/phase0/spec.py +tests/core/pyspec/eth2spec/phase1/spec.py # coverage reports .htmlcov .coverage # local CI testing output -test_libs/pyspec/test-reports +tests/core/pyspec/test-reports diff --git a/Makefile b/Makefile index 51bff90d0..e91a686f1 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,10 @@ SPEC_DIR = ./specs +SSZ_DIR = ./ssz SCRIPT_DIR = ./scripts -TEST_LIBS_DIR = ./test_libs +TEST_LIBS_DIR = ./tests/core PY_SPEC_DIR = $(TEST_LIBS_DIR)/pyspec TEST_VECTOR_DIR = ./eth2.0-spec-tests/tests -GENERATOR_DIR = ./test_generators +GENERATOR_DIR = ./tests/generators DEPOSIT_CONTRACT_DIR = ./deposit_contract CONFIGS_DIR = ./configs @@ -16,17 +17,19 @@ GENERATOR_VENVS = $(patsubst $(GENERATOR_DIR)/%, $(GENERATOR_DIR)/%venv, $(GENER # To check generator matching: #$(info $$GENERATOR_TARGETS is [${GENERATOR_TARGETS}]) +PHASE0_SPEC_DIR = $(SPEC_DIR)/phase0 PY_SPEC_PHASE_0_TARGETS = $(PY_SPEC_DIR)/eth2spec/phase0/spec.py -PY_SPEC_PHASE_0_DEPS = $(wildcard $(SPEC_DIR)/core/0_*.md) +PY_SPEC_PHASE_0_DEPS = $(wildcard $(SPEC_DIR)/phase0/*.md) +PHASE1_SPEC_DIR = $(SPEC_DIR)/phase1 PY_SPEC_PHASE_1_TARGETS = $(PY_SPEC_DIR)/eth2spec/phase1/spec.py -PY_SPEC_PHASE_1_DEPS = $(wildcard $(SPEC_DIR)/core/1_*.md) +PY_SPEC_PHASE_1_DEPS = $(wildcard $(SPEC_DIR)/phase1/*.md) PY_SPEC_ALL_DEPS = $(PY_SPEC_PHASE_0_DEPS) $(PY_SPEC_PHASE_1_DEPS) PY_SPEC_ALL_TARGETS = $(PY_SPEC_PHASE_0_TARGETS) $(PY_SPEC_PHASE_1_TARGETS) -MARKDOWN_FILES = $(PY_SPEC_ALL_DEPS) $(wildcard $(SPEC_DIR)/*.md) $(wildcard $(SPEC_DIR)/light_client/*.md) $(wildcard $(SPEC_DIR)/networking/*.md) $(wildcard $(SPEC_DIR)/validator/*.md) +MARKDOWN_FILES = $(PY_SPEC_ALL_DEPS) $(wildcard $(SPEC_DIR)/*.md) $(wildcard $(SSZ_DIR)/*.md) $(wildcard $(SPEC_DIR)/networking/*.md) $(wildcard $(SPEC_DIR)/validator/*.md) COV_HTML_OUT=.htmlcov COV_INDEX_FILE=$(PY_SPEC_DIR)/$(COV_HTML_OUT)/index.html @@ -101,10 +104,10 @@ test_deposit_contract: pyspec: $(PY_SPEC_ALL_TARGETS) $(PY_SPEC_PHASE_0_TARGETS): $(PY_SPEC_PHASE_0_DEPS) - python3 $(SCRIPT_DIR)/build_spec.py -p0 $(SPEC_DIR)/core/0_beacon-chain.md $(SPEC_DIR)/core/0_fork-choice.md $(SPEC_DIR)/validator/0_beacon-chain-validator.md $@ + python3 $(SCRIPT_DIR)/build_spec.py -p0 $(PHASE0_SPEC_DIR)/beacon-chain.md $(PHASE0_SPEC_DIR)/fork-choice.md $(PHASE0_SPEC_DIR)/validator.md $@ $(PY_SPEC_DIR)/eth2spec/phase1/spec.py: $(PY_SPEC_PHASE_1_DEPS) - python3 $(SCRIPT_DIR)/build_spec.py -p1 $(SPEC_DIR)/core/0_beacon-chain.md $(SPEC_DIR)/core/0_fork-choice.md $(SPEC_DIR)/light_client/merkle_proofs.md $(SPEC_DIR)/core/1_custody-game.md $(SPEC_DIR)/core/1_shard-data-chains.md $(SPEC_DIR)/core/1_beacon-chain-misc.md $@ + python3 $(SCRIPT_DIR)/build_spec.py -p1 $(PHASE0_SPEC_DIR)/beacon-chain.md $(PHASE0_SPEC_DIR)/fork-choice.md $(SSZ_DIR)/merkle-proofs.md $(PHASE1_SPEC_DIR)/custody-game.md $(PHASE1_SPEC_DIR)/shard-data-chains.md $(PHASE1_SPEC_DIR)/beacon-chain-misc.md $@ CURRENT_DIR = ${CURDIR} diff --git a/README.md b/README.md index fa103394d..d08cc0bb5 100644 --- a/README.md +++ b/README.md @@ -9,18 +9,19 @@ This repository hosts the current Eth2 specifications. Discussions about design ## Specs -Core specifications for Eth2 client validation can be found in [specs/core](specs/core). These are divided into phases. Each subsequent phase depends upon the prior. The current phases specified are: +Core specifications for Eth2 clients be found in [specs/](specs/). These are divided into phases. Each subsequent phase depends upon the prior. The current phases specified are: ### Phase 0 -* [The Beacon Chain](specs/core/0_beacon-chain.md) -* [Fork Choice](specs/core/0_fork-choice.md) -* [Deposit Contract](specs/core/0_deposit-contract.md) -* [Honest Validator](specs/validator/0_beacon-chain-validator.md) +* [The Beacon Chain](specs/phase0/beacon-chain.md) +* [Fork Choice](specs/phase0/fork-choice.md) +* [Deposit Contract](specs/phase0/deposit-contract.md) +* [Honest Validator](specs/phase0/validator.md) ### Phase 1 -* [Custody Game](specs/core/1_custody-game.md) -* [Shard Data Chains](specs/core/1_shard-data-chains.md) -* [Misc beacon chain updates](specs/core/1_beacon-chain-misc.md) +* [Custody Game](specs/phase1/custody-game.md) +* [Shard Data Chains](specs/phase1/shard-data-chains.md) +* [Misc beacon chain updates](specs/phase1/beacon-chain-misc.md) +* [Light client syncing protocol](specs/phase1/light-client-sync.md) ### Phase 2 @@ -30,11 +31,9 @@ See the [Eth2 Phase 2 Wiki](https://hackmd.io/UzysWse1Th240HELswKqVA?view) for c ### Accompanying documents can be found in [specs](specs) and include: -* [SimpleSerialize (SSZ) spec](specs/simple-serialize.md) -* [BLS signature verification](specs/bls_signature.md) -* [General test format](specs/test_formats/README.md) -* [Merkle proof formats](specs/light_client/merkle_proofs.md) -* [Light client syncing protocol](specs/light_client/sync_protocol.md) +* [SimpleSerialize (SSZ) spec](ssz/simple-serialize.md) +* [Merkle proof formats](ssz/merkle-proofs.md) +* [General test format](tests/formats/README.md) ## Additional specifications for client implementers @@ -63,6 +62,6 @@ The following are the broad design goals for Ethereum 2.0: ## For spec contributors Documentation on the different components used during spec writing can be found here: -* [YAML Test Generators](test_generators/README.md) -* [Executable Python Spec, with Py-tests](test_libs/pyspec/README.md) +* [YAML Test Generators](tests/generators/README.md) +* [Executable Python Spec, with Py-tests](tests/core/pyspec/README.md) diff --git a/deposit_contract/requirements-testing.txt b/deposit_contract/requirements-testing.txt index c542121c2..cbf6983c1 100644 --- a/deposit_contract/requirements-testing.txt +++ b/deposit_contract/requirements-testing.txt @@ -2,4 +2,4 @@ eth-tester[py-evm]==0.1.0b39 git+https://github.com/vyperlang/vyper@1761-HOTFIX-v0.1.0-beta.13 web3==5.0.0b2 pytest==3.6.1 -../test_libs/pyspec +../tests/core/pyspec diff --git a/scripts/build_spec.py b/scripts/build_spec.py index 50f57960f..114832bc2 100644 --- a/scripts/build_spec.py +++ b/scripts/build_spec.py @@ -308,18 +308,18 @@ if __name__ == '__main__': description = ''' Build the specs from the md docs. If building phase 0: - 1st argument is input /core/0_beacon-chain.md - 2nd argument is input /core/0_fork-choice.md - 3rd argument is input /core/0_beacon-chain-validator.md + 1st argument is input phase0/beacon-chain.md + 2nd argument is input phase0/fork-choice.md + 3rd argument is input phase0/validator.md 4th argument is output spec.py If building phase 1: - 1st argument is input /core/0_beacon-chain.md - 2nd argument is input /core/0_fork-choice.md - 3rd argument is input /light_client/merkle_proofs.md - 4th argument is input /core/1_custody-game.md - 5th argument is input /core/1_shard-data-chains.md - 6th argument is input /core/1_beacon-chain-misc.md + 1st argument is input phase0/beacon-chain.md + 2nd argument is input phase0/fork-choice.md + 3rd argument is input ssz/merkle-proofs.md + 4th argument is input phase1/custody-game.md + 5th argument is input phase1/shard-data-chains.md + 6th argument is input phase1/beacon-chain-misc.md 7th argument is output spec.py ''' parser = ArgumentParser(description=description) @@ -338,9 +338,9 @@ If building phase 1: else: print( " Phase 1 requires input files as well as an output file:\n" - "\t core/phase_0: (0_beacon-chain.md, 0_fork-choice.md)\n" - "\t light_client: (merkle_proofs.md)\n" - "\t core/phase_1: (1_custody-game.md, 1_shard-data-chains.md, 1_beacon-chain-misc.md)\n" + "\t phase0: (beacon-chain.md, fork-choice.md)\n" + "\t ssz: (merkle-proofs.md)\n" + "\t phase1: (custody-game.md, shard-data-chains.md, beacon-chain-misc.md)\n" "\t and output.py" ) else: diff --git a/specs/core/0_beacon-chain.md b/specs/phase0/beacon-chain.md similarity index 99% rename from specs/core/0_beacon-chain.md rename to specs/phase0/beacon-chain.md index 6fe947ba8..503286e48 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/phase0/beacon-chain.md @@ -261,7 +261,7 @@ The following values are (non-configurable) constants used throughout the specif ## Containers -The following types are [SimpleSerialize (SSZ)](../simple-serialize.md) containers. +The following types are [SimpleSerialize (SSZ)](../../ssz/simple-serialize.md) containers. *Note*: The definitions are ordered topologically to facilitate execution of the spec. @@ -579,7 +579,7 @@ def bytes_to_int(data: bytes) -> uint64: #### `hash_tree_root` -`def hash_tree_root(object: SSZSerializable) -> Root` is a function for hashing objects into a single root by utilizing a hash tree structure, as defined in the [SSZ spec](../simple-serialize.md#merkleization). +`def hash_tree_root(object: SSZSerializable) -> Root` is a function for hashing objects into a single root by utilizing a hash tree structure, as defined in the [SSZ spec](../../ssz/simple-serialize.md#merkleization). #### BLS Signatures diff --git a/specs/core/0_deposit-contract.md b/specs/phase0/deposit-contract.md similarity index 94% rename from specs/core/0_deposit-contract.md rename to specs/phase0/deposit-contract.md index 11be41b86..9c5137a32 100644 --- a/specs/core/0_deposit-contract.md +++ b/specs/phase0/deposit-contract.md @@ -40,7 +40,7 @@ The initial deployment phases of Ethereum 2.0 are implemented without consensus ### `deposit` function -The deposit contract has a public `deposit` function to make deposits. It takes as arguments `pubkey: bytes[48], withdrawal_credentials: bytes[32], signature: bytes[96], deposit_data_root: bytes32`. The first three arguments populate a [`DepositData`](./0_beacon-chain.md#depositdata) object, and `deposit_data_root` is the expected `DepositData` root as a protection against malformatted calldata. +The deposit contract has a public `deposit` function to make deposits. It takes as arguments `pubkey: bytes[48], withdrawal_credentials: bytes[32], signature: bytes[96], deposit_data_root: bytes32`. The first three arguments populate a [`DepositData`](./beacon-chain.md#depositdata) object, and `deposit_data_root` is the expected `DepositData` root as a protection against malformatted calldata. #### Deposit amount diff --git a/specs/core/0_fork-choice.md b/specs/phase0/fork-choice.md similarity index 97% rename from specs/core/0_fork-choice.md rename to specs/phase0/fork-choice.md index b286654af..0d9823fcd 100644 --- a/specs/core/0_fork-choice.md +++ b/specs/phase0/fork-choice.md @@ -34,7 +34,7 @@ ## Introduction -This document is the beacon chain fork choice spec, part of Ethereum 2.0 Phase 0. It assumes the [beacon chain state transition function spec](./0_beacon-chain.md). +This document is the beacon chain fork choice spec, part of Ethereum 2.0 Phase 0. It assumes the [beacon chain state transition function spec](./beacon-chain.md). ## Fork choice @@ -48,7 +48,7 @@ The head block root associated with a `store` is defined as `get_head(store)`. A 1) **Leap seconds**: Slots will last `SECONDS_PER_SLOT + 1` or `SECONDS_PER_SLOT - 1` seconds around leap seconds. This is automatically handled by [UNIX time](https://en.wikipedia.org/wiki/Unix_time). 2) **Honest clocks**: Honest nodes are assumed to have clocks synchronized within `SECONDS_PER_SLOT` seconds of each other. -3) **Eth1 data**: The large `ETH1_FOLLOW_DISTANCE` specified in the [honest validator document](../validator/0_beacon-chain-validator.md) should ensure that `state.latest_eth1_data` of the canonical Ethereum 2.0 chain remains consistent with the canonical Ethereum 1.0 chain. If not, emergency manual intervention will be required. +3) **Eth1 data**: The large `ETH1_FOLLOW_DISTANCE` specified in the [honest validator document](./validator.md) should ensure that `state.latest_eth1_data` of the canonical Ethereum 2.0 chain remains consistent with the canonical Ethereum 1.0 chain. If not, emergency manual intervention will be required. 4) **Manual forks**: Manual forks may arbitrarily change the fork choice rule but are expected to be enacted at epoch transitions, with the fork details reflected in `state.fork`. 5) **Implementation**: The implementation found in this specification is constructed for ease of understanding rather than for optimization in computation, space, or any other resource. A number of optimized alternatives can be found [here](https://github.com/protolambda/lmd-ghost). diff --git a/specs/networking/p2p-interface.md b/specs/phase0/p2p-interface.md similarity index 99% rename from specs/networking/p2p-interface.md rename to specs/phase0/p2p-interface.md index 8e060a092..c04d2ae4c 100644 --- a/specs/networking/p2p-interface.md +++ b/specs/phase0/p2p-interface.md @@ -398,12 +398,12 @@ Here, `result` represents the 1-byte response code. The token of the negotiated protocol ID specifies the type of encoding to be used for the req/resp interaction. Two values are possible at this time: -- `ssz`: the contents are [SSZ-encoded](../simple-serialize.md). This encoding type MUST be supported by all clients. For objects containing a single field, only the field is SSZ-encoded not a container with a single field. For example, the `BeaconBlocksByRoot` request is an SSZ-encoded list of `Bytes32`'s. +- `ssz`: the contents are [SSZ-encoded](../../ssz/simple-serialize.md). This encoding type MUST be supported by all clients. For objects containing a single field, only the field is SSZ-encoded not a container with a single field. For example, the `BeaconBlocksByRoot` request is an SSZ-encoded list of `Bytes32`'s. - `ssz_snappy`: The contents are SSZ-encoded and then compressed with [Snappy](https://github.com/google/snappy). MAY be supported in the interoperability testnet; MUST be supported in mainnet. #### SSZ-encoding strategy (with or without Snappy) -The [SimpleSerialize (SSZ) specification](../simple-serialize.md) outlines how objects are SSZ-encoded. If the Snappy variant is selected, we feed the serialized form to the Snappy compressor on encoding. The inverse happens on decoding. +The [SimpleSerialize (SSZ) specification](../../ssz/simple-serialize.md) outlines how objects are SSZ-encoded. If the Snappy variant is selected, we feed the serialized form to the Snappy compressor on encoding. The inverse happens on decoding. **Encoding-dependent header:** Req/Resp protocols using the `ssz` or `ssz_snappy` encoding strategies MUST prefix all encoded and compressed (if applicable) payloads with an unsigned [protobuf varint](https://developers.google.com/protocol-buffers/docs/encoding#varints). diff --git a/specs/validator/0_beacon-chain-validator.md b/specs/phase0/validator.md similarity index 87% rename from specs/validator/0_beacon-chain-validator.md rename to specs/phase0/validator.md index 473699c5a..75b9f9311 100644 --- a/specs/validator/0_beacon-chain-validator.md +++ b/specs/phase0/validator.md @@ -1,6 +1,6 @@ # Ethereum 2.0 Phase 0 -- Honest Validator -**Notice**: This document is a work-in-progress for researchers and implementers. This is an accompanying document to [Ethereum 2.0 Phase 0 -- The Beacon Chain](../core/0_beacon-chain.md), which describes the expected actions of a "validator" participating in the Ethereum 2.0 protocol. +**Notice**: This document is a work-in-progress for researchers and implementers. This is an accompanying document to [Ethereum 2.0 Phase 0 -- The Beacon Chain](./beacon-chain.md), which describes the expected actions of a "validator" participating in the Ethereum 2.0 protocol. ## Table of contents @@ -75,7 +75,7 @@ A validator is an entity that participates in the consensus of the Ethereum 2.0 ## Prerequisites -All terminology, constants, functions, and protocol mechanics defined in the [Phase 0 -- The Beacon Chain](../core/0_beacon-chain.md) and [Phase 0 -- Deposit Contract](../core/0_deposit-contract.md) doc are requisite for this document and used throughout. Please see the Phase 0 doc before continuing and use as a reference throughout. +All terminology, constants, functions, and protocol mechanics defined in the [Phase 0 -- The Beacon Chain](./beacon-chain.md) and [Phase 0 -- Deposit Contract](./deposit-contract.md) doc are requisite for this document and used throughout. Please see the Phase 0 doc before continuing and use as a reference throughout. ## Constants @@ -110,11 +110,11 @@ The validator constructs their `withdrawal_credentials` via the following: ### Submit deposit -In Phase 0, all incoming validator deposits originate from the Ethereum 1.0 proof-of-work chain. Deposits are made to the [deposit contract](../core/0_deposit-contract.md) located at `DEPOSIT_CONTRACT_ADDRESS`. +In Phase 0, all incoming validator deposits originate from the Ethereum 1.0 proof-of-work chain. Deposits are made to the [deposit contract](./deposit-contract.md) located at `DEPOSIT_CONTRACT_ADDRESS`. To submit a deposit: -- Pack the validator's [initialization parameters](#initialization) into `deposit_data`, a [`DepositData`](../core/0_beacon-chain.md#depositdata) SSZ object. +- Pack the validator's [initialization parameters](#initialization) into `deposit_data`, a [`DepositData`](./beacon-chain.md#depositdata) SSZ object. - Let `amount` be the amount in Gwei to be deposited by the validator where `amount >= MIN_DEPOSIT_AMOUNT`. - Set `deposit_data.pubkey` to validator's `pubkey`. - Set `deposit_data.withdrawal_credentials` to `withdrawal_credentials`. @@ -132,13 +132,13 @@ Deposits cannot be processed into the beacon chain until the Eth1 block in which ### Validator index -Once a validator has been processed and added to the beacon state's `validators`, the validator's `validator_index` is defined by the index into the registry at which the [`ValidatorRecord`](../core/0_beacon-chain.md#validator) contains the `pubkey` specified in the validator's deposit. A validator's `validator_index` is guaranteed to not change from the time of initial deposit until the validator exits and fully withdraws. This `validator_index` is used throughout the specification to dictate validator roles and responsibilities at any point and should be stored locally. +Once a validator has been processed and added to the beacon state's `validators`, the validator's `validator_index` is defined by the index into the registry at which the [`ValidatorRecord`](./beacon-chain.md#validator) contains the `pubkey` specified in the validator's deposit. A validator's `validator_index` is guaranteed to not change from the time of initial deposit until the validator exits and fully withdraws. This `validator_index` is used throughout the specification to dictate validator roles and responsibilities at any point and should be stored locally. ### Activation In normal operation, the validator is quickly activated, at which point the validator is added to the shuffling and begins validation after an additional `MAX_SEED_LOOKAHEAD` epochs (25.6 minutes). -The function [`is_active_validator`](../core/0_beacon-chain.md#is_active_validator) can be used to check if a validator is active during a given epoch. Usage is as follows: +The function [`is_active_validator`](./beacon-chain.md#is_active_validator) can be used to check if a validator is active during a given epoch. Usage is as follows: ```python def check_if_validator_active(state: BeaconState, validator_index: ValidatorIndex) -> bool: @@ -209,7 +209,7 @@ A validator has two primary responsibilities to the beacon chain: [proposing blo ### Block proposal -A validator is expected to propose a [`SignedBeaconBlock`](../core/0_beacon-chain.md#signedbeaconblock) at the beginning of any slot during which `is_proposer(state, validator_index)` returns `True`. To propose, the validator selects the `BeaconBlock`, `parent`, that in their view of the fork choice is the head of the chain during `slot - 1`. The validator creates, signs, and broadcasts a `block` that is a child of `parent` that satisfies a valid [beacon chain state transition](../core/0_beacon-chain.md#beacon-chain-state-transition-function). +A validator is expected to propose a [`SignedBeaconBlock`](./beacon-chain.md#signedbeaconblock) at the beginning of any slot during which `is_proposer(state, validator_index)` returns `True`. To propose, the validator selects the `BeaconBlock`, `parent`, that in their view of the fork choice is the head of the chain during `slot - 1`. The validator creates, signs, and broadcasts a `block` that is a child of `parent` that satisfies a valid [beacon chain state transition](./beacon-chain.md#beacon-chain-state-transition-function). There is one proposer per slot, so if there are N active validators any individual validator will on average be assigned to propose once per N slots (e.g. at 312,500 validators = 10 million ETH, that's once per ~6 weeks). @@ -302,25 +302,25 @@ def get_eth1_vote(state: BeaconState, eth1_chain: Sequence[Eth1Block]) -> Eth1Da ##### Proposer slashings -Up to `MAX_PROPOSER_SLASHINGS`, [`ProposerSlashing`](../core/0_beacon-chain.md#proposerslashing) objects can be included in the `block`. The proposer slashings must satisfy the verification conditions found in [proposer slashings processing](../core/0_beacon-chain.md#proposer-slashings). The validator receives a small "whistleblower" reward for each proposer slashing found and included. +Up to `MAX_PROPOSER_SLASHINGS`, [`ProposerSlashing`](./beacon-chain.md#proposerslashing) objects can be included in the `block`. The proposer slashings must satisfy the verification conditions found in [proposer slashings processing](./beacon-chain.md#proposer-slashings). The validator receives a small "whistleblower" reward for each proposer slashing found and included. ##### Attester slashings -Up to `MAX_ATTESTER_SLASHINGS`, [`AttesterSlashing`](../core/0_beacon-chain.md#attesterslashing) objects can be included in the `block`. The attester slashings must satisfy the verification conditions found in [attester slashings processing](../core/0_beacon-chain.md#attester-slashings). The validator receives a small "whistleblower" reward for each attester slashing found and included. +Up to `MAX_ATTESTER_SLASHINGS`, [`AttesterSlashing`](./beacon-chain.md#attesterslashing) objects can be included in the `block`. The attester slashings must satisfy the verification conditions found in [attester slashings processing](./beacon-chain.md#attester-slashings). The validator receives a small "whistleblower" reward for each attester slashing found and included. ##### Attestations -Up to `MAX_ATTESTATIONS`, aggregate attestations can be included in the `block`. The attestations added must satisfy the verification conditions found in [attestation processing](../core/0_beacon-chain.md#attestations). To maximize profit, the validator should attempt to gather aggregate attestations that include singular attestations from the largest number of validators whose signatures from the same epoch have not previously been added on chain. +Up to `MAX_ATTESTATIONS`, aggregate attestations can be included in the `block`. The attestations added must satisfy the verification conditions found in [attestation processing](./beacon-chain.md#attestations). To maximize profit, the validator should attempt to gather aggregate attestations that include singular attestations from the largest number of validators whose signatures from the same epoch have not previously been added on chain. ##### Deposits -If there are any unprocessed deposits for the existing `state.eth1_data` (i.e. `state.eth1_data.deposit_count > state.eth1_deposit_index`), then pending deposits _must_ be added to the block. The expected number of deposits is exactly `min(MAX_DEPOSITS, eth1_data.deposit_count - state.eth1_deposit_index)`. These [`deposits`](../core/0_beacon-chain.md#deposit) are constructed from the `Deposit` logs from the [Eth1 deposit contract](../core/0_deposit-contract.md) and must be processed in sequential order. The deposits included in the `block` must satisfy the verification conditions found in [deposits processing](../core/0_beacon-chain.md#deposits). +If there are any unprocessed deposits for the existing `state.eth1_data` (i.e. `state.eth1_data.deposit_count > state.eth1_deposit_index`), then pending deposits _must_ be added to the block. The expected number of deposits is exactly `min(MAX_DEPOSITS, eth1_data.deposit_count - state.eth1_deposit_index)`. These [`deposits`](./beacon-chain.md#deposit) are constructed from the `Deposit` logs from the [Eth1 deposit contract](./deposit-contract.md) and must be processed in sequential order. The deposits included in the `block` must satisfy the verification conditions found in [deposits processing](./beacon-chain.md#deposits). The `proof` for each deposit must be constructed against the deposit root contained in `state.eth1_data` rather than the deposit root at the time the deposit was initially logged from the 1.0 chain. This entails storing a full deposit merkle tree locally and computing updated proofs against the `eth1_data.deposit_root` as needed. See [`minimal_merkle.py`](https://github.com/ethereum/research/blob/master/spec_pythonizer/utils/merkle_minimal.py) for a sample implementation. ##### Voluntary exits -Up to `MAX_VOLUNTARY_EXITS`, [`VoluntaryExit`](../core/0_beacon-chain.md#voluntaryexit) objects can be included in the `block`. The exits must satisfy the verification conditions found in [exits processing](../core/0_beacon-chain.md#voluntary-exits). +Up to `MAX_VOLUNTARY_EXITS`, [`VoluntaryExit`](./beacon-chain.md#voluntaryexit) objects can be included in the `block`. The exits must satisfy the verification conditions found in [exits processing](./beacon-chain.md#voluntary-exits). #### Packaging into a `SignedBeaconBlock` @@ -360,7 +360,7 @@ A validator should create and broadcast the `attestation` to the associated atte #### Attestation data -First, the validator should construct `attestation_data`, an [`AttestationData`](../core/0_beacon-chain.md#attestationdata) object based upon the state at the assigned slot. +First, the validator should construct `attestation_data`, an [`AttestationData`](./beacon-chain.md#attestationdata) object based upon the state at the assigned slot. - Let `head_block` be the result of running the fork choice during the assigned slot. - Let `head_state` be the state of `head_block` processed through any empty slots up to the assigned slot using `process_slots(state, slot)`. @@ -386,7 +386,7 @@ Set `attestation_data.beacon_block_root = hash_tree_root(head_block)`. #### Construct attestation -Next, the validator creates `attestation`, an [`Attestation`](../core/0_beacon-chain.md#attestation) object. +Next, the validator creates `attestation`, an [`Attestation`](./beacon-chain.md#attestation) object. ##### Data @@ -495,7 +495,7 @@ Because Phase 0 does not have shards and thus does not have Shard Committees, th ### Proposer slashing -To avoid "proposer slashings", a validator must not sign two conflicting [`BeaconBlock`](../core/0_beacon-chain.md#beaconblock) where conflicting is defined as two distinct blocks within the same epoch. +To avoid "proposer slashings", a validator must not sign two conflicting [`BeaconBlock`](./beacon-chain.md#beaconblock) where conflicting is defined as two distinct blocks within the same epoch. *In Phase 0, as long as the validator does not sign two different beacon blocks for the same epoch, the validator is safe against proposer slashings.* @@ -508,7 +508,7 @@ If the software crashes at some point within this routine, then when the validat ### Attester slashing -To avoid "attester slashings", a validator must not sign two conflicting [`AttestationData`](../core/0_beacon-chain.md#attestationdata) objects, i.e. two attestations that satisfy [`is_slashable_attestation_data`](../core/0_beacon-chain.md#is_slashable_attestation_data). +To avoid "attester slashings", a validator must not sign two conflicting [`AttestationData`](./beacon-chain.md#attestationdata) objects, i.e. two attestations that satisfy [`is_slashable_attestation_data`](./beacon-chain.md#is_slashable_attestation_data). Specifically, when signing an `Attestation`, a validator should perform the following steps in the following order: diff --git a/specs/core/1_beacon-chain-misc.md b/specs/phase1/beacon-chain-misc.md similarity index 100% rename from specs/core/1_beacon-chain-misc.md rename to specs/phase1/beacon-chain-misc.md diff --git a/specs/core/1_custody-game.md b/specs/phase1/custody-game.md similarity index 99% rename from specs/core/1_custody-game.md rename to specs/phase1/custody-game.md index fdaf9af42..c09fa1867 100644 --- a/specs/core/1_custody-game.md +++ b/specs/phase1/custody-game.md @@ -59,7 +59,7 @@ ## Introduction -This document details the beacon chain additions and changes in Phase 1 of Ethereum 2.0 to support the shard data custody game, building upon the [Phase 0](0_beacon-chain.md) specification. +This document details the beacon chain additions and changes in Phase 1 of Ethereum 2.0 to support the shard data custody game, building upon the [Phase 0](../phase0/beacon-chain.md) specification. ## Terminology diff --git a/specs/light_client/sync_protocol.md b/specs/phase1/light-client-sync.md similarity index 100% rename from specs/light_client/sync_protocol.md rename to specs/phase1/light-client-sync.md diff --git a/specs/core/1_shard-data-chains.md b/specs/phase1/shard-data-chains.md similarity index 100% rename from specs/core/1_shard-data-chains.md rename to specs/phase1/shard-data-chains.md diff --git a/specs/light_client/merkle_proofs.md b/ssz/merkle-proofs.md similarity index 100% rename from specs/light_client/merkle_proofs.md rename to ssz/merkle-proofs.md diff --git a/specs/simple-serialize.md b/ssz/simple-serialize.md similarity index 97% rename from specs/simple-serialize.md rename to ssz/simple-serialize.md index 860a27f01..1c4f588eb 100644 --- a/specs/simple-serialize.md +++ b/ssz/simple-serialize.md @@ -239,7 +239,7 @@ We now define Merkleization `hash_tree_root(value)` of an object `value` recursi Let `A` be an object derived from another object `B` by replacing some of the (possibly nested) values of `B` by their `hash_tree_root`. We say `A` is a "summary" of `B`, and that `B` is an "expansion" of `A`. Notice `hash_tree_root(A) == hash_tree_root(B)`. -We similarly define "summary types" and "expansion types". For example, [`BeaconBlock`](./core/0_beacon-chain.md#beaconblock) is an expansion type of [`BeaconBlockHeader`](./core/0_beacon-chain.md#beaconblockheader). Notice that objects expand to at most one object of a given expansion type. For example, `BeaconBlockHeader` objects uniquely expand to `BeaconBlock` objects. +We similarly define "summary types" and "expansion types". For example, [`BeaconBlock`](../specs/phase0/beacon-chain.md#beaconblock) is an expansion type of [`BeaconBlockHeader`](../specs/phase0/beacon-chain.md#beaconblockheader). Notice that objects expand to at most one object of a given expansion type. For example, `BeaconBlockHeader` objects uniquely expand to `BeaconBlock` objects. ## Implementations diff --git a/test_generators/epoch_processing/requirements.txt b/test_generators/epoch_processing/requirements.txt deleted file mode 100644 index 3314093d3..000000000 --- a/test_generators/epoch_processing/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -../../test_libs/gen_helpers -../../test_libs/config_helpers -../../test_libs/pyspec \ No newline at end of file diff --git a/test_generators/genesis/requirements.txt b/test_generators/genesis/requirements.txt deleted file mode 100644 index 3314093d3..000000000 --- a/test_generators/genesis/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -../../test_libs/gen_helpers -../../test_libs/config_helpers -../../test_libs/pyspec \ No newline at end of file diff --git a/test_generators/operations/requirements.txt b/test_generators/operations/requirements.txt deleted file mode 100644 index 595cee69c..000000000 --- a/test_generators/operations/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -eth-utils==1.6.0 -../../test_libs/gen_helpers -../../test_libs/config_helpers -../../test_libs/pyspec \ No newline at end of file diff --git a/test_generators/sanity/requirements.txt b/test_generators/sanity/requirements.txt deleted file mode 100644 index 3314093d3..000000000 --- a/test_generators/sanity/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -../../test_libs/gen_helpers -../../test_libs/config_helpers -../../test_libs/pyspec \ No newline at end of file diff --git a/test_generators/shuffling/requirements.txt b/test_generators/shuffling/requirements.txt deleted file mode 100644 index 595cee69c..000000000 --- a/test_generators/shuffling/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -eth-utils==1.6.0 -../../test_libs/gen_helpers -../../test_libs/config_helpers -../../test_libs/pyspec \ No newline at end of file diff --git a/test_generators/ssz_generic/requirements.txt b/test_generators/ssz_generic/requirements.txt deleted file mode 100644 index c540f26b5..000000000 --- a/test_generators/ssz_generic/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -eth-utils==1.6.0 -../../test_libs/gen_helpers -../../test_libs/config_helpers -../../test_libs/pyspec diff --git a/test_generators/ssz_static/requirements.txt b/test_generators/ssz_static/requirements.txt deleted file mode 100644 index 3314093d3..000000000 --- a/test_generators/ssz_static/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -../../test_libs/gen_helpers -../../test_libs/config_helpers -../../test_libs/pyspec \ No newline at end of file diff --git a/test_libs/config_helpers/README.md b/tests/core/config_helpers/README.md similarity index 72% rename from test_libs/config_helpers/README.md rename to tests/core/config_helpers/README.md index 20dfcf7bf..85a9304d7 100644 --- a/test_libs/config_helpers/README.md +++ b/tests/core/config_helpers/README.md @@ -1,7 +1,7 @@ # Eth2 config helpers -`preset_loader`: A util to load constants-presets with. -See [Constants-presets documentation](../../configs/constants_presets/README.md). +`preset_loader`: A util to load config-presets with. +See [Configs documentation](../../../configs/README.md). Usage: diff --git a/test_generators/ssz_generic/__init__.py b/tests/core/config_helpers/preset_loader/__init__.py similarity index 100% rename from test_generators/ssz_generic/__init__.py rename to tests/core/config_helpers/preset_loader/__init__.py diff --git a/test_libs/config_helpers/preset_loader/loader.py b/tests/core/config_helpers/preset_loader/loader.py similarity index 100% rename from test_libs/config_helpers/preset_loader/loader.py rename to tests/core/config_helpers/preset_loader/loader.py diff --git a/test_libs/config_helpers/requirements.txt b/tests/core/config_helpers/requirements.txt similarity index 100% rename from test_libs/config_helpers/requirements.txt rename to tests/core/config_helpers/requirements.txt diff --git a/test_libs/config_helpers/setup.py b/tests/core/config_helpers/setup.py similarity index 100% rename from test_libs/config_helpers/setup.py rename to tests/core/config_helpers/setup.py diff --git a/test_libs/gen_helpers/README.md b/tests/core/gen_helpers/README.md similarity index 96% rename from test_libs/gen_helpers/README.md rename to tests/core/gen_helpers/README.md index 1d74a31d3..20b48db83 100644 --- a/test_libs/gen_helpers/README.md +++ b/tests/core/gen_helpers/README.md @@ -4,7 +4,7 @@ A util to quickly write new test suite generators with. -See [Generators documentation](../../test_generators/README.md) for integration details. +See [Generators documentation](../../generators/README.md) for integration details. Options: diff --git a/test_generators/ssz_static/__init__.py b/tests/core/gen_helpers/gen_base/__init__.py similarity index 100% rename from test_generators/ssz_static/__init__.py rename to tests/core/gen_helpers/gen_base/__init__.py diff --git a/test_libs/gen_helpers/gen_base/gen_runner.py b/tests/core/gen_helpers/gen_base/gen_runner.py similarity index 100% rename from test_libs/gen_helpers/gen_base/gen_runner.py rename to tests/core/gen_helpers/gen_base/gen_runner.py diff --git a/test_libs/gen_helpers/gen_base/gen_typing.py b/tests/core/gen_helpers/gen_base/gen_typing.py similarity index 100% rename from test_libs/gen_helpers/gen_base/gen_typing.py rename to tests/core/gen_helpers/gen_base/gen_typing.py diff --git a/test_libs/config_helpers/preset_loader/__init__.py b/tests/core/gen_helpers/gen_from_tests/__init__.py similarity index 100% rename from test_libs/config_helpers/preset_loader/__init__.py rename to tests/core/gen_helpers/gen_from_tests/__init__.py diff --git a/test_libs/gen_helpers/gen_from_tests/gen.py b/tests/core/gen_helpers/gen_from_tests/gen.py similarity index 100% rename from test_libs/gen_helpers/gen_from_tests/gen.py rename to tests/core/gen_helpers/gen_from_tests/gen.py diff --git a/test_libs/gen_helpers/requirements.txt b/tests/core/gen_helpers/requirements.txt similarity index 100% rename from test_libs/gen_helpers/requirements.txt rename to tests/core/gen_helpers/requirements.txt diff --git a/test_libs/gen_helpers/setup.py b/tests/core/gen_helpers/setup.py similarity index 100% rename from test_libs/gen_helpers/setup.py rename to tests/core/gen_helpers/setup.py diff --git a/test_libs/pyspec/README.md b/tests/core/pyspec/README.md similarity index 95% rename from test_libs/pyspec/README.md rename to tests/core/pyspec/README.md index ea994c71b..2e596520c 100644 --- a/test_libs/pyspec/README.md +++ b/tests/core/pyspec/README.md @@ -63,4 +63,4 @@ The pyspec is not a replacement. ## License -Same as the spec itself; see [LICENSE](../../LICENSE) file in the specs repository root. +Same as the spec itself; see [LICENSE](../../../LICENSE) file in the specs repository root. diff --git a/test_libs/gen_helpers/gen_base/__init__.py b/tests/core/pyspec/__init__.py similarity index 100% rename from test_libs/gen_helpers/gen_base/__init__.py rename to tests/core/pyspec/__init__.py diff --git a/test_libs/gen_helpers/gen_from_tests/__init__.py b/tests/core/pyspec/eth2spec/__init__.py similarity index 100% rename from test_libs/gen_helpers/gen_from_tests/__init__.py rename to tests/core/pyspec/eth2spec/__init__.py diff --git a/test_libs/pyspec/__init__.py b/tests/core/pyspec/eth2spec/debug/__init__.py similarity index 100% rename from test_libs/pyspec/__init__.py rename to tests/core/pyspec/eth2spec/debug/__init__.py diff --git a/test_libs/pyspec/eth2spec/debug/decode.py b/tests/core/pyspec/eth2spec/debug/decode.py similarity index 100% rename from test_libs/pyspec/eth2spec/debug/decode.py rename to tests/core/pyspec/eth2spec/debug/decode.py diff --git a/test_libs/pyspec/eth2spec/debug/encode.py b/tests/core/pyspec/eth2spec/debug/encode.py similarity index 100% rename from test_libs/pyspec/eth2spec/debug/encode.py rename to tests/core/pyspec/eth2spec/debug/encode.py diff --git a/test_libs/pyspec/eth2spec/debug/random_value.py b/tests/core/pyspec/eth2spec/debug/random_value.py similarity index 100% rename from test_libs/pyspec/eth2spec/debug/random_value.py rename to tests/core/pyspec/eth2spec/debug/random_value.py diff --git a/test_libs/pyspec/eth2spec/__init__.py b/tests/core/pyspec/eth2spec/fuzzing/__init__.py similarity index 100% rename from test_libs/pyspec/eth2spec/__init__.py rename to tests/core/pyspec/eth2spec/fuzzing/__init__.py diff --git a/test_libs/pyspec/eth2spec/fuzzing/decoder.py b/tests/core/pyspec/eth2spec/fuzzing/decoder.py similarity index 100% rename from test_libs/pyspec/eth2spec/fuzzing/decoder.py rename to tests/core/pyspec/eth2spec/fuzzing/decoder.py diff --git a/test_libs/pyspec/eth2spec/fuzzing/test_decoder.py b/tests/core/pyspec/eth2spec/fuzzing/test_decoder.py similarity index 100% rename from test_libs/pyspec/eth2spec/fuzzing/test_decoder.py rename to tests/core/pyspec/eth2spec/fuzzing/test_decoder.py diff --git a/test_libs/pyspec/eth2spec/debug/__init__.py b/tests/core/pyspec/eth2spec/phase0/__init__.py similarity index 100% rename from test_libs/pyspec/eth2spec/debug/__init__.py rename to tests/core/pyspec/eth2spec/phase0/__init__.py diff --git a/test_libs/pyspec/eth2spec/fuzzing/__init__.py b/tests/core/pyspec/eth2spec/phase1/__init__.py similarity index 100% rename from test_libs/pyspec/eth2spec/fuzzing/__init__.py rename to tests/core/pyspec/eth2spec/phase1/__init__.py diff --git a/test_libs/pyspec/eth2spec/phase0/__init__.py b/tests/core/pyspec/eth2spec/test/__init__.py similarity index 100% rename from test_libs/pyspec/eth2spec/phase0/__init__.py rename to tests/core/pyspec/eth2spec/test/__init__.py diff --git a/test_libs/pyspec/eth2spec/test/conftest.py b/tests/core/pyspec/eth2spec/test/conftest.py similarity index 93% rename from test_libs/pyspec/eth2spec/test/conftest.py rename to tests/core/pyspec/eth2spec/test/conftest.py index 5713c3470..1d299042a 100644 --- a/test_libs/pyspec/eth2spec/test/conftest.py +++ b/tests/core/pyspec/eth2spec/test/conftest.py @@ -34,6 +34,6 @@ def pytest_addoption(parser): def config(request): config_name = request.config.getoption("--config") from preset_loader import loader - presets = loader.load_presets('../../configs/', config_name) + presets = loader.load_presets('../../../configs/', config_name) spec_phase0.apply_constants_preset(presets) spec_phase1.apply_constants_preset(presets) diff --git a/test_libs/pyspec/eth2spec/test/context.py b/tests/core/pyspec/eth2spec/test/context.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/context.py rename to tests/core/pyspec/eth2spec/test/context.py diff --git a/test_libs/pyspec/eth2spec/test/fork_choice/test_get_head.py b/tests/core/pyspec/eth2spec/test/fork_choice/test_get_head.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/fork_choice/test_get_head.py rename to tests/core/pyspec/eth2spec/test/fork_choice/test_get_head.py diff --git a/test_libs/pyspec/eth2spec/test/fork_choice/test_on_attestation.py b/tests/core/pyspec/eth2spec/test/fork_choice/test_on_attestation.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/fork_choice/test_on_attestation.py rename to tests/core/pyspec/eth2spec/test/fork_choice/test_on_attestation.py diff --git a/test_libs/pyspec/eth2spec/test/fork_choice/test_on_block.py b/tests/core/pyspec/eth2spec/test/fork_choice/test_on_block.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/fork_choice/test_on_block.py rename to tests/core/pyspec/eth2spec/test/fork_choice/test_on_block.py diff --git a/test_libs/pyspec/eth2spec/test/fork_choice/test_on_tick.py b/tests/core/pyspec/eth2spec/test/fork_choice/test_on_tick.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/fork_choice/test_on_tick.py rename to tests/core/pyspec/eth2spec/test/fork_choice/test_on_tick.py diff --git a/test_libs/pyspec/eth2spec/phase1/__init__.py b/tests/core/pyspec/eth2spec/test/genesis/__init__.py similarity index 100% rename from test_libs/pyspec/eth2spec/phase1/__init__.py rename to tests/core/pyspec/eth2spec/test/genesis/__init__.py diff --git a/test_libs/pyspec/eth2spec/test/genesis/test_initialization.py b/tests/core/pyspec/eth2spec/test/genesis/test_initialization.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/genesis/test_initialization.py rename to tests/core/pyspec/eth2spec/test/genesis/test_initialization.py diff --git a/test_libs/pyspec/eth2spec/test/genesis/test_validity.py b/tests/core/pyspec/eth2spec/test/genesis/test_validity.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/genesis/test_validity.py rename to tests/core/pyspec/eth2spec/test/genesis/test_validity.py diff --git a/test_libs/pyspec/eth2spec/test/__init__.py b/tests/core/pyspec/eth2spec/test/helpers/__init__.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/__init__.py rename to tests/core/pyspec/eth2spec/test/helpers/__init__.py diff --git a/test_libs/pyspec/eth2spec/test/helpers/attestations.py b/tests/core/pyspec/eth2spec/test/helpers/attestations.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/helpers/attestations.py rename to tests/core/pyspec/eth2spec/test/helpers/attestations.py diff --git a/test_libs/pyspec/eth2spec/test/helpers/attester_slashings.py b/tests/core/pyspec/eth2spec/test/helpers/attester_slashings.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/helpers/attester_slashings.py rename to tests/core/pyspec/eth2spec/test/helpers/attester_slashings.py diff --git a/test_libs/pyspec/eth2spec/test/helpers/block.py b/tests/core/pyspec/eth2spec/test/helpers/block.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/helpers/block.py rename to tests/core/pyspec/eth2spec/test/helpers/block.py diff --git a/test_libs/pyspec/eth2spec/test/helpers/block_header.py b/tests/core/pyspec/eth2spec/test/helpers/block_header.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/helpers/block_header.py rename to tests/core/pyspec/eth2spec/test/helpers/block_header.py diff --git a/test_libs/pyspec/eth2spec/test/helpers/custody.py b/tests/core/pyspec/eth2spec/test/helpers/custody.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/helpers/custody.py rename to tests/core/pyspec/eth2spec/test/helpers/custody.py diff --git a/test_libs/pyspec/eth2spec/test/helpers/deposits.py b/tests/core/pyspec/eth2spec/test/helpers/deposits.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/helpers/deposits.py rename to tests/core/pyspec/eth2spec/test/helpers/deposits.py diff --git a/test_libs/pyspec/eth2spec/test/helpers/genesis.py b/tests/core/pyspec/eth2spec/test/helpers/genesis.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/helpers/genesis.py rename to tests/core/pyspec/eth2spec/test/helpers/genesis.py diff --git a/test_libs/pyspec/eth2spec/test/helpers/keys.py b/tests/core/pyspec/eth2spec/test/helpers/keys.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/helpers/keys.py rename to tests/core/pyspec/eth2spec/test/helpers/keys.py diff --git a/test_libs/pyspec/eth2spec/test/genesis/__init__.py b/tests/core/pyspec/eth2spec/test/helpers/phase1/__init__.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/genesis/__init__.py rename to tests/core/pyspec/eth2spec/test/helpers/phase1/__init__.py diff --git a/test_libs/pyspec/eth2spec/test/helpers/phase1/attestations.py b/tests/core/pyspec/eth2spec/test/helpers/phase1/attestations.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/helpers/phase1/attestations.py rename to tests/core/pyspec/eth2spec/test/helpers/phase1/attestations.py diff --git a/test_libs/pyspec/eth2spec/test/helpers/phase1/shard_block.py b/tests/core/pyspec/eth2spec/test/helpers/phase1/shard_block.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/helpers/phase1/shard_block.py rename to tests/core/pyspec/eth2spec/test/helpers/phase1/shard_block.py diff --git a/test_libs/pyspec/eth2spec/test/helpers/phase1/shard_state.py b/tests/core/pyspec/eth2spec/test/helpers/phase1/shard_state.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/helpers/phase1/shard_state.py rename to tests/core/pyspec/eth2spec/test/helpers/phase1/shard_state.py diff --git a/test_libs/pyspec/eth2spec/test/helpers/proposer_slashings.py b/tests/core/pyspec/eth2spec/test/helpers/proposer_slashings.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/helpers/proposer_slashings.py rename to tests/core/pyspec/eth2spec/test/helpers/proposer_slashings.py diff --git a/test_libs/pyspec/eth2spec/test/helpers/state.py b/tests/core/pyspec/eth2spec/test/helpers/state.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/helpers/state.py rename to tests/core/pyspec/eth2spec/test/helpers/state.py diff --git a/test_libs/pyspec/eth2spec/test/helpers/voluntary_exits.py b/tests/core/pyspec/eth2spec/test/helpers/voluntary_exits.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/helpers/voluntary_exits.py rename to tests/core/pyspec/eth2spec/test/helpers/voluntary_exits.py diff --git a/test_libs/pyspec/eth2spec/test/helpers/__init__.py b/tests/core/pyspec/eth2spec/test/merkle_proofs/__init__.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/helpers/__init__.py rename to tests/core/pyspec/eth2spec/test/merkle_proofs/__init__.py diff --git a/test_libs/pyspec/eth2spec/test/merkle_proofs/test_merkle_proofs.py b/tests/core/pyspec/eth2spec/test/merkle_proofs/test_merkle_proofs.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/merkle_proofs/test_merkle_proofs.py rename to tests/core/pyspec/eth2spec/test/merkle_proofs/test_merkle_proofs.py diff --git a/test_libs/pyspec/eth2spec/test/helpers/phase1/__init__.py b/tests/core/pyspec/eth2spec/test/phase_0/__init__.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/helpers/phase1/__init__.py rename to tests/core/pyspec/eth2spec/test/phase_0/__init__.py diff --git a/test_libs/pyspec/eth2spec/test/merkle_proofs/__init__.py b/tests/core/pyspec/eth2spec/test/phase_0/block_processing/__init__.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/merkle_proofs/__init__.py rename to tests/core/pyspec/eth2spec/test/phase_0/block_processing/__init__.py diff --git a/test_libs/pyspec/eth2spec/test/phase_0/block_processing/test_process_attestation.py b/tests/core/pyspec/eth2spec/test/phase_0/block_processing/test_process_attestation.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/phase_0/block_processing/test_process_attestation.py rename to tests/core/pyspec/eth2spec/test/phase_0/block_processing/test_process_attestation.py diff --git a/test_libs/pyspec/eth2spec/test/phase_0/block_processing/test_process_attester_slashing.py b/tests/core/pyspec/eth2spec/test/phase_0/block_processing/test_process_attester_slashing.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/phase_0/block_processing/test_process_attester_slashing.py rename to tests/core/pyspec/eth2spec/test/phase_0/block_processing/test_process_attester_slashing.py diff --git a/test_libs/pyspec/eth2spec/test/phase_0/block_processing/test_process_block_header.py b/tests/core/pyspec/eth2spec/test/phase_0/block_processing/test_process_block_header.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/phase_0/block_processing/test_process_block_header.py rename to tests/core/pyspec/eth2spec/test/phase_0/block_processing/test_process_block_header.py diff --git a/test_libs/pyspec/eth2spec/test/phase_0/block_processing/test_process_deposit.py b/tests/core/pyspec/eth2spec/test/phase_0/block_processing/test_process_deposit.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/phase_0/block_processing/test_process_deposit.py rename to tests/core/pyspec/eth2spec/test/phase_0/block_processing/test_process_deposit.py diff --git a/test_libs/pyspec/eth2spec/test/phase_0/block_processing/test_process_proposer_slashing.py b/tests/core/pyspec/eth2spec/test/phase_0/block_processing/test_process_proposer_slashing.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/phase_0/block_processing/test_process_proposer_slashing.py rename to tests/core/pyspec/eth2spec/test/phase_0/block_processing/test_process_proposer_slashing.py diff --git a/test_libs/pyspec/eth2spec/test/phase_0/block_processing/test_process_voluntary_exit.py b/tests/core/pyspec/eth2spec/test/phase_0/block_processing/test_process_voluntary_exit.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/phase_0/block_processing/test_process_voluntary_exit.py rename to tests/core/pyspec/eth2spec/test/phase_0/block_processing/test_process_voluntary_exit.py diff --git a/test_libs/pyspec/eth2spec/test/phase_0/__init__.py b/tests/core/pyspec/eth2spec/test/phase_0/epoch_processing/__init__.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/phase_0/__init__.py rename to tests/core/pyspec/eth2spec/test/phase_0/epoch_processing/__init__.py diff --git a/test_libs/pyspec/eth2spec/test/phase_0/epoch_processing/run_epoch_process_base.py b/tests/core/pyspec/eth2spec/test/phase_0/epoch_processing/run_epoch_process_base.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/phase_0/epoch_processing/run_epoch_process_base.py rename to tests/core/pyspec/eth2spec/test/phase_0/epoch_processing/run_epoch_process_base.py diff --git a/test_libs/pyspec/eth2spec/test/phase_0/epoch_processing/test_process_final_updates.py b/tests/core/pyspec/eth2spec/test/phase_0/epoch_processing/test_process_final_updates.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/phase_0/epoch_processing/test_process_final_updates.py rename to tests/core/pyspec/eth2spec/test/phase_0/epoch_processing/test_process_final_updates.py diff --git a/test_libs/pyspec/eth2spec/test/phase_0/epoch_processing/test_process_justification_and_finalization.py b/tests/core/pyspec/eth2spec/test/phase_0/epoch_processing/test_process_justification_and_finalization.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/phase_0/epoch_processing/test_process_justification_and_finalization.py rename to tests/core/pyspec/eth2spec/test/phase_0/epoch_processing/test_process_justification_and_finalization.py diff --git a/test_libs/pyspec/eth2spec/test/phase_0/epoch_processing/test_process_registry_updates.py b/tests/core/pyspec/eth2spec/test/phase_0/epoch_processing/test_process_registry_updates.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/phase_0/epoch_processing/test_process_registry_updates.py rename to tests/core/pyspec/eth2spec/test/phase_0/epoch_processing/test_process_registry_updates.py diff --git a/test_libs/pyspec/eth2spec/test/phase_0/epoch_processing/test_process_rewards_and_penalties.py b/tests/core/pyspec/eth2spec/test/phase_0/epoch_processing/test_process_rewards_and_penalties.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/phase_0/epoch_processing/test_process_rewards_and_penalties.py rename to tests/core/pyspec/eth2spec/test/phase_0/epoch_processing/test_process_rewards_and_penalties.py diff --git a/test_libs/pyspec/eth2spec/test/phase_0/epoch_processing/test_process_slashings.py b/tests/core/pyspec/eth2spec/test/phase_0/epoch_processing/test_process_slashings.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/phase_0/epoch_processing/test_process_slashings.py rename to tests/core/pyspec/eth2spec/test/phase_0/epoch_processing/test_process_slashings.py diff --git a/test_libs/pyspec/eth2spec/test/phase_0/block_processing/__init__.py b/tests/core/pyspec/eth2spec/test/phase_1/__init__.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/phase_0/block_processing/__init__.py rename to tests/core/pyspec/eth2spec/test/phase_1/__init__.py diff --git a/test_libs/pyspec/eth2spec/test/phase_0/epoch_processing/__init__.py b/tests/core/pyspec/eth2spec/test/phase_1/block_processing/__init__.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/phase_0/epoch_processing/__init__.py rename to tests/core/pyspec/eth2spec/test/phase_1/block_processing/__init__.py diff --git a/test_libs/pyspec/eth2spec/test/phase_1/block_processing/test_process_bit_challenge.py b/tests/core/pyspec/eth2spec/test/phase_1/block_processing/test_process_bit_challenge.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/phase_1/block_processing/test_process_bit_challenge.py rename to tests/core/pyspec/eth2spec/test/phase_1/block_processing/test_process_bit_challenge.py diff --git a/test_libs/pyspec/eth2spec/test/phase_1/block_processing/test_process_custody_key_reveal.py b/tests/core/pyspec/eth2spec/test/phase_1/block_processing/test_process_custody_key_reveal.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/phase_1/block_processing/test_process_custody_key_reveal.py rename to tests/core/pyspec/eth2spec/test/phase_1/block_processing/test_process_custody_key_reveal.py diff --git a/test_libs/pyspec/eth2spec/test/phase_1/block_processing/test_process_early_derived_secret_reveal.py b/tests/core/pyspec/eth2spec/test/phase_1/block_processing/test_process_early_derived_secret_reveal.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/phase_1/block_processing/test_process_early_derived_secret_reveal.py rename to tests/core/pyspec/eth2spec/test/phase_1/block_processing/test_process_early_derived_secret_reveal.py diff --git a/test_libs/pyspec/eth2spec/test/phase_1/sanity/test_shard_blocks.py b/tests/core/pyspec/eth2spec/test/phase_1/sanity/test_shard_blocks.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/phase_1/sanity/test_shard_blocks.py rename to tests/core/pyspec/eth2spec/test/phase_1/sanity/test_shard_blocks.py diff --git a/test_libs/pyspec/eth2spec/test/phase_1/__init__.py b/tests/core/pyspec/eth2spec/test/sanity/__init__.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/phase_1/__init__.py rename to tests/core/pyspec/eth2spec/test/sanity/__init__.py diff --git a/test_libs/pyspec/eth2spec/test/sanity/test_blocks.py b/tests/core/pyspec/eth2spec/test/sanity/test_blocks.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/sanity/test_blocks.py rename to tests/core/pyspec/eth2spec/test/sanity/test_blocks.py diff --git a/test_libs/pyspec/eth2spec/test/sanity/test_slots.py b/tests/core/pyspec/eth2spec/test/sanity/test_slots.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/sanity/test_slots.py rename to tests/core/pyspec/eth2spec/test/sanity/test_slots.py diff --git a/test_libs/pyspec/eth2spec/test/test_finality.py b/tests/core/pyspec/eth2spec/test/test_finality.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/test_finality.py rename to tests/core/pyspec/eth2spec/test/test_finality.py diff --git a/test_libs/pyspec/eth2spec/test/utils.py b/tests/core/pyspec/eth2spec/test/utils.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/utils.py rename to tests/core/pyspec/eth2spec/test/utils.py diff --git a/test_libs/pyspec/eth2spec/test/phase_1/block_processing/__init__.py b/tests/core/pyspec/eth2spec/utils/__init__.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/phase_1/block_processing/__init__.py rename to tests/core/pyspec/eth2spec/utils/__init__.py diff --git a/test_libs/pyspec/eth2spec/utils/bls.py b/tests/core/pyspec/eth2spec/utils/bls.py similarity index 100% rename from test_libs/pyspec/eth2spec/utils/bls.py rename to tests/core/pyspec/eth2spec/utils/bls.py diff --git a/test_libs/pyspec/eth2spec/utils/hash_function.py b/tests/core/pyspec/eth2spec/utils/hash_function.py similarity index 100% rename from test_libs/pyspec/eth2spec/utils/hash_function.py rename to tests/core/pyspec/eth2spec/utils/hash_function.py diff --git a/test_libs/pyspec/eth2spec/utils/merkle_minimal.py b/tests/core/pyspec/eth2spec/utils/merkle_minimal.py similarity index 100% rename from test_libs/pyspec/eth2spec/utils/merkle_minimal.py rename to tests/core/pyspec/eth2spec/utils/merkle_minimal.py diff --git a/test_libs/pyspec/eth2spec/test/sanity/__init__.py b/tests/core/pyspec/eth2spec/utils/ssz/__init__.py similarity index 100% rename from test_libs/pyspec/eth2spec/test/sanity/__init__.py rename to tests/core/pyspec/eth2spec/utils/ssz/__init__.py diff --git a/test_libs/pyspec/eth2spec/utils/ssz/ssz_impl.py b/tests/core/pyspec/eth2spec/utils/ssz/ssz_impl.py similarity index 100% rename from test_libs/pyspec/eth2spec/utils/ssz/ssz_impl.py rename to tests/core/pyspec/eth2spec/utils/ssz/ssz_impl.py diff --git a/test_libs/pyspec/eth2spec/utils/ssz/ssz_typing.py b/tests/core/pyspec/eth2spec/utils/ssz/ssz_typing.py similarity index 100% rename from test_libs/pyspec/eth2spec/utils/ssz/ssz_typing.py rename to tests/core/pyspec/eth2spec/utils/ssz/ssz_typing.py diff --git a/test_libs/pyspec/eth2spec/utils/ssz/test_ssz_impl.py b/tests/core/pyspec/eth2spec/utils/ssz/test_ssz_impl.py similarity index 100% rename from test_libs/pyspec/eth2spec/utils/ssz/test_ssz_impl.py rename to tests/core/pyspec/eth2spec/utils/ssz/test_ssz_impl.py diff --git a/test_libs/pyspec/eth2spec/utils/ssz/test_ssz_typing.py b/tests/core/pyspec/eth2spec/utils/ssz/test_ssz_typing.py similarity index 100% rename from test_libs/pyspec/eth2spec/utils/ssz/test_ssz_typing.py rename to tests/core/pyspec/eth2spec/utils/ssz/test_ssz_typing.py diff --git a/test_libs/pyspec/eth2spec/utils/test_merkle_minimal.py b/tests/core/pyspec/eth2spec/utils/test_merkle_minimal.py similarity index 100% rename from test_libs/pyspec/eth2spec/utils/test_merkle_minimal.py rename to tests/core/pyspec/eth2spec/utils/test_merkle_minimal.py diff --git a/test_libs/pyspec/requirements-testing.txt b/tests/core/pyspec/requirements-testing.txt similarity index 100% rename from test_libs/pyspec/requirements-testing.txt rename to tests/core/pyspec/requirements-testing.txt diff --git a/test_libs/pyspec/requirements.txt b/tests/core/pyspec/requirements.txt similarity index 100% rename from test_libs/pyspec/requirements.txt rename to tests/core/pyspec/requirements.txt diff --git a/test_libs/pyspec/setup.py b/tests/core/pyspec/setup.py similarity index 100% rename from test_libs/pyspec/setup.py rename to tests/core/pyspec/setup.py diff --git a/specs/test_formats/README.md b/tests/formats/README.md similarity index 100% rename from specs/test_formats/README.md rename to tests/formats/README.md diff --git a/specs/test_formats/bls/README.md b/tests/formats/bls/README.md similarity index 100% rename from specs/test_formats/bls/README.md rename to tests/formats/bls/README.md diff --git a/specs/test_formats/bls/aggregate_pubkeys.md b/tests/formats/bls/aggregate_pubkeys.md similarity index 100% rename from specs/test_formats/bls/aggregate_pubkeys.md rename to tests/formats/bls/aggregate_pubkeys.md diff --git a/specs/test_formats/bls/aggregate_sigs.md b/tests/formats/bls/aggregate_sigs.md similarity index 100% rename from specs/test_formats/bls/aggregate_sigs.md rename to tests/formats/bls/aggregate_sigs.md diff --git a/specs/test_formats/bls/msg_hash_g2_compressed.md b/tests/formats/bls/msg_hash_g2_compressed.md similarity index 100% rename from specs/test_formats/bls/msg_hash_g2_compressed.md rename to tests/formats/bls/msg_hash_g2_compressed.md diff --git a/specs/test_formats/bls/msg_hash_g2_uncompressed.md b/tests/formats/bls/msg_hash_g2_uncompressed.md similarity index 100% rename from specs/test_formats/bls/msg_hash_g2_uncompressed.md rename to tests/formats/bls/msg_hash_g2_uncompressed.md diff --git a/specs/test_formats/bls/priv_to_pub.md b/tests/formats/bls/priv_to_pub.md similarity index 100% rename from specs/test_formats/bls/priv_to_pub.md rename to tests/formats/bls/priv_to_pub.md diff --git a/specs/test_formats/bls/sign_msg.md b/tests/formats/bls/sign_msg.md similarity index 100% rename from specs/test_formats/bls/sign_msg.md rename to tests/formats/bls/sign_msg.md diff --git a/specs/test_formats/epoch_processing/README.md b/tests/formats/epoch_processing/README.md similarity index 100% rename from specs/test_formats/epoch_processing/README.md rename to tests/formats/epoch_processing/README.md diff --git a/specs/test_formats/genesis/README.md b/tests/formats/genesis/README.md similarity index 100% rename from specs/test_formats/genesis/README.md rename to tests/formats/genesis/README.md diff --git a/specs/test_formats/genesis/initialization.md b/tests/formats/genesis/initialization.md similarity index 100% rename from specs/test_formats/genesis/initialization.md rename to tests/formats/genesis/initialization.md diff --git a/specs/test_formats/genesis/validity.md b/tests/formats/genesis/validity.md similarity index 100% rename from specs/test_formats/genesis/validity.md rename to tests/formats/genesis/validity.md diff --git a/specs/test_formats/operations/README.md b/tests/formats/operations/README.md similarity index 100% rename from specs/test_formats/operations/README.md rename to tests/formats/operations/README.md diff --git a/specs/test_formats/sanity/README.md b/tests/formats/sanity/README.md similarity index 100% rename from specs/test_formats/sanity/README.md rename to tests/formats/sanity/README.md diff --git a/specs/test_formats/sanity/blocks.md b/tests/formats/sanity/blocks.md similarity index 100% rename from specs/test_formats/sanity/blocks.md rename to tests/formats/sanity/blocks.md diff --git a/specs/test_formats/sanity/slots.md b/tests/formats/sanity/slots.md similarity index 100% rename from specs/test_formats/sanity/slots.md rename to tests/formats/sanity/slots.md diff --git a/specs/test_formats/shuffling/README.md b/tests/formats/shuffling/README.md similarity index 96% rename from specs/test_formats/shuffling/README.md rename to tests/formats/shuffling/README.md index a2184020b..15bfe6996 100644 --- a/specs/test_formats/shuffling/README.md +++ b/tests/formats/shuffling/README.md @@ -30,7 +30,7 @@ The `count` specifies the validator registry size. One should compute the shuffl The `seed` is the raw shuffling seed, passed to permute-index (or optimized shuffling approach). The `mapping` is a look up array, constructed as `[spec.compute_shuffled_index(i, count, seed) for i in range(count)]` -I.e. `mapping[i]` is the shuffled location of `i`. +I.e. `mapping[i]` is the shuffled location of `i`. ## Condition diff --git a/specs/test_formats/ssz_generic/README.md b/tests/formats/ssz_generic/README.md similarity index 100% rename from specs/test_formats/ssz_generic/README.md rename to tests/formats/ssz_generic/README.md diff --git a/specs/test_formats/ssz_static/README.md b/tests/formats/ssz_static/README.md similarity index 81% rename from specs/test_formats/ssz_static/README.md rename to tests/formats/ssz_static/README.md index 78df2fc9a..1ac91cb13 100644 --- a/specs/test_formats/ssz_static/README.md +++ b/tests/formats/ssz_static/README.md @@ -3,6 +3,6 @@ This set of test-suites provides static testing for SSZ: to instantiate just the known Eth2 SSZ types from binary data. -This series of tests is based on the spec-maintained `eth2spec/utils/ssz/ssz_impl.py`, i.e. fully consistent with the SSZ spec. +This series of tests is based on the spec-maintained `eth2spec/utils/ssz/ssz_impl.py`, i.e. fully consistent with the SSZ spec. Test format documentation can be found here: [core test format](./core.md). diff --git a/specs/test_formats/ssz_static/core.md b/tests/formats/ssz_static/core.md similarity index 92% rename from specs/test_formats/ssz_static/core.md rename to tests/formats/ssz_static/core.md index ddb370983..d6f99a32b 100644 --- a/specs/test_formats/ssz_static/core.md +++ b/tests/formats/ssz_static/core.md @@ -49,5 +49,5 @@ A test-runner can implement the following assertions: ## References -**`serialized`**—[SSZ serialization](../../simple-serialize.md#serialization) -**`root`**—[hash_tree_root](../../simple-serialize.md#merkleization) function +**`serialized`**—[SSZ serialization](../../../ssz/simple-serialize.md#serialization) +**`root`**—[hash_tree_root](../../../ssz/simple-serialize.md#merkleization) function diff --git a/test_generators/README.md b/tests/generators/README.md similarity index 97% rename from test_generators/README.md rename to tests/generators/README.md index 9b1aab29c..77a50606b 100644 --- a/test_generators/README.md +++ b/tests/generators/README.md @@ -78,9 +78,9 @@ It's recommended to extend the base-generator. Create a `requirements.txt` in the root of your generator directory: ``` -../../test_libs/gen_helpers -../../test_libs/config_helpers -../../test_libs/pyspec +../../core/gen_helpers +../../core/config_helpers +../../core/pyspec ``` The config helper and pyspec is optional, but preferred. We encourage generators to derive tests from the spec itself in order to prevent code duplication and outdated tests. @@ -200,7 +200,7 @@ Recommendations: - Use config `minimal` for performance and simplicity, but also implement a suite with the `mainnet` config where necessary. - You may be able to write your test case provider in a way where it does not make assumptions on constants. If so, you can generate test cases with different configurations for the same scenario (see example). -- See [`test_libs/gen_helpers/README.md`](../test_libs/gen_helpers/README.md) for command line options for generators. +- See [`tests/core/gen_helpers/README.md`](../core/gen_helpers/README.md) for command line options for generators. ## How to add a new test generator diff --git a/test_generators/bls/README.md b/tests/generators/bls/README.md similarity index 100% rename from test_generators/bls/README.md rename to tests/generators/bls/README.md diff --git a/test_generators/bls/main.py b/tests/generators/bls/main.py similarity index 100% rename from test_generators/bls/main.py rename to tests/generators/bls/main.py diff --git a/test_generators/bls/requirements.txt b/tests/generators/bls/requirements.txt similarity index 52% rename from test_generators/bls/requirements.txt rename to tests/generators/bls/requirements.txt index 8a72affe0..7b1d2f4a9 100644 --- a/test_generators/bls/requirements.txt +++ b/tests/generators/bls/requirements.txt @@ -1,3 +1,3 @@ py_ecc==2.0.0 eth-utils==1.6.0 -../../test_libs/gen_helpers +../../core/gen_helpers diff --git a/test_generators/epoch_processing/README.md b/tests/generators/epoch_processing/README.md similarity index 100% rename from test_generators/epoch_processing/README.md rename to tests/generators/epoch_processing/README.md diff --git a/test_generators/epoch_processing/main.py b/tests/generators/epoch_processing/main.py similarity index 100% rename from test_generators/epoch_processing/main.py rename to tests/generators/epoch_processing/main.py diff --git a/tests/generators/epoch_processing/requirements.txt b/tests/generators/epoch_processing/requirements.txt new file mode 100644 index 000000000..3c318f56b --- /dev/null +++ b/tests/generators/epoch_processing/requirements.txt @@ -0,0 +1,3 @@ +../../core/gen_helpers +../../core/config_helpers +../../core/pyspec \ No newline at end of file diff --git a/test_generators/genesis/README.md b/tests/generators/genesis/README.md similarity index 71% rename from test_generators/genesis/README.md rename to tests/generators/genesis/README.md index 8a2b01c62..e270f6e35 100644 --- a/test_generators/genesis/README.md +++ b/tests/generators/genesis/README.md @@ -2,7 +2,5 @@ Genesis tests cover the initialization and validity-based launch trigger for the Beacon Chain genesis state. -Information on the format of the tests can be found in the [genesis test formats documentation](../../specs/test_formats/genesis/README.md). - - +Information on the format of the tests can be found in the [genesis test formats documentation](../../formats/genesis/README.md). diff --git a/test_generators/genesis/main.py b/tests/generators/genesis/main.py similarity index 100% rename from test_generators/genesis/main.py rename to tests/generators/genesis/main.py diff --git a/tests/generators/genesis/requirements.txt b/tests/generators/genesis/requirements.txt new file mode 100644 index 000000000..3c318f56b --- /dev/null +++ b/tests/generators/genesis/requirements.txt @@ -0,0 +1,3 @@ +../../core/gen_helpers +../../core/config_helpers +../../core/pyspec \ No newline at end of file diff --git a/test_generators/operations/README.md b/tests/generators/operations/README.md similarity index 100% rename from test_generators/operations/README.md rename to tests/generators/operations/README.md diff --git a/test_generators/operations/main.py b/tests/generators/operations/main.py similarity index 100% rename from test_generators/operations/main.py rename to tests/generators/operations/main.py diff --git a/tests/generators/operations/requirements.txt b/tests/generators/operations/requirements.txt new file mode 100644 index 000000000..f34243cf4 --- /dev/null +++ b/tests/generators/operations/requirements.txt @@ -0,0 +1,4 @@ +eth-utils==1.6.0 +../../core/gen_helpers +../../core/config_helpers +../../core/pyspec \ No newline at end of file diff --git a/test_generators/sanity/README.md b/tests/generators/sanity/README.md similarity index 100% rename from test_generators/sanity/README.md rename to tests/generators/sanity/README.md diff --git a/test_generators/sanity/main.py b/tests/generators/sanity/main.py similarity index 100% rename from test_generators/sanity/main.py rename to tests/generators/sanity/main.py diff --git a/tests/generators/sanity/requirements.txt b/tests/generators/sanity/requirements.txt new file mode 100644 index 000000000..3c318f56b --- /dev/null +++ b/tests/generators/sanity/requirements.txt @@ -0,0 +1,3 @@ +../../core/gen_helpers +../../core/config_helpers +../../core/pyspec \ No newline at end of file diff --git a/test_generators/shuffling/README.md b/tests/generators/shuffling/README.md similarity index 100% rename from test_generators/shuffling/README.md rename to tests/generators/shuffling/README.md diff --git a/test_generators/shuffling/main.py b/tests/generators/shuffling/main.py similarity index 100% rename from test_generators/shuffling/main.py rename to tests/generators/shuffling/main.py diff --git a/tests/generators/shuffling/requirements.txt b/tests/generators/shuffling/requirements.txt new file mode 100644 index 000000000..f34243cf4 --- /dev/null +++ b/tests/generators/shuffling/requirements.txt @@ -0,0 +1,4 @@ +eth-utils==1.6.0 +../../core/gen_helpers +../../core/config_helpers +../../core/pyspec \ No newline at end of file diff --git a/test_libs/pyspec/eth2spec/utils/__init__.py b/tests/generators/ssz_generic/__init__.py similarity index 100% rename from test_libs/pyspec/eth2spec/utils/__init__.py rename to tests/generators/ssz_generic/__init__.py diff --git a/test_generators/ssz_generic/main.py b/tests/generators/ssz_generic/main.py similarity index 100% rename from test_generators/ssz_generic/main.py rename to tests/generators/ssz_generic/main.py diff --git a/tests/generators/ssz_generic/requirements.txt b/tests/generators/ssz_generic/requirements.txt new file mode 100644 index 000000000..6b11d61af --- /dev/null +++ b/tests/generators/ssz_generic/requirements.txt @@ -0,0 +1,4 @@ +eth-utils==1.6.0 +../../core/gen_helpers +../../core/config_helpers +../../core/pyspec diff --git a/test_generators/ssz_generic/ssz_basic_vector.py b/tests/generators/ssz_generic/ssz_basic_vector.py similarity index 100% rename from test_generators/ssz_generic/ssz_basic_vector.py rename to tests/generators/ssz_generic/ssz_basic_vector.py diff --git a/test_generators/ssz_generic/ssz_bitlist.py b/tests/generators/ssz_generic/ssz_bitlist.py similarity index 100% rename from test_generators/ssz_generic/ssz_bitlist.py rename to tests/generators/ssz_generic/ssz_bitlist.py diff --git a/test_generators/ssz_generic/ssz_bitvector.py b/tests/generators/ssz_generic/ssz_bitvector.py similarity index 100% rename from test_generators/ssz_generic/ssz_bitvector.py rename to tests/generators/ssz_generic/ssz_bitvector.py diff --git a/test_generators/ssz_generic/ssz_boolean.py b/tests/generators/ssz_generic/ssz_boolean.py similarity index 100% rename from test_generators/ssz_generic/ssz_boolean.py rename to tests/generators/ssz_generic/ssz_boolean.py diff --git a/test_generators/ssz_generic/ssz_container.py b/tests/generators/ssz_generic/ssz_container.py similarity index 100% rename from test_generators/ssz_generic/ssz_container.py rename to tests/generators/ssz_generic/ssz_container.py diff --git a/test_generators/ssz_generic/ssz_test_case.py b/tests/generators/ssz_generic/ssz_test_case.py similarity index 100% rename from test_generators/ssz_generic/ssz_test_case.py rename to tests/generators/ssz_generic/ssz_test_case.py diff --git a/test_generators/ssz_generic/ssz_uints.py b/tests/generators/ssz_generic/ssz_uints.py similarity index 100% rename from test_generators/ssz_generic/ssz_uints.py rename to tests/generators/ssz_generic/ssz_uints.py diff --git a/test_generators/ssz_generic/uint_test_cases.py b/tests/generators/ssz_generic/uint_test_cases.py similarity index 100% rename from test_generators/ssz_generic/uint_test_cases.py rename to tests/generators/ssz_generic/uint_test_cases.py diff --git a/test_generators/ssz_static/README.md b/tests/generators/ssz_static/README.md similarity index 100% rename from test_generators/ssz_static/README.md rename to tests/generators/ssz_static/README.md diff --git a/test_libs/pyspec/eth2spec/utils/ssz/__init__.py b/tests/generators/ssz_static/__init__.py similarity index 100% rename from test_libs/pyspec/eth2spec/utils/ssz/__init__.py rename to tests/generators/ssz_static/__init__.py diff --git a/test_generators/ssz_static/main.py b/tests/generators/ssz_static/main.py similarity index 100% rename from test_generators/ssz_static/main.py rename to tests/generators/ssz_static/main.py diff --git a/tests/generators/ssz_static/requirements.txt b/tests/generators/ssz_static/requirements.txt new file mode 100644 index 000000000..3c318f56b --- /dev/null +++ b/tests/generators/ssz_static/requirements.txt @@ -0,0 +1,3 @@ +../../core/gen_helpers +../../core/config_helpers +../../core/pyspec \ No newline at end of file From 55fb97d8b1c1005709a6ed073e77984fe45537ed Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Fri, 10 Jan 2020 12:03:05 -0700 Subject: [PATCH 6/6] bump cache versions --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 04d5bf799..45cb958a3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -35,13 +35,13 @@ commands: description: "Restore the cache with pyspec keys" steps: - restore_cached_venv: - venv_name: v6-pyspec + venv_name: v7-pyspec reqs_checksum: cache-{{ checksum "tests/core/pyspec/requirements.txt" }}-{{ checksum "tests/core/pyspec/requirements-testing.txt" }} save_pyspec_cached_venv: description: Save a venv into a cache with pyspec keys" steps: - save_cached_venv: - venv_name: v6-pyspec + venv_name: v7-pyspec reqs_checksum: cache-{{ checksum "tests/core/pyspec/requirements.txt" }}-{{ checksum "tests/core/pyspec/requirements-testing.txt" }} venv_path: ./tests/core/pyspec/venv restore_deposit_contract_cached_venv: