fix: filter out empty storage entries in state diff (#5230)

This commit is contained in:
Matthias Seitz
2023-10-30 14:38:24 +01:00
committed by GitHub
parent ef80b4d037
commit 7140bc29ff

View File

@ -589,8 +589,9 @@ where
let account_code = load_account_code(&db, &changed_acc.info).unwrap_or_default(); let account_code = load_account_code(&db, &changed_acc.info).unwrap_or_default();
entry.code = Delta::Added(account_code); entry.code = Delta::Added(account_code);
// new storage values // new storage values are marked as added,
for (key, slot) in changed_acc.storage.iter() { // however we're filtering changed here to avoid adding entries for the zero value
for (key, slot) in changed_acc.storage.iter().filter(|(_, slot)| slot.is_changed()) {
entry.storage.insert((*key).into(), Delta::Added(slot.present_value.into())); entry.storage.insert((*key).into(), Delta::Added(slot.present_value.into()));
} }
} else { } else {