[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
This commit is contained in:
David 2019-08-15 16:06:43 +02:00 committed by Andronik Ordian
parent 5807402a0b
commit ef47426a93
9 changed files with 48 additions and 58 deletions

2
Cargo.lock generated
View File

@ -1481,10 +1481,8 @@ dependencies = [
"panic_hook 0.1.0", "panic_hook 0.1.0",
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pod 0.1.0", "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)", "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 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)", "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)", "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"trace 0.1.0", "trace 0.1.0",

View File

@ -111,7 +111,7 @@ evm-debug-tests = ["evm-debug", "evm/evm-debug-tests"]
# EVM debug traces are printed. # EVM debug traces are printed.
slow-blocks = [] slow-blocks = []
# Run JSON consensus tests. # 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. # Skip JSON consensus tests with pending issues.
ci-skip-tests = [] ci-skip-tests = []
# Run memory/cpu heavy tests. # Run memory/cpu heavy tests.

View File

@ -3,6 +3,7 @@ description = "Parity EVM Implementation"
name = "evmbin" name = "evmbin"
version = "0.1.0" version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
[[bin]] [[bin]]
name = "parity-evm" name = "parity-evm"
@ -21,14 +22,12 @@ panic_hook = { path = "../util/panic-hook" }
parity-bytes = "0.1" parity-bytes = "0.1"
pod = { path = "../ethcore/pod" } pod = { path = "../ethcore/pod" }
rustc-hex = "1.0" rustc-hex = "1.0"
serde = "1.0" serde = { version = "1.0", features = ["derive"] }
serde_derive = "1.0"
serde_json = "1.0" serde_json = "1.0"
trace = { path = "../ethcore/trace" } trace = { path = "../ethcore/trace" }
vm = { path = "../ethcore/vm" } vm = { path = "../ethcore/vm" }
[dev-dependencies] [dev-dependencies]
pretty_assertions = "0.1"
tempdir = "0.3" tempdir = "0.3"
[features] [features]

View File

@ -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. - [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. - [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. - [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.

View File

@ -20,11 +20,14 @@ use std::collections::HashMap;
use std::mem; use std::mem;
use ethereum_types::{U256, H256, BigEndianHash}; use ethereum_types::{U256, H256, BigEndianHash};
use bytes::ToPretty; use parity_bytes::ToPretty;
use serde::Serialize;
use trace; use trace;
use display; use crate::{
use info as vm; display,
info as vm,
};
/// JSON formatting informant. /// JSON formatting informant.
#[derive(Default)] #[derive(Default)]
@ -273,10 +276,12 @@ impl trace::VMTracer for Informant {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use serde::{Deserialize, Serialize};
use info::tests::run_test;
use serde_json; use serde_json;
use super::*;
use crate::info::tests::run_test;
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
struct TestTrace { struct TestTrace {

View File

@ -17,10 +17,12 @@
//! Log EVM instruction output data traces from a simple formatting informant. //! Log EVM instruction output data traces from a simple formatting informant.
use trace; use trace;
use bytes::ToPretty; use parity_bytes::ToPretty;
use display; use crate::{
use info as vm; display,
info as vm,
};
/// Simple formatting informant. /// Simple formatting informant.
#[derive(Default)] #[derive(Default)]

View File

@ -20,11 +20,15 @@ use std::collections::HashMap;
use std::io; use std::io;
use ethereum_types::{H256, U256, BigEndianHash}; use ethereum_types::{H256, U256, BigEndianHash};
use bytes::ToPretty; use parity_bytes::ToPretty;
use trace;
use pod::PodState; use pod::PodState;
use display; use serde::Serialize;
use info as vm; use trace;
use crate::{
display,
info as vm,
};
pub trait Writer: io::Write + Send + Sized { pub trait Writer: io::Write + Send + Sized {
fn clone(&self) -> Self; fn clone(&self) -> Self;
@ -312,7 +316,7 @@ impl<Trace: Writer, Out: Writer> trace::VMTracer for Informant<Trace, Out> {
pub mod tests { pub mod tests {
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use super::*; use super::*;
use info::tests::run_test; use crate::info::tests::run_test;
#[derive(Debug, Clone, Default)] #[derive(Debug, Clone, Default)]
pub struct TestWriter(pub Arc<Mutex<Vec<u8>>>); pub struct TestWriter(pub Arc<Mutex<Vec<u8>>>);

View File

@ -17,13 +17,17 @@
//! EVM runner. //! EVM runner.
use std::time::{Instant, Duration}; 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 ethereum_types::{H256, U256};
use ethjson; use ethjson;
use pod::PodState; use pod::PodState;
use trace; use trace;
use types::transaction;
use vm::ActionParams; use vm::ActionParams;
/// EVM execution informant. /// EVM execution informant.
@ -37,7 +41,7 @@ pub trait Informant: trace::VMTracer {
/// Clone sink. /// Clone sink.
fn clone_sink(&self) -> Self::Sink; fn clone_sink(&self) -> Self::Sink;
/// Display final result. /// Display final result.
fn finish(result: RunResult<Self::Output>, &mut Self::Sink); fn finish(result: RunResult<Self::Output>, _: &mut Self::Sink);
} }
/// Execution finished correctly. /// Execution finished correctly.
@ -272,7 +276,7 @@ pub mod tests {
#[test] #[test]
fn should_call_account_from_spec() { fn should_call_account_from_spec() {
use display::std_json::tests::informant; use crate::display::std_json::tests::informant;
let (inf, res, _) = informant(); let (inf, res, _) = informant();
let mut params = ActionParams::default(); let mut params = ActionParams::default();

View File

@ -34,46 +34,22 @@
#![warn(missing_docs)] #![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::sync::Arc;
use std::{fmt, fs}; use std::{fmt, fs};
use std::path::PathBuf; use std::path::PathBuf;
use parity_bytes::Bytes;
use docopt::Docopt; use docopt::Docopt;
use rustc_hex::FromHex; use rustc_hex::FromHex;
use ethereum_types::{U256, Address}; use ethereum_types::{U256, Address};
use bytes::Bytes;
use ethcore::{spec, json_tests, TrieSpec}; use ethcore::{spec, json_tests, TrieSpec};
use serde::Deserialize;
use vm::{ActionParams, CallType}; use vm::{ActionParams, CallType};
mod info; mod info;
mod display; mod display;
use info::{Informant, TxInput}; use crate::info::{Informant, TxInput};
const USAGE: &'static str = r#" const USAGE: &'static str = r#"
EVM implementation for Parity. EVM implementation for Parity.
@ -289,7 +265,7 @@ fn run_state_test(args: Args) {
} }
fn run_stats_jsontests_vm(args: Args) { fn run_stats_jsontests_vm(args: Args) {
use json_tests::HookType; use crate::json_tests::HookType;
use std::collections::HashMap; use std::collections::HashMap;
use std::time::{Instant, Duration}; use std::time::{Instant, Duration};
@ -464,14 +440,17 @@ fn die<T: fmt::Display>(msg: T) -> ! {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use display::std_json::tests::informant; use common_types::transaction;
use docopt::Docopt; use docopt::Docopt;
use ethcore::{TrieSpec}; use ethcore::{TrieSpec};
use ethjson::state::test::{State}; use ethjson::state::test::{State};
use info::{self, TxInput}; use serde::Deserialize;
use super::{Args, USAGE, Address, run_call};
use types::transaction;
use super::{Args, USAGE, Address, run_call};
use crate::{
display::std_json::tests::informant,
info::{self, TxInput}
};
#[derive(Debug, PartialEq, Deserialize)] #[derive(Debug, PartialEq, Deserialize)]
pub struct SampleStateTests { pub struct SampleStateTests {