Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Kzg Specs, integration to gossipValidation and it's adjoining tests #6322

Open
wants to merge 36 commits into
base: wip-peerdas
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
4c39032
rebase/add: rebased kzgpeerdas to wip-peerdas, no conflicts with unst…
agnxsh May 28, 2024
26519f6
feat: added kzg specs to gossip validation rules, fixed peerdas from …
agnxsh May 29, 2024
983522f
fix copyright year, and push raises
agnxsh May 29, 2024
80387f1
fix: code styles
agnxsh May 29, 2024
a268ad2
fix:reduced blank lines
agnxsh May 29, 2024
538ce0a
fix: added global ctx verification in computeCellsAndProofs and recov…
agnxsh May 31, 2024
e5f82ca
upstream fix in kzg4844-c
agnxsh May 31, 2024
07c3ec5
switched c-kzg-4844
agnxsh May 31, 2024
ca19e12
experimental chenges
agnxsh Jun 2, 2024
578a106
conditional disabling
agnxsh Jun 2, 2024
caf5557
oops
agnxsh Jun 2, 2024
c35b5f1
disable more
agnxsh Jun 2, 2024
b4810fa
fix
agnxsh Jun 2, 2024
9be2e4d
experimental disabling of upstream
agnxsh Jun 3, 2024
29e370e
add: EF test harness for KZG EIP7594 (Peerdas)
agnxsh Jun 5, 2024
452a39b
bumped nim-kzg4844
agnxsh Jun 5, 2024
8565bab
bump nim-kzg4844 to 9f54f2f83eb64be7571e5450c805f862e3e95780
agnxsh Jun 5, 2024
3ef4af0
rename func name to avoid conflicts
agnxsh Jun 5, 2024
5c12be0
bumped nim-kzg4844 to d915948dd58c2ad23b551cd408066046cf5e46db
agnxsh Jun 5, 2024
49b3495
fix: test_fixture_kzg
agnxsh Jun 5, 2024
a8accf6
updated test suite with passing tests for KZG EIP7594
agnxsh Jun 6, 2024
c0ade0c
added test_fixture_networking for peerdas
agnxsh Jun 7, 2024
6f87a30
remove commented code
agnxsh Jun 7, 2024
869f41b
fix: folder auto
agnxsh Jun 7, 2024
427e942
add: test pass, added test to suite, added test report
agnxsh Jun 7, 2024
8fd153f
Merge branch 'kzgpeerdas' of https://github.com/status-im/nimbus-eth2…
agnxsh Jun 7, 2024
7230128
update: test report
agnxsh Jun 7, 2024
282b716
add: test for ssz consensus objects
agnxsh Jun 9, 2024
3e995d9
add: passing tests and test report for ssz consensus objects (eip7594)
agnxsh Jun 9, 2024
d8acc16
rename: KzgCell --> Cell
agnxsh Jun 11, 2024
2615514
add: testing init for peerdas eip
agnxsh Jun 13, 2024
96b3e95
fix: suggested fixes
agnxsh Jun 13, 2024
7d13a80
added another unit test, disabling test in CI for now, because change…
agnxsh Jun 13, 2024
6eaab41
bumped nim-kzg4844 to 2880673a7af5d96bfc91d51c5c0c058be07a6c57
agnxsh Jun 14, 2024
6b0223b
bump down due to error in C api
agnxsh Jun 14, 2024
6ec2774
fix: linux-amd failure for `test_fixture_kzg` ~ peerdas branch(es) (#…
agnxsh Jul 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions beacon_chain/gossip_processing/gossip_validation.nim
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import
results,
# Internals
../spec/[
beaconstate, state_transition_block, forks, helpers, network, signatures],
beaconstate, state_transition_block, forks, helpers, network, signatures, eip7594_helpers],
../consensus_object_pools/[
attestation_pool, blockchain_dag, blob_quarantine, block_quarantine,
spec_cache, light_client_pool, sync_committee_msg_pool,
Expand Down Expand Up @@ -207,6 +207,18 @@ func check_blob_sidecar_inclusion_proof(

ok()

func check_data_column_sidecar_inclusion_proof(
data_column_sidecar: DataColumnSidecar): Result[void, ValidationError] =
let res = data_column_sidecar.verify_data_column_sidecar_inclusion_proof()
if res.isErr:
return errReject(res.error)

proc check_data_column_sidecar_kzg_proofs(
data_column_sidecar: DataColumnSidecar): Result[void, ValidationError] =
let res = data_column_sidecar.verify_data_column_sidecar_kzg_proofs()
if res.isErr:
return errReject(res.error)

# Gossip Validation
# ----------------------------------------------------------------

Expand Down Expand Up @@ -502,11 +514,19 @@ proc validateDataColumnSidecar*(
if not (block_header.slot > dag.finalizedHead.slot):
return errIgnore("DataColumnSidecar: slot already finalized")

# TODO: [REJECT] The sidecar's `kzg_commitments` inclusion proof is valid as verified by
# [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)

# TODO: [REJECT] The sidecar's column data is valid as
# [REJECT] The sidecar's column data is valid as
# verified by `verify_data_column_kzg_proofs(sidecar)`
block:
let r = check_data_column_sidecar_kzg_proofs(data_column_sidecar)
if r.isErr:
return dag.checkedReject(r.error)

# [IGNORE] The sidecar is the first sidecar for the tuple
# (block_header.slot, block_header.proposer_index, blob_sidecar.index)
Expand Down
8 changes: 5 additions & 3 deletions beacon_chain/spec/datatypes/eip7594.nim
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ type
Coset* = array[FIELD_ELEMENTS_PER_CELL, BLSFieldElement]
CosetEvals* = array[FIELD_ELEMENTS_PER_CELL, BLSFieldElement]
Cell* = KzgCell
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is Cell used anywhere, or should it be, in place of KzgCell?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, using Cell should be used ideally and consistently everywhere, I probably used KzgCell as as experimental debug strategy to locate the buggy non-upstreamed funcs in c-kzg

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can definitely fix this

Cells* = KzgCells
CellsAndProofs* = KzgCellsAndKzgProofs
CellID* = uint64
RowIndex* = uint64
ColumnIndex* = uint64
Expand All @@ -34,8 +36,8 @@ const
TARGET_NUMBER_OF_PEERS* = 70

type
DataColumn* = List[Cell, Limit(MAX_BLOB_COMMITMENTS_PER_BLOCK)]
ExtendedMatrix* = List[Cell, Limit(MAX_CELLS_IN_EXTENDED_MATRIX)]
DataColumn* = List[KzgCell, Limit(MAX_BLOB_COMMITMENTS_PER_BLOCK)]
ExtendedMatrix* = List[KzgCell, Limit(MAX_CELLS_IN_EXTENDED_MATRIX)]

DataColumnSidecar* = object
index*: ColumnIndex # Index of column in extended matrix
Expand All @@ -44,7 +46,7 @@ type
kzg_proofs*: List[KzgProof, Limit(MAX_BLOB_COMMITMENTS_PER_BLOCK)]
signed_block_header*: SignedBeaconBlockHeader
kzg_commitments_inclusion_proof*:
array[KZG_COMMITMENTS_INCLUSION_PROOF_DEPTH, KzgBytes32]
array[KZG_COMMITMENTS_INCLUSION_PROOF_DEPTH, Eth2Digest]

func shortLog*(v: DataColumnSidecar): auto =
(
Expand Down
Loading
Loading