-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(gnovm): Resolve RefValues before using as Objects #2454
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2454 +/- ##
==========================================
+ Coverage 54.68% 54.80% +0.12%
==========================================
Files 583 583
Lines 78503 79124 +621
==========================================
+ Hits 42928 43364 +436
- Misses 32368 32486 +118
- Partials 3207 3274 +67
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test could be improved to validate content, otherwise LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, Thanks
Closes gnolang#2449. I believe the bug was introduced by gnolang#2255. Previously, if the type of `tv.V` in `GetFirstObject` was a `PointerValue`, it the `Base` would have been nil in the scenario producing this bug. Now that `Base` can never be nil for a `PointerValue`, the nil base check has been removed. We do however need to account for a new scenario where the `Base` is a `RefValue`, a type that does implement the `Object` interface. In the case where the base is a `RefValue`, first resolve it by calling `store.GetObject`. <!-- please provide a detailed description of the changes made in this pull request. --> <details><summary>Contributors' checklist...</summary> - [x] Added new tests, or not needed, or not feasible - [x] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [x] Updated the official documentation or not needed - [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [x] Added references to related issues and PRs - [x] Provided any useful hints for running manual tests - [x] Added new benchmarks to [generated graphs](https://gnoland.github.io/benchmarks), if any. More info [here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md). </details>
Closes #2449.
I believe the bug was introduced by #2255. Previously, if the type of
tv.V
inGetFirstObject
was aPointerValue
, it theBase
would have been nil in the scenario producing this bug. Now thatBase
can never be nil for aPointerValue
, the nil base check has been removed. We do however need to account for a new scenario where theBase
is aRefValue
, a type that does implement theObject
interface. In the case where the base is aRefValue
, first resolve it by callingstore.GetObject
.Contributors' checklist...
BREAKING CHANGE: xxx
message was included in the description