Zebra/zebra-consensus/src
Janito Vaqueiro Ferreira Filho 2e0318878a
Further test new transaction consensus rules (#2246)
* Add a `at_least_one!` macro for testing

Similar to the `vec!` macro, but doesn't allow creating an empty list.

* Test if `has_inputs_and_outputs` considers actions

Create a dummy transaction with no inputs and no outputs, and add a
dummy Orchard action to it. The `check::has_inputs_and_outputs`
should succeed, because the consensus rule considers having Orchard
actions as having inputs and/or outputs.

* Refactor to create helper function

Move the code to create a fake Orchard shielded data instance to a
helper function in `zebra_chain::transaction::arbitrary`, so that other
tests can also use it.

* Test coinbase V5 transaction with enable spends

A V5 coinbase transaction that has Orchard shielded data MUST NOT have
the enable spends flag set.

* Test if coinbase without enable spends is valid

A coinbase transaction with Orchard shielded data and without the enable
spends flag set should be valid.

* Add a security comment about the `at_least_one!` macro

This macro must not be used outside tests, because it allows memory denial
of service.

Co-authored-by: teor <teor@riseup.net>
2021-06-07 12:02:18 +10:00
..
block Standardise clippy lints and require docs (#2238) 2021-06-04 08:48:40 +10:00
chain Standardise clippy lints and require docs (#2238) 2021-06-04 08:48:40 +10:00
checkpoint Make sure the mandatory checkpoint includes Canopy activation (#2235) 2021-06-03 10:24:08 +10:00
parameters Replace smart quotes with ascii quotes 2021-03-15 03:18:10 -04:00
primitives Rename shielded_data to sapling_shielded_data as needed (#2072) 2021-04-27 10:37:53 -03:00
transaction Further test new transaction consensus rules (#2246) 2021-06-07 12:02:18 +10:00
block.rs Validate nConsensusBranchId (#2100) 2021-05-10 01:31:45 +00:00
chain.rs Standardise clippy lints and require docs (#2238) 2021-06-04 08:48:40 +10:00
checkpoint.rs Validate nConsensusBranchId (#2100) 2021-05-10 01:31:45 +00:00
config.rs Make sure the mandatory checkpoint includes Canopy activation (#2235) 2021-06-03 10:24:08 +10:00
error.rs Update `transaction::check::coinbase_tx_no_joinsplit_or_spend` to validate V5 coinbase transactions with Orchard shielded data (#2236) 2021-06-03 01:54:08 +00:00
lib.rs Standardise clippy lints and require docs (#2238) 2021-06-04 08:48:40 +10:00
parameters.rs move genesis parameters to zebra-chain (#1151) 2020-10-12 14:08:23 -07:00
primitives.rs Ed25519 async batch verification for JoinSplit signatures (#1952) 2021-03-31 09:08:19 +10:00
script.rs Make the state usage clearer in script::Verifier (#1733) 2021-02-16 05:53:12 +10:00
transaction.rs Move the check in `transaction::check::sapling_balances_match` to `V4` deserialization (#2234) 2021-06-04 08:53:00 +10:00