chain: move amount to a top-level module.

This commit is contained in:
Henry de Valence 2020-08-14 23:15:36 -07:00
parent cee7d0b8eb
commit a35604aef3
11 changed files with 14 additions and 15 deletions

View File

@ -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,

View File

@ -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::*;

View File

@ -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;

View File

@ -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};

View File

@ -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;

View File

@ -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,
},
}

View File

@ -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.
///

View File

@ -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].

View File

@ -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::*};

View File

@ -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;

View File

@ -10,8 +10,6 @@ use std::{
io::{self, Read},
};
pub mod amount;
/// A u32 which represents a block height value.
///
/// # Invariants