fix: get_data_column_sidecar
This commit is contained in:
parent
87bc91febe
commit
18e3ba2a39
|
@ -11,7 +11,9 @@
|
|||
import
|
||||
std/[algorithm, macros, tables],
|
||||
stew/results,
|
||||
ssz_serialization/proofs,
|
||||
ssz_serialization/[
|
||||
proofs,
|
||||
types],
|
||||
chronicles,
|
||||
./[beacon_time, crypto],
|
||||
kzg4844/kzg_ex,
|
||||
|
@ -145,7 +147,12 @@ proc get_data_column_sidecars*(signed_block: deneb.SignedBeaconBlock | electra.S
|
|||
signed_block_header: SignedBeaconBlockHeader
|
||||
blck = signed_block.message
|
||||
cellsAndProofs: seq[KzgCellsAndKzgProofs]
|
||||
kzg_incl_proof: array[KZG_COMMITMENT_INCLUSION_PROOF_DEPTH, Eth2Digest]
|
||||
|
||||
blck.body.build_proof(
|
||||
27.GeneralizedIndex,
|
||||
kzg_incl_proof).expect("Valid gindex")
|
||||
|
||||
for blob in blobs:
|
||||
let
|
||||
computed_cell = computeCellsAndKzgProofs(blob)
|
||||
|
@ -181,6 +188,7 @@ proc get_data_column_sidecars*(signed_block: deneb.SignedBeaconBlock | electra.S
|
|||
kzgCommitments: blck.body.blob_kzg_commitments,
|
||||
kzgProofs: kzgProofOfColumn,
|
||||
signed_block_header: signed_block_header
|
||||
|
||||
)
|
||||
blck.body.build_proof(
|
||||
kzg_commitment_inclusion_proof_gindex(BlobIndex(columnIndex)),
|
||||
|
|
|
@ -161,27 +161,27 @@ proc routeSignedBeaconBlock*(
|
|||
notice "Blob sent", blob = shortLog(blobs[i])
|
||||
blobRefs = Opt.some(blobs.mapIt(newClone(it)))
|
||||
|
||||
var dataColumnRefs = Opt.none(DataColumnSidecars)
|
||||
when typeof(blck).kind >= ConsensusFork.Deneb:
|
||||
if blobsOpt.isSome():
|
||||
let blobs = blobsOpt.get()
|
||||
let data_columns = get_data_column_sidecars(blck, blobs.mapIt(it.blob)).get()
|
||||
var das_workers = newSeq[Future[SendResult]](len(data_columns))
|
||||
for i in 0..<data_columns.lenu64:
|
||||
let subnet_id = compute_subnet_for_data_column_sidecar(i)
|
||||
das_workers[i] =
|
||||
router[].network.broadcastDataColumnSidecar(subnet_id, data_columns[i])
|
||||
let allres = await allFinished(das_workers)
|
||||
for i in 0..<allres.len:
|
||||
let res = allres[i]
|
||||
doAssert res.finished()
|
||||
if res.failed():
|
||||
notice "Data Columns not sent",
|
||||
data_column = shortLog(data_columns[i]), error = res.error[]
|
||||
else:
|
||||
notice "Data columns sent", data_column = shortLog(data_columns[i])
|
||||
blobRefs = Opt.some(blobs.mapIt(newClone(it)))
|
||||
dataColumnRefs = Opt.some(data_columns.mapIt(newClone(it)))
|
||||
# var dataColumnRefs = Opt.none(DataColumnSidecars)
|
||||
# when typeof(blck).kind >= ConsensusFork.Deneb:
|
||||
# if blobsOpt.isSome():
|
||||
# let blobs = blobsOpt.get()
|
||||
# let data_columns = get_data_column_sidecars(blck, blobs.mapIt(it.blob)).get()
|
||||
# var das_workers = newSeq[Future[SendResult]](len(data_columns))
|
||||
# for i in 0..<data_columns.lenu64:
|
||||
# let subnet_id = compute_subnet_for_data_column_sidecar(i)
|
||||
# das_workers[i] =
|
||||
# router[].network.broadcastDataColumnSidecar(subnet_id, data_columns[i])
|
||||
# let allres = await allFinished(das_workers)
|
||||
# for i in 0..<allres.len:
|
||||
# let res = allres[i]
|
||||
# doAssert res.finished()
|
||||
# if res.failed():
|
||||
# notice "Data Columns not sent",
|
||||
# data_column = shortLog(data_columns[i]), error = res.error[]
|
||||
# else:
|
||||
# notice "Data columns sent", data_column = shortLog(data_columns[i])
|
||||
# blobRefs = Opt.some(blobs.mapIt(newClone(it)))
|
||||
# dataColumnRefs = Opt.some(data_columns.mapIt(newClone(it)))
|
||||
|
||||
let added = await router[].blockProcessor[].addBlock(
|
||||
MsgSource.api, ForkedSignedBeaconBlock.init(blck), blobRefs, Opt.none(DataColumnSidecars))
|
||||
|
|
Loading…
Reference in New Issue