fix(gnovm): various post interrealm fixes#4192
Merged
Conversation
Collaborator
🛠 PR Checks SummaryAll Automated Checks passed. ✅ Manual Checks (for Reviewers):
Read More🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers. ✅ Automated Checks (for Contributors):No automated checks match this pull request. ☑️ Contributor Actions:
☑️ Reviewer Actions:
📚 Resources:Debug
|
Codecov ReportAttention: Patch coverage is 📢 Thoughts on this report? Let us know! |
jaekwon
commented
Apr 21, 2025
| Column: 0, // fake column | ||
| }) | ||
| line++ | ||
| fv := &gno.FuncValue{Name: name, PkgPath: m.Package.PkgPath, Source: fd} |
jaekwon
commented
Apr 21, 2025
| func A() string { | ||
| crossing() | ||
|
|
||
| return myrlm.A() |
Contributor
Author
There was a problem hiding this comment.
did this work? hmm... should have failed because myrlm.A is crossing so it should have to be called with cross(myrlm.A)().
jaekwon
commented
Apr 21, 2025
| # | 1 | MsgCall | wallet direct | myrlm.A() | user address | | ||
| # | 2 | | | myrlm.B() | user address | | ||
| # | 3 | | through /r/foo | myrlm.A() | user address | | ||
| # | 4 | | | myrlm.B() | user address | |
Contributor
Author
There was a problem hiding this comment.
if /r/foo calls cross(myrlm.A)() then it should be r/foo...
…dded addr from a run path
…rived addr and path in getRealm()
e7537ce to
8b73c94
Compare
- event for statement output - event multi msg output - ghverify - event normal output - gnokey gasfee - gnokey simulate
…simulate gas, transfer
jaekwon
added a commit
that referenced
this pull request
May 1, 2025
* When you are MsgAddPackage, nothing is run, but the machine does run for initialization during declarations and init() calls. In this stage of running, CurrentRealm() returns the *package path* even if you're initing a p package. Which is a little strange but it's a realm for a moment because it's mutating? :) And PreviousRealm() returns g1user, "" because the end user isn't a realm himself. * When calling main() or any other function after init it then runs in StageRun, and CurrentRealm() would be g1user and realm path "" while PreviousRealm() would panic, BUT, since MsgCall always crosses into a crossing function, in practice CurrentRealm() becomes the called external realm (e.g. gno.land/r/boards/boardsv1), and PreviousRealm() becomes g1user and "". When MsgRun runs, during init CurrentRealm() is gno.land/r/g1user/run, but the addr is not hash derived from that path, but instead the g1user is extracted from it, while PreviousRealm() has the same g1user but the realm path is "" indicating the end user (who uses the temporary run-realm but discards it after). https://github.com/gnolang/gno/blob/fcc6e1033139b1707688ef1aa8aebb9861419790/gnovm/stdlibs/std/native.go#L109-L131 btw solved it using two different modes for machine .Run(). During package init "add" or any other post-init "run". 2m * Machine is either in StageAdd or StageRun state, and its value may determine the behavior of std.CurrentRealm() and std.PreviousRealmI(). --------- Co-authored-by: gfanton <8671905+gfanton@users.noreply.github.com>
stefann-01
pushed a commit
to stefann-01/gno
that referenced
this pull request
Jul 14, 2025
* When you are MsgAddPackage, nothing is run, but the machine does run for initialization during declarations and init() calls. In this stage of running, CurrentRealm() returns the *package path* even if you're initing a p package. Which is a little strange but it's a realm for a moment because it's mutating? :) And PreviousRealm() returns g1user, "" because the end user isn't a realm himself. * When calling main() or any other function after init it then runs in StageRun, and CurrentRealm() would be g1user and realm path "" while PreviousRealm() would panic, BUT, since MsgCall always crosses into a crossing function, in practice CurrentRealm() becomes the called external realm (e.g. gno.land/r/boards/boardsv1), and PreviousRealm() becomes g1user and "". When MsgRun runs, during init CurrentRealm() is gno.land/r/g1user/run, but the addr is not hash derived from that path, but instead the g1user is extracted from it, while PreviousRealm() has the same g1user but the realm path is "" indicating the end user (who uses the temporary run-realm but discards it after). https://github.com/gnolang/gno/blob/fcc6e1033139b1707688ef1aa8aebb9861419790/gnovm/stdlibs/std/native.go#L109-L131 btw solved it using two different modes for machine .Run(). During package init "add" or any other post-init "run". 2m * Machine is either in StageAdd or StageRun state, and its value may determine the behavior of std.CurrentRealm() and std.PreviousRealmI(). --------- Co-authored-by: gfanton <8671905+gfanton@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When you are MsgAddPackage, nothing is run, but the machine does run for initialization during declarations and init() calls. In this stage of running, CurrentRealm() returns the package path even if you're initing a p package. Which is a little strange but it's a realm for a moment because it's mutating? :) And PreviousRealm() returns g1user, "" because the end user isn't a realm himself.
When calling main() or any other function after init it then runs in StageRun, and CurrentRealm() would be g1user and realm path "" while PreviousRealm() would panic, BUT, since MsgCall always crosses into a crossing function, in practice CurrentRealm() becomes the called external realm (e.g. gno.land/r/boards/boardsv1), and PreviousRealm() becomes g1user and "".
When MsgRun runs, during init CurrentRealm() is gno.land/r/g1user/run, but the addr is not hash derived from that path, but instead the g1user is extracted from it, while PreviousRealm() has the same g1user but the realm path is "" indicating the end user (who uses the temporary run-realm but discards it after).
gno/gnovm/stdlibs/std/native.go
Lines 109 to 131 in fcc6e10
2m