Skip to content

Commit

Permalink
Handle nil *Any in UnpackAny and add panic handler for tx decoding (c…
Browse files Browse the repository at this point in the history
…osmos#7594)

* Handle nil any in UnpackAny

* Add test

* Add flag back

* Update runTx signature

* Update Simulate signature

* Update calls to Simulate

* Add txEncoder in baseapp

* Fix TestTxWithoutPublicKey

* Wrap errors

* Use amino in baseapp tests

* Add txEncoder arg to Check & Deliver

* Fix gas in test

* Fix remaining base app tests

* Rename to amionTxEncoder

* Update codec/types/interface_registry.go

Co-authored-by: Aaron Craelius <aaron@regen.network>

* golangci-lint fix

Co-authored-by: Amaury Martiny <amaury.martiny@protonmail.com>
Co-authored-by: Aaron Craelius <aaron@regen.network>
Co-authored-by: Cory Levinson <cjlevinson@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
5 people committed Oct 19, 2020
1 parent 09bc763 commit 46c20cd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,12 +320,12 @@ func CheckBalance(t *testing.T, app *SimApp, addr sdk.AccAddress, balances sdk.C
// the parameter 'expPass' against the result. A corresponding result is
// returned.
func SignCheckDeliver(
t *testing.T, txGen client.TxConfig, app *bam.BaseApp, header tmproto.Header, msgs []sdk.Msg,
t *testing.T, txCfg client.TxConfig, app *bam.BaseApp, header tmproto.Header, msgs []sdk.Msg,
chainID string, accNums, accSeqs []uint64, expSimPass, expPass bool, priv ...crypto.PrivKey,
) (sdk.GasInfo, *sdk.Result, error) {

tx, err := helpers.GenTx(
txGen,
txCfg,
msgs,
sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 0)},
helpers.DefaultGenTxGas,
Expand All @@ -335,11 +335,11 @@ func SignCheckDeliver(
priv...,
)
require.NoError(t, err)
txBytes, err := txGen.TxEncoder()(tx)
txBytes, err := txCfg.TxEncoder()(tx)
require.Nil(t, err)

// Must simulate now as CheckTx doesn't run Msgs anymore
_, res, err := app.Simulate(txBytes, tx)
_, res, err := app.Simulate(txBytes)

if expSimPass {
require.NoError(t, err)
Expand All @@ -351,7 +351,7 @@ func SignCheckDeliver(

// Simulate a sending a transaction and committing a block
app.BeginBlock(abci.RequestBeginBlock{Header: header})
gInfo, res, err := app.Deliver(tx)
gInfo, res, err := app.Deliver(txCfg.TxEncoder(), tx)

if expPass {
require.NoError(t, err)
Expand Down

0 comments on commit 46c20cd

Please sign in to comment.