forked from gnolang/gno
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: catch the out of gas exception in preprocess (gnolang#2638)
<!-- please provide a detailed description of the changes made in this pull request. --> <details><summary>Contributors' checklist...</summary> - [ ] Added new tests, or not needed, or not feasible - [ ] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [ ] Updated the official documentation or not needed - [ ] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [ ] Added references to related issues and PRs - [ ] Provided any useful hints for running manual tests - [ ] Added new benchmarks to [generated graphs](https://gnoland.github.io/benchmarks), if any. More info [here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md). </details> --------- Co-authored-by: Morgan <[email protected]>
- Loading branch information
Showing
2 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# ensure users get proper out of gas errors when they add packages | ||
|
||
# start a new node | ||
gnoland start | ||
|
||
# add foo package | ||
gnokey maketx addpkg -pkgdir $WORK/foo -pkgpath gno.land/r/foo -gas-fee 1000000ugnot -gas-wanted 220000 -broadcast -chainid=tendermint_test test1 | ||
|
||
|
||
# add bar package | ||
# out of gas at store.GetPackage() with gas 60000 | ||
|
||
! gnokey maketx addpkg -pkgdir $WORK/bar -pkgpath gno.land/r/bar -gas-fee 1000000ugnot -gas-wanted 60000 -broadcast -chainid=tendermint_test test1 | ||
|
||
# Out of gas error | ||
|
||
stderr '--= Error =--' | ||
stderr 'Data: out of gas error' | ||
stderr 'Msg Traces:' | ||
stderr 'out of gas.*?in preprocess' | ||
stderr '--= /Error =--' | ||
|
||
|
||
|
||
# out of gas at store.store.GetTypeSafe() with gas 63000 | ||
|
||
! gnokey maketx addpkg -pkgdir $WORK/bar -pkgpath gno.land/r/bar -gas-fee 1000000ugnot -gas-wanted 63000 -broadcast -chainid=tendermint_test test1 | ||
|
||
stderr '--= Error =--' | ||
stderr 'Data: out of gas error' | ||
stderr 'Msg Traces:' | ||
stderr 'out of gas.*?in preprocess' | ||
stderr '--= /Error =--' | ||
|
||
|
||
-- foo/foo.gno -- | ||
package foo | ||
|
||
type Counter int | ||
|
||
func Inc(i Counter) Counter{ | ||
i = i+1 | ||
return i | ||
} | ||
|
||
-- bar/bar.gno -- | ||
package bar | ||
|
||
import "gno.land/r/foo" | ||
|
||
type NewCounter foo.Counter | ||
|
||
func Add2(i NewCounter) NewCounter{ | ||
i=i+2 | ||
|
||
return i | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters