Skip to content

Commit

Permalink
fix alloydb
Browse files Browse the repository at this point in the history
  • Loading branch information
lightsing committed Jul 31, 2024
1 parent f0fea88 commit 406db5e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion crates/revm/src/db/alloydb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,20 @@ impl<T: Transport + Clone, N: Network, P: Provider<T, N>> DatabaseRef for AlloyD

let balance = balance?;
let code = Bytecode::new_raw(code?.0.into());
#[cfg(not(feature = "scroll"))]
let code_hash = code.hash_slow();
#[cfg(feature = "scroll")]
let code_hash = code.poseidon_hash_slow();
let nonce = nonce?;

Ok(Some(AccountInfo::new(balance, nonce, code_hash, code)))
cfg_if::cfg_if! {
if #[cfg(not(feature = "scroll"))] {
return Ok(Some(AccountInfo::new(balance, nonce, code_hash, code)))
} else {
let keccak_code_hash = code.keccak_hash_slow();
return Ok(Some(AccountInfo::new(balance, nonce, code_hash, keccak_code_hash, code)))
}
}
}

fn block_hash_ref(&self, number: u64) -> Result<B256, Self::Error> {
Expand Down

0 comments on commit 406db5e

Please sign in to comment.