chain: move amount to a top-level module.
This commit is contained in:
parent
cee7d0b8eb
commit
a35604aef3
|
|
@ -1,4 +1,5 @@
|
|||
//! Module of types for working with validated zatoshi Amounts
|
||||
//! Strongly-typed zatoshi amounts that prevent under/overflows.
|
||||
|
||||
use std::{
|
||||
convert::{TryFrom, TryInto},
|
||||
marker::PhantomData,
|
||||
|
|
@ -13,11 +13,11 @@ use bitvec::prelude::*;
|
|||
use rand_core::{CryptoRng, RngCore};
|
||||
|
||||
use crate::{
|
||||
amount::{Amount, NonNegative},
|
||||
keys::sapling::{find_group_hash, Diversifier, TransmissionKey},
|
||||
serialization::{
|
||||
serde_helpers, ReadZcashExt, SerializationError, ZcashDeserialize, ZcashSerialize,
|
||||
},
|
||||
types::amount::{Amount, NonNegative},
|
||||
};
|
||||
|
||||
use pedersen_hashes::*;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ extern crate serde;
|
|||
mod merkle_tree;
|
||||
|
||||
pub mod addresses;
|
||||
pub mod amount;
|
||||
pub mod block;
|
||||
pub mod commitments;
|
||||
pub mod equihash_solution;
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ mod ciphertexts;
|
|||
mod nullifiers;
|
||||
|
||||
use crate::{
|
||||
amount::{Amount, NonNegative},
|
||||
commitments::sapling::CommitmentRandomness,
|
||||
keys::sapling::{Diversifier, TransmissionKey},
|
||||
notes::memo::Memo,
|
||||
types::amount::{Amount, NonNegative},
|
||||
};
|
||||
|
||||
pub use ciphertexts::{EncryptedCiphertext, OutCiphertext};
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ mod ciphertexts;
|
|||
mod nullifiers;
|
||||
|
||||
use crate::{
|
||||
amount::{Amount, NonNegative},
|
||||
commitments::sprout::CommitmentRandomness,
|
||||
keys::sprout::PayingKey,
|
||||
notes::memo::Memo,
|
||||
types::amount::{Amount, NonNegative},
|
||||
};
|
||||
|
||||
pub use ciphertexts::EncryptedCiphertext;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,6 @@ pub enum SerializationError {
|
|||
Amount {
|
||||
/// The source error indicating how the num failed to validate
|
||||
#[from]
|
||||
source: crate::types::amount::Error,
|
||||
source: crate::amount::Error,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,8 +16,9 @@ pub use joinsplit::{JoinSplit, JoinSplitData};
|
|||
pub use shielded_data::{Output, ShieldedData, Spend};
|
||||
pub use transparent::{CoinbaseData, OutPoint, TransparentInput, TransparentOutput};
|
||||
|
||||
use crate::amount::Amount;
|
||||
use crate::proofs::{Bctv14Proof, Groth16Proof};
|
||||
use crate::types::{amount::Amount, BlockHeight, LockTime};
|
||||
use crate::types::{BlockHeight, LockTime};
|
||||
|
||||
/// A Zcash transaction.
|
||||
///
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
amount::{Amount, NonNegative},
|
||||
ed25519_zebra,
|
||||
notes::sprout,
|
||||
proofs::ZkSnarkProof,
|
||||
treestate,
|
||||
types::amount::{Amount, NonNegative},
|
||||
};
|
||||
|
||||
/// A _JoinSplit Description_, as described in [protocol specification §7.2][ps].
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
use crate::{
|
||||
amount::{Amount, NonNegative},
|
||||
commitments, keys,
|
||||
notes::{sapling, sprout},
|
||||
proofs::{Groth16Proof, ZkSnarkProof},
|
||||
|
|
@ -7,10 +8,7 @@ use crate::{
|
|||
TransparentInput,
|
||||
},
|
||||
treestate::{self, note_commitment_tree::SaplingNoteTreeRootHash},
|
||||
types::{
|
||||
amount::{Amount, NonNegative},
|
||||
BlockHeight, Script,
|
||||
},
|
||||
types::{BlockHeight, Script},
|
||||
};
|
||||
use futures::future::Either;
|
||||
use proptest::{array, collection::vec, prelude::*};
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
#[cfg(test)]
|
||||
use proptest_derive::Arbitrary;
|
||||
|
||||
use crate::types::{
|
||||
use crate::{
|
||||
amount::{Amount, NonNegative},
|
||||
BlockHeight, Script,
|
||||
types::{BlockHeight, Script},
|
||||
};
|
||||
|
||||
use super::TransactionHash;
|
||||
|
|
|
|||
|
|
@ -10,8 +10,6 @@ use std::{
|
|||
io::{self, Read},
|
||||
};
|
||||
|
||||
pub mod amount;
|
||||
|
||||
/// A u32 which represents a block height value.
|
||||
///
|
||||
/// # Invariants
|
||||
|
|
|
|||
Loading…
Reference in New Issue