Skip to content

Commit

Permalink
fix: review
Browse files Browse the repository at this point in the history
  • Loading branch information
atanmarko committed Aug 15, 2024
1 parent 2864c8e commit 56ce331
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ categories.workspace = true

[dependencies]
ethereum-types = { workspace = true }
keccak-hash = { workspace = true }

[dev-dependencies]
bytes = { workspace = true }
rlp = { workspace = true }
17 changes: 15 additions & 2 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
use ethereum_types::H256;

/// Empty code hash value
/// Hash value of account empty EVM code.
/// 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470
pub const EMPTY_CODE_HASH: H256 = H256([
197, 210, 70, 1, 134, 247, 35, 60, 146, 126, 125, 178, 220, 199, 3, 192, 229, 0, 182, 83, 202,
130, 39, 59, 123, 250, 216, 4, 93, 133, 164, 112,
]);

/// The hash of an empty trie.
/// The hash of an empty Merkle Patricia trie.
/// 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421
pub const EMPTY_TRIE_HASH: H256 = H256([
86, 232, 31, 23, 27, 204, 85, 166, 255, 131, 69, 230, 146, 192, 248, 110, 91, 72, 224, 27, 153,
108, 173, 192, 1, 98, 47, 181, 227, 99, 180, 33,
]);

#[test]
fn test_code_hash() {
assert_eq!(EMPTY_CODE_HASH, keccak_hash::keccak([]));
}

#[test]
fn test_empty_trie_hash() {
assert_eq!(
EMPTY_TRIE_HASH,
keccak_hash::keccak(bytes::Bytes::from_static(&rlp::NULL_RLP))
);
}

0 comments on commit 56ce331

Please sign in to comment.