remove dead code from zebra-chain (#5464)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
parent
868ba1325e
commit
233220ace0
|
@ -125,7 +125,7 @@ impl Commitment {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the serialized bytes for this Commitment.
|
/// Returns the serialized bytes for this Commitment.
|
||||||
#[allow(dead_code)]
|
#[cfg(test)]
|
||||||
pub(super) fn to_bytes(self) -> [u8; 32] {
|
pub(super) fn to_bytes(self) -> [u8; 32] {
|
||||||
use Commitment::*;
|
use Commitment::*;
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ impl ChainHistoryBlockTxAuthCommitmentHash {
|
||||||
/// all possible verification failures enumerates the consensus rules we
|
/// all possible verification failures enumerates the consensus rules we
|
||||||
/// implement, and ensures that we don't reject blocks or transactions
|
/// implement, and ensures that we don't reject blocks or transactions
|
||||||
/// for a non-enumerated reason.
|
/// for a non-enumerated reason.
|
||||||
#[allow(dead_code, missing_docs)]
|
#[allow(missing_docs)]
|
||||||
#[derive(Error, Debug, PartialEq, Eq)]
|
#[derive(Error, Debug, PartialEq, Eq)]
|
||||||
pub enum CommitmentError {
|
pub enum CommitmentError {
|
||||||
#[error(
|
#[error(
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
#[allow(dead_code, missing_docs)]
|
#[allow(missing_docs)]
|
||||||
#[derive(Error, Debug, PartialEq, Eq)]
|
#[derive(Error, Debug, PartialEq, Eq)]
|
||||||
pub enum BlockError {
|
pub enum BlockError {
|
||||||
#[error("transaction has wrong consensus branch id for block network upgrade")]
|
#[error("transaction has wrong consensus branch id for block network upgrade")]
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
//!
|
//!
|
||||||
//! <https://zips.z.cash/protocol/nu5.pdf#orchardkeycomponents>
|
//! <https://zips.z.cash/protocol/nu5.pdf#orchardkeycomponents>
|
||||||
#![allow(clippy::fallible_impl_from)]
|
#![allow(clippy::fallible_impl_from)]
|
||||||
#![allow(dead_code)]
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
@ -76,27 +75,6 @@ pub fn prf_expand(sk: [u8; 32], t: Vec<&[u8]>) -> [u8; 64] {
|
||||||
*state.finalize().as_array()
|
*state.finalize().as_array()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Used to derive the outgoing cipher key _ock_ used to encrypt an encrypted
|
|
||||||
/// output note from an Action.
|
|
||||||
///
|
|
||||||
/// PRF^ock(ovk, cv, cm_x, ephemeralKey) := BLAKE2b-256(“Zcash_Orchardock”, ovk || cv || cm_x || ephemeralKey)
|
|
||||||
///
|
|
||||||
/// <https://zips.z.cash/protocol/nu5.pdf#concreteprfs>
|
|
||||||
/// <https://zips.z.cash/protocol/nu5.pdf#concretesym>
|
|
||||||
fn prf_ock(ovk: [u8; 32], cv: [u8; 32], cm_x: [u8; 32], ephemeral_key: [u8; 32]) -> [u8; 32] {
|
|
||||||
let hash = blake2b_simd::Params::new()
|
|
||||||
.hash_length(32)
|
|
||||||
.personal(b"Zcash_Orchardock")
|
|
||||||
.to_state()
|
|
||||||
.update(&ovk)
|
|
||||||
.update(&cv)
|
|
||||||
.update(&cm_x)
|
|
||||||
.update(&ephemeral_key)
|
|
||||||
.finalize();
|
|
||||||
|
|
||||||
hash.as_bytes().try_into().expect("32 byte array")
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Used to derive a diversified base point from a diversifier value.
|
/// Used to derive a diversified base point from a diversifier value.
|
||||||
///
|
///
|
||||||
/// DiversifyHash^Orchard(d) := {︃ GroupHash^P("z.cash:Orchard-gd",""), if P = 0_P
|
/// DiversifyHash^Orchard(d) := {︃ GroupHash^P("z.cash:Orchard-gd",""), if P = 0_P
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
//! Orchard notes
|
//! Orchard notes
|
||||||
|
|
||||||
#![allow(clippy::unit_arg)]
|
#![allow(clippy::unit_arg)]
|
||||||
#![allow(dead_code)]
|
|
||||||
|
|
||||||
use group::{ff::PrimeField, GroupEncoding};
|
use group::{ff::PrimeField, GroupEncoding};
|
||||||
use halo2::{arithmetic::FieldExt, pasta::pallas};
|
use halo2::{arithmetic::FieldExt, pasta::pallas};
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#![allow(clippy::unit_arg)]
|
#![allow(clippy::unit_arg)]
|
||||||
#![allow(dead_code)]
|
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
convert::TryFrom,
|
convert::TryFrom,
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
//! Produced by <https://github.com/zcash-hackworks/zcash-test-vectors/blob/ec5fe3abef5219d0f8c9edbc93bb4038f1729dfe/orchard_key_components.py>
|
//! Produced by <https://github.com/zcash-hackworks/zcash-test-vectors/blob/ec5fe3abef5219d0f8c9edbc93bb4038f1729dfe/orchard_key_components.py>
|
||||||
|
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
pub struct TestVector {
|
pub struct TestVector {
|
||||||
pub(crate) sk: [u8; 32],
|
pub(crate) sk: [u8; 32],
|
||||||
pub(crate) ask: [u8; 32],
|
pub(crate) ask: [u8; 32],
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
//! librustzcash.
|
//! librustzcash.
|
||||||
|
|
||||||
// TODO: remove after this module gets to be used
|
// TODO: remove after this module gets to be used
|
||||||
#![allow(dead_code)]
|
|
||||||
#![allow(missing_docs)]
|
#![allow(missing_docs)]
|
||||||
|
|
||||||
mod tests;
|
mod tests;
|
||||||
|
@ -210,26 +209,6 @@ impl<V: Version> Tree<V> {
|
||||||
}
|
}
|
||||||
Ok(new_nodes)
|
Ok(new_nodes)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Append multiple blocks to the tree.
|
|
||||||
fn append_leaf_iter(
|
|
||||||
&mut self,
|
|
||||||
vals: impl Iterator<Item = (Arc<Block>, sapling::tree::Root, orchard::tree::Root)>,
|
|
||||||
) -> Result<Vec<Entry>, zcash_history::Error> {
|
|
||||||
let mut new_nodes = Vec::new();
|
|
||||||
for (block, sapling_root, orchard_root) in vals {
|
|
||||||
new_nodes.append(&mut self.append_leaf(block, &sapling_root, &orchard_root)?);
|
|
||||||
}
|
|
||||||
Ok(new_nodes)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Remove the last leaf (block) from the tree.
|
|
||||||
///
|
|
||||||
/// Returns the number of nodes removed from the tree after the operation.
|
|
||||||
fn truncate_leaf(&mut self) -> Result<u32, zcash_history::Error> {
|
|
||||||
self.inner.truncate_leaf()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Return the root hash of the tree, i.e. `hashChainHistoryRoot`.
|
/// Return the root hash of the tree, i.e. `hashChainHistoryRoot`.
|
||||||
pub fn hash(&self) -> ChainHistoryMmrRootHash {
|
pub fn hash(&self) -> ChainHistoryMmrRootHash {
|
||||||
// Both append_leaf() and truncate_leaf() leave a root node, so it should
|
// Both append_leaf() and truncate_leaf() leave a root node, so it should
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
// librustzcash, they match their Display impl to match the Python hex strings
|
// librustzcash, they match their Display impl to match the Python hex strings
|
||||||
// and that's what they compare in their unit tests, not the bytes.
|
// and that's what they compare in their unit tests, not the bytes.
|
||||||
|
|
||||||
#![allow(dead_code)]
|
|
||||||
|
|
||||||
use bitvec::prelude::*;
|
use bitvec::prelude::*;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
//! [3.1]: https://zips.z.cash/protocol/protocol.pdf#addressesandkeys
|
//! [3.1]: https://zips.z.cash/protocol/protocol.pdf#addressesandkeys
|
||||||
#![allow(clippy::unit_arg)]
|
#![allow(clippy::unit_arg)]
|
||||||
#![allow(clippy::fallible_impl_from)]
|
#![allow(clippy::fallible_impl_from)]
|
||||||
#![allow(dead_code)]
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test_vectors;
|
mod test_vectors;
|
||||||
|
@ -65,25 +64,6 @@ fn prf_expand(sk: [u8; 32], t: &[u8]) -> [u8; 64] {
|
||||||
*hash.as_array()
|
*hash.as_array()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Used to derive the outgoing cipher key _ock_ used to encrypt an Output ciphertext.
|
|
||||||
///
|
|
||||||
/// PRF^ock(ovk, cv, cm_u, ephemeralKey) := BLAKE2b-256(“Zcash_Derive_ock”, ovk || cv || cm_u || ephemeralKey)
|
|
||||||
///
|
|
||||||
/// <https://zips.z.cash/protocol/nu5.pdf#concreteprfs>
|
|
||||||
fn prf_ock(ovk: [u8; 32], cv: [u8; 32], cm_u: [u8; 32], ephemeral_key: [u8; 32]) -> [u8; 32] {
|
|
||||||
let hash = blake2b_simd::Params::new()
|
|
||||||
.hash_length(32)
|
|
||||||
.personal(b"Zcash_Derive_ock")
|
|
||||||
.to_state()
|
|
||||||
.update(&ovk)
|
|
||||||
.update(&cv)
|
|
||||||
.update(&cm_u)
|
|
||||||
.update(&ephemeral_key)
|
|
||||||
.finalize();
|
|
||||||
|
|
||||||
<[u8; 32]>::try_from(hash.as_bytes()).expect("32 byte array")
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Invokes Blake2s-256 as _CRH^ivk_, to derive the IncomingViewingKey
|
/// Invokes Blake2s-256 as _CRH^ivk_, to derive the IncomingViewingKey
|
||||||
/// bytes from an AuthorizingKey and NullifierDerivingKey.
|
/// bytes from an AuthorizingKey and NullifierDerivingKey.
|
||||||
///
|
///
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
//! Sapling notes
|
//! Sapling notes
|
||||||
|
|
||||||
#![allow(clippy::unit_arg)]
|
#![allow(clippy::unit_arg)]
|
||||||
#![allow(dead_code)]
|
|
||||||
|
|
||||||
mod ciphertexts;
|
mod ciphertexts;
|
||||||
mod nullifiers;
|
mod nullifiers;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#![allow(clippy::unit_arg)]
|
#![allow(clippy::unit_arg)]
|
||||||
#![allow(dead_code)]
|
|
||||||
|
|
||||||
use super::super::{
|
use super::super::{
|
||||||
commitment::{pedersen_hashes::mixing_pedersen_hash, NoteCommitment},
|
commitment::{pedersen_hashes::mixing_pedersen_hash, NoteCommitment},
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
//! Sprout notes
|
//! Sprout notes
|
||||||
|
|
||||||
#![allow(clippy::unit_arg)]
|
#![allow(clippy::unit_arg)]
|
||||||
#![allow(dead_code)]
|
|
||||||
|
|
||||||
#[cfg(any(test, feature = "proptest-impl"))]
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
mod arbitrary;
|
mod arbitrary;
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#![allow(dead_code)]
|
|
||||||
|
|
||||||
use byteorder::{ByteOrder, LittleEndian};
|
use byteorder::{ByteOrder, LittleEndian};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use sha2::digest::generic_array::{typenum::U64, GenericArray};
|
use sha2::digest::generic_array::{typenum::U64, GenericArray};
|
||||||
|
|
|
@ -975,29 +975,6 @@ impl Transaction {
|
||||||
.map_err(ValueBalanceError::Transparent)
|
.map_err(ValueBalanceError::Transparent)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the transparent value balance,
|
|
||||||
/// the change in the value of the transaction value pool.
|
|
||||||
///
|
|
||||||
/// The sum of the UTXOs spent by transparent inputs in `tx_in` fields,
|
|
||||||
/// minus the sum of the newly created outputs in `tx_out` fields.
|
|
||||||
///
|
|
||||||
/// Positive values are added to this transaction's value pool,
|
|
||||||
/// and removed from the transparent chain value pool.
|
|
||||||
/// Negative values are removed from the transparent chain value pool,
|
|
||||||
/// and added to this transaction.
|
|
||||||
///
|
|
||||||
/// <https://zebra.zfnd.org/dev/rfcs/0012-value-pools.html#definitions>
|
|
||||||
///
|
|
||||||
/// `utxos` must contain the utxos of every input in the transaction,
|
|
||||||
/// including UTXOs created by earlier transactions in this block.
|
|
||||||
#[allow(dead_code)]
|
|
||||||
fn transparent_value_balance(
|
|
||||||
&self,
|
|
||||||
utxos: &HashMap<transparent::OutPoint, transparent::Utxo>,
|
|
||||||
) -> Result<ValueBalance<NegativeAllowed>, ValueBalanceError> {
|
|
||||||
self.transparent_value_balance_from_outputs(&outputs_from_utxos(utxos.clone()))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Modify the transparent output values of this transaction, regardless of version.
|
/// Modify the transparent output values of this transaction, regardless of version.
|
||||||
#[cfg(any(test, feature = "proptest-impl"))]
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
pub fn output_values_mut(&mut self) -> impl Iterator<Item = &mut Amount<NonNegative>> {
|
pub fn output_values_mut(&mut self) -> impl Iterator<Item = &mut Amount<NonNegative>> {
|
||||||
|
|
Loading…
Reference in New Issue