diff --git a/beacon_chain/conf.nim b/beacon_chain/conf.nim index de66a5b6a..8b3dce353 100644 --- a/beacon_chain/conf.nim +++ b/beacon_chain/conf.nim @@ -253,6 +253,12 @@ type desc: "Subscribe to all subnet topics when gossiping" name: "subscribe-all-subnets" .}: bool + peerdasSupernode* {. + hidden + defaultValue: false, + desc: "Subscribe to all column subnets, thereby becoming a peerdas supernode" + name: "debug-peerdas-supernode" .}: bool + slashingDbKind* {. hidden defaultValue: SlashingDbKind.v2 diff --git a/beacon_chain/nimbus_beacon_node.nim b/beacon_chain/nimbus_beacon_node.nim index 44d6d3998..e849ca6a9 100644 --- a/beacon_chain/nimbus_beacon_node.nim +++ b/beacon_chain/nimbus_beacon_node.nim @@ -416,7 +416,7 @@ proc initFullNode( onElectraAttesterSlashingAdded)) blobQuarantine = newClone(BlobQuarantine.init(onBlobSidecarAdded)) dataColumnQuarantine = newClone(DataColumnQuarantine.init()) - supernode = node.config.subscribeAllSubnets + supernode = node.config.peerdasSupernode localCustodySubnets = if supernode: DATA_COLUMN_SIDECAR_SUBNET_COUNT.uint64 @@ -564,7 +564,7 @@ proc initFullNode( node.network.nodeId.get_custody_columns(max(SAMPLES_PER_SLOT.uint64, localCustodySubnets)) - if node.config.subscribeAllSubnets: + if node.config.peerdasSupernode: node.network.loadCscnetMetadataAndEnr(DATA_COLUMN_SIDECAR_SUBNET_COUNT.uint8) else: node.network.loadCscnetMetadataAndEnr(CUSTODY_REQUIREMENT.uint8) diff --git a/beacon_chain/spec/eip7594_helpers.nim b/beacon_chain/spec/eip7594_helpers.nim index 94037505b..148d28832 100644 --- a/beacon_chain/spec/eip7594_helpers.nim +++ b/beacon_chain/spec/eip7594_helpers.nim @@ -24,9 +24,9 @@ type CellBytes = array[fulu.CELLS_PER_EXT_BLOB, Cell] ProofBytes = array[fulu.CELLS_PER_EXT_BLOB, KzgProof] -func sortedColumnIndices*(columnsPerSubnet: ColumnIndex, - subnetIds: HashSet[uint64]): - seq[ColumnIndex] = +func sortedColumnIndices(columnsPerSubnet: ColumnIndex, + subnetIds: HashSet[uint64]): + seq[ColumnIndex] = var res: seq[ColumnIndex] = @[] for i in 0'u64 ..< columnsPerSubnet: for subnetId in subnetIds: @@ -35,9 +35,9 @@ func sortedColumnIndices*(columnsPerSubnet: ColumnIndex, res.sort res -func sortedColumnIndexList*(columnsPerSubnet: ColumnIndex, - subnetIds: HashSet[uint64]): - List[ColumnIndex, NUMBER_OF_COLUMNS] = +func sortedColumnIndexList(columnsPerSubnet: ColumnIndex, + subnetIds: HashSet[uint64]): + List[ColumnIndex, NUMBER_OF_COLUMNS] = var res: seq[ColumnIndex] for i in 0'u64 ..< columnsPerSubnet: diff --git a/beacon_chain/spec/helpers.nim b/beacon_chain/spec/helpers.nim index 75e5f3efa..e1df9ee2b 100644 --- a/beacon_chain/spec/helpers.nim +++ b/beacon_chain/spec/helpers.nim @@ -10,7 +10,6 @@ # Uncategorized helper functions from the spec import - std/sequtils, # Status libraries stew/[byteutils, endians2, objects], nimcrypto/sha2, @@ -543,6 +542,7 @@ proc compute_execution_block_hash*(blck: ForkyBeaconBlock): Eth2Digest = rlpHash(blockToBlockHeader(blck)).to(Eth2Digest) from std/math import exp, ln +from std/sequtils import foldl func ln_binomial(n, k: int): float64 = if k > n: