diff --git a/Cargo.toml b/Cargo.toml index 8ecb8a5..9810525 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ members = ["crates/*"] resolver = "2" [workspace.package] -version = "0.6.8" +version = "0.6.9" edition = "2024" rust-version = "1.92" authors = ["init4"] @@ -35,13 +35,13 @@ incremental = false [workspace.dependencies] # internal -signet-hot = { version = "0.6.8", path = "./crates/hot" } -signet-hot-mdbx = { version = "0.6.8", path = "./crates/hot-mdbx" } -signet-cold = { version = "0.6.8", path = "./crates/cold" } -signet-cold-mdbx = { version = "0.6.8", path = "./crates/cold-mdbx" } -signet-cold-sql = { version = "0.6.8", path = "./crates/cold-sql" } -signet-storage = { version = "0.6.8", path = "./crates/storage" } -signet-storage-types = { version = "0.6.8", path = "./crates/types" } +signet-hot = { version = "0.6.9", path = "./crates/hot" } +signet-hot-mdbx = { version = "0.6.9", path = "./crates/hot-mdbx" } +signet-cold = { version = "0.6.9", path = "./crates/cold" } +signet-cold-mdbx = { version = "0.6.9", path = "./crates/cold-mdbx" } +signet-cold-sql = { version = "0.6.9", path = "./crates/cold-sql" } +signet-storage = { version = "0.6.9", path = "./crates/storage" } +signet-storage-types = { version = "0.6.9", path = "./crates/types" } # External, in-house signet-libmdbx = { version = "0.8.0" } diff --git a/crates/hot/src/db/inconsistent.rs b/crates/hot/src/db/inconsistent.rs index d661021..9a47a2b 100644 --- a/crates/hot/src/db/inconsistent.rs +++ b/crates/hot/src/db/inconsistent.rs @@ -239,8 +239,11 @@ pub trait UnsafeHistoryWrite: UnsafeDbWrite + HistoryRead { for (address, info) in accounts { let account = info.as_ref().map(Account::from).unwrap_or_default(); - if let Some(bytecode) = info.as_ref().and_then(|info| info.code.clone()) { - let code_hash = account.bytecode_hash.expect("info has bytecode; hash must exist"); + // bytecode_hash is None when code_hash == KECCAK256_EMPTY, + // which doesn't need to be stored. + if let Some((bytecode, code_hash)) = + info.as_ref().and_then(|info| info.code.clone()).zip(account.bytecode_hash) + { self.put_bytecode(&code_hash, &bytecode)?; } @@ -322,8 +325,9 @@ pub trait UnsafeHistoryWrite: UnsafeDbWrite + HistoryRead { }; let account = Account::from(info.clone()); - if let Some(bytecode) = info.code.clone() { - let code_hash = account.bytecode_hash.expect("info has bytecode; hash must exist"); + // bytecode_hash is None when code_hash == KECCAK256_EMPTY, + // which doesn't need to be stored. + if let Some((bytecode, code_hash)) = info.code.clone().zip(account.bytecode_hash) { self.put_bytecode(&code_hash, &bytecode)?; } self.put_account(address, &account)