Skip to content
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

out of gas error is unclear (VM call panic {WritePerByte}) #2365

Closed
grepsuzette opened this issue Jun 17, 2024 · 2 comments
Closed

out of gas error is unclear (VM call panic {WritePerByte}) #2365

grepsuzette opened this issue Jun 17, 2024 · 2 comments

Comments

@grepsuzette
Copy link
Contributor

grepsuzette commented Jun 17, 2024

The same kind of bug as #1205 but with {WritePerByte} has been happening quite a lot, when adding packages with insufficient gas.

Data: internal error
Msg traces:
    0 /me/gno/tm2/pkg/crypto/keys/client/maketx.go:213 - deliver transaction failed: log:recovered: strings/strings.gno:11: {WritePerByte}
stack: see below
Call stack
stack:
goroutine 53 [running]:
runtime/debug.Stack()
        /usr/lib/go/src/runtime/debug/stack.go:24 +0x5e
github.com/gnolang/gno/tm2/pkg/sdk.(*BaseApp).runTx.func1()
        /me/gno/tm2/pkg/sdk/baseapp.go:749 +0x205
panic({0xf1e340?, 0xc005525a80?})
        /usr/lib/go/src/runtime/panic.go:770 +0x132
go/types.(*Checker).handleBailout(0xc0071f1c00, 0xc005317760)
        /usr/lib/go/src/go/types/check.go:367 +0x88
panic({0xf1e340?, 0xc005525a80?})
        /usr/lib/go/src/runtime/panic.go:770 +0x132
github.com/gnolang/gno/gnovm/pkg/gnolang.predefineNow.func1()
        /me/gno/gnovm/pkg/gnolang/preprocess.go:3070 +0x25c
panic({0xf6ba00?, 0xc005525a40?})
        /usr/lib/go/src/runtime/panic.go:770 +0x132
github.com/gnolang/gno/tm2/pkg/store/types.(*basicGasMeter).ConsumeGas(0x45bcfc?, 0x31?, {0x108d47d?
, 0x457969?})
        /me/gno/tm2/pkg/store/types/gas.go:97 +0x68
github.com/gnolang/gno/tm2/pkg/store/gas.(*Store).Set(0xc00479a060, {0xc0035b97c0, 0x31, 0x40}, {0xc
005556640, 0x12e, 0x12e})
        /me/gno/tm2/pkg/store/gas/store.go:45 +0x103
github.com/gnolang/gno/gnovm/pkg/gnolang.(*defaultStore).SetObject(0xc0004560a0, {0x13e25d8, 0xc0052
98280})
        /me/gno/gnovm/pkg/gnolang/store.go:323 +0x30f
github.com/gnolang/gno/gnovm/pkg/gnolang.(*Realm).saveObject(0x13c7528?, {0x13e4940, 0xc0004560a0}, 
{0x13e25d8, 0xc005298280})
        /me/gno/gnovm/pkg/gnolang/realm.go:747 +0x12b
github.com/gnolang/gno/gnovm/pkg/gnolang.(*Realm).saveUnsavedObjectRecursively(0xc0003c60e0, {0x13e4
940, 0xc0004560a0}, {0x13e25d8, 0xc005298280})
        /me/gno/gnovm/pkg/gnolang/realm.go:702 +0xf9
github.com/gnolang/gno/gnovm/pkg/gnolang.(*Realm).saveUnsavedObjectRecursively(0xc0003c60e0, {0x13e4
940, 0xc0004560a0}, {0x13e23c8, 0xc003d1ab00})
        /me/gno/gnovm/pkg/gnolang/realm.go:691 +0xc5
github.com/gnolang/gno/gnovm/pkg/gnolang.(*Realm).saveUnsavedObjectRecursively(0xc0003c60e0, {0x13e4
940, 0xc0004560a0}, {0x13e25d8, 0xc0052990e0})
        /me/gno/gnovm/pkg/gnolang/realm.go:691 +0xc5
github.com/gnolang/gno/gnovm/pkg/gnolang.(*Realm).saveUnsavedObjectRecursively(0xc0003c60e0, {0x13e4
940, 0xc0004560a0}, {0x13e24d0, 0xc0006a4750})
        /me/gno/gnovm/pkg/gnolang/realm.go:691 +0xc5
github.com/gnolang/gno/gnovm/pkg/gnolang.(*Realm).saveUnsavedObjectRecursively(0xc0003c60e0, {0x13e4
940, 0xc0004560a0}, {0x13e28f0, 0xc0070d1680})
        /me/gno/gnovm/pkg/gnolang/realm.go:691 +0xc5
github.com/gnolang/gno/gnovm/pkg/gnolang.(*Realm).saveUnsavedObjects(0xc0003c60e0, {0x13e4940, 0xc00
04560a0})
        /me/gno/gnovm/pkg/gnolang/realm.go:651 +0x96
github.com/gnolang/gno/gnovm/pkg/gnolang.(*Realm).FinalizeRealmTransaction(0xc0003c60e0, 0xe8?, {0x1
3e4940, 0xc0004560a0})
        /me/gno/gnovm/pkg/gnolang/realm.go:334 +0xb9
github.com/gnolang/gno/gnovm/pkg/gnolang.(*Machine).savePackageValuesAndTypes(0xc007f2d8c8)
        /me/gno/gnovm/pkg/gnolang/machine.go:662 +0x10f
github.com/gnolang/gno/gnovm/pkg/gnolang.(*Machine).runMemPackage(0xc007f2d8c8, 0xc007162d00, 0x1, 0
x0)
        /me/gno/gnovm/pkg/gnolang/machine.go:291 +0x246
github.com/gnolang/gno/gnovm/pkg/gnolang.(*Machine).RunMemPackage(...)
        /me/gno/gnovm/pkg/gnolang/machine.go:255
github.com/gnolang/gno/gno.land/pkg/sdk/vm.(*VMKeeper).initBuiltinPackagesAndTypes.func1({0xc002ca34
57, 0x7}, {0x13e4940, 0xc0004560a0})
        /me/gno/gno.land/pkg/sdk/vm/builtins.go:40 +0x245
github.com/gnolang/gno/gnovm/pkg/gnolang.(*defaultStore).GetPackage(0xc0004560a0, {0xc002ca3457, 0x7
}, 0x77?)
        /me/gno/gnovm/pkg/gnolang/store.go:170 +0x125
github.com/gnolang/gno/gnovm/pkg/gnolang.tryPredefine({0x13e4940, 0xc0004560a0}, {0x13e17a0, 0xc004f
42908}, {0x13d7548, 0xc004a2b480})
        /me/gno/gnovm/pkg/gnolang/preprocess.go:3226 +0x163
github.com/gnolang/gno/gnovm/pkg/gnolang.predefineNow2({0x13e4940, 0xc0004560a0}, {0x13e17a0, 0xc004
f42908}, {0x13d7548, 0xc004a2b480}, 0xc005316408)
        /me/gno/gnovm/pkg/gnolang/preprocess.go:3090 +0x130
github.com/gnolang/gno/gnovm/pkg/gnolang.predefineNow({0x13e4940, 0xc0004560a0}, {0x13e17a0, 0xc004f
42908}, {0x13d7548, 0xc004a2b480})
        /me/gno/gnovm/pkg/gnolang/preprocess.go:3075 +0x153
github.com/gnolang/gno/gnovm/pkg/gnolang.PredefineFileSet({0x13e4940, 0xc0004560a0}, 0xc004f42c08, 0
xc004b82330)
        /me/gno/gnovm/pkg/gnolang/preprocess.go:43 +0x6f5
github.com/gnolang/gno/gnovm/pkg/gnolang.(*Machine).runFiles(0xc0002f8008, {0xc004f2cd00, 0x5, 0x8})
        /me/gno/gnovm/pkg/gnolang/machine.go:530 +0x275
github.com/gnolang/gno/gnovm/pkg/gnolang.(*Machine).RunFiles(...)
        /me/gno/gnovm/pkg/gnolang/machine.go:496
github.com/gnolang/gno/gnovm/pkg/gnolang.(*Machine).runMemPackage(0xc0002f8008, 0xc0047fc480, 0x1, 0
x0)
        /me/gno/gnovm/pkg/gnolang/machine.go:287 +0x22d
github.com/gnolang/gno/gnovm/pkg/gnolang.(*Machine).RunMemPackage(...)
        /me/gno/gnovm/pkg/gnolang/machine.go:255
github.com/gnolang/gno/gno.land/pkg/sdk/vm.(*VMKeeper).initBuiltinPackagesAndTypes.func1({0xc002c85c
81, 0x7}, {0x13e4940, 0xc0004560a0})
        /me/gno/gno.land/pkg/sdk/vm/builtins.go:40 +0x245
github.com/gnolang/gno/gnovm/pkg/gnolang.(*defaultStore).GetPackage(0xc0004560a0, {0xc002c85c81, 0x7
}, 0x10?)
        /me/gno/gnovm/pkg/gnolang/store.go:170 +0x125
github.com/gnolang/gno/gnovm/pkg/gnolang.(*defaultStore).getMemPackage(0xc0004560a0, {0xc002c85c81, 
0x7}, 0x0)
        /me/gno/gnovm/pkg/gnolang/store.go:558 +0xbd
github.com/gnolang/gno/gnovm/pkg/gnolang.(*defaultStore).GetMemPackage(0xc007fc0c48?, {0xc002c85c81?
, 0xc002c85c81?})
        /me/gno/gnovm/pkg/gnolang/store.go:545 +0x1a
github.com/gnolang/gno/gnovm/pkg/gnolang.(*gnoImporter).ImportFrom(0xc00452f740, {0xc002c85c81, 0x7}
, {0xc007fc0cc8?, 0x22acd8?}, 0x7?)
        /me/gno/gnovm/pkg/gnolang/go2gno.go:540 +0x64
go/types.(*Checker).importPackage(0xc0071f1c00, {0x13c3a00, 0xc00452faa0}, {0xc002c85c81, 0x7}, {0x1
3b6c68, 0x1})
        /usr/lib/go/src/go/types/resolver.go:158 +0x53a
go/types.(*Checker).collectObjects.func1({0x13c3b80?, 0xc003f0a960})
        /usr/lib/go/src/go/types/resolver.go:267 +0x125
go/types.(*Checker).walkDecl(0xc0071f1c00, {0x13c9fa0?, 0xc0046f4940}, 0xc005317658)
        /usr/lib/go/src/go/types/decl.go:412 +0x2e7
go/types.(*Checker).walkDecls(...)
        /usr/lib/go/src/go/types/decl.go:399
go/types.(*Checker).collectObjects(0xc0071f1c00)
        /usr/lib/go/src/go/types/resolver.go:254 +0xe2f
go/types.(*Checker).checkFiles(0xc0071f1c00, {0xc002e5b7c0, 0x6, 0x9})
        /usr/lib/go/src/go/types/check.go:405 +0x17c
go/types.(*Checker).Files(...)
        /usr/lib/go/src/go/types/check.go:372
go/types.(*Config).Check(0xc00479a180, {0xc00038ff68?, 0xa?}, 0xc0046f4600, {0xc002e5b7c0, 0x6, 0x9}
, 0x0)
        /usr/lib/go/src/go/types/api.go:458 +0x79
github.com/gnolang/gno/gnovm/pkg/gnolang.(*gnoImporter).parseCheckMemPackage(0xc00452f740, 0xc0046f4
500)
        /me/gno/gnovm/pkg/gnolang/go2gno.go:574 +0x366
github.com/gnolang/gno/gnovm/pkg/gnolang.TypeCheckMemPackage(0xc0046f4500, {0x762c507f8570, 0xc00045
60a0})
        /me/gno/gnovm/pkg/gnolang/go2gno.go:505 +0x14c
github.com/gnolang/gno/gno.land/pkg/sdk/vm.(*VMKeeper).AddPackage(_, {{0x13cba08, 0xc003eb7b00}, 0x2
, {0x13cac60, 0xc003a46a50}, {0x13cbd50, 0xc0004694a0}, {0xc000e5fa7b, 0x3}, ...}, ...)
        /me/gno/gno.land/pkg/sdk/vm/keeper.go:166 +0x545
github.com/gnolang/gno/gno.land/pkg/sdk/vm.vmHandler.handleMsgAddPackage({_}, {{0x13cba08, 0xc003eb7
b00}, 0x2, {0x13cac60, 0xc003a46a50}, {0x13cbd50, 0xc0004694a0}, {0xc000e5fa7b, 0x3}, ...}, ...)
        /me/gno/gno.land/pkg/sdk/vm/handler.go:44 +0xb8
github.com/gnolang/gno/gno.land/pkg/sdk/vm.vmHandler.Process({_}, {{0x13cba08, 0xc003eb7b00}, 0x2, {
0x13cac60, 0xc003a46a50}, {0x13cbd50, 0xc0004694a0}, {0xc000e5fa7b, 0x3}, ...}, ...)
        /me/gno/gno.land/pkg/sdk/vm/handler.go:31 +0x358
github.com/gnolang/gno/tm2/pkg/sdk.(*BaseApp).runMsgs(_, {{0x13cba08, 0xc003eb7b00}, 0x2, {0x13cac60
, 0xc003a46a50}, {0x13cbd50, 0xc0004694a0}, {0xc000e5fa7b, 0x3}, ...}, ...)
        /me/gno/tm2/pkg/sdk/baseapp.go:650 +0x2ed
github.com/gnolang/gno/tm2/pkg/sdk.(*BaseApp).runTx(0xc000422700, 0x2, {0xc0046e4000, 0x1bc2, _}, {{
0xc0038eb990, 0x1, 0x1}, {0x895440, {{0xc002c84dc2, ...}, ...}}, ...})
        /me/gno/tm2/pkg/sdk/baseapp.go:829 +0xae5
github.com/gnolang/gno/tm2/pkg/sdk.(*BaseApp).DeliverTx(0xc000422700, {{}, {0xc0046e4000?, 0x0?, 0x0
?}})
        /me/gno/tm2/pkg/sdk/baseapp.go:585 +0x15d
github.com/gnolang/gno/tm2/pkg/bft/abci/client.(*localClient).DeliverTxAsync(0xc000415320, {{}, {0xc
0046e4000, 0x1bc2, 0x1bc2}})
        /me/gno/tm2/pkg/bft/abci/client/local_client.go:82 +0xeb
github.com/gnolang/gno/tm2/pkg/bft/appconn.(*consensus).DeliverTxAsync(0x0?, {{}, {0xc0046e4000?, 0x
0?, 0x0?}})
        /me/gno/tm2/pkg/bft/appconn/app_conn.go:74 +0x23
github.com/gnolang/gno/tm2/pkg/bft/state.execBlockOnProxyApp(0xc00005a260, {0x13d1bc0, 0xc000412d50}
, 0xc004bbdd40, {0x13d7458, 0xc0003bdd20})
        /me/gno/tm2/pkg/bft/state/execution.go:265 +0x557
github.com/gnolang/gno/tm2/pkg/bft/state.(*BlockExecutor).ApplyBlock(_, {{0x108bc64, 0xb}, {0x108bc6
4, 0xb}, {0x0, 0x0}, {0xc00031cacb, 0x3}, 0x49, ...}, ...)
        /me/gno/tm2/pkg/bft/state/execution.go:102 +0x17a
github.com/gnolang/gno/tm2/pkg/bft/consensus.(*ConsensusState).finalizeCommit(0xc0000fe608, 0x4a)
        /me/gno/tm2/pkg/bft/consensus/state.go:1370 +0x88c
github.com/gnolang/gno/tm2/pkg/bft/consensus.(*ConsensusState).tryFinalizeCommit(0xc0000fe608, 0x4a)
        /me/gno/tm2/pkg/bft/consensus/state.go:1294 +0x190
github.com/gnolang/gno/tm2/pkg/bft/consensus.(*ConsensusState).enterCommit.func1()
        /me/gno/tm2/pkg/bft/consensus/state.go:1240 +0x88
github.com/gnolang/gno/tm2/pkg/bft/consensus.(*ConsensusState).enterCommit(0xc0000fe608, 0x4a, 0x0)
        /me/gno/tm2/pkg/bft/consensus/state.go:1271 +0xa25
github.com/gnolang/gno/tm2/pkg/bft/consensus.(*ConsensusState).addVote(0xc0000fe608, 0xc0062a25a0, {
0x0, 0x0})
        /me/gno/tm2/pkg/bft/consensus/state.go:1684 +0x785
github.com/gnolang/gno/tm2/pkg/bft/consensus.(*ConsensusState).tryAddVote(0xc0000fe608, 0x417dba?, {
0x0?, 0x762c503ec268?})
        /me/gno/tm2/pkg/bft/consensus/state.go:1518 +0x2f
github.com/gnolang/gno/tm2/pkg/bft/consensus.(*ConsensusState).handleMsg(0xc0000fe608, {{0x13c3600, 
0xc00041f320}, {0x0, 0x0}})
        /me/gno/tm2/pkg/bft/consensus/state.go:696 +0xf8
github.com/gnolang/gno/tm2/pkg/bft/consensus.(*ConsensusState).receiveRoutine(0xc0000fe608, 0x0)
        /me/gno/tm2/pkg/bft/consensus/state.go:655 +0x452
created by github.com/gnolang/gno/tm2/pkg/bft/consensus.(*ConsensusState).OnStart in goroutine 1
        /me/gno/tm2/pkg/bft/consensus/state.go:349 +0x4ef

Sometimes adding the same package and with the same gas settings I simply get

Data: std.OutOfGasError{abciError:std.abciError{}}
Msg Traces:
    0  /me/gno/tm2/pkg/std/errors.go:106 - out of gas in location: txSize; gasWanted: 9000, gasUsed: 71110
Stack Trace:
    0  /me/gno/tm2/pkg/errors/errors.go:20
    1  /me/gno/tm2/pkg/std/errors.go:106
    2  /me/gno/tm2/pkg/sdk/auth/ante.go:87
    3  /usr/lib/go/src/runtime/panic.go:770
    4  /me/gno/tm2/pkg/store/types/gas.go:97
    5  /me/gno/tm2/pkg/sdk/auth/ante.go:108
    6  /me/gno/gno.land/pkg/gnoland/app.go:104
    7  /me/gno/tm2/pkg/sdk/baseapp.go:806
    8  /me/gno/tm2/pkg/sdk/baseapp.go:569
    9  /me/gno/tm2/pkg/bft/abci/client/local_client.go:90
   10  /me/gno/tm2/pkg/bft/appconn/app_conn.go:115
   11  /me/gno/tm2/pkg/bft/mempool/clist_mempool.go:286
   12  /me/gno/tm2/pkg/bft/mempool/clist_mempool.go:214
   13  /me/gno/tm2/pkg/bft/rpc/core/mempool.go:230
   14  /usr/lib/go/src/reflect/value.go:596
   15  /usr/lib/go/src/reflect/value.go:380
   16  /me/gno/tm2/pkg/bft/rpc/lib/server/handlers.go:185
   17  /me/gno/tm2/pkg/bft/rpc/lib/server/handlers.go:209
   18  /usr/lib/go/src/net/http/server.go:2166
   19  /usr/lib/go/src/net/http/server.go:2683
   20  /me/code/go/pkg/mod/github.com/rs/[email protected]/cors.go:281
   21  /usr/lib/go/src/net/http/server.go:2166
   22  /me/gno/tm2/pkg/bft/rpc/lib/server/http_server.go:216
   23  /me/gno/tm2/pkg/bft/rpc/lib/server/http_server.go:189
   24  /usr/lib/go/src/net/http/server.go:2166
   25  /usr/lib/go/src/net/http/server.go:3137
   26  /usr/lib/go/src/net/http/server.go:2039
   27  /usr/lib/go/src/runtime/asm_amd64.s:1695

Steps to reproduce

  • gnodev -minimal
gnokey maketx addpkg -pkgpath "gno.land/p/demo/mux" \
                -pkgdir "examples/gno.land/p/demo/mux" \
                -deposit 10ugnot \
                -gas-fee 10ugnot \
                -gas-wanted 9000000 \
                -broadcast=true \
                -chainid "dev" \
                -remote "127.0.0.1:26657" \
                bob 

Edit: Note from commit f2844 onwards (#2504), the above method can't seem to reproduce this bug.

@ltzmaxwell
Copy link
Contributor

had this before, #1205, seems it's not fixed.

@grepsuzette
Copy link
Contributor Author

grepsuzette commented Jul 16, 2024

Can't reproduce anymore, a git bisect pointed out it's not reproducible since commit f2844 (#2504).
The above method can't reproduce this bug. Not saying it's fixed but will close for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

2 participants