Skip to content

Commit

Permalink
Post-rebase fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
mariopil committed Feb 19, 2025
1 parent fbef780 commit 640d321
Show file tree
Hide file tree
Showing 23 changed files with 51 additions and 121 deletions.
24 changes: 12 additions & 12 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1293,7 +1293,7 @@ dependencies = [
[[package]]
name = "equihash"
version = "0.2.0"
source = "git+https://github.com/ShieldedLabs/librustzcash/?branch=nsm-work#d5bf1a26bcc768f2bd957c01ba917cffd94be14e"
source = "git+https://github.com/ShieldedLabs/librustzcash/?branch=nsm#dd96084ceb4b64ba4640e8e1c092c65ea773bd6f"
dependencies = [
"blake2b_simd",
"byteorder",
Expand Down Expand Up @@ -1328,7 +1328,7 @@ dependencies = [
[[package]]
name = "f4jumble"
version = "0.1.0"
source = "git+https://github.com/ShieldedLabs/librustzcash/?branch=nsm-work#d5bf1a26bcc768f2bd957c01ba917cffd94be14e"
source = "git+https://github.com/ShieldedLabs/librustzcash/?branch=nsm#dd96084ceb4b64ba4640e8e1c092c65ea773bd6f"
dependencies = [
"blake2b_simd",
]
Expand Down Expand Up @@ -5780,7 +5780,7 @@ dependencies = [
[[package]]
name = "zcash_address"
version = "0.6.0"
source = "git+https://github.com/ShieldedLabs/librustzcash/?branch=nsm-work#d5bf1a26bcc768f2bd957c01ba917cffd94be14e"
source = "git+https://github.com/ShieldedLabs/librustzcash/?branch=nsm#dd96084ceb4b64ba4640e8e1c092c65ea773bd6f"
dependencies = [
"bech32",
"bs58",
Expand All @@ -5792,7 +5792,7 @@ dependencies = [
[[package]]
name = "zcash_client_backend"
version = "0.15.0"
source = "git+https://github.com/ShieldedLabs/librustzcash/?branch=nsm-work#d5bf1a26bcc768f2bd957c01ba917cffd94be14e"
source = "git+https://github.com/ShieldedLabs/librustzcash/?branch=nsm#dd96084ceb4b64ba4640e8e1c092c65ea773bd6f"
dependencies = [
"base64 0.22.1",
"bech32",
Expand Down Expand Up @@ -5831,7 +5831,7 @@ dependencies = [
[[package]]
name = "zcash_encoding"
version = "0.2.1"
source = "git+https://github.com/ShieldedLabs/librustzcash/?branch=nsm-work#d5bf1a26bcc768f2bd957c01ba917cffd94be14e"
source = "git+https://github.com/ShieldedLabs/librustzcash/?branch=nsm#dd96084ceb4b64ba4640e8e1c092c65ea773bd6f"
dependencies = [
"byteorder",
"nonempty",
Expand All @@ -5840,7 +5840,7 @@ dependencies = [
[[package]]
name = "zcash_history"
version = "0.4.0"
source = "git+https://github.com/ShieldedLabs/librustzcash/?branch=nsm-work#d5bf1a26bcc768f2bd957c01ba917cffd94be14e"
source = "git+https://github.com/ShieldedLabs/librustzcash/?branch=nsm#dd96084ceb4b64ba4640e8e1c092c65ea773bd6f"
dependencies = [
"blake2b_simd",
"byteorder",
Expand All @@ -5850,7 +5850,7 @@ dependencies = [
[[package]]
name = "zcash_keys"
version = "0.5.0"
source = "git+https://github.com/ShieldedLabs/librustzcash/?branch=nsm-work#d5bf1a26bcc768f2bd957c01ba917cffd94be14e"
source = "git+https://github.com/ShieldedLabs/librustzcash/?branch=nsm#dd96084ceb4b64ba4640e8e1c092c65ea773bd6f"
dependencies = [
"bech32",
"blake2b_simd",
Expand Down Expand Up @@ -5888,15 +5888,15 @@ dependencies = [
[[package]]
name = "zcash_primitives"
version = "0.20.0"
source = "git+https://github.com/ShieldedLabs/librustzcash/?branch=nsm-work#d5bf1a26bcc768f2bd957c01ba917cffd94be14e"
source = "git+https://github.com/ShieldedLabs/librustzcash/?branch=nsm#dd96084ceb4b64ba4640e8e1c092c65ea773bd6f"
dependencies = [
"aes",
"bip32",
"blake2b_simd",
"bs58",
"byteorder",
"document-features",
"equihash 0.2.0 (git+https://github.com/ShieldedLabs/librustzcash/?branch=nsm-work)",
"equihash 0.2.0 (git+https://github.com/ShieldedLabs/librustzcash/?branch=nsm)",
"ff",
"fpe",
"group",
Expand Down Expand Up @@ -5926,7 +5926,7 @@ dependencies = [
[[package]]
name = "zcash_proofs"
version = "0.20.0"
source = "git+https://github.com/ShieldedLabs/librustzcash/?branch=nsm-work#d5bf1a26bcc768f2bd957c01ba917cffd94be14e"
source = "git+https://github.com/ShieldedLabs/librustzcash/?branch=nsm#dd96084ceb4b64ba4640e8e1c092c65ea773bd6f"
dependencies = [
"bellman",
"blake2b_simd",
Expand All @@ -5948,7 +5948,7 @@ dependencies = [
[[package]]
name = "zcash_protocol"
version = "0.4.1"
source = "git+https://github.com/ShieldedLabs/librustzcash/?branch=nsm-work#d5bf1a26bcc768f2bd957c01ba917cffd94be14e"
source = "git+https://github.com/ShieldedLabs/librustzcash/?branch=nsm#dd96084ceb4b64ba4640e8e1c092c65ea773bd6f"
dependencies = [
"document-features",
"memuse",
Expand Down Expand Up @@ -6536,7 +6536,7 @@ dependencies = [
[[package]]
name = "zip321"
version = "0.2.0"
source = "git+https://github.com/ShieldedLabs/librustzcash/?branch=nsm-work#d5bf1a26bcc768f2bd957c01ba917cffd94be14e"
source = "git+https://github.com/ShieldedLabs/librustzcash/?branch=nsm#dd96084ceb4b64ba4640e8e1c092c65ea773bd6f"
dependencies = [
"base64 0.22.1",
"nom",
Expand Down
16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ incrementalmerkletree = { version = "0.7.1", features = ["legacy-api"] }
orchard = "0.10.0"
sapling-crypto = "0.3.0"
# TODO: Revert to a release once librustzcash is released (#8749).
zcash_address = { git = "https://github.com/ShieldedLabs/librustzcash/", branch = "nsm-work" }
zcash_client_backend = { git = "https://github.com/ShieldedLabs/librustzcash/", branch = "nsm-work" }
zcash_encoding = { git = "https://github.com/ShieldedLabs/librustzcash/", branch = "nsm-work" }
zcash_history = { git = "https://github.com/ShieldedLabs/librustzcash/", branch = "nsm-work" }
zcash_keys = { git = "https://github.com/ShieldedLabs/librustzcash/", branch = "nsm-work" }
zcash_primitives = { git = "https://github.com/ShieldedLabs/librustzcash/", branch = "nsm-work" }
zcash_proofs = { git = "https://github.com/ShieldedLabs/librustzcash/", branch = "nsm-work" }
zcash_protocol = { git = "https://github.com/ShieldedLabs/librustzcash/", branch = "nsm-work" }
zcash_address = { git = "https://github.com/ShieldedLabs/librustzcash/", branch = "nsm" }
zcash_client_backend = { git = "https://github.com/ShieldedLabs/librustzcash/", branch = "nsm" }
zcash_encoding = { git = "https://github.com/ShieldedLabs/librustzcash/", branch = "nsm" }
zcash_history = { git = "https://github.com/ShieldedLabs/librustzcash/", branch = "nsm" }
zcash_keys = { git = "https://github.com/ShieldedLabs/librustzcash/", branch = "nsm" }
zcash_primitives = { git = "https://github.com/ShieldedLabs/librustzcash/", branch = "nsm" }
zcash_proofs = { git = "https://github.com/ShieldedLabs/librustzcash/", branch = "nsm" }
zcash_protocol = { git = "https://github.com/ShieldedLabs/librustzcash/", branch = "nsm" }
abscissa_core = "0.7.0"
atty = "0.2.14"
base64 = "0.22.1"
Expand Down
4 changes: 0 additions & 4 deletions zebra-chain/src/block/commitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,6 @@ impl Commitment {
(Nu5 | Nu6 | Nu7, _) => Ok(ChainHistoryBlockTxAuthCommitment(
ChainHistoryBlockTxAuthCommitmentHash(bytes),
)),
#[cfg(zcash_unstable = "nsm")]
(ZFuture, _) => Ok(ChainHistoryBlockTxAuthCommitment(
ChainHistoryBlockTxAuthCommitmentHash(bytes),
)),
}
}

Expand Down
26 changes: 0 additions & 26 deletions zebra-chain/src/block/subsidy/general.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,32 +57,6 @@ pub fn num_halvings(height: Height, network: &Network) -> u32 {
.expect("already checked for negatives")
}

#[cfg(zcash_unstable = "nsm")]
pub fn block_subsidy(
height: Height,
network: &Network,
money_reserve: Amount<NonNegative>,
) -> Result<Amount<NonNegative>, SubsidyError> {
let nsm_activation_height = ZFuture
.activation_height(network)
.expect("ZFuture activation height should be available");

if height < nsm_activation_height {
block_subsidy_pre_nsm(height, network)
} else {
let money_reserve: i64 = money_reserve.into();
let money_reserve: i128 = money_reserve.into();
const BLOCK_SUBSIDY_DENOMINATOR: i128 = 10_000_000_000;
const BLOCK_SUBSIDY_NUMERATOR: i128 = 4_126;

// calculate the block subsidy (in zatoshi) using the money reserve, note the rounding up
let subsidy = (money_reserve * BLOCK_SUBSIDY_NUMERATOR + (BLOCK_SUBSIDY_DENOMINATOR - 1))
/ BLOCK_SUBSIDY_DENOMINATOR;

Ok(subsidy.try_into().expect("subsidy should fit in Amount"))
}
}

#[cfg(zcash_unstable = "zip234")]
pub fn block_subsidy(
height: Height,
Expand Down
15 changes: 0 additions & 15 deletions zebra-chain/src/primitives/zcash_history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,21 +291,6 @@ impl Version for zcash_history::V1 {
end_height: height.0 as u64,
sapling_tx: sapling_tx_count,
},
#[cfg(zcash_unstable = "nsm")]
NetworkUpgrade::ZFuture => zcash_history::NodeData {
consensus_branch_id: branch_id.into(),
subtree_commitment: block_hash,
start_time: time,
end_time: time,
start_target: target,
end_target: target,
start_sapling_root: sapling_root,
end_sapling_root: sapling_root,
subtree_total_work: work,
start_height: height.0 as u64,
end_height: height.0 as u64,
sapling_tx: sapling_tx_count,
},
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions zebra-chain/src/primitives/zcash_primitives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,6 @@ impl TryFrom<&Transaction> for zp_tx::Transaction {
| Transaction::V6 {
network_upgrade, ..
} => network_upgrade,
#[cfg(zcash_unstable = "nsm")]
Transaction::ZFuture {
network_upgrade, ..
} => network_upgrade,
Transaction::V1 { .. }
| Transaction::V2 { .. }
| Transaction::V3 { .. }
Expand Down
6 changes: 0 additions & 6 deletions zebra-chain/src/transaction/arbitrary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -783,12 +783,6 @@ impl Arbitrary for Transaction {
Self::v5_strategy(ledger_state)
]
.boxed(),
#[cfg(zcash_unstable = "nsm")]
NetworkUpgrade::ZFuture => prop_oneof![
Self::v4_strategy(ledger_state.clone()),
Self::v5_strategy(ledger_state)
]
.boxed(),
}
}

Expand Down
3 changes: 1 addition & 2 deletions zebra-chain/src/transaction/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ impl Transaction {
height: Height,
outputs: impl IntoIterator<Item = (Amount<NonNegative>, transparent::Script)>,
extra_coinbase_data: Vec<u8>,
#[cfg(zcash_unstable = "zip235")]
miner_fee: Amount<NonNegative>,
#[cfg(zcash_unstable = "zip235")] miner_fee: Amount<NonNegative>,
zip233_amount: Option<Amount<NonNegative>>,
) -> Transaction {
// # Consensus
Expand Down
21 changes: 0 additions & 21 deletions zebra-chain/src/transaction/tests/vectors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -947,27 +947,6 @@ fn binding_signatures() {
}
}
}
#[cfg(zcash_unstable = "nsm")]
Transaction::ZFuture {
sapling_shielded_data,
..
} => {
if let Some(sapling_shielded_data) = sapling_shielded_data {
let shielded_sighash =
tx.sighash(upgrade.branch_id().unwrap(), HashType::ALL, &[], None);

let bvk = redjubjub::VerificationKey::try_from(
sapling_shielded_data.binding_verification_key(),
)
.expect("a valid redjubjub::VerificationKey");

bvk.verify(
shielded_sighash.as_ref(),
&sapling_shielded_data.binding_sig,
)
.expect("must pass verification");
}
}
}
}

Expand Down
2 changes: 0 additions & 2 deletions zebra-consensus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ categories = ["asynchronous", "cryptography::cryptocurrencies"]
[features]
default = []

nsm = []

# Production features that activate extra dependencies, or extra features in dependencies

progress-bar = [
Expand Down
7 changes: 4 additions & 3 deletions zebra-consensus/src/block/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@ use zebra_chain::{
work::difficulty::{ParameterDifficulty as _, INVALID_COMPACT_DIFFICULTY},
};
use zebra_script::CachedFfiTransaction;
use zebra_state::check::{
coinbase_is_first, miner_fees_are_valid, subsidy_is_valid, transaction_miner_fees_are_valid,
};
use zebra_state::check::{coinbase_is_first, subsidy_is_valid, transaction_miner_fees_are_valid};
use zebra_test::transcript::{ExpectedTranscriptError, Transcript};

use crate::{block::check, difficulty_is_valid, transaction};

use super::*;

#[cfg(any(zcash_unstable = "zip234", zcash_unstable = "zip235"))]
use zebra_state::check::miner_fees_are_valid;

static VALID_BLOCK_TRANSCRIPT: Lazy<Vec<(Request, Result<block::Hash, ExpectedTranscriptError>)>> =
Lazy::new(|| {
let block: Arc<_> =
Expand Down
3 changes: 0 additions & 3 deletions zebra-consensus/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -951,9 +951,6 @@ where
transaction.version(),
network_upgrade,
)),

#[cfg(zcash_unstable = "nsm")]
NetworkUpgrade::ZFuture => Ok(()),
}
}

Expand Down
2 changes: 0 additions & 2 deletions zebra-network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ categories = ["asynchronous", "cryptography::cryptocurrencies", "encoding", "net
[features]
default = []

nsm = []

# Production features that activate extra dependencies, or extra features in dependencies

progress-bar = [
Expand Down
4 changes: 1 addition & 3 deletions zebra-rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ categories = [

[features]

nsm = []

indexer-rpcs = [
"tonic-build",
"tonic",
Expand Down Expand Up @@ -138,4 +136,4 @@ zebra-state = { path = "../zebra-state", version = "1.0.0-beta.45", features = [
zebra-test = { path = "../zebra-test", version = "1.0.0-beta.45" }

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(zcash_unstable, values("zip234"))'] }
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(zcash_unstable, values("zip234", "zip235"))'] }
5 changes: 5 additions & 0 deletions zebra-rpc/src/methods/get_block_template_rpcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,11 @@ where
let mempool = self.mempool.clone();
let mut latest_chain_tip = self.latest_chain_tip.clone();
let sync_status = self.sync_status.clone();

#[cfg(not(zcash_unstable = "zip234"))]
let state = self.state.clone();

#[cfg(zcash_unstable = "zip234")]
let mut state = self.state.clone();

if let Some(HexData(block_proposal_bytes)) = parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,6 @@ pub fn proposal_block_from_template(
NetworkUpgrade::Nu5 | NetworkUpgrade::Nu6 | NetworkUpgrade::Nu7 => {
block_commitments_hash.bytes_in_serialized_order().into()
}
#[cfg(zcash_unstable = "nsm")]
NetworkUpgrade::ZFuture => block_commitments_hash.bytes_in_serialized_order().into(),
};

Ok(Block {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//! Tests for ZIP-317 transaction selection for block template production
use zebra_chain::{
amount::MAX_MONEY,
block::{subsidy::general, Height},
parameters::Network,
transaction,
Expand All @@ -10,6 +9,9 @@ use zebra_node_services::mempool::TransactionDependencies;

use super::select_mempool_transactions;

#[cfg(zcash_unstable = "zip234")]
use zebra_chain::amount::MAX_MONEY;

#[test]
fn excludes_tx_with_unselected_dependencies() {
let network = Network::Mainnet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use zebra_chain::{
serialization::{DateTime32, ZcashDeserializeInto},
transaction::Transaction,
transparent,
value_balance::ValueBalance,
work::difficulty::{CompactDifficulty, ParameterDifficulty as _},
};
use zebra_network::{address_book_peers::MockAddressBookPeers, types::MetaAddr};
Expand All @@ -36,6 +35,9 @@ use zebra_test::{
vectors::BLOCK_MAINNET_1_BYTES,
};

#[cfg(zcash_unstable = "zip234")]
use zebra_chain::value_balance::ValueBalance;

use crate::methods::{
get_block_template_rpcs::types::{
get_block_template::{self, GetBlockTemplateRequestMode},
Expand Down
4 changes: 3 additions & 1 deletion zebra-rpc/src/methods/tests/vectors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1593,13 +1593,15 @@ async fn rpc_getblocktemplate_mining_address(use_p2pkh: bool) {
parameters::NetworkKind,
serialization::DateTime32,
transaction::{zip317, VerifiedUnminedTx},
value_balance::ValueBalance,
work::difficulty::{CompactDifficulty, ExpandedDifficulty, U256},
};
use zebra_consensus::MAX_BLOCK_SIGOPS;
use zebra_network::address_book_peers::MockAddressBookPeers;
use zebra_state::{GetBlockTemplateChainInfo, ReadRequest, ReadResponse};

#[cfg(zcash_unstable = "zip234")]
use zebra_chain::value_balance::ValueBalance;

use crate::methods::{
get_block_template_rpcs::{
constants::{
Expand Down
Loading

0 comments on commit 640d321

Please sign in to comment.