Skip to content

Commit

Permalink
support Capella LC data format
Browse files Browse the repository at this point in the history
Implements the proposed light client data format for Capella:
- ethereum/consensus-specs#3151
  • Loading branch information
etan-status committed Jan 15, 2023
1 parent f2c0189 commit 135b09e
Show file tree
Hide file tree
Showing 13 changed files with 621 additions and 56 deletions.
2 changes: 1 addition & 1 deletion AllTests-mainnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ OK: 12/12 Fail: 0/12 Skip: 0/12
+ LVH searching OK
```
OK: 1/1 Fail: 0/1 Skip: 0/1
## Light client [Preset: mainnet]
## Light client [Preset: mainnet]
```diff
+ Init from checkpoint OK
+ Light client sync OK
Expand Down
10 changes: 9 additions & 1 deletion ConsensusSpecPreset-mainnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -1843,6 +1843,14 @@ OK: 1/1 Fail: 0/1 Skip: 0/1
+ Testing Withdrawal OK
```
OK: 46/46 Fail: 0/46 Skip: 0/46
## EF - Capella - Unittests - Light client - Sync protocol [Preset: mainnet]
```diff
+ process_light_client_update_finality_updated OK
+ process_light_client_update_timeout OK
+ test_process_light_client_update_at_period_boundary OK
+ test_process_light_client_update_not_timeout OK
```
OK: 4/4 Fail: 0/4 Skip: 0/4
## EF - EIP4844 - Epoch Processing - Effective balance updates [Preset: mainnet]
```diff
+ Effective balance updates - effective_balance_hysteresis [Preset: mainnet] OK
Expand Down Expand Up @@ -2580,4 +2588,4 @@ OK: 63/63 Fail: 0/63 Skip: 0/63
OK: 100/100 Fail: 0/100 Skip: 0/100

---TOTAL---
OK: 2285/2294 Fail: 0/2294 Skip: 9/2294
OK: 2289/2298 Fail: 0/2298 Skip: 9/2298
10 changes: 9 additions & 1 deletion ConsensusSpecPreset-minimal.md
Original file line number Diff line number Diff line change
Expand Up @@ -1992,6 +1992,14 @@ OK: 5/5 Fail: 0/5 Skip: 0/5
+ Testing Withdrawal OK
```
OK: 46/46 Fail: 0/46 Skip: 0/46
## EF - Capella - Unittests - Light client - Sync protocol [Preset: minimal]
```diff
+ process_light_client_update_finality_updated OK
+ process_light_client_update_timeout OK
+ test_process_light_client_update_at_period_boundary OK
+ test_process_light_client_update_not_timeout OK
```
OK: 4/4 Fail: 0/4 Skip: 0/4
## EF - EIP4844 - Epoch Processing - Effective balance updates [Preset: minimal]
```diff
+ Effective balance updates - effective_balance_hysteresis [Preset: minimal] OK
Expand Down Expand Up @@ -2747,4 +2755,4 @@ OK: 68/68 Fail: 0/68 Skip: 0/68
OK: 102/102 Fail: 0/102 Skip: 0/102

---TOTAL---
OK: 2436/2445 Fail: 0/2445 Skip: 9/2445
OK: 2440/2449 Fail: 0/2449 Skip: 9/2449
6 changes: 3 additions & 3 deletions beacon_chain/light_client.nim
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ proc installMessageValidators*(

let forkDigests = lightClient.forkDigests
for stateFork in BeaconStateFork:
if stateFork >= BeaconStateFork.Capella:
if stateFork >= BeaconStateFork.EIP4844:
# Format is still in development, do not use Gossip at this time.
continue

Expand Down Expand Up @@ -420,7 +420,7 @@ proc updateGossipStatus*(

for gossipFork in oldGossipForks:
if gossipFork >= BeaconStateFork.Altair:
if gossipFork >= BeaconStateFork.Capella:
if gossipFork >= BeaconStateFork.EIP4844:
# Format is still in development, do not use Gossip at this time.
continue
let forkDigest = lightClient.forkDigests[].atStateFork(gossipFork)
Expand All @@ -431,7 +431,7 @@ proc updateGossipStatus*(

for gossipFork in newGossipForks:
if gossipFork >= BeaconStateFork.Altair:
if gossipFork >= BeaconStateFork.Capella:
if gossipFork >= BeaconStateFork.EIP4844:
# Format is still in development, do not use Gossip at this time.
continue
let forkDigest = lightClient.forkDigests[].atStateFork(gossipFork)
Expand Down
11 changes: 8 additions & 3 deletions beacon_chain/nimbus_light_client.nim
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import
./gossip_processing/optimistic_processor,
./networking/topic_params,
./spec/beaconstate,
./spec/datatypes/[phase0, altair, bellatrix],
./spec/datatypes/[phase0, altair, bellatrix, capella],
"."/[filepath, light_client, light_client_db, nimbus_binary_common, version]

from ./consensus_object_pools/consensus_manager import runForkchoiceUpdated
Expand Down Expand Up @@ -154,6 +154,11 @@ programMain:
proc (signedBlock: bellatrix.SignedBeaconBlock): ValidationResult =
toValidationResult(
optimisticProcessor.processSignedBeaconBlock(signedBlock)))
network.addValidator(
getBeaconBlocksTopic(forkDigests.capella),
proc (signedBlock: capella.SignedBeaconBlock): ValidationResult =
toValidationResult(
optimisticProcessor.processSignedBeaconBlock(signedBlock)))
lightClient.installMessageValidators()
waitFor network.startListening()
waitFor network.start()
Expand Down Expand Up @@ -250,14 +255,14 @@ programMain:
oldGossipForks = currentGossipState - targetGossipState

for gossipFork in oldGossipForks:
if gossipFork >= BeaconStateFork.Capella:
if gossipFork >= BeaconStateFork.EIP4844:
# Format is still in development, do not use Gossip at this time.
continue
let forkDigest = forkDigests[].atStateFork(gossipFork)
network.unsubscribe(getBeaconBlocksTopic(forkDigest))

for gossipFork in newGossipForks:
if gossipFork >= BeaconStateFork.Capella:
if gossipFork >= BeaconStateFork.EIP4844:
# Format is still in development, do not use Gossip at this time.
continue
let forkDigest = forkDigests[].atStateFork(gossipFork)
Expand Down
Loading

0 comments on commit 135b09e

Please sign in to comment.