Skip to content

Commit 8414b07

Browse files
committed
sdb skip empty value
1 parent b7cf183 commit 8414b07

File tree

1 file changed

+8
-5
lines changed
  • bus-mapping/src/circuit_input_builder

1 file changed

+8
-5
lines changed

bus-mapping/src/circuit_input_builder/l2.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,18 @@ impl From<&ZktrieState> for StateDB {
3232
let mut sdb = StateDB::new();
3333

3434
for (addr, acc) in mpt_state.state() {
35-
sdb.set_account(addr, acc.into())
35+
if !acc.keccak_code_hash.is_zero() {
36+
sdb.set_account(addr, acc.into())
37+
}
3638
}
3739

3840
for (storage_key, data) in mpt_state.storage() {
39-
//TODO: add an warning on non-existed account?
40-
let (_, acc) = sdb.get_account_mut(&storage_key.0);
41-
acc.storage.insert(storage_key.1, *data.as_ref());
41+
if !data.as_ref().is_zero() {
42+
//TODO: add an warning on non-existed account?
43+
let (_, acc) = sdb.get_account_mut(&storage_key.0);
44+
acc.storage.insert(storage_key.1, *data.as_ref());
45+
}
4246
}
43-
4447
sdb
4548
}
4649
}

0 commit comments

Comments
 (0)