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