Open grepsuzette opened 1 week ago
Attention: Patch coverage is 0%
with 2 lines
in your changes missing coverage. Please review.
Project coverage is 54.63%. Comparing base (
e7e47d2
) to head (edc0f3b
).
Files | Patch % | Lines |
---|---|---|
gnovm/pkg/gnolang/preprocess.go | 0.00% | 1 Missing and 1 partial :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
just curious, is it only happening with predefineNow()
?
just curious, is it only happening with predefineNow()?
I am not sure, that's why I will try to add many packages.
The following should fix #2365 when adding a package.
Problem
2365 (and before it, #1205) described a way where adding packages with insufficient gas very often lead to hard to read errors such as:
Diagnostic
Using the call stack in #2365, the following seems to happen.
While preprocessing some file, a panic with
OutOfGasException
occurs: https://github.com/gnolang/gno/blob/e7e47d2589ceece37b0502d0df8d54ded582d501/tm2/pkg/store/types/gas.go#L96-L98Upper level recovers and repanics with error: https://github.com/gnolang/gno/blob/e7e47d2589ceece37b0502d0df8d54ded582d501/gnovm/pkg/gnolang/preprocess.go#L3057-L3070
Upper level treats it as a banal error (falling in
default:
rather thanOutOfGasException
, this snippet is longer, make sure to scroll down): https://github.com/gnolang/gno/blob/e7e47d2589ceece37b0502d0df8d54ded582d501/tm2/pkg/sdk/baseapp.go#L733-L752Proposed fix
Just add a couple of lines in gno/gnovm/pkg/gnolang/preprocess.go:
After recompiling and testing with the modus operandi described in #2365, the error message is now:
Repeatedly calling with fresh
gnodev -minimal
each time and adding package now consistently shows this message.Discussion
There still remains a question about the "NOTE: gotuna/gorilla expects error exceptions".
Think it has to do with gnoweb ability to print failures, e.g.
gnoweb
usesfunc makeRequest(log *slog.Logger, cfg *Config, qpath string, data []byte) (res *abci.ResponseQuery, err error)
.However
BaseApp.runTx
will turn the OutOfGasException to a niceABCIError(std.ErrOutOfGas())
. So, in theory, it should do.I will do some more test tonight adding many packages from
/p/demo
.