export proptest impls for use in downstream crates (#1092)
* export proptest impls for use in downstream crates * add testjob for disabled feature in zebra-chain * run rustfmt * try to fix github actions syntax * differentiate name * prove that github action tests zebra-chain build without features * revert change from last commit now that test is running * remove accidentally introduced newline * Update .github/workflows/ci.yml Co-authored-by: Deirdre Connolly <deirdre@zfnd.org> Co-authored-by: Deirdre Connolly <deirdre@zfnd.org>
This commit is contained in:
parent
40e22808c7
commit
0b4e974c9e
|
|
@ -1,5 +1,4 @@
|
||||||
name: CI
|
name: CI
|
||||||
|
|
||||||
on: pull_request
|
on: pull_request
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
@ -32,6 +31,25 @@ jobs:
|
||||||
command: test
|
command: test
|
||||||
args: --verbose --all
|
args: --verbose --all
|
||||||
|
|
||||||
|
build-chain-no-features:
|
||||||
|
name: Build zebra-chain w/o features on ubuntu-latest
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
override: true
|
||||||
|
- name: cargo fetch
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: fetch
|
||||||
|
- name: Run build without features enabled
|
||||||
|
working-directory: ./zebra-chain
|
||||||
|
env:
|
||||||
|
RUST_BACKTRACE: full
|
||||||
|
run: cargo build --verbose --no-default-features
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build on ${{ matrix.os }}
|
name: Build on ${{ matrix.os }}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
|
||||||
|
|
@ -3282,6 +3282,7 @@ dependencies = [
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"owo-colors",
|
"owo-colors",
|
||||||
"pretty_assertions",
|
"pretty_assertions",
|
||||||
|
"proptest",
|
||||||
"regex",
|
"regex",
|
||||||
"spandoc",
|
"spandoc",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,11 @@ 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
|
||||||
|
|
||||||
|
[features]
|
||||||
|
|
||||||
|
default = []
|
||||||
|
proptest-impl = ["proptest", "proptest-derive"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bech32 = "0.7.2"
|
bech32 = "0.7.2"
|
||||||
bitvec = "0.17.4"
|
bitvec = "0.17.4"
|
||||||
|
|
@ -29,6 +34,9 @@ sha2 = { version = "0.9.1", features=["compress"] }
|
||||||
thiserror = "1"
|
thiserror = "1"
|
||||||
x25519-dalek = { version = "1.1", features = ["serde"] }
|
x25519-dalek = { version = "1.1", features = ["serde"] }
|
||||||
|
|
||||||
|
proptest = { version = "0.10", optional = true }
|
||||||
|
proptest-derive = { version = "0.2.0", optional = true }
|
||||||
|
|
||||||
# ZF deps
|
# ZF deps
|
||||||
displaydoc = "0.1.7"
|
displaydoc = "0.1.7"
|
||||||
ed25519-zebra = "1"
|
ed25519-zebra = "1"
|
||||||
|
|
@ -39,9 +47,9 @@ bitflags = "1.2.1"
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
bincode = "1"
|
bincode = "1"
|
||||||
color-eyre = "0.5"
|
color-eyre = "0.5"
|
||||||
proptest = "0.10"
|
|
||||||
proptest-derive = "0.2.0"
|
|
||||||
spandoc = "0.2"
|
spandoc = "0.2"
|
||||||
tracing = "0.1.19"
|
tracing = "0.1.19"
|
||||||
|
proptest = "0.10"
|
||||||
|
proptest-derive = "0.2"
|
||||||
|
|
||||||
zebra-test = { path = "../zebra-test/" }
|
zebra-test = { path = "../zebra-test/" }
|
||||||
|
|
|
||||||
|
|
@ -296,25 +296,26 @@ impl ZcashDeserialize for Amount<NonNegative> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
|
use proptest::prelude::*;
|
||||||
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
|
impl<C> Arbitrary for Amount<C>
|
||||||
|
where
|
||||||
|
C: Constraint + std::fmt::Debug,
|
||||||
|
{
|
||||||
|
type Parameters = ();
|
||||||
|
|
||||||
|
fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy {
|
||||||
|
C::valid_range().prop_map(|v| Self(v, PhantomData)).boxed()
|
||||||
|
}
|
||||||
|
|
||||||
|
type Strategy = BoxedStrategy<Self>;
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
use color_eyre::eyre::Result;
|
use color_eyre::eyre::Result;
|
||||||
use proptest::prelude::*;
|
|
||||||
use std::fmt;
|
|
||||||
|
|
||||||
impl<C> Arbitrary for Amount<C>
|
|
||||||
where
|
|
||||||
C: Constraint + fmt::Debug,
|
|
||||||
{
|
|
||||||
type Parameters = ();
|
|
||||||
|
|
||||||
fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy {
|
|
||||||
C::valid_range().prop_map(|v| Self(v, PhantomData)).boxed()
|
|
||||||
}
|
|
||||||
|
|
||||||
type Strategy = BoxedStrategy<Self>;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_add_bare() -> Result<()> {
|
fn test_add_bare() -> Result<()> {
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@ mod serialize;
|
||||||
|
|
||||||
pub mod merkle;
|
pub mod merkle;
|
||||||
|
|
||||||
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
|
mod arbitrary;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
|
|
@ -25,12 +27,12 @@ use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::{parameters::Network, transaction::Transaction, transparent};
|
use crate::{parameters::Network, transaction::Transaction, transparent};
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
use proptest_derive::Arbitrary;
|
use proptest_derive::Arbitrary;
|
||||||
|
|
||||||
/// A Zcash block, containing a header and a list of transactions.
|
/// A Zcash block, containing a header and a list of transactions.
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
|
||||||
#[cfg_attr(test, derive(Arbitrary))]
|
#[cfg_attr(any(test, feature = "proptest-impl"), derive(Arbitrary))]
|
||||||
pub struct Block {
|
pub struct Block {
|
||||||
/// The block header, containing block metadata.
|
/// The block header, containing block metadata.
|
||||||
pub header: Header,
|
pub header: Header,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::parameters::Network;
|
use crate::parameters::Network;
|
||||||
use crate::work::{difficulty::CompactDifficulty, equihash};
|
use crate::work::{difficulty::CompactDifficulty, equihash};
|
||||||
|
|
||||||
use super::super::*;
|
use super::*;
|
||||||
|
|
||||||
use chrono::{TimeZone, Utc};
|
use chrono::{TimeZone, Utc};
|
||||||
use proptest::{
|
use proptest::{
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use std::{fmt, io};
|
use std::{fmt, io};
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
use proptest_derive::Arbitrary;
|
use proptest_derive::Arbitrary;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ use super::Header;
|
||||||
/// Note: Zebra displays transaction and block hashes in their actual byte-order,
|
/// Note: Zebra displays transaction and block hashes in their actual byte-order,
|
||||||
/// not in reversed byte-order.
|
/// not in reversed byte-order.
|
||||||
#[derive(Copy, Clone, Eq, PartialEq, Hash, Serialize, Deserialize)]
|
#[derive(Copy, Clone, Eq, PartialEq, Hash, Serialize, Deserialize)]
|
||||||
#[cfg_attr(test, derive(Arbitrary))]
|
#[cfg_attr(any(test, feature = "proptest-impl"), derive(Arbitrary))]
|
||||||
pub struct Hash(pub [u8; 32]);
|
pub struct Hash(pub [u8; 32]);
|
||||||
|
|
||||||
impl fmt::Display for Hash {
|
impl fmt::Display for Hash {
|
||||||
|
|
|
||||||
|
|
@ -79,9 +79,9 @@ impl Sub<i32> for Height {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
use proptest::prelude::*;
|
use proptest::prelude::*;
|
||||||
#[cfg(test)]
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
impl Arbitrary for Height {
|
impl Arbitrary for Height {
|
||||||
type Parameters = ();
|
type Parameters = ();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
use std::{fmt, io};
|
use std::{fmt, io};
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(any(any(test, feature = "proptest-impl"), feature = "proptest-impl"))]
|
||||||
use proptest_derive::Arbitrary;
|
use proptest_derive::Arbitrary;
|
||||||
|
|
||||||
use crate::serialization::{sha256d, SerializationError, ZcashDeserialize, ZcashSerialize};
|
use crate::serialization::{sha256d, SerializationError, ZcashDeserialize, ZcashSerialize};
|
||||||
|
|
@ -31,7 +31,7 @@ impl<Transaction> ZcashDeserialize for Tree<Transaction> {
|
||||||
/// A SHA-256d hash of the root node of a merkle tree of SHA256-d
|
/// A SHA-256d hash of the root node of a merkle tree of SHA256-d
|
||||||
/// hashed transactions in a block.
|
/// hashed transactions in a block.
|
||||||
#[derive(Clone, Copy, Eq, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Copy, Eq, PartialEq, Serialize, Deserialize)]
|
||||||
#[cfg_attr(test, derive(Arbitrary))]
|
#[cfg_attr(any(test, feature = "proptest-impl"), derive(Arbitrary))]
|
||||||
pub struct Root(pub [u8; 32]);
|
pub struct Root(pub [u8; 32]);
|
||||||
|
|
||||||
impl From<Tree<Transaction>> for Root {
|
impl From<Tree<Transaction>> for Root {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
mod arbitrary;
|
|
||||||
// XXX this should be rewritten as strategies
|
// XXX this should be rewritten as strategies
|
||||||
mod generate;
|
mod generate;
|
||||||
mod prop;
|
mod prop;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
#[cfg(test)]
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
use proptest_derive::Arbitrary;
|
use proptest_derive::Arbitrary;
|
||||||
|
|
||||||
/// An enum describing the possible network choices.
|
/// An enum describing the possible network choices.
|
||||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)]
|
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)]
|
||||||
#[cfg_attr(test, derive(Arbitrary))]
|
#[cfg_attr(any(test, feature = "proptest-impl"), derive(Arbitrary))]
|
||||||
pub enum Network {
|
pub enum Network {
|
||||||
/// The production mainnet.
|
/// The production mainnet.
|
||||||
Mainnet,
|
Mainnet,
|
||||||
|
|
|
||||||
|
|
@ -51,10 +51,10 @@ impl ZcashDeserialize for Bctv14Proof {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
use proptest::{arbitrary::Arbitrary, collection::vec, prelude::*};
|
use proptest::{arbitrary::Arbitrary, collection::vec, prelude::*};
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
impl Arbitrary for Bctv14Proof {
|
impl Arbitrary for Bctv14Proof {
|
||||||
type Parameters = ();
|
type Parameters = ();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,10 +50,10 @@ impl ZcashDeserialize for Groth16Proof {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
use proptest::{arbitrary::Arbitrary, collection::vec, prelude::*};
|
use proptest::{arbitrary::Arbitrary, collection::vec, prelude::*};
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
impl Arbitrary for Groth16Proof {
|
impl Arbitrary for Groth16Proof {
|
||||||
type Parameters = ();
|
type Parameters = ();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
//! Sapling-related functionality.
|
//! Sapling-related functionality.
|
||||||
|
|
||||||
mod address;
|
mod address;
|
||||||
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
|
mod arbitrary;
|
||||||
mod commitment;
|
mod commitment;
|
||||||
mod note;
|
mod note;
|
||||||
mod output;
|
mod output;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ use proptest::{arbitrary::any, array, collection::vec, prelude::*};
|
||||||
|
|
||||||
use crate::primitives::Groth16Proof;
|
use crate::primitives::Groth16Proof;
|
||||||
|
|
||||||
use super::super::{commitment, keys, note, tree, Output, Spend};
|
use super::{commitment, keys, note, tree, Output, Spend};
|
||||||
|
|
||||||
impl Arbitrary for Spend {
|
impl Arbitrary for Spend {
|
||||||
type Parameters = ();
|
type Parameters = ();
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
//! Note and value commitments.
|
//! Note and value commitments.
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
mod arbitrary;
|
mod arbitrary;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test_vectors;
|
mod test_vectors;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
//! [3.1]: https://zips.z.cash/protocol/protocol.pdf#addressesandkeys
|
//! [3.1]: https://zips.z.cash/protocol/protocol.pdf#addressesandkeys
|
||||||
#![allow(clippy::unit_arg)]
|
#![allow(clippy::unit_arg)]
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
mod arbitrary;
|
mod arbitrary;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test_vectors;
|
mod test_vectors;
|
||||||
|
|
@ -26,7 +26,7 @@ use std::{
|
||||||
use bech32::{self, FromBase32, ToBase32};
|
use bech32::{self, FromBase32, ToBase32};
|
||||||
use rand_core::{CryptoRng, RngCore};
|
use rand_core::{CryptoRng, RngCore};
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
use proptest_derive::Arbitrary;
|
use proptest_derive::Arbitrary;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
|
@ -183,7 +183,7 @@ mod sk_hrp {
|
||||||
///
|
///
|
||||||
/// [ps]: https://zips.z.cash/protocol/protocol.pdf#saplingkeycomponents
|
/// [ps]: https://zips.z.cash/protocol/protocol.pdf#saplingkeycomponents
|
||||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||||
#[cfg_attr(test, derive(Arbitrary))]
|
#[cfg_attr(any(test, feature = "proptest-impl"), derive(Arbitrary))]
|
||||||
pub struct SpendingKey {
|
pub struct SpendingKey {
|
||||||
network: Network,
|
network: Network,
|
||||||
bytes: [u8; 32],
|
bytes: [u8; 32],
|
||||||
|
|
@ -610,7 +610,7 @@ impl PartialEq<[u8; 32]> for IncomingViewingKey {
|
||||||
///
|
///
|
||||||
/// [ps]: https://zips.z.cash/protocol/protocol.pdf#saplingkeycomponents
|
/// [ps]: https://zips.z.cash/protocol/protocol.pdf#saplingkeycomponents
|
||||||
#[derive(Copy, Clone, Eq, PartialEq)]
|
#[derive(Copy, Clone, Eq, PartialEq)]
|
||||||
#[cfg_attr(test, derive(Arbitrary))]
|
#[cfg_attr(any(test, feature = "proptest-impl"), derive(Arbitrary))]
|
||||||
pub struct Diversifier(pub [u8; 11]);
|
pub struct Diversifier(pub [u8; 11]);
|
||||||
|
|
||||||
impl fmt::Debug for Diversifier {
|
impl fmt::Debug for Diversifier {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
mod ciphertexts;
|
mod ciphertexts;
|
||||||
mod nullifiers;
|
mod nullifiers;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
mod arbitrary;
|
mod arbitrary;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,5 @@
|
||||||
use std::{fmt, io};
|
use std::{fmt, io};
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
use proptest::{arbitrary::any, prelude::*};
|
|
||||||
|
|
||||||
use crate::serialization::{serde_helpers, SerializationError, ZcashDeserialize, ZcashSerialize};
|
use crate::serialization::{serde_helpers, SerializationError, ZcashDeserialize, ZcashSerialize};
|
||||||
|
|
||||||
/// A ciphertext component for encrypted output notes.
|
/// A ciphertext component for encrypted output notes.
|
||||||
|
|
@ -103,6 +100,8 @@ impl ZcashDeserialize for WrappedNoteKey {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
use proptest::prelude::*;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
proptest! {
|
proptest! {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,10 @@ fn prf_nf(nk: [u8; 32], rho: [u8; 32]) -> [u8; 32] {
|
||||||
|
|
||||||
/// A Nullifier for Sapling transactions
|
/// A Nullifier for Sapling transactions
|
||||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]
|
||||||
#[cfg_attr(test, derive(proptest_derive::Arbitrary))]
|
#[cfg_attr(
|
||||||
|
any(test, feature = "proptest-impl"),
|
||||||
|
derive(proptest_derive::Arbitrary)
|
||||||
|
)]
|
||||||
pub struct Nullifier([u8; 32]);
|
pub struct Nullifier([u8; 32]);
|
||||||
|
|
||||||
impl From<[u8; 32]> for Nullifier {
|
impl From<[u8; 32]> for Nullifier {
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
mod arbitrary;
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
use std::{fmt, io};
|
use std::{fmt, io};
|
||||||
|
|
||||||
use bitvec::prelude::*;
|
use bitvec::prelude::*;
|
||||||
#[cfg(test)]
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
use proptest_derive::Arbitrary;
|
use proptest_derive::Arbitrary;
|
||||||
|
|
||||||
use crate::serialization::{SerializationError, ZcashDeserialize, ZcashSerialize};
|
use crate::serialization::{SerializationError, ZcashDeserialize, ZcashSerialize};
|
||||||
|
|
@ -53,7 +53,7 @@ pub struct Position(pub(crate) u64);
|
||||||
|
|
||||||
/// Sapling Note Commitment Tree
|
/// Sapling Note Commitment Tree
|
||||||
#[derive(Clone, Debug, Default, Eq, PartialEq)]
|
#[derive(Clone, Debug, Default, Eq, PartialEq)]
|
||||||
#[cfg_attr(test, derive(Arbitrary))]
|
#[cfg_attr(any(test, feature = "proptest-impl"), derive(Arbitrary))]
|
||||||
struct SaplingNoteCommitmentTree;
|
struct SaplingNoteCommitmentTree;
|
||||||
|
|
||||||
/// Sapling note commitment tree root node hash.
|
/// Sapling note commitment tree root node hash.
|
||||||
|
|
@ -63,7 +63,7 @@ struct SaplingNoteCommitmentTree;
|
||||||
/// this block. A root of a note commitment tree is associated with
|
/// this block. A root of a note commitment tree is associated with
|
||||||
/// each treestate.
|
/// each treestate.
|
||||||
#[derive(Clone, Copy, Default, Eq, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Copy, Default, Eq, PartialEq, Serialize, Deserialize)]
|
||||||
#[cfg_attr(test, derive(Arbitrary))]
|
#[cfg_attr(any(test, feature = "proptest-impl"), derive(Arbitrary))]
|
||||||
pub struct Root(pub [u8; 32]);
|
pub struct Root(pub [u8; 32]);
|
||||||
|
|
||||||
impl fmt::Debug for Root {
|
impl fmt::Debug for Root {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
//! Sprout-related functionality.
|
//! Sprout-related functionality.
|
||||||
|
|
||||||
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
|
mod arbitrary;
|
||||||
mod joinsplit;
|
mod joinsplit;
|
||||||
#[cfg(test)]
|
|
||||||
mod tests;
|
|
||||||
|
|
||||||
// XXX clean up these modules
|
// XXX clean up these modules
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ use crate::{
|
||||||
primitives::ZkSnarkProof,
|
primitives::ZkSnarkProof,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::super::{commitment, note, tree, JoinSplit};
|
use super::{commitment, note, tree, JoinSplit};
|
||||||
|
|
||||||
impl<P: ZkSnarkProof + Arbitrary + 'static> Arbitrary for JoinSplit<P> {
|
impl<P: ZkSnarkProof + Arbitrary + 'static> Arbitrary for JoinSplit<P> {
|
||||||
type Parameters = ();
|
type Parameters = ();
|
||||||
|
|
@ -8,7 +8,10 @@ use super::note::Note;
|
||||||
|
|
||||||
/// The randomness used in the Pedersen Hash for note commitment.
|
/// The randomness used in the Pedersen Hash for note commitment.
|
||||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||||
#[cfg_attr(test, derive(proptest_derive::Arbitrary))]
|
#[cfg_attr(
|
||||||
|
any(test, feature = "proptest-impl"),
|
||||||
|
derive(proptest_derive::Arbitrary)
|
||||||
|
)]
|
||||||
pub struct CommitmentRandomness(pub [u8; 32]);
|
pub struct CommitmentRandomness(pub [u8; 32]);
|
||||||
|
|
||||||
impl AsRef<[u8]> for CommitmentRandomness {
|
impl AsRef<[u8]> for CommitmentRandomness {
|
||||||
|
|
@ -19,7 +22,10 @@ impl AsRef<[u8]> for CommitmentRandomness {
|
||||||
|
|
||||||
/// Note commitments for the output notes.
|
/// Note commitments for the output notes.
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
|
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
|
||||||
#[cfg_attr(test, derive(proptest_derive::Arbitrary))]
|
#[cfg_attr(
|
||||||
|
any(test, feature = "proptest-impl"),
|
||||||
|
derive(proptest_derive::Arbitrary)
|
||||||
|
)]
|
||||||
pub struct NoteCommitment(pub(crate) [u8; 32]);
|
pub struct NoteCommitment(pub(crate) [u8; 32]);
|
||||||
|
|
||||||
impl Eq for NoteCommitment {}
|
impl Eq for NoteCommitment {}
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,9 @@ use byteorder::{ByteOrder, LittleEndian};
|
||||||
use rand_core::{CryptoRng, RngCore};
|
use rand_core::{CryptoRng, RngCore};
|
||||||
use sha2::digest::generic_array::{typenum::U64, GenericArray};
|
use sha2::digest::generic_array::{typenum::U64, GenericArray};
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
use proptest::{array, prelude::*};
|
use proptest::{array, prelude::*};
|
||||||
#[cfg(test)]
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
use proptest_derive::Arbitrary;
|
use proptest_derive::Arbitrary;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
|
@ -61,7 +61,7 @@ fn prf_addr(x: [u8; 32], t: u8) -> [u8; 32] {
|
||||||
/// All other Sprout key types derive from the SpendingKey value.
|
/// All other Sprout key types derive from the SpendingKey value.
|
||||||
/// Actually 252 bits.
|
/// Actually 252 bits.
|
||||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||||
#[cfg_attr(test, derive(Arbitrary))]
|
#[cfg_attr(any(test, feature = "proptest-impl"), derive(Arbitrary))]
|
||||||
pub struct SpendingKey {
|
pub struct SpendingKey {
|
||||||
/// What would normally be the value inside a tuple struct.
|
/// What would normally be the value inside a tuple struct.
|
||||||
pub bytes: [u8; 32],
|
pub bytes: [u8; 32],
|
||||||
|
|
@ -183,7 +183,10 @@ impl From<SpendingKey> for ReceivingKey {
|
||||||
|
|
||||||
/// Derived from a _SpendingKey_.
|
/// Derived from a _SpendingKey_.
|
||||||
#[derive(Copy, Clone, Eq, PartialEq)]
|
#[derive(Copy, Clone, Eq, PartialEq)]
|
||||||
#[cfg_attr(test, derive(proptest_derive::Arbitrary))]
|
#[cfg_attr(
|
||||||
|
any(test, feature = "proptest-impl"),
|
||||||
|
derive(proptest_derive::Arbitrary)
|
||||||
|
)]
|
||||||
pub struct PayingKey(pub [u8; 32]);
|
pub struct PayingKey(pub [u8; 32]);
|
||||||
|
|
||||||
impl AsRef<[u8]> for PayingKey {
|
impl AsRef<[u8]> for PayingKey {
|
||||||
|
|
@ -310,7 +313,7 @@ impl std::str::FromStr for IncomingViewingKey {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
impl Arbitrary for IncomingViewingKey {
|
impl Arbitrary for IncomingViewingKey {
|
||||||
type Parameters = ();
|
type Parameters = ();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
#![allow(clippy::unit_arg)]
|
#![allow(clippy::unit_arg)]
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
mod arbitrary;
|
mod arbitrary;
|
||||||
mod ciphertexts;
|
mod ciphertexts;
|
||||||
mod mac;
|
mod mac;
|
||||||
|
|
@ -28,7 +28,10 @@ pub use nullifiers::{Nullifier, NullifierSeed};
|
||||||
///
|
///
|
||||||
/// https://zips.z.cash/protocol/protocol.pdf#notes
|
/// https://zips.z.cash/protocol/protocol.pdf#notes
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
#[cfg_attr(test, derive(proptest_derive::Arbitrary))]
|
#[cfg_attr(
|
||||||
|
any(test, feature = "proptest-impl"),
|
||||||
|
derive(proptest_derive::Arbitrary)
|
||||||
|
)]
|
||||||
pub struct Note {
|
pub struct Note {
|
||||||
/// The paying key of the recipient’s shielded payment address
|
/// The paying key of the recipient’s shielded payment address
|
||||||
pub paying_key: PayingKey,
|
pub paying_key: PayingKey,
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,5 @@
|
||||||
use std::{fmt, io};
|
use std::{fmt, io};
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
use proptest::{arbitrary::any, prelude::*};
|
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::serialization::{serde_helpers, SerializationError, ZcashDeserialize, ZcashSerialize};
|
use crate::serialization::{serde_helpers, SerializationError, ZcashDeserialize, ZcashSerialize};
|
||||||
|
|
@ -56,6 +53,8 @@ impl ZcashDeserialize for EncryptedNote {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
use proptest::prelude::*;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
proptest! {
|
proptest! {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,10 @@ use std::io::{self, Read};
|
||||||
/// binding h_sig to each a_sk of the JoinSplit description, computed as
|
/// binding h_sig to each a_sk of the JoinSplit description, computed as
|
||||||
/// described in § 4.10 ‘Non-malleability (Sprout)’ on p. 37
|
/// described in § 4.10 ‘Non-malleability (Sprout)’ on p. 37
|
||||||
#[derive(PartialEq, Eq, Clone, Debug, Serialize, Deserialize)]
|
#[derive(PartialEq, Eq, Clone, Debug, Serialize, Deserialize)]
|
||||||
#[cfg_attr(test, derive(proptest_derive::Arbitrary))]
|
#[cfg_attr(
|
||||||
|
any(test, feature = "proptest-impl"),
|
||||||
|
derive(proptest_derive::Arbitrary)
|
||||||
|
)]
|
||||||
pub struct MAC([u8; 32]);
|
pub struct MAC([u8; 32]);
|
||||||
|
|
||||||
impl ZcashDeserialize for MAC {
|
impl ZcashDeserialize for MAC {
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,10 @@ fn prf_nf(a_sk: [u8; 32], rho: [u8; 32]) -> [u8; 32] {
|
||||||
/// [ps]: https://zips.z.cash/protocol/protocol.pdf#sproutkeycomponents
|
/// [ps]: https://zips.z.cash/protocol/protocol.pdf#sproutkeycomponents
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug)]
|
||||||
#[cfg_attr(test, derive(proptest_derive::Arbitrary))]
|
#[cfg_attr(
|
||||||
|
any(test, feature = "proptest-impl"),
|
||||||
|
derive(proptest_derive::Arbitrary)
|
||||||
|
)]
|
||||||
pub struct NullifierSeed(pub(crate) [u8; 32]);
|
pub struct NullifierSeed(pub(crate) [u8; 32]);
|
||||||
|
|
||||||
impl AsRef<[u8]> for NullifierSeed {
|
impl AsRef<[u8]> for NullifierSeed {
|
||||||
|
|
@ -60,7 +63,10 @@ impl From<NullifierSeed> for [u8; 32] {
|
||||||
|
|
||||||
/// A Nullifier for Sprout transactions
|
/// A Nullifier for Sprout transactions
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
#[cfg_attr(test, derive(proptest_derive::Arbitrary))]
|
#[cfg_attr(
|
||||||
|
any(test, feature = "proptest-impl"),
|
||||||
|
derive(proptest_derive::Arbitrary)
|
||||||
|
)]
|
||||||
pub struct Nullifier(pub(crate) [u8; 32]);
|
pub struct Nullifier(pub(crate) [u8; 32]);
|
||||||
|
|
||||||
impl From<[u8; 32]> for Nullifier {
|
impl From<[u8; 32]> for Nullifier {
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
use proptest_derive::Arbitrary;
|
use proptest_derive::Arbitrary;
|
||||||
|
|
||||||
/// Sprout note commitment tree root node hash.
|
/// Sprout note commitment tree root node hash.
|
||||||
|
|
@ -23,7 +23,7 @@ use proptest_derive::Arbitrary;
|
||||||
/// this block. A root of a note commitment tree is associated with
|
/// this block. A root of a note commitment tree is associated with
|
||||||
/// each treestate.
|
/// each treestate.
|
||||||
#[derive(Clone, Copy, Default, Eq, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Copy, Default, Eq, PartialEq, Serialize, Deserialize)]
|
||||||
#[cfg_attr(test, derive(Arbitrary))]
|
#[cfg_attr(any(test, feature = "proptest-impl"), derive(Arbitrary))]
|
||||||
pub struct Root([u8; 32]);
|
pub struct Root([u8; 32]);
|
||||||
|
|
||||||
impl fmt::Debug for Root {
|
impl fmt::Debug for Root {
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@ mod serialize;
|
||||||
mod shielded_data;
|
mod shielded_data;
|
||||||
mod sighash;
|
mod sighash;
|
||||||
|
|
||||||
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
|
mod arbitrary;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,10 @@ use crate::{
|
||||||
sapling, sprout, transparent,
|
sapling, sprout, transparent,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::super::{JoinSplitData, LockTime, Memo, ShieldedData, Transaction};
|
use super::{JoinSplitData, LockTime, Memo, ShieldedData, Transaction};
|
||||||
|
|
||||||
impl Transaction {
|
impl Transaction {
|
||||||
|
/// Generate a proptest strategy for V1 Transactions
|
||||||
pub fn v1_strategy() -> impl Strategy<Value = Self> {
|
pub fn v1_strategy() -> impl Strategy<Value = Self> {
|
||||||
(
|
(
|
||||||
vec(any::<transparent::Input>(), 0..10),
|
vec(any::<transparent::Input>(), 0..10),
|
||||||
|
|
@ -26,6 +27,7 @@ impl Transaction {
|
||||||
.boxed()
|
.boxed()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Generate a proptest strategy for V2 Transactions
|
||||||
pub fn v2_strategy() -> impl Strategy<Value = Self> {
|
pub fn v2_strategy() -> impl Strategy<Value = Self> {
|
||||||
(
|
(
|
||||||
vec(any::<transparent::Input>(), 0..10),
|
vec(any::<transparent::Input>(), 0..10),
|
||||||
|
|
@ -44,6 +46,7 @@ impl Transaction {
|
||||||
.boxed()
|
.boxed()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Generate a proptest strategy for V3 Transactions
|
||||||
pub fn v3_strategy() -> impl Strategy<Value = Self> {
|
pub fn v3_strategy() -> impl Strategy<Value = Self> {
|
||||||
(
|
(
|
||||||
vec(any::<transparent::Input>(), 0..10),
|
vec(any::<transparent::Input>(), 0..10),
|
||||||
|
|
@ -64,6 +67,7 @@ impl Transaction {
|
||||||
.boxed()
|
.boxed()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Generate a proptest strategy for V4 Transactions
|
||||||
pub fn v4_strategy() -> impl Strategy<Value = Self> {
|
pub fn v4_strategy() -> impl Strategy<Value = Self> {
|
||||||
(
|
(
|
||||||
vec(any::<transparent::Input>(), 0..10),
|
vec(any::<transparent::Input>(), 0..10),
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#![allow(clippy::unit_arg)]
|
#![allow(clippy::unit_arg)]
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
use proptest_derive::Arbitrary;
|
use proptest_derive::Arbitrary;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
|
@ -14,7 +14,7 @@ use super::Transaction;
|
||||||
/// Note: Zebra displays transaction and block hashes in their actual byte-order,
|
/// Note: Zebra displays transaction and block hashes in their actual byte-order,
|
||||||
/// not in reversed byte-order.
|
/// not in reversed byte-order.
|
||||||
#[derive(Copy, Clone, Eq, PartialEq, Serialize, Deserialize, Hash)]
|
#[derive(Copy, Clone, Eq, PartialEq, Serialize, Deserialize, Hash)]
|
||||||
#[cfg_attr(test, derive(Arbitrary))]
|
#[cfg_attr(any(test, feature = "proptest-impl"), derive(Arbitrary))]
|
||||||
pub struct Hash(pub [u8; 32]);
|
pub struct Hash(pub [u8; 32]);
|
||||||
|
|
||||||
impl<'a> From<&'a Transaction> for Hash {
|
impl<'a> From<&'a Transaction> for Hash {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,2 @@
|
||||||
mod arbitrary;
|
|
||||||
mod prop;
|
mod prop;
|
||||||
mod vectors;
|
mod vectors;
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,9 @@ mod serialize;
|
||||||
pub use address::Address;
|
pub use address::Address;
|
||||||
pub use script::Script;
|
pub use script::Script;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
mod tests;
|
mod arbitrary;
|
||||||
#[cfg(test)]
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
use proptest_derive::Arbitrary;
|
use proptest_derive::Arbitrary;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
|
@ -41,7 +41,7 @@ impl AsRef<[u8]> for CoinbaseData {
|
||||||
///
|
///
|
||||||
/// A particular transaction output reference.
|
/// A particular transaction output reference.
|
||||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
|
#[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
|
||||||
#[cfg_attr(test, derive(Arbitrary))]
|
#[cfg_attr(any(test, feature = "proptest-impl"), derive(Arbitrary))]
|
||||||
pub struct OutPoint {
|
pub struct OutPoint {
|
||||||
/// References the transaction that contains the UTXO being spent.
|
/// References the transaction that contains the UTXO being spent.
|
||||||
pub hash: transaction::Hash,
|
pub hash: transaction::Hash,
|
||||||
|
|
@ -87,7 +87,7 @@ pub enum Input {
|
||||||
/// that spends my UTXO and sends 1 ZEC to you and 1 ZEC back to me
|
/// that spends my UTXO and sends 1 ZEC to you and 1 ZEC back to me
|
||||||
/// (just like receiving change).
|
/// (just like receiving change).
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
|
||||||
#[cfg_attr(test, derive(Arbitrary))]
|
#[cfg_attr(any(test, feature = "proptest-impl"), derive(Arbitrary))]
|
||||||
pub struct Output {
|
pub struct Output {
|
||||||
/// Transaction value.
|
/// Transaction value.
|
||||||
// At https://en.bitcoin.it/wiki/Protocol_documentation#tx, this is an i64.
|
// At https://en.bitcoin.it/wiki/Protocol_documentation#tx, this is an i64.
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ use proptest::{arbitrary::any, collection::vec, prelude::*};
|
||||||
|
|
||||||
use crate::block;
|
use crate::block;
|
||||||
|
|
||||||
use super::super::{CoinbaseData, Input, OutPoint, Script};
|
use super::{CoinbaseData, Input, OutPoint, Script};
|
||||||
|
|
||||||
impl Arbitrary for Input {
|
impl Arbitrary for Input {
|
||||||
type Parameters = ();
|
type Parameters = ();
|
||||||
|
|
@ -9,7 +9,10 @@ use std::{
|
||||||
|
|
||||||
/// An encoding of a Bitcoin script.
|
/// An encoding of a Bitcoin script.
|
||||||
#[derive(Clone, Eq, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Eq, PartialEq, Serialize, Deserialize)]
|
||||||
#[cfg_attr(test, derive(proptest_derive::Arbitrary))]
|
#[cfg_attr(
|
||||||
|
any(test, feature = "proptest-impl"),
|
||||||
|
derive(proptest_derive::Arbitrary)
|
||||||
|
)]
|
||||||
pub struct Script(pub Vec<u8>);
|
pub struct Script(pub Vec<u8>);
|
||||||
|
|
||||||
impl fmt::Debug for Script {
|
impl fmt::Debug for Script {
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
mod arbitrary;
|
|
||||||
|
|
@ -3,5 +3,7 @@
|
||||||
pub mod difficulty;
|
pub mod difficulty;
|
||||||
pub mod equihash;
|
pub mod equihash;
|
||||||
|
|
||||||
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
|
mod arbitrary;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use super::super::*;
|
use super::*;
|
||||||
|
|
||||||
use proptest::{arbitrary::Arbitrary, collection::vec, prelude::*};
|
use proptest::{arbitrary::Arbitrary, collection::vec, prelude::*};
|
||||||
|
|
||||||
|
|
@ -18,9 +18,9 @@ use std::{fmt, ops::Add, ops::AddAssign};
|
||||||
|
|
||||||
use primitive_types::U256;
|
use primitive_types::U256;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
use proptest_derive::Arbitrary;
|
use proptest_derive::Arbitrary;
|
||||||
#[cfg(test)]
|
#[cfg(tests)]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
/// A 32-bit "compact bits" value, which represents the difficulty threshold for
|
/// A 32-bit "compact bits" value, which represents the difficulty threshold for
|
||||||
|
|
@ -52,7 +52,7 @@ mod tests;
|
||||||
/// multiple equivalent `CompactDifficulty` values, due to redundancy in the
|
/// multiple equivalent `CompactDifficulty` values, due to redundancy in the
|
||||||
/// floating-point format.
|
/// floating-point format.
|
||||||
#[derive(Clone, Copy, Eq, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Copy, Eq, PartialEq, Serialize, Deserialize)]
|
||||||
#[cfg_attr(test, derive(Arbitrary))]
|
#[cfg_attr(any(test, feature = "proptest-impl"), derive(Arbitrary))]
|
||||||
pub struct CompactDifficulty(pub u32);
|
pub struct CompactDifficulty(pub u32);
|
||||||
|
|
||||||
impl fmt::Debug for CompactDifficulty {
|
impl fmt::Debug for CompactDifficulty {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,2 @@
|
||||||
mod arbitrary;
|
|
||||||
mod prop;
|
mod prop;
|
||||||
mod vectors;
|
mod vectors;
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ thiserror = "1.0.20"
|
||||||
tokio = { version = "0.2.22", features = ["sync"] }
|
tokio = { version = "0.2.22", features = ["sync"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
zebra-chain = { path = "../zebra-chain", features = ["proptest-impl"] }
|
||||||
zebra-test = { path = "../zebra-test/" }
|
zebra-test = { path = "../zebra-test/" }
|
||||||
|
|
||||||
once_cell = "1.4"
|
once_cell = "1.4"
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ regex = "1.3.9"
|
||||||
thiserror = "1.0.20"
|
thiserror = "1.0.20"
|
||||||
pretty_assertions = "0.6.1"
|
pretty_assertions = "0.6.1"
|
||||||
owo-colors = "1.1.3"
|
owo-colors = "1.1.3"
|
||||||
|
proptest = "0.10.1"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tokio = { version = "0.2", features = ["full"] }
|
tokio = { version = "0.2", features = ["full"] }
|
||||||
|
|
|
||||||
|
|
@ -5,3 +5,4 @@ pub use color_eyre;
|
||||||
pub use color_eyre::eyre;
|
pub use color_eyre::eyre;
|
||||||
pub use eyre::Result;
|
pub use eyre::Result;
|
||||||
pub use pretty_assertions::{assert_eq, assert_ne};
|
pub use pretty_assertions::{assert_eq, assert_ne};
|
||||||
|
pub use proptest::prelude::*;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue