WIP: fix(gnovm): fill package value for GetPackage and GetObject
🛠 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:
- Fix any issues flagged by automated checks.
- 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 CHANGEnotes. - Link related issues/PRs, where applicable.
☑️ Reviewer Actions:
- 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 requestManual Checks
**IGNORE** the bot requirements for this PR (force green CI check)
If
🟢 Condition met └── 🟢 On every pull requestCan be checked by
- Any user with comment edit permission
Codecov Report
:x: Patch coverage is 70.83333% with 7 lines in your changes missing coverage. Please review.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| gnovm/pkg/gnolang/store.go | 80.00% | 3 Missing and 1 partial :warning: |
| gnovm/pkg/gnolang/realm.go | 0.00% | 3 Missing :warning: |
:loudspeaker: Thoughts on this report? Let us know!
Can we make GetPackage call GetObjectSafe, at this point? 👍 , see f76bdb2
I'm worried if this might encourage misuse of
GetObjectto get packages more generally; maybe one small step against this is to unexportObjectIDFromPkgPath?
That can avoid misuse in external package only. i'd like to introduce a new method only for getting pkg from store: GetPackageFromStore, along with some comments, so that people are still discouraged to use GetObject for a *PackageValue, as it may yield unpredictable result . wdyt?
see: https://github.com/gnolang/gno/pull/4376/commits/55a018a91f4ca28152dd19d5d69582e0444d84fe
That can avoid misuse in external package only. i'd like to introduce a new method only for getting pkg from store: GetPackageFromStore, along with some comments, so that people are still discouraged to use
GetObjectfor a *PackageValue, as it may yield unpredictable result . wdyt?
The change works if GetObject panics if it should return a PackageValue. Maybe we can have this in GetObject rather than GetObjectSafe, so "safe" is the method that does not panic. Do you agree?
This PR is a blocker for GnoSwap
I'm worried if this might encourage misuse of GetObject to get packages more generally; maybe one small step against this is to unexport ObjectIDFromPkgPath?
I think the reason we didn’t want GetObject to be used for retrieving packages was that it’s not a complete implementation—it doesn’t use pkgGetter and it also doesn’t populate the package’s realm. By design, GetPackage is the only intended entry point for this.
However, now we need to retrieve a package by ObjectID solely from the cache/store(get containing package of an object), so using GetObject for this purpose makes sense. do you agree. @thehowl