180 Commits

Author SHA1 Message Date
Hsiao-Wei Wang
3d7f307020 Refactor test_sync_protocol.py a bit 2022-02-04 17:46:37 -08:00
Etan Kissling
8319d07084
Consistently use compute_sync_committee_period
There were a couple instances where a division was used on an epoch
to derive the corresponding sync committee period instead of calling the
`compute_sync_committee_period` function.
These instances were changed to also use the function.
2022-01-17 17:38:24 +01:00
Etan Kissling
48e19b15ae
Rename sync_committee_aggregate > sync_aggregate
This renames the `sync_committee_aggregate` field of `LightClientUpdate`
to `sync_aggregate` for consistency with the terminology in the rest of
the spec.
2022-01-11 11:22:39 +01:00
Hsiao-Wei Wang
257c2413a5
Update test_sync_protocol.py per the new optimistic_header and data structure 2021-12-14 22:06:25 +08:00
Hsiao-Wei Wang
f0bb032eb1
Fix test_transition_with_one_fourth_exiting_validators_exit_at_fork assertions 2021-11-15 23:46:40 +08:00
Hsiao-Wei Wang
0641d1c184
ALL_FORKS sounds like a list of fork names. Rename it to ALL_FORK_UPGRADES 2021-11-02 19:01:32 +08:00
Hsiao-Wei Wang
0b0fe15c75
Make altair transition tests support merge forks 2021-11-02 14:47:24 +08:00
Hsiao-Wei Wang
7480fad8cd
Add test_transition_with_activation_at_fork_epoch 2021-10-15 22:46:16 +08:00
Hsiao-Wei Wang
40869d6e39
PR feedback on exit_random_validators helper 2021-10-15 22:14:30 +08:00
Hsiao-Wei Wang
be6d2017bb
fix typo 2021-10-15 22:05:07 +08:00
Hsiao-Wei Wang
162711ea56
PR feedback. Rework transition_to_next_epoch_and_append_blocks a bit 2021-10-15 22:00:48 +08:00
Hsiao-Wei Wang
a4e5d50660
Fix/ignore mainnet preset cases 2021-10-15 11:57:10 +08:00
Hsiao-Wei Wang
f62167c4ab
pr feedback 2021-10-15 00:30:24 +08:00
Hsiao-Wei Wang
3a242a1e0b
Refactor and add test cases of having operation right before the fork 2021-10-15 00:02:33 +08:00
Hsiao-Wei Wang
49bf78d431
PR feedback 2021-10-14 22:40:29 +08:00
Hsiao-Wei Wang
cbba5426fe
PR feedback 2021-10-14 20:22:03 +08:00
Hsiao-Wei Wang
67da1ba2bf
Minor refactoring
- sanity check: deposit operation is independent of spec fork versions
- refactoring
- add comments
2021-10-14 00:06:29 +08:00
Hsiao-Wei Wang
53d4fa5187
Make operation (attester_slashing, proposer_slashing, voluntary_exit) at the fork block 2021-10-13 02:01:13 +08:00
Hsiao-Wei Wang
f0980a4ab9
Refactoring. Sort tests to specific files. 2021-10-13 00:26:23 +08:00
Hsiao-Wei Wang
95f940cc74
ensure that some of the current sync committee members are the slashed 2021-10-12 23:33:48 +08:00
Hsiao-Wei Wang
4dd8b7c98a
[WIP] Add new transition tests 2021-10-12 23:05:14 +08:00
Hsiao-Wei Wang
ff15d0bc39
Apply PR feedback from @ralexstokes 2021-10-07 16:04:06 +08:00
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
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
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
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
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
Danny Ryan
d6b5cbd94c
fix sync agg test for mainnet 2021-09-09 19:53:30 -06:00
Alex Stokes
0cee5660db
pr feedback 2021-09-09 15:43:42 -07:00
Alex Stokes
c0994e6736
Add sync committee tests with exited and withdrawable members 2021-09-09 13:27:54 -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
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
ad076697f4
add test case for active/exited difference for sync rewards processing 2021-09-02 09:50:39 -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
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
e2dc9f9ec2
update generation of randomized scenarios for more variability 2021-08-25 14:42:41 -07:00
Alex Stokes
14518d4d64
update name of utility module to be more specific 2021-08-25 11:15:59 -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
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
70d4ddf613
Merge pull request #2556 from ralexstokes/add-randomized-testing-for-altair-inactivity-scores
Add randomized testing for altair inactivity scores
2021-08-19 07:42:46 -07:00
Alex Stokes
b809d86736
add test for process_inactivity_updates for randomized state 2021-08-19 07:43:16 -06:00