Use valuable::Enumerable to iterate through network upgrades #1974
Labels
A-rust
Area: Updates to Rust code
C-cleanup
Category: This is a cleanup
C-enhancement
Category: This is an improvement
S-blocked
Status: Blocked on other tasks
Is your feature request related to a problem? Please describe.
Some of Zebra's tests iterate through the entire set of network upgrades. Others want to know the latest network upgrade, even if it doesn't have an activation height.
If we use the valuable crate's Enumerable derive, we won't need to change these tests every time we add a new network upgrade.
https://github.com/tokio-rs/valuable
Describe the solution you'd like
valuable
to be published to https://crates.io/crates/valuableEnumerable
forNetworkUpgrade
A list of network upgrades:
version_consistent
test to useEnumerable
'sEnumDef
zebra_chain::parameters
tests could also useEnumDef
The latest network upgrade (even if it doesn't have an activation height):
EnumDef
to find future network upgrades inArbitrary for LedgerState
Default for LedgerState
andLedgerStateOverride
if we haven't removed them in Increase proptest coverage using arbitrary LedgerStates #2059Canopy
,NU5
, and future network upgrades with a "latest network upgrade" function, as neededNU5
constant inzebra-chain/src/transaction/tests/vectors.rs
with the latest network upgradeTransaction::branch_id()
strategy withEnumDef
, a "has branch id" filter, then a random choiceDescribe alternatives you've considered
We could use
strum
, but we're going to have thevaluable
dependency whentracing
hits 1.0 anywayhttps://docs.rs/strum/0.20.0/strum/
We could do nothing.
The text was updated successfully, but these errors were encountered: