Commit Graph

272 Commits

Author SHA1 Message Date
Etan Kissling c4dbd241ac
Root `next_sync_committee` in `attested_header`
`LightClientUpdate` structures currently use different merkle proof root
depending on the presence of `finalized_header`. By always rooting it in
the same state (the `attested_header.state_root`), logic gets simpler.

Caveats:
- In periods of extended non-finality, `update.finalized_header` may now
  be outdated by several sync committee periods. The old implementation
  rejected such updates as the `next_sync_committee` in them was stale,
  but the new implementation can properly handle this case.
- The `next_sync_committee` can no longer be considered finalized based
  on `is_finality_update`. Instead, waiting until `finalized_header` is
  in the `attested_header`'s sync committee period is now necessary.
- Because `update.finalized_header > store.finalized_header` no longer
  holds (for updates with finality), an `is_better_update` helper is
  added to improve `best_valid_update` tracking (in the past, finalized
  updates with supermajority participation would always directly apply)

This PR builds on prior work from:
- @hwwhww at https://github.com/ethereum/consensus-specs/pull/2829
2022-07-01 14:49:24 -07:00
Alex Stokes 2dd9a52fe4
remove data logging from BLS test gen 2022-06-29 10:24:53 -06:00
Alex Stokes 129d9e28b4
add randomized tests for bellatrix 2022-01-27 19:41:09 -08:00
Antonio Sanso 7255faf41b
Update ssz_container.py 2022-01-13 13:40:48 +01:00
Alex Stokes c4a60225cb
Merge branch 'dev' into patch-5 2022-01-11 16:09:40 -06:00
Alex Stokes d74cb5c9ec
remove unnecessary conditional 2022-01-06 15:34:59 -08:00
Antonio Sanso e56dddd6ec
Update tests/generators/ssz_generic/ssz_container.py
Co-authored-by: Alex Stokes <r.alex.stokes@gmail.com>
2022-01-06 19:07:48 +01:00
Antonio Sanso 69a2fb4af0
Update tests/generators/ssz_generic/ssz_container.py
Co-authored-by: Alex Stokes <r.alex.stokes@gmail.com>
2022-01-06 19:07:31 +01:00
Antonio Sanso 7df0d4d70e
Update tests/generators/ssz_generic/ssz_container.py
Co-authored-by: Alex Stokes <r.alex.stokes@gmail.com>
2022-01-06 19:07:23 +01:00
Antonio Sanso 22719f2748
Update tests/generators/ssz_generic/ssz_container.py
Co-authored-by: Alex Stokes <r.alex.stokes@gmail.com>
2022-01-06 19:06:50 +01:00
Antonio Sanso 6f64d46bc4
Update tests/generators/ssz_generic/ssz_container.py
Co-authored-by: Alex Stokes <r.alex.stokes@gmail.com>
2022-01-06 19:06:42 +01:00
Antonio Sanso db16f590cb fixing lint 2022-01-06 13:29:57 +01:00
Antonio Sanso b5908cf294 fixing lint 2022-01-06 13:28:19 +01:00
Antonio Sanso 7ccd528cd1 fixing lint 2022-01-06 13:26:00 +01:00
Antonio Sanso b220655d24
Add 3 new invalid test cases 2022-01-06 13:08:47 +01:00
Hsiao-Wei Wang 5910b90c43
Enable Bellatrix fork tests in test generator 2021-12-24 00:56:55 +08:00
Hsiao-Wei Wang 8facc0a095
Merge -> Bellatrix 2021-12-23 14:25:43 +08:00
Hsiao-Wei Wang addc03cb7c
Enable ex-ante tests in testgen and minor fixes 2021-12-09 17:47:20 +08:00
Antonio Sanso dfb3ef8f2c
Update ssz_container.py 2021-11-24 08:42:27 +01:00
Hsiao-Wei Wang 49d96f92ef
Add a sample altair-to-merge-only transition 2021-11-12 17:06:10 +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 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 f0980a4ab9
Refactoring. Sort tests to specific files. 2021-10-13 00:26:23 +08:00
Hsiao-Wei Wang e821ddade2
Remove the trailing comma 2021-10-07 21:44:51 +08:00
Hsiao-Wei Wang 7a7ab81306
Also update other generators so that we won't write the bad pattern again 2021-10-07 03:14:29 +08:00
Hsiao-Wei Wang dcdbff0728
Combine the conflicting handler names 2021-10-07 02:11:50 +08:00
Hsiao-Wei Wang e235aa8296
Clean up. Add `execution_payload_header` to initialization `meta.yaml` 2021-10-03 22:38:05 +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
Danny Ryan d34b79f4de
Merge pull request #2630 from ethereum/tests/merge-clean-up
#2598 + cleanups
2021-09-27 11:23:30 -06: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
Dmitrii Shmatko 8ae078a4f5 Merge branch 'dev' into tests/merge 2021-09-23 22:24:33 +03:00
Dmitrii Shmatko b1aa227983 Added `on_merge_block` client tests 2021-09-23 22:22:34 +03:00
Etan Kissling 41c12bfcb2
improve grammar in BLS test comments
The comments for the PRIVKEYS definition in the BLS test generator were
a bit difficult to read. Improved by rewording them slightly.
2021-09-22 14:15:07 +02:00
Dmitrii Shmatko 829c6e7325 Enable genesis client tests for MERGE 2021-09-15 18:27:20 +03:00
Danny Ryan cb7c81eb96
Merge pull request #2576 from ralexstokes/consolidate-like-operations-tests
Allow spec tests author to batch tests under one handler name
2021-09-01 17:54:34 -06:00
Hsiao-Wei Wang 085045a860
Since merge spec was rebased, make `merge_mods` base on `altair_mods` instead of `phase_0_mods` 2021-08-31 18:06:55 +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
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 a890d04a62
Merge branch 'add-broad-spectrum-spec-tests' of https://github.com/ralexstokes/eth2.0-specs into add-broad-spectrum-spec-tests 2021-08-25 17:18:08 -07: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 4b3022a767
Update tests/generators/random/generate.py 2021-08-25 16:19:46 -06: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 a6f8870e18
update makefile to use correct python version 2021-08-25 11:15:27 -07:00
Alex Stokes 81971a8957
update readme for pytest 2021-08-25 11:01:26 -07:00
Alex Stokes e575b222be
clarify readme 2021-08-25 10:54:55 -07:00
Alex Stokes 02bc6541d9
extend Makefile 2021-08-24 16:40:16 -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 cc04da8e79
add randomized block tests for altair 2021-08-23 12:30:05 -07:00
Alex Stokes 92aabcd207
add randomized block tests to test generator 2021-08-21 15:48:29 -07:00
Danny Ryan 2c632c0087
Merge pull request #2555 from ethereum/great-renaming
modify docs for great renaming
2021-08-20 08:14:49 -06:00
Danny Ryan 4c1156d504
rename eth1 and eth2 throughout specs and readme where reasonable 2021-08-18 17:13:24 -06:00
Danny Ryan f6aa54b66f
Merge pull request #2554 from ralexstokes/refactor-sync-committee-tests
Refactor sync committee tests
2021-08-18 16:38:56 -06:00
Alex Stokes 5a17fa65b2
group test files into subdirectory 2021-08-18 10:49:44 -06:00
Hsiao-Wei Wang 3a9dcbadf0
Merge pull request #2487 from ethereum/on-block-tests
Rework + add some `on_block` tests
2021-08-17 21:21:44 +08:00
Hsiao-Wei Wang 93af122b2d
PR feedback from @ralexstokes and add single pubkey aggregate tests 2021-08-05 12:09:30 +08:00
Hsiao-Wei Wang 3b86bd340f
Rename eth2_* to eth_* 2021-08-05 11:20:49 +08:00
Hsiao-Wei Wang a8383be878
Apply suggestions from code review
Co-authored-by: Alex Stokes <r.alex.stokes@gmail.com>
2021-08-05 11:12:36 +08:00
Hsiao-Wei Wang 43a1617ffa
Ensure that the given PKs are valid PKs + fix typos 2021-08-04 21:25:37 +08:00
Hsiao-Wei Wang d8d0686400
Add tests for the Altair BLS helpers 2021-08-04 02:07:57 +08:00
Hsiao-Wei Wang fb2465db45
Rework `on_block` unit tests 2021-06-19 02:03:33 +08:00
Hsiao-Wei Wang 42eae81013
WIP. Rework on_block tests 2021-06-15 21:52:25 +08:00
Danny Ryan 09b6fb0e64
ensure consistency about sync committees vs aggregates in naming throughout 2021-06-07 16:17:46 -06:00
protolambda 4c02dbadd0
enable inactivity updates test generator output, implement new participation flag updates testing 2021-05-22 18:43:29 +02:00
protolambda e50d8d4391
Merge branch 'dev' into config-rework 2021-05-20 23:31:49 +02:00
Alex Stokes a7346ae384
Add Altair fork tests to test generators 2021-05-18 18:05:07 -07:00
protolambda 90c4a7599b
fix lint 2021-05-18 20:53:04 +02:00
protolambda 925f0508ce
test generator fixes 2021-05-18 20:13:19 +02:00
protolambda fb82472b46
update test generators 2021-05-18 18:48:58 +02:00
Alex Stokes b71aa3fb56
add `transition` spec test format 2021-05-11 10:14:23 -07:00
protolambda 8ac59b7317
fix old ssz-static todo comment 2021-05-05 22:38:16 +02:00
protolambda f37f9a367d
include merge in generators 2021-05-05 00:15:15 +02:00
protolambda 5e8304b4c6
Merge SSZ-static tests 2021-04-20 17:26:11 +02:00
Hsiao-Wei Wang cd43d64809
Move constants to `eth2spec.test.helpers.constants` 2021-04-12 22:34:00 +08:00
protolambda d28cac0e8f
clean up test phase 1 testgen references 2021-03-29 15:38:43 +02:00
Hsiao-Wei Wang 5d9f4b072c
Update genesis testgen and format 2021-03-16 00:38:30 +08:00
Hsiao-Wei Wang 9254f1bf8c
Fix conflicts 2021-03-12 00:39:38 +08:00
Hsiao-Wei Wang 216bbb0a46
Merge branch 'dev' into fork-choice-test-vectors 2021-03-12 00:34:23 +08:00
Hsiao-Wei Wang 78a4897418
Add fork choice rule format doc 2021-03-12 00:33:04 +08:00
Hsiao-Wei Wang 8e303b60b9
Fix generator to ssz_snappy mode 2021-03-12 00:06:52 +08:00
Hsiao-Wei Wang 96e29841a7
Merge branch 'dev' into fork-choice-test-vectors 2021-03-11 23:45:54 +08:00
Hsiao-Wei Wang b44e576e95
LIGHTCLIENT_PATCH/HF1 -> ALTAIR 2021-03-11 21:32:00 +08:00
Danny Ryan 4569ddea5d
add missing sanity requirements.txt for generators 2021-03-10 18:49:50 -07:00
Danny Ryan c36106e630
put snappy in 'generator' extra dep build and use for generator builds 2021-03-10 17:18:11 -07:00
Danny Ryan e792c27c91
@hwwhww review
Co-authored-by: Hsiao-Wei Wang <hsiaowei.eth@gmail.com>
2021-03-10 12:27:50 -07:00
Danny Ryan 338be1f636
clean up fork gens 2021-03-09 16:27:06 -07:00
Hsiao-Wei Wang f71a3c6b22
Generate with mainnet config 2021-03-09 21:34:45 +08:00
Hsiao-Wei Wang 5e864af67a
Reload Altair spec 2021-03-09 21:32:37 +08:00
Hsiao-Wei Wang f97ea9e172
Generate basic tests. Still having problem with generating `with_custom_state` tests 2021-03-09 20:55:39 +08:00
Danny Ryan 6c406753f1
working through test gens 2021-03-08 19:11:31 -07:00
Hsiao-Wei Wang 63d3dae7a9
Merge pull request #2210 from mpetrunic/mpetrunic/lc-ssz-static
Disable phase1/enable lightclient ssz static types tests generators
2021-02-23 22:26:13 +08:00
Marin Petrunić d28ec2fc75
fix lint 2021-02-23 14:46:53 +01:00
Hsiao-Wei Wang 993bcdf082
Use constants 2021-02-23 14:25:13 +01:00
Marin Petrunić 1d4f467516
disable phase1/enable lightclient ssz static types test 2021-02-23 13:30:26 +01:00
Marin Petrunić e63754e629
change how generator targets are invoked 2021-02-23 13:23:32 +01:00
Marin Petrunić 9f634dc6f6
Update test generation docs 2021-02-23 09:56:38 +01:00
Hsiao-Wei Wang f6b8171350
Update shuffling generator requirements.txt 2021-02-22 19:45:10 +08:00
Hsiao-Wei Wang de4cad5d35
Update docs 2021-02-22 18:40:04 +08:00
Hsiao-Wei Wang 27507fb3e2
Add `get_head` test vectors 2021-02-19 13:08:35 +08:00
Hsiao-Wei Wang 9cc8567d68
Move `gen_helpers` into a module of `eth2spec` package 2021-02-18 15:17:47 +08:00
Hsiao-Wei Wang c7d975981c
Refactor state tests generators 2021-02-15 22:48:34 +08:00
Hsiao-Wei Wang 600a4daddf
Turn off phase1 testgen and turn on lightclient_patch testgen 2021-02-15 22:29:27 +08:00
Hsiao-Wei Wang 1b00c10ed3
Apply @michaelsproul's feedback 2021-01-27 14:47:52 +08:00
Hsiao-Wei Wang 15e48f712b
Fix Phase 1 epoch_processing and fix epoch_processing testgen 2021-01-27 03:02:12 +08:00
Hsiao-Wei Wang 844c879f1c
Bump `py_ecc` and `milagro_bls_binding` (#2169)
* Bump py_ecc to v5.1.0 and milagro_bls_binding to v1.6.2

* python3.8 -> python3 for py39 compatibility

* fix

* Try python:3.9

* Revert: using Python3.8 in CI now
2021-01-05 21:00:52 +08:00
Danny Ryan 17829836f6
Merge pull request #2099 from ethereum/fix_bls_testgen_typo
Fix BLS testgen typo
2020-10-13 08:08:20 -06:00
Hsiao-Wei Wang d6ccbd515d
Fix typo, `messages` -> `message` 2020-10-13 11:39:10 +08:00
Hsiao-Wei Wang 00a19e583e
Bump milagro_bls_binding to 1.5.0 2020-10-06 16:17:29 +08:00
Hsiao-Wei Wang 4d3ac72473
Bump milagro_bls_binding to `1.4.0`, handle the exception cases 2020-10-05 21:55:49 +08:00
Hsiao-Wei Wang 4613c6b333
Bump py_ecc to 5.0.0 2020-10-01 00:44:47 +08:00
Hsiao-Wei Wang b43f62de0e
Fix encoding 2020-09-25 15:05:10 +08:00
Hsiao-Wei Wang ad4ad2d8b4
Bump IETF BLS spec version draft 03 -> draft 04 2020-09-25 15:01:41 +08:00
Hsiao-Wei Wang bdbd2aae37
Aggregate G2 point at infinity 2020-09-25 15:01:41 +08:00
Hsiao-Wei Wang 19d6c8336a
Add IETF BLS draft 04 edge cases test vectors 2020-09-25 15:01:38 +08:00
Danny Ryan 4c9f5eee71
re-enable mainnet ssz_static tests 2020-09-21 13:40:14 -06:00
Hsiao-Wei Wang 20bd00cef0
Add `make lint_generators` linter check for test generators 2020-09-15 11:19:50 +08:00
Hsiao-Wei Wang c0c2461d2f
Remove redundant keys and use Dict for `phase_0_mods`, `phase_1_mods` instead of List 2020-09-15 11:13:33 +08:00
Hsiao-Wei Wang 916ae9e309
Enable more rewards and finality tests 2020-09-04 21:50:27 +08:00
Hsiao-Wei Wang 74a2a1c0d4
Enable all tests 2020-09-04 02:40:36 +08:00
Hsiao-Wei Wang 6289664260
Update testing context
1. Add `with_configs` decorator to assign available configs
2. Add `only_full_crosslink` decorator to detect if the configuation can
do full crosslinking
3. Add `context.is_pytest` flag: True if calling via pytest. False if
calling from test generator.
2020-08-12 21:50:14 +08:00
Hsiao-Wei Wang 3e5cada5de
Merge branch 'dev' into testgenphase1 2020-08-11 15:24:43 +08:00
protolambda e9d887be4d
Enable BLS in finality tests, use Milagro 2020-07-24 01:19:14 +02:00
Hsiao-Wei Wang de15960185
Add finality tests to test vectors 2020-07-24 04:23:26 +08:00
Hsiao-Wei Wang bdde2e5889
Reorg test dir 2020-07-24 03:54:45 +08:00
Hsiao-Wei Wang 302607eac5
Rename `aggregate_na_pubkeys` to `aggregate_na_signatures` and add comments 2020-07-21 21:10:27 +08:00
protolambda 3c374b1e16
Update test gen to output phase 1 test vectors. Mainnet disabled for now. 2020-07-07 21:26:35 +02:00
protolambda 6b1d4839d8
update block operations generator 2020-07-07 20:17:36 +02:00
Hsiao-Wei Wang ec25f78632
Update path 2020-06-18 14:55:50 +08:00
Hsiao-Wei Wang cceeab2657
Combine `process_crosslinks` and `verify_empty_shard_transition` into `process_shard_transitions` 2020-05-30 03:13:20 +08:00
Hsiao-Wei Wang f72d14a747
Bump `milagro_bls_binding` to 1.2.0
Also verify it in BLS test generator
2020-05-21 01:37:12 +08:00
Danny Ryan 5c564f4d7c
clean up reards generator 2020-05-18 20:06:36 -06:00
Danny Ryan 8060505743
refactor rewards/penalties tests to use a single structure 2020-05-18 16:00:59 -06:00
Danny Ryan 4a86c39712
Merge pull request #1799 from ethereum/bls_v2
Update to IETF BLS draft-irtf-cfrg-bls-signature-02 + draft-irtf-cfrg-hash-to-curve-07
2020-05-18 07:35:49 -06:00
Hsiao-Wei Wang fd3cce0d2c
Update README 2020-05-15 23:38:25 +08:00
Hsiao-Wei Wang d07e594f92
Add `Aggregate()` case 2020-05-15 23:27:35 +08:00
Hsiao-Wei Wang 82073a4a83
Fix typo 2020-05-15 03:05:23 +08:00
Hsiao-Wei Wang ea99f0ab10
Fix typo
Co-authored-by: Danny Ryan <dannyjryan@gmail.com>
2020-05-15 03:03:47 +08:00
Hsiao-Wei Wang 9a2559857c
Fix typo and remove unused variable 2020-05-15 01:18:48 +08:00
Hsiao-Wei Wang d27f2350a2
Update BLS test suite to BLS standard draft v2 format
1. Make sure that BLS -Verify APIs would only return `True` or `False` , no exceptions.
2. Use `eth2spec.utils.bls` instead of py_ecc for test generator
3. Add assertions in test generator
4. Add some special test cases for the -Verify APIs
5. Clean up the test format documents
2020-05-15 00:55:06 +08:00
Hsiao-Wei Wang ed194de26b
Bump py_ecc to v4.0.0 (IETF BLS v2 + H2C v7) 2020-05-13 02:27:51 +08:00
Hsiao-Wei Wang 78d83b6c7d
Bump py_ecc to v3.0.0 (IETF BLS v2 + H2C v6) 2020-05-12 12:21:35 +08:00
Hsiao-Wei Wang cdd0ed0f7b
Update to IETF BLS draft-irtf-cfrg-bls-signature-02 2020-05-09 11:48:48 +08:00
Danny Ryan 8f569a8ddc
add inactivity penalty deltas tests 2020-05-04 20:58:42 -06:00
Danny Ryan eda249957e
basic generators work 2020-05-04 13:20:32 -06:00
Hsiao-Wei Wang fa66475da4
Move `sanity` to under `phase_0` 2020-04-29 00:04:44 +08:00