Replace primitives_types with uint (#2350)

This commit is contained in:
Conrado Gouvea 2021-06-18 15:35:05 -03:00 committed by GitHub
parent 7d1c1fb84e
commit c9e93a75f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 21 additions and 68 deletions

59
Cargo.lock generated
View File

@ -483,12 +483,6 @@ version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820"
[[package]]
name = "byte-slice-cast"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "65c1bf4a04a88c54f589125563643d773f3254b5c38571395e2b591c693bbc81"
[[package]]
name = "bytemuck"
version = "1.4.1"
@ -1148,18 +1142,6 @@ dependencies = [
"subtle",
]
[[package]]
name = "fixed-hash"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c"
dependencies = [
"byteorder",
"rand 0.8.4",
"rustc-hex",
"static_assertions",
]
[[package]]
name = "flate2"
version = "1.0.19"
@ -1724,15 +1706,6 @@ dependencies = [
"version_check 0.9.2",
]
[[package]]
name = "impl-codec"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df170efa359aebdd5cb7fe78edcc67107748e4737bdca8a8fb40d15ea7a877ed"
dependencies = [
"parity-scale-codec",
]
[[package]]
name = "indenter"
version = "0.3.0"
@ -2299,18 +2272,6 @@ dependencies = [
"group",
]
[[package]]
name = "parity-scale-codec"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75c823fdae1bb5ff5708ee61a62697e6296175dc671710876871c853f48592b3"
dependencies = [
"arrayvec 0.5.2",
"bitvec 0.20.1",
"byte-slice-cast",
"serde",
]
[[package]]
name = "parking_lot"
version = "0.11.1"
@ -2474,17 +2435,6 @@ dependencies = [
"output_vt100",
]
[[package]]
name = "primitive-types"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2415937401cb030a2a0a4d922483f945fa068f52a7dbb22ce0fe5f2b6f6adace"
dependencies = [
"fixed-hash",
"impl-codec",
"uint",
]
[[package]]
name = "proc-macro-error"
version = "1.0.4"
@ -2958,12 +2908,6 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "rustc-hex"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6"
[[package]]
name = "rustc_version"
version = "0.2.3"
@ -4462,7 +4406,6 @@ dependencies = [
"itertools 0.10.1",
"jubjub",
"lazy_static",
"primitive-types",
"proptest",
"proptest-derive",
"rand 0.8.4",
@ -4478,6 +4421,7 @@ dependencies = [
"subtle",
"thiserror",
"tracing",
"uint",
"x25519-dalek",
"zcash_history",
"zebra-test",
@ -4583,7 +4527,6 @@ dependencies = [
"lazy_static",
"metrics",
"once_cell",
"primitive-types",
"proptest",
"proptest-derive",
"regex",

View File

@ -34,7 +34,6 @@ halo2 = { git = "https://github.com/zcash/halo2.git", rev = "dda60a363001373d564
hex = "0.4"
jubjub = "0.6.0"
lazy_static = "1.4.0"
primitive-types = "0.9.0"
rand_core = "0.6"
ripemd160 = "0.9"
secp256k1 = { version = "0.20.2", features = ["serde"] }
@ -46,6 +45,7 @@ thiserror = "1"
x25519-dalek = { version = "1.1", features = ["serde"] }
zcash_history = { git = "https://github.com/zcash/librustzcash.git", rev = "0c3ed159985affa774e44d10172d4471d798a85a" }
bigint = "4"
uint = "0.9.0"
proptest = { version = "0.10", optional = true }
proptest-derive = { version = "0.3.0", optional = true }

View File

@ -2,6 +2,7 @@
pub mod difficulty;
pub mod equihash;
mod u256;
#[cfg(any(test, feature = "proptest-impl"))]
mod arbitrary;

View File

@ -23,7 +23,7 @@ use std::{
ops::Mul,
};
use primitive_types::U256;
pub use crate::work::u256::U256;
#[cfg(any(test, feature = "proptest-impl"))]
mod arbitrary;

View File

@ -1,4 +1,3 @@
use primitive_types::U256;
use proptest::{arbitrary::any, prelude::*};
use std::cmp::Ordering;

View File

@ -0,0 +1,10 @@
//! Module for a 256-bit big int structure.
// This is a separate module to make it easier to disable clippy because
// it raises a lot of issues in the macro.
#![allow(clippy::all)]
use uint::construct_uint;
construct_uint! {
pub struct U256(4);
}

View File

@ -26,7 +26,6 @@ displaydoc = "0.2.1"
rocksdb = "0.16.0"
tempdir = "0.3.7"
chrono = "0.4.19"
primitive-types = "0.9.0"
rlimit = "0.5.4"
[dev-dependencies]
@ -40,4 +39,3 @@ tempdir = "0.3.7"
tokio = { version = "0.3.6", features = ["full"] }
proptest = "0.10.1"
proptest-derive = "0.3"
primitive-types = "0.9.0"

View File

@ -6,14 +6,17 @@
//! * `median-time-past`.
use chrono::{DateTime, Duration, Utc};
use primitive_types::U256;
use std::{cmp::max, cmp::min, convert::TryInto};
use zebra_chain::{
block, block::Block, parameters::Network, parameters::NetworkUpgrade,
parameters::POW_AVERAGING_WINDOW, work::difficulty::CompactDifficulty,
block,
block::Block,
parameters::Network,
parameters::NetworkUpgrade,
parameters::POW_AVERAGING_WINDOW,
work::difficulty::ExpandedDifficulty,
work::difficulty::{CompactDifficulty, U256},
};
/// The median block span for time median calculations.

View File

@ -1,12 +1,11 @@
use std::{convert::TryFrom, mem, sync::Arc};
use primitive_types::U256;
use zebra_chain::{
block::{self, Block},
transaction::Transaction,
transparent,
work::difficulty::ExpandedDifficulty,
work::difficulty::Work,
work::difficulty::{Work, U256},
};
use super::*;