Skip to content

Commit 4adf8af

Browse files
committed
update to latest light client sync protocol
This implements the latest version of the light client sync protocol, and also adds a test runner for the new accompanying tests. See ethereum/consensus-specs#2802
1 parent e070447 commit 4adf8af

8 files changed

+585
-149
lines changed

AllTests-mainnet.md

+43-35
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,5 @@
11
AllTests-mainnet
22
===
3-
##
4-
```diff
5-
+ Slashing test: duplicate_pubkey_not_slashable.json OK
6-
+ Slashing test: multiple_interchanges_single_validator_single_message_gap.json OK
7-
+ Slashing test: multiple_interchanges_single_validator_single_message_out_of_order.json OK
8-
+ Slashing test: multiple_validators_multiple_blocks_and_attestations.json OK
9-
+ Slashing test: multiple_validators_same_slot_blocks.json OK
10-
+ Slashing test: single_validator_genesis_attestation.json OK
11-
+ Slashing test: single_validator_import_only.json OK
12-
+ Slashing test: single_validator_multiple_block_attempts.json OK
13-
+ Slashing test: single_validator_multiple_blocks_and_attestations.json OK
14-
+ Slashing test: single_validator_out_of_order_attestations.json OK
15-
+ Slashing test: single_validator_out_of_order_blocks.json OK
16-
+ Slashing test: single_validator_resign_attestation.json OK
17-
+ Slashing test: single_validator_resign_block.json OK
18-
+ Slashing test: single_validator_single_attestation.json OK
19-
+ Slashing test: single_validator_single_block.json OK
20-
+ Slashing test: single_validator_single_block_and_attestation.json OK
21-
+ Slashing test: single_validator_single_block_and_attestation_signing_root.json OK
22-
+ Slashing test: single_validator_slashable_attestations_double_vote.json OK
23-
+ Slashing test: single_validator_slashable_attestations_surrounded_by_existing.json OK
24-
+ Slashing test: single_validator_slashable_attestations_surrounds_existing.json OK
25-
+ Slashing test: single_validator_slashable_blocks.json OK
26-
+ Slashing test: single_validator_slashable_blocks_no_root.json OK
27-
+ Slashing test: single_validator_source_greater_than_target.json OK
28-
+ Slashing test: single_validator_two_blocks_no_signing_root.json OK
29-
+ Slashing test: wrong_genesis_validators_root.json OK
30-
```
31-
OK: 25/25 Fail: 0/25 Skip: 0/25
323
## Attestation pool processing [Preset: mainnet]
334
```diff
345
+ Attestations may arrive in any order [Preset: mainnet] OK
@@ -293,17 +264,54 @@ OK: 1/1 Fail: 0/1 Skip: 0/1
293264
+ deletePeer() test OK
294265
```
295266
OK: 12/12 Fail: 0/12 Skip: 0/12
267+
## Slashing Interchange tests [Preset: mainnet]
268+
```diff
269+
+ Slashing test: duplicate_pubkey_not_slashable.json OK
270+
+ Slashing test: duplicate_pubkey_slashable_attestation.json OK
271+
+ Slashing test: duplicate_pubkey_slashable_block.json OK
272+
+ Slashing test: multiple_interchanges_multiple_validators_repeat_idem.json OK
273+
+ Slashing test: multiple_interchanges_overlapping_validators_merge_stale.json OK
274+
+ Slashing test: multiple_interchanges_overlapping_validators_repeat_idem.json OK
275+
+ Slashing test: multiple_interchanges_single_validator_fail_iff_imported.json OK
276+
+ Slashing test: multiple_interchanges_single_validator_first_surrounds_second.json OK
277+
Slashing test: multiple_interchanges_single_validator_multiple_blocks_out_of_order.json Skip
278+
+ Slashing test: multiple_interchanges_single_validator_second_surrounds_first.json OK
279+
+ Slashing test: multiple_interchanges_single_validator_single_att_out_of_order.json OK
280+
+ Slashing test: multiple_interchanges_single_validator_single_block_out_of_order.json OK
281+
+ Slashing test: multiple_interchanges_single_validator_single_message_gap.json OK
282+
+ Slashing test: multiple_validators_multiple_blocks_and_attestations.json OK
283+
+ Slashing test: multiple_validators_same_slot_blocks.json OK
284+
+ Slashing test: single_validator_genesis_attestation.json OK
285+
+ Slashing test: single_validator_import_only.json OK
286+
+ Slashing test: single_validator_multiple_block_attempts.json OK
287+
+ Slashing test: single_validator_multiple_blocks_and_attestations.json OK
288+
+ Slashing test: single_validator_out_of_order_attestations.json OK
289+
+ Slashing test: single_validator_out_of_order_blocks.json OK
290+
+ Slashing test: single_validator_resign_attestation.json OK
291+
+ Slashing test: single_validator_resign_block.json OK
292+
+ Slashing test: single_validator_single_attestation.json OK
293+
+ Slashing test: single_validator_single_block.json OK
294+
+ Slashing test: single_validator_single_block_and_attestation.json OK
295+
+ Slashing test: single_validator_single_block_and_attestation_signing_root.json OK
296+
+ Slashing test: single_validator_slashable_attestations_double_vote.json OK
297+
+ Slashing test: single_validator_slashable_attestations_surrounded_by_existing.json OK
298+
+ Slashing test: single_validator_slashable_attestations_surrounds_existing.json OK
299+
+ Slashing test: single_validator_slashable_blocks.json OK
300+
+ Slashing test: single_validator_slashable_blocks_no_root.json OK
301+
+ Slashing test: single_validator_source_greater_than_target.json OK
302+
+ Slashing test: single_validator_source_greater_than_target_sensible_iff_minified.json OK
303+
+ Slashing test: single_validator_source_greater_than_target_surrounded.json OK
304+
Slashing test: single_validator_source_greater_than_target_surrounding.json Skip
305+
+ Slashing test: single_validator_two_blocks_no_signing_root.json OK
306+
+ Slashing test: wrong_genesis_validators_root.json OK
307+
```
308+
OK: 36/38 Fail: 0/38 Skip: 2/38
296309
## Slashing Protection DB - Interchange [Preset: mainnet]
297310
```diff
298311
+ Smoke test - Complete format - Invalid database is refused [Preset: mainnet] OK
299312
+ Smoke test - Complete format [Preset: mainnet] OK
300313
```
301314
OK: 2/2 Fail: 0/2 Skip: 0/2
302-
## Slashing Protection DB - v1 and v2 migration [Preset: mainnet]
303-
```diff
304-
+ Minimal format migration [Preset: mainnet] OK
305-
```
306-
OK: 1/1 Fail: 0/1 Skip: 0/1
307315
## Slashing Protection DB [Preset: mainnet]
308316
```diff
309317
+ Attestation ordering #1698 OK
@@ -442,4 +450,4 @@ OK: 1/1 Fail: 0/1 Skip: 0/1
442450
OK: 1/1 Fail: 0/1 Skip: 0/1
443451

444452
---TOTAL---
445-
OK: 238/240 Fail: 0/240 Skip: 2/240
453+
OK: 248/252 Fail: 0/252 Skip: 4/252

ConsensusSpecPreset-mainnet.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -787,9 +787,10 @@ OK: 35/35 Fail: 0/35 Skip: 0/35
787787
```diff
788788
+ process_light_client_update_finality_updated OK
789789
+ process_light_client_update_timeout OK
790+
+ test_process_light_client_update_at_period_boundary OK
790791
+ test_process_light_client_update_not_timeout OK
791792
```
792-
OK: 3/3 Fail: 0/3 Skip: 0/3
793+
OK: 4/4 Fail: 0/4 Skip: 0/4
793794
## EF - Bellatrix - Epoch Processing - Effective balance updates [Preset: mainnet]
794795
```diff
795796
+ Effective balance updates - effective_balance_hysteresis [Preset: mainnet] OK
@@ -1191,4 +1192,4 @@ OK: 44/44 Fail: 0/44 Skip: 0/44
11911192
OK: 27/27 Fail: 0/27 Skip: 0/27
11921193

11931194
---TOTAL---
1194-
OK: 1015/1017 Fail: 0/1017 Skip: 2/1017
1195+
OK: 1016/1018 Fail: 0/1018 Skip: 2/1018

ConsensusSpecPreset-minimal.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -387,9 +387,10 @@ ConsensusSpecPreset-minimal
387387
+ fork_random_large_validator_set OK
388388
+ fork_random_low_balances OK
389389
+ fork_random_misc_balances OK
390+
+ light_client_sync OK
390391
+ next_sync_committee_merkle_proof OK
391392
```
392-
OK: 386/386 Fail: 0/386 Skip: 0/386
393+
OK: 387/387 Fail: 0/387 Skip: 0/387
393394
## Attestation
394395
```diff
395396
+ [Invalid] EF - Altair - Operations - Attestation - after_epoch_slots OK
@@ -828,9 +829,10 @@ OK: 35/35 Fail: 0/35 Skip: 0/35
828829
```diff
829830
+ process_light_client_update_finality_updated OK
830831
+ process_light_client_update_timeout OK
832+
+ test_process_light_client_update_at_period_boundary OK
831833
+ test_process_light_client_update_not_timeout OK
832834
```
833-
OK: 3/3 Fail: 0/3 Skip: 0/3
835+
OK: 4/4 Fail: 0/4 Skip: 0/4
834836
## EF - Bellatrix - Epoch Processing - Effective balance updates [Preset: minimal]
835837
```diff
836838
+ Effective balance updates - effective_balance_hysteresis [Preset: minimal] OK
@@ -1268,4 +1270,4 @@ OK: 48/48 Fail: 0/48 Skip: 0/48
12681270
OK: 30/30 Fail: 0/30 Skip: 0/30
12691271

12701272
---TOTAL---
1271-
OK: 1066/1086 Fail: 0/1086 Skip: 20/1086
1273+
OK: 1068/1088 Fail: 0/1088 Skip: 20/1088

beacon_chain/spec/datatypes/altair.nim

+28-2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const
5353

5454
# https://github.com/ethereum/consensus-specs/blob/v1.1.8/setup.py#L478-L479
5555
FINALIZED_ROOT_INDEX* = 105.GeneralizedIndex
56+
CURRENT_SYNC_COMMITTEE_INDEX* = 54.GeneralizedIndex
5657
NEXT_SYNC_COMMITTEE_INDEX* = 55.GeneralizedIndex
5758

5859
# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/altair/beacon-chain.md#participation-flag-indices
@@ -152,12 +153,23 @@ type
152153

153154
### Modified/overloaded
154155

156+
# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/altair/sync-protocol.md#lightclientbootstrap
157+
LightClientBootstrap* = object
158+
header*: BeaconBlockHeader ##\
159+
## The requested beacon block header
160+
161+
# Current sync committee corresponding to the requested header
162+
current_sync_committee*: SyncCommittee
163+
current_sync_committee_branch*:
164+
array[log2trunc(CURRENT_SYNC_COMMITTEE_INDEX), Eth2Digest]
165+
155166
# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/altair/sync-protocol.md#lightclientupdate
156167
LightClientUpdate* = object
157168
attested_header*: BeaconBlockHeader ##\
158169
## The beacon block header that is attested to by the sync committee
159170

160-
# Next sync committee corresponding to the active header
171+
# Next sync committee corresponding to the active header,
172+
# if signature is from current sync committee
161173
next_sync_committee*: SyncCommittee
162174
next_sync_committee_branch*:
163175
array[log2trunc(NEXT_SYNC_COMMITTEE_INDEX), Eth2Digest]
@@ -167,11 +179,25 @@ type
167179
finality_branch*: array[log2trunc(FINALIZED_ROOT_INDEX), Eth2Digest]
168180

169181
# Sync committee aggregate signature
170-
sync_committee_aggregate*: SyncAggregate
182+
sync_aggregate*: SyncAggregate
183+
184+
fork_version*: Version ##\
185+
## Fork version for the aggregate signature
186+
187+
# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/altair/sync-protocol.md#optimisticlightclientupdate
188+
OptimisticLightClientUpdate* = object
189+
attested_header*: BeaconBlockHeader ##\
190+
## The beacon block header that is attested to by the sync committee
191+
192+
sync_aggregate*: SyncAggregate ##\
193+
## Sync committee aggregate signature
171194

172195
fork_version*: Version ##\
173196
## Fork version for the aggregate signature
174197

198+
is_signed_by_next_sync_committee*: bool ##\
199+
## Whether the signature was produced by `attested_header`'s next sync committee
200+
175201
# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/altair/sync-protocol.md#lightclientstore
176202
LightClientStore* = object
177203
finalized_header*: BeaconBlockHeader ##\

0 commit comments

Comments
 (0)