271 Commits

Author SHA1 Message Date
Mikhail Kalinin
eb0cdc72e8 Update tests 2024-05-31 22:02:22 +06:00
Hsiao-Wei Wang
c9c43e8f66
Apply suggestions from code review
Co-authored-by: Lion - dapplion <35266934+dapplion@users.noreply.github.com>
2024-01-18 13:27:34 +08:00
Hsiao-Wei Wang
4fe36dec58
Add transition test case of non-empty pre-state historical_roots 2024-01-18 00:10:45 +08:00
Etan Kissling
07710e6b4e
Merge branch 'dev' into lc-transitionacrossforks 2024-01-15 13:34:04 +01:00
Hsiao-Wei Wang
868a600a57
Merge pull request #3537 from etan-status/lc-gindexname
Rename `_INDEX` generalized index constants to `_GINDEX`
2024-01-15 18:57:48 +08:00
Hsiao-Wei Wang
e42974ef03
Merge pull request #3571 from etan-status/lc-periodhelpers
Extract sync committee period <-> slot helpers to common LC test module
2024-01-11 00:16:20 +08:00
Etan Kissling
240a127f9f
Consider fork transitions when using get_sync_aggregate helper func
When calling `get_sync_aggregate` with a `signature_slot - 1` in a
future fork, i.e., the first slot of the new fork is missed, it uses
a wrong fork version for the signature. Fix that by correctly applying
fork transitions to the `signature_state`, if a fork schedule is given.
2024-01-09 16:10:28 +01:00
Etan Kissling
6c6ed3eab9
Extract sync committee period <-> slot helpers to common LC test module
The two functions `compute_start_slot_at_sync_committee_period` and
`compute_start_slot_at_next_sync_committee_period` are currently only
available during LC `test_sync`. Move them to the common LC test module
so that they can be used from future tests as well.
2024-01-09 15:49:45 +01:00
Etan Kissling
69d043b437
Extract LC migration test helpers to light_client.py module
The helpers needed to migrate LC data across forks are generic enough to
allow extraction from a specific test into the common `light_client.py`
helper module. This way, it is possible to use them from future tests.

Also complete the missing functions for `LightClientFinalityUpdate`,
`LightClientOptimisticUpdate` and `LightClientHeader` in same style.
2024-01-09 15:33:43 +01:00
Etan Kissling
d9e53cbaf5
Merge branch 'dev' into lc-gindexname 2023-11-06 12:32:53 +01:00
Etan Kissling
89c986ee6a
Rename _INDEX generalized index constants to _GINDEX
To assist with readability, use `_GINDEX` suffix when referring to
generalized index constants.

Does neither affect consensus, beacon-API nor builder API.
2023-11-01 13:30:55 +01:00
Hsiao-Wei Wang
0e4737eba2
Add a general compute_merkle_proof helper to replace container-specific helpers 2023-10-30 14:44:32 +08:00
shuoer86
bae3384071 Fix typos 2023-10-16 21:16:26 +08:00
Hsiao-Wei Wang
30da14e9b4
Create LIGHT_CLIENT_TESTING_FORKS to limit the light client tests 2023-05-25 13:49:41 +08:00
Hsiao-Wei Wang
5e2a18a319
Fix test_randomized_state and test_randomized_state_leaking 2023-05-06 21:38:03 +08:00
Hsiao-Wei Wang
cd7783e59d
EIP-6110: Fix compute_fork_version and add light client specs 2023-03-28 15:08:03 +08:00
Etan Kissling
43e714e60f
Check correct fork version in LC sync protocol
- Sync committee is determined by signature_slot
- Signature fork version is determined by max(signature_slot, 1) - 1
- Attested block fork version can be anything < signature_slot

Old logic incorrectly derived signature fork version from signature_slot
and did not subtract a slot. Extended tests to check this edge case.
2023-03-08 15:34:56 +01:00
Paul Harris
317facbd64 Replaced EIP4844 references with Deneb
Fixes #3207
2023-01-23 15:08:34 +01:00
Etan Kissling
ffd047c6fa
Consistent test step naming 2023-01-14 14:51:59 +01:00
Etan Kissling
82d6267951
Merge branch 'dev' into lc-eph 2023-01-12 18:44:54 +01:00
Etan Kissling
a14edb1967
Merge branch 'dev' into lc-headerwrapper 2023-01-10 15:29:34 +01:00
Hsiao-Wei Wang
9c4500533f
Merge branch 'dev' into pr3121 2023-01-10 16:47:21 +08: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
Hsiao-Wei Wang
0777a52f55
Merge pull request #3149 from etan-status/lc-toheader
Add `block_to_light_client_header` helper
2023-01-05 12:12:36 +08:00
Etan Kissling
ce7fd412cc
Add test for LC data spanning 3 forks 2023-01-04 19:44:10 +01:00
Etan Kissling
e5cda1745f
Run fork test for EIP4844 2023-01-04 19:15:34 +01:00
Etan Kissling
b0471511e5
Merge branch 'dev' into lc-eph 2023-01-03 15:36:37 +01:00
Danny Ryan
991f81770b
Merge pull request #3157 from ethereum/balance-op
Add tests to test sync aggregate's order of balance operation
2022-12-14 08:15:09 -07:00
Hsiao-Wei Wang
c7e102a5e5
PR feedback from @djrtwo and change the duplicate sync committee preconditions 2022-12-14 16:55:03 +08:00
Etan Kissling
02abdc311f
Merge branch 'dev' into lc-eph 2022-12-13 15:33:28 +01:00
Etan Kissling
74883fec7c
Merge branch 'dev' into ci-phasesconfig 2022-12-13 15:33:07 +01:00
Etan Kissling
3bfac0e16e
Merge branch 'lc-toheader' into lc-eph 2022-12-13 12:31:12 +01:00
Etan Kissling
ef2a8b319d
Avoid line continuation syntax 2022-12-13 12:30:14 +01:00
Hsiao-Wei Wang
19c38dbac6
Add tests to test sync aggregate's order of operation 2022-12-13 17:35:34 +08:00
Hsiao-Wei Wang
c59b06cccd
Merge branch 'dev' into sf-epochoverrides 2022-12-13 16:13:21 +08:00
Hsiao-Wei Wang
da3f5af919
Test case naming clean up (#3143)
* Add @description decorator

* Unify test case naming style

* more clean ups

* Altair tests cleanup

* Clean up Altair and Bellatrix `process_deposit` tests

* Clean up Bellatrix tests

* Clean up Capella tests

* PR feedback from @ralexstokes

* Add comments on the deposit fork version tests

* Remove `test_incorrect_sig_other_version` since it is duplicate to `test_ineffective_deposit_with_bad_fork_version`

* Add `test_ineffective_deposit_with_current_fork_version`
2022-12-13 15:13:44 +08:00
Etan Kissling
a8dabc05a8
Add test_eip4844_store_with_legacy_data (fork test still nyi) 2022-12-12 19:08:45 +01:00
Etan Kissling
dc05a3f19e
Rename test back 2022-12-12 13:13:25 +01:00
Etan Kissling
4df86632b6
Rename legacy --> altair in test name 2022-12-12 12:56:34 +01: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
9ab22b3ef3
Merge branch 'lc-accessors' into lc-eph 2022-12-12 00:41:31 +01:00
Etan Kissling
c1a6b127f1
Merge branch 'lc-toheader' into lc-eph 2022-12-12 00:38:34 +01:00
Etan Kissling
08a2080937
Merge branch 'ci-phasesconfig' into lc-eph 2022-12-12 00:36:13 +01:00
Etan Kissling
364d106ac3
Merge branch 'sf-epochoverrides' into lc-eph 2022-12-12 00:35:30 +01:00
Etan Kissling
0649e0662c
Allow selecting phase to emit, and fix combi with overrides 2022-12-07 22:37:40 +01:00
Etan Kissling
ae64c515f4
Merge branch 'dev' into ci-phasesconfig 2022-12-07 20:56:59 +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
Etan Kissling
8bf801ecc6
Add block_to_light_client_header helper
Introduce `block_to_light_client_header` helper function to enable
future forks to override it with additional info (e.g., execution),
without having to change the general light client logic.

Likewise, update existing light client data creation flow to use
`block_to_light_client_header` and default-initialize empty fields.

Furthermore, generalize `create_update` helper to streamline test code
using `block_to_light_client_header`.

Note: In Altair spec, LC header is the same as `BeaconBlockHeader`.
however; future forks will extend it with more information.
2022-12-06 17:44:41 +01:00
Etan Kissling
db796f70ad
Add missing .config 2022-11-20 14:25:50 +01:00
Etan Kissling
f42da8d00b
Apply with_config_overrides to all phases
When defining a fork transition test, additional spec forks are made
available through `@with_phases(..., other_phases=...)`.
The `with_config_overrides` decorator only applies to the primary phase
so far, which can be unexpected. `with_config_overrides` is adjusted to
override config in subsequent `other_phases` as well.
2022-11-19 12:58:20 +01:00