Skip to content

Commit

Permalink
fix: format web3_sha3 result as an hexadecimal string (#6843)
Browse files Browse the repository at this point in the history
* fix: format `web3_sha3` result as an hexadecimal string

* chore: use `alloy_primitives::utils` instead of `ethers::utils`
  • Loading branch information
leovct authored Jan 18, 2024
1 parent b51c057 commit 8bd1483
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/anvil/src/eth/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,8 @@ impl EthApi {
pub fn sha3(&self, bytes: Bytes) -> Result<String> {
node_info!("web3_sha3");
let hash = ethers::utils::keccak256(bytes.as_ref());
Ok(ethers::utils::hex::encode(&hash[..]))
let hex_hash = alloy_primitives::utils::hex::encode(&hash[..]);
Ok(format!("0x{hex_hash}"))
}

/// Returns protocol version encoded as a string (quotes are necessary).
Expand Down

0 comments on commit 8bd1483

Please sign in to comment.