Skip to content

Commit

Permalink
special snapshot for storage application cycles
Browse files Browse the repository at this point in the history
  • Loading branch information
joonazan committed Aug 29, 2024
1 parent bdfc56f commit 98a8045
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/world_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,18 @@ impl WorldDiff {
self.transient_storage_changes = Default::default();
}

pub fn storage_application_cycles_after(&self, snapshot: &ExternalSnapshot) -> usize {
pub fn storage_application_cycles_snapshot(&self) -> StorageApplicationCyclesSnapshot {
StorageApplicationCyclesSnapshot {
written_storage_slots: self.written_storage_slots.snapshot(),
read_storage_slots: self.read_storage_slots.snapshot(),
decommitted_hashes: self.decommitted_hashes.snapshot(),
}
}

pub fn storage_application_cycles_after(
&self,
snapshot: &StorageApplicationCyclesSnapshot,
) -> usize {
self.written_storage_slots
.added_after(snapshot.written_storage_slots)
.len()
Expand All @@ -352,6 +363,12 @@ impl WorldDiff {
}
}

pub struct StorageApplicationCyclesSnapshot {
written_storage_slots: <RollbackableSet<(H160, U256)> as Rollback>::Snapshot,
read_storage_slots: <RollbackableSet<(H160, U256)> as Rollback>::Snapshot,
decommitted_hashes: <RollbackableSet<U256> as Rollback>::Snapshot,
}

#[derive(Clone, PartialEq, Debug)]
pub struct Snapshot {
storage_changes: <RollbackableMap<(H160, U256), U256> as Rollback>::Snapshot,
Expand Down

0 comments on commit 98a8045

Please sign in to comment.