populate dataColumnSidecarByRange with remote custody columns
This commit is contained in:
parent
032f544d65
commit
8bb1145b43
|
@ -31,10 +31,25 @@ proc sortedColumnIndices*(columnsPerSubnet: ColumnIndex, subnetIds: HashSet[uint
|
|||
for i in 0 ..< columnsPerSubnet:
|
||||
for subnetId in subnetIds:
|
||||
let index = DATA_COLUMN_SIDECAR_SUBNET_COUNT * i + subnetId
|
||||
result.add(ColumnIndex(index))
|
||||
res.add(ColumnIndex(index))
|
||||
res.sort()
|
||||
res
|
||||
|
||||
proc sortedColumnIndexList*(columnsPerSubnet: ColumnIndex,
|
||||
subnetIds: HashSet[uint64]):
|
||||
List[ColumnIndex, NUMBER_OF_COLUMNS] =
|
||||
var
|
||||
res: seq[ColumnIndex]
|
||||
list: List[ColumnIndex, NUMBER_OF_COLUMNS]
|
||||
for i in 0 ..< columnsPerSubnet:
|
||||
for subnetId in subnetIds:
|
||||
let index = DATA_COLUMN_SIDECAR_SUBNET_COUNT * i + subnetId
|
||||
res.add(ColumnIndex(index))
|
||||
res.sort()
|
||||
for elem in res:
|
||||
discard list.add(ColumnIndex(elem))
|
||||
list
|
||||
|
||||
proc get_custody_column_subnet*(node_id: NodeId,
|
||||
custody_subnet_count: uint64):
|
||||
Result[HashSet[uint64], cstring] =
|
||||
|
@ -81,6 +96,17 @@ proc get_custody_columns*(node_id: NodeId,
|
|||
|
||||
ok(sortedColumnIndices(ColumnIndex(columns_per_subnet), subnet_ids))
|
||||
|
||||
proc get_custody_column_list*(node_id: NodeId,
|
||||
custody_subnet_count: uint64):
|
||||
Result[List[ColumnIndex, NUMBER_OF_COLUMNS], cstring] =
|
||||
|
||||
let subnet_ids = get_custody_column_subnet(node_id, custody_subnet_count).get
|
||||
|
||||
# columns_per_subnet = NUMBER_OF_COLUMNS // DATA_COLUMN_SIDECAR_SUBNET_COUNT
|
||||
let columns_per_subnet = NUMBER_OF_COLUMNS div DATA_COLUMN_SIDECAR_SUBNET_COUNT
|
||||
|
||||
ok(sortedColumnIndexList(ColumnIndex(columns_per_subnet), subnet_ids))
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/_features/eip7594/das-core.md#compute_extended_matrix
|
||||
proc compute_extended_matrix* (blobs: seq[KzgBlob]): Result[seq[MatrixEntry], cstring] =
|
||||
# This helper demonstrates the relationship between blobs and the `MatrixEntries`
|
||||
|
|
|
@ -280,9 +280,21 @@ proc getDataColumnSidecars[A, B](man: SyncManager[A, B], peer: A,
|
|||
direction = man.direction
|
||||
topics = "syncman"
|
||||
|
||||
let
|
||||
remoteCustodySubnetCount =
|
||||
if man.supernode:
|
||||
DATA_COLUMN_SIDECAR_SUBNET_COUNT.uint64
|
||||
else:
|
||||
CUSTODY_REQUIREMENT.uint64
|
||||
|
||||
let
|
||||
remoteNodeId = getNodeIdFromPeer(peer)
|
||||
remoteCustodyColumns =
|
||||
remoteNodeId.get_custody_column_list(remoteCustodySubnetCount).get
|
||||
|
||||
doAssert(not(req.isEmpty()), "Request must not be empty!")
|
||||
debug "Requesting data column sidecars from peer", request = req
|
||||
dataColumnSidecarsByRange(peer, req.slot, req.count, req.columns)
|
||||
dataColumnSidecarsByRange(peer, req.slot, req.count, remoteCustodyColumns)
|
||||
|
||||
func groupDataColumns*[T](req: SyncRequest[T],
|
||||
blocks: seq[ref ForkedSignedBeaconBlock],
|
||||
|
|
|
@ -38,7 +38,6 @@ type
|
|||
index*: uint64
|
||||
slot*: Slot
|
||||
count*: uint64
|
||||
columns*: List[ColumnIndex, NUMBER_OF_COLUMNS]
|
||||
item*: T
|
||||
|
||||
SyncResult*[T] = object
|
||||
|
|
Loading…
Reference in New Issue