Commit Graph

932 Commits

Author SHA1 Message Date
Hsiao-Wei Wang 4ae8fb182e
Fix `run_sync_committee_sanity_test` so that it works with duplicate committee indices 2021-10-07 03:29:09 +08:00
Hsiao-Wei Wang dcdbff0728
Combine the conflicting handler names 2021-10-07 02:11:50 +08:00
Danny Ryan dd6f09dab8
bump version.txt to v1.1.1 2021-10-04 08:06:04 +03:00
Hsiao-Wei Wang f1f082fbe7
Remove the unused stub constants 2021-10-04 00:30:01 +08:00
Hsiao-Wei Wang e235aa8296
Clean up. Add `execution_payload_header` to initialization `meta.yaml` 2021-10-03 22:38:05 +08:00
Danny Ryan 789eea0060
fix tests. add new generator 2021-10-03 16:19:50 +03:00
Hsiao-Wei Wang 296f9bab81
Merge pull request #2638 from etan-status/exec-payload-time
use correct timestamp for empty ExecutionPayload
2021-10-02 14:44:20 +08:00
Etan Kissling 65649c0383
use correct timestamp for empty ExecutionPayload
There are two similar functions to compute the timestamp for a given
beacon chain slot. `compute_time_at_slot` is used for processing Eth1
votes, and does not take into account `GENESIS_TIME`. The other one,
`compute_timestamp_at_slot`, is used everywhere else. When processing
`ExecutionPayload`, the `merge/beacon-chain.md` spec uses the latter,
`compute_timestamp_at_slot`, to verify the timestamp. However, in the
test code, `build_empty_execution_payload` uses `compute_time_at_slot`.
This patch changes the test to use the same function for creating the
timestamp that is later used to verify it. Note that `GENESIS_TIME` is 0
so there is no practical difference.
2021-10-01 14:52:30 +02:00
Etan Kissling 939e6c7e8e
run tests against future forks by default
Some tests are currently restricted to a single phase using @with_phases
even though they could likely run unchanged in later phases. This patch
changes the default for such tests to also run in later phases. If the
beacon chain changes enough in later phases to break these tests, this
highlights that the tests need to be adjusted or extended accordingly.
2021-09-30 10:28:02 +02:00
Danny Ryan d34b79f4de
Merge pull request #2630 from ethereum/tests/merge-clean-up
#2598 + cleanups
2021-09-27 11:23:30 -06:00
Danny Ryan 334e3138fa
Merge pull request #2628 from ethereum/bump-version
bump VERSION.txt to 1.1.0
2021-09-27 11:14:37 -06:00
Hsiao-Wei Wang ef51e1cfb9
Change mainnet `TERMINAL_TOTAL_DIFFICULTY` placeholder to `2**256-2**10` to avoid overflow 2021-09-28 01:02:53 +08:00
Hsiao-Wei Wang 5ab2824427
Clean up, refactor test_transition.py 2021-09-28 00:59:03 +08:00
Hsiao-Wei Wang 2fa595f784
Apply the trivial suggestions 2021-09-28 00:17:18 +08:00
protolambda bd8c978965
move merkle tests, output proof.yaml, update format 2021-09-27 18:07:59 +02:00
Etan Kissling e7317e2283
merkle proof test generator
Building merkle proofs is required functionality for implementing light
client sync. Although the spec currently only defines a function to
verify merkle proofs (`is_valid_merkle_branch`) there are still a few
PySpec unit tests that produce merkle proofs. This patch adds a new
generator to extract test vectors from those static unit tests, so that
light client implementations can validate their merkle proof logic.
2021-09-27 17:34:51 +02:00
Danny Ryan c8d05c60ec
Apply suggestions from code review 2021-09-27 08:23:02 -06:00
Danny Ryan 42ef3548e1
bump VERSION.txt to 1.1.0 2021-09-27 08:01:27 -06:00
Dmitrii Shmatko deb4dbd9c8 Make empty pow_block hash generation Python 3.8 compatible 2021-09-25 01:26:01 +03:00
Danny Ryan 8d5106808f
bump version to v1.1.0-beta.5 2021-09-24 12:26:40 -06:00
Dmitrii Shmatko f8b3a67152 Fixed test_on_merge_block tests 2021-09-24 21:06:02 +03:00
Dmitrii Shmatko 457b0396dd update PowBlock generation with random hash 2021-09-24 20:25:18 +03:00
Danny Ryan 940d6b1cc5
Merge pull request #2613 from mkalinin/execution-engine-update
Update execution engine calls
2021-09-24 05:57:27 -06:00
Dmitrii Shmatko f3f1c86a57 Fixed imports in merge tests 2021-09-23 23:13:04 +03:00
Dmitrii Shmatko 1ecfc4016c Polishing merge tests 2021-09-23 23:10:29 +03:00
Dmitrii Shmatko 8ae078a4f5 Merge branch 'dev' into tests/merge 2021-09-23 22:24:33 +03:00
Dmitrii Shmatko 239653ea01 Fixed lint errors for `test_on_merge_block.py` 2021-09-23 22:24:02 +03:00
Dmitrii Shmatko b1aa227983 Added `on_merge_block` client tests 2021-09-23 22:22:34 +03:00
Etan Kissling 0c65f79d82
fix merkle proof test for mainnet
The `test_next_sync_committee_tree` currently only supports the minimal
preset, as it incorrectly initializes the `next_sync_committee`. On the
mainnet preset, `SYNC_COMMITTEE_SIZE` is 512, but the default states use
only 256 validators, leading to an IndexError during the test execution.
`next_sync_committee` is already initialized correctly prior to the test
run using the spec's `get_next_sync_committee` function, which fills up
extra committee slots with duplicate validators in this scenario. This
makes it unnecessary to manually initialize the `next_sync_committee`.
Removed the incorrect initialization to allow testing on mainnet preset.
2021-09-23 15:20:18 +02:00
Mikhail Kalinin 7d577ed422 Introduce ExecutionAddress type 2021-09-23 14:35:55 +06:00
Mikhail Kalinin 8cecf405cb Merge branch 'dev' into execution-engine-update 2021-09-22 17:47:02 +06:00
Dmitrii Shmatko cdcf366007 merge tests updated to be in line with transition_store removal 2021-09-21 15:20:19 +03:00
Dmitrii Shmatko 8bfa5188c1 Merge branch 'hardcoded-ttd' into tests/merge 2021-09-20 22:26:35 +03:00
Danny Ryan e2af59c8cd ensure random is validated for all payloads including transition 2021-09-20 23:18:39 +06:00
Mikhail Kalinin cb9e65ab85 Bring on extra_data field 2021-09-20 23:18:39 +06:00
Mikhail Kalinin b530e01761 Update calls to execution_engine 2021-09-20 20:57:45 +06:00
Danny Ryan 5811046f1a
Merge pull request #2581 from mkalinin/set-random-to-prev-randao-mix
Set the value of the random field to the previous randao_mix
2021-09-20 08:17:55 -06:00
Danny Ryan 3ef13561e6
ensure random is validated for all payloads including transition 2021-09-17 11:00:32 -06:00
Mikhail Kalinin c2084ad5b0 Bring on extra_data field 2021-09-17 18:23:21 +06:00
Mikhail Kalinin 26c78b540a Fix test_blocks#test_parent_from_same_slot 2021-09-17 16:01:15 +06:00
Mikhail Kalinin df657f7c93 Merge branch 'dev' into set-random-to-prev-randao-mix 2021-09-17 14:41:43 +06:00
Etan Kissling 370b9e86e3
pass sync committee sig consistently in tests
There are three defined unit tests for the light client sync protocol.
They all follow a similar structure. However, there is an inconcistency
how they pass the slot to compute_aggregate_sync_committee_signature.
In one instance it is passed as `block.slot`. In the other two cases
it is passed as `block_header.slot`. As the `block_header` is created
from the `block`, they share the same value. This patch makes the way
how the slot is passed consistent across all of the test cases.
2021-09-15 21:34:10 +02:00
Dmitrii Shmatko b99720ec26 Renamed test_on_block -> test_terminal_validity to avoid misleading as generator test 2021-09-14 17:56:49 +03:00
Dmitrii Shmatko cf1bd6ccc0 Fixed lint errors for merge tests 2021-09-14 15:26:10 +03:00
Dmitrii Shmatko 7ff173bd0b Added new Merge tests 2021-09-14 11:51:37 +03:00
Danny Ryan 70de0c3fa3
Merge pull request #2594 from ethereum/fix-agg-test
fix sync agg test for mainnet
2021-09-09 20:05:10 -06:00
Danny Ryan d6b5cbd94c
fix sync agg test for mainnet 2021-09-09 19:53:30 -06:00
Danny Ryan 8f064d104f
bmp version.txt to 1.1.0-beta-4 2021-09-09 17:11:27 -06:00
Danny Ryan a3e2e79ce7
Merge pull request #2591 from ralexstokes/add-exited-sync-comm-member-test
Add sync committee tests with exited and withdrawable members
2021-09-09 17:09:10 -06:00
Alex Stokes 0cee5660db
pr feedback 2021-09-09 15:43:42 -07:00
Danny Ryan b660892ca3
Merge pull request #2586 from ethereum/churn-test
Add churn tests for when churn limit scales with v-set size
2021-09-09 16:41:37 -06:00
Danny Ryan 5348b9a3b9
randomize state can result in some exited vals for current epoch 2021-09-09 15:56:08 -06:00
Danny Ryan a47ade3ba6
pr feedback 2021-09-09 15:27:23 -06:00
Alex Stokes c0994e6736
Add sync committee tests with exited and withdrawable members 2021-09-09 13:27:54 -07:00
Alex Stokes 989cd38041
add rewards spec test with exit in current epoch 2021-09-08 20:24:22 -07:00
Hsiao-Wei Wang d23444a2db
Merge pull request #2577 from ethereum/fix-fork-choice-tests
Fix fork choice `on_block` tests and update test format
2021-09-08 21:35:32 +08:00
Danny Ryan 8220f7dd44
ensure new dynamic queue tests don't run for mainnet cofig 2021-09-08 07:31:13 -06:00
Hsiao-Wei Wang 5bc59d8aab
Fix the comments 2021-09-08 21:22:48 +08:00
Danny Ryan 6784025d64
add scaled churn limit tests for voluntary exits 2021-09-07 20:49:54 -06:00
Danny Ryan 43e79a7ee0
add process_registry_updates tests for scaled churn limit 2021-09-07 20:34:28 -06:00
Danny Ryan 4faff4f899
Merge pull request #2580 from ralexstokes/add-rewards-test-case-for-exited-vals
Add test cases to ensure coverage with exited validators
2021-09-07 16:11:53 -06:00
Alex Stokes 14f71ffb4b
Use realistic `withdrawable_epoch` in spec test 2021-09-07 12:53:06 -07:00
Alex Stokes 064b489d18
Use spec function for total active balance 2021-09-07 12:23:57 -07:00
Alex Stokes fb4a4f6694
Update tests/core/pyspec/eth2spec/test/altair/block_processing/sync_aggregate/test_process_sync_aggregate_random.py
Co-authored-by: Danny Ryan <dannyjryan@gmail.com>
2021-09-07 13:09:23 -06:00
Danny Ryan ccd48d7286
Merge pull request #2579 from ethereum/fix-process_and_sign_block_without_header_validations
Fix testing helper `process_and_sign_block_without_header_validations`
2021-09-07 12:57:26 -06:00
Alex Stokes 25c290474f
fix test filtering on eth1 voting spec test 2021-09-02 15:50:26 -07:00
Alex Stokes 4168943ecf
Update tests/core/pyspec/eth2spec/test/helpers/random.py 2021-09-02 15:38:52 -06:00
Alex Stokes 30596fb8a1
Update tests/core/pyspec/eth2spec/test/altair/block_processing/sync_aggregate/test_process_sync_aggregate_random.py 2021-09-02 15:35:15 -06:00
Alex Stokes d834b6e800
add active/exited balances test for justification 2021-09-02 12:37:11 -07:00
Alex Stokes bd38587a1e
add active/exited balances test for `process_slashings` 2021-09-02 09:50:40 -07:00
Alex Stokes ad076697f4
add test case for active/exited difference for sync rewards processing 2021-09-02 09:50:39 -07:00
Alex Stokes df89763777
ensure balance differential as a sanity check 2021-09-02 08:48:32 -07:00
Alex Stokes 58c0da9059
ensure rewards spec test with exited validators 2021-09-02 08:48:32 -07:00
Alex Stokes 0cc5f9cd59
modify helper for more precision on exited validators 2021-09-02 08:48:32 -07:00
Alex Stokes cf23cd00ab
ensure the test covers exited, unslashed validators 2021-09-02 08:48:32 -07:00
Alex Stokes 7cb5901ee6
add spec test case for rewards with exited validators and _no_ leak 2021-09-02 08:48:31 -07:00
Alex Stokes e341f4e1f8
refactor "leaking patch" helper 2021-09-02 08:48:31 -07:00
Antonio Sanso ae8c0447ef
Update tests/core/pyspec/eth2spec/test/altair/block_processing/sync_aggregate/test_process_sync_aggregate.py
Co-authored-by: Alex Stokes <r.alex.stokes@gmail.com>
2021-09-02 14:57:47 +02:00
Antonio Sanso 5f1a444e70
Update test_process_sync_aggregate.py 2021-09-02 11:34:42 +02:00
Antonio Sanso 2206a58335
Update test_process_sync_aggregate.py 2021-09-02 11:33:12 +02:00
Antonio Sanso 2d736139d5
Update test_process_sync_aggregate.py 2021-09-02 11:19:58 +02:00
Antonio Sanso 9bf8ad9130
Update test_process_sync_aggregate.py 2021-09-02 11:00:51 +02:00
Mikhail Kalinin 6ba1f22404 Set ExecutionPayload.random to the previous randao_mix 2021-09-01 18:42:58 +06:00
Hsiao-Wei Wang 4c34518edf
Call Altair and Merge operations in `process_and_sign_block_without_header_validations` 2021-09-01 00:23:42 +08:00
Hsiao-Wei Wang b23ed05eee
[`test_on_block_finalized_skip_slots`] Make target state right after skipped slots 2021-08-31 18:40:26 +08:00
Hsiao-Wei Wang 9b065c7816
To avoid using non-genesis anchor state, rewrite `test_on_block_finalized_skip_slots_not_in_skip_chain` 2021-08-31 17:42:10 +08:00
Hsiao-Wei Wang da8d22c754
Update `checks` Checkpoint fields 2021-08-31 13:16:19 +08:00
Hsiao-Wei Wang 189a9d4ae9
Add the missed on_tick output and remove the useless on_tick call 2021-08-31 12:10:47 +08:00
Alex Stokes 2477deaf13
Allow test driver to batch test cases under one handler name with a list 2021-08-30 13:53:05 -07:00
Alex Stokes 387113b2f4
add "collect only" mode to spec test generator 2021-08-30 13:36:01 -07:00
Danny Ryan 125bf22494
Merge pull request #2570 from ralexstokes/fix-deposits-randomized-tests
Fix randomized deposit testing
2021-08-26 17:47:03 -06:00
Danny Ryan c45e77b0b5
Merge pull request #2571 from ralexstokes/add-timing-info-to-test-gen
add timing information to spec test generation
2021-08-26 17:14:52 -06:00
Alex Stokes 74fcf67cf4
Fix a performance bug with the randomized block tests from #2560 2021-08-26 13:42:12 -07:00
Alex Stokes 9474f0a051
construct and supply scenario-wide state to facilitate deposit processing 2021-08-26 12:02:59 -07:00
Alex Stokes b45601f44c
add timing information to spec test generation
in particular, warn if any particular operation takes longer than
some threshold, e.g. 1.0 second.
2021-08-26 11:50:24 -07:00
Alex Stokes 1f34ef9b56
modularize the random deposit helpers 2021-08-26 10:50:50 -07:00
Danny Ryan 17fece57b6
Merge pull request #2560 from ralexstokes/add-broad-spectrum-spec-tests
Broad-spectrum randomized block tests
2021-08-25 20:34:47 -06:00
Alex Stokes 874ea80cb8
use more precise name for altair block randomizer and re-gen tests 2021-08-25 17:18:02 -07:00
Alex Stokes 5b0d2627c3
apply pr feedback on randrange 2021-08-25 15:13:20 -07:00
Alex Stokes c206a2772a
update docs via PR feedback 2021-08-25 14:46:17 -07:00
Alex Stokes e2dc9f9ec2
update generation of randomized scenarios for more variability 2021-08-25 14:42:41 -07:00
Alex Stokes 047ff5b099
unify visibility on names for doc purposes 2021-08-25 14:16:39 -07:00
Alex Stokes 961953ac15
update parameter name 2021-08-25 13:10:41 -07:00
Alex Stokes 377797fd0d
code layout change 2021-08-25 11:20:17 -07:00
Alex Stokes 14518d4d64
update name of utility module to be more specific 2021-08-25 11:15:59 -07:00
Alex Stokes 0da1fe947d
clarify how the random block generator works 2021-08-25 11:09:35 -07:00
Alex Stokes e72edf07f9
consolidate call to `max` into `randrange` 2021-08-25 10:40:15 -07:00
Alex Stokes 4d4f4e89f4
be specific about which slot we want a sync committee root for 2021-08-25 10:38:01 -07:00
Alex Stokes 7874e8db88
clean up unnecessary comment 2021-08-24 16:40:16 -07:00
Alex Stokes 33c96127da
fix bug with random sync aggregate helper 2021-08-24 16:40:15 -07:00
Alex Stokes f7c0dc36be
skip running heavy randomized tests in CI 2021-08-24 15:05:07 -07:00
Alex Stokes 933c1323dd
lint updates 2021-08-24 14:46:31 -07:00
Alex Stokes 8a32bef58b
update skipped test count when test already exists 2021-08-24 13:19:31 -07:00
Alex Stokes 8e5a34c38a
adjust helper to account for additional slashings 2021-08-24 12:46:03 -07:00
Alex Stokes d1f3ec59af
ensure at least 1 operation when making random block 2021-08-24 11:56:19 -07:00
Alex Stokes c27e4d140e
move to code-gen under new test generator 2021-08-24 11:56:15 -07:00
Alex Stokes 505bdba8f8
fix imports 2021-08-23 12:49:36 -07:00
Alex Stokes d037c6662a
lint fix 2021-08-23 12:40:42 -07:00
Alex Stokes cc04da8e79
add randomized block tests for altair 2021-08-23 12:30:05 -07:00
Alex Stokes 58c6f33e85
ensure at least one proposer slashing 2021-08-23 12:15:22 -07:00
Alex Stokes 7b9d70fcec
allow test customization (for future forks) 2021-08-23 12:15:09 -07:00
Alex Stokes ff6863e689
fix bug with deposit generation code 2021-08-23 12:01:05 -07:00
Alex Stokes 31d46247ce
file re-org to re-use for later forks 2021-08-23 11:48:22 -07:00
Alex Stokes 20e3934fa2
do not exit validators who are already exited 2021-08-23 11:46:20 -07:00
Alex Stokes 16423880aa
add multiple blocks to each test 2021-08-23 11:00:33 -07:00
Alex Stokes 6316c7d364
ensure at least 1 attester slashing 2021-08-23 10:29:39 -07:00
Alex Stokes 361d97c54b
fix bug with proposer search 2021-08-23 10:13:19 -07:00
Hsiao-Wei Wang 15a6c48a46
Merge pull request #2518 from ethereum/fix-store-justified-checkpoint
Fix fork choice store checkpoints inconsistency issue
2021-08-23 23:41:11 +08:00
Hsiao-Wei Wang 838c263c4a
Apply suggestions from code review
Co-authored-by: Aditya Asgaonkar <adiasg@users.noreply.github.com>
2021-08-23 23:21:15 +08:00
Alex Stokes 2db01ba6d0
use fixed seed for block randomization 2021-08-22 13:55:29 -07:00
Alex Stokes 253f927c0a
fix randomness seed across randomized test 2021-08-22 13:55:29 -07:00
Alex Stokes 0c401a3e2a
filter for exit eligibility in helper 2021-08-22 13:55:28 -07:00
Alex Stokes ce471b702e
code org 2021-08-22 10:54:00 -07:00
Alex Stokes f76a29c1f9
patch state to not be leaking at start 2021-08-22 10:52:22 -07:00
Alex Stokes 993997aca5
ensure no leak on "normal" transitions 2021-08-22 10:19:21 -07:00
Alex Stokes 270814e20f
fix bug with `_epochs_until_leak` helper 2021-08-22 09:59:28 -07:00
Alex Stokes 820affd2aa
extend validator set so randomized helpers have more room for operation 2021-08-22 09:58:54 -07:00
Alex Stokes 513f57f74c
formatting 2021-08-22 09:56:03 -07:00
Alex Stokes b17ada2d67
only target phase 0 and altair for now 2021-08-21 18:24:26 -07:00
Alex Stokes 9e6a51ef70
update fn name for test id 2021-08-21 18:10:27 -07:00
Alex Stokes fde71cbe74
add warnings if empty block 2021-08-21 18:10:27 -07:00
Alex Stokes 7bc2f9547a
skip validators when building a random block if they are slashed 2021-08-21 17:52:26 -07:00
Alex Stokes 86643d805a
adjust some helper code for randomized environment
1. randomized block helpers assume most of the validator set is not slashed
2. `randomize_state` helper slashes or exits ~1/2 of the validator set

So, adjust helpers to be less aggresive with exits and slashings and
to skip elements as needed if we happen to make something by
a validator who has been slashed.
2021-08-21 17:36:50 -07:00
Alex Stokes 6da2c7a916
ensure all validators in randomized test are active 2021-08-21 16:59:54 -07:00
Alex Stokes 5094193f9a
formatting 2021-08-21 16:59:02 -07:00
Alex Stokes 619e828898
Progress on block test gen 2021-08-21 15:48:29 -07:00
Alex Stokes 4420d13816
add helper to check existence of many validator types 2021-08-21 15:48:29 -07:00
Alex Stokes 00df808f59
expose functionality to make random block 2021-08-21 15:48:28 -07:00
Danny Ryan 29c7184b7b
bump VERSION.txt to 1.1.0-beta.3 2021-08-20 08:42:22 -06:00
Danny Ryan f30e7c8ef3
Merge pull request #2559 from ralexstokes/update-full-random-tests-to-all-phases
Extend randomized block tests to all phases
2021-08-20 08:20:55 -06:00