Skip to content

Conversation

@D4ryl00
Copy link
Contributor

@D4ryl00 D4ryl00 commented Dec 9, 2025

fixes #3704

This PR is a proposed solution to issue #3704. It focuses only on improving the “out of gas” error, whereas PR #4451 also aims to improve the UX to help users avoid running out of gas.

Changes

  • Simulation now uses the consensus Block.MaxGas as the cap (ignores tx gas-wanted), falling back to infinite only when maxGas is unset. That means you can estimate full usage up to that cap; if the tx needs more than maxGas, simulation will still OOG at that ceiling (with the “hit consensus maxGas” hint).
  • The simulate OOG special case still marks an error when gasUsed > gasWanted so you see the failure even though the meter is high.
  • OOG logs in running tx show “(until panic)” to make it clear gasUsed stops at the panic point.

Before

gnokey maketx call -pkgpath "gno.land/r/demo/counter" -func "Increment" -broadcast -gas-wanted=105000 -gas-fee=500ugnot test1
Enter password.
TX HASH:
INFO:
--= Error =--
Data: out of gas error
Msg Traces:
    0  gno/tm2/pkg/errors/errors.go:103 - deliver transaction failed: log:out of gas, gasWanted: 105000, gasUsed: 110998 location: GetObjectPerByte
--= /Error =--

GAS USED is the gas used until the panic during the simulation stage.

Now

gnokey maketx call -pkgpath "gno.land/r/demo/counter" -func "Increment" -broadcast -gas-wanted=105000 -gas-fee=500ugnot test1
Enter password.
GAS WANTED: 105000
GAS USED:   227390
HEIGHT:     0
STORAGE DELTA:  5 bytes
STORAGE FEE:    500ugnot
TOTAL TX COST:  1000ugnot
EVENTS:     [{"bytes_delta":5,"fee_delta":{"denom":"ugnot","amount":500},"pkg_path":"gno.land/r/demo/counter"}]
INFO:
TX HASH:
--= Error =--
Data: out of gas error
Msg Traces:
    0  gno/tm2/pkg/errors/errors.go:103 - deliver transaction failed: log:out of gas during simulation; gasWanted: 105000, gasUsed: 227390
--= /Error =--

GAS USED is the total gas used of the transaction, now calculate during the simulation stage.

gnokey maketx call -pkgpath "gno.land/r/demo/counter" -func "Increment" -broadcast -gas-wanted=105000 -gas-fee=500ugnot -simulate skip test1
Enter password.
GAS WANTED: 105000
GAS USED:   110998
HEIGHT:     3
EVENTS:     []
INFO:
TX HASH:    doB/H4EvsPgIVllZM7JxQtEwNcjOzQ0HSBgUZn0yMuc=
--= Error =--
Data: out of gas error
Msg Traces:
    0  gno/tm2/pkg/errors/errors.go:103 - deliver transaction failed: log:out of gas, gasWanted: 105000, gasUsed: 110998 (until panic) location: GetObjectPerByte
--= /Error =--

Message updated: GAS USED is the gas used UNTIL the panic (no simulation).

gnokey maketx call -pkgpath "gno.land/r/demo/counter" -func "Increment" -broadcast -gas-wanted=100 -gas-fee=500ugnot -simulate skip test1
Enter password.
--= Error =--
Data: out of gas error
Msg Traces:
    0  gno/tm2/pkg/errors/errors.go:103 - check transaction failed: log:--= Error =--
Data: std.OutOfGasError{abciError:std.abciError{}}
Msg Traces:
    0  gno/tm2/pkg/std/errors.go:108 - out of gas in location: txSize; gasWanted: 100, gasUsed: 2370 (until panic)
Stack Trace:
    0  gno/tm2/pkg/errors/errors.go:93
    1  gno/tm2/pkg/std/errors.go:108
    2  gno/tm2/pkg/sdk/auth/ante.go:84
    ...

Message updated: GAS USED is the gas used UNTIL the panic (before running the tx).

@Gno2D2
Copy link
Collaborator

Gno2D2 commented Dec 9, 2025

🛠 PR Checks Summary

🔴 Pending initial approval by a review team member, or review from tech-staff

Manual Checks (for Reviewers):
  • IGNORE the bot requirements for this PR (force green CI check)
  • The pull request description provides enough details
Read More

🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers.

✅ Automated Checks (for Contributors):

🟢 Maintainers must be able to edit this pull request (more info)
🔴 Pending initial approval by a review team member, or review from tech-staff

☑️ Contributor Actions:
  1. Fix any issues flagged by automated checks.
  2. Follow the Contributor Checklist to ensure your PR is ready for review.
    • Add new tests, or document why they are unnecessary.
    • Provide clear examples/screenshots, if necessary.
    • Update documentation, if required.
    • Ensure no breaking changes, or include BREAKING CHANGE notes.
    • Link related issues/PRs, where applicable.
☑️ Reviewer Actions:
  1. Complete manual checks for the PR, including the guidelines and additional checks if applicable.
📚 Resources:
Debug
Automated Checks
Maintainers must be able to edit this pull request (more info)

If

🟢 Condition met
└── 🟢 And
    ├── 🟢 The base branch matches this pattern: ^master$
    └── 🟢 The pull request was created from a fork (head branch repo: D4ryl00/gno)

Then

🟢 Requirement satisfied
└── 🟢 Maintainer can modify this pull request

Pending initial approval by a review team member, or review from tech-staff

If

🟢 Condition met
└── 🟢 And
    ├── 🟢 The base branch matches this pattern: ^master$
    └── 🟢 Not (🔴 Pull request author is a member of the team: tech-staff)

Then

🔴 Requirement not satisfied
└── 🔴 If
    ├── 🔴 Condition
    │   └── 🔴 Or
    │       ├── 🔴 At least one of these user(s) reviewed the pull request: [jefft0 leohhhn n0izn0iz notJoon omarsy x1unix] (with state "APPROVED")
    │       ├── 🔴 At least 1 user(s) of the team tech-staff reviewed pull request
    │       └── 🔴 This pull request is a draft
    └── 🔴 Else
        └── 🔴 And
            ├── 🟢 This label is applied to pull request: review/triage-pending
            └── 🔴 On no pull request

Manual Checks
**IGNORE** the bot requirements for this PR (force green CI check)

If

🟢 Condition met
└── 🟢 On every pull request

Can be checked by

  • Any user with comment edit permission
The pull request description provides enough details

If

🟢 Condition met
└── 🟢 And
    ├── 🟢 Not (🔴 Pull request author is a member of the team: core-contributors)
    └── 🟢 Not (🔴 Pull request author is user: dependabot[bot])

Can be checked by

  • team core-contributors

@codecov
Copy link

codecov bot commented Dec 9, 2025

Codecov Report

❌ Patch coverage is 97.61905% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
tm2/pkg/crypto/keys/client/maketx.go 90.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@Kouteki Kouteki moved this from Triage to In Progress in 🧙‍♂️Gno.land development Dec 10, 2025
@D4ryl00 D4ryl00 marked this pull request as ready for review December 12, 2025 17:15
@Gno2D2 Gno2D2 added the review/triage-pending PRs opened by external contributors that are waiting for the 1st review label Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📦 🌐 tendermint v2 Issues or PRs tm2 related 📦 ⛰️ gno.land Issues or PRs gno.land package related review/triage-pending PRs opened by external contributors that are waiting for the 1st review

Projects

Status: No status
Status: In Progress

Development

Successfully merging this pull request may close these issues.

Make out of gas error more useful

2 participants