add: verify data column kzg proof during storeBlock, added serializeDataColumn for better logs
This commit is contained in:
parent
2e9750ba76
commit
e80bd36f76
|
@ -644,6 +644,24 @@ proc storeBlock(
|
|||
msg = r.error()
|
||||
return err((VerifierError.Invalid, ProcessingStatus.completed))
|
||||
|
||||
if dataColumnsOpt.isSome:
|
||||
let data_column_sidecars = dataColumnsOpt.get
|
||||
if data_column_sidecars.len > 0:
|
||||
for i in 0..<data_column_sidecars.len:
|
||||
let r = verify_data_column_sidecar_kzg_proofs(data_column_sidecars[i][])
|
||||
|
||||
if r.isErr():
|
||||
debug "data column sidecar verification failed",
|
||||
blockroot = shortLog(signedBlock.root),
|
||||
column = shortLog(data_column_sidecars[i][].column),
|
||||
blck = shortLog(signedBlock.message),
|
||||
kzgCommits =
|
||||
mapIt(data_column_sidecars[i][].kzg_commitments,
|
||||
shortLog(it)),
|
||||
signature = shortLog(signedBlock.signature),
|
||||
msg = r.error
|
||||
return err((VerifierError.Invalid, ProcessingStatus.completed))
|
||||
|
||||
type Trusted = typeof signedBlock.asTrusted()
|
||||
|
||||
let
|
||||
|
|
|
@ -8,8 +8,10 @@
|
|||
{.push raises: [].}
|
||||
|
||||
import
|
||||
std/[sequtils],
|
||||
"."/[base, deneb],
|
||||
kzg4844
|
||||
kzg4844,
|
||||
stew/[byteutils]
|
||||
|
||||
from std/sequtils import mapIt
|
||||
from std/strutils import join
|
||||
|
@ -76,6 +78,17 @@ type
|
|||
|
||||
CscBits* = BitArray[DATA_COLUMN_SIDECAR_SUBNET_COUNT]
|
||||
|
||||
func serializeDataColumn(data_column: DataColumn): auto =
|
||||
var counter = 0
|
||||
var serd : array[MAX_BLOB_COMMITMENTS_PER_BLOCK * KzgCellSize, byte]
|
||||
for i in 0..<MAX_BLOB_COMMITMENTS_PER_BLOCK:
|
||||
for j in 0..<KzgCellSize:
|
||||
serd[counter] = data_column[i][j]
|
||||
inc(counter)
|
||||
serd
|
||||
|
||||
func shortLog*(v: DataColumn): auto =
|
||||
to0xHex(v.serializeDataColumn())
|
||||
|
||||
func shortLog*(v: DataColumnSidecar): auto =
|
||||
(
|
||||
|
|
Loading…
Reference in New Issue