Commit Graph

1231 Commits

Author SHA1 Message Date
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 de15971ae8
Cleanups 2022-07-15 13:45:34 +02: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
Hsiao-Wei Wang bfa048a449
Merge pull request #2929 from etan-status/lc-testterms
Cleanup light client tests
2022-07-02 02:32:18 +08:00
Hsiao-Wei Wang d2a1f57e09
Merge pull request #2928 from ralexstokes/test-gen-patch-up
remove data logging from BLS test gen
2022-06-30 17:10:08 +08: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
Alex Stokes 2dd9a52fe4
remove data logging from BLS test gen 2022-06-29 10:24:53 -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
Alex Stokes 0d305f0ae3
Update README.md
Some edits to remove stale information
2022-06-01 22:00:11 -06: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
Hsiao-Wei Wang 89e7a1073d Add notes about invalid case to `epoch_processing` test format 2022-05-10 19:02:10 +02: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 3cdc0e61ed Add `on_attester_slashing` execution step 2022-03-09 10:18:00 +08: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
Alex Stokes 50a63c4135
Merge pull request #2790 from asanso/patch-5
Add 3 new invalid test cases
2022-01-13 12:56:38 -06: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
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
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
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
Danny Ryan af4725d08a
add some non-empty extra_data tests 2022-01-03 07:51:35 -07:00