Commit Graph

101 Commits

Author SHA1 Message Date
Etan Kissling ffd047c6fa
Consistent test step naming 2023-01-14 14:51:59 +01:00
Etan Kissling b7205813fd
Update sync test documentation 2023-01-12 19:01:57 +01:00
Etan Kissling 82d6267951
Merge branch 'dev' into lc-eph 2023-01-12 18:44:54 +01:00
Etan Kissling 375436094c
Merge branch 'dev' into lc-eph 2023-01-05 13:53:29 +01:00
Etan Kissling 5c64a2047a
Add `LightClientHeader` wrapper
In Altair, light client sync protocol exchanges `BeaconBlockHeader`
structures for tracking current progress. Wrapping `BeaconBlockHeader`
inside a `LightClientHeader` allows future extensions of this header,
e.g., to also track `ExecutionPayloadHeader`.

Note: This changes the JSON REST format by adding a `beacon` nesting.
For SSZ, the serialization format stays same (but overall root changes).
2023-01-05 13:36:04 +01:00
protolambda 5998836449
tests/formats: update epoch and operations formats to reflect push-withdrawals (#3184)
* tests/formats: update epoch and operations formats to reflect push-withdrawals of PR 3068

* fix typo

* Update epoch processing readme

Co-authored-by: Hsiao-Wei Wang <hsiaowei.eth@gmail.com>
2023-01-04 18:20:09 +08:00
Etan Kissling 2e97af2627
Add `ExecutionPayloadHeader` to LC data
While the light client sync protocol currently provides access to the
latest `BeaconBlockHeader`, obtaining the matching execution data needs
workarounds such as downloading the full block.

Having ready access to the EL state root simplifies use cases that need
a way to cross-check `eth_getProof` responses against LC data.

Access to `block_hash` unlocks scenarios where a CL light client drives
an EL without `engine_newPayload`. As of Altair, only the CL beacon
block root is available, but the EL block hash is needed for engine API.

Other fields in the `ExecutionPayloadHeader` such as `logs_bloom` may
allow light client applications to monitor blocks for local interest,
e.g. for transfers affecting a certain wallet. This enables to download
only the few relevant blocks instead of every single one.

A new `LightClientStore` is proposed into the Capella spec that may be
used to sync LC data that includes execution data. Existing pre-Capella
LC data will remain as is, but can be locally upgraded before feeding it
into the new `LightClientStore` so that light clients do not need to run
a potentially expensive fork transition at a specific time. This enables
the `LightClientStore` to be upgraded at a use case dependent timing at
any time before Capella hits. Smart contract and embedded deployments
benefit from reduced code size and do not need synchronization with the
beacon chain clock to perform the Capella fork.
2022-12-12 00:48:40 +01:00
Etan Kissling 0fb0b26742
Add accessors for LC header
Introduce `get_lc_beacon_slot` and `get_lc_beacon_root` accessors
similar to `get_current_slot(state)` to account for future extensions
to the light client header structure that may override how those fields
are accessed. Idea is to extend with execution accessors in the future.
2022-12-06 22:05:19 +01: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
terence tsao bbc3ec02ff Fix typos 2022-11-12 23:36:34 -08:00
Etan Kissling cfad029f45
Merge branch 'dev' into lc-prooftest 2022-11-07 14:41:27 +01:00
Etan Kissling 5c66300171
Use `suite_name` instead of `meta.yaml` for SSZ type 2022-10-28 20:32:33 +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
Hsiao-Wei Wang f48d6b324d
Update test formats 2022-10-20 22:27:49 -05:00
Hsiao-Wei Wang 73c96b238a
Merge pull request #3001 from ethereum/bls-output-null
Update BLS test format: output `null` for invalid case
2022-09-22 14:36:31 +08:00
Hsiao-Wei Wang 93b7ae299d
Update BLS test format: output `null` for invalid case 2022-09-21 01:24:22 +08:00
Hsiao-Wei Wang 0f8e12e929
Add a redirection README.md for the sync tests 2022-09-20 18:13:15 +08:00
Mikhail Kalinin b67fb5b049
Update tests/formats/fork_choice/README.md
Co-authored-by: Hsiao-Wei Wang <hsiaowei.eth@gmail.com>
2022-08-24 23:29:59 +06:00
Mikhail Kalinin 14d4f44c11 Extend fork_choice test format with on_payload_info 2022-08-03 18:19:39 +06:00
Danny Ryan 981b05afb0
Merge pull request #2950 from ethereum/mv-merkle-tests
Move `merkle/single_proof` tests to `light_client/single_merkle_proof`
2022-07-26 12:46:51 -04:00
Alex Stokes 7e54cd09b0
Update README.md 2022-07-22 13:15:46 -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
Etan Kissling 30d635259b
Move test files to `light_client` subdir 2022-07-15 21:36:26 +02: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 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
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 0d305f0ae3
Update README.md
Some edits to remove stale information
2022-06-01 22:00:11 -06:00
Hsiao-Wei Wang 89e7a1073d Add notes about invalid case to `epoch_processing` test format 2022-05-10 19:02:10 +02:00
Hsiao-Wei Wang 3cdc0e61ed Add `on_attester_slashing` execution step 2022-03-09 10:18:00 +08:00
Hsiao-Wei Wang 8facc0a095
Merge -> Bellatrix 2021-12-23 14:25:43 +08:00
Hsiao-Wei Wang 2ba0586c3d
Add `proposer_boost_root` field to test vector "checks" step 2021-11-24 00:09:48 +08:00
Alex Stokes 43a659a51b
Update tests/formats/ssz_generic/README.md 2021-10-27 05:55:53 -06:00
Alex Stokes ec516a7625
Update `ssz_generic` test format README
The existing README has a reference to an alias type `Bytes[N]` that has been removed from the repo so it is not clear what it exactly refers to.

This PR updates the type to the equivalent `List[T, N]` using more recent SSZ typing syntax.
2021-10-18 02:34:52 -07:00
Hsiao-Wei Wang 9879e0475d
Add random test format doc 2021-10-14 00:27:08 +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
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 f8b3a67152 Fixed test_on_merge_block tests 2021-09-24 21:06:02 +03:00
Dmitrii Shmatko 1ecfc4016c Polishing merge tests 2021-09-23 23:10:29 +03:00
Hsiao-Wei Wang da8d22c754
Update `checks` Checkpoint fields 2021-08-31 13:16:19 +08:00
Danny Ryan 4c1156d504
rename eth1 and eth2 throughout specs and readme where reasonable 2021-08-18 17:13:24 -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 ad4445fa9e
Apply PR feedback from Danny and clean up the BLS test format docs 2021-08-06 16:39:35 +08:00
Hsiao-Wei Wang 3b86bd340f
Rename eth2_* to eth_* 2021-08-05 11:20:49 +08:00