From 55e398c10a5d6da719167c73644eba85750cdc94 Mon Sep 17 00:00:00 2001 From: teor Date: Thu, 20 May 2021 08:53:44 +1000 Subject: [PATCH] Stop generating V1-V3 transactions for non-finalized state proptests (#2159) These transactions cause a test panic in `UpdateWith`, in the rare cases where the test gets that far. --- .../service/non_finalized_state/tests/prop.txt | 1 + .../src/service/non_finalized_state/arbitrary.rs | 15 ++++----------- 2 files changed, 5 insertions(+), 11 deletions(-) create mode 100644 zebra-state/proptest-regressions/service/non_finalized_state/tests/prop.txt diff --git a/zebra-state/proptest-regressions/service/non_finalized_state/tests/prop.txt b/zebra-state/proptest-regressions/service/non_finalized_state/tests/prop.txt new file mode 100644 index 000000000..3e15a78b7 --- /dev/null +++ b/zebra-state/proptest-regressions/service/non_finalized_state/tests/prop.txt @@ -0,0 +1 @@ +cc 693962399f2771634758dccac882604c14751015ac280113fa9127fa96376c3a # entered unreachable code: older transaction versions only exist in finalized blocks pre sapling; PreparedBlock { .. , Block { .. , transactions: [V2 { .. }, .. ] } }; diff --git a/zebra-state/src/service/non_finalized_state/arbitrary.rs b/zebra-state/src/service/non_finalized_state/arbitrary.rs index ad44dc2cd..6d0c0fada 100644 --- a/zebra-state/src/service/non_finalized_state/arbitrary.rs +++ b/zebra-state/src/service/non_finalized_state/arbitrary.rs @@ -49,18 +49,11 @@ impl Strategy for PreparedChain { fn new_tree(&self, runner: &mut TestRunner) -> NewTree { let mut chain = self.chain.lock().unwrap(); if chain.is_none() { - let ledger_strategy = LedgerState::coinbase_strategy(); + // Only generate blocks from the most recent network upgrade + let mut ledger_state = LedgerState::default(); + ledger_state.network_upgrade_override = None; - // Disable the NU5 override until UpdateWith is implemented for Tx v5 (#1982) - let ledger_strategy = ledger_strategy.prop_map(|mut ledger_state| { - ledger_state.network_upgrade_override = None; - ledger_state - }); - - let blocks = ledger_strategy - .prop_flat_map(|ledger_state| { - Block::partial_chain_strategy(ledger_state, MAX_PARTIAL_CHAIN_BLOCKS) - }) + let blocks = Block::partial_chain_strategy(ledger_state, MAX_PARTIAL_CHAIN_BLOCKS) .prop_map(|vec| vec.into_iter().map(|blk| blk.prepare()).collect::>()) .new_tree(runner)? .current();