Commit Graph

1523 Commits

Author SHA1 Message Date
Hsiao-Wei Wang aac1af7db0
Add `test_fail_double_bls_changes_in_same_block` 2022-11-18 17:27:59 +08:00
Hsiao-Wei Wang a1d259addf
Merge pull request #3111 from ethereum/testgen-fix
Fix --preset-list argument and enhance error output
2022-11-18 17:18:39 +08:00
Hsiao-Wei Wang 8824259131
Fix --preset-list argument and enhance error output 2022-11-18 05:08:37 +08:00
Hsiao-Wei Wang d12c2a3b73
Add EIP4844 random tests 2022-11-18 04:55:59 +08:00
Hsiao-Wei Wang 812618cdaf
Fix fork test verifier 2022-11-18 03:37:24 +08:00
Hsiao-Wei Wang 0c8885570e
Add Capella and EIP4844 fork random tests 2022-11-18 03:20:25 +08:00
Hsiao-Wei Wang 2a40b513cb
Add EIP4844 testgen 2022-11-18 03:20:22 +08:00
Hsiao-Wei Wang ee0e2a03d2
Merge branch 'dev' into pr3052 2022-11-18 02:44:46 +08:00
Hsiao-Wei Wang b6df4b5a9e
Merge pull request #3066 from etan-status/lc-prooftest
Allow extending LC merkle proof tests
2022-11-18 02:34:07 +08:00
Hsiao-Wei Wang f1d4c9047a
Merge branch 'dev' into pr3052 2022-11-18 02:12:07 +08:00
Etan Kissling b612ec5fd5
cleanup explicit fork enumerations in tests
Fork epoch override test decorators were still referring to `SHARDING`.
Replace the implementation with one that needs less maintenance.
2022-11-16 16:39:06 +01:00
terence tsao bbc3ec02ff Fix typos 2022-11-12 23:36:34 -08:00
George Kadianakis ff34006807 Refactor `verify_kzg_proof()` to receive bytes (used in precompile)
This way, client devs don't need to convert to field elements themselves, and the KZG library takes care fo it.
2022-11-12 01:47:39 +02:00
inphi 37144460be
Fix merge conflict 2022-11-11 17:52:57 -05:00
inphi 3df1371897
Merge remote-tracking branch 'origin/dev' into inphi/eip4844-rebase 2022-11-11 17:32:06 -05:00
Hsiao-Wei Wang a6c4b9ae9e
Merge pull request #3072 from etan-status/sf-ispostfork
Move `is_post_xxx` functions to new module
2022-11-12 04:26:29 +08:00
inphi 67ba28c9d0
remove eip4844 epoch_processing package 2022-11-10 14:13:49 -05:00
inphi fcafdc14a3
remove eip4844 partial/full withdrawwals tests 2022-11-10 14:11:05 -05:00
inphi 2fbb1eddd2
fix test_process_withdrawals 2022-11-10 14:01:50 -05:00
inphi a04f06bd11
Fix merge conflict 2022-11-10 13:29:33 -05:00
inphi a59dd37933
Merge remote-tracking branch 'origin/dev' into inphi/eip4844-rebase 2022-11-10 13:17:57 -05:00
Danny Ryan 37996fc36c
Merge pull request #3068 from potuz/withdrawals_without_queues
Withdrawals without queues
2022-11-10 10:49:25 -07:00
Etan Kissling 76157f91d7
Rename `phases.py` to `forks.py`; add `ValueError` check
Co-authored-by: Hsiao-Wei Wang <hsiaowei.eth@gmail.com>
2022-11-10 13:26:00 +01:00
Etan Kissling 99785733b7
Merge branch 'dev' into sf-ispostfork 2022-11-10 13:15:17 +01:00
Potuz c7d733303f lint 2022-11-10 08:47:16 -03:00
Potuz 3d82a19b3b whitespace 2022-11-10 08:41:55 -03:00
Potuz 6179085b7e Merge branch 'withdrawals_without_queues' of github-potuz:potuz/consensus-specs into withdrawals_without_queues 2022-11-10 08:40:31 -03:00
Potuz 7f266bcb0f Use next_validator_withdrawal_index 2022-11-10 08:33:11 -03:00
Hsiao-Wei Wang 087f785ee9
PR feedback from @djrtwo 2022-11-09 17:15:00 -05:00
Potuz 2f89f5096d Danny's review 1st pass 2022-11-07 17:29:56 -03:00
Hsiao-Wei Wang 95ee291f58
Merge branch 'dev' into pr3052 2022-11-07 10:10:16 -05:00
Hsiao-Wei Wang 544ae28721
Merge pull request #3016 from ethereum/gen_kzg_trusted_setups
Rework the testing KZG trusted setups presets
2022-11-07 22:29:54 +08:00
Hsiao-Wei Wang b7dfd5a37e
Merge pull request #3027 from ethereum/eip-4844-fee-ssz-fix
eip4844: update tx_peek_blob_versioned_hashes to match tx type from fee market update
2022-11-07 22:22:12 +08:00
Etan Kissling 37c30ad9db
Merge branch 'dev' into sf-ispostfork 2022-11-07 15:22:02 +01:00
Hsiao-Wei Wang dac756efee
Minor clean up 2022-11-07 09:09:09 -05:00
Etan Kissling 08ff71688f
Merge branch 'dev' into lc-blockfuncs 2022-11-07 15:03:20 +01:00
Etan Kissling cfad029f45
Merge branch 'dev' into lc-prooftest 2022-11-07 14:41:27 +01:00
Hsiao-Wei Wang 3fc1ebce06
Move some Capella operation tests to sanity/blocks tests 2022-11-07 08:39:10 -05:00
Potuz 8488fb79d9 Alex Stokes' review 2022-11-04 18:47:56 -03:00
Potuz e15b02d16f lint 2022-11-04 09:13:21 -03:00
Potuz 9973e9f29f harden tests and add couple of cases 2022-11-04 09:00:53 -03:00
Potuz 6e913ecbd2 rename to latest_withdrawal_validator_index 2022-11-03 20:23:35 -03:00
Hsiao-Wei Wang b530dc09aa
Move old withdrawal epoch_processing tests to block_processing 2022-11-03 16:57:02 -05:00
Hsiao-Wei Wang 494cefcda6
Fix sanity block tests 2022-11-03 16:27:24 -05:00
Hsiao-Wei Wang 0b1f32ec25
Fix capella/block_processing tests 2022-11-03 16:08:05 -05:00
Potuz a09d617737 right ret 2022-11-03 15:07:03 -03:00
Hsiao-Wei Wang ad36548480
Fix auto-rebase errors 2022-11-03 11:46:07 -05:00
Potuz f506087af5
rebase on top of develop 2022-11-03 11:42:30 -05:00
Hsiao-Wei Wang 7c016f3236
Add testing KZG trusted setups generator tool and load the file during building pyspec 2022-11-03 10:17:42 -05:00
George Kadianakis 86e15764ad
EIP4844: Update cryptography API (#3038)
This commit changes the public API of the KZG library to the following high-level API:

```
- verify_kzg_proof()
- compute_aggregate_kzg_proof()
- verify_aggregate_kzg_proof()
- blob_to_kzg_commitment()
```

compared to the previous much more low-level API:

```
- compute_powers()
- matrix_lincomb()
- lincomb()
- bytes_to_bls_field()
- evaluate_polynomial_in_evaluation_form()
- verify_kzg_proof()
- compute_kzg_proof()
```

This means that all the cryptographic logic (including Fiat-Shamir) is now isolated and hidden in the KZG library and the `validator.md` file ends up being significantly simplified, only calling high-level KZG functions.

Some additional things that this commit does:

- Moves all EIP4844 cryptography into polynomial-commitments.md
- Improves the Fiat-Shamir stack by removing the need for SSZ and by introducing simple domain separators

Co-authored-by: Kevaundray Wedderburn <kevtheappdev@gmail.com>
Co-authored-by: Hsiao-Wei Wang <hsiaowei.eth@gmail.com>
Co-authored-by: Dankrad Feist <mail@dankradfeist.de>
2022-11-03 17:01:32 +02:00
Etan Kissling 332ad4cb57
Move `is_post_xxx` functions to new module
Moving the `is_post_xxx` functions to a separate module allows `genesis`
to also use them (cyclic import from `context` prevented this before).
This allows removing `FORKS_BEFORE_ALTAIR` and `FORKS_BEFORE_BELLATRIX`
constants and adding a more general `is_post_fork` function that needs
less maintenance. This then allows definition of `with_all_phases_from`
to streamline the implementation of the `with_xxx_and_later` decorators.
2022-10-30 12:50:56 +01:00
Etan Kissling ff0e525ecc
Pass blocks to LC data creation functions
Future light client protocol extensions may include data from the block
in addition to data from the state, e.g., `ExecutionPayloadHeader`.
To prepare for this, also pass the block to the corresponding functions.
In practice, blocks access is easier than historic state access, meaning
there are no practical limitations due to this change.
2022-10-28 22:14:25 +02:00
Etan Kissling 5c66300171
Use `suite_name` instead of `meta.yaml` for SSZ type 2022-10-28 20:32:33 +02:00
Alex Stokes bab01d6e99
Merge pull request #3067 from etan-status/lc-synctestroot
Rename LC test check from `root` to `beacon_root`
2022-10-28 08:55:27 -06:00
Alex Stokes 72b6abd545
Merge pull request #3064 from etan-status/lc-periodatepoch
Consistently use `compute_sync_committee_period_at_slot`
2022-10-28 08:49:58 -06:00
Etan Kissling 4fc80765ad
Also update test logic accordingly 2022-10-27 22:08:24 +02:00
Etan Kissling 990866dd9f
Rename LC test check from `root` to `beacon_root`
Future light client tests will also incorporate execution payload data.
To avoid confusion, rename the current `root` check to `beacon_root`.
Doing this now, as #3066 already requires LC test runners to update.
2022-10-27 22:06:11 +02:00
Etan Kissling cdaf7e84dd
Allow extending LC merkle proof tests
Currently, `test_single_merkle_proof` only supports `BeaconState` tests.
For future tests, different object classes are desirable. Update format
to allow testing other objects as well.
2022-10-27 21:59:48 +02:00
Etan Kissling 14b3463f2c
Consistent variable name in LC test
In light client tests, a variable is named `finality_header` but
everywhere else it is called `finalized_header`. Rename for consistency.
2022-10-27 00:01:22 +02:00
Hsiao-Wei Wang 60187e5dc4
Add `test_process_withdrawals` no-op test 2022-10-26 15:19:15 -05:00
Hsiao-Wei Wang e460005aff
Add tests for no-op functions 2022-10-26 15:12:05 -05:00
Hsiao-Wei Wang 317209591d
Make pyspec disable withdrawal-functions in EIP4844 2022-10-26 15:06:39 -05:00
Hsiao-Wei Wang af8c5bf532
Merge pull request #3046 from terencechain/couple-block-sidecar
EIP4844: couple beacon block and blob sidecar for p2p
2022-10-26 23:51:23 +08:00
Hsiao-Wei Wang 3c7c3a9c97
bump VERSION.txt to 1.3.0-alpha.0 (#3056) 2022-10-25 11:45:04 +08:00
inphi 6d270cdc52
Add CAPELLA_FORK_EPOCH overrides 2022-10-24 17:21:36 -04:00
inphi 459310f744
Fix test_process_execution_payload 2022-10-24 16:25:50 -04:00
Hsiao-Wei Wang 9844ea1f30
Merge pull request #3040 from ethereum/capella-test-vectors
Capella test vectors
2022-10-23 06:44:03 +08:00
terence tsao e2d0a4fa9a Fix ToC and test 2022-10-22 08:36:46 -07:00
Hsiao-Wei Wang 0e2c3d89e0
Fill `bls_to_execution_changes` field in Capella random tests 2022-10-20 22:22:11 -05:00
Hsiao-Wei Wang d013379628
Ensure `validator_index` is in validator set 2022-10-19 10:27:01 -05:00
Hsiao-Wei Wang 53b63cedc5
Merge branch 'dev' into pr3050 2022-10-19 10:21:32 -05:00
Jim McDonald 0345b2284a
Add validator_index to Withdrawal. 2022-10-18 15:35:06 +01:00
Hsiao-Wei Wang b90436c988
Fix capella random & fork 2022-10-14 23:42:42 -05:00
Hsiao-Wei Wang 03ced9c263
Add Capella tests 2022-10-14 23:40:45 -05:00
Hsiao-Wei Wang 6181035d5d
Fix typo (#3039) 2022-10-15 12:40:17 +08:00
Hsiao-Wei Wang 9717daa325
Merge branch 'dev' into more-withdrawals-tests 2022-10-10 10:07:38 -05:00
protolambda 2d08dc51c5
eip-4844: test tx_peek_blob_versioned_hashes 2022-10-06 18:13:35 +02:00
protolambda c7d88b7ce5
eip4844: update test type definition 2022-10-06 18:13:35 +02:00
Danny Ryan 491f14c76f
some capella sanity tests 2022-10-05 10:40:58 -06:00
Hsiao-Wei Wang 44424c4080
Bump dep packages version and fix lint issues 2022-09-28 12:38:21 +08:00
Danny Ryan 0fdab6130e
Merge pull request #3010 from jtraglia/partial-withdrawal-balance-tests
Add partial withdrawal balance tests
2022-09-26 14:35:28 -06:00
Danny Ryan eeebd42a95
Merge pull request #2998 from ethereum/remove-withdrawn-epoch
remove withdrawn_epoch
2022-09-26 14:30:25 -06:00
Justin Traglia fdb5c7dcf3 Add partial withdrawal balance tests 2022-09-22 15:19:22 -05:00
Danny Ryan bfca7f9a96
Apply suggestions from code review
Co-authored-by: Alex Stokes <r.alex.stokes@gmail.com>
2022-09-21 07:50:31 -06:00
Danny Ryan 91ea9e6959
review suggestion from @hwwhww
Co-authored-by: Hsiao-Wei Wang <hsiaowei.eth@gmail.com>
2022-09-20 08:22:26 -06:00
Danny Ryan 70f90c5296
rmove withdrawn_epoch 2022-09-19 11:39:46 -06:00
Danny Ryan 63d284a85c
bump version to v1.2.0 2022-09-16 09:55:36 -06:00
Danny Ryan 770a603af9
Merge pull request #2989 from ethereum/deposit-zero-pk
Add `test_process_deposit::test_key_validate_invalid`
2022-09-13 14:05:13 -06:00
Hsiao-Wei Wang 4d2cfff2d6
Add `test_key_validate_invalid_decompression` 2022-09-12 22:59:29 +08:00
Hsiao-Wei Wang e4407c64e3
Add `test_process_deposit::test_key_validate_invalid` 2022-09-12 22:31:49 +08:00
Hsiao-Wei Wang 2e73091258
Add `get_valid_flag_value` helper to determine the `valid` flag value 2022-09-08 22:42:39 +08:00
Hsiao-Wei Wang 0f8b5ae6bd
Apply PR feedback from @michaelsproul 2022-09-02 20:45:51 +08:00
Hsiao-Wei Wang ac717b106a
Address PR feedback from @mkalinin 2022-08-31 22:02:47 +08:00
Hsiao-Wei Wang f8d92c3bd8
Add basic test case 2022-08-24 23:20:31 +08:00
Danny Ryan efc4d45bbc
bump VERSION.txt 2022-08-18 11:35:39 -06:00
Hsiao-Wei Wang bafb5870c1
Update tests/core/pyspec/eth2spec/test/bellatrix/block_processing/test_process_deposit.py
Co-authored-by: Danny Ryan <dannyjryan@gmail.com>
2022-08-19 01:20:53 +08:00
Hsiao-Wei Wang 6c00b48dca
PR feedback from @djrtwo: add `is_before_fork_epoch` and more param combinations 2022-08-19 00:29:56 +08:00
Hsiao-Wei Wang 806a6ad414
Apply suggestions from code review
Co-authored-by: Danny Ryan <dannyjryan@gmail.com>
2022-08-19 00:03:58 +08:00
Hsiao-Wei Wang b3ef9b2b3e
Add invalid fork version tests 2022-08-18 22:49:02 +08:00
Danny Ryan ff6181f8f5
Merge branch 'master' into dev 2022-08-16 09:04:43 -06:00
Hsiao-Wei Wang d95c45523f
Fix path: the bellatrix-new tests have been moved to altair file 2022-08-16 14:29:56 +08:00
Danny Ryan 91b584eb21
bump VERSION.txt (#2971) 2022-08-15 09:11:41 -06:00
Danny Ryan ccc40e1982
a few more bellatrix tests (#2962)
* Do not overload index with WithdrawalIndex and ValidatorIndex

* a few more bellatrix tests

* use function from other PR

* fix tests

* Update tests/core/pyspec/eth2spec/test/bellatrix/transition/test_transition.py

Co-authored-by: Hsiao-Wei Wang <hsiaowei.eth@gmail.com>

* refactor to reuse bellatrix transitio ntests for all transitions

Co-authored-by: Potuz <potuz@prysmaticlabs.com>
Co-authored-by: Hsiao-Wei Wang <hsiaowei.eth@gmail.com>
2022-08-15 07:49:53 -06:00
Danny Ryan 3d785dad7a
pr feedback from @hwwhww 2022-08-03 08:24:32 -06:00
Danny Ryan 7e360240f9
more execution payload tests and cleanup old ones 2022-08-01 11:42:38 -06:00
Hsiao-Wei Wang 176a5d227a
Move `merkle/single_proof` tests to `light_client/single_merkle_proof` 2022-07-22 21:34:09 +08:00
Etan Kissling 8643e28f12
`try_...` --> `process_...` 2022-07-22 11:49:07 +02:00
Etan Kissling f9d866eb28
Manually trigger `LightClientStore` force updates
Replaces `process_slot_for_light_client_store` which force updates the
`LightClientStore` automatically based on `finalized_header` age with
`try_light_client_store_force_update` which may be manually called based
on use case dependent heuristics if light client sync appears stuck.
Not all use cases share the same risk profile.
2022-07-21 16:06:46 +02:00
Hsiao-Wei Wang 1d2ef9f8cb
Merge pull request #2938 from etan-status/lc-testsuite
Add functions for deriving light client data
2022-07-20 14:47:05 +08:00
Hsiao-Wei Wang 0f31fcdee4
[Refactor] remove useless `spec` param from `compute_committee_indices` 2022-07-19 22:17:35 +08:00
Etan Kissling 0941114acf
Merge branch 'dev' into lc-testsuite 2022-07-18 18:19:07 +02:00
Hsiao-Wei Wang a1546fdf4f
Merge branch 'dev' into fix-capella-genesis 2022-07-18 14:48:02 +08:00
Etan Kissling c9f0927d8b
Merge branch 'dev' into lc-testsuite 2022-07-17 06:34:52 +02:00
Etan Kissling 261c5317e1
Remove genesis check now that Capella is fixed
Co-authored-by: Hsiao-Wei Wang <hsiaowei.eth@gmail.com>
2022-07-15 21:40:13 +02:00
Etan Kissling 63816debcc
Merge commit '9c798806355f67a32704a8cd5a98d90deccb8f69' into lc-testsuite 2022-07-15 21:38:18 +02:00
Etan Kissling 9d41c2306f
Align format of override `config.yaml` with base cfg 2022-07-15 21:37:18 +02:00
Etan Kissling 30d635259b
Move test files to `light_client` subdir 2022-07-15 21:36:26 +02:00
Hsiao-Wei Wang ec7c7c8589
Remove leftover print 2022-07-16 01:41:56 +08:00
Hsiao-Wei Wang 185f51ec0e
Merge branch 'dev' into pr2937 2022-07-16 01:40:39 +08:00
Hsiao-Wei Wang 5356fee282
Fix `test_override_config_fork_epoch` 2022-07-16 01:28:19 +08:00
Hsiao-Wei Wang 400e1e54c1
Fix EIP4844 `create_genesis_state`, `EIP4844_FORK_VERSION`, and `config_fork_epoch_overrides`
`config_fork_epoch_overrides`: since Capella and EIP4844 are in parallel, need to check if the field exists

Update `compute_fork_version`
2022-07-16 01:13:25 +08:00
Hsiao-Wei Wang 808f9c7f7f
Use `validate_*` for the valdiation functions that return `None` 2022-07-16 00:54:01 +08:00
Danny Ryan d49c98c7aa
Merge pull request #2926 from ralexstokes/spec-diagnostis
Add summary diagnostics to spec test gen
2022-07-15 09:01:32 -06:00
Hsiao-Wei Wang 9c79880635
Fix genesis testing tool and add Capella version `initialize_beacon_state_from_eth1` helper 2022-07-15 22:22:19 +08:00
Etan Kissling 3c5d347cdc
Emit checks after each individual test step
Co-authored-by: Hsiao-Wei Wang <hsiaowei.eth@gmail.com>
2022-07-15 13:13:33 +02:00
Etan Kissling 73279f8382
Explain why the tests check for Altair twice 2022-07-15 12:24:40 +02:00
Etan Kissling 88a69512b2
`finalize_test` --> `finish_test` 2022-07-15 12:04:56 +02:00
Etan Kissling 95c07575b1
Hide `build_proof` and `get_backing` from spec 2022-07-15 11:54:47 +02:00
Etan Kissling 86fe93ca96
Add functions for deriving light client data
Adds `create_light_client_bootstrap` and `create_light_client_update`
functions as a reference implementation for serving light client data.
This also enables a new test harness to verify that light client data
gets applied to a `LightClientStore` as expected.
2022-07-14 09:36:09 +02:00
George Kadianakis 2558282e6d EIP-4844: Introduce KZG and blob verification unittests
Co-authored-by: Hsiao-Wei Wang <hsiaowei.eth@gmail.com>
2022-07-13 13:14:31 +03:00
George Kadianakis 567a25f883 EIP-4844: Make the spec executable
- Implement all the required glue code to make things executable
- Implement a dummy KZG trusted setup

Co-authored-by: Hsiao-Wei Wang <hsiaowei.eth@gmail.com>
2022-07-13 13:14:05 +03:00
Etan Kissling 654970c605
Add `LightClientBootstrap`
Introduces a new `LightClientBootstrap` structure to allow setting up a
`LightClientStore` with the initial sync committee and block header from
a user-configured trusted block root.

This leads to new cases where the `LightClientStore` is only aware of
the current but not the next sync committee. As a side effect of these
new cases, the store's `finalized_header` may now  advance into the next
sync committee period before a corresponding `LightClientUpdate` with
the new sync committee is obtained, improving responsiveness.

Note that so far, `LightClientUpdate.attested_header.slot` needed to be
newer than `LightClientStore.finalized_header.slot`. However, it is now
necessary to also consider certain older updates to try and backfill the
`next_sync_committee`. The `is_better_update` helper is also updated to
improve `best_valid_update` tracking.
2022-07-12 07:27:00 +02:00
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
Etan Kissling e269b305b9
Cleanup light client tests
Various cleanups and minor fixes:
- Consistent terminology:
  - `signed_block` -> `attested_block`
  - `finalized_block_header` -> `finalized_header`
  - `snapshot_period` -> `store_period`
- Use correct block in finality test (`blocks[-1]` instead of new one)
- Add `signed_block_header` func to get header from `SignedBeaconBlock`
- Remove `block_header` from `get_sync_aggregate` helper arguments
- Use `state_transition_with_full_block` as shortcut for multiple calls
- Have `finalized_header` actually be header instead of full block body
- Consistent ordering of `assert` to match structure definition
2022-06-30 11:09:49 +02:00
Alex Stokes 529ce301b8
write test generator diagnostics to a summary file 2022-06-29 12:09:56 -06:00
Etan Kissling f5f3031c5e
Allow passing redundant `next_sync_committee`
The producer of `LightClientUpdate` structures usually does not know how
far the `LightClientStore` on the client side has advanced. Updates are
currently rejected when including a redundant `next_sync_committee` not
advancing the `LightClientStore`. Behaviour is changed to allow this.
2022-06-29 13:16:03 +02:00
Etan Kissling 9a253e437d
create decorator for tests with matching config 2022-06-24 01:05:11 +02:00
Etan Kissling 0b8ab23bd4
Remove `fork_version` from `LightClientUpdate`
The `fork_version` field in `LightClientUpdate` can be derived from the
`update.signature_slot` value by consulting the locally configured fork
schedule. The light client already needs access to the fork schedule to
determine the `GeneralizedIndex` values used for merkle proofs, and the
memory layouts of the structures (including `LightClientUpdate`). The
`fork_version` itself is network dependent and doesn't reveal that info.
2022-06-16 17:17:24 +02:00
Hsiao-Wei Wang 8cc008d11c
Merge pull request #2805 from etan-status/lc-period
Allow light client to verify signatures at period boundary
2022-06-16 16:53:12 +02:00
Danny Ryan 74489d5523
Partial withdrawals (#2862)
* t push base design for partial withdrawals

* moor tests

* clean up withdrawals naming

* make partial withdrawal randomized tests better

* Apply suggestions from code review

Co-authored-by: Alex Stokes <r.alex.stokes@gmail.com>
Co-authored-by: Hsiao-Wei Wang <hsiaowei.eth@gmail.com>

* fix mainnet brokn test

* name swap

* lint

Co-authored-by: Alex Stokes <r.alex.stokes@gmail.com>
Co-authored-by: Hsiao-Wei Wang <hsiaowei.eth@gmail.com>
2022-06-08 13:16:12 -06:00
Hsiao-Wei Wang c165d31ccb
Remove `@disable_process_reveal_deadlines` 2022-06-06 16:24:44 +08:00
Danny Ryan e43b1f7679
bump version.txt (#2900) 2022-05-23 05:25:20 -06:00
Danny Ryan 895cce5aeb
bump version.txt 2022-05-23 05:23:16 -06:00
Danny Ryan 1d82d33774
Merge pull request #2887 from jtraglia/add-invalid-withdrawable-epoch-test
Add invalid large withdrawable epoch test
2022-05-16 08:07:21 -06:00
Justin Traglia 02090d94ab Remove pytest import 2022-05-10 11:00:16 -05:00
Justin Traglia d1f0187076 Revert "Move test case to new location"
This reverts commit e2cbdb2b67.
2022-05-10 10:48:59 -05:00
Justin Traglia 5868a53cf1 Revert "Fix linter warnings again"
This reverts commit ac7267c938.
2022-05-10 10:48:51 -05:00
Justin Traglia ac7267c938 Fix linter warnings again 2022-05-09 16:50:43 -05:00
Justin Traglia e2cbdb2b67 Move test case to new location 2022-05-09 16:47:19 -05:00
Justin Traglia 90c1825637 Convert participation_fn from lambda to def
I felt that the the lambda was a little too complicated.
2022-05-09 15:53:36 -05:00
Justin Traglia 9dcb2eecbc Fix linter warnings 2022-05-09 14:28:54 -05:00
Justin Traglia a7bda480fe Convert sets to sorted lists prior to sampling
This is because sampling of sets has been deprecated in Python 3.9. I used
sorted() instead of list() so that things are deterministic.
2022-05-09 14:09:27 -05:00
Justin Traglia 3c7544af3d Add invalid large withdrawable epoch test 2022-05-06 13:56:40 -05:00
Danny Ryan c1d0836936
Merge pull request #2855 from ethereum/00-to-01
00 to 01 cred change
2022-05-05 07:31:49 -06:00
Hsiao-Wei Wang 8a4ea1d13d
Merge pull request #2877 from zilm13/fix/equivocating-indices
Yield attestation in equivocating indices test
2022-05-03 14:44:57 +02:00
Etan Kissling 5653649ca8
Allow light client to verify signatures at period boundary
As the sync committee signs the previous block, the situation arises at
every sync committee period boundary, that the new sync committee signs
a block in the previous sync committee period. The light client cannot
reliably detect this condition (e.g., assume that this is the case when
it is currently on the last slot of a sync committee period), because
the last couple slots of a sync committee period may not have a block.

For example, when receiving a `LightClientUpdate` that is constructed
as in the following illustration, it is unknown whether `sync_aggregate`
was signed by the current or next sync committee at `attested_header`.

```

        slot N           N + 1   |            N + 2   (slot not sent!)
                                 |
  +-----------------+     \ /    |     +----------------+
  | attested_header | <--- X ----|---- | sync_aggregate |
  +-----------------+     / \    |     +----------------+
                        missed   |
                                 |
                          sync committee
                          period boundary
```

This patch addresses this edge case by including the slot at which the
`sync_aggregate` was created into the `LightClientUpdate` object.

Note that the `signature_slot` cannot be trusted beyond the purpose of
signature verification, as it could be manipulated to any other slot
within the same sync committee period and fork version, without making
the `sync_aggregate` invalid.
2022-05-02 13:08:20 +02:00
Dmitrii Shmatko b9cb294650 Yield attestation in equivocating indices test 2022-04-25 23:23:44 +03:00
Etan Kissling f125538122
Fix param order in `prepare_execution_payload`
Documentation on how to call `prepare_execution_payload` had the params
for `safe_block_hash` and `finalized_block` hash flipped compared to the
function definition. Also updated tests for consistency.
2022-04-25 16:49:00 +02:00
Danny Ryan 1bfefe301d
Merge pull request #2858 from mkalinin/justified-to-safe-block
Bellatrix: pass justified as a safe block
2022-03-30 12:19:21 -06:00
Danny Ryan ee5f29cb75
fix ci 2022-03-24 09:57:43 -06:00
Danny Ryan 6e369e4a53
Apply suggestions from code review
Co-authored-by: Hsiao-Wei Wang <hsiaowei.eth@gmail.com>
2022-03-23 10:55:27 -06:00
Danny Ryan 2017b61265
test address_change 2022-03-22 13:37:17 -06:00
Mikhail Kalinin 95a2327800 Bellatrix: add get_safe_block_hash to validator.md 2022-03-22 22:51:45 +06:00
Danny Ryan 702ed9f39a
Merge branch 'withdrawals-push' into 00-to-01 2022-03-22 08:23:34 -06:00
Danny Ryan b469593219
toc 2022-03-22 08:22:35 -06:00
Danny Ryan 0da78ebc4b
Merge branch 'withdrawals-push' into 00-to-01 2022-03-22 08:19:31 -06:00
Danny Ryan c10d219664
Merge branch 'dev' into withdrawals-push 2022-03-22 08:11:09 -06:00
Danny Ryan 493b169022
refine naming for withdrawals 2022-03-22 07:55:45 -06:00
Danny Ryan 79cdb88e66
wip 00 to 01 cred change 2022-03-16 15:41:37 -06:00
Danny Ryan 36aae1d848
add tests for process_withdrawals 2022-03-16 13:35:29 -06:00
Mikhail Kalinin cc347c6ff4
Merge pull request #2851 from mkalinin/safe-head
Add safe_block_hash to notify_forkchoice_updated
2022-03-16 13:29:23 +06:00
Mikhail Kalinin 84ab086d94 Add safe_block_hash to notify_fc_updated 2022-03-14 19:09:21 +06:00
Danny Ryan 3dd83cf4ee
minor withdrawals renamings 2022-03-10 12:30:51 -07:00
Danny Ryan 507f550cb1
Merge branch 'dev' into withdrawals-push 2022-03-10 10:27:20 -07:00
Hsiao-Wei Wang 95c712598a Fix `test_discard_equivocations` test vectors 2022-03-09 10:16:37 +08:00
Danny Ryan e1b9cf97e2
add withdrawal index to wihdrawal transaction 2022-03-03 14:02:52 -07:00
Aditya Asgaonkar 7f31c80b8f Fix lint & CI 2022-03-01 11:47:45 -08:00
Aditya Asgaonkar 4fbe162655 Add on_attester_slashing() and related test 2022-03-01 11:42:49 -08:00
Danny Ryan 1fb7a95329
bump VERSION.txt to 1.1.10 2022-02-25 11:23:15 -07:00
Danny Ryan 0a55f062d7
fix execution paylaod tests 2022-02-24 15:38:23 -07:00
Danny Ryan f5dab5b666
fix fully withdrawal tests 2022-02-24 15:06:31 -07:00
Danny Ryan 2026103bb9
Merge branch 'dev' into withdrawals-push 2022-02-23 15:08:29 -07:00
Mikhail Kalinin 1280fe2a02 Bellatrix: random -> prev_randao 2022-02-22 17:16:33 +06:00
Hsiao-Wei Wang 3d7f307020 Refactor test_sync_protocol.py a bit 2022-02-04 17:46:37 -08:00
Hsiao-Wei Wang f2fd673a66
Merge pull request #2807 from etan-status/compute-sync-period
Consistently use `compute_sync_committee_period`
2022-02-01 16:05:58 -08:00
Danny Ryan 67fcbf22ec
bump version 2022-01-28 06:44:04 -07:00
Alex Stokes 129d9e28b4
add randomized tests for bellatrix 2022-01-27 19:41:09 -08:00
Mikhail Kalinin eb4497fae7 Bellatrix: Rename execute_payload to notify_new_payload 2022-01-27 15:24:53 +06:00
Danny Ryan 671c4f0e3a
receipt_root -> receipts_root 2022-01-17 13:42:10 -07: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
Hsiao-Wei Wang 16c350ebcd
Merge pull request #2796 from etan-status/lc-aggregate
Rename `sync_committee_aggregate` > `sync_aggregate`
2022-01-13 21:07:50 +08:00
Danny Ryan a1719f9afc
Merge pull request #2784 from status-im/config-name
Add `CONFIG_NAME` to configs
2022-01-11 07:24:15 -07: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
Danny Ryan af4725d08a
add some non-empty extra_data tests 2022-01-03 07:51:35 -07:00
Jacek Sieka 46bc206740
Add `CONFIG_NAME` to configs
Runtime configurations apply to a certain network and the name of that
network is useful for humans such that they can talk about it.

Some of the existing configs already include a `CONFIG_NAME` toggle -
might as well add it here as well and avoid some confusion - this name
above all becomes useful in the beacon API.

By extension, the `CONFIG_NAME` config will appear in the beacon api as
a result of being defined here.
2021-12-29 13:02:36 +01:00
Hsiao-Wei Wang cbf314c67e
Move capella fork tests to the correct folder and resolve conflicts 2021-12-27 18:44:03 +08:00
Hsiao-Wei Wang 171a9ccc81
Resolve conflicts 2021-12-27 18:30:12 +08:00
Hsiao-Wei Wang db642e0586 bump VERSION.txt to 1.1.8 2021-12-25 00:59:11 +08:00
Hsiao-Wei Wang ba690852d6
Merge pull request #2774 from ethereum/bellatrix
Rename "Merge" -> "Bellatrix"
2021-12-24 01:46:55 +08:00
Hsiao-Wei Wang a7df9a39cc
Set RNG seed 2021-12-23 21:33:23 +08:00
Hsiao-Wei Wang 41af639517
PR feedback from @mkalinin 2021-12-23 17:26:48 +08:00
Hsiao-Wei Wang 8facc0a095
Merge -> Bellatrix 2021-12-23 14:25:43 +08:00
Hsiao-Wei Wang cba3ddfc3d
bump VERSION.txt to 1.1.7 2021-12-22 15:47:38 +08:00
Hsiao-Wei Wang 2fa396f67d
Merge pull request #2746 from ethereum/vbuterin-patch-12
Simplify sync protocol and update to calculate optimistic heads
2021-12-16 00:12:36 +08: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 6edf840992
fix lint 2021-12-11 09:06:56 +08:00
Hsiao-Wei Wang 4cea972cc0
Apply suggestions from code review
Co-authored-by: Caspar Schwarz-Schilling <31305984+casparschwa@users.noreply.github.com>
2021-12-11 09:01:16 +08:00
Hsiao-Wei Wang 11a42f8d06
Remove `*_without_boost` tests 2021-12-09 17:58:31 +08:00
Hsiao-Wei Wang addc03cb7c
Enable ex-ante tests in testgen and minor fixes 2021-12-09 17:47:20 +08:00
Caspar Schwarz-Schilling 9f614fca83 Fix linting 2021-12-08 18:31:14 +01:00
Caspar Schwarz-Schilling 79e1d5e021 Fix head view comparison 2021-12-08 18:14:46 +01:00
Caspar Schwarz-Schilling dc9db78a67 Add sandwich test scenarios 2021-12-08 17:05:44 +01:00
Alex Stokes db2be42baa
use a specific `spec` rather than the pre-defined phases 2021-12-07 18:50:00 +01:00
Alex Stokes 55c9c03f08
simply module import and fix config adjustment 2021-12-07 18:22:10 +01:00
Alex Stokes 733f37715e
use `importlib` to perform an actual spec copy 2021-12-07 17:55:17 +01:00
Alex Stokes 57be9d064f
update per-test config to be unique per-test 2021-12-07 17:13:26 +01:00
Hsiao-Wei Wang 200ed58dd9
Merge branch 'dev' into ex-ante-tests 2021-12-07 18:29:48 +08:00
Hsiao-Wei Wang 9dc1b7af7e
Test with strict `proposer_boost + 1` attestation participants 2021-12-07 00:25:26 +08:00
Danny Ryan 59d48210a1
fix forkchoice tests 2021-12-02 12:10:46 -07:00
Danny Ryan 6969c8af67
lint 2021-12-02 12:03:51 -07:00
Danny Ryan 180abb90ec
clean up some withdrawal logic and add tests 2021-12-02 11:56:33 -07:00
Hsiao-Wei Wang 6308cee7a6
Fix typo 2021-12-03 02:17:57 +08:00
Danny Ryan 3024dc8ba8
add withdrawn_epoch to capella validators 2021-12-02 10:52:56 -07:00
Hsiao-Wei Wang a399d953d3
Add assertion to `test_shorter_chain_but_heavier_weight` 2021-12-02 17:21:42 +08:00
Danny Ryan 78d55839b9
fix tsts 2021-12-01 16:42:12 -07:00
Danny Ryan b7308e0953
remove capella built files 2021-12-01 11:43:32 -07:00
Danny Ryan 4f24fe455b
basic capella withdrawal in place 2021-12-01 11:37:30 -07:00
Hsiao-Wei Wang dc52b35145
Add `PROPOSER_SCORE_BOOST` to meta.yaml and fix comments 2021-12-02 01:37:01 +08:00
Hsiao-Wei Wang bb8168fd95
Make config dict compatible with yaml.dump 2021-12-02 01:34:35 +08:00
Hsiao-Wei Wang d7f6a42729
[WIP] Add ex-ante fork choice test cases 2021-12-01 02:37:22 +08:00
Danny Ryan 4370b9c816
bump VERSION.txt to 1.1.6 2021-11-23 14:53:13 -07:00
Danny Ryan 69e7f586ac
Merge pull request #2738 from ethereum/fix-names
is_merge -> is_merge_transition
2021-11-23 14:52:05 -07:00
Danny Ryan a0d008bb86
is_merge -> is_merge_transition 2021-11-23 14:45:03 -07:00
Danny Ryan 32e8ca26a0
Merge pull request #2737 from ethereum/test_prepare_execution_payload
Fix spec typo and add `test_prepare_execution_payload` unit tests
2021-11-23 14:25:48 -07:00
Hsiao-Wei Wang 8050de384e
Fix spec typo and add `test_prepare_execution_payload` unit tests 2021-11-24 02:23:24 +08:00
Danny Ryan 975931b5cf
pr feedback 2021-11-23 11:19:22 -07:00
Hsiao-Wei Wang 2ba0586c3d
Add `proposer_boost_root` field to test vector "checks" step 2021-11-24 00:09:48 +08:00
Aditya Asgaonkar 6f95637637 Merging local branch to remote latest 2021-11-23 07:32:56 -08:00
Aditya Asgaonkar ecbe9190b9 Apply HWW code's review - properly update test steps 2021-11-23 07:20:54 -08:00
Hsiao-Wei Wang bdd7b0782e
Add configuration value checks 2021-11-23 16:44:12 +08:00
Aditya Asgaonkar d85d4399cb Rename test 2021-11-22 14:45:20 -08:00
Aditya Asgaonkar 1d835c5198 Apply Danny's code review & suggestions 2021-11-22 14:44:52 -08:00
Danny Ryan ea09df50db
toc 2021-11-22 11:39:08 -07:00
Aditya Asgaonkar 2d161b4244
Add proposer score boosting & related tests 2021-11-22 11:12:24 -07:00
Danny Ryan bbdb0d8fba
Merge pull request #2727 from ethereum/fc-dev-validate_target_epoch_scope-patch
always atomically update justified and finalized
2021-11-22 09:42:20 -07:00
Danny Ryan 97e6d5c6d6
Merge branch 'fc-dev-validate_target_epoch_scope-patch' into dev 2021-11-22 08:32:32 -07:00
Hsiao-Wei Wang 29beba6ab5
Merge pull request #2706 from ethereum/transition-reuse 2021-11-20 08:21:22 +08:00
Danny Ryan 3c25da8218
Merge pull request #2726 from ethereum/get_pow_block_at_ttd-tests
Fix `get_pow_block_at_terminal_total_difficulty` and add unit tests
2021-11-19 09:37:11 -07:00
Danny Ryan e7df64b0a4
Merge pull request #2723 from ethereum/add-test_is_execution_enabled_false
Add a test to cover the case of `is_execution_enabled` result is false
2021-11-19 09:33:34 -07:00
Danny Ryan dc14b79a52
Merge pull request #2720 from paulhauner/patch-34
Remove `difficulty` from `PowBlock`
2021-11-18 15:49:27 -07:00
Mikhail Kalinin 58968f9286 Rename coinbase to fee_recipient 2021-11-18 19:23:52 +06:00
Hsiao-Wei Wang 2c865e3627
Resolve the commented out code in `test_new_finalized_slot_is_not_justified_checkpoint_ancestor` 2021-11-18 11:02:12 +08:00
Danny Ryan 3d4ece44df
port phase0 forkchocie changes to merge 2021-11-17 18:37:45 -07:00
Danny Ryan eb00f8f735
cleanup forkchoice tests 2021-11-17 18:24:47 -07:00
Hsiao-Wei Wang e56bbb8c44
Fix `get_pow_block_at_terminal_total_difficulty` and add unit tests 2021-11-17 18:00:35 +08:00
Hsiao-Wei Wang 79f1f16adf
Clean `PowBlock.difficulty` leftover 2021-11-16 22:08:00 +08:00
Hsiao-Wei Wang 2b9692a22c
Add a test to cover the case of `is_execution_enabled` result is false 2021-11-16 21:56:55 +08:00
Hsiao-Wei Wang 63c9e5ea56
Minor refactoring and add comments 2021-11-16 00:32:29 +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 f643554aa5
Fix issue around on_attestation validation by skipping epoch scope
validation if attestation is from a block message
2021-11-13 18:28:05 +08:00
Danny Ryan cd3d2ce692
working through test issues 2021-11-12 12:43:54 -07:00
Hsiao-Wei Wang 49d96f92ef
Add a sample altair-to-merge-only transition 2021-11-12 17:06:10 +08:00
Hsiao-Wei Wang e70da78377
Merge branch 'dev' into transition-reuse 2021-11-12 15:57:27 +08:00
Danny Ryan 342171f441
version.txt bump to v1.1.5 2021-11-08 07:50:54 -07:00
Mikhail Kalinin f463c32879 Apply feedback from the review of test_validate_merge_block 2021-11-06 10:21:56 +06:00
Mikhail Kalinin 56bb393eb5 Refine validate_merge_block unit tests 2021-11-05 19:56:53 +06:00
Danny Ryan 1361078a75
bump VERSION.txt to 1.1.4 2021-11-02 09:38:49 -06: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 fa4dc0c168
Apply suggestions from code review
Co-authored-by: Alex Stokes <r.alex.stokes@gmail.com>
2021-11-02 18:38:24 +08:00
Hsiao-Wei Wang 0b0fe15c75
Make altair transition tests support merge forks 2021-11-02 14:47:24 +08:00
Danny Ryan 7a5eec3c5f
Merge pull request #2704 from ethereum/disable-too-slow-fork-choice-tests
Disable some too-slow mainnet preset fork choice tests
2021-11-01 12:23:23 -06:00
Danny Ryan 7e3ccb706d
remove block_number validation from CL 2021-11-01 07:57:49 -06:00
Danny Ryan 52a97ab494
remove gas validations from CL 2021-11-01 07:39:13 -06:00
Danny Ryan 78040ac3ae
update penalty params for Merge 2021-10-29 12:41:38 -06:00
Hsiao-Wei Wang 314840117d
Add `test_invalid_previous_source_root` and fix `test_invalid_current_source_root` 2021-10-26 16:04:52 +08:00
Hsiao-Wei Wang 405f2e2c2f
Update tests/core/pyspec/eth2spec/test/conftest.py
Co-authored-by: Danny Ryan <dannyjryan@gmail.com>
2021-10-21 23:21:56 +08:00
Hsiao-Wei Wang cb513aa82d
--fork cli option: fix the case of unset directory path + validate fork name 2021-10-21 12:26:11 +08:00
Hsiao-Wei Wang 4f3637851c
Disable some too-slow mainnet preset fork choice tests 2021-10-19 00:54:29 +08:00
Hsiao-Wei Wang afb62eebf0
Add pytest CLI option `--fork` so that we can just run with specific phase (fork) 2021-10-18 17:59:55 +08:00
Danny Ryan c5b169bd62
fix issue with mutation in test generation 2021-10-15 16:15:37 -06:00
Alex Stokes aa91788dfb
Yield the `pre` state for this test type before making blocks 2021-10-15 19:46:46 +01:00
Danny Ryan a05a78246f
bump version.txt to 1.1.3 2021-10-15 09:47:24 -06:00
Alex Stokes bf01e11cae
Merge pull request #2664 from ethereum/new-transition-test-cases
Add new Altair transition tests
2021-10-15 09:38:24 -06:00
Hsiao-Wei Wang e70ef11b4d
Fix SSZ underflow 2021-10-15 22:49:43 +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 b0b3733243
Fix `randomize_state` default params 2021-10-15 22:18:13 +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 52235a9e40
minor: Use pre spec for running `prepare_state_and_deposit` 2021-10-15 00:44:11 +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
Danny Ryan e5bbbc5191
base_fee_per_gas to uint256 2021-10-11 16:25:01 -06:00
Danny Ryan 154212dc58
bump VERSION.txt to v1.1.2 2021-10-07 11:54:58 +03: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
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