Skip to content

Commit 8b2923a

Browse files
agnxshtersec
andauthored
introduce light supernodes (#7752)
* introduce light supernodes * some more changes * add options in docs * synchronize docs with --help * completely disable reconstruction temporarily * put docs entry in right order * add -Wno-stringop-overflow to test-libnimbus-lc target --------- Co-authored-by: tersec <tersec@users.noreply.github.com>
1 parent c86dce0 commit 8b2923a

File tree

4 files changed

+44
-6
lines changed

4 files changed

+44
-6
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,7 @@ test_libnimbus_lc: libnimbus_lc.a
720720
--std=c17 -flto \
721721
-pedantic -pedantic-errors \
722722
-Wall -Wextra -Werror -Wno-maybe-uninitialized \
723+
-Wno-stringop-overflow \
723724
-Wno-unsafe-buffer-usage -Wno-unknown-warning-option \
724725
-o build/test_libnimbus_lc \
725726
beacon_chain/libnimbus_lc/test_libnimbus_lc.c \

beacon_chain/conf.nim

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,11 @@ type
251251
desc: "Subscribe to all column subnets, thereby becoming a PeerDAS supernode"
252252
name: "peerdas-supernode" .}: bool
253253

254+
lightSupernode* {.
255+
defaultValue: false,
256+
desc: "Subscribe to the first half of column subnets"
257+
name: "light-supernode" .}: bool
258+
254259
slashingDbKind* {.
255260
hidden
256261
defaultValue: SlashingDbKind.v2

beacon_chain/nimbus_beacon_node.nim

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -417,14 +417,24 @@ proc initFullNode(
417417
blobQuarantine = newClone(BlobQuarantine.init(
418418
dag.cfg, dag.db.getQuarantineDB(), 10, onBlobSidecarAdded))
419419
supernode = node.config.peerdasSupernode or node.config.debugPeerdasSupernode
420+
lightSupernode = node.config.lightSupernode
420421
localCustodyGroups =
421422
if supernode:
422423
dag.cfg.NUMBER_OF_CUSTODY_GROUPS
424+
elif lightSupernode:
425+
dag.cfg.NUMBER_OF_CUSTODY_GROUPS div 2
423426
else:
424427
dag.cfg.CUSTODY_REQUIREMENT
425428
custodyColumns =
426-
dag.cfg.resolve_columns_from_custody_groups(
427-
node.network.nodeId, localCustodyGroups)
429+
if node.config.lightSupernode:
430+
# Just the first half of custody columns
431+
var res: HashSet[ColumnIndex]
432+
for i in 0..<dag.cfg.NUMBER_OF_CUSTODY_GROUPS div 2:
433+
res.incl ColumnIndex(i)
434+
res
435+
else:
436+
dag.cfg.resolve_columns_from_custody_groups(
437+
node.network.nodeId, localCustodyGroups)
428438

429439
var sortedColumns = custodyColumns.toSeq()
430440
sort(sortedColumns)
@@ -1294,20 +1304,33 @@ func getSyncCommitteeSubnets(node: BeaconNode, epoch: Epoch): SyncnetBits =
12941304
subnets + node.getNextSyncCommitteeSubnets(epoch)
12951305

12961306
func readCustodyGroupSubnets(node: BeaconNode): uint64 =
1297-
let vcus_count = node.dataColumnQuarantine.custodyColumns.lenu64
1307+
let
1308+
custodyGroups = node.dag.cfg.NUMBER_OF_CUSTODY_GROUPS
1309+
vcus_count = node.dataColumnQuarantine.custodyColumns.lenu64
12981310
if node.config.peerdasSupernode or node.config.debugPeerdasSupernode:
1299-
node.dag.cfg.NUMBER_OF_CUSTODY_GROUPS
1311+
custodyGroups
1312+
elif node.config.lightSupernode:
1313+
custodyGroups div 2
13001314
elif vcus_count > node.dag.cfg.CUSTODY_REQUIREMENT:
13011315
vcus_count
13021316
else:
13031317
node.dag.cfg.CUSTODY_REQUIREMENT
13041318

13051319
proc updateDataColumnSidecarHandlers(node: BeaconNode, gossipEpoch: Epoch) =
13061320
let
1321+
custody_groups = node.dag.cfg.NUMBER_OF_CUSTODY_GROUPS
13071322
forkDigest = node.dag.forkDigests[].atEpoch(gossipEpoch, node.dag.cfg)
13081323
targetSubnets = node.readCustodyGroupSubnets()
1309-
custody = node.dag.cfg.get_custody_groups(
1310-
node.network.nodeId, targetSubnets.uint64)
1324+
custody =
1325+
if node.config.lightSupernode:
1326+
# Light supernode serves only half of the custody groups
1327+
var res = newSeqOfCap[CustodyIndex](custody_groups div 2)
1328+
for i in 0..<custody_groups div 2:
1329+
res.add CustodyIndex(i)
1330+
res
1331+
else:
1332+
node.dag.cfg.get_custody_groups(
1333+
node.network.nodeId, targetSubnets.uint64)
13111334

13121335
for i in custody:
13131336
let topic = getDataColumnSidecarTopic(forkDigest, i)
@@ -1736,10 +1759,17 @@ proc reconstructDataColumns(node: BeaconNode, slot: Slot) =
17361759
# https://github.com/ethereum/consensus-specs/blob/v1.6.0-beta.0/specs/fulu/das-core.md#reconstruction-and-cross-seeding
17371760
# "If the node obtains 50%+ of all the columns, it SHOULD reconstruct the
17381761
# full data matrix via the recover_matrix helper."
1762+
if node.config.lightSupernode:
1763+
return
1764+
17391765
if node.dataColumnQuarantine.custodyColumns.lenu64 <
17401766
node.dag.cfg.NUMBER_OF_CUSTODY_GROUPS div 2:
17411767
return
17421768

1769+
# Currently, this logic is broken
1770+
if true:
1771+
return
1772+
17431773
logScope:
17441774
slot = slot
17451775

@@ -2014,6 +2044,7 @@ proc onSlotEnd(node: BeaconNode, slot: Slot) {.async.} =
20142044

20152045
if (not node.config.peerdasSupernode) and
20162046
(not node.config.debugPeerdasSupernode) and
2047+
(not node.config.lightSupernode) and
20172048
node.dataColumnQuarantine[].len == 0 and
20182049
node.attachedValidatorBalanceTotal > 0.Gwei:
20192050
# Detect new validator custody at the last slot of every epoch

docs/the_nimbus_book/src/options.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ The following options are available:
5050
--agent-string Node agent string which is used as identifier in network [=nimbus].
5151
--subscribe-all-subnets Subscribe to all subnet topics when gossiping [=false].
5252
--peerdas-supernode Subscribe to all column subnets, thereby becoming a PeerDAS supernode [=false].
53+
--light-supernode Subscribe to the first half of column subnets [=false].
5354
--num-threads Number of worker threads ("0" = use as many threads as there are CPU cores
5455
available) [=0].
5556
--jwt-secret A file containing the hex-encoded 256 bit secret key to be used for

0 commit comments

Comments
 (0)