Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
thehowl committed Dec 11, 2024
1 parent e0b4ba0 commit 224e164
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
9 changes: 1 addition & 8 deletions gno.land/cmd/gnoland/testdata/addpkg_outofgas.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,12 @@ gnoland start
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
# 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 =--'


Expand All @@ -28,8 +23,6 @@ stderr '--= /Error =--'

stderr '--= Error =--'
stderr 'Data: out of gas error'
stderr 'Msg Traces:'
stderr 'out of gas.*?in preprocess'
stderr '--= /Error =--'


Expand Down
6 changes: 3 additions & 3 deletions gno.land/pkg/sdk/vm/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,8 @@ func (vm *VMKeeper) Call(ctx sdk.Context, msg MsgCall) (res string, err error) {

func doRecover(m *gno.Machine, e *error) {
if r := recover(); r != nil {
if err := r.(error); r != nil {
oog := new(types.OutOfGasError)
if err, ok := r.(error); ok {
var oog types.OutOfGasError
if goerrors.As(err, &oog) {
// Re-panic and don't wrap.
panic(oog)
Expand All @@ -521,7 +521,7 @@ func doRecover(m *gno.Machine, e *error) {
if goerrors.As(err, &up) {
// Common unhandled panic error, skip machine state.
*e = errors.Wrapf(
up.Descriptor,
errors.New(up.Descriptor),
"VM panic: %s\nStacktrace: %s\n",
up.Descriptor, m.ExceptionsStacktrace(),
)
Expand Down
4 changes: 2 additions & 2 deletions tm2/pkg/store/types/gas.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type OutOfGasError struct {
Descriptor string
}

func (oog *OutOfGasError) Error() string {
func (oog OutOfGasError) Error() string {
return "out of gas in location: " + oog.Descriptor

Check warning on line 30 in tm2/pkg/store/types/gas.go

View check run for this annotation

Codecov / codecov/patch

tm2/pkg/store/types/gas.go#L29-L30

Added lines #L29 - L30 were not covered by tests
}

Expand All @@ -36,7 +36,7 @@ type GasOverflowError struct {
Descriptor string
}

func (oog *GasOverflowError) Error() string {
func (oog GasOverflowError) Error() string {
return "gas overflow in location: " + oog.Descriptor

Check warning on line 40 in tm2/pkg/store/types/gas.go

View check run for this annotation

Codecov / codecov/patch

tm2/pkg/store/types/gas.go#L39-L40

Added lines #L39 - L40 were not covered by tests
}

Expand Down

0 comments on commit 224e164

Please sign in to comment.