260 Commits

Author SHA1 Message Date
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
Aditya Asgaonkar
1e10e7dc1c Fix UPDATE_TIMEOUT unit typo 2022-03-03 20:16:32 -08:00
Hsiao-Wei Wang
6d11d627f8 Refactoring: add is_finality_update helper 2022-02-09 18:13:51 -07:00
Danny Ryan
5a09b5f8a8
Merge pull request #2814 from etan-status/lc-opt-fin
Ensure light client `optimistic_header` to be at head
2022-02-09 10:06:57 -07: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
Etan Kissling
0e9460b8dd
Ensure light client optimistic_header to be at head
When a light client updates its `finalized_header` using a forced update
because of the timeout, and the new header was not signed by enough sync
committee participants to pass `get_safety_threshold(store)`, it may
occur that `store.finalized_header.slot > store.optimistic_header.slot`.
This patch ensures that the `optimistic_header` is updated to the latest
`finalized_header` if that happens, so that it always indicates the
latest known and accepted head.
2022-01-25 10:09:10 +01:00
Dustin Brody
182e4496c3
use INTERVALS_PER_SLOT in sync committee specs 2022-01-21 19:01:56 +00: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
2b45496fe4
clean up unused argument from phase0 2022-01-13 11:39:36 -08: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
7b435bd470
Merge pull request #2797 from etan-status/lc-update-doc
Fix light client docs to match function signature
2022-01-11 06:57:19 -07:00
Etan Kissling
79c456b9f4
Fix light client docs to match function signature
In the light client docs a mentioning of a function trigger is lacking
the `genesis_validators_root` argument. This patch adds that argument
to the documentation to match the real function signature. It also
slightly improves the grammar.
2022-01-11 12:10:30 +01:00
Etan Kissling
212eb00fc1
Document light client constants
This adds documentation about the unit and actual value of light client
specific constants, consistently with the rest of the spec.
2022-01-11 12:10:09 +01: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
Hsiao-Wei Wang
de892382db
Minor style fixes 2021-12-15 23:44:29 +08:00
Hsiao-Wei Wang
25d88fee24
Fix process_light_client_update 2021-12-14 22:05:09 +08:00
Hsiao-Wei Wang
2f618f7b48
Fix lint and presets 2021-12-14 21:38:58 +08:00
vbuterin
916193bd69
Updates in response to comments 2021-12-10 07:48:14 -06:00
Hsiao-Wei Wang
402c663b51
Fix function name leftover 2021-11-30 21:57:43 +08:00
vbuterin
c30662b696
Consistently use sum instead of count(1) 2021-11-30 06:39:25 -06:00
Hsiao-Wei Wang
7de1495a42
Fix lint (#2750) 2021-11-30 06:38:42 -06:00
vbuterin
6fa19705fb
Clarified next sync committee comment 2021-11-29 07:05:01 -06:00
vbuterin
06af6296c5
Updated in response to comments 2021-11-29 07:04:05 -06:00
vbuterin
c4f70970c4
Update specs/altair/sync-protocol.md
Co-authored-by: terence tsao <terence@prysmaticlabs.com>
2021-11-28 08:31:48 -06:00
vbuterin
77188726de
Fixed ToC and get_active_header positioninf 2021-11-27 07:27:16 -06:00
vbuterin
e104164960
Rework data structures (#2747)
1. Replace `header` and `finality_header` with `attested_header` (always the header signed by the committee) and `finailzed_header` (always the header verified by the Merkle branch)
2. Remove `LightClientSnapshot`, fold its fields into `LightClientStore` for simplicity
2021-11-27 07:25:27 -06:00
vbuterin
013e814d2d
Update sync-protocol.md 2021-11-26 15:32:37 -06:00
vbuterin
25f2efab19
Simplify sync protocol and update to calculate optimistic heads
1. Simplify `valid_updates` to `best_valid_update` so the `LightClientStore` only needs to store O(1) data
2. Track an optimistic head, by looking for the highest-slot header which passes a safety threshold
2021-11-26 15:11:19 -06:00
Ben Edgington
44fec310b3
Eth1 block hashes have type Hash32 (#2693)
* Eth1 block hashes have type Hash32

* Modify other forks as well

Co-authored-by: Hsiao-Wei Wang <hsiaowei.eth@gmail.com>
2021-11-23 08:20:26 -07:00
Hsiao-Wei Wang
1f7040b42b
Make previous_version=current_version 2021-09-30 16:41:05 +08:00
Danny Ryan
af5eef37b2
fix am/pm issue 2021-09-24 12:29:34 -06:00
Danny Ryan
9f037180ba
add ALTAIR_FORK_EPOCH for mainnet configuration 2021-09-24 12:14:39 -06:00
Danny Ryan
a3953a10fe
minor format 2021-08-19 10:11:02 -06:00
Hsiao-Wei Wang
59d8ee34f9
Update some "1.0" "2.0" wording 2021-08-19 23:24:04 +08:00
Danny Ryan
911a4169fe
spelling
Co-authored-by: Diederik Loerakker <proto@protolambda.com>
2021-08-19 07:59:05 -06: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
93af122b2d
PR feedback from @ralexstokes and add single pubkey aggregate tests 2021-08-05 12:09:30 +08:00
Hsiao-Wei Wang
56c92136f2
Merge branch 'dev' into altair-bls-tests 2021-08-05 11:18:41 +08:00
Hsiao-Wei Wang
43a1617ffa
Ensure that the given PKs are valid PKs + fix typos 2021-08-04 21:25:37 +08:00
Hsiao-Wei Wang
b262854bb1
Rename the eth2_* functions to eth_ 2021-08-03 21:51:02 +08:00
Danny Ryan
f7a2a973ac
Update specs/altair/p2p-interface.md
Co-authored-by: Alex Stokes <r.alex.stokes@gmail.com>
2021-07-21 15:51:59 -06:00
Danny Ryan
02a9fc460e
require aggregation bits to have at least one participant in sync contributions 2021-07-21 11:10:09 -06:00
Danny Ryan
6d0deddbe5
modify target sync committee aggregators to more sound 16 2021-07-12 09:03:43 -06:00
Danny Ryan
8140a789c4
Merge pull request #2509 from terencechain/patch-124
Rename a few instances of `signature` to `message`
2021-07-08 10:09:12 -06:00
Danny Ryan
88bb7562aa
Update specs/altair/beacon-chain.md 2021-07-07 16:11:58 -06:00
terence tsao
6f31077afa
Update get_next_sync_committee notes 2021-07-07 10:42:52 -07:00
terence tsao
3a59c1b789
Rename a few instances of signature to message 2021-07-07 10:04:26 -07:00
Danny Ryan
c61eeb8a27
optimize sync committee message gossip and caches 2021-06-22 12:31:02 -06:00
Danny Ryan
fc1012b632
typo 2021-06-21 12:49:41 -06:00
Danny Ryan
a61aa7968d
clean up 2021-06-21 12:48:44 -06:00