Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ethcore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 2 additions & 3 deletions evmbin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ description = "Parity EVM Implementation"
name = "evmbin"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

[[bin]]
name = "parity-evm"
Expand All @@ -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]
Expand Down
1 change: 0 additions & 1 deletion evmbin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
15 changes: 10 additions & 5 deletions evmbin/src/display/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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 {
Expand Down
8 changes: 5 additions & 3 deletions evmbin/src/display/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
14 changes: 9 additions & 5 deletions evmbin/src/display/std_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -312,7 +316,7 @@ impl<Trace: Writer, Out: Writer> trace::VMTracer for Informant<Trace, Out> {
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<Mutex<Vec<u8>>>);
Expand Down
14 changes: 9 additions & 5 deletions evmbin/src/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -37,7 +41,7 @@ pub trait Informant: trace::VMTracer {
/// Clone sink.
fn clone_sink(&self) -> Self::Sink;
/// Display final result.
fn finish(result: RunResult<Self::Output>, &mut Self::Sink);
fn finish(result: RunResult<Self::Output>, _: &mut Self::Sink);
}

/// Execution finished correctly.
Expand Down Expand Up @@ -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();
Expand Down
45 changes: 12 additions & 33 deletions evmbin/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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};

Expand Down Expand Up @@ -464,14 +440,17 @@ fn die<T: fmt::Display>(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 {
Expand Down