fix(build): Stop using a test-only method in production code (#4000)

* Make proptest-impl features consistently depend on each other

* Use a non-test method for consensus checks

* Make proptest dependencies the same between crates
This commit is contained in:
teor 2022-03-31 04:23:55 +10:00 committed by GitHub
parent a12d5df695
commit d767f43fd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 10 deletions

1
Cargo.lock generated
View File

@ -5757,6 +5757,7 @@ dependencies = [
"jsonrpc-derive",
"jsonrpc-http-server",
"proptest",
"proptest-derive",
"serde",
"serde_json",
"thiserror",

View File

@ -7,7 +7,7 @@ edition = "2021"
[features]
default = []
proptest-impl = ["proptest", "proptest-derive", "zebra-chain/proptest-impl"]
proptest-impl = ["proptest", "proptest-derive", "zebra-chain/proptest-impl", "zebra-state/proptest-impl"]
[dependencies]
blake2b_simd = "1.0.0"

View File

@ -495,7 +495,7 @@ where
crate::block::check::equihash_solution_is_valid(&block.header)?;
// don't do precalculation until the block passes basic difficulty checks
let block = FinalizedBlock::with_hash_and_height(block, hash, height);
let block = FinalizedBlock::with_hash(block, hash);
crate::block::check::merkle_root_validity(
self.network,

View File

@ -7,6 +7,10 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
default = []
proptest-impl = ["proptest", "proptest-derive", "zebra-chain/proptest-impl", "zebra-state/proptest-impl"]
[dependencies]
zebra-chain = { path = "../zebra-chain" }
zebra-network = { path = "../zebra-network" }
@ -35,8 +39,12 @@ tracing-futures = "0.2.5"
hex = { version = "0.4.3", features = ["serde"] }
serde = { version = "1.0.136", features = ["serde_derive"] }
proptest = { version = "0.10.1", optional = true }
proptest-derive = { version = "0.3.0", optional = true }
[dev-dependencies]
proptest = "0.10.1"
proptest-derive = "0.3.0"
serde_json = "1.0.79"
thiserror = "1.0.30"
tokio = { version = "1.16.1", features = ["full", "test-util"] }

View File

@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0"
edition = "2021"
[features]
proptest-impl = ["proptest", "proptest-derive", "zebra-test"]
proptest-impl = ["proptest", "proptest-derive", "zebra-test", "zebra-chain/proptest-impl"]
[dependencies]
bincode = "1.3.3"

View File

@ -9,6 +9,16 @@ repository = "https://github.com/ZcashFoundation/zebra"
# when run in the workspace directory
default-run = "zebrad"
[features]
default = []
proptest-impl = ["proptest", "proptest-derive", "zebra-chain/proptest-impl", "zebra-state/proptest-impl", "zebra-consensus/proptest-impl", "zebra-network/proptest-impl"]
enable-sentry = []
test_sync_to_mandatory_checkpoint_mainnet = []
test_sync_to_mandatory_checkpoint_testnet = []
test_sync_past_mandatory_checkpoint_mainnet = []
test_sync_past_mandatory_checkpoint_testnet = []
[dependencies]
zebra-chain = { path = "../zebra-chain" }
zebra-consensus = { path = "../zebra-consensus/" }
@ -53,6 +63,9 @@ sentry = { version = "0.23.0", default-features = false, features = ["backtrace"
num-integer = "0.1.44"
rand = { version = "0.8.5", package = "rand" }
proptest = { version = "0.10.1", optional = true }
proptest-derive = { version = "0.3.0", optional = true }
[build-dependencies]
vergen = { version = "7.0.0", default-features = false, features = ["cargo", "git"] }
@ -74,10 +87,3 @@ zebra-consensus = { path = "../zebra-consensus/", features = ["proptest-impl"] }
zebra-network = { path = "../zebra-network", features = ["proptest-impl"] }
zebra-state = { path = "../zebra-state", features = ["proptest-impl"] }
zebra-test = { path = "../zebra-test" }
[features]
enable-sentry = []
test_sync_to_mandatory_checkpoint_mainnet = []
test_sync_to_mandatory_checkpoint_testnet = []
test_sync_past_mandatory_checkpoint_mainnet = []
test_sync_past_mandatory_checkpoint_testnet = []