Closed schollz closed 1 year ago
It's probably an (unclear) gas issue, i.e., because your contract is more significant than usual.
Can you try increasing the -gas-wanted
value?
Thanks for the quick reply @moul! No rush on these questions, don't mean to pull you away from the weekend.
But, yeah, I tried to increase 5x and still same error:
cat password | gnokey maketx addpkg --pkgpath "gno.land/p/demo/audio/bytebeat" --pkgdir "examples/gno.land/p/demo/audio/bytebeat" --deposit 100000000ugnot --gas-fee 1000000ugnot --gas-wanted 10000000 --broadcast --chainid dev --remote localhost:26657 --insecure-password-stdin=true zkey
Enter password.
internal error
If I go higher in gas-wanted
it gives invalid gas wanted
.
I'll investigate further into the issue with your fourth command.
Meanwhile, I recommend cherry-picking this PR https://github.com/gnolang/gno/pull/806, which simplifies your workflow by enabling you to read errors directly from gnokey
instead of the gnoland
logs.
Ah brilliant, will cherry pick that, thanks.
@moul - I've simplified the file needed to get this error (here's my branch: https://github.com/gnolang/gno/compare/master...schollz:gno:writebyte).
All that is needed to get the WritePerByte
error is having bufio.NewWriter
:
func WriteByte() (data string) {
var b bytes.Buffer
w := bufio.NewWriter(&b)
_ = w
return
}
If I remove the bufio.NewWriter
(along with bufio
package), then no error occurs.
Here are the errors with the cherry-picked PR to print more errors:
$ gnokey maketx addpkg --pkgpath "gno.land/p/demo/writebyte" --pkgdir "examples/gno.land/p/demo/writebyte" --deposit 100000000ugnot --gas-fee 1000000ugnot --gas-wanted 2000000 --broadcast --chainid dev --remote localhost:26657 zzkey1 Enter password. --= Error =-- Data: internal error Msg Traces: 0 /home/zns/Documents/gno-main/tm2/pkg/crypto/keys/client/addpkg.go:211 - deliver transaction failed: log:recovered: gno.land/p/demo/writebyte/writebyte.gno:1: {WritePerByte} stack: goroutine 40 [running]: runtime/debug.Stack() /usr/local/go/src/runtime/debug/stack.go:24 +0x65 github.com/gnolang/gno/tm2/pkg/sdk.(*BaseApp).runTx.func1() /home/zns/Documents/gno-main/tm2/pkg/sdk/baseapp.go:743 +0x2cd panic({0xca1b20, 0xc006f63580}) /usr/local/go/src/runtime/panic.go:884 +0x213 github.com/gnolang/gno/gnovm/pkg/gnolang.predefineNow.func1() /home/zns/Documents/gno-main/gnovm/pkg/gnolang/preprocess.go:2854 +0x2d2 panic({0xc77740, 0xc00a0e0af0}) /usr/local/go/src/runtime/panic.go:884 +0x213 github.com/gnolang/gno/tm2/pkg/store/types.(*basicGasMeter).ConsumeGas(0x454d7e?, 0x9?, {0xd37e01?, 0x0?}) /home/zns/Documents/gno-main/tm2/pkg/store/types/gas.go:97 +0x78 github.com/gnolang/gno/tm2/pkg/store/gas.(*Store).Set(0xc00605d7a0, {0xc001888a00, 0x9, 0x10}, {0xc00525e000, 0xcfc1, 0xe000}) /home/zns/Documents/gno-main/tm2/pkg/store/gas/store.go:43 +0x99 github.com/gnolang/gno/gnovm/pkg/gnolang.(*defaultStore).AddMemPackage(0xc00025e360, 0xc00aa3ea40) /home/zns/Documents/gno-main/gnovm/pkg/gnolang/store.go:531 +0x1a2 github.com/gnolang/gno/gnovm/pkg/gnolang.(*Machine).RunMemPackage(0xc005484b40, 0xc00aa3ea40, 0x1) /home/zns/Documents/gno-main/gnovm/pkg/gnolang/machine.go:240 +0x255 github.com/gnolang/gno/tm2/pkg/sdk/vm.(*VMKeeper).initBuiltinPackagesAndTypes.func1({0xc006685951, 0x5}) /home/zns/Documents/gno-main/tm2/pkg/sdk/vm/builtins.go:35 +0x20c github.com/gnolang/gno/gnovm/pkg/gnolang.(*defaultStore).GetPackage(0xc00025e360, {0xc006685951, 0x5}, 0xd8?) /home/zns/Documents/gno-main/gnovm/pkg/gnolang/store.go:162 +0x1e2 github.com/gnolang/gno/gnovm/pkg/gnolang.tryPredefine({0xfa6498, 0xc00025e360}, {0xfa3ef8, 0xc003dc4580}, {0xf9e710, 0xc00607b380?}) /home/zns/Documents/gno-main/gnovm/pkg/gnolang/preprocess.go:2967 +0x15f github.com/gnolang/gno/gnovm/pkg/gnolang.predefineNow2({0xfa6498, 0xc00025e360}, {0xfa3ef8?, 0xc003dc4580}, {0xf9e710, 0xc00607b380?}, 0x423165?) /home/zns/Documents/gno-main/gnovm/pkg/gnolang/preprocess.go:2870 +0x125 github.com/gnolang/gno/gnovm/pkg/gnolang.predefineNow({0xfa6498, 0xc00025e360}, {0xfa3ef8, 0xc003dc4580}, {0xf9e710, 0xc00607b380}) /home/zns/Documents/gno-main/gnovm/pkg/gnolang/preprocess.go:2859 +0x149 github.com/gnolang/gno/gnovm/pkg/gnolang.PredefineFileSet({0xfa6498, 0xc00025e360}, 0xc003dc5340, 0xc001c47ed8) /home/zns/Documents/gno-main/gnovm/pkg/gnolang/preprocess.go:38 +0x6c5 github.com/gnolang/gno/gnovm/pkg/gnolang.(*Machine).runFiles(0xc005484360, {0xc008e70988, 0x1, 0x1}) /home/zns/Documents/gno-main/gnovm/pkg/gnolang/machine.go:411 +0x291 github.com/gnolang/gno/gnovm/pkg/gnolang.(*Machine).RunFiles(...) /home/zns/Documents/gno-main/gnovm/pkg/gnolang/machine.go:377 github.com/gnolang/gno/gnovm/pkg/gnolang.(*Machine).RunMemPackage(0xc005484360, 0xc00a427980, 0x1) /home/zns/Documents/gno-main/gnovm/pkg/gnolang/machine.go:234 +0x216 github.com/gnolang/gno/tm2/pkg/sdk/vm.(*VMKeeper).AddPackage(_, {{0xf95b08, 0xc004245050}, 0x2, {0xf95700, 0xc0046aee10}, {0xf95c90, 0xc00163f340}, {0xc00153499d, 0x3}, ...}, ...) /home/zns/Documents/gno-main/tm2/pkg/sdk/vm/keeper.go:180 +0x88a github.com/gnolang/gno/tm2/pkg/sdk/vm.vmHandler.handleMsgAddPackage({_}, {{0xf95b08, 0xc004245050}, 0x2, {0xf95700, 0xc0046aee10}, {0xf95c90, 0xc00163f340}, {0xc00153499d, 0x3}, ...}, ...) /home/zns/Documents/gno-main/tm2/pkg/sdk/vm/handler.go:46 +0x2a5 github.com/gnolang/gno/tm2/pkg/sdk/vm.vmHandler.Process({_}, {{0xf95b08, 0xc004245050}, 0x2, {0xf95700, 0xc0046aee10}, {0xf95c90, 0xc00163f340}, {0xc00153499d, 0x3}, ...}, ...) /home/zns/Documents/gno-main/tm2/pkg/sdk/vm/handler.go:27 +0x205 github.com/gnolang/gno/tm2/pkg/sdk.(*BaseApp).runMsgs(_, {{0xf95b08, 0xc004245050}, 0x2, {0xf95700, 0xc0046aee10}, {0xf95c90, 0xc00163f340}, {0xc00153499d, 0x3}, ...}, ...) /home/zns/Documents/gno-main/tm2/pkg/sdk/baseapp.go:644 +0x2ed github.com/gnolang/gno/tm2/pkg/sdk.(*BaseApp).runTx(0xc000236100, 0x2, {0xc0060d7400, 0x268, _}, {{0xc0046ae080, 0x1, 0x1}, {0x1e8480, {{0xc00689dbf7, ...}, ...}}, ...}) /home/zns/Documents/gno-main/tm2/pkg/sdk/baseapp.go:823 +0x965 github.com/gnolang/gno/tm2/pkg/sdk.(*BaseApp).DeliverTx(0x0?, {{}, {0xc0060d7400?, 0x0?, 0x0?}}) /home/zns/Documents/gno-main/tm2/pkg/sdk/baseapp.go:580 +0x17d github.com/gnolang/gno/tm2/pkg/bft/abci/client.(*localClient).DeliverTxAsync(0xc0005710e0, {{}, {0xc0060d7400, 0x268, 0x268}}) /home/zns/Documents/gno-main/tm2/pkg/bft/abci/client/local_client.go:82 +0xfc github.com/gnolang/gno/tm2/pkg/bft/proxy.(*appConnConsensus).DeliverTxAsync(0x0?, {{}, {0xc0060d7400?, 0x0?, 0x0?}}) /home/zns/Documents/gno-main/tm2/pkg/bft/proxy/app_conn.go:73 +0x26 github.com/gnolang/gno/tm2/pkg/bft/state.execBlockOnProxyApp({0xf96968, 0xc0095fa090}, {0xf99030, 0xc001938690}, 0xc00563ad00, {0xf9e8f0, 0xc0001a4428}) /home/zns/Documents/gno-main/tm2/pkg/bft/state/execution.go:253 +0x5aa github.com/gnolang/gno/tm2/pkg/bft/state.(*BlockExecutor).ApplyBlock(_, {{0xd3785c, 0xb}, {0xd3785c, 0xb}, {0x0, 0x0}, {0xc008d6d47d, 0x3}, 0x12, ...}, ...) /home/zns/Documents/gno-main/tm2/pkg/bft/state/execution.go:102 +0x115 github.com/gnolang/gno/tm2/pkg/bft/consensus.(*ConsensusState).finalizeCommit(0xc0024db800, 0x13) /home/zns/Documents/gno-main/tm2/pkg/bft/consensus/state.go:1347 +0x97e github.com/gnolang/gno/tm2/pkg/bft/consensus.(*ConsensusState).tryFinalizeCommit(0xc0024db800, 0x13) /home/zns/Documents/gno-main/tm2/pkg/bft/consensus/state.go:1275 +0x313 github.com/gnolang/gno/tm2/pkg/bft/consensus.(*ConsensusState).enterCommit.func1() /home/zns/Documents/gno-main/tm2/pkg/bft/consensus/state.go:1221 +0x97 github.com/gnolang/gno/tm2/pkg/bft/consensus.(*ConsensusState).enterCommit(0xc0024db800, 0x13, 0x0) /home/zns/Documents/gno-main/tm2/pkg/bft/consensus/state.go:1252 +0xb03 github.com/gnolang/gno/tm2/pkg/bft/consensus.(*ConsensusState).addVote(0xc0024db800, 0xc00681d040, {0x0, 0x0}) /home/zns/Documents/gno-main/tm2/pkg/bft/consensus/state.go:1637 +0x913 github.com/gnolang/gno/tm2/pkg/bft/consensus.(*ConsensusState).tryAddVote(0xc0024db800, 0xf?, {0x0?, 0x0?}) /home/zns/Documents/gno-main/tm2/pkg/bft/consensus/state.go:1483 +0x27 github.com/gnolang/gno/tm2/pkg/bft/consensus.(*ConsensusState).handleMsg(0xc0024db800, {{0xf8f2c0, 0xc008e70470}, {0x0, 0x0}}) /home/zns/Documents/gno-main/tm2/pkg/bft/consensus/state.go:691 +0x318 github.com/gnolang/gno/tm2/pkg/bft/consensus.(*ConsensusState).receiveRoutine(0xc0024db800, 0x0) /home/zns/Documents/gno-main/tm2/pkg/bft/consensus/state.go:650 +0x42c created by github.com/gnolang/gno/tm2/pkg/bft/consensus.(*ConsensusState).OnStart /home/zns/Documents/gno-main/tm2/pkg/bft/consensus/state.go:344 +0x4af --= /Error =--
I am going to dig in a little bit to see if I can figure out why bufio
is a problem, but please let me know if anyone has any hints.
Edit: the error is reproducible in the simpler code:
package writebyte
import (
"bufio"
)
func WriteByte() (data string) {
var w bufio.Writer
_ = w
return
}
Edit2: This particular WritePerByte
error does go away if the gas is increased. So this issue is solved by increasing --gas-wanted
to 5000000
. However, the original problem (adding bytebeat) does not work due to a new error that occurs after increasing the gas:
$ gnokey maketx addpkg --pkgpath "gno.land/p/demo/audio/bytebeat" --pkgdir "examples/gno.land/p/demo/audio/bytebeat" --deposit 100000000ugnot --gas-fee 1000000ugnot --gas-wanted 5000000 --broadcast --chainid dev --remote localhost:26657 --insecure-password-stdin=true zzkey1 ... .level 0 .msg Invalid tx [error internal error log recovered: gno.land/p/demo/audio/bytebeat/bytebeat.gno:1: should not happen stack: goroutine 58 [running]: runtime/debug.Stack() /usr/local/go/src/runtime/debug/stack.go:24 +0x65 github.com/gnolang/gno/tm2/pkg/sdk.(*BaseApp).runTx.func1() /home/zns/Documents/gno-main/tm2/pkg/sdk/baseapp.go:743 +0x2cd panic({0xca1b20, 0xc0038e0a80}) /usr/local/go/src/runtime/panic.go:884 +0x213 github.com/gnolang/gno/gnovm/pkg/gnolang.predefineNow.func1() /home/zns/Documents/gno-main/gnovm/pkg/gnolang/preprocess.go:2854 +0x2d2 panic({0xc22a60, 0xf8b8d0}) /usr/local/go/src/runtime/panic.go:884 +0x213 github.com/gnolang/gno/gnovm/pkg/gnolang.(*defaultStore).SetCacheType(0xc0001e6360, {0xf975b0, 0xc0009aca20}) /home/zns/Documents/gno-main/gnovm/pkg/gnolang/store.go:412 +0xed github.com/gnolang/gno/gnovm/pkg/gnolang.(*defaultStore).GetPackage(0xc0001e6360, {0xc0037535b1, 0x5}, 0xd8?) /home/zns/Documents/gno-main/gnovm/pkg/gnolang/store.go:193 +0x825 github.com/gnolang/gno/gnovm/pkg/gnolang.tryPredefine({0xfa64d8, 0xc0001e6360}, {0xfa3f38, 0xc00153c2c0}, {0xf9e750, 0xc00cce4480?}) /home/zns/Documents/gno-main/gnovm/pkg/gnolang/preprocess.go:2967 +0x15f github.com/gnolang/gno/gnovm/pkg/gnolang.predefineNow2({0xfa64d8, 0xc0001e6360}, {0xfa3f38?, 0xc00153c2c0}, {0xf9e750, 0xc00cce4480?}, 0x4508b2?) /home/zns/Documents/gno-main/gnovm/pkg/gnolang/preprocess.go:2870 +0x125 github.com/gnolang/gno/gnovm/pkg/gnolang.predefineNow({0xfa64d8, 0xc0001e6360}, {0xfa3f38, 0xc00153c2c0}, {0xf9e750, 0xc00cce4480}) /home/zns/Documents/gno-main/gnovm/pkg/gnolang/preprocess.go:2859 +0x149 github.com/gnolang/gno/gnovm/pkg/gnolang.PredefineFileSet({0xfa64d8, 0xc0001e6360}, 0xc00153d600, 0xc00a7249a8) /home/zns/Documents/gno-main/gnovm/pkg/gnolang/preprocess.go:38 +0x6c5 github.com/gnolang/gno/gnovm/pkg/gnolang.(*Machine).runFiles(0xc0024ab200, {0xc004bb8ea8, 0x1, 0x1}) /home/zns/Documents/gno-main/gnovm/pkg/gnolang/machine.go:411 +0x291 github.com/gnolang/gno/gnovm/pkg/gnolang.(*Machine).RunFiles(...) /home/zns/Documents/gno-main/gnovm/pkg/gnolang/machine.go:377 github.com/gnolang/gno/gnovm/pkg/gnolang.(*Machine).RunMemPackage(0xc0024ab200, 0xc00baea280, 0x1) /home/zns/Documents/gno-main/gnovm/pkg/gnolang/machine.go:234 +0x216 github.com/gnolang/gno/tm2/pkg/sdk/vm.(*VMKeeper).AddPackage(_, {{0xf95b48, 0xc00b643260}, 0x2, {0xf95740, 0xc00888efa0}, {0xf95cd0, 0xc00653f4a0}, {0xc00bb501fd, 0x3}, ...}, ...) /home/zns/Documents/gno-main/tm2/pkg/sdk/vm/keeper.go:180 +0x88a github.com/gnolang/gno/tm2/pkg/sdk/vm.vmHandler.handleMsgAddPackage({_}, {{0xf95b48, 0xc00b643260}, 0x2, {0xf95740, 0xc00888efa0}, {0xf95cd0, 0xc00653f4a0}, {0xc00bb501fd, 0x3}, ...}, ...) /home/zns/Documents/gno-main/tm2/pkg/sdk/vm/handler.go:46 +0x2a5 github.com/gnolang/gno/tm2/pkg/sdk/vm.vmHandler.Process({_}, {{0xf95b48, 0xc00b643260}, 0x2, {0xf95740, 0xc00888efa0}, {0xf95cd0, 0xc00653f4a0}, {0xc00bb501fd, 0x3}, ...}, ...) /home/zns/Documents/gno-main/tm2/pkg/sdk/vm/handler.go:27 +0x205 github.com/gnolang/gno/tm2/pkg/sdk.(*BaseApp).runMsgs(_, {{0xf95b48, 0xc00b643260}, 0x2, {0xf95740, 0xc00888efa0}, {0xf95cd0, 0xc00653f4a0}, {0xc00bb501fd, 0x3}, ...}, ...) /home/zns/Documents/gno-main/tm2/pkg/sdk/baseapp.go:644 +0x2ed github.com/gnolang/gno/tm2/pkg/sdk.(*BaseApp).runTx(0xc0001be100, 0x2, {0xc001634000, 0x9cb, _}, {{0xc00888e260, 0x1, 0x1}, {0x4c4b40, {{0xc0082f79b7, ...}, ...}}, ...}) /home/zns/Documents/gno-main/tm2/pkg/sdk/baseapp.go:823 +0x965 github.com/gnolang/gno/tm2/pkg/sdk.(*BaseApp).DeliverTx(0x0?, {{}, {0xc001634000?, 0x0?, 0x0?}}) /home/zns/Documents/gno-main/tm2/pkg/sdk/baseapp.go:580 +0x17d github.com/gnolang/gno/tm2/pkg/bft/abci/client.(*localClient).DeliverTxAsync(0xc0004d3ec0, {{}, {0xc001634000, 0x9cb, 0x9cb}}) /home/zns/Documents/gno-main/tm2/pkg/bft/abci/client/local_client.go:82 +0xfc github.com/gnolang/gno/tm2/pkg/bft/proxy.(*appConnConsensus).DeliverTxAsync(0x0?, {{}, {0xc001634000?, 0x0?, 0x0?}}) /home/zns/Documents/gno-main/tm2/pkg/bft/proxy/app_conn.go:73 +0x26 github.com/gnolang/gno/tm2/pkg/bft/state.execBlockOnProxyApp({0xf969a8, 0xc00825e3f0}, {0xf99070, 0xc00195a640}, 0xc001856b60, {0xf9e930, 0xc00012a030}) /home/zns/Documents/gno-main/tm2/pkg/bft/state/execution.go:253 +0x5aa github.com/gnolang/gno/tm2/pkg/bft/state.(*BlockExecutor).ApplyBlock(_, {{0xd37873, 0xb}, {0xd37873, 0xb}, {0x0, 0x0}, {0xc0057b4d7d, 0x3}, 0xb, ...}, ...) /home/zns/Documents/gno-main/tm2/pkg/bft/state/execution.go:102 +0x115 github.com/gnolang/gno/tm2/pkg/bft/consensus.(*ConsensusState).finalizeCommit(0xc00a2c5b00, 0xc) /home/zns/Documents/gno-main/tm2/pkg/bft/consensus/state.go:1347 +0x97e github.com/gnolang/gno/tm2/pkg/bft/consensus.(*ConsensusState).tryFinalizeCommit(0xc00a2c5b00, 0xc) /home/zns/Documents/gno-main/tm2/pkg/bft/consensus/state.go:1275 +0x313 github.com/gnolang/gno/tm2/pkg/bft/consensus.(*ConsensusState).enterCommit.func1() /home/zns/Documents/gno-main/tm2/pkg/bft/consensus/state.go:1221 +0x97 github.com/gnolang/gno/tm2/pkg/bft/consensus.(*ConsensusState).enterCommit(0xc00a2c5b00, 0xc, 0x0) /home/zns/Documents/gno-main/tm2/pkg/bft/consensus/state.go:1252 +0xb03 github.com/gnolang/gno/tm2/pkg/bft/consensus.(*ConsensusState).addVote(0xc00a2c5b00, 0xc002cb8d20, {0x0, 0x0}) /home/zns/Documents/gno-main/tm2/pkg/bft/consensus/state.go:1637 +0x913 github.com/gnolang/gno/tm2/pkg/bft/consensus.(*ConsensusState).tryAddVote(0xc00a2c5b00, 0xf?, {0x0?, 0x0?}) /home/zns/Documents/gno-main/tm2/pkg/bft/consensus/state.go:1483 +0x27 github.com/gnolang/gno/tm2/pkg/bft/consensus.(*ConsensusState).handleMsg(0xc00a2c5b00, {{0xf8f300, 0xc004bb8948}, {0x0, 0x0}}) /home/zns/Documents/gno-main/tm2/pkg/bft/consensus/state.go:691 +0x318 github.com/gnolang/gno/tm2/pkg/bft/consensus.(*ConsensusState).receiveRoutine(0xc00a2c5b00, 0x0) /home/zns/Documents/gno-main/tm2/pkg/bft/consensus/state.go:650 +0x42c created by github.com/gnolang/gno/tm2/pkg/bft/consensus.(*ConsensusState).OnStart /home/zns/Documents/gno-main/tm2/pkg/bft/consensus/state.go:344 +0x4af
Edit3: Brilliant, the cherry-picked logs found the error: 0 /home/zns/Documents/gno-main/tm2/pkg/crypto/keys/client/addpkg.go:211 - deliver transaction failed: log:recovered: encoding/base64/base64.gno:6: unknown import path encoding/binary
. I'll work on fixing the encoding/base64
. Will make a new issue to track this.
I'm running into an error and everything I've tried to understand it / workaround it has failed. For some reason, one of my packages keeps giving an error.
I have a couple of "audio" packages and all of them are passing tests and compiling with the gnovm:
test commands
I am hitting the problem when posting the package to gnoland. All my packages succeed when posting, except for the
bytebeat
one, but the error at this stage is justinternal error:
gnokey maketx output
gnoland gives some more output, but the only thing I can glean is that it says
WritePerByte
is causing some kind of panic.gnoland output
I'm hitting a bit of a wall here, if anyone has any ideas please let me know. The code I'm working on is here: https://github.com/schollz/gno/tree/bytebeat/examples/gno.land/p/demo/audio. I can make some detailed repro instructions if that is helpful.