Skip to content

Commit

Permalink
fix: make DatabaseRef::basic consistent with Database (#201)
Browse files Browse the repository at this point in the history
* fix: make DatabaseRef::basic consistent with database

* clippy update
  • Loading branch information
rakita authored Sep 2, 2022
1 parent 8f01d86 commit 8f4348d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion bins/revme/src/debugger/ctrl/ctrl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ impl<DB: Database> Inspector<DB> for Controller {
println!("PC:{} stack:{}", interp.program_counter(), interp.stack())
}
CtrlPrint::Memory => {
println!("memory:{}", hex::encode(&interp.memory.data()))
println!("memory:{}", hex::encode(interp.memory.data()))
}
},
Ctrl::Continue => {
Expand Down
2 changes: 1 addition & 1 deletion bins/revme/src/statetest/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pub fn execute_test_suit(path: &Path, elapsed: &Arc<Mutex<Duration>>) -> Result<
return Ok(());
}

let json_reader = std::fs::read(&path).unwrap();
let json_reader = std::fs::read(path).unwrap();
let suit: TestSuit = serde_json::from_reader(&*json_reader)?;

let map_caller_keys: HashMap<_, _> = vec![
Expand Down
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 @@ -282,7 +282,7 @@ impl<ExtDB: DatabaseRef> DatabaseRef for CacheDB<ExtDB> {

fn basic(&self, address: H160) -> Result<Option<AccountInfo>, Self::Error> {
match self.accounts.get(&address) {
Some(acc) => Ok(Some(acc.info.clone())),
Some(acc) => Ok(acc.info()),
None => self.db.basic(address),
}
}
Expand Down Expand Up @@ -344,7 +344,7 @@ impl DatabaseRef for EmptyDB {
fn block_hash(&self, number: U256) -> Result<H256, Self::Error> {
let mut buffer: [u8; 4 * 8] = [0; 4 * 8];
number.to_big_endian(&mut buffer);
Ok(H256::from_slice(&Keccak256::digest(&buffer)))
Ok(H256::from_slice(&Keccak256::digest(buffer)))
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/revm/src/evm_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -820,9 +820,9 @@ pub fn create2_address(caller: H160, code_hash: H256, salt: U256) -> H160 {
salt.to_big_endian(&mut temp);

let mut hasher = Keccak256::new();
hasher.update(&[0xff]);
hasher.update([0xff]);
hasher.update(&caller[..]);
hasher.update(&temp);
hasher.update(temp);
hasher.update(&code_hash[..]);
H160::from_slice(&hasher.finalize().as_slice()[12..])
}
Expand Down

0 comments on commit 8f4348d

Please sign in to comment.