chain: move serde_helpers into serialization.
This commit is contained in:
parent
b36fe8f937
commit
cee7d0b8eb
|
@ -14,8 +14,9 @@ use rand_core::{CryptoRng, RngCore};
|
|||
|
||||
use crate::{
|
||||
keys::sapling::{find_group_hash, Diversifier, TransmissionKey},
|
||||
serde_helpers,
|
||||
serialization::{ReadZcashExt, SerializationError, ZcashDeserialize, ZcashSerialize},
|
||||
serialization::{
|
||||
serde_helpers, ReadZcashExt, SerializationError, ZcashDeserialize, ZcashSerialize,
|
||||
},
|
||||
types::amount::{Amount, NonNegative},
|
||||
};
|
||||
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
//! Equihash Solution and related items.
|
||||
|
||||
use crate::{
|
||||
serde_helpers,
|
||||
serialization::{
|
||||
ReadZcashExt, SerializationError, WriteZcashExt, ZcashDeserialize, ZcashSerialize,
|
||||
},
|
||||
use crate::serialization::{
|
||||
serde_helpers, ReadZcashExt, SerializationError, WriteZcashExt, ZcashDeserialize,
|
||||
ZcashSerialize,
|
||||
};
|
||||
use std::{fmt, io};
|
||||
|
||||
|
|
|
@ -31,8 +31,9 @@ use proptest_derive::Arbitrary;
|
|||
|
||||
use crate::{
|
||||
redjubjub::{self, SpendAuth},
|
||||
serde_helpers,
|
||||
serialization::{ReadZcashExt, SerializationError, ZcashDeserialize, ZcashSerialize},
|
||||
serialization::{
|
||||
serde_helpers, ReadZcashExt, SerializationError, ZcashDeserialize, ZcashSerialize,
|
||||
},
|
||||
Network,
|
||||
};
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
extern crate serde;
|
||||
|
||||
mod merkle_tree;
|
||||
mod serde_helpers;
|
||||
|
||||
pub mod addresses;
|
||||
pub mod block;
|
||||
|
|
|
@ -3,10 +3,7 @@ use std::{fmt, io};
|
|||
#[cfg(test)]
|
||||
use proptest::{arbitrary::any, prelude::*};
|
||||
|
||||
use crate::{
|
||||
serde_helpers,
|
||||
serialization::{SerializationError, ZcashDeserialize, ZcashSerialize},
|
||||
};
|
||||
use crate::serialization::{serde_helpers, SerializationError, ZcashDeserialize, ZcashSerialize};
|
||||
|
||||
/// A ciphertext component for encrypted output notes.
|
||||
#[derive(Deserialize, Serialize)]
|
||||
|
|
|
@ -5,10 +5,7 @@ use proptest::{arbitrary::any, prelude::*};
|
|||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
serde_helpers,
|
||||
serialization::{SerializationError, ZcashDeserialize, ZcashSerialize},
|
||||
};
|
||||
use crate::serialization::{serde_helpers, SerializationError, ZcashDeserialize, ZcashSerialize};
|
||||
|
||||
/// A ciphertext component for encrypted output notes.
|
||||
#[derive(Serialize, Deserialize)]
|
||||
|
|
|
@ -2,8 +2,7 @@ use std::{fmt, io};
|
|||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::serde_helpers;
|
||||
use crate::serialization::{SerializationError, ZcashDeserialize, ZcashSerialize};
|
||||
use crate::serialization::{serde_helpers, SerializationError, ZcashDeserialize, ZcashSerialize};
|
||||
|
||||
/// An encoding of a BCTV14 proof, as used in Zcash.
|
||||
#[derive(Serialize, Deserialize)]
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
use std::{fmt, io};
|
||||
|
||||
use crate::serde_helpers;
|
||||
use crate::serialization::{SerializationError, ZcashDeserialize, ZcashSerialize};
|
||||
use crate::serialization::{serde_helpers, SerializationError, ZcashDeserialize, ZcashSerialize};
|
||||
|
||||
/// An encoding of a Groth16 proof, as used in Zcash.
|
||||
#[derive(Serialize, Deserialize)]
|
||||
|
|
|
@ -12,6 +12,8 @@ mod write_zcash;
|
|||
mod zcash_deserialize;
|
||||
mod zcash_serialize;
|
||||
|
||||
pub(crate) mod serde_helpers;
|
||||
|
||||
pub mod sha256d;
|
||||
|
||||
pub use error::SerializationError;
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
use super::equihash_solution::EQUIHASH_SOLUTION_SIZE;
|
||||
use serde_big_array::big_array;
|
||||
|
||||
big_array! {
|
||||
BigArray;
|
||||
+EQUIHASH_SOLUTION_SIZE,
|
||||
+ 1344, // `EquihashSolution`
|
||||
80, // `sapling::OutCiphertext`
|
||||
580, // `sapling::EncryptedCiphertext`
|
||||
601, // `sprout::EncryptedCiphertext`
|
||||
296, // `bctv14::Bctv14Proof`
|
||||
296, // `Bctv14Proof`
|
||||
196, // `Groth16Proof`
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[serde(remote = "jubjub::AffinePoint")]
|
||||
pub(crate) struct AffinePoint {
|
||||
pub struct AffinePoint {
|
||||
#[serde(getter = "jubjub::AffinePoint::to_bytes")]
|
||||
bytes: [u8; 32],
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ impl From<AffinePoint> for jubjub::AffinePoint {
|
|||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[serde(remote = "jubjub::Fq")]
|
||||
pub(crate) struct Fq {
|
||||
pub struct Fq {
|
||||
#[serde(getter = "jubjub::Fq::to_bytes")]
|
||||
bytes: [u8; 32],
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ impl From<Fq> for jubjub::Fq {
|
|||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[serde(remote = "futures::future::Either")]
|
||||
pub(crate) enum Either<A, B> {
|
||||
pub enum Either<A, B> {
|
||||
Left(A),
|
||||
Right(B),
|
||||
}
|
|
@ -2,7 +2,7 @@ use crate::{
|
|||
commitments, keys, notes,
|
||||
proofs::Groth16Proof,
|
||||
redjubjub::{self, Binding, SpendAuth},
|
||||
serde_helpers,
|
||||
serialization::serde_helpers,
|
||||
treestate::note_commitment_tree::SaplingNoteTreeRootHash,
|
||||
};
|
||||
use futures::future::Either;
|
||||
|
|
Loading…
Reference in New Issue