-
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
feat(sdk/vm): support return values from main in msgrun #1591
Conversation
Example of execution: $ cat sos.gno
package main
func main() int {
return 11
}
$ gnokey maketx run -broadcast -gas-wanted 1000000 -gas-fee 1ugnot gentest sos.gno
Enter password.
(11 int)
OK!
GAS WANTED: 1000000
GAS USED: 65914 |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #1591 +/- ##
==========================================
- Coverage 55.80% 55.79% -0.01%
==========================================
Files 436 436
Lines 66168 66169 +1
==========================================
- Hits 36922 36920 -2
- Misses 26356 26358 +2
- Partials 2890 2891 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Reporting what we discussed in our weekly today: @moul thinks that this PR is not an improvement, as he sees This has a few major issues, in my opinion:
Consequently, we convened that:
|
Something I wondered about what we could do with MsgRun. I saw that in the current implementation, the output that is returned to the user is the output of calls to the "Output", ie.
println
. I don't think we should support this OR endorse any usage ofprintln
as a stable function in production code; hence this PR.This PR adds support for adding return values to the
main()
function inMsgRun
. It substitutes the current way to get data back from aMsgRun
call --println
-- to using return values, as we do forMsgCall
. This creates an inconsistency with the "model" of inspiration forMsgRun
-- ie.gno run
-- but I think it is the right call.Let's discuss!