Skip to content

Conversation

@DaniPopes
Copy link
Member

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

Ref #14

@DaniPopes DaniPopes requested review from mattsse and rakita February 15, 2024 08:09
// 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.

// 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
Contributor

@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

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.

5 participants