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

Borrow self and add derive traits for OpCode #231

Merged
merged 2 commits into from
Oct 16, 2022
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
4 changes: 2 additions & 2 deletions crates/revm/src/db/in_memory_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use sha3::{Digest, Keccak256};

pub type InMemoryDB = CacheDB<EmptyDB>;

impl InMemoryDB {
pub fn default() -> Self {
impl Default for InMemoryDB {
fn default() -> Self {
CacheDB::new(EmptyDB {})
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/revm/src/evm_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB,

if crate::USE_GAS {
let zero_data_len = input.iter().filter(|v| **v == 0).count() as u64;
let non_zero_data_len = (input.len() as u64 - zero_data_len) as u64;
let non_zero_data_len = input.len() as u64 - zero_data_len;
let (accessed_accounts, accessed_slots) = {
if SPEC::enabled(BERLIN) {
let mut accessed_slots = 0_u64;
Expand Down
3 changes: 2 additions & 1 deletion crates/revm/src/instructions/opcode.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::gas;
use crate::SpecId;

#[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub struct OpCode(u8);

pub const STOP: u8 = 0x00;
Expand Down Expand Up @@ -164,7 +165,7 @@ impl OpCode {
}

#[inline(always)]
pub const fn u8(self) -> u8 {
pub const fn u8(&self) -> u8 {
self.0
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/revm_precompiles/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ pub enum SpecId {

impl SpecId {
pub const fn enabled(self, spec_id: u8) -> bool {
spec_id as u8 >= self as u8
spec_id >= self as u8
}
}

Expand Down