Handle nil *Any in UnpackAny and add panic handler for tx decoding (#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>
This commit is contained in:
co-authored by
Aaron Craelius
Amaury Martiny
Cory Levinson
mergify[bot]
parent
9e7eb0da00
commit
eba4c8a264
@@ -8,11 +8,10 @@ import (
|
||||
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
|
||||
)
|
||||
|
||||
// BaseAppSimulateFn is the signature of the Baseapp#Simulate function.
|
||||
type BaseAppSimulateFn func(txBytes []byte, txtypes sdk.Tx) (sdk.GasInfo, *sdk.Result, error)
|
||||
type BaseAppSimulateFn func(txBytes []byte) (sdk.GasInfo, *sdk.Result, error)
|
||||
|
||||
type simulateServer struct {
|
||||
simulate BaseAppSimulateFn
|
||||
@@ -39,13 +38,12 @@ func (s simulateServer) Simulate(ctx context.Context, req *SimulateRequest) (*Si
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
txBuilder := authtx.WrapTx(req.Tx)
|
||||
txBytes, err := req.Tx.Marshal()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
gasInfo, result, err := s.simulate(txBytes, txBuilder.GetTx())
|
||||
gasInfo, result, err := s.simulate(txBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user