From ef47426a93a722f03b0217187c8235f4a4b72021 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 15 Aug 2019 16:06:43 +0200 Subject: [PATCH] [evmbin] fix compilation (#10976) * Fix compilation error Include the test-helpers from `machine` (used by json-tests, although I'm not sure why evmbin needs ethcore/json-tests) * Update to edition --- Cargo.lock | 2 -- ethcore/Cargo.toml | 2 +- evmbin/Cargo.toml | 5 ++-- evmbin/README.md | 1 - evmbin/src/display/json.rs | 15 ++++++++---- evmbin/src/display/simple.rs | 8 +++--- evmbin/src/display/std_json.rs | 14 +++++++---- evmbin/src/info.rs | 14 +++++++---- evmbin/src/main.rs | 45 +++++++++------------------------- 9 files changed, 48 insertions(+), 58 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0b8f8cfc3..467c385e0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1481,10 +1481,8 @@ dependencies = [ "panic_hook 0.1.0", "parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "pod 0.1.0", - "pretty_assertions 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "trace 0.1.0", diff --git a/ethcore/Cargo.toml b/ethcore/Cargo.toml index 107413d91..44118bbea 100644 --- a/ethcore/Cargo.toml +++ b/ethcore/Cargo.toml @@ -111,7 +111,7 @@ evm-debug-tests = ["evm-debug", "evm/evm-debug-tests"] # EVM debug traces are printed. slow-blocks = [] # Run JSON consensus tests. -json-tests = ["env_logger", "test-helpers"] +json-tests = ["env_logger", "test-helpers", "machine/test-helpers"] # Skip JSON consensus tests with pending issues. ci-skip-tests = [] # Run memory/cpu heavy tests. diff --git a/evmbin/Cargo.toml b/evmbin/Cargo.toml index c3706b60e..0a9a481e4 100644 --- a/evmbin/Cargo.toml +++ b/evmbin/Cargo.toml @@ -3,6 +3,7 @@ description = "Parity EVM Implementation" name = "evmbin" version = "0.1.0" authors = ["Parity Technologies "] +edition = "2018" [[bin]] name = "parity-evm" @@ -21,14 +22,12 @@ panic_hook = { path = "../util/panic-hook" } parity-bytes = "0.1" pod = { path = "../ethcore/pod" } rustc-hex = "1.0" -serde = "1.0" -serde_derive = "1.0" +serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" trace = { path = "../ethcore/trace" } vm = { path = "../ethcore/vm" } [dev-dependencies] -pretty_assertions = "0.1" tempdir = "0.3" [features] diff --git a/evmbin/README.md b/evmbin/README.md index 1a4396ec0..4e06525c5 100644 --- a/evmbin/README.md +++ b/evmbin/README.md @@ -52,4 +52,3 @@ _This project is a part of the Parity Ethereum toolchain._ - [ethabi](https://github.com/paritytech/ethabi) - Parity Ethereum function calls encoding. - [ethstore](https://github.com/paritytech/parity-ethereum/blob/master/accounts/ethstore) - Parity Ethereum key management. - [ethkey](https://github.com/paritytech/parity-ethereum/blob/master/accounts/ethkey) - Parity Ethereum keys generator. -- [whisper](https://github.com/paritytech/whisper) - Implementation of Whisper-v2 PoC. diff --git a/evmbin/src/display/json.rs b/evmbin/src/display/json.rs index b25d2bbb2..d4cacc8bb 100644 --- a/evmbin/src/display/json.rs +++ b/evmbin/src/display/json.rs @@ -20,11 +20,14 @@ use std::collections::HashMap; use std::mem; use ethereum_types::{U256, H256, BigEndianHash}; -use bytes::ToPretty; +use parity_bytes::ToPretty; +use serde::Serialize; use trace; -use display; -use info as vm; +use crate::{ + display, + info as vm, +}; /// JSON formatting informant. #[derive(Default)] @@ -273,10 +276,12 @@ impl trace::VMTracer for Informant { #[cfg(test)] mod tests { - use super::*; - use info::tests::run_test; + use serde::{Deserialize, Serialize}; use serde_json; + use super::*; + use crate::info::tests::run_test; + #[derive(Serialize, Deserialize, Debug, PartialEq)] #[serde(rename_all = "camelCase")] struct TestTrace { diff --git a/evmbin/src/display/simple.rs b/evmbin/src/display/simple.rs index 7bc3a0e7c..dad498fb8 100644 --- a/evmbin/src/display/simple.rs +++ b/evmbin/src/display/simple.rs @@ -17,10 +17,12 @@ //! Log EVM instruction output data traces from a simple formatting informant. use trace; -use bytes::ToPretty; +use parity_bytes::ToPretty; -use display; -use info as vm; +use crate::{ + display, + info as vm, +}; /// Simple formatting informant. #[derive(Default)] diff --git a/evmbin/src/display/std_json.rs b/evmbin/src/display/std_json.rs index a5974bc91..8104d6a78 100644 --- a/evmbin/src/display/std_json.rs +++ b/evmbin/src/display/std_json.rs @@ -20,11 +20,15 @@ use std::collections::HashMap; use std::io; use ethereum_types::{H256, U256, BigEndianHash}; -use bytes::ToPretty; -use trace; +use parity_bytes::ToPretty; use pod::PodState; -use display; -use info as vm; +use serde::Serialize; +use trace; + +use crate::{ + display, + info as vm, +}; pub trait Writer: io::Write + Send + Sized { fn clone(&self) -> Self; @@ -312,7 +316,7 @@ impl trace::VMTracer for Informant { pub mod tests { use std::sync::{Arc, Mutex}; use super::*; - use info::tests::run_test; + use crate::info::tests::run_test; #[derive(Debug, Clone, Default)] pub struct TestWriter(pub Arc>>); diff --git a/evmbin/src/info.rs b/evmbin/src/info.rs index cd5816181..c42454a01 100644 --- a/evmbin/src/info.rs +++ b/evmbin/src/info.rs @@ -17,13 +17,17 @@ //! EVM runner. use std::time::{Instant, Duration}; -use ethcore::client::{self, EvmTestClient, EvmTestError, TransactErr, TransactSuccess}; -use ethcore::{spec, TrieSpec}; + +use common_types::transaction; +use ethcore::{ + client::{self, EvmTestClient, EvmTestError, TransactErr, TransactSuccess}, + spec, + TrieSpec, +}; use ethereum_types::{H256, U256}; use ethjson; use pod::PodState; use trace; -use types::transaction; use vm::ActionParams; /// EVM execution informant. @@ -37,7 +41,7 @@ pub trait Informant: trace::VMTracer { /// Clone sink. fn clone_sink(&self) -> Self::Sink; /// Display final result. - fn finish(result: RunResult, &mut Self::Sink); + fn finish(result: RunResult, _: &mut Self::Sink); } /// Execution finished correctly. @@ -272,7 +276,7 @@ pub mod tests { #[test] fn should_call_account_from_spec() { - use display::std_json::tests::informant; + use crate::display::std_json::tests::informant; let (inf, res, _) = informant(); let mut params = ActionParams::default(); diff --git a/evmbin/src/main.rs b/evmbin/src/main.rs index 7491d3c18..40d394180 100644 --- a/evmbin/src/main.rs +++ b/evmbin/src/main.rs @@ -34,46 +34,22 @@ #![warn(missing_docs)] -extern crate account_state; -extern crate common_types as types; -extern crate docopt; -extern crate env_logger; -extern crate ethcore; -extern crate ethereum_types; -extern crate ethjson; -extern crate evm; -extern crate panic_hook; -extern crate parity_bytes as bytes; -extern crate pod; -extern crate rustc_hex; -extern crate serde; -#[macro_use] -extern crate serde_derive; -extern crate serde_json; -extern crate trace; -extern crate vm; - -#[cfg(test)] -#[macro_use] -extern crate pretty_assertions; - -#[cfg(test)] -extern crate tempdir; - use std::sync::Arc; use std::{fmt, fs}; use std::path::PathBuf; + +use parity_bytes::Bytes; use docopt::Docopt; use rustc_hex::FromHex; use ethereum_types::{U256, Address}; -use bytes::Bytes; use ethcore::{spec, json_tests, TrieSpec}; +use serde::Deserialize; use vm::{ActionParams, CallType}; mod info; mod display; -use info::{Informant, TxInput}; +use crate::info::{Informant, TxInput}; const USAGE: &'static str = r#" EVM implementation for Parity. @@ -289,7 +265,7 @@ fn run_state_test(args: Args) { } fn run_stats_jsontests_vm(args: Args) { - use json_tests::HookType; + use crate::json_tests::HookType; use std::collections::HashMap; use std::time::{Instant, Duration}; @@ -464,14 +440,17 @@ fn die(msg: T) -> ! { #[cfg(test)] mod tests { - use display::std_json::tests::informant; + use common_types::transaction; use docopt::Docopt; use ethcore::{TrieSpec}; use ethjson::state::test::{State}; - use info::{self, TxInput}; - use super::{Args, USAGE, Address, run_call}; - use types::transaction; + use serde::Deserialize; + use super::{Args, USAGE, Address, run_call}; + use crate::{ + display::std_json::tests::informant, + info::{self, TxInput} + }; #[derive(Debug, PartialEq, Deserialize)] pub struct SampleStateTests {