Skip to content

Conversation

@MishkaRogachev
Copy link
Contributor

Part of NIT-4069
Nitro PR: OffchainLabs/nitro#4012

Changes:

  • Add multigas to EndTxHook
  • Add safeDecrement for MultiGas (used in nitro code)

@MishkaRogachev MishkaRogachev changed the title Add multigas to EndTxHook and safeDecrement core: Add multigas to EndTxHook and safeDecrement Nov 17, 2025
@MishkaRogachev MishkaRogachev marked this pull request as ready for review November 21, 2025 14:06
res.gas[kind] = v
}

if t, c := bits.Sub64(res.total, gas, 0); c != 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a bug here when you have multiple constraints and it underflows a single constraint.

MultiGas(Computation=10, StorageAccess=10, total=20) - MultiGas(Computation=20, total=20)

The implementation will return

MultiGas(Computation=0, StorageAccess=10, total=0)

The correct value is

MultiGas(Computation=0, StorageAccess=10, total=10)

@gligneul gligneul assigned MishkaRogachev and unassigned gligneul Nov 21, 2025
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.

3 participants