chain: move Memo into transaction
This commit is contained in:
parent
312c66264a
commit
e8f923ec86
|
@ -15,7 +15,6 @@ mod merkle_tree;
|
|||
|
||||
pub mod addresses;
|
||||
pub mod keys;
|
||||
pub mod notes;
|
||||
|
||||
pub mod amount;
|
||||
pub mod block;
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
//! Notes, note encryption, and nullifier types.
|
||||
|
||||
#[cfg(test)]
|
||||
mod arbitrary;
|
||||
pub mod memo;
|
|
@ -1,19 +0,0 @@
|
|||
use crate::notes::memo::Memo;
|
||||
|
||||
use proptest::{arbitrary::any, collection::vec, prelude::*};
|
||||
|
||||
impl Arbitrary for Memo {
|
||||
type Parameters = ();
|
||||
|
||||
fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy {
|
||||
(vec(any::<u8>(), 512))
|
||||
.prop_map(|v| {
|
||||
let mut bytes = [0; 512];
|
||||
bytes.copy_from_slice(v.as_slice());
|
||||
Memo(Box::new(bytes))
|
||||
})
|
||||
.boxed()
|
||||
}
|
||||
|
||||
type Strategy = BoxedStrategy<Self>;
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
pub const MEMO_FIELD_INVALID_UTF8_BYTES = [0xf6, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00];
|
|
@ -11,7 +11,7 @@ mod arbitrary;
|
|||
|
||||
use crate::{
|
||||
amount::{Amount, NonNegative},
|
||||
notes::memo::Memo,
|
||||
transaction::Memo,
|
||||
};
|
||||
|
||||
use super::{
|
||||
|
|
|
@ -11,7 +11,7 @@ mod nullifiers;
|
|||
|
||||
use crate::{
|
||||
amount::{Amount, NonNegative},
|
||||
notes::memo::Memo,
|
||||
transaction::Memo,
|
||||
};
|
||||
|
||||
use super::{commitment::CommitmentRandomness, keys::PayingKey};
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use proptest::{arbitrary::any, collection::vec, prelude::*};
|
||||
|
||||
|
||||
impl Arbitrary for super::EncryptedCiphertext {
|
||||
type Parameters = ();
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize};
|
|||
mod hash;
|
||||
mod joinsplit;
|
||||
mod lock_time;
|
||||
mod memo;
|
||||
mod serialize;
|
||||
mod shielded_data;
|
||||
mod transparent;
|
||||
|
@ -15,6 +16,7 @@ mod tests;
|
|||
pub use hash::TransactionHash;
|
||||
pub use joinsplit::{JoinSplit, JoinSplitData};
|
||||
pub use lock_time::LockTime;
|
||||
pub use memo::Memo;
|
||||
pub use shielded_data::{Output, ShieldedData, Spend};
|
||||
pub use transparent::{CoinbaseData, OutPoint, TransparentInput, TransparentOutput};
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@ use serde::{Deserialize, Serialize};
|
|||
|
||||
use crate::{
|
||||
amount::{Amount, NonNegative},
|
||||
sprout,
|
||||
primitives::{ed25519, x25519, ZkSnarkProof},
|
||||
sprout,
|
||||
};
|
||||
|
||||
/// A _JoinSplit Description_, as described in [protocol specification §7.2][ps].
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::{cmp, convert::TryFrom, fmt};
|
||||
|
||||
/// A 512-byte _Memo_ field associated with a note, as described in
|
||||
/// A 512-byte (plaintext) memo associated with a note, as described in
|
||||
/// [protocol specification §5.5][ps].
|
||||
///
|
||||
/// The _Memo_ field of a note is a plaintext type; the parent note is
|
|
@ -6,12 +6,12 @@ use crate::{
|
|||
amount::{Amount, NonNegative},
|
||||
block::BlockHeight,
|
||||
primitives::{Bctv14Proof, Groth16Proof, Script, ZkSnarkProof},
|
||||
sapling,
|
||||
sprout,
|
||||
transaction::{
|
||||
CoinbaseData, JoinSplit, JoinSplitData, LockTime, OutPoint, Output, ShieldedData, Spend,
|
||||
Transaction, TransparentInput, TransparentOutput,
|
||||
},
|
||||
sapling, sprout,
|
||||
};
|
||||
|
||||
use super::super::{
|
||||
CoinbaseData, JoinSplit, JoinSplitData, LockTime, Memo, OutPoint, Output, ShieldedData, Spend,
|
||||
Transaction, TransparentInput, TransparentOutput,
|
||||
};
|
||||
|
||||
impl Transaction {
|
||||
|
@ -100,6 +100,22 @@ impl Transaction {
|
|||
}
|
||||
}
|
||||
|
||||
impl Arbitrary for Memo {
|
||||
type Parameters = ();
|
||||
|
||||
fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy {
|
||||
(vec(any::<u8>(), 512))
|
||||
.prop_map(|v| {
|
||||
let mut bytes = [0; 512];
|
||||
bytes.copy_from_slice(v.as_slice());
|
||||
Memo(Box::new(bytes))
|
||||
})
|
||||
.boxed()
|
||||
}
|
||||
|
||||
type Strategy = BoxedStrategy<Self>;
|
||||
}
|
||||
|
||||
impl Arbitrary for LockTime {
|
||||
type Parameters = ();
|
||||
|
||||
|
|
Loading…
Reference in New Issue