Skip to content

Commit 77cbfc0

Browse files
authored
prevent double verification of data column sidecar kzg proofs (#7301)
1 parent 121f30a commit 77cbfc0

File tree

4 files changed

+14
-26
lines changed

4 files changed

+14
-26
lines changed

AllTests-mainnet.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ AllTests-mainnet
209209
+ Different fork versions OK
210210
+ Different genesis validators roots OK
211211
+ Different lengths and blob limits OK
212+
+ Fusaka devnet-2 OK
212213
```
213214
## EF - KZG
214215
```diff
@@ -647,10 +648,6 @@ AllTests-mainnet
647648
+ Obtaining the gas limit of an unconfigured validator returns the suggested default [Beacon OK
648649
+ Setting the gas limit on a missing validator creates a record for it [Beacon Node] [Preset OK
649650
```
650-
## Gossip fork transition
651-
```diff
652-
+ Gossip fork transition OK
653-
```
654651
## Gossip validation [Preset: mainnet]
655652
```diff
656653
+ Empty committee when no committee for slot OK

beacon_chain/gossip_processing/block_processor.nim

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -727,27 +727,15 @@ proc storeBlock(
727727

728728
let newPayloadTick = Moment.now()
729729

730-
when typeof(signedBlock).kind >= ConsensusFork.Fulu:
731-
if dataColumnsOpt.isSome:
732-
let
733-
columns0 = dataColumnsOpt.get()
734-
kzgCommits = signedBlock.message.body.blob_kzg_commitments.asSeq
735-
if columns0.len > 0 and kzgCommits.len > 0:
736-
for i in 0..<columns0.len:
737-
let r =
738-
verify_data_column_sidecar_kzg_proofs(columns0[i][])
739-
if r.isErr:
740-
debug "data column validation failed",
741-
blockRoot = shortLog(signedBlock.root),
742-
column_sidecar = shortLog(columns0[i][]),
743-
blck = shortLog(signedBlock.message),
744-
signature = shortLog(signedBlock.signature),
745-
msg = r.error()
746-
return err((VerifierError.Invalid, ProcessingStatus.completed))
730+
# No need to verify data column sidecar kzg proofs, as
731+
# there are verification processes ar every point of entry
732+
# for column sidecars, more so as this verification process
733+
# is expensive and latent for nodes with higher column custody.
734+
747735
# TODO with v1.4.0, not sure this is still relevant
748736
# Establish blob viability before calling addHeadBlock to avoid
749737
# writing the block in case of blob error.
750-
elif typeof(signedBlock).kind >= ConsensusFork.Deneb:
738+
when typeof(signedBlock).kind >= ConsensusFork.Deneb:
751739
if blobsOpt.isSome:
752740
let blobs = blobsOpt.get()
753741
let kzgCommits = signedBlock.message.body.blob_kzg_commitments.asSeq

beacon_chain/spec/peerdas_helpers.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ proc verify_data_column_sidecar_inclusion_proof*(sidecar: DataColumnSidecar):
516516

517517
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.10/specs/fulu/p2p-interface.md#verify_data_column_sidecar_kzg_proofs
518518
proc verify_data_column_sidecar_kzg_proofs*(sidecar: DataColumnSidecar):
519-
Result[void, cstring] =
519+
Result[void, string] =
520520
## Verify if the KZG Proofs consisting in the `DataColumnSidecar`
521521
## is valid or not.
522522

beacon_chain/sync/request_manager.nim

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,9 @@ func checkResponseSanity(
172172

173173
Opt.some(records)
174174

175-
func checkColumnResponse(idList: seq[DataColumnsByRootIdentifier],
176-
columns: openArray[ref DataColumnSidecar]):
177-
Opt[seq[DataColumnResponseRecord]] =
175+
proc checkColumnResponse(idList: seq[DataColumnsByRootIdentifier],
176+
columns: openArray[ref DataColumnSidecar]):
177+
Opt[seq[DataColumnResponseRecord]] =
178178
var colRec: seq[DataColumnResponseRecord]
179179
for colresp in columns:
180180
let block_root =
@@ -188,6 +188,9 @@ func checkColumnResponse(idList: seq[DataColumnsByRootIdentifier],
188188
# verify the inclusion proof
189189
colresp[].verify_data_column_sidecar_inclusion_proof().isOkOr:
190190
return Opt.none(seq[DataColumnResponseRecord])
191+
# verify the column kzg proof
192+
colresp[].verify_data_column_sidecar_kzg_proofs().isOkOr:
193+
return Opt.none(seq[DataColumnResponseRecord])
191194
colRec.add(DataColumnResponseRecord(block_root: block_root,
192195
sidecar: colresp))
193196
Opt.some(colRec)

0 commit comments

Comments
 (0)