From 7eaaab908cf249f981d8d36efd83663e79e5105e Mon Sep 17 00:00:00 2001 From: tersec Date: Wed, 30 Sep 2020 13:12:03 +0000 Subject: [PATCH] fix output of proposer slashing test fixture (#1780) * fix output of proposer slashing test fixture * run make test * a few more v0.12.3 spec refs --- FixtureAll-mainnet.md | 20 +++++++++++++++---- beacon_chain/block_pools/chain_dag.nim | 2 +- beacon_chain/ssz/merkleization.nim | 2 +- beacon_chain/ssz/ssz_serialization.nim | 4 ++-- beacon_chain/time.nim | 2 +- docs/the_nimbus_book/src/intro.md | 2 +- scripts/run_ssz_fuzzing_test.nims | 2 +- ..._fixture_operations_proposer_slashings.nim | 2 +- tests/official/test_fixture_rewards.nim | 2 +- 9 files changed, 25 insertions(+), 13 deletions(-) diff --git a/FixtureAll-mainnet.md b/FixtureAll-mainnet.md index d1e5d1b38..a87bf4584 100644 --- a/FixtureAll-mainnet.md +++ b/FixtureAll-mainnet.md @@ -130,10 +130,22 @@ OK: 6/6 Fail: 0/6 Skip: 0/6 OK: 11/11 Fail: 0/11 Skip: 0/11 ## Official - Operations - Proposer slashing [Preset: mainnet] ```diff -+ [Invalid] identifier OK -+ [Valid] identifier OK ++ [Invalid] epochs_are_different OK ++ [Invalid] headers_are_same_sigs_are_different OK ++ [Invalid] headers_are_same_sigs_are_same OK ++ [Invalid] invalid_different_proposer_indices OK ++ [Invalid] invalid_proposer_index OK ++ [Invalid] invalid_sig_1 OK ++ [Invalid] invalid_sig_1_and_2 OK ++ [Invalid] invalid_sig_1_and_2_swap OK ++ [Invalid] invalid_sig_2 OK ++ [Invalid] proposer_is_not_activated OK ++ [Invalid] proposer_is_slashed OK ++ [Invalid] proposer_is_withdrawn OK ++ [Valid] success OK ++ [Valid] success_slashed_and_proposer_index_the_same OK ``` -OK: 2/2 Fail: 0/2 Skip: 0/2 +OK: 14/14 Fail: 0/14 Skip: 0/14 ## Official - Operations - Voluntary exit [Preset: mainnet] ```diff + [Invalid] invalid_signature OK @@ -242,4 +254,4 @@ OK: 32/32 Fail: 0/32 Skip: 0/32 OK: 5/5 Fail: 0/5 Skip: 0/5 ---TOTAL--- -OK: 184/184 Fail: 0/184 Skip: 0/184 +OK: 196/196 Fail: 0/196 Skip: 0/196 diff --git a/beacon_chain/block_pools/chain_dag.nim b/beacon_chain/block_pools/chain_dag.nim index fbda34584..0a547a2f8 100644 --- a/beacon_chain/block_pools/chain_dag.nim +++ b/beacon_chain/block_pools/chain_dag.nim @@ -185,7 +185,7 @@ func isAncestorOf*(a, b: BlockRef): bool = b = b.parent func get_ancestor*(blck: BlockRef, slot: Slot): BlockRef = - ## https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/fork-choice.md#get_ancestor + ## https://github.com/ethereum/eth2.0-specs/blob/v0.12.3/specs/phase0/fork-choice.md#get_ancestor ## Return the most recent block as of the time at `slot` that not more recent ## than `blck` itself doAssert not blck.isNil diff --git a/beacon_chain/ssz/merkleization.nim b/beacon_chain/ssz/merkleization.nim index 4c88a7d14..1a0e2174a 100644 --- a/beacon_chain/ssz/merkleization.nim +++ b/beacon_chain/ssz/merkleization.nim @@ -7,7 +7,7 @@ # This module contains the parts necessary to create a merkle hash from the core # SSZ types outlined in the spec: -# https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/ssz/simple-serialize.md#merkleization +# https://github.com/ethereum/eth2.0-specs/blob/v0.12.3/ssz/simple-serialize.md#merkleization {.push raises: [Defect].} diff --git a/beacon_chain/ssz/ssz_serialization.nim b/beacon_chain/ssz/ssz_serialization.nim index c26563ee4..f77676769 100644 --- a/beacon_chain/ssz/ssz_serialization.nim +++ b/beacon_chain/ssz/ssz_serialization.nim @@ -3,8 +3,8 @@ # {.push raises: [Defect].} {.pragma: raisesssz, raises: [Defect, MalformedSszError, SszSizeMismatchError].} -## SSZ serialiazation for core SSZ types, as specified in: -# https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/ssz/simple-serialize.md#serialization +## SSZ serialization for core SSZ types, as specified in: +# https://github.com/ethereum/eth2.0-specs/blob/v0.12.3/ssz/simple-serialize.md#serialization import typetraits, options, diff --git a/beacon_chain/time.nim b/beacon_chain/time.nim index 6aa2c7b6a..640510d28 100644 --- a/beacon_chain/time.nim +++ b/beacon_chain/time.nim @@ -16,7 +16,7 @@ type ## which blocks are valid - in particular, blocks are not valid if they ## come from the future as seen from the local clock. ## - ## https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/fork-choice.md#fork-choice + ## https://github.com/ethereum/eth2.0-specs/blob/v0.12.3/specs/phase0/fork-choice.md#fork-choice ## # TODO replace time in chronos with a proper unit type, then this code can # follow: diff --git a/docs/the_nimbus_book/src/intro.md b/docs/the_nimbus_book/src/intro.md index d4aa0c40c..dc33f09f1 100644 --- a/docs/the_nimbus_book/src/intro.md +++ b/docs/the_nimbus_book/src/intro.md @@ -5,7 +5,7 @@ The Nimbus beacon chain is a research implementation of the Beacon Chain – the - Open sourced at [github.com/status-im/nim-beacon-chain](https://github.com/status-im/nim-beacon-chain/tree/master) -- Specification described at [ethereum/eth2.0-specs](https://github.com/ethereum/eth2.0-specs/tree/v0.12.2#phase-0) +- Specification described at [ethereum/eth2.0-specs](https://github.com/ethereum/eth2.0-specs/tree/v0.12.3#phase-0) ### Helpful resources diff --git a/scripts/run_ssz_fuzzing_test.nims b/scripts/run_ssz_fuzzing_test.nims index 8ff411e86..aba710477 100644 --- a/scripts/run_ssz_fuzzing_test.nims +++ b/scripts/run_ssz_fuzzing_test.nims @@ -4,7 +4,7 @@ import testutils/fuzzing_engines const gitRoot = thisDir() / ".." - fixturesDir = gitRoot / "vendor" / "nim-eth2-scenarios" / "tests-v0.12.2" / "mainnet" / "phase0" / "ssz_static" + fixturesDir = gitRoot / "vendor" / "nim-eth2-scenarios" / "tests-v0.12.3" / "mainnet" / "phase0" / "ssz_static" fuzzingTestsDir = gitRoot / "tests" / "fuzzing" fuzzingCorpusesDir = fuzzingTestsDir / "corpus" diff --git a/tests/official/test_fixture_operations_proposer_slashings.nim b/tests/official/test_fixture_operations_proposer_slashings.nim index 45b777f3c..9778e1f27 100644 --- a/tests/official/test_fixture_operations_proposer_slashings.nim +++ b/tests/official/test_fixture_operations_proposer_slashings.nim @@ -38,7 +38,7 @@ proc runTest(identifier: string) = else: prefix = "[Invalid] " - timedTest prefix & astToStr(identifier): + timedTest prefix & identifier: let proposerSlashing = parseTest(testDir/"proposer_slashing.ssz", SSZ, ProposerSlashing) var preState = newClone(parseTest(testDir/"pre.ssz", SSZ, BeaconState)) diff --git a/tests/official/test_fixture_rewards.nim b/tests/official/test_fixture_rewards.nim index bf1ec491b..8a6eb9fd0 100644 --- a/tests/official/test_fixture_rewards.nim +++ b/tests/official/test_fixture_rewards.nim @@ -25,7 +25,7 @@ const RewardsDirLeak = RewardsDirBase/"leak"/"pyspec_tests" RewardsDirRandom = RewardsDirBase/"random"/"pyspec_tests" -# https://github.com/ethereum/eth2.0-specs/tree/v0.12.2/tests/formats/rewards#rewards-tests +# https://github.com/ethereum/eth2.0-specs/tree/v0.12.3/tests/formats/rewards#rewards-tests type Deltas = object rewards: List[uint64, Limit VALIDATOR_REGISTRY_LIMIT] penalties: List[uint64, Limit VALIDATOR_REGISTRY_LIMIT]