-
Notifications
You must be signed in to change notification settings - Fork 372
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
feat(gnovm): forbid importing realms in packages #3042
base: master
Are you sure you want to change the base?
feat(gnovm): forbid importing realms in packages #3042
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3042 +/- ##
==========================================
- Coverage 63.32% 63.32% -0.01%
==========================================
Files 548 548
Lines 78511 78528 +17
==========================================
+ Hits 49719 49724 +5
- Misses 25438 25451 +13
+ Partials 3354 3353 -1
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.
It might be a good idea to include additional tests, such as checking what happens when we publish a package or testing case. WDYT?
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.
logic LGTM, optimization comments since it's part of consensus
continue // can be other files like LICENSE, README or empty gno files | ||
} | ||
for _, imp := range astFile.Imports { | ||
// ensure the pkg is a realm by checking if the path contains /r/ and no other / character before it (i.e protect from gno.land/p/demo/r/) |
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.
maybe we should add a test for the case gno.land/p/demo/r/
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.
Co-authored-by: n0izn0iz <[email protected]>
Co-authored-by: n0izn0iz <[email protected]>
## 16. MsgRun -> run.main -> bar.A: PANIC | ||
! gnokey maketx run -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1 $WORK/run/barA.gno | ||
stderr 'invalid non-origin call' | ||
|
||
## 17. MsgRun -> run.main -> bar.B: PASS | ||
gnokey maketx run -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1 $WORK/run/barB.gno | ||
stdout 'OK!' |
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.
Why did these get removed?
Msgrun should be able to import packages.
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.
I remove it because it tested the flow: msgRun -> run.main -> package -> realm
But indeed, i should have keep the flow with just removing the link to the realm
fix here: 21f15fe
Hello @MikaelVallenet . Please merge master. This should fix the CI check errors for "unknown revision v0.1.1". |
…t/forbid-importing-realms
Co-authored-by: n0izn0iz <[email protected]>
…t/forbid-importing-realms
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.
we should probably add tests cases with
- non-gno file
- invalid gno file that will trigger a parser error
Also I feel this PR should not remove the MsgCall
tests since it does not change this behavior. Think we may add them back with a package that does not import a realm. But it's not very important
# | 11 | | through /p/demo/bar | bar.A() | user address | | ||
# | 12 | | | bar.B() | user address | | ||
# | 9 | MsgCall | wallet direct | std.PrevRealm() | user address | | ||
# | 10 | MsgRun | wallet direct | std.PrevRealm() | user address | |
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.
order and index do not match the actual tests below
i added test 6081a7b |
…t/forbid-importing-realms
what I meant is that the MsgCall tests that call into a package should probably be removed by the actual PR that will prevent we could keep them like the I'm not sure this is very important so if it's a pain nevermind the test summary tables and actual tests seems still off, for example, test 8 in assertorigincall.txtar is a MsgRun type but it's not marked as such in the summary |
Closes #3040
80% of the work comes from @harry-hov's PR #1393 (let's repay to Caesar what belongs to Caesar) 🚀
Notable additions:
.gno
files (LICENSE, README, ...) or empty filesContributors' checklist...
BREAKING CHANGE: xxx
message was included in the description