Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 27 additions & 22 deletions src/tracing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,31 +534,36 @@ impl TracingInspector {
}

let journal = context.journal_ref().journal();

// If journal has not changed, there is no state change to be recorded.
if self.config.record_state_diff && journal.len() != self.last_journal_len {
Comment on lines -538 to -539
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why was this check removed?

if self.config.record_state_diff {
let op = step.op.get();

let journal_entry = journal.last();

step.storage_change = match (op, journal_entry) {
(
opcode::SLOAD | opcode::SSTORE,
Some(JournalEntry::StorageChanged { address, key, had_value }),
) => {
// SAFETY: (Address,key) exists if part if StorageChange
let value =
context.journal_ref().evm_state()[address].storage[key].present_value();
let reason = match op {
opcode::SLOAD => StorageChangeReason::SLOAD,
opcode::SSTORE => StorageChangeReason::SSTORE,
_ => unreachable!(),
};
let change =
StorageChange { key: *key, value, had_value: Some(*had_value), reason };
Some(Box::new(change))
step.storage_change = if matches!(op, opcode::SLOAD | opcode::SSTORE) {
let reason = match op {
opcode::SLOAD => StorageChangeReason::SLOAD,
opcode::SSTORE => StorageChangeReason::SSTORE,
_ => unreachable!(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is still unreachable now

};

match journal.last() {
Some(JournalEntry::StorageChanged { address, key, had_value }) => {
// SAFETY: (Address,key) exists if part if StorageChange
let value =
context.journal_ref().evm_state()[address].storage[key].present_value();
let change =
StorageChange { key: *key, value, had_value: Some(*had_value), reason };
Some(Box::new(change))
}
Some(JournalEntry::StorageWarmed { key, address }) => {
// SAFETY: (Address,key) exists if part if StorageChange
let value =
context.journal_ref().evm_state()[address].storage[key].present_value();
let change = StorageChange { key: *key, value, had_value: None, reason };
Some(Box::new(change))
}
_ => None,
}
Comment on lines +556 to 564
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this effectively the only change that we need here, the missing

JournalEntry::StorageWarmed { key, address }

variant?

_ => None,
} else {
None
};
}

Expand Down
Loading