Skip to content

fix(gnovm): correct len/cap/hint type check#5391

Open
ltzmaxwell wants to merge 20 commits intognolang:masterfrom
ltzmaxwell:fix/maxwell/len-cap-hint
Open

fix(gnovm): correct len/cap/hint type check#5391
ltzmaxwell wants to merge 20 commits intognolang:masterfrom
ltzmaxwell:fix/maxwell/len-cap-hint

Conversation

@ltzmaxwell
Copy link
Copy Markdown
Contributor

@ltzmaxwell ltzmaxwell commented Mar 30, 2026

No description provided.

@Gno2D2
Copy link
Copy Markdown
Collaborator

Gno2D2 commented Mar 30, 2026

🛠 PR Checks Summary

All Automated Checks passed. ✅

Manual Checks (for Reviewers):
  • IGNORE the bot requirements for this PR (force green CI check)
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)

☑️ 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: ltzmaxwell/gno)

Then

🟢 Requirement satisfied
└── 🟢 Maintainer can modify this 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

@ltzmaxwell ltzmaxwell changed the title fix(gnovm): correct len/cap/hint type check WIP fix(gnovm): correct len/cap/hint type check Mar 30, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@ltzmaxwell ltzmaxwell marked this pull request as ready for review April 7, 2026 15:38
@ltzmaxwell ltzmaxwell changed the title WIP fix(gnovm): correct len/cap/hint type check fix(gnovm): correct len/cap/hint type check Apr 7, 2026
@ltzmaxwell ltzmaxwell requested a review from thehowl April 7, 2026 15:38
@ltzmaxwell ltzmaxwell requested a review from omarsy April 9, 2026 09:51
Copy link
Copy Markdown
Member

@thehowl thehowl left a comment

Choose a reason for hiding this comment

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

could we handle compile-time cases of len > cap as well? (ie. make([]int, 6, 3)

Comment on lines +1811 to +1813
if tv := cx.TypedValue; tv.T != nil && isNumeric(tv.T) && tv.Sign() < 0 {
panic(fmt.Sprintf("invalid argument: index %v must not be negative", tv))
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

could be cx.TypedValue.AssertNonNegative

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should likely be changed or removed, as this is a recover test and it's not testing recover anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📦 🤖 gnovm Issues or PRs gnovm related

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants