rename zebra-test-vectors to zebra-test

This commit is contained in:
Henry de Valence 2020-06-22 19:34:11 -07:00
parent 1c42b66a4f
commit e8561d8f9e
13 changed files with 39 additions and 37 deletions

28
Cargo.lock generated
View File

@ -42,9 +42,9 @@ dependencies = [
[[package]] [[package]]
name = "addr2line" name = "addr2line"
version = "0.12.1" version = "0.12.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a49806b9dadc843c61e7c97e72490ad7f7220ae249012fbda9ad0609457c0543" checksum = "602d785912f476e480434627e8732e6766b760c045bbf897d9dfaa9f4fbd399c"
dependencies = [ dependencies = [
"gimli", "gimli",
] ]
@ -57,9 +57,9 @@ checksum = "567b077b825e468cc974f0020d4082ee6e03132512f207ef1a02fd5d00d1f32d"
[[package]] [[package]]
name = "aho-corasick" name = "aho-corasick"
version = "0.7.10" version = "0.7.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8716408b8bc624ed7f65d223ddb9ac2d044c0547b6fa4b0d554f3a9540496ada" checksum = "c259a748ac706ba73d609b73fc13469e128337f9a6b2fb3cc82d100f8dd8d511"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]
@ -423,9 +423,9 @@ dependencies = [
[[package]] [[package]]
name = "dtoa" name = "dtoa"
version = "0.4.5" version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4358a9e11b9a09cf52383b451b49a169e8d797b68aa02301ff586d70d9661ea3" checksum = "134951f4028bdadb9b84baf4232681efbf277da25144b9b0ad65df75946c422b"
[[package]] [[package]]
name = "ed25519-zebra" name = "ed25519-zebra"
@ -804,9 +804,9 @@ dependencies = [
[[package]] [[package]]
name = "itoa" name = "itoa"
version = "0.4.5" version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6"
[[package]] [[package]]
name = "jubjub" name = "jubjub"
@ -1657,9 +1657,9 @@ dependencies = [
[[package]] [[package]]
name = "signal-hook" name = "signal-hook"
version = "0.1.15" version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ff2db2112d6c761e12522c65f7768548bd6e8cd23d2a9dae162520626629bd6" checksum = "604508c1418b99dfe1925ca9224829bb2a8a9a04dda655cc01fcad46f4ab05ed"
dependencies = [ dependencies = [
"libc", "libc",
"signal-hook-registry", "signal-hook-registry",
@ -2329,7 +2329,7 @@ dependencies = [
"sha2", "sha2",
"thiserror", "thiserror",
"x25519-dalek", "x25519-dalek",
"zebra-test-vectors", "zebra-test",
] ]
[[package]] [[package]]
@ -2350,7 +2350,7 @@ dependencies = [
"tracing-subscriber", "tracing-subscriber",
"zebra-chain", "zebra-chain",
"zebra-state", "zebra-state",
"zebra-test-vectors", "zebra-test",
] ]
[[package]] [[package]]
@ -2408,11 +2408,11 @@ dependencies = [
"tracing-futures", "tracing-futures",
"tracing-subscriber", "tracing-subscriber",
"zebra-chain", "zebra-chain",
"zebra-test-vectors", "zebra-test",
] ]
[[package]] [[package]]
name = "zebra-test-vectors" name = "zebra-test"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"hex", "hex",

View File

@ -8,7 +8,7 @@ members = [
"zebra-consensus", "zebra-consensus",
"zebra-rpc", "zebra-rpc",
"zebra-client", "zebra-client",
"zebra-test-vectors", "zebra-test",
"zebrad", "zebrad",
] ]

View File

@ -33,4 +33,4 @@ redjubjub = "0.1"
[dev-dependencies] [dev-dependencies]
proptest = "0.10" proptest = "0.10"
proptest-derive = "0.2.0" proptest-derive = "0.2.0"
zebra-test-vectors = { path = "../zebra-test-vectors/" } zebra-test = { path = "../zebra-test/" }

View File

@ -105,22 +105,22 @@ fn blockheaderhash_from_blockheader() {
fn deserialize_blockheader() { fn deserialize_blockheader() {
// https://explorer.zcha.in/blocks/415000 // https://explorer.zcha.in/blocks/415000
let _header = let _header =
BlockHeader::zcash_deserialize(&zebra_test_vectors::HEADER_MAINNET_415000_BYTES[..]) BlockHeader::zcash_deserialize(&zebra_test::vectors::HEADER_MAINNET_415000_BYTES[..])
.expect("blockheader test vector should deserialize"); .expect("blockheader test vector should deserialize");
} }
#[test] #[test]
fn deserialize_block() { fn deserialize_block() {
Block::zcash_deserialize(&zebra_test_vectors::BLOCK_MAINNET_GENESIS_BYTES[..]) Block::zcash_deserialize(&zebra_test::vectors::BLOCK_MAINNET_GENESIS_BYTES[..])
.expect("block test vector should deserialize"); .expect("block test vector should deserialize");
Block::zcash_deserialize(&zebra_test_vectors::BLOCK_MAINNET_1_BYTES[..]) Block::zcash_deserialize(&zebra_test::vectors::BLOCK_MAINNET_1_BYTES[..])
.expect("block test vector should deserialize"); .expect("block test vector should deserialize");
// https://explorer.zcha.in/blocks/415000 // https://explorer.zcha.in/blocks/415000
Block::zcash_deserialize(&zebra_test_vectors::BLOCK_MAINNET_415000_BYTES[..]) Block::zcash_deserialize(&zebra_test::vectors::BLOCK_MAINNET_415000_BYTES[..])
.expect("block test vector should deserialize"); .expect("block test vector should deserialize");
// https://explorer.zcha.in/blocks/434873 // https://explorer.zcha.in/blocks/434873
// this one has a bad version field // this one has a bad version field
Block::zcash_deserialize(&zebra_test_vectors::BLOCK_MAINNET_434873_BYTES[..]) Block::zcash_deserialize(&zebra_test::vectors::BLOCK_MAINNET_434873_BYTES[..])
.expect("block test vector should deserialize"); .expect("block test vector should deserialize");
} }

View File

@ -122,7 +122,7 @@ mod tests {
#[test] #[test]
fn equihash_solution_test_vector() { fn equihash_solution_test_vector() {
let solution_bytes = let solution_bytes =
&zebra_test_vectors::HEADER_MAINNET_415000_BYTES[EQUIHASH_SOLUTION_BLOCK_OFFSET..]; &zebra_test::vectors::HEADER_MAINNET_415000_BYTES[EQUIHASH_SOLUTION_BLOCK_OFFSET..];
let solution = EquihashSolution::zcash_deserialize(solution_bytes) let solution = EquihashSolution::zcash_deserialize(solution_bytes)
.expect("Test vector EquihashSolution should deserialize"); .expect("Test vector EquihashSolution should deserialize");

View File

@ -14,7 +14,7 @@ futures-util = "0.3.5"
tower = "0.3.1" tower = "0.3.1"
[dev-dependencies] [dev-dependencies]
zebra-test-vectors = { path = "../zebra-test-vectors/" } zebra-test = { path = "../zebra-test/" }
spandoc = { git = "https://github.com/yaahc/spandoc.git" } spandoc = { git = "https://github.com/yaahc/spandoc.git" }
tokio = { version = "0.2.21", features = ["full"] } tokio = { version = "0.2.21", features = ["full"] }
tracing = "0.1.15" tracing = "0.1.15"

View File

@ -166,7 +166,7 @@ mod tests {
#[spandoc::spandoc] #[spandoc::spandoc]
async fn checkpoint_single_item_list() -> Result<(), Report> { async fn checkpoint_single_item_list() -> Result<(), Report> {
let block0 = let block0 =
Arc::<Block>::zcash_deserialize(&zebra_test_vectors::BLOCK_MAINNET_GENESIS_BYTES[..])?; Arc::<Block>::zcash_deserialize(&zebra_test::vectors::BLOCK_MAINNET_GENESIS_BYTES[..])?;
let hash0: BlockHeaderHash = block0.as_ref().into(); let hash0: BlockHeaderHash = block0.as_ref().into();
// Make a checkpoint list containing only the genesis block // Make a checkpoint list containing only the genesis block
@ -216,7 +216,7 @@ mod tests {
#[spandoc::spandoc] #[spandoc::spandoc]
async fn checkpoint_list_empty_fail() -> Result<(), Report> { async fn checkpoint_list_empty_fail() -> Result<(), Report> {
let block0 = let block0 =
Arc::<Block>::zcash_deserialize(&zebra_test_vectors::BLOCK_MAINNET_GENESIS_BYTES[..])?; Arc::<Block>::zcash_deserialize(&zebra_test::vectors::BLOCK_MAINNET_GENESIS_BYTES[..])?;
let mut state_service = Box::new(zebra_state::in_memory::init()); let mut state_service = Box::new(zebra_state::in_memory::init());
let mut checkpoint_verifier = super::init( let mut checkpoint_verifier = super::init(
@ -263,9 +263,9 @@ mod tests {
#[spandoc::spandoc] #[spandoc::spandoc]
async fn checkpoint_not_present_fail() -> Result<(), Report> { async fn checkpoint_not_present_fail() -> Result<(), Report> {
let block0 = let block0 =
Arc::<Block>::zcash_deserialize(&zebra_test_vectors::BLOCK_MAINNET_GENESIS_BYTES[..])?; Arc::<Block>::zcash_deserialize(&zebra_test::vectors::BLOCK_MAINNET_GENESIS_BYTES[..])?;
let block415000 = let block415000 =
Arc::<Block>::zcash_deserialize(&zebra_test_vectors::BLOCK_MAINNET_415000_BYTES[..])?; Arc::<Block>::zcash_deserialize(&zebra_test::vectors::BLOCK_MAINNET_415000_BYTES[..])?;
// Make a checkpoint list containing only the genesis block // Make a checkpoint list containing only the genesis block
let genesis_checkpoint_list: HashMap<BlockHeight, BlockHeaderHash> = let genesis_checkpoint_list: HashMap<BlockHeight, BlockHeaderHash> =
@ -332,7 +332,7 @@ mod tests {
#[spandoc::spandoc] #[spandoc::spandoc]
async fn checkpoint_wrong_hash_fail() -> Result<(), Report> { async fn checkpoint_wrong_hash_fail() -> Result<(), Report> {
let block0 = let block0 =
Arc::<Block>::zcash_deserialize(&zebra_test_vectors::BLOCK_MAINNET_GENESIS_BYTES[..])?; Arc::<Block>::zcash_deserialize(&zebra_test::vectors::BLOCK_MAINNET_GENESIS_BYTES[..])?;
// Make a checkpoint list containing the genesis block height, // Make a checkpoint list containing the genesis block height,
// but use the wrong hash // but use the wrong hash

View File

@ -131,7 +131,7 @@ mod tests {
#[spandoc::spandoc] #[spandoc::spandoc]
async fn verify() -> Result<(), Report> { async fn verify() -> Result<(), Report> {
let block = let block =
Arc::<Block>::zcash_deserialize(&zebra_test_vectors::BLOCK_MAINNET_415000_BYTES[..])?; Arc::<Block>::zcash_deserialize(&zebra_test::vectors::BLOCK_MAINNET_415000_BYTES[..])?;
let hash: BlockHeaderHash = block.as_ref().into(); let hash: BlockHeaderHash = block.as_ref().into();
let state_service = Box::new(zebra_state::in_memory::init()); let state_service = Box::new(zebra_state::in_memory::init());
@ -158,7 +158,7 @@ mod tests {
#[spandoc::spandoc] #[spandoc::spandoc]
async fn round_trip() -> Result<(), Report> { async fn round_trip() -> Result<(), Report> {
let block = let block =
Arc::<Block>::zcash_deserialize(&zebra_test_vectors::BLOCK_MAINNET_415000_BYTES[..])?; Arc::<Block>::zcash_deserialize(&zebra_test::vectors::BLOCK_MAINNET_415000_BYTES[..])?;
let hash: BlockHeaderHash = block.as_ref().into(); let hash: BlockHeaderHash = block.as_ref().into();
let mut state_service = zebra_state::in_memory::init(); let mut state_service = zebra_state::in_memory::init();
@ -202,7 +202,7 @@ mod tests {
install_tracing(); install_tracing();
let block = let block =
Arc::<Block>::zcash_deserialize(&zebra_test_vectors::BLOCK_MAINNET_415000_BYTES[..])?; Arc::<Block>::zcash_deserialize(&zebra_test::vectors::BLOCK_MAINNET_415000_BYTES[..])?;
let hash: BlockHeaderHash = block.as_ref().into(); let hash: BlockHeaderHash = block.as_ref().into();
let mut state_service = zebra_state::in_memory::init(); let mut state_service = zebra_state::in_memory::init();

View File

@ -18,7 +18,7 @@ serde = { version = "1", features = ["serde_derive"] }
[dev-dependencies] [dev-dependencies]
tokio = { version = "0.2.21", features = ["full"] } tokio = { version = "0.2.21", features = ["full"] }
zebra-test-vectors = { path = "../zebra-test-vectors/" } zebra-test = { path = "../zebra-test" }
spandoc = { git = "https://github.com/yaahc/spandoc.git" } spandoc = { git = "https://github.com/yaahc/spandoc.git" }
tracing = "0.1.15" tracing = "0.1.15"
tracing-futures = "0.2.4" tracing-futures = "0.2.4"

View File

@ -146,7 +146,7 @@ mod tests {
>, >,
{ {
let block: Arc<_> = let block: Arc<_> =
Block::zcash_deserialize(&zebra_test_vectors::BLOCK_MAINNET_415000_BYTES[..])?.into(); Block::zcash_deserialize(&zebra_test::vectors::BLOCK_MAINNET_415000_BYTES[..])?.into();
let hash = block.as_ref().into(); let hash = block.as_ref().into();
let response = service let response = service
@ -205,9 +205,9 @@ mod tests {
install_tracing(); install_tracing();
let block0: Arc<_> = let block0: Arc<_> =
Block::zcash_deserialize(&zebra_test_vectors::BLOCK_MAINNET_GENESIS_BYTES[..])?.into(); Block::zcash_deserialize(&zebra_test::vectors::BLOCK_MAINNET_GENESIS_BYTES[..])?.into();
let block1: Arc<_> = let block1: Arc<_> =
Block::zcash_deserialize(&zebra_test_vectors::BLOCK_MAINNET_1_BYTES[..])?.into(); Block::zcash_deserialize(&zebra_test::vectors::BLOCK_MAINNET_1_BYTES[..])?.into();
let block0_hash: BlockHeaderHash = block0.as_ref().into(); let block0_hash: BlockHeaderHash = block0.as_ref().into();
let block1_hash: BlockHeaderHash = block1.as_ref().into(); let block1_hash: BlockHeaderHash = block1.as_ref().into();

View File

@ -1,7 +1,8 @@
[package] [package]
name = "zebra-test-vectors" name = "zebra-test"
version = "0.1.0" version = "0.1.0"
authors = ["Jane Lusby <jane@zfnd.org>"] authors = ["Zcash Foundation <zebra@zfnd.org>"]
license = "MIT OR Apache-2.0"
edition = "2018" edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

1
zebra-test/src/lib.rs Normal file
View File

@ -0,0 +1 @@
pub mod vectors;