Skip to content

Commit

Permalink
Cleanup imports
Browse files Browse the repository at this point in the history
Licence year change
  • Loading branch information
rakita committed Jan 29, 2023
1 parent c14d7ea commit 0ac5d54
Show file tree
Hide file tree
Showing 27 changed files with 121 additions and 155 deletions.
79 changes: 41 additions & 38 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 LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 draganrakita
Copyright (c) 2023 draganrakita

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion bins/revme/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 draganrakita
Copyright (c) 2023 draganrakita

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
31 changes: 3 additions & 28 deletions crates/interpreter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,7 @@ readme = "../../README.md"
[dependencies]
revm-primitives = { path = "../primitives", default-features = false }

bytes = { version = "1.1", default-features = false }
hashbrown = { version = "0.13" }
hex = { version = "0.4", default-features = false }
rlp = { version = "0.5", default-features = false } # used for create2 address calculation
ruint = { version = "1.7.0", features = ["primitive-types", "rlp"] }


# bits B256 B160 crate
fixed-hash = { version = "0.8", default-features = false, features = [
"rustc-hex",
] }

#utility
hex-literal = "0.3"
derive_more = "0.99"
enumn = "0.1"

Expand All @@ -42,12 +29,6 @@ proptest-derive = { version = "0.3", optional = true }
arbitrary = { version = "1.2", features = ["derive"] }
proptest = { version = "1.0" }
proptest-derive = "0.3"
ruint = { version = "1.7.0", features = [
"primitive-types",
"rlp",
"proptest",
"arbitrary",
] }

[features]
default = ["std"]
Expand All @@ -64,20 +45,14 @@ optional_balance_check = ["revm-primitives/optional_balance_check"]
optional_block_gas_limit = ["revm-primitives/optional_block_gas_limit"]
optional_eip3607 = ["revm-primitives/optional_eip3607"]
optional_gas_refund = ["revm-primitives/optional_gas_refund"]
std = ["bytes/std", "rlp/std", "hex/std"]
std = ["revm-primitives/std"]
serde = [
"dep:serde",
"hex/serde",
"hashbrown/serde",
"ruint/serde",
"bytes/serde",
"revm-primitives/serde"
"revm-primitives/serde",
]
arbitrary = [
"ruint/arbitrary",
"ruint/proptest",
"dep:arbitrary",
"dep:proptest",
"dep:proptest-derive",
"revm-primitives/arbitrary"
"revm-primitives/arbitrary",
]
2 changes: 1 addition & 1 deletion crates/interpreter/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 draganrakita
Copyright (c) 2023 draganrakita

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
32 changes: 10 additions & 22 deletions crates/interpreter/src/host/dummy_host.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
use hashbrown::{hash_map::Entry, HashMap};
use ruint::aliases::U256;

use crate::primitives::Bytecode;
use crate::primitives::{hash_map::Entry, Bytecode, Bytes, HashMap, U256};
use crate::{
primitives::{Env, Log, B160, B256, KECCAK_EMPTY},
CallInputs, CreateInputs, Gas, Host, InstructionResult, Interpreter, SelfDestructResult,
Expand Down Expand Up @@ -49,11 +46,11 @@ impl Host for DummyHost {
Some((true, true))
}

fn block_hash(&mut self, _number: ruint::aliases::U256) -> Option<B256> {
fn block_hash(&mut self, _number: U256) -> Option<B256> {
Some(B256::zero())
}

fn balance(&mut self, _address: B160) -> Option<(ruint::aliases::U256, bool)> {
fn balance(&mut self, _address: B160) -> Option<(U256, bool)> {
Some((U256::ZERO, false))
}

Expand All @@ -65,11 +62,7 @@ impl Host for DummyHost {
Some((KECCAK_EMPTY, false))
}

fn sload(
&mut self,
__address: B160,
index: ruint::aliases::U256,
) -> Option<(ruint::aliases::U256, bool)> {
fn sload(&mut self, __address: B160, index: U256) -> Option<(U256, bool)> {
match self.storage.entry(index) {
Entry::Occupied(entry) => Some((*entry.get(), false)),
Entry::Vacant(entry) => {
Expand All @@ -82,14 +75,9 @@ impl Host for DummyHost {
fn sstore(
&mut self,
_address: B160,
index: ruint::aliases::U256,
value: ruint::aliases::U256,
) -> Option<(
ruint::aliases::U256,
ruint::aliases::U256,
ruint::aliases::U256,
bool,
)> {
index: U256,
value: U256,
) -> Option<(U256, U256, U256, bool)> {
let (present, is_cold) = match self.storage.entry(index) {
Entry::Occupied(mut entry) => (entry.insert(value), false),
Entry::Vacant(entry) => {
Expand All @@ -101,7 +89,7 @@ impl Host for DummyHost {
Some((U256::ZERO, present, value, is_cold))
}

fn log(&mut self, address: B160, topics: Vec<B256>, data: bytes::Bytes) {
fn log(&mut self, address: B160, topics: Vec<B256>, data: Bytes) {
self.log.push(Log {
address,
topics,
Expand All @@ -116,11 +104,11 @@ impl Host for DummyHost {
fn create(
&mut self,
_inputs: &mut CreateInputs,
) -> (InstructionResult, Option<B160>, Gas, bytes::Bytes) {
) -> (InstructionResult, Option<B160>, Gas, Bytes) {
panic!("Create is not supported for this host")
}

fn call(&mut self, _input: &mut CallInputs) -> (InstructionResult, Gas, bytes::Bytes) {
fn call(&mut self, _input: &mut CallInputs) -> (InstructionResult, Gas, Bytes) {
panic!("Call is not supported for this host")
}
}
3 changes: 1 addition & 2 deletions crates/interpreter/src/instructions/host.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use crate::primitives::{Spec, SpecId::*, B160, B256, U256};
use crate::primitives::{Bytes, Spec, SpecId::*, B160, B256, U256};
use crate::{
alloc::vec::Vec,
gas::{self, COLD_ACCOUNT_ACCESS_COST, WARM_STORAGE_READ_COST},
interpreter::Interpreter,
return_ok, return_revert, CallContext, CallInputs, CallScheme, CreateInputs, CreateScheme,
Host, InstructionResult, Transfer,
};
use bytes::Bytes;
use core::cmp::min;

pub fn balance<SPEC: Spec>(interpreter: &mut Interpreter, host: &mut dyn Host) {
Expand Down
Loading

0 comments on commit 0ac5d54

Please sign in to comment.