From 84ce0c912ed359836aabdb8b5ece7898ec13971f Mon Sep 17 00:00:00 2001 From: Kim De Mey Date: Tue, 23 Jul 2024 11:59:59 +0200 Subject: [PATCH] Bump Portal test vectors and re-activate skipped tests (#2515) --- fluffy/scripts/test_portal_testnet.nim | 3 +- .../test_history_block_proof_bellatrix.nim | 30 ++++++++-------- .../test_history_block_proof_capella.nim | 34 +++++++++---------- .../mainnet/test_history_content.nim | 3 +- vendor/portal-spec-tests | 2 +- 5 files changed, 33 insertions(+), 39 deletions(-) diff --git a/fluffy/scripts/test_portal_testnet.nim b/fluffy/scripts/test_portal_testnet.nim index 89e7d1b28..5fc51a4c7 100644 --- a/fluffy/scripts/test_portal_testnet.nim +++ b/fluffy/scripts/test_portal_testnet.nim @@ -247,8 +247,7 @@ procSuite "Portal testnet tests": headerFile = "./vendor/portal-spec-tests/tests/mainnet/history/headers/1000001-1000010.e2s" accumulatorFile = - "./vendor/portal-spec-tests/tests/mainnet/history/accumulator/epoch-accumulator-00122.ssz" - # TODO: rename + "./vendor/portal-spec-tests/tests/mainnet/history/accumulator/epoch-record-00122.ssz" blockDataFile = "./fluffy/tests/blocks/mainnet_blocks_1000001_1000010.json" let diff --git a/fluffy/tests/portal_spec_tests/mainnet/test_history_block_proof_bellatrix.nim b/fluffy/tests/portal_spec_tests/mainnet/test_history_block_proof_bellatrix.nim index 664bfe467..767cefb9f 100644 --- a/fluffy/tests/portal_spec_tests/mainnet/test_history_block_proof_bellatrix.nim +++ b/fluffy/tests/portal_spec_tests/mainnet/test_history_block_proof_bellatrix.nim @@ -26,21 +26,19 @@ suite "History Block Proofs - Bellatrix": "./vendor/portal-spec-tests/tests/mainnet/history/headers_with_proof/block_proofs_bellatrix/" historicalRoots = loadHistoricalRoots() - # TODO: reactivate when test vectors PR gets merged - skip() - # for kind, path in walkDir(testsPath): - # if kind == pcFile and path.splitFile.ext == ".yaml": - # let - # testProof = YamlTestProofBellatrix.loadFromYaml(path).valueOr: - # raiseAssert "Cannot read test vector: " & error + for kind, path in walkDir(testsPath): + if kind == pcFile and path.splitFile.ext == ".yaml": + let + testProof = YamlTestProofBellatrix.loadFromYaml(path).valueOr: + raiseAssert "Cannot read test vector: " & error - # blockHash = BlockHash.fromHex(testProof.execution_block_header) - # blockProof = BeaconChainBlockProof( - # beaconBlockProof: array[11, Digest].fromHex(testProof.beacon_block_proof), - # beaconBlockRoot: Digest.fromHex(testProof.beacon_block_root), - # historicalRootsProof: - # array[14, Digest].fromHex(testProof.historical_roots_proof), - # slot: Slot(testProof.slot), - # ) + blockHash = BlockHash.fromHex(testProof.execution_block_header) + blockProof = BeaconChainBlockProof( + beaconBlockProof: array[11, Digest].fromHex(testProof.beacon_block_proof), + beaconBlockRoot: Digest.fromHex(testProof.beacon_block_root), + historicalRootsProof: + array[14, Digest].fromHex(testProof.historical_roots_proof), + slot: Slot(testProof.slot), + ) - # check verifyProof(historicalRoots, blockProof, blockHash) + check verifyProof(historicalRoots, blockProof, blockHash) diff --git a/fluffy/tests/portal_spec_tests/mainnet/test_history_block_proof_capella.nim b/fluffy/tests/portal_spec_tests/mainnet/test_history_block_proof_capella.nim index a9cfe6174..365467b06 100644 --- a/fluffy/tests/portal_spec_tests/mainnet/test_history_block_proof_capella.nim +++ b/fluffy/tests/portal_spec_tests/mainnet/test_history_block_proof_capella.nim @@ -55,23 +55,21 @@ suite "History Block Proofs - Capella": historicalSummaries = readHistoricalSummaries(historicalSummaries_path).valueOr: raiseAssert "Cannot read historical summaries: " & error - # TODO: reactivate when test vectors PR gets merged - skip() - # for kind, path in walkDir(testsPath): - # if kind == pcFile and path.splitFile.ext == ".yaml": - # let - # testProof = YamlTestProof.loadFromYaml(path).valueOr: - # raiseAssert "Cannot read test vector: " & error + for kind, path in walkDir(testsPath): + if kind == pcFile and path.splitFile.ext == ".yaml": + let + testProof = YamlTestProof.loadFromYaml(path).valueOr: + raiseAssert "Cannot read test vector: " & error - # blockHash = BlockHash.fromHex(testProof.execution_block_header) - # blockProof = BeaconChainBlockProof( - # beaconBlockProof: array[11, Digest].fromHex(testProof.beacon_block_proof), - # beaconBlockRoot: Digest.fromHex(testProof.beacon_block_root), - # historicalSummariesProof: - # array[13, Digest].fromHex(testProof.historical_summaries_proof), - # slot: Slot(testProof.slot), - # ) + blockHash = BlockHash.fromHex(testProof.execution_block_header) + blockProof = BeaconChainBlockProof( + beaconBlockProof: array[11, Digest].fromHex(testProof.beacon_block_proof), + beaconBlockRoot: Digest.fromHex(testProof.beacon_block_root), + historicalSummariesProof: + array[13, Digest].fromHex(testProof.historical_summaries_proof), + slot: Slot(testProof.slot), + ) - # check verifyProof( - # historicalSummaries, blockProof, blockHash, networkData.metadata.cfg - # ) + check verifyProof( + historicalSummaries, blockProof, blockHash, networkData.metadata.cfg + ) diff --git a/fluffy/tests/portal_spec_tests/mainnet/test_history_content.nim b/fluffy/tests/portal_spec_tests/mainnet/test_history_content.nim index d37406632..15b58f17a 100644 --- a/fluffy/tests/portal_spec_tests/mainnet/test_history_content.nim +++ b/fluffy/tests/portal_spec_tests/mainnet/test_history_content.nim @@ -27,8 +27,7 @@ suite "History Content Encodings": headerFile = "./vendor/portal-spec-tests/tests/mainnet/history/headers/1000001-1000010.e2s" accumulatorFile = - "./vendor/portal-spec-tests/tests/mainnet/history/accumulator/epoch-accumulator-00122.ssz" - # TODO: rename + "./vendor/portal-spec-tests/tests/mainnet/history/accumulator/epoch-record-00122.ssz" headersWithProofFile = "./vendor/portal-spec-tests/tests/mainnet/history/headers_with_proof/1000001-1000010.json" diff --git a/vendor/portal-spec-tests b/vendor/portal-spec-tests index af2360565..4254dac8c 160000 --- a/vendor/portal-spec-tests +++ b/vendor/portal-spec-tests @@ -1 +1 @@ -Subproject commit af2360565c4ed5342bb5533bace4e2b9712e0d1b +Subproject commit 4254dac8ce1cbe28fc4704d92aa6809c73451c20