enable dc in gossip and message router
This commit is contained in:
parent
318d656942
commit
fab427d65f
|
@ -530,10 +530,10 @@ proc validateDataColumnSidecar*(
|
|||
|
||||
# [REJECT] The sidecar's `kzg_commitments` inclusion proof is valid as verified by
|
||||
# `verify_data_column_sidecar_inclusion_proof(sidecar)`.
|
||||
# block:
|
||||
# let v = check_data_column_sidecar_inclusion_proof(data_column_sidecar)
|
||||
# if v.isErr:
|
||||
# return dag.checkedReject(v.error)
|
||||
block:
|
||||
let v = check_data_column_sidecar_inclusion_proof(data_column_sidecar)
|
||||
if v.isErr:
|
||||
return dag.checkedReject(v.error)
|
||||
|
||||
# [IGNORE] The sidecar's block's parent (defined by
|
||||
# `block_header.parent_root`) has been seen (via both gossip and
|
||||
|
|
|
@ -325,7 +325,7 @@ proc verify_data_column_sidecar_kzg_proofs*(sidecar: DataColumnSidecar): Result[
|
|||
ok()
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/5f48840f4d768bf0e0a8156a3ed06ec333589007/specs/_features/eip7594/p2p-interface.md#verify_data_column_sidecar_inclusion_proof
|
||||
proc verify_data_column_sidecar_inclusion_proof*(sidecar: DataColumnSidecar): Result[void, string] =
|
||||
func verify_data_column_sidecar_inclusion_proof*(sidecar: DataColumnSidecar): Result[void, string] =
|
||||
# Verify if the given KZG commitments are included in the beacon block
|
||||
let gindex = 11.GeneralizedIndex
|
||||
if not is_valid_merkle_branch(
|
||||
|
|
|
@ -164,25 +164,25 @@ proc routeSignedBeaconBlock*(
|
|||
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])
|
||||
# dataColumnRefs = Opt.some(data_columns.mapIt(newClone(it)))
|
||||
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])
|
||||
dataColumnRefs = Opt.some(data_columns.mapIt(newClone(it)))
|
||||
|
||||
let added = await router[].blockProcessor[].addBlock(
|
||||
MsgSource.api, ForkedSignedBeaconBlock.init(blck), blobRefs, dataColumnRefs)
|
||||
|
|
Loading…
Reference in New Issue