From 9ede8028c0ab6b5649f872c25d6c3738ba7a25e4 Mon Sep 17 00:00:00 2001 From: Agnish Ghosh Date: Tue, 8 Oct 2024 04:28:12 +0530 Subject: [PATCH] add more checking in rpc response --- beacon_chain/spec/eip7594_helpers.nim | 3 +++ beacon_chain/sync/request_manager.nim | 2 ++ 2 files changed, 5 insertions(+) diff --git a/beacon_chain/spec/eip7594_helpers.nim b/beacon_chain/spec/eip7594_helpers.nim index 39646febb..7139c3ca9 100644 --- a/beacon_chain/spec/eip7594_helpers.nim +++ b/beacon_chain/spec/eip7594_helpers.nim @@ -387,6 +387,9 @@ proc verify_data_column_sidecar_kzg_proofs*(sidecar: DataColumnSidecar): ## Verify if the KZG Proofs consisting in the `DataColumnSidecar` ## is valid or not. + if not (sidecar.kzg_commitments.len == 0): + return err("Kzg commitments length cannot be 0") + # Check if the data column sidecar index < NUMBER_OF_COLUMNS if not (sidecar.index < NUMBER_OF_COLUMNS): return err("Data column sidecar index exceeds the NUMBER_OF_COLUMNS") diff --git a/beacon_chain/sync/request_manager.nim b/beacon_chain/sync/request_manager.nim index 6882d0bbd..a1691087f 100644 --- a/beacon_chain/sync/request_manager.nim +++ b/beacon_chain/sync/request_manager.nim @@ -153,6 +153,8 @@ proc checkResponse(colIdList: seq[DataColumnIdentifier], break if not found: return false + column[].verify_data_column_sidecar_kzg_proofs()isOkOr: + return false column[].verify_data_column_sidecar_inclusion_proof().isOkOr: return false true