diff --git a/.gitignore b/.gitignore index 60ba9980014..bbf0f99bd06 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ /target/ # Firebase caches (?) .firebase/ +# Emacs detritus +*~ diff --git a/zebra-chain/proptest-regressions/block/tests.txt b/zebra-chain/proptest-regressions/block/tests.txt new file mode 100644 index 00000000000..ae5bbef6281 --- /dev/null +++ b/zebra-chain/proptest-regressions/block/tests.txt @@ -0,0 +1,7 @@ +# Seeds for failure cases proptest has generated in the past. It is +# automatically read and these particular cases re-run before any +# novel cases are generated. +# +# It is recommended to check this file in to source control so that +# everyone who runs the test benefits from these saved cases. +cc 1fcf1e08caccdafad9c9f51c46cd24b992cf7207f55cae605a54830868527baa # shrinks to header = BlockHeader { previous_block_hash: BlockHeaderHash("0000000000000000000000000000000000000000000000000000000000000000"), merkle_root_hash: MerkleTreeRootHash([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), final_sapling_root_hash: SaplingNoteTreeRootHash([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), time: 1969-12-31T23:59:59Z, bits: 0, nonce: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], solution: EquihashSolution("000000000000000000000128fd6ffe028bf9b8e789cf2bf69845f52fddda4066064dd798670fd27ca39ab1a3a363ccd3aab31a6e3aaf168095acafbf6a95f01a651d0c1b799a8c3134838b78de78c7128b4280136f544792764a739e3f152e92a79e849d87db179f8aa6d565b5c9c5cb60f92acd669254c0a454ecc0d74d05e21135f5f9445dd18755bc2bd2af041ba3f903e22ceccf729825b382e95b0d90b6a8657645395caa9041a93e904505c762f57ed042cb8e3b69a7fbee5bb8d174fabd95fbae8e7c01e8ecfe69d32d3954c8bdf75f8a292b08358a74d67a63599c9c97a2af237cfe0a14fbe21d73676a097706836f31bfac1e269e050e8cd95ffa04f24553206df40b559ba59078053a19ca20e51fde2ed9bf3a6f2d64e50985abdb59843738296438fd1e0223f1bac8525f42ccbb8ca128436fd5fb936bf5819b2469334d2082120bcdd62e6b800bb64124dd7472e1a8fc14d8e022a4195ff7be3b93deb24f5cf2c54015fd3ba008d035f57c991dae92eb6ad4ddae0e115ab4bd1f36350688d1bbe44574dcf53f158ab3d2747764b5bbf962d66570ef2b25d9cca5dcca7c692c33d0999f916ec0c4f87816797fdb7d38152110008470755ccd74552d498962297c7f99e4a59aface18dfb626bd106043932d70ccb97aa17152cf2da8d30f252cdb42883376ab048f94b376b9f844a412900a41bb63e11af1ea6cb0387646665cb067ada754335c66f499008bf836a3ee08330e4cef1c8218c0af52cadb7caf11e970737f2b684409921969e5be75a3b3328a98528f1d5af263ba33555a9df47f055f5698ce5f02827e08ec56e17bca426e16ea75474be0c68a02c22a1a095821019e293d79d2cb39baea9d190b9c07b9c2961a1b87a20ca3b6bc078cd7f928062d37b4f39b43057196079a71148ea1c5ce60c78711d314e021dc378c00a66eb4190b19b1804241b01a2bb9577ea4532f31ed3b76772e91313fd2639d1ba0e238035fc1a1dfe3f83caa7b82a9fddbbf15cbf6266ab824bcbfbdd7d8684a1002aaa96d234f5bacc124b7df180fd743d9108848f2cd38fdd96493353b31cac694fba0f502fe8410659fdf77a3774959a3579e66eebe8a190361b7abbd5f761b8b5b3fc78f4f146b3ffb08560589d7d2e12d279f7720e0b4bf72dd396d8628e1a335c2260af81198b32345da6cae3f93f734f7faa8d7a025130443260c8dc0a3640256315839570a9745f3dd4c75a3dcac9ff7b0dd081e072dd2337e3461078ba09c51c477e4e0f64bdf3cf898df0e8add9f94618993242a147e3aa7a879fe8ced8b0e6421c700376757c32c5df309d45b986ea28733a5519f3b1b501951bbad2c4d4dc823b05233a6c957bdd336f74bc803d5cb6b001681eac90e4ce1ee1766419b2f2a1024d81b03c21699d61b0faeeba6325d429c5f338de675a9c0ebd2ef75f4ccd6fd0b46232368c8b59d574be2cf1c7ea01a5fd3f8f30f268ba858a0910bee8ce4345028a6e471fce6f28b98ae64b9609c8235adebd8cca87462cae60349bc4b61a8a86071025d0f6f314a8a00cd98bd2680e19441bdc124722ddc64833d29b26fb5c34819d6315fc05e4c362dd13e3221f78e251869abdf26d728ba0896897348a07407d5822928e724987998101a6d00e39c125b7b0d22f43aed8b7f15080b4d0fa056454392466bcd27e56d7d49dd35a86e0337c0bfb5efb14e3ebf353ee57d6631437881e42ed3da531737d6266550ea4a6ced3f9b53523e6233e95a8b5fa730d321b1618cb67488f82c6fe2b17b6483910e25cc7b6df22560694a185bea249d29ac0699edba45038713077589a3b3058e1a4bf4579f4b224dbe01e1e017c268dafde88a89e9cb29f999b8870ce704275e24861613188555") } diff --git a/zebra-chain/src/block.rs b/zebra-chain/src/block.rs index a096bde8517..b0093658552 100644 --- a/zebra-chain/src/block.rs +++ b/zebra-chain/src/block.rs @@ -1,9 +1,19 @@ //! Definitions of block datastructures. -use chrono::{DateTime, Utc}; +#[cfg(test)] +pub mod test_vectors; +#[cfg(test)] +mod tests; + +use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt}; +use chrono::{DateTime, TimeZone, Utc}; use hex; use std::{fmt, io}; +#[cfg(test)] +use proptest_derive::Arbitrary; + +use crate::equihash_solution::EquihashSolution; use crate::merkle_tree::MerkleTreeRootHash; use crate::note_commitment_tree::SaplingNoteTreeRootHash; use crate::serialization::{ReadZcashExt, SerializationError, ZcashDeserialize, ZcashSerialize}; @@ -23,6 +33,7 @@ use crate::transaction::Transaction; /// for now I want to call it a `BlockHeaderHash` because that's /// more explicit. #[derive(Copy, Clone, Eq, PartialEq)] +#[cfg_attr(test, derive(Arbitrary))] pub struct BlockHeaderHash(pub [u8; 32]); impl fmt::Debug for BlockHeaderHash { @@ -52,8 +63,7 @@ impl ZcashSerialize for BlockHeaderHash { impl ZcashDeserialize for BlockHeaderHash { fn zcash_deserialize(mut reader: R) -> Result { - let bytes = reader.read_32_bytes()?; - Ok(BlockHeaderHash(bytes)) + Ok(BlockHeaderHash(reader.read_32_bytes()?)) } } @@ -63,7 +73,7 @@ impl ZcashDeserialize for BlockHeaderHash { /// backwards reference (previous header hash) present in the block /// header. Each block points backwards to its parent, all the way /// back to the genesis block (the first block in the blockchain). -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] pub struct BlockHeader { /// A SHA-256d hash in internal byte order of the previous block’s /// header. This ensures no previous block can be changed without @@ -104,22 +114,42 @@ pub struct BlockHeader { nonce: [u8; 32], /// The Equihash solution. - // The solution size when serialized should be in bytes ('always - // 1344'). I first tried this as a [u8; 1344] but until const - // generics land we'd have to implement all our common traits - // manually, like in pzec. - solution: Vec, + solution: EquihashSolution, } impl ZcashSerialize for BlockHeader { - fn zcash_serialize(&self, _writer: W) -> Result<(), SerializationError> { - unimplemented!(); + fn zcash_serialize(&self, mut writer: W) -> Result<(), SerializationError> { + // "The current and only defined block version number for Zcash is 4." + writer.write_u32::(4)?; + self.previous_block_hash.zcash_serialize(&mut writer)?; + writer.write_all(&self.merkle_root_hash.0[..])?; + writer.write_all(&self.final_sapling_root_hash.0[..])?; + writer.write_u32::(self.time.timestamp() as u32)?; + writer.write_u32::(self.bits)?; + writer.write_all(&self.nonce[..])?; + self.solution.zcash_serialize(&mut writer)?; + Ok(()) } } impl ZcashDeserialize for BlockHeader { - fn zcash_deserialize(_reader: R) -> Result { - unimplemented!(); + fn zcash_deserialize(mut reader: R) -> Result { + // "The current and only defined block version number for Zcash is 4." + let version = reader.read_u32::()?; + + if version != 4 { + return Err(SerializationError::Parse("bad block header")); + } + + Ok(BlockHeader { + previous_block_hash: BlockHeaderHash::zcash_deserialize(&mut reader)?, + merkle_root_hash: MerkleTreeRootHash(reader.read_32_bytes()?), + final_sapling_root_hash: SaplingNoteTreeRootHash(reader.read_32_bytes()?), + time: Utc.timestamp(reader.read_u32::()? as i64, 0), + bits: reader.read_u32::()?, + nonce: reader.read_32_bytes()?, + solution: EquihashSolution::zcash_deserialize(reader)?, + }) } } @@ -130,6 +160,7 @@ impl ZcashDeserialize for BlockHeader { /// Block header: a data structure containing the block's metadata /// Transactions: an array (vector in Rust) of transactions #[derive(Clone, Debug, Eq, PartialEq)] +#[cfg_attr(test, derive(Arbitrary))] pub struct Block { /// First 80 bytes of the block as defined by the encoding used by /// "block" messages. @@ -140,37 +171,18 @@ pub struct Block { } impl ZcashSerialize for Block { - fn zcash_serialize(&self, _writer: W) -> Result<(), SerializationError> { - unimplemented!(); + fn zcash_serialize(&self, mut writer: W) -> Result<(), SerializationError> { + self.header.zcash_serialize(&mut writer)?; + self.transactions.zcash_serialize(&mut writer)?; + Ok(()) } } impl ZcashDeserialize for Block { - fn zcash_deserialize(_reader: R) -> Result { - unimplemented!(); - } -} - -#[cfg(test)] -mod tests { - - use std::io::Write; - - use super::BlockHeaderHash; - - use crate::sha256d_writer::Sha256dWriter; - - #[test] - fn blockheaderhash_debug() { - let preimage = b"foo bar baz"; - let mut sha_writer = Sha256dWriter::default(); - let _ = sha_writer.write_all(preimage); - - let hash = BlockHeaderHash(sha_writer.finish()); - - assert_eq!( - format!("{:?}", hash), - "BlockHeaderHash(\"bf46b4b5030752fedac6f884976162bbfb29a9398f104a280b3e34d51b416631\")" - ); + fn zcash_deserialize(mut reader: R) -> Result { + Ok(Block { + header: BlockHeader::zcash_deserialize(&mut reader)?, + transactions: Vec::zcash_deserialize(&mut reader)?, + }) } } diff --git a/zebra-chain/src/block/test_vectors.rs b/zebra-chain/src/block/test_vectors.rs new file mode 100644 index 00000000000..d167b75de3f --- /dev/null +++ b/zebra-chain/src/block/test_vectors.rs @@ -0,0 +1,98 @@ +// Copied from librustzcash +// From mainnet block 415000. +// https://explorer.zcha.in/blocks/415000 +pub const HEADER_MAINNET_415000: [u8; 1487] = [ + 0x04, 0x00, 0x00, 0x00, 0x52, 0x74, 0xb4, 0x3b, 0x9e, 0x4a, 0xd8, 0xf4, 0x3e, 0x93, 0xf7, 0x84, + 0x63, 0xd2, 0x4d, 0xcf, 0xe5, 0x31, 0xae, 0xb4, 0x71, 0x98, 0x19, 0xf4, 0xf9, 0x7f, 0x7e, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x66, 0x30, 0x73, 0xbc, 0x4b, 0xfa, 0x95, 0xc9, 0xbe, 0xc3, 0x6a, 0xad, + 0x72, 0x68, 0xa5, 0x73, 0x04, 0x97, 0x97, 0xbd, 0xfc, 0x5a, 0xa4, 0xc7, 0x43, 0xfb, 0xe4, 0x82, + 0x0a, 0xa3, 0x93, 0xce, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xa8, 0xbe, 0xcc, 0x5b, 0xe1, 0xab, 0x03, 0x1c, 0xc2, 0xfd, 0x60, 0x7c, + 0x77, 0x6a, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0xb2, 0x18, 0x19, 0xfd, 0x40, 0x05, 0x00, + 0x94, 0x9d, 0x55, 0xde, 0x0c, 0xc6, 0x33, 0xe0, 0xcc, 0xe4, 0x1e, 0x46, 0x49, 0xef, 0x4a, 0xa3, + 0x34, 0x9f, 0x01, 0x00, 0x29, 0x0f, 0xfe, 0x28, 0x1b, 0x94, 0x7b, 0x3b, 0x53, 0xfb, 0xd2, 0xf3, + 0x5b, 0x1c, 0xe2, 0x92, 0x64, 0x9b, 0x96, 0xac, 0x6e, 0x08, 0x83, 0xaf, 0x3a, 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0x6b, 0xc2, 0x54, 0xd5, 0x09, + 0xad, 0xeb, 0x75, 0xcb, 0xa7, 0x6d, 0x48, 0xfe, 0x02, 0x4e, 0x3e, 0x66, 0xd8, 0xdf, 0x5e, +]; diff --git a/zebra-chain/src/block/tests.rs b/zebra-chain/src/block/tests.rs new file mode 100644 index 00000000000..7f36d109da2 --- /dev/null +++ b/zebra-chain/src/block/tests.rs @@ -0,0 +1,142 @@ +use std::io::{Cursor, Write}; + +use chrono::NaiveDateTime; +use proptest::{ + arbitrary::{any, Arbitrary}, + prelude::*, +}; + +use crate::sha256d_writer::Sha256dWriter; + +use super::*; + +#[cfg(test)] +impl Arbitrary for BlockHeader { + type Parameters = (); + + fn arbitrary_with(_args: ()) -> Self::Strategy { + ( + any::(), + any::(), + any::(), + (0i64..4_294_967_296i64), + any::(), + any::<[u8; 32]>(), + any::(), + ) + .prop_map( + |( + block_hash, + merkle_root_hash, + sapling_root_hash, + timestamp, + bits, + nonce, + equihash_solution, + )| BlockHeader { + previous_block_hash: block_hash, + merkle_root_hash: merkle_root_hash, + final_sapling_root_hash: sapling_root_hash, + time: Utc.timestamp(timestamp, 0), + bits: bits, + nonce: nonce, + solution: equihash_solution, + }, + ) + .boxed() + } + + type Strategy = BoxedStrategy; +} + +#[test] +fn blockheaderhash_debug() { + let preimage = b"foo bar baz"; + let mut sha_writer = Sha256dWriter::default(); + let _ = sha_writer.write_all(preimage); + + let hash = BlockHeaderHash(sha_writer.finish()); + + assert_eq!( + format!("{:?}", hash), + "BlockHeaderHash(\"bf46b4b5030752fedac6f884976162bbfb29a9398f104a280b3e34d51b416631\")" + ); +} + +#[test] +fn blockheaderhash_from_blockheader() { + let some_bytes = [0; 32]; + + let blockheader = BlockHeader { + previous_block_hash: BlockHeaderHash(some_bytes), + merkle_root_hash: MerkleTreeRootHash(some_bytes), + final_sapling_root_hash: SaplingNoteTreeRootHash(some_bytes), + time: DateTime::::from_utc(NaiveDateTime::from_timestamp(61, 0), Utc), + bits: 0, + nonce: some_bytes, + solution: EquihashSolution([0; 1344]), + }; + + let hash = BlockHeaderHash::from(blockheader); + + assert_eq!( + format!("{:?}", hash), + "BlockHeaderHash(\"39c92b8c6b582797830827c78d58674c7205fcb21991887c124d1dbe4b97d6d1\")" + ); + + let mut bytes = Cursor::new(Vec::new()); + + blockheader + .zcash_serialize(&mut bytes) + .expect("these bytes to serialize from a blockheader without issue"); + + bytes.set_position(0); + let other_header = BlockHeader::zcash_deserialize(&mut bytes) + .expect("these bytes to deserialize into a blockheader without issue"); + + assert_eq!(blockheader, other_header); +} + +#[test] +fn deserialize_blockheader() { + // https://explorer.zcha.in/blocks/415000 + let _header = BlockHeader::zcash_deserialize(&test_vectors::HEADER_MAINNET_415000[..]) + .expect("blockheader test vector should deserialize"); +} + +proptest! { + + #[test] + fn blockheaderhash_roundtrip(hash in any::()) { + let mut bytes = Cursor::new(Vec::new()); + hash.zcash_serialize(&mut bytes)?; + + bytes.set_position(0); + let other_hash = BlockHeaderHash::zcash_deserialize(&mut bytes)?; + + prop_assert_eq![hash, other_hash]; + } + + #[test] + fn blockheader_roundtrip(header in any::()) { + let mut bytes = Cursor::new(Vec::new()); + header.zcash_serialize(&mut bytes)?; + + bytes.set_position(0); + let other_header = BlockHeader::zcash_deserialize(&mut bytes)?; + + prop_assert_eq![header, other_header]; + } + + #[test] + fn block_roundtrip(block in any::()) { + let mut bytes = Cursor::new(Vec::new()); + block.zcash_serialize(&mut bytes)?; + + bytes.set_position(0); + let other_block = Block::zcash_deserialize(&mut bytes)?; + + prop_assert_eq![block, other_block]; + } + +} diff --git a/zebra-chain/src/equihash_solution.rs b/zebra-chain/src/equihash_solution.rs index e0107619f10..55ca811644e 100644 --- a/zebra-chain/src/equihash_solution.rs +++ b/zebra-chain/src/equihash_solution.rs @@ -1,8 +1,13 @@ //! Equihash Solution and related items. -// use std::fmt; +use std::{fmt, io}; -// use hex::ToHex; +#[cfg(test)] +use proptest::{arbitrary::Arbitrary, collection::vec, prelude::*}; + +use crate::serialization::{ + ReadZcashExt, SerializationError, WriteZcashExt, ZcashDeserialize, ZcashSerialize, +}; /// The size of an Equihash solution in bytes (always 1344). const EQUIHASH_SOLUTION_SIZE: usize = 1344; @@ -15,24 +20,89 @@ const EQUIHASH_SOLUTION_SIZE: usize = 1344; /// /// The size of an Equihash solution in bytes is always 1344 so the /// length of this type is fixed. -#[derive(Clone)] -pub struct EquihashSolution([u8; EQUIHASH_SOLUTION_SIZE]); +pub struct EquihashSolution(pub [u8; EQUIHASH_SOLUTION_SIZE]); -impl Default for EquihashSolution { - fn default() -> Self { - EquihashSolution([0; EQUIHASH_SOLUTION_SIZE]) +impl PartialEq for EquihashSolution { + fn eq(&self, other: &EquihashSolution) -> bool { + self.0.as_ref() == other.0.as_ref() } } -// TODO: fix hex crate import conflict with tracing-subscriber -// impl fmt::Debug for EquihashSolution { -// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { -// f.write_str(&self.0.encode_hex::()) -// } -// } +impl fmt::Debug for EquihashSolution { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("EquihashSolution") + .field(&hex::encode(&self.0[..])) + .finish() + } +} + +// These impls all only exist because of array length restrictions. + +impl Copy for EquihashSolution {} + +impl Clone for EquihashSolution { + fn clone(&self) -> Self { + let mut bytes = [0; EQUIHASH_SOLUTION_SIZE]; + bytes[..].copy_from_slice(&self.0[..]); + Self(bytes) + } +} + +impl Eq for EquihashSolution {} + +impl ZcashSerialize for EquihashSolution { + fn zcash_serialize(&self, mut writer: W) -> Result<(), SerializationError> { + writer.write_compactsize(EQUIHASH_SOLUTION_SIZE as u64)?; + writer.write_all(&self.0[..])?; + Ok(()) + } +} + +impl ZcashDeserialize for EquihashSolution { + fn zcash_deserialize(mut reader: R) -> Result { + reader.read_compactsize()?; + let mut bytes = [0; EQUIHASH_SOLUTION_SIZE]; + reader.read_exact(&mut bytes[..])?; + Ok(Self(bytes)) + } +} + +#[cfg(test)] +impl Arbitrary for EquihashSolution { + type Parameters = (); + + fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy { + (vec(any::(), EQUIHASH_SOLUTION_SIZE)) + .prop_map(|v| { + let mut bytes = [0; EQUIHASH_SOLUTION_SIZE]; + bytes.copy_from_slice(v.as_slice()); + return Self(bytes); + }) + .boxed() + } + + type Strategy = BoxedStrategy; +} + +#[cfg(test)] +mod tests { + + use super::*; + + proptest! { + + #[test] + fn equihash_solution_roundtrip(solution in any::()) { + + let mut data = Vec::new(); + + solution.zcash_serialize(&mut data).expect("EquihashSolution should serialize"); + + let solution2 = EquihashSolution::zcash_deserialize(&data[..]) + .expect("randomized EquihashSolution should deserialize"); + + prop_assert_eq![solution, solution2]; + } -impl PartialEq for EquihashSolution { - fn eq(&self, other: &EquihashSolution) -> bool { - self.0.as_ref() == other.0.as_ref() } } diff --git a/zebra-chain/src/merkle_tree.rs b/zebra-chain/src/merkle_tree.rs index 72f2540ac0a..1ed9b2f54a5 100644 --- a/zebra-chain/src/merkle_tree.rs +++ b/zebra-chain/src/merkle_tree.rs @@ -3,6 +3,9 @@ use std::io; +#[cfg(test)] +use proptest_derive::Arbitrary; + use crate::serialization::{SerializationError, ZcashDeserialize, ZcashSerialize}; use crate::sha256d_writer::Sha256dWriter; use crate::transaction::Transaction; @@ -28,8 +31,9 @@ impl ZcashDeserialize for MerkleTree { /// A SHA-256d hash of the root node of a merkle tree of SHA256-d /// hashed transactions in a block. -#[derive(Clone, Debug, Eq, PartialEq)] -pub struct MerkleTreeRootHash([u8; 32]); +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +#[cfg_attr(test, derive(Arbitrary))] +pub struct MerkleTreeRootHash(pub [u8; 32]); impl From> for MerkleTreeRootHash { fn from(merkle_tree: MerkleTree) -> Self { diff --git a/zebra-chain/src/note_commitment_tree.rs b/zebra-chain/src/note_commitment_tree.rs index 4eba6a24114..32eb0bd2873 100644 --- a/zebra-chain/src/note_commitment_tree.rs +++ b/zebra-chain/src/note_commitment_tree.rs @@ -31,7 +31,7 @@ pub struct SaplingNoteCommitmentTree; /// commitment tree corresponding to the final Sapling treestate of /// this block. A root of a note commitment tree is associated with /// each treestate. -#[derive(Clone, Debug, Default, Eq, PartialEq)] +#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)] #[cfg_attr(test, derive(Arbitrary))] pub struct SaplingNoteTreeRootHash(pub [u8; 32]); diff --git a/zebra-chain/src/sha256d_writer.rs b/zebra-chain/src/sha256d_writer.rs index 5e835cdfc17..4e4c14a34c6 100644 --- a/zebra-chain/src/sha256d_writer.rs +++ b/zebra-chain/src/sha256d_writer.rs @@ -31,3 +31,21 @@ impl Write for Sha256dWriter { Ok(()) } } + +#[cfg(test)] +mod tests { + + use std::io::Write; + + use crate::sha256d_writer::Sha256dWriter; + + #[test] + // Just checking that `flush()` succeeds without error. + fn sha256d_flush() { + let preimage = b"foo bar baz"; + let mut sha_writer = Sha256dWriter::default(); + let _ = sha_writer.write_all(preimage); + + assert_eq!(sha_writer.flush().unwrap(), ()); + } +} diff --git a/zebra-chain/src/transaction.rs b/zebra-chain/src/transaction.rs index 63dc76bb2a8..651e684dbd3 100644 --- a/zebra-chain/src/transaction.rs +++ b/zebra-chain/src/transaction.rs @@ -6,6 +6,8 @@ mod serialize; mod shielded_data; mod transparent; +#[cfg(test)] +mod test_vectors; #[cfg(test)] mod tests; diff --git a/zebra-chain/src/transaction/test_vectors.rs b/zebra-chain/src/transaction/test_vectors.rs new file mode 100644 index 00000000000..1a427e9cb5a --- /dev/null +++ b/zebra-chain/src/transaction/test_vectors.rs @@ -0,0 +1,131 @@ +// Copied from librustzcash +// TxID: 64f0bd7fe30ce23753358fe3a2dc835b8fba9c0274c4e2c54a6f73114cb55639 +// From testnet block 280003. +pub const GENERIC_TESTNET_TX: [u8; 2005] = [ + 0x04, 0x00, 0x00, 0x80, 0x85, 0x20, 0x2f, 0x89, 0x01, 0x8f, 0x64, 0x29, 0x96, 0xdf, 0x1e, 0x93, + 0xa6, 0xd7, 0x9a, 0xe5, 0xba, 0xae, 0x34, 0x93, 0xf4, 0x23, 0xca, 0x6c, 0x82, 0xe9, 0x9f, 0x3e, + 0x8d, 0x95, 0x24, 0xfa, 0x78, 0xbc, 0xf1, 0x61, 0x67, 0x00, 0x00, 0x00, 0x00, 0x6b, 0x48, 0x30, + 0x45, 0x02, 0x21, 0x00, 0xb6, 0x5e, 0x37, 0x22, 0x97, 0x07, 0xd9, 0xcd, 0x48, 0x39, 0x40, 0xd2, + 0xab, 0x8b, 0xdc, 0x0b, 0x74, 0xb1, 0x2d, 0xda, 0x66, 0xd0, 0x2d, 0xbd, 0xf3, 0x6f, 0xd3, 0x83, + 0xb9, 0x60, 0x2a, 0x51, 0x02, 0x20, 0x4b, 0xe7, 0xfd, 0x7a, 0x39, 0xa4, 0xa4, 0x2d, 0xff, 0x07, + 0x1a, 0x5a, 0x2b, 0xc5, 0x1b, 0x49, 0x2d, 0x33, 0xf0, 0xbc, 0x39, 0x4b, 0xc8, 0x78, 0x61, 0xe1, + 0xbc, 0xaa, 0xf2, 0xba, 0xc9, 0x3b, 0x01, 0x21, 0x02, 0x48, 0xe7, 0x8b, 0xdc, 0x18, 0xf1, 0xa8, + 0x31, 0x10, 0xc1, 0x2e, 0x40, 0x08, 0xb7, 0x64, 0x02, 0x69, 0x61, 0xb1, 0x68, 0xfe, 0x8d, 0x5a, + 0x8d, 0x94, 0x7e, 0xfe, 0x6a, 0xf8, 0x3c, 0xc8, 0x8e, 0xff, 0xff, 0xff, 0xff, 0x01, 0xf0, 0xf2, + 0x70, 0x18, 0x02, 0x00, 0x00, 0x00, 0x19, 0x76, 0xa9, 0x14, 0xa2, 0x84, 0xd0, 0x51, 0x1d, 0x0e, + 0x52, 0x0d, 0x36, 0xf4, 0x44, 0xa3, 0x6c, 0x10, 0xbf, 0x54, 0xb4, 0xb0, 0x17, 0xcd, 0x88, 0xac, + 0x00, 0x00, 0x00, 0x00, 0xd7, 0x45, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0xca, 0x9a, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x13, 0x31, 0xa3, 0x05, 0x9e, 0x66, 0xaa, 0x6c, 0xa9, 0x7a, 0x62, 0xf5, 0x6e, + 0xa2, 0x34, 0x20, 0x75, 0x68, 0x56, 0x6f, 0x69, 0x71, 0xb3, 0x72, 0x2a, 0xe0, 0xdd, 0x82, 0xc0, + 0x03, 0x99, 0x69, 0x2a, 0xac, 0xb5, 0xfb, 0x12, 0xac, 0x58, 0x0a, 0xc2, 0x66, 0x24, 0xa8, 0xcf, + 0x0a, 0x90, 0x4c, 0xd6, 0xf4, 0xbf, 0xea, 0x55, 0x62, 0x52, 0x05, 0xcb, 0x58, 0xf0, 0x6b, 0x1c, + 0x19, 0x74, 0x23, 0x28, 0x0d, 0xea, 0xc7, 0x4e, 0xea, 0x97, 0x59, 0x8c, 0x43, 0x14, 0xd8, 0x99, + 0xa4, 0xfd, 0x85, 0x31, 0x1e, 0x04, 0x62, 0x57, 0xd2, 0xd4, 0xc2, 0x97, 0xf1, 0x40, 0x6c, 0xf7, + 0x09, 0xd9, 0x2a, 0x86, 0x07, 0xf7, 0x69, 0x8d, 0x45, 0xfe, 0x9f, 0x41, 0xde, 0xa3, 0xa0, 0x57, + 0x1c, 0x5d, 0xa5, 0xcf, 0xa7, 0x8e, 0x18, 0xeb, 0xf5, 0x80, 0xc3, 0x61, 0x79, 0xd9, 0xd6, 0xe6, + 0x32, 0x0a, 0x34, 0x8f, 0x14, 0x6c, 0x40, 0x7a, 0xda, 0xb4, 0xcb, 0x31, 0x03, 0x92, 0xa5, 0xf5, + 0xb5, 0xab, 0x28, 0x3b, 0x78, 0x34, 0x3b, 0xa9, 0x1a, 0xbc, 0x7c, 0x4b, 0xfe, 0x23, 0xa3, 0xdb, + 0xaf, 0x80, 0x37, 0xc6, 0x76, 0xe5,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 0xe8, 0xd8, 0x03, 0x2b, 0x86, 0x1b, + 0x4a, 0xad, 0x20, 0x02, 0xa8, 0xfd, 0x17, 0xc9, 0x28, 0x2b, 0x82, 0x5f, 0x02, 0xd3, 0x53, 0xe2, + 0x91, 0x37, 0x9c, 0xed, 0x00, 0xeb, 0xaa, 0x3c, 0x03, 0xe0, 0x1d, 0x9c, 0x59, 0xf4, 0x05, 0x09, + 0x9d, 0x1c, 0x34, 0x32, 0xba, 0xd0, 0x63, 0x58, 0xd6, 0xb1, 0x94, 0x2f, 0x0b, 0xaf, 0x71, 0x09, + 0x98, 0xd1, 0x0a, 0x22, 0xd1, 0x55, 0xb0, 0xfe, 0x84, 0x99, 0x52, 0x89, 0x31, 0x26, 0x94, 0x9f, + 0xf9, 0x2d, 0xe3, 0xa4, 0xc2, 0xee, 0xaf, 0xdf, 0x68, 0x84, 0x35, 0xe3, 0x25, 0xd8, 0x1c, 0x2c, + 0xe0, 0x08, 0xcf, 0x6c, 0x76, 0x03, 0x0d, 0x4d, 0x46, 0x34, 0x2a, 0xc3, 0x37, 0x2c, 0x73, 0x98, + 0x65, 0x60, 0xc4, 0xec, 0x35, 0xa6, 0xf6, 0x49, 0xef, 0x02, 0xc1, 0x19, 0x36, 0xb7, 0x03, 0x9b, + 0xc6, 0xf5, 0xd0, 0x94, 0x38, 0xdb, 0xe4, 0x76, 0x25, 0x1b, 0x59, 0x64, 0xb6, 0x8f, 0x02, 0xee, + 0xdf, 0xf7, 0xa9, 0xe0, 0xed, 0x3e, 0x30, 0x90, 0x96, 0x5a, 0x22, 0xf2, 0xc5, 0x52, 0xce, 0x3b, + 0x2b, 0x47, 0x4f, 0xd2, 0xfc, 0x06, 0xb5, 0x09, 0x27, 0x83, 0x0a, 0x05, 0xa3, 0x03, 0xfa, 0xff, + 0xd6, 0x84, 0x82, 0xd7, 0xb7, 0x85, 0x38, 0x43, 0x25, 0x40, 0xdd, 0x32, 0x61, 0xab, 0x75, 0x9b, + 0x65, 0x82, 0x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x74, 0x3f, 0xab, 0x29, 0x77, 0x76, 0xcc, 0x9c, + 0xf7, 0x9e, 0x90, 0xe8, 0xfc, 0xe1, 0x00, 0x17, 0x90, 0xc2, 0xe7, 0xd5, 0xc9, 0x58, 0x64, 0x7c, + 0xca, 0x5d, 0x33, 0x97, 0xd2, 0x0a, 0xfc, 0xf2, 0x9b, 0xa4, 0x4f, 0x62, 0xa7, 0xc6, 0x2e, 0x90, + 0x8d, 0x84, 0x8d, 0x81, 0xa7, 0x9f, 0xad, 0xbb, 0x37, 0x0a, 0xba, 0x93, 0xb0, 0x3e, 0x41, 0xd4, + 0xbc, 0x49, 0xe2, 0x99, 0xd6, 0xd3, 0x3f, 0xaf, 0x86, 0x9f, 0x36, 0x37, 0x14, 0x14, 0xce, 0x64, + 0x6f, 0xc2, 0xca, 0x6d, 0xcf, 0xf5, 0x5a, 0x6e, 0x06, 0x39, 0xd5, 0x0c, 0xae, 0xb1, 0x14, 0xc4, + 0x18, 0xc6, 0x26, 0xb8, 0x67, 0x15, 0x43, 0x64, 0x81, 0xd1, 0x92, 0x8d, 0x55, 0xa7, 0x56, 0xa6, + 0x03, 0xe7, 0x11, 0x0c, 0x3a, 0xfe, 0x96, 0x3c, 0x2b, 0x29, 0xa4, 0x78, 0xf9, 0xd4, 0x39, 0x7b, + 0x88, 0x5a, 0x67, 0xb0, 0x93, 0xa3, 0x45, 0x79, 0x62, 0x19, 0xc1, 0x11, 0xb7, 0xe9, 0x4d, 0xb3, + 0x90, 0xaa, 0x4b, 0xb7, 0x6b, 0x66, 0xa5, 0x34, 0xe5, 0xe2, 0x67, 0x9b, 0x27, 0xdb, 0x5f, 0x95, + 0xfd, 0x09, 0xa3, 0x6b, 0x05, +]; diff --git a/zebra-chain/src/transaction/tests.rs b/zebra-chain/src/transaction/tests.rs index 2db65d475ce..2bb61b279a3 100644 --- a/zebra-chain/src/transaction/tests.rs +++ b/zebra-chain/src/transaction/tests.rs @@ -118,155 +118,13 @@ impl Arbitrary for Transaction { #[test] fn librustzcash_tx_deserialize_and_round_trip() { - // Copied from librustzcash - // TxID: 64f0bd7fe30ce23753358fe3a2dc835b8fba9c0274c4e2c54a6f73114cb55639 - // From testnet block 280003. - let data = [ - 0x04, 0x00, 0x00, 0x80, 0x85, 0x20, 0x2f, 0x89, 0x01, 0x8f, 0x64, 0x29, 0x96, 0xdf, 0x1e, - 0x93, 0xa6, 0xd7, 0x9a, 0xe5, 0xba, 0xae, 0x34, 0x93, 0xf4, 0x23, 0xca, 0x6c, 0x82, 0xe9, - 0x9f, 0x3e, 0x8d, 0x95, 0x24, 0xfa, 0x78, 0xbc, 0xf1, 0x61, 0x67, 0x00, 0x00, 0x00, 0x00, - 0x6b, 0x48, 0x30, 0x45, 0x02, 0x21, 0x00, 0xb6, 0x5e, 0x37, 0x22, 0x97, 0x07, 0xd9, 0xcd, - 0x48, 0x39, 0x40, 0xd2, 0xab, 0x8b, 0xdc, 0x0b, 0x74, 0xb1, 0x2d, 0xda, 0x66, 0xd0, 0x2d, - 0xbd, 0xf3, 0x6f, 0xd3, 0x83, 0xb9, 0x60, 0x2a, 0x51, 0x02, 0x20, 0x4b, 0xe7, 0xfd, 0x7a, - 0x39, 0xa4, 0xa4, 0x2d, 0xff, 0x07, 0x1a, 0x5a, 0x2b, 0xc5, 0x1b, 0x49, 0x2d, 0x33, 0xf0, - 0xbc, 0x39, 0x4b, 0xc8, 0x78, 0x61, 0xe1, 0xbc, 0xaa, 0xf2, 0xba, 0xc9, 0x3b, 0x01, 0x21, - 0x02, 0x48, 0xe7, 0x8b, 0xdc, 0x18, 0xf1, 0xa8, 0x31, 0x10, 0xc1, 0x2e, 0x40, 0x08, 0xb7, - 0x64, 0x02, 0x69, 0x61, 0xb1, 0x68, 0xfe, 0x8d, 0x5a, 0x8d, 0x94, 0x7e, 0xfe, 0x6a, 0xf8, - 0x3c, 0xc8, 0x8e, 0xff, 0xff, 0xff, 0xff, 0x01, 0xf0, 0xf2, 0x70, 0x18, 0x02, 0x00, 0x00, - 0x00, 0x19, 0x76, 0xa9, 0x14, 0xa2, 0x84, 0xd0, 0x51, 0x1d, 0x0e, 0x52, 0x0d, 0x36, 0xf4, - 0x44, 0xa3, 0x6c, 0x10, 0xbf, 0x54, 0xb4, 0xb0, 0x17, 0xcd, 0x88, 0xac, 0x00, 0x00, 0x00, - 0x00, 0xd7, 0x45, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0xca, 0x9a, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x13, 0x31, 0xa3, 0x05, 0x9e, 0x66, 0xaa, 0x6c, 0xa9, 0x7a, 0x62, 0xf5, 0x6e, - 0xa2, 0x34, 0x20, 0x75, 0x68, 0x56, 0x6f, 0x69, 0x71, 0xb3, 0x72, 0x2a, 0xe0, 0xdd, 0x82, - 0xc0, 0x03, 0x99, 0x69, 0x2a, 0xac, 0xb5, 0xfb, 0x12, 0xac, 0x58, 0x0a, 0xc2, 0x66, 0x24, - 0xa8, 0xcf, 0x0a, 0x90, 0x4c, 0xd6, 0xf4, 0xbf, 0xea, 0x55, 0x62, 0x52, 0x05, 0xcb, 0x58, - 0xf0, 0x6b, 0x1c, 0x19, 0x74, 0x23, 0x28, 0x0d, 0xea, 0xc7, 0x4e, 0xea, 0x97, 0x59, 0x8c, - 0x43, 0x14, 0xd8, 0x99, 0xa4, 0xfd, 0x85, 0x31, 0x1e, 0x04, 0x62, 0x57, 0xd2, 0xd4, 0xc2, - 0x97, 0xf1, 0x40, 0x6c, 0xf7, 0x09, 0xd9, 0x2a, 0x86, 0x07, 0xf7, 0x69, 0x8d, 0x45, 0xfe, - 0x9f, 0x41, 0xde, 0xa3, 0xa0, 0x57, 0x1c, 0x5d, 0xa5, 0xcf, 0xa7, 0x8e, 0x18, 0xeb, 0xf5, - 0x80, 0xc3, 0x61, 0x79, 0xd9, 0xd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c3, 0xe3, 0x2a, 0xa7, 0x07, 0x8e, 0x83, 0xd4, 0xc1, 0x92, 0x9e, 0x1e, 0x1d, 0x86, 0x14, - 0x1c, 0xde, 0xb1, 0x89, 0x20, 0x91, 0x09, 0x75, 0xdb, 0x3a, 0x76, 0x26, 0x82, 0x05, 0x99, - 0x63, 0x0c, 0x42, 0x3a, 0xde, 0x23, 0x3d, 0x5d, 0x60, 0x68, 0x55, 0x24, 0xe8, 0xd8, 0x03, - 0x2b, 0x86, 0x1b, 0x4a, 0xad, 0x20, 0x02, 0xa8, 0xfd, 0x17, 0xc9, 0x28, 0x2b, 0x82, 0x5f, - 0x02, 0xd3, 0x53, 0xe2, 0x91, 0x37, 0x9c, 0xed, 0x00, 0xeb, 0xaa, 0x3c, 0x03, 0xe0, 0x1d, - 0x9c, 0x59, 0xf4, 0x05, 0x09, 0x9d, 0x1c, 0x34, 0x32, 0xba, 0xd0, 0x63, 0x58, 0xd6, 0xb1, - 0x94, 0x2f, 0x0b, 0xaf, 0x71, 0x09, 0x98, 0xd1, 0x0a, 0x22, 0xd1, 0x55, 0xb0, 0xfe, 0x84, - 0x99, 0x52, 0x89, 0x31, 0x26, 0x94, 0x9f, 0xf9, 0x2d, 0xe3, 0xa4, 0xc2, 0xee, 0xaf, 0xdf, - 0x68, 0x84, 0x35, 0xe3, 0x25, 0xd8, 0x1c, 0x2c, 0xe0, 0x08, 0xcf, 0x6c, 0x76, 0x03, 0x0d, - 0x4d, 0x46, 0x34, 0x2a, 0xc3, 0x37, 0x2c, 0x73, 0x98, 0x65, 0x60, 0xc4, 0xec, 0x35, 0xa6, - 0xf6, 0x49, 0xef, 0x02, 0xc1, 0x19, 0x36, 0xb7, 0x03, 0x9b, 0xc6, 0xf5, 0xd0, 0x94, 0x38, - 0xdb, 0xe4, 0x76, 0x25, 0x1b, 0x59, 0x64, 0xb6, 0x8f, 0x02, 0xee, 0xdf, 0xf7, 0xa9, 0xe0, - 0xed, 0x3e, 0x30, 0x90, 0x96,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, 0xa5, 0x34, 0xe5, 0xe2, 0x67, - 0x9b, 0x27, 0xdb, 0x5f, 0x95, 0xfd, 0x09, 0xa3, 0x6b, 0x05, - ]; - - let tx = Transaction::zcash_deserialize(&data[..]) + let tx = Transaction::zcash_deserialize(&test_vectors::GENERIC_TESTNET_TX[..]) .expect("transaction test vector from librustzcash should deserialize"); - println!("{:?}", tx); - let mut data2 = Vec::new(); tx.zcash_serialize(&mut data2).expect("tx should serialize"); - assert_eq!(&data[..], &data2[..]); + assert_eq!(&test_vectors::GENERIC_TESTNET_TX[..], &data2[..]); } #[cfg(test)] @@ -275,16 +133,12 @@ proptest! { #[test] fn transaction_roundtrip(tx in any::()) { - println!("{:?}", tx); - let mut data = Vec::new(); tx.zcash_serialize(&mut data).expect("tx should serialize"); let tx2 = Transaction::zcash_deserialize(&data[..]).expect("randomized tx should deserialize"); - println!("{:?}", tx2); - prop_assert_eq![tx, tx2]; } } diff --git a/zebra-chain/src/types.rs b/zebra-chain/src/types.rs index af56c88cdf6..9c352301446 100644 --- a/zebra-chain/src/types.rs +++ b/zebra-chain/src/types.rs @@ -183,6 +183,5 @@ mod proptests { prop_assert_eq![script, other_script]; } - } } diff --git a/zebra-network/src/protocol/external/codec.rs b/zebra-network/src/protocol/external/codec.rs index 82e74f4fc83..d0217df503b 100644 --- a/zebra-network/src/protocol/external/codec.rs +++ b/zebra-network/src/protocol/external/codec.rs @@ -475,7 +475,7 @@ impl Codec { Ok(Message::GetBlocks { version: Version(reader.read_u32::()?), block_locator_hashes: Vec::zcash_deserialize(&mut reader)?, - hash_stop: BlockHeaderHash(reader.read_32_bytes()?), + hash_stop: BlockHeaderHash::zcash_deserialize(&mut reader)?, }) } @@ -492,7 +492,7 @@ impl Codec { Ok(Message::GetHeaders { version: Version(reader.read_u32::()?), block_locator_hashes: Vec::zcash_deserialize(&mut reader)?, - hash_stop: BlockHeaderHash(reader.read_32_bytes()?), + hash_stop: BlockHeaderHash::zcash_deserialize(&mut reader)?, }) } @@ -505,7 +505,7 @@ impl Codec { } fn read_notfound(&self, reader: R) -> Result { - Ok(Message::GetData(Vec::zcash_deserialize(reader)?)) + Ok(Message::NotFound(Vec::zcash_deserialize(reader)?)) } fn read_tx(&self, mut reader: R) -> Result {