Skip to content

Commit

Permalink
fix(build): Stop using a test-only method in production code (#4000)
Browse files Browse the repository at this point in the history
* Make proptest-impl features consistently depend on each other

* Use a non-test method for consensus checks

* Make proptest dependencies the same between crates
  • Loading branch information
teor2345 authored Mar 30, 2022
1 parent a12d5df commit d767f43
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 10 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion zebra-consensus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion zebra-consensus/src/checkpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 8 additions & 0 deletions zebra-rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down Expand Up @@ -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"] }
Expand Down
2 changes: 1 addition & 1 deletion zebra-state/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
20 changes: 13 additions & 7 deletions zebrad/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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/" }
Expand Down Expand Up @@ -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"] }

Expand All @@ -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 = []

0 comments on commit d767f43

Please sign in to comment.