experimentally disable verifying data column sidecar before storing block

This commit is contained in:
Agnish Ghosh 2024-08-19 13:52:47 +05:30
parent 635eebbed1
commit f71354b307
2 changed files with 34 additions and 33 deletions

View File

@ -635,39 +635,39 @@ proc storeBlock(
# TODO with v1.4.0, not sure this is still relevant # TODO with v1.4.0, not sure this is still relevant
# Establish blob viability before calling addHeadBlock to avoid # Establish blob viability before calling addHeadBlock to avoid
# writing the block in case of blob error. # writing the block in case of blob error.
when typeof(signedBlock).kind >= ConsensusFork.Deneb: # when typeof(signedBlock).kind >= ConsensusFork.Deneb:
if blobsOpt.isSome: # if blobsOpt.isSome:
let blobs = blobsOpt.get() # let blobs = blobsOpt.get()
let kzgCommits = signedBlock.message.body.blob_kzg_commitments.asSeq # let kzgCommits = signedBlock.message.body.blob_kzg_commitments.asSeq
if blobs.len > 0 or kzgCommits.len > 0: # if blobs.len > 0 or kzgCommits.len > 0:
let r = validate_blobs(kzgCommits, blobs.mapIt(KzgBlob(bytes: it.blob)), # let r = validate_blobs(kzgCommits, blobs.mapIt(KzgBlob(bytes: it.blob)),
blobs.mapIt(it.kzg_proof)) # blobs.mapIt(it.kzg_proof))
if r.isErr(): # if r.isErr():
debug "blob validation failed", # debug "blob validation failed",
blockRoot = shortLog(signedBlock.root), # blockRoot = shortLog(signedBlock.root),
blobs = shortLog(blobs), # blobs = shortLog(blobs),
blck = shortLog(signedBlock.message), # blck = shortLog(signedBlock.message),
kzgCommits = mapIt(kzgCommits, shortLog(it)), # kzgCommits = mapIt(kzgCommits, shortLog(it)),
signature = shortLog(signedBlock.signature), # signature = shortLog(signedBlock.signature),
msg = r.error() # msg = r.error()
return err((VerifierError.Invalid, ProcessingStatus.completed)) # return err((VerifierError.Invalid, ProcessingStatus.completed))
if dataColumnsOpt.isSome: # if dataColumnsOpt.isSome:
let data_column_sidecars = dataColumnsOpt.get # let data_column_sidecars = dataColumnsOpt.get
if data_column_sidecars.len > 0: # if data_column_sidecars.len > 0:
for i in 0..<data_column_sidecars.len: # for i in 0..<data_column_sidecars.len:
let r = verify_data_column_sidecar_kzg_proofs(data_column_sidecars[i][]) # let r = verify_data_column_sidecar_kzg_proofs(data_column_sidecars[i][])
if r.isErr(): # if r.isErr():
debug "data column sidecar verification failed", # debug "data column sidecar verification failed",
blockroot = shortLog(signedBlock.root), # blockroot = shortLog(signedBlock.root),
blck = shortLog(signedBlock.message), # blck = shortLog(signedBlock.message),
kzgCommits = # kzgCommits =
mapIt(data_column_sidecars[i][].kzg_commitments, # mapIt(data_column_sidecars[i][].kzg_commitments,
shortLog(it)), # shortLog(it)),
signature = shortLog(signedBlock.signature), # signature = shortLog(signedBlock.signature),
msg = r.error # msg = r.error
return err((VerifierError.Invalid, ProcessingStatus.completed)) # return err((VerifierError.Invalid, ProcessingStatus.completed))
type Trusted = typeof signedBlock.asTrusted() type Trusted = typeof signedBlock.asTrusted()
@ -719,6 +719,7 @@ proc storeBlock(
let data_columns = dataColumnsOpt.valueOr: DataColumnSidecars @[] let data_columns = dataColumnsOpt.valueOr: DataColumnSidecars @[]
for c in data_columns: for c in data_columns:
self.consensusManager.dag.db.putDataColumnSidecar(c[]) self.consensusManager.dag.db.putDataColumnSidecar(c[])
debug "Data column written to database!"
let addHeadBlockTick = Moment.now() let addHeadBlockTick = Moment.now()

View File

@ -32,12 +32,12 @@ const
PARALLEL_REQUESTS* = 2 PARALLEL_REQUESTS* = 2
## Number of peers we using to resolve our request. ## Number of peers we using to resolve our request.
PARALLEL_REQUESTS_DATA_COLUMNS* = 16 PARALLEL_REQUESTS_DATA_COLUMNS* = 64
BLOB_GOSSIP_WAIT_TIME_NS* = 2 * 1_000_000_000 BLOB_GOSSIP_WAIT_TIME_NS* = 2 * 1_000_000_000
## How long to wait for blobs to arrive over gossip before fetching. ## How long to wait for blobs to arrive over gossip before fetching.
DATA_COLUMN_GOSSIP_WAIT_TIME_NS* = 250_000_000 DATA_COLUMN_GOSSIP_WAIT_TIME_NS* = 4 * 1_000_000_000
POLL_INTERVAL = 1.seconds POLL_INTERVAL = 1.seconds