Skip to content

Commit

Permalink
Fixed formatting, added cfg param 'zcash_unstable' for clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
mariopil committed Oct 14, 2024
1 parent 78b36c9 commit 6c6bf03
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 17 deletions.
3 changes: 3 additions & 0 deletions zebra-chain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,6 @@ required-features = ["bench"]
[[bench]]
name = "redpallas"
harness = false

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(zcash_unstable, values("nsm"))'] }
3 changes: 3 additions & 0 deletions zebra-consensus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,6 @@ tracing-subscriber = "0.3.18"
zebra-state = { path = "../zebra-state", version = "1.0.0-beta.39", features = ["proptest-impl"] }
zebra-chain = { path = "../zebra-chain", version = "1.0.0-beta.39", features = ["proptest-impl"] }
zebra-test = { path = "../zebra-test/", version = "1.0.0-beta.39" }

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(zcash_unstable, values("nsm"))'] }
25 changes: 9 additions & 16 deletions zebra-consensus/src/block/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,7 @@ fn subsidy_is_valid_for_network(network: Network) -> Result<(), Report> {
// TODO: first halving, second halving, third halving, and very large halvings
if height >= canopy_activation_height {
let expected_block_subsidy =
subsidy::general::block_subsidy(height, &network)
.expect("valid block subsidy");
subsidy::general::block_subsidy(height, &network).expect("valid block subsidy");

check::subsidy_is_valid(&block, &network, expected_block_subsidy)
.expect("subsidies should pass for this block");
Expand Down Expand Up @@ -344,8 +343,7 @@ fn coinbase_validation_failure() -> Result<(), Report> {
let expected = BlockError::NoTransactions;
assert_eq!(expected, result);

let result =
check::subsidy_is_valid(&block, &network, expected_block_subsidy).unwrap_err();
let result = check::subsidy_is_valid(&block, &network, expected_block_subsidy).unwrap_err();
let expected = BlockError::Transaction(TransactionError::Subsidy(SubsidyError::NoCoinbase));
assert_eq!(expected, result);

Expand All @@ -371,8 +369,7 @@ fn coinbase_validation_failure() -> Result<(), Report> {
let expected = BlockError::Transaction(TransactionError::CoinbasePosition);
assert_eq!(expected, result);

let result =
check::subsidy_is_valid(&block, &network, expected_block_subsidy).unwrap_err();
let result = check::subsidy_is_valid(&block, &network, expected_block_subsidy).unwrap_err();
let expected = BlockError::Transaction(TransactionError::Subsidy(SubsidyError::NoCoinbase));
assert_eq!(expected, result);

Expand Down Expand Up @@ -433,8 +430,7 @@ fn funding_stream_validation_for_network(network: Network) -> Result<(), Report>
if height >= canopy_activation_height {
let block = Block::zcash_deserialize(&block[..]).expect("block should deserialize");
let expected_block_subsidy =
subsidy::general::block_subsidy(height, &network)
.expect("valid block subsidy");
subsidy::general::block_subsidy(height, &network).expect("valid block subsidy");

// Validate
let result = check::subsidy_is_valid(&block, &network, expected_block_subsidy);
Expand Down Expand Up @@ -555,14 +551,11 @@ fn miner_fees_validation_failure() -> Result<(), Report> {
let height = block.coinbase_height().expect("valid coinbase height");
let expected_block_subsidy = block_subsidy(height, &network)?;
// TODO: Add link to lockbox stream ZIP
let expected_deferred_amount = subsidy::funding_streams::funding_stream_values(
height,
&network,
expected_block_subsidy,
)
.expect("we always expect a funding stream hashmap response even if empty")
.remove(&FundingStreamReceiver::Deferred)
.unwrap_or_default();
let expected_deferred_amount =
subsidy::funding_streams::funding_stream_values(height, &network, expected_block_subsidy)
.expect("we always expect a funding stream hashmap response even if empty")
.remove(&FundingStreamReceiver::Deferred)
.unwrap_or_default();

assert_eq!(
check::miner_fees_are_valid(
Expand Down
3 changes: 3 additions & 0 deletions zebra-network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,6 @@ toml = "0.8.19"

zebra-chain = { path = "../zebra-chain", features = ["proptest-impl"] }
zebra-test = { path = "../zebra-test/" }

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(zcash_unstable, values("nsm"))'] }
3 changes: 3 additions & 0 deletions zebra-rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,6 @@ zebra-state = { path = "../zebra-state", version = "1.0.0-beta.39", features = [
] }

zebra-test = { path = "../zebra-test", version = "1.0.0-beta.39" }

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(zcash_unstable, values("nsm"))'] }
3 changes: 3 additions & 0 deletions zebra-state/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,6 @@ tokio = { version = "1.40.0", features = ["full", "tracing", "test-util"] }

zebra-chain = { path = "../zebra-chain", version = "1.0.0-beta.39", features = ["proptest-impl"] }
zebra-test = { path = "../zebra-test/", version = "1.0.0-beta.39" }

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(zcash_unstable, values("nsm"))'] }
2 changes: 1 addition & 1 deletion zebrad/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -301,4 +301,4 @@ zebra-grpc = { path = "../zebra-grpc", version = "0.1.0-alpha.6" }
zebra-utils = { path = "../zebra-utils", version = "1.0.0-beta.39" }

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tokio_unstable)'] }
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tokio_unstable)', 'cfg(zcash_unstable, values("nsm"))'] }

0 comments on commit 6c6bf03

Please sign in to comment.