From 6ffd41650b11467f9c225b40a2523e1d7112eb3e Mon Sep 17 00:00:00 2001 From: protolambda Date: Tue, 28 May 2019 15:35:00 +0200 Subject: [PATCH] suggestion from hww, reduce into one bls_setting key --- specs/test_formats/README.md | 12 ++++++++++++ specs/test_formats/epoch_processing/README.md | 3 +-- specs/test_formats/operations/README.md | 3 +-- specs/test_formats/sanity/blocks.md | 3 +-- specs/test_formats/sanity/slots.md | 3 +-- test_libs/pyspec/eth2spec/test/context.py | 4 ++-- 6 files changed, 18 insertions(+), 10 deletions(-) diff --git a/specs/test_formats/README.md b/specs/test_formats/README.md index 273659ce9..d245fcfa4 100644 --- a/specs/test_formats/README.md +++ b/specs/test_formats/README.md @@ -176,6 +176,18 @@ To prevent parsing of hundreds of different YAML files to test a specific test t ... <--- more test types ``` +## Common test-case properties + +Some test-case formats share some common key-value pair patterns, and these are documented here: + +``` +bls_setting: int -- optional, can have 3 different values: + 0: (default, applies if key-value pair is absent). Free to choose either BLS ON or OFF. + Tests are generated with valid BLS data in this case, + but there is no change of outcome when running the test if BLS is ON or OFF. + 1: known as "BLS required" - if the test validity is strictly dependent on BLS being ON + 2: known as "BLS ignored" - if the test validity is strictly dependent on BLS being OFF +``` ## Note for implementers diff --git a/specs/test_formats/epoch_processing/README.md b/specs/test_formats/epoch_processing/README.md index 117be89d1..d3dbfcbd9 100644 --- a/specs/test_formats/epoch_processing/README.md +++ b/specs/test_formats/epoch_processing/README.md @@ -9,8 +9,7 @@ Hence, the format is shared between each test-handler. (See test condition docum ```yaml description: string -- description of test case, purely for debugging purposes -bls_required: bool -- optional, true if the test validity is strictly dependent on BLS being ON. False otherwise. -bls_ignored: bool -- optional, true if the test validity is strictly dependent on BLS being OFF. False otherwise. +bls_setting: int -- see general test-format spec. pre: BeaconState -- state before running the sub-transition post: BeaconState -- state after applying the epoch sub-transition. ``` diff --git a/specs/test_formats/operations/README.md b/specs/test_formats/operations/README.md index 039e01a2f..04e24ddad 100644 --- a/specs/test_formats/operations/README.md +++ b/specs/test_formats/operations/README.md @@ -6,8 +6,7 @@ The different kinds of operations ("transactions") are tested individually with ```yaml description: string -- description of test case, purely for debugging purposes -bls_required: bool -- optional, true if the test validity is strictly dependent on BLS being ON. False otherwise. -bls_ignored: bool -- optional, true if the test validity is strictly dependent on BLS being OFF. False otherwise. +bls_setting: int -- see general test-format spec. pre: BeaconState -- state before applying the operation : -- the YAML encoded operation, e.g. a "ProposerSlashing", or "Deposit". post: BeaconState -- state after applying the operation. No value if operation processing is aborted. diff --git a/specs/test_formats/sanity/blocks.md b/specs/test_formats/sanity/blocks.md index 696813740..3004a6de7 100644 --- a/specs/test_formats/sanity/blocks.md +++ b/specs/test_formats/sanity/blocks.md @@ -6,8 +6,7 @@ Sanity tests to cover a series of one or more blocks being processed, aiming to ```yaml description: string -- description of test case, purely for debugging purposes -bls_required: bool -- optional, true if the test validity is strictly dependent on BLS being ON. False otherwise. -bls_ignored: bool -- optional, true if the test validity is strictly dependent on BLS being OFF. False otherwise. +bls_setting: int -- see general test-format spec. pre: BeaconState -- state before running through the transitions triggered by the blocks. blocks: [BeaconBlock] -- blocks to process, in given order, following the main transition function (i.e. process slot and epoch transitions in between blocks as normal) post: BeaconState -- state after applying all the transitions triggered by the blocks. diff --git a/specs/test_formats/sanity/slots.md b/specs/test_formats/sanity/slots.md index e8961608d..81866d47b 100644 --- a/specs/test_formats/sanity/slots.md +++ b/specs/test_formats/sanity/slots.md @@ -6,8 +6,7 @@ Sanity tests to cover a series of one or more empty-slot transitions being proce ```yaml description: string -- description of test case, purely for debugging purposes -bls_required: bool -- optional, true if the test validity is strictly dependent on BLS being ON. False otherwise. -bls_ignored: bool -- optional, true if the test validity is strictly dependent on BLS being OFF. False otherwise. +bls_setting: int -- see general test-format spec. pre: BeaconState -- state before running through the transitions. slots: N -- amount of slots to process, N being a positive numer. post: BeaconState -- state after applying all the transitions. diff --git a/test_libs/pyspec/eth2spec/test/context.py b/test_libs/pyspec/eth2spec/test/context.py index a484cc995..2be9322de 100644 --- a/test_libs/pyspec/eth2spec/test/context.py +++ b/test_libs/pyspec/eth2spec/test/context.py @@ -39,7 +39,7 @@ def expect_assertion_error(fn): # Tags a test to be ignoring BLS for it to pass. -bls_ignored = with_tags({'bls_ignored': True}) +bls_ignored = with_tags({'bls_setting': 2}) def never_bls(fn): @@ -54,7 +54,7 @@ def never_bls(fn): # Tags a test to be requiring BLS for it to pass. -bls_required = with_tags({'bls_required': True}) +bls_required = with_tags({'bls_setting': 1}) def always_bls(fn):