You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This consistently produces should not happen the second time.
Note
It happens on master.
But it is more apparent after applying #2368.
That is because in that case, the first time you add a package, it then shows a clear Out of gas error. Whereas without #2368, you get some random error for the first failing addpkg, meaning you're not as likely to go further.
Expected behaviour
The second addpkg with insufficient gas (same or different package), should fail in the same way as the first. When the tx fails we don't expect state to change in the VM itself.
Actual behaviour
... instead it currently panic with should not happen the second time, line 428:
-- produced: 3 times
gnodev -minimal
addpkg p/demo/bf out of gas
addpkg p/demo/rat ok
addpkg p/demo/cford32 should not happen
-- produced: 3 times
gnodev -minimal
addpkg p/demo/bf out of gas
addpkg p/demo/cford32 should not happen
addpkg p/demo/rat ok
-- produced: 1 times
gnodev -minimal
addpkg p/demo/cford32 ok
addpkg p/demo/rat ok
addpkg p/demo/bf out of gas
addpkg p/demo/gnode ok
addpkg p/demo/stack ok
addpkg p/demo/merkle should not happen
-- produced: 1 times
gnodev -minimal
addpkg p/demo/merkle out of gas
addpkg p/demo/gnode ok
addpkg p/demo/cford32 should not happen
-- predicted, and produced: 1 times
gnodev -minimal
addpkg p/demo/merkle out of gas
addpkg p/demo/gnode ok
addpkg p/demo/rat ok
addpkg p/demo/stack ok
addpkg p/demo/cford32 should not happen
-- predicted, and produced: 1 times
gnodev -minimal
addpkg p/demo/merkle out of gas
addpkg p/demo/gnode ok
addpkg p/demo/rat ok
addpkg p/demo/stack ok
addpkg p/demo/bf should not happen
Proposed solution
Spent many hours on this already, mostly reading early commits about the store.
The most promising clue I've seen so far is this message #1702 (comment) by Morgan
@thehowl, you're the hope for humanity here :p
Do you understand what's happening?
The text was updated successfully, but these errors were encountered:
Calling
addpkg
with insufficient gas seems to corrupt the machine.Issue became apparent to me while testing #2368, but it also happens without.
Steps to reproduce
On a clean chain:
For example:
gnodev -minimal
gnokey maketx addpkg -pkgpath p/demo/bf -pkgdir examples/p/demo/bf -deposit 10ugnot -gas-fee 10ugnot -gas-wanted 9000000 -broadcast=true -chainid dev -remote localhost:26657 myaccount
gnokey maketx addpkg -pkgpath p/demo/cford32 -pkgdir examples/p/demo/cford32 -deposit 10ugnot -gas-fee 10ugnot -gas-wanted 9000000 -broadcast=true -chainid dev -remote localhost:26657 myaccount
This consistently produces
should not happen
the second time.Note
It happens on master.
But it is more apparent after applying #2368.
That is because in that case, the first time you add a package, it then shows a clear Out of gas error. Whereas without #2368, you get some random error for the first failing addpkg, meaning you're not as likely to go further.
Expected behaviour
The second addpkg with insufficient gas (same or different package), should fail in the same way as the first. When the tx fails we don't expect state to change in the VM itself.
Actual behaviour
... instead it currently panic with
should not happen
the second time, line 428:gno/gnovm/pkg/gnolang/store.go
Lines 423 to 431 in 3901e7e
VS Code. tt != tt2 (click to show debugger screenshots)
![_](https://github.com/gnolang/gno/assets/350354/0344f91e-f374-48d9-947f-335efe829c2c) See tt and tt2 compared here:
The caller of this is
func (ds *defaultStore) GetPackage(pkgPath string, isImport bool)
.More exactly here is where it gets called (L209):
gno/gnovm/pkg/gnolang/store.go
Lines 203 to 211 in 3901e7e
In the case I was debugging, it was about
import "errors"
...Logs
Call stack
Reproducibility
First we have determined that some packages require more gas than others to be added:
cheap: p/demo/rat, p/demo/gnode, p/stack
expensive: p/demo/bf, p/demo/merkle, p/demo/cford32
-- produced: 3 times
gnodev -minimal
addpkg p/demo/bf out of gas
addpkg p/demo/rat ok
addpkg p/demo/cford32 should not happen
-- produced: 3 times
gnodev -minimal
addpkg p/demo/bf out of gas
addpkg p/demo/cford32 should not happen
addpkg p/demo/rat ok
-- produced: 1 times
gnodev -minimal
addpkg p/demo/cford32 ok
addpkg p/demo/rat ok
addpkg p/demo/bf out of gas
addpkg p/demo/gnode ok
addpkg p/demo/stack ok
addpkg p/demo/merkle should not happen
-- produced: 1 times
gnodev -minimal
addpkg p/demo/merkle out of gas
addpkg p/demo/gnode ok
addpkg p/demo/cford32 should not happen
-- predicted, and produced: 1 times
gnodev -minimal
addpkg p/demo/merkle out of gas
addpkg p/demo/gnode ok
addpkg p/demo/rat ok
addpkg p/demo/stack ok
addpkg p/demo/cford32 should not happen
-- predicted, and produced: 1 times
gnodev -minimal
addpkg p/demo/merkle out of gas
addpkg p/demo/gnode ok
addpkg p/demo/rat ok
addpkg p/demo/stack ok
addpkg p/demo/bf should not happen
Proposed solution
Spent many hours on this already, mostly reading early commits about the store.
The most promising clue I've seen so far is this message #1702 (comment) by Morgan
@thehowl, you're the hope for humanity here :p
Do you understand what's happening?
The text was updated successfully, but these errors were encountered: