Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: upstream trace formatting from Foundry #38

Merged
merged 3 commits into from
Feb 15, 2024
Merged

Conversation

DaniPopes
Copy link
Member

Will need a follow-up to add the "decoded" fields.

Ref #14

@@ -391,7 +398,7 @@ impl TracingInspector {

// The gas cost is the difference between the recorded gas remaining at the start of the
// step the remaining gas here, at the end of the step.
step.gas_cost = step.gas_remaining - self.gas_inspector.gas_remaining();
// step.gas_cost = step.gas_remaining - self.gas_inspector.gas_remaining();
Copy link
Member Author

@DaniPopes DaniPopes Feb 15, 2024

Choose a reason for hiding this comment

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

This overflows in the test I added, what am I missing? @mattsse @rakita

Copy link
Contributor

Choose a reason for hiding this comment

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

hard to find what's happening inside revm here

but this here would also overflow if nut saturating:

https://github.com/bluealloy/revm/blob/d6bd0109e5b5c37505fe25017b8ca5c2ea5ae6ca/crates/revm/src/inspector/gas.rs#L44

unclear why, I assume it must have something to do with a RETURN,
because this overflow happens after a call ended (call_end)

any ideas @rakita

@DaniPopes I think for now we can just saturate, even if not accurate

Copy link
Contributor

Choose a reason for hiding this comment

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

call_end returned the gas that is not spend to the caller after sub call get returned.

Copy link
Contributor

Choose a reason for hiding this comment

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

But with loop calls this behaviour is changed. It should not be effected. So overflow can only happen is step_end has more remaining_gas than step and step is always first called.

@@ -391,7 +398,7 @@ impl TracingInspector {

// The gas cost is the difference between the recorded gas remaining at the start of the
// step the remaining gas here, at the end of the step.
step.gas_cost = step.gas_remaining - self.gas_inspector.gas_remaining();
// step.gas_cost = step.gas_remaining - self.gas_inspector.gas_remaining();
Copy link
Contributor

Choose a reason for hiding this comment

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

hard to find what's happening inside revm here

but this here would also overflow if nut saturating:

https://github.com/bluealloy/revm/blob/d6bd0109e5b5c37505fe25017b8ca5c2ea5ae6ca/crates/revm/src/inspector/gas.rs#L44

unclear why, I assume it must have something to do with a RETURN,
because this overflow happens after a call ended (call_end)

any ideas @rakita

@DaniPopes I think for now we can just saturate, even if not accurate

@DaniPopes DaniPopes marked this pull request as ready for review February 15, 2024 16:09
Copy link
Member

@onbjerg onbjerg left a comment

Choose a reason for hiding this comment

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

ok with this although we initially said we shouldnt :p

@DaniPopes DaniPopes merged commit 552f47c into main Feb 15, 2024
11 checks passed
@DaniPopes DaniPopes deleted the dani/trace-writer branch February 15, 2024 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants