Skip to content

Commit

Permalink
Fix storage reset
Browse files Browse the repository at this point in the history
  • Loading branch information
sorpaas committed Nov 18, 2023
1 parent ba17d41 commit d2a9a9a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/backend/in_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,13 @@ impl RuntimeBackend for InMemoryBackend {
}

fn set_storage(&mut self, address: H160, index: H256, value: H256) -> Result<(), ExitError> {
self.current_layer_mut()
.state
.entry(address)
.or_default()
.storage
.insert(index, value);
let entry = self.current_layer_mut().state.entry(address).or_default();

if value == H256::default() {
entry.storage.remove(&index);
} else {
entry.storage.insert(index, value);
}
Ok(())
}

Expand Down

0 comments on commit d2a9a9a

Please sign in to comment.