Skip to content

Commit

Permalink
update to latest LC test format (#3879)
Browse files Browse the repository at this point in the history
The EF test format for the LC sync protocol is modified to verify checks
after each step: ethereum/consensus-specs#2938 -
The test runner is updated accordingly.
  • Loading branch information
etan-status committed Jul 23, 2022
1 parent c3f9844 commit 3bc4299
Show file tree
Hide file tree
Showing 15 changed files with 350 additions and 363 deletions.
18 changes: 3 additions & 15 deletions ConsensusSpecPreset-mainnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -422,16 +422,14 @@ ConsensusSpecPreset-mainnet
+ bellatrix_fork_random_3 OK
+ bellatrix_fork_random_low_balances OK
+ bellatrix_fork_random_misc_balances OK
+ finality_root_merkle_proof OK
+ fork_base_state OK
+ fork_many_next_epoch OK
+ fork_next_epoch OK
+ fork_next_epoch_with_block OK
+ fork_random_low_balances OK
+ fork_random_misc_balances OK
+ next_sync_committee_merkle_proof OK
```
OK: 421/428 Fail: 0/428 Skip: 7/428
OK: 419/426 Fail: 0/426 Skip: 7/426
## Attestation
```diff
+ [Invalid] EF - Altair - Operations - Attestation - after_epoch_slots OK
Expand Down Expand Up @@ -852,17 +850,7 @@ OK: 1/1 Fail: 0/1 Skip: 0/1
+ Testing VoluntaryExit OK
```
OK: 35/35 Fail: 0/35 Skip: 0/35
## EF - Altair - Sync protocol - Light client [Preset: mainnet]
```diff
All tests Skip
```
OK: 0/1 Fail: 0/1 Skip: 1/1
## EF - Altair - Sync protocol - Update ranking [Preset: mainnet]
```diff
All tests Skip
```
OK: 0/1 Fail: 0/1 Skip: 1/1
## EF - Altair - Unittests - Sync protocol [Preset: mainnet]
## EF - Altair - Unittests - Light client - Sync protocol [Preset: mainnet]
```diff
+ process_light_client_update_finality_updated OK
+ process_light_client_update_timeout OK
Expand Down Expand Up @@ -1261,4 +1249,4 @@ OK: 44/44 Fail: 0/44 Skip: 0/44
OK: 27/27 Fail: 0/27 Skip: 0/27

---TOTAL---
OK: 1074/1083 Fail: 0/1083 Skip: 9/1083
OK: 1072/1079 Fail: 0/1079 Skip: 7/1079
18 changes: 3 additions & 15 deletions ConsensusSpecPreset-minimal.md
Original file line number Diff line number Diff line change
Expand Up @@ -471,17 +471,15 @@ ConsensusSpecPreset-minimal
+ bellatrix_fork_random_large_validator_set OK
+ bellatrix_fork_random_low_balances OK
+ bellatrix_fork_random_misc_balances OK
+ finality_root_merkle_proof OK
+ fork_base_state OK
+ fork_many_next_epoch OK
+ fork_next_epoch OK
+ fork_next_epoch_with_block OK
+ fork_random_large_validator_set OK
+ fork_random_low_balances OK
+ fork_random_misc_balances OK
+ next_sync_committee_merkle_proof OK
```
OK: 471/478 Fail: 0/478 Skip: 7/478
OK: 469/476 Fail: 0/476 Skip: 7/476
## Attestation
```diff
+ [Invalid] EF - Altair - Operations - Attestation - after_epoch_slots OK
Expand Down Expand Up @@ -917,17 +915,7 @@ OK: 5/5 Fail: 0/5 Skip: 0/5
+ Testing VoluntaryExit OK
```
OK: 35/35 Fail: 0/35 Skip: 0/35
## EF - Altair - Sync protocol - Light client [Preset: minimal]
```diff
All tests Skip
```
OK: 0/1 Fail: 0/1 Skip: 1/1
## EF - Altair - Sync protocol - Update ranking [Preset: minimal]
```diff
All tests Skip
```
OK: 0/1 Fail: 0/1 Skip: 1/1
## EF - Altair - Unittests - Sync protocol [Preset: minimal]
## EF - Altair - Unittests - Light client - Sync protocol [Preset: minimal]
```diff
+ process_light_client_update_finality_updated OK
+ process_light_client_update_timeout OK
Expand Down Expand Up @@ -1352,4 +1340,4 @@ OK: 48/48 Fail: 0/48 Skip: 0/48
OK: 30/30 Fail: 0/30 Skip: 0/30

---TOTAL---
OK: 1157/1166 Fail: 0/1166 Skip: 9/1166
OK: 1155/1162 Fail: 0/1162 Skip: 7/1162
2 changes: 1 addition & 1 deletion beacon_chain/gossip_processing/light_client_processor.nim
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ proc tryForceUpdate(

if store[].isSome:
doAssert self.finalizationMode == LightClientFinalizationMode.Optimistic
case store[].get.try_light_client_store_force_update(wallSlot)
case store[].get.process_light_client_store_force_update(wallSlot)
of NoUpdate:
discard
of DidUpdateWithoutSupermajority:
Expand Down
4 changes: 2 additions & 2 deletions beacon_chain/spec/light_client_sync.nim
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,14 @@ func apply_light_client_update(
didProgress = true
didProgress

# https://github.com/ethereum/consensus-specs/blob/vFuture/specs/altair/sync-protocol.md#try_light_client_store_force_update
# https://github.com/ethereum/consensus-specs/blob/vFuture/specs/altair/sync-protocol.md#process_light_client_store_force_update
type
ForceUpdateResult* = enum
NoUpdate,
DidUpdateWithoutSupermajority,
DidUpdateWithoutFinality

func try_light_client_store_force_update*(
func process_light_client_store_force_update*(
store: var LightClientStore,
current_slot: Slot): ForceUpdateResult {.discardable.} =
var res = NoUpdate
Expand Down
5 changes: 1 addition & 4 deletions tests/consensus_spec/altair/all_altair_fixtures.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@

import
./test_fixture_fork,
./test_fixture_merkle_single_proof,
./test_fixture_light_client_sync_protocol,
./test_fixture_operations,
./test_fixture_sanity_blocks,
./test_fixture_sanity_slots,
./test_fixture_ssz_consensus_objects,
./test_fixture_state_transition_epoch,
./test_fixture_sync_protocol_light_client_sync,
./test_fixture_sync_protocol_update_ranking,
./test_fixture_sync_protocol,
./test_fixture_transition
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,15 @@ func initialize_light_client_store(state: auto): LightClientStore =
current_max_active_participants: 0,
)

suite "EF - Altair - Unittests - Sync protocol" & preset():
suite "EF - Altair - Unittests - Light client - Sync protocol" & preset():
let
cfg = block:
var res = defaultRuntimeConfig
res.ALTAIR_FORK_EPOCH = GENESIS_EPOCH
res
genesisState = newClone(initGenesisState(cfg = cfg))

# https://github.com/ethereum/consensus-specs/blob/vFuture/tests/core/pyspec/eth2spec/test/altair/unittests/test_sync_protocol.py#L25-L67
# https://github.com/ethereum/consensus-specs/blob/vFuture/tests/core/pyspec/eth2spec/test/altair/unittests/light_client/test_sync_protocol.py#L25-L67
test "test_process_light_client_update_not_timeout":
let forked = assignClone(genesisState[])
template state(): auto = forked[].altairData.data
Expand Down Expand Up @@ -207,7 +207,7 @@ suite "EF - Altair - Unittests - Sync protocol" & preset():
store.optimistic_header == update.attested_header
store.current_max_active_participants > 0

# https://github.com/ethereum/consensus-specs/blob/vFuture/tests/core/pyspec/eth2spec/test/altair/unittests/test_sync_protocol.py#L70-L116
# https://github.com/ethereum/consensus-specs/blob/vFuture/tests/core/pyspec/eth2spec/test/altair/unittests/light_client/test_sync_protocol.py#L70-L116
test "test_process_light_client_update_at_period_boundary":
var forked = assignClone(genesisState[])
template state(): auto = forked[].altairData.data
Expand Down Expand Up @@ -260,7 +260,7 @@ suite "EF - Altair - Unittests - Sync protocol" & preset():
store.optimistic_header == update.attested_header
store.current_max_active_participants > 0

# https://github.com/ethereum/consensus-specs/blob/vFuture/tests/core/pyspec/eth2spec/test/altair/unittests/test_sync_protocol.py#L119-L166
# https://github.com/ethereum/consensus-specs/blob/vFuture/tests/core/pyspec/eth2spec/test/altair/unittests/light_client/test_sync_protocol.py#L119-L166
test "process_light_client_update_timeout":
let forked = assignClone(genesisState[])
template state(): auto = forked[].altairData.data
Expand Down Expand Up @@ -316,7 +316,7 @@ suite "EF - Altair - Unittests - Sync protocol" & preset():
store.optimistic_header == update.attested_header
store.current_max_active_participants > 0

# https://github.com/ethereum/consensus-specs/blob/vFuture/tests/core/pyspec/eth2spec/test/altair/unittests/test_sync_protocol.py#L169-L223
# https://github.com/ethereum/consensus-specs/blob/vFuture/tests/core/pyspec/eth2spec/test/altair/unittests/light_client/test_sync_protocol.py#L169-L223
test "process_light_client_update_finality_updated":
let forked = assignClone(genesisState[])
template state(): auto = forked[].altairData.data
Expand Down
63 changes: 0 additions & 63 deletions tests/consensus_spec/altair/test_fixture_merkle_single_proof.nim

This file was deleted.

This file was deleted.

Loading

0 comments on commit 3bc4299

Please sign in to comment.