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

add: compute_columns_for_custody_group tests #6838

Open
wants to merge 7 commits into
base: unstable
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
9 changes: 7 additions & 2 deletions AllTests-mainnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,11 @@ OK: 253/253 Fail: 0/253 Skip: 0/253
OK: 56/56 Fail: 0/56 Skip: 0/56
## EF - PeerDAS - Networking [Preset: mainnet]
```diff
+ Networking - Compute Columns for Custody Group - mainnet/fulu/networking/compute_columns_f OK
+ Networking - Compute Columns for Custody Group - mainnet/fulu/networking/compute_columns_f OK
+ Networking - Compute Columns for Custody Group - mainnet/fulu/networking/compute_columns_f OK
+ Networking - Compute Columns for Custody Group - mainnet/fulu/networking/compute_columns_f OK
+ Networking - Compute Columns for Custody Group - mainnet/fulu/networking/compute_columns_f OK
+ Networking - Get Custody Groups - mainnet/fulu/networking/get_custody_groups/pyspec_tests/ OK
+ Networking - Get Custody Groups - mainnet/fulu/networking/get_custody_groups/pyspec_tests/ OK
+ Networking - Get Custody Groups - mainnet/fulu/networking/get_custody_groups/pyspec_tests/ OK
Expand All @@ -523,7 +528,7 @@ OK: 56/56 Fail: 0/56 Skip: 0/56
+ Networking - Get Custody Groups - mainnet/fulu/networking/get_custody_groups/pyspec_tests/ OK
+ Networking - Get Custody Groups - mainnet/fulu/networking/get_custody_groups/pyspec_tests/ OK
```
OK: 9/9 Fail: 0/9 Skip: 0/9
OK: 14/14 Fail: 0/14 Skip: 0/14
## EF - SSZ generic types
```diff
Testing basic_vector inputs - invalid Skip
Expand Down Expand Up @@ -1144,4 +1149,4 @@ OK: 2/2 Fail: 0/2 Skip: 0/2
OK: 9/9 Fail: 0/9 Skip: 0/9

---TOTAL---
OK: 777/782 Fail: 0/782 Skip: 5/782
OK: 782/787 Fail: 0/787 Skip: 5/787
2 changes: 1 addition & 1 deletion beacon_chain/spec/peerdas_helpers.nim
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type
ProofBytes = array[fulu.CELLS_PER_EXT_BLOB, KzgProof]

# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.10/specs/fulu/das-core.md#compute_columns_for_custody_group
iterator compute_columns_for_custody_group(custody_group: CustodyIndex):
iterator compute_columns_for_custody_group*(custody_group: CustodyIndex):
ColumnIndex =
agnxsh marked this conversation as resolved.
Show resolved Hide resolved
for i in 0'u64 ..< COLUMNS_PER_GROUP:
yield ColumnIndex(NUMBER_OF_CUSTODY_GROUPS * i + custody_group)
Expand Down
39 changes: 33 additions & 6 deletions tests/consensus_spec/test_fixture_networking.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{.used.}

import
std/[json, streams],
std/[json, streams, sequtils],
yaml,
kzg4844/[kzg, kzg_abi],
stint,
Expand All @@ -20,7 +20,28 @@ import

from std/sequtils import mapIt
agnxsh marked this conversation as resolved.
Show resolved Hide resolved

proc runGetCustodyColumns(suiteName, path: string) =
proc runComputeForCustodyGroup(suiteName, path: string) =
let relativeTestPathComponent = path.relativeTestPathComponent()
test "Networking - Compute Columns for Custody Group - " &
relativeTestPathComponent:
type TestMetaYaml = object
custody_group: uint64
result: seq[uint64]
let
meta = block:
var s = openFileStream(path/"meta.yaml")
defer: close(s)
var res: TestMetaYaml
yaml.load(s, res)
res
custody_group = meta.custody_group
reslt = (meta.result).mapIt(it)
agnxsh marked this conversation as resolved.
Show resolved Hide resolved
let columns = compute_columns_for_custody_group(custody_group).toSeq

for i in 0..<columns.lenu64:
agnxsh marked this conversation as resolved.
Show resolved Hide resolved
check columns[i] == reslt[i]

proc runGetCustodyGroups(suiteName, path: string) =
let relativePathComponent = path.relativeTestPathComponent()
test "Networking - Get Custody Groups - " & relativePathComponent:
type TestMetaYaml = object
Expand All @@ -46,7 +67,13 @@ proc runGetCustodyColumns(suiteName, path: string) =
suite "EF - PeerDAS - Networking" & preset():
const presetPath = SszTestsDir/const_preset
# foldering to be resolved in alpha 11 release of consensus spec tests
let basePath =
presetPath/"fulu"/"networking"/"get_custody_groups"/"pyspec_tests"
for kind, path in walkDir(basePath, relative = true, checkDir = true):
runGetCustodyColumns(suiteName, basePath/path)
block:
let basePath =
presetPath/"fulu"/"networking"/"get_custody_groups"/"pyspec_tests"
for kind, path in walkDir(basePath, relative = true, checkDir = true):
runGetCustodyGroups(suiteName, basePath/path)
block:
let basePath =
presetPath/"fulu"/"networking"/"compute_columns_for_custody_group"/"pyspec_tests"
for kind, path in walkDir(basePath, relative = true, checkDir = true):
runComputeForCustodyGroup(suiteName, basePath/path)
Loading