Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manage primitive-types dependency through evm-core #308

Open
wants to merge 1 commit into
base: v0.x
Choose a base branch
from
Open
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
5 changes: 0 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ edition = "2018"
auto_impl = "1.0"
ethereum = { git = "https://github.com/rust-ethereum/ethereum.git", rev = "3be0d8fd4c2ad1ba216b69ef65b9382612efc8ba", default-features = false }
log = { version = "0.4", default-features = false }
primitive-types = { version = "0.13", default-features = false, features = ["rlp"] }
rlp = { version = "0.6", default-features = false }
sha3 = { version = "0.10", default-features = false }

Expand All @@ -39,7 +38,6 @@ default = ["std"]
std = [
"ethereum/std",
"log/std",
"primitive-types/std",
"rlp/std",
"sha3/std",
"environmental/std",
Expand All @@ -53,14 +51,11 @@ std = [
with-codec = [
"scale-codec",
"scale-info",
"primitive-types/codec",
"primitive-types/scale-info",
"ethereum/with-scale",
"evm-core/with-codec",
]
with-serde = [
"serde",
"primitive-types/impl-serde",
"evm-core/with-serde",
"ethereum/with-serde",
]
Expand Down
2 changes: 1 addition & 1 deletion benches/loop.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use criterion::{criterion_group, criterion_main, Criterion};
use evm::backend::{MemoryAccount, MemoryBackend, MemoryVicinity};
use evm::executor::stack::{MemoryStackState, StackExecutor, StackSubstateMetadata};
use evm::primitive_types::{H160, U256};
use evm::Config;
use primitive_types::{H160, U256};
use std::{collections::BTreeMap, str::FromStr};

fn run_loop_contract() {
Expand Down
4 changes: 2 additions & 2 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ edition = "2018"

[dependencies]
log = { version = "0.4", optional = true }
primitive-types = { version = "0.13", default-features = false }
primitive-types = { version = "0.13", default-features = false, features = ["rlp"] }
scale-codec = { package = "parity-scale-codec", version = "3.2", default-features = false, features = ["derive", "full"], optional = true }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
serde = { version = "1.0", default-features = false, features = ["derive"], optional = true }
Expand All @@ -29,7 +29,7 @@ std = [
with-codec = [
"scale-codec",
"scale-info",
"primitive-types/impl-codec",
"primitive-types/scale-info",
]
with-serde = [
"serde",
Expand Down
2 changes: 2 additions & 0 deletions core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ pub use crate::opcode::Opcode;
pub use crate::stack::Stack;
pub use crate::valids::Valids;

pub use primitive_types;

use crate::eval::{eval, Control};
use alloc::rc::Rc;
use alloc::vec::Vec;
Expand Down
2 changes: 0 additions & 2 deletions gasometer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ edition = "2018"
[dependencies]
environmental = { version = "1.1.2", default-features = false, optional = true }
log = { version = "0.4", optional = true }
primitive-types = { version = "0.13", default-features = false }

evm-core = { version = "0.42", path = "../core", default-features = false }
evm-runtime = { version = "0.42", path = "../runtime", default-features = false }
Expand All @@ -20,7 +19,6 @@ evm-runtime = { version = "0.42", path = "../runtime", default-features = false
default = ["std"]
std = [
"environmental/std",
"primitive-types/std",
"evm-core/std",
"evm-runtime/std",
]
Expand Down
2 changes: 1 addition & 1 deletion gasometer/src/costs.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::consts::*;
use crate::Config;
use evm_core::primitive_types::{H256, U256};
use evm_core::ExitError;
use primitive_types::{H256, U256};

pub fn call_extra_check(gas: U256, after_gas: u64, config: &Config) -> Result<(), ExitError> {
if config.err_on_call_with_more_gas && U256::from(after_gas) < gas {
Expand Down
2 changes: 1 addition & 1 deletion gasometer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ mod utils;

use alloc::vec::Vec;
use core::cmp::max;
use evm_core::primitive_types::{H160, H256, U256};
use evm_core::{ExitError, Opcode, Stack};
use evm_runtime::{Config, Handler};
use primitive_types::{H160, H256, U256};

macro_rules! try_or_fail {
( $inner:expr, $e:expr ) => {
Expand Down
2 changes: 1 addition & 1 deletion gasometer/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use primitive_types::U256;
use evm_core::primitive_types::U256;

pub fn log2floor(value: U256) -> u64 {
assert!(value != U256::zero());
Expand Down
2 changes: 0 additions & 2 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ edition = "2018"
[dependencies]
auto_impl = "1.0"
environmental = { version = "1.1.2", default-features = false, optional = true }
primitive-types = { version = "0.13", default-features = false }
sha3 = { version = "0.10", default-features = false }

evm-core = { version = "0.42", path = "../core", default-features = false }
Expand All @@ -20,7 +19,6 @@ evm-core = { version = "0.42", path = "../core", default-features = false }
default = ["std"]
std = [
"environmental/std",
"primitive-types/std",
"sha3/std",
"evm-core/std",
]
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/context.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use primitive_types::{H160, H256, U256};
use evm_core::primitive_types::{H160, H256, U256};

/// Create scheme.
#[derive(Clone, Copy, Eq, PartialEq, Debug)]
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/eval/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mod system;
use crate::{CallScheme, ExitReason, Handler, Opcode, Runtime};
use alloc::vec::Vec;
use core::cmp::min;
use primitive_types::{H160, H256, U256};
use evm_core::primitive_types::{H160, H256, U256};

pub enum Control<H: Handler> {
Continue,
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/eval/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
Runtime, Transfer,
};
use alloc::vec::Vec;
use primitive_types::{H256, U256};
use evm_core::primitive_types::{H256, U256};
use sha3::{Digest, Keccak256};

pub fn sha3<H: Handler>(runtime: &mut Runtime) -> Control<H> {
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/handler.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{Capture, Context, CreateScheme, ExitError, ExitReason, Machine, Opcode, Stack};
use alloc::vec::Vec;
use primitive_types::{H160, H256, U256};
use evm_core::primitive_types::{H160, H256, U256};

/// Transfer from source to target, with given value.
#[derive(Clone, Debug)]
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub use crate::interrupt::{Resolve, ResolveCall, ResolveCreate};

use alloc::rc::Rc;
use alloc::vec::Vec;
use primitive_types::{H160, U256};
use evm_core::primitive_types::{H160, U256};

macro_rules! step {
( $self:expr, $handler:expr, $return:tt $($err:path)?; $($ok:path)? ) => ({
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/tracing.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Allows to listen to runtime events.

use crate::{Capture, Context, ExitReason, Memory, Opcode, Stack, Trap};
use primitive_types::{H160, H256};
use evm_core::primitive_types::{H160, H256};

environmental::environmental!(listener: dyn EventListener + 'static);

Expand Down
2 changes: 1 addition & 1 deletion src/backend/memory.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::{Apply, ApplyBackend, Backend, Basic, Log};
use alloc::collections::BTreeMap;
use alloc::vec::Vec;
use primitive_types::{H160, H256, U256};
use evm_core::primitive_types::{H160, H256, U256};

/// Vicinity value of a memory backend.
#[derive(Clone, Debug, Eq, PartialEq)]
Expand Down
2 changes: 1 addition & 1 deletion src/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mod memory;

pub use self::memory::{MemoryAccount, MemoryBackend, MemoryVicinity};
use alloc::vec::Vec;
use primitive_types::{H160, H256, U256};
use evm_core::primitive_types::{H160, H256, U256};
/// Basic account information.
#[derive(Clone, Eq, PartialEq, Debug, Default)]
#[cfg_attr(
Expand Down
2 changes: 1 addition & 1 deletion src/executor/stack/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ use crate::{
};
use alloc::{collections::BTreeSet, rc::Rc, vec::Vec};
use core::{cmp::min, convert::Infallible};
use evm_core::primitive_types::{H160, H256, U256};
use evm_core::ExitFatal;
use evm_runtime::Resolve;
use primitive_types::{H160, H256, U256};
use sha3::{Digest, Keccak256};

macro_rules! emit_exit {
Expand Down
2 changes: 1 addition & 1 deletion src/executor/stack/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use alloc::{
vec::Vec,
};
use core::mem;
use primitive_types::{H160, H256, U256};
use evm_core::primitive_types::{H160, H256, U256};

#[derive(Clone, Debug)]
pub struct MemoryStackAccount {
Expand Down
2 changes: 1 addition & 1 deletion src/executor/stack/precompile.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{Context, ExitError, ExitFatal, ExitReason, ExitRevert, ExitSucceed, Transfer};
use alloc::{collections::BTreeMap, vec::Vec};
use primitive_types::{H160, H256};
use evm_core::primitive_types::{H160, H256};

/// A precompile result.
pub type PrecompileResult = Result<PrecompileOutput, PrecompileFailure>;
Expand Down
2 changes: 1 addition & 1 deletion src/executor/stack/tagged_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use crate::maybe_borrowed::MaybeBorrowed;
use crate::Runtime;
use primitive_types::H160;
use evm_core::primitive_types::H160;

pub struct TaggedRuntime<'borrow> {
pub kind: RuntimeKind,
Expand Down
2 changes: 1 addition & 1 deletion src/tracing.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! Allows to listen to runtime events.

use crate::Context;
use evm_core::primitive_types::{H160, H256, U256};
use evm_runtime::{CreateScheme, ExitReason, Transfer};
use primitive_types::{H160, H256, U256};

environmental::environmental!(listener: dyn EventListener + 'static);

Expand Down
Loading