Skip to content

Commit

Permalink
updates funding stream values test to check post-NU6 funding streams …
Browse files Browse the repository at this point in the history
…too, adds Mainnet/Testnet NU6 activation heights, fixes lints/compilation issue
  • Loading branch information
arya2 committed Jul 25, 2024
1 parent 9bca31f commit 0d22b68
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 9 deletions.
3 changes: 3 additions & 0 deletions zebra-chain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,6 @@ required-features = ["bench"]
[[bench]]
name = "redpallas"
harness = false

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(zcash_unstable, values("nu6"))'] }
4 changes: 2 additions & 2 deletions zebra-chain/src/parameters/network_upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ pub(super) const MAINNET_ACTIVATION_HEIGHTS: &[(block::Height, NetworkUpgrade)]
(block::Height(903_000), Heartwood),
(block::Height(1_046_400), Canopy),
(block::Height(1_687_104), Nu5),
// TODO: Add NU6.
(block::Height(2_726_400), Nu6),
];

/// Fake mainnet network upgrade activation heights, used in tests.
Expand Down Expand Up @@ -124,7 +124,7 @@ pub(super) const TESTNET_ACTIVATION_HEIGHTS: &[(block::Height, NetworkUpgrade)]
(block::Height(903_800), Heartwood),
(block::Height(1_028_500), Canopy),
(block::Height(1_842_420), Nu5),
// TODO: Add NU6.
(block::Height(2_942_000), Nu6),
];

/// Fake testnet network upgrade activation heights, used in tests.
Expand Down
21 changes: 20 additions & 1 deletion zebra-consensus/src/block/subsidy/funding_streams/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ fn test_funding_stream_values() -> Result<(), Report> {
);

// funding stream period is ending
// TODO: Check post-NU6 funding streams here as well.
let range = network.pre_nu6_funding_streams().height_range();
let end = range.end;
let last = end - 1;
Expand All @@ -56,6 +55,26 @@ fn test_funding_stream_values() -> Result<(), Report> {
);
assert!(funding_stream_values(end, network)?.is_empty());

let mut hash_map = HashMap::new();
hash_map.insert(
FundingStreamReceiver::Deferred,
Amount::try_from(18_750_000)?,
);
hash_map.insert(
FundingStreamReceiver::MajorGrants,
Amount::try_from(12_500_000)?,
);

let nu6_height = Nu6.activation_height(network).unwrap();

for height in [
nu6_height,
Height(nu6_height.0 + 1),
Height(nu6_height.0 + 1),
] {
assert_eq!(funding_stream_values(height, network).unwrap(), hash_map);
}

Ok(())
}

Expand Down
2 changes: 1 addition & 1 deletion zebrad/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -299,4 +299,4 @@ zebra-grpc = { path = "../zebra-grpc", version = "0.1.0-alpha.5" }
zebra-utils = { path = "../zebra-utils", version = "1.0.0-beta.38" }

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tokio_unstable)', 'cfg(zcash_unstable = "nu6")'] }
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tokio_unstable)', 'cfg(zcash_unstable, values("nu6"))'] }
7 changes: 2 additions & 5 deletions zebrad/tests/acceptance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,7 @@ use serde_json::Value;
use tower::ServiceExt;
use zebra_chain::{
block::{self, genesis::regtest_genesis_block, Height},
parameters::{
testnet::ConfiguredFundingStreams,
Network::{self, *},
},
parameters::Network::{self, *},
};
use zebra_consensus::ParameterCheckpoint;
use zebra_network::constants::PORT_IN_USE_ERROR;
Expand Down Expand Up @@ -3242,7 +3239,7 @@ async fn nu6_lockbox_funding_stream() -> Result<()> {
use zebra_chain::{
chain_sync_status::MockSyncStatus,
parameters::{
testnet::{self, ConfiguredActivationHeights},
testnet::{self, ConfiguredActivationHeights, ConfiguredFundingStreams},
NetworkUpgrade,
},
serialization::ZcashSerialize,
Expand Down

0 comments on commit 0d22b68

Please sign in to comment.