[dependencies]: unify rustc-hex (#11506)

* [dependency]: unify `rustc-hex`

* [private tx]: fix upgrade to `rustc hex 2.1.0`
This commit is contained in:
Niklas Adolfsson
2020-02-21 15:10:00 +01:00
committed by GitHub
parent bec867be03
commit 2018f5b0ab
52 changed files with 355 additions and 357 deletions

View File

@@ -17,7 +17,8 @@ static_assertions = "1.1.0"
[dev-dependencies]
criterion = "0.3"
rustc-hex = "1.0"
hex-literal = "0.2.1"
rustc-hex = "2.1.0"
serde_json = "1.0"
tempdir = "0.3"

View File

@@ -1,15 +1,17 @@
#[macro_use]
extern crate criterion;
extern crate ethash;
extern crate rustc_hex;
extern crate tempdir;
#[macro_use]
extern crate hex_literal;
extern crate common_types;
extern crate ethash;
extern crate tempdir;
use criterion::Criterion;
use ethash::progpow;
use tempdir::TempDir;
use rustc_hex::FromHex;
use ethash::NodeCacheBuilder;
use ethash::compute::light_compute;
use common_types::engines::OptimizeFor;
@@ -18,7 +20,7 @@ fn bench_hashimoto_light(c: &mut Criterion) {
let builder = NodeCacheBuilder::new(OptimizeFor::Memory, u64::max_value());
let tempdir = TempDir::new("").unwrap();
let light = builder.light(&tempdir.path(), 1);
let h = FromHex::from_hex("c9149cc0386e689d789a1c2f3d5d169a61a6218ed30e74414dc736e442ef3d1f").unwrap();
let h = hex!("c9149cc0386e689d789a1c2f3d5d169a61a6218ed30e74414dc736e442ef3d1f");
let mut hash = [0; 32];
hash.copy_from_slice(&h);
@@ -32,7 +34,7 @@ fn bench_progpow_light(c: &mut Criterion) {
let tempdir = TempDir::new("").unwrap();
let cache = builder.new_cache(tempdir.into_path(), 0);
let h = FromHex::from_hex("c9149cc0386e689d789a1c2f3d5d169a61a6218ed30e74414dc736e442ef3d1f").unwrap();
let h = hex!("c9149cc0386e689d789a1c2f3d5d169a61a6218ed30e74414dc736e442ef3d1f");
let mut hash = [0; 32];
hash.copy_from_slice(&h);
@@ -56,7 +58,7 @@ fn bench_progpow_optimal_light(c: &mut Criterion) {
let cache = builder.new_cache(tempdir.into_path(), 0);
let c_dag = progpow::generate_cdag(cache.as_ref());
let h = FromHex::from_hex("c9149cc0386e689d789a1c2f3d5d169a61a6218ed30e74414dc736e442ef3d1f").unwrap();
let h = hex!("c9149cc0386e689d789a1c2f3d5d169a61a6218ed30e74414dc736e442ef3d1f");
let mut hash = [0; 32];
hash.copy_from_slice(&h);

View File

@@ -26,6 +26,10 @@ extern crate log;
#[macro_use]
extern crate static_assertions;
#[cfg(test)]
#[macro_use]
extern crate hex_literal;
#[cfg(test)]
extern crate rustc_hex;
@@ -35,6 +39,7 @@ extern crate serde_json;
#[cfg(test)]
extern crate tempdir;
#[cfg(feature = "bench")]
pub mod compute;
#[cfg(not(feature = "bench"))]

View File

@@ -431,7 +431,7 @@ mod test {
use super::*;
fn h256(hex: &str) -> H256 {
let bytes = FromHex::from_hex(hex).unwrap();
let bytes: Vec<u8> = FromHex::from_hex(hex).unwrap();
let mut res = [0; 32];
res.copy_from_slice(&bytes);
res
@@ -549,8 +549,8 @@ mod test {
&c_dag,
);
let expected_digest = FromHex::from_hex("b3bad9ca6f7c566cf0377d1f8cce29d6516a96562c122d924626281ec948ef02").unwrap();
let expected_result = FromHex::from_hex("f4ac202715ded4136e72887c39e63a4738331c57fd9eb79f6ec421c281aa8743").unwrap();
let expected_digest = hex!("b3bad9ca6f7c566cf0377d1f8cce29d6516a96562c122d924626281ec948ef02");
let expected_result = hex!("f4ac202715ded4136e72887c39e63a4738331c57fd9eb79f6ec421c281aa8743");
assert_eq!(
digest.to_vec(),