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

AnteDecorator #5006

Merged
merged 42 commits into from
Oct 10, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
1960993
start decorator changes
AdityaSripal Aug 28, 2019
12244c5
start replacing ante logic with decorators
AdityaSripal Aug 30, 2019
5a46ceb
Fix build errors
AdityaSripal Sep 5, 2019
bdcf294
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into ad…
AdityaSripal Sep 5, 2019
ac19f18
fix some tests
AdityaSripal Sep 6, 2019
9a0eac7
fix baseapp tests
AdityaSripal Sep 9, 2019
725f5cf
fix auth tests
AdityaSripal Sep 12, 2019
ff5f1f7
start individual decorator tests
AdityaSripal Sep 14, 2019
73e2739
add signature tests
AdityaSripal Sep 17, 2019
77bc7c6
complete sig tests
AdityaSripal Sep 17, 2019
baf5bfb
fix all test errors
AdityaSripal Sep 17, 2019
71e07ce
remove unnecessary &
AdityaSripal Sep 18, 2019
3b3a74f
fix linter errors
AdityaSripal Sep 18, 2019
6303bec
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into ad…
AdityaSripal Sep 18, 2019
e52e89d
interface all decorators except sigs
AdityaSripal Sep 18, 2019
ac8209d
check signer lenght in sigverify
AdityaSripal Sep 19, 2019
b93ca36
Apply suggestions from bez code review
AdityaSripal Sep 22, 2019
5825e81
complete bez suggestions
AdityaSripal Sep 29, 2019
441c050
fix merge conflicts
AdityaSripal Sep 29, 2019
2f22251
create sigTx interface
AdityaSripal Oct 1, 2019
975ad0e
linting
AdityaSripal Oct 1, 2019
c5ede73
finish linting except TODO
AdityaSripal Oct 1, 2019
9a5cb61
make auth tx interfaces extend sdk.Tx
AdityaSripal Oct 1, 2019
e7ec478
Merge branch 'master' into aditya/ante-decorator
alexanderbez Oct 2, 2019
634c1aa
test docs, replace FeeCoins with GetFee
AdityaSripal Oct 2, 2019
66144bf
Merge branch 'aditya/ante-decorator' of https://github.com/cosmos/cos…
AdityaSripal Oct 2, 2019
0c39cd9
Apply suggestions from fede code review
AdityaSripal Oct 2, 2019
29e85bf
address tim comments
AdityaSripal Oct 3, 2019
f1964cf
Merge branch 'aditya/ante-decorator' of https://github.com/cosmos/cos…
AdityaSripal Oct 3, 2019
b6d9166
Merge branch 'master' into aditya/ante-decorator
fedekunze Oct 8, 2019
0fd1234
add order comments
AdityaSripal Oct 8, 2019
aad9673
Add Schwarzenegger art
AdityaSripal Oct 8, 2019
5ce99da
add assertions that StdTx implements all necessary decorator interfaces
AdityaSripal Oct 8, 2019
bd79e58
Merge branch 'aditya/ante-decorator' of https://github.com/cosmos/cos…
AdityaSripal Oct 8, 2019
2f54876
documentation and CHANGELOG
AdityaSripal Oct 9, 2019
a4ef3ec
Run goimports
alexanderbez Oct 9, 2019
33cc17a
Update ChainAnteDecorators godoc
alexanderbez Oct 10, 2019
882fac5
Changelog entries cleanup
alexanderbez Oct 10, 2019
163da7f
Changelog entries cleanup
alexanderbez Oct 10, 2019
492cf0d
Merge branch 'master' into aditya/ante-decorator
alexanderbez Oct 10, 2019
1b1a779
Fix formatter
alexanderbez Oct 10, 2019
440a05c
Merge branch 'master' into aditya/ante-decorator
alexanderbez Oct 10, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
complete bez suggestions
  • Loading branch information
AdityaSripal committed Sep 29, 2019
commit 5825e81f7679334af4d4355f4cba4be1c5539129
14 changes: 7 additions & 7 deletions baseapp/baseapp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"github.com/cosmos/cosmos-sdk/store/rootmulti"
store "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
errs "github.com/cosmos/cosmos-sdk/types/errors"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)

var (
Expand Down Expand Up @@ -600,12 +600,12 @@ func anteHandlerTxTest(t *testing.T, capKey *sdk.KVStoreKey, storeKey []byte) sd
txTest := tx.(txTest)

if txTest.FailOnAnte {
return newCtx, errs.Wrap(errs.ErrUnauthorized, "ante handler failure")
return newCtx, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "ante handler failure")
}

res := incrementingCounter(t, store, storeKey, txTest.Counter)
if !res.IsOK() {
err = errs.ABCIError(string(res.Codespace), uint32(res.Code), res.Log)
err = sdkerrors.ABCIError(string(res.Codespace), uint32(res.Code), res.Log)
}
return
}
Expand Down Expand Up @@ -996,7 +996,7 @@ func TestTxGasLimits(t *testing.T) {
switch rType := r.(type) {
case sdk.ErrorOutOfGas:
log := fmt.Sprintf("out of gas in location: %v", rType.Descriptor)
err = errs.Wrap(errs.ErrOutOfGas, log)
err = sdkerrors.Wrap(sdkerrors.ErrOutOfGas, log)
default:
panic(r)
}
Expand Down Expand Up @@ -1076,7 +1076,7 @@ func TestMaxBlockGasLimits(t *testing.T) {
if r := recover(); r != nil {
switch rType := r.(type) {
case sdk.ErrorOutOfGas:
err = errs.Wrapf(errs.ErrOutOfGas, "out of gas in location: %v", rType.Descriptor)
err = sdkerrors.Wrapf(sdkerrors.ErrOutOfGas, "out of gas in location: %v", rType.Descriptor)
default:
panic(r)
}
Expand Down Expand Up @@ -1241,7 +1241,7 @@ func TestGasConsumptionBadTx(t *testing.T) {
switch rType := r.(type) {
case sdk.ErrorOutOfGas:
log := fmt.Sprintf("out of gas in location: %v", rType.Descriptor)
err = errs.Wrap(errs.ErrOutOfGas, log)
err = sdkerrors.Wrap(sdkerrors.ErrOutOfGas, log)
default:
panic(r)
}
Expand All @@ -1251,7 +1251,7 @@ func TestGasConsumptionBadTx(t *testing.T) {
txTest := tx.(txTest)
newCtx.GasMeter().ConsumeGas(uint64(txTest.Counter), "counter-ante")
if txTest.FailOnAnte {
return newCtx, errs.Wrap(errs.ErrUnauthorized, "ante handler failure")
return newCtx, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "ante handler failure")
}

return
Expand Down
10 changes: 5 additions & 5 deletions docs/architecture/adr-010-modular-antehandler.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,16 +191,16 @@ type AnteDecorator interface {
```

```go
// ChainDecorators will recursively link all of the AnteDecorators in the chain and return a final AnteHandler function
// ChainAnteDecorators will recursively link all of the AnteDecorators in the chain and return a final AnteHandler function
// This is done to preserve the ability to set a single AnteHandler function in the baseapp.
func ChainDecorators(chain ...AnteDecorator) AnteHandler {
func ChainAnteDecorators(chain ...AnteDecorator) AnteHandler {
if len(chain) == 1 {
return func(ctx Context, tx Tx, simulate bool) {
chain[0].AnteHandle(ctx, tx, simulate, nil)
}
}
return func(ctx Context, tx Tx, simulate bool) {
chain[0].AnteHandle(ctx, tx, simulate, ChainDecorators(chain[1:]))
chain[0].AnteHandle(ctx, tx, simulate, ChainAnteDecorators(chain[1:]))
}
}
```
Expand Down Expand Up @@ -251,7 +251,7 @@ Link AnteDecorators to create a final AnteHandler. Set this AnteHandler in basea

```go
// Create final antehandler by chaining the decorators together
antehandler := ChainDecorators(NewSetupDecorator(), NewSigVerifyDecorator(), NewUserDefinedDecorator())
antehandler := ChainAnteDecorators(NewSetupDecorator(), NewSigVerifyDecorator(), NewUserDefinedDecorator())

// Set chained Antehandler in the baseapp
bapp.SetAnteHandler(antehandler)
Expand All @@ -264,7 +264,7 @@ Pros:

Cons:

1. Decorator pattern may have a deeply nested structure that is hard to understand, this is mitigated by having the decorator order explicitly listed in the `ChainDecorators` function.
1. Decorator pattern may have a deeply nested structure that is hard to understand, this is mitigated by having the decorator order explicitly listed in the `ChainAnteDecorators` function.
2. Does not make use of the ModuleManager design. Since this is already being used for BeginBlocker/EndBlocker, this proposal seems unaligned with that design pattern.

## Status
Expand Down
14 changes: 8 additions & 6 deletions types/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,25 @@ type AnteDecorator interface {
// wrapping over the decorators further along chain and returns a single AnteHandler
//
// First element is outermost decorator, last element is innermost decorator
func ChainDecorators(chain ...AnteDecorator) AnteHandler {
chain = append(chain, Tail{})
func ChainAnteDecorators(chain ...AnteDecorator) AnteHandler {
if (chain[len(chain)-1] != Terminator{}) {
chain = append(chain, Terminator{})
}
if len(chain) == 1 {
return func(ctx Context, tx Tx, simulate bool) (Context, error) {
return chain[0].AnteHandle(ctx, tx, simulate, nil)
}
}
return func(ctx Context, tx Tx, simulate bool) (Context, error) {
return chain[0].AnteHandle(ctx, tx, simulate, ChainDecorators(chain[1:]...))
return chain[0].AnteHandle(ctx, tx, simulate, ChainAnteDecorators(chain[1:]...))
}
}

// Tail AnteDecorator will get added to the chain to simplify decorator code
// Terminator AnteDecorator will get added to the chain to simplify decorator code
// Don't need to check if next == nil further up the chain
type Tail struct{}
type Terminator struct{}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lololol


// Simply return provided Context and nil error
func (t Tail) AnteHandle(ctx Context, tx Tx, simulate bool, next AnteHandler) (Context, error) {
func (t Terminator) AnteHandle(ctx Context, tx Tx, simulate bool, next AnteHandler) (Context, error) {
return ctx, nil
}
4 changes: 2 additions & 2 deletions x/auth/ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import (
// numbers, checks signatures & account numbers, and deducts fees from the first
// signer.
func NewAnteHandler(ak keeper.AccountKeeper, supplyKeeper types.SupplyKeeper, sigGasConsumer SignatureVerificationGasConsumer) sdk.AnteHandler {
return sdk.ChainDecorators(
return sdk.ChainAnteDecorators(
NewSetupDecorator(),
NewMempoolFeeDecorator(),
NewValidateBasicDecorator(),
NewValidateMemoDecorator(ak),
NewConsumeGasForTxSizeDecorator(ak),
NewDeductFeeDecorator(ak, supplyKeeper),
NewSetPubKeyDecorator(ak),
NewValidateSigCountDecorator(ak),
NewDeductFeeDecorator(ak, supplyKeeper),
NewSigGasConsumeDecorator(ak, sigGasConsumer),
NewSigVerificationDecorator(ak),
)
Expand Down
4 changes: 2 additions & 2 deletions x/auth/ante/ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/tendermint/tendermint/crypto/secp256k1"

sdk "github.com/cosmos/cosmos-sdk/types"
errs "github.com/cosmos/cosmos-sdk/types/errors"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
"github.com/cosmos/cosmos-sdk/x/auth/exported"
"github.com/cosmos/cosmos-sdk/x/auth/types"
Expand Down Expand Up @@ -736,7 +736,7 @@ func TestCustomSignatureVerificationGasConsumer(t *testing.T) {
meter.ConsumeGas(params.SigVerifyCostED25519, "ante verify: ed25519")
return nil
default:
return errs.Wrapf(errs.ErrInvalidPubKey, "unrecognized public key type: %T", pubkey)
return sdkerrors.Wrapf(sdkerrors.ErrInvalidPubKey, "unrecognized public key type: %T", pubkey)
}
})

Expand Down
14 changes: 7 additions & 7 deletions x/auth/ante/basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package ante
import (
sdk "github.com/cosmos/cosmos-sdk/types"
err "github.com/cosmos/cosmos-sdk/types/errors"
errs "github.com/cosmos/cosmos-sdk/types/errors"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"

"github.com/cosmos/cosmos-sdk/x/auth/keeper"
)
Expand Down Expand Up @@ -46,7 +46,7 @@ func NewValidateMemoDecorator(ak keeper.AccountKeeper) ValidateMemoDecorator {
func (vmd ValidateMemoDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) {
memoTx, ok := tx.(TxWithMemo)
if !ok {
return ctx, errs.Wrap(errs.ErrTxDecode, "Tx must have a GetMemo method")
return ctx, sdkerrors.Wrap(sdkerrors.ErrTxDecode, "Tx must have a GetMemo method")
}

params := vmd.ak.GetParams(ctx)
Expand All @@ -62,19 +62,19 @@ func (vmd ValidateMemoDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate
return next(ctx, tx, simulate)
}

// ConsumeGasForTxSizeDecorator will take in parameters and consume gas proportional to the size of tx
// ConsumeTxSizeGasDecorator will take in parameters and consume gas proportional to the size of tx
// before calling next AnteHandler
type ConsumeGasForTxSizeDecorator struct {
type ConsumeTxSizeGasDecorator struct {
ak keeper.AccountKeeper
}

func NewConsumeGasForTxSizeDecorator(ak keeper.AccountKeeper) ConsumeGasForTxSizeDecorator {
return ConsumeGasForTxSizeDecorator{
func NewConsumeGasForTxSizeDecorator(ak keeper.AccountKeeper) ConsumeTxSizeGasDecorator {
return ConsumeTxSizeGasDecorator{
ak: ak,
}
}

func (cgts ConsumeGasForTxSizeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) {
func (cgts ConsumeTxSizeGasDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) {
params := cgts.ak.GetParams(ctx)
ctx.GasMeter().ConsumeGas(params.TxSizeCostPerByte*sdk.Gas(len(ctx.TxBytes())), "txSize")

Expand Down
8 changes: 4 additions & 4 deletions x/auth/ante/basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestValidateBasic(t *testing.T) {
invalidTx := types.NewTestTx(ctx, msgs, privs, accNums, seqs, fee)

vbd := ante.NewValidateBasicDecorator()
antehandler := sdk.ChainDecorators(vbd)
antehandler := sdk.ChainAnteDecorators(vbd)
_, err := antehandler(ctx, invalidTx, false)

require.NotNil(t, err, "Did not error on invalid tx")
Expand Down Expand Up @@ -58,7 +58,7 @@ func TestValidateMemo(t *testing.T) {
invalidTx := types.NewTestTxWithMemo(ctx, msgs, privs, accNums, seqs, fee, strings.Repeat("01234567890", 500))

vmd := ante.NewValidateMemoDecorator(app.AccountKeeper)
antehandler := sdk.ChainDecorators(vmd)
antehandler := sdk.ChainAnteDecorators(vmd)
_, err := antehandler(ctx, invalidTx, false)

require.NotNil(t, err, "Did not error on tx with high memo")
Expand All @@ -75,7 +75,7 @@ func TestConsumeGasForTxSize(t *testing.T) {
app, ctx := createTestApp(true)

cgtsd := ante.NewConsumeGasForTxSizeDecorator(app.AccountKeeper)
antehandler := sdk.ChainDecorators(cgtsd)
antehandler := sdk.ChainAnteDecorators(cgtsd)

params := app.AccountKeeper.GetParams(ctx)
txBytes := []byte(strings.Repeat("a", 10))
Expand All @@ -94,7 +94,7 @@ func TestConsumeGasForTxSize(t *testing.T) {
// No need to send tx here since this Decorator will do nothing with it
beforeGas = ctx.GasMeter().GasConsumed()
ctx, err := antehandler(ctx, nil, false)
require.Nil(t, err, "ConsumeGasForTxSizeDecorator returned error: %v", err)
require.Nil(t, err, "ConsumeTxSizeGasDecorator returned error: %v", err)

consumedGas := ctx.GasMeter().GasConsumed() - beforeGas
require.Equal(t, expectedGas, consumedGas, "Decorator did not consume the correct amount of gas")
Expand Down
17 changes: 9 additions & 8 deletions x/auth/ante/fee.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/cosmos/cosmos-sdk/x/auth/keeper"
"github.com/cosmos/cosmos-sdk/x/auth/types"

errs "github.com/cosmos/cosmos-sdk/types/errors"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)

// Tx must implement FeeTx interface to use the FeeDecorators
Expand All @@ -19,7 +19,8 @@ type FeeTx interface {
FeePayer() sdk.AccAddress
}

// MempoolFeeDecorator will check if the transaction's fee is at least as large the local validator's minimum gasFee (defined in validator config).
// MempoolFeeDecorator will check if the transaction's fee is at least as large
// as the local validator's minimum gasFee (defined in validator config).
// If fee is too low, decorator returns error and tx is rejected from mempool.
// Note this only applies when ctx.CheckTx = true
// If fee is high enough or not CheckTx, then call next AnteHandler
Expand All @@ -33,7 +34,7 @@ func NewMempoolFeeDecorator() MempoolFeeDecorator {
func (mfd MempoolFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) {
feeTx, ok := tx.(FeeTx)
if !ok {
return ctx, errs.Wrap(errs.ErrTxDecode, "Tx must be a FeeTx")
return ctx, sdkerrors.Wrap(sdkerrors.ErrTxDecode, "Tx must be a FeeTx")
}
feeCoins := feeTx.FeeCoins()
gas := feeTx.Gas()
Expand All @@ -55,7 +56,7 @@ func (mfd MempoolFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate b
}

if !feeCoins.IsAnyGTE(requiredFees) {
return ctx, errs.Wrapf(errs.ErrInsufficientFee, "insufficient fees; got: %q required: %q", feeCoins, requiredFees)
return ctx, sdkerrors.Wrapf(sdkerrors.ErrInsufficientFee, "insufficient fees; got: %q required: %q", feeCoins, requiredFees)
}
}
}
Expand All @@ -82,7 +83,7 @@ func NewDeductFeeDecorator(ak keeper.AccountKeeper, sk types.SupplyKeeper) Deduc
func (dfd DeductFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) {
feeTx, ok := tx.(FeeTx)
if !ok {
return ctx, errs.Wrap(errs.ErrTxDecode, "Tx must be a FeeTx")
return ctx, sdkerrors.Wrap(sdkerrors.ErrTxDecode, "Tx must be a FeeTx")
}

if addr := dfd.supplyKeeper.GetModuleAddress(types.FeeCollectorName); addr == nil {
Expand Down Expand Up @@ -112,21 +113,21 @@ func DeductFees(supplyKeeper types.SupplyKeeper, ctx sdk.Context, acc exported.A
coins := acc.GetCoins()

if !fees.IsValid() {
return errs.Wrapf(errs.ErrInsufficientFee, "invalid fee amount: %s", fees)
return sdkerrors.Wrapf(sdkerrors.ErrInsufficientFee, "invalid fee amount: %s", fees)
}

// verify the account has enough funds to pay for fees
_, hasNeg := coins.SafeSub(fees)
if hasNeg {
return errs.Wrapf(errs.ErrInsufficientFunds,
return sdkerrors.Wrapf(sdkerrors.ErrInsufficientFunds,
"insufficient funds to pay for fees; %s < %s", coins, fees)
}

// Validate the account has enough "spendable" coins as this will cover cases
// such as vesting accounts.
spendableCoins := acc.SpendableCoins(blockTime)
if _, hasNeg := spendableCoins.SafeSub(fees); hasNeg {
return errs.Wrapf(errs.ErrInsufficientFunds,
return sdkerrors.Wrapf(sdkerrors.ErrInsufficientFunds,
"insufficient funds to pay for fees; %s < %s", spendableCoins, fees)
}

Expand Down
4 changes: 2 additions & 2 deletions x/auth/ante/fee_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func TestEnsureMempoolFees(t *testing.T) {
_, ctx := createTestApp(true)

mfd := ante.NewMempoolFeeDecorator()
antehandler := sdk.ChainDecorators(mfd)
antehandler := sdk.ChainAnteDecorators(mfd)

// keys and addresses
priv1, _, addr1 := types.KeyTestPubAddr()
Expand Down Expand Up @@ -81,7 +81,7 @@ func TestDeductFees(t *testing.T) {
app.AccountKeeper.SetAccount(ctx, acc)

dfd := ante.NewDeductFeeDecorator(app.AccountKeeper, app.SupplyKeeper)
antehandler := sdk.ChainDecorators(dfd)
antehandler := sdk.ChainAnteDecorators(dfd)

_, err := antehandler(ctx, tx, false)

Expand Down
7 changes: 3 additions & 4 deletions x/auth/ante/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"

sdk "github.com/cosmos/cosmos-sdk/types"
errs "github.com/cosmos/cosmos-sdk/types/errors"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)

// Tx with a Gas() method is needed to use SetupDecorator
Expand All @@ -30,7 +30,7 @@ func (sud SetUpDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool,
// Set a gas meter with limit 0 as to prevent an infinite gas meter attack
// during runTx.
newCtx = SetGasMeter(simulate, ctx, 0)
return newCtx, errs.Wrap(errs.ErrTxDecode, "Tx must be GasTx")
return newCtx, sdkerrors.Wrap(sdkerrors.ErrTxDecode, "Tx must be GasTx")
}

newCtx = SetGasMeter(simulate, ctx, gasTx.Gas())
Expand All @@ -48,8 +48,7 @@ func (sud SetUpDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool,
"out of gas in location: %v; gasWanted: %d, gasUsed: %d",
rType.Descriptor, gasTx.Gas(), newCtx.GasMeter().GasConsumed())

err = errs.Wrap(errs.ErrOutOfGas, log)
// TODO: figure out how to return Context, error so that baseapp can recover gasWanted/gasUsed
err = sdkerrors.Wrap(sdkerrors.ErrOutOfGas, log)
default:
panic(r)
}
Expand Down
Loading