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

[R4R] hot fix panic is not recovered in prechecker #635

Merged
merged 1 commit into from
Aug 1, 2019
Merged

Conversation

ackratos
Copy link
Contributor

@ackratos ackratos commented Aug 1, 2019

Description

Fix Panic within ante handler and prechecker is not recovered.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0xd533f7]

goroutine 416261 [running]:
github.com/binance-chain/node/vendor/github.com/cosmos/cosmos-sdk/x/auth.StdTx.GetSigners(0xc017b4a710, 0x1, 0x1, 0xc00ec73e80, 0x1, 0x1, 0xc00cd62f68, 0x8, 0x1, 0x0, ...)
        /root/bnbchain/src/github.com/binance-chain/node/vendor/github.com/cosmos/cosmos-sdk/x/auth/stdtx.go:49 +0x127
github.com/binance-chain/node/common/tx.validateBasic(0xc017b4a710, 0x1, 0x1, 0xc00ec73e80, 0x1, 0x1, 0xc00cd62f68, 0x8, 0x1, 0x0, ...)
        /root/bnbchain/src/github.com/binance-chain/node/common/tx/ante.go:208 +0x129
github.com/binance-chain/node/common/tx.NewTxPreChecker.func1(0x14e9100, 0xc00f67f500, 0xc00aaea1c0, 0xb, 0xc00806bad0, 0xc8, 0xc9, 0x14cb660, 0xc00fe42600, 0x0, ...)
        /root/bnbchain/src/github.com/binance-chain/node/common/tx/ante.go:69 +0xde
github.com/binance-chain/node/vendor/github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).preCheck(0xc00010c000, 0xc00806bad0, 0xc8, 0xc9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /root/bnbchain/src/github.com/binance-chain/node/vendor/github.com/cosmos/cosmos-sdk/baseapp/baseapp.go:600 +0x219
github.com/binance-chain/node/vendor/github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).PreCheckTx(0xc00010c000, 0xc00806bad0, 0xc8, 0xc9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /root/bnbchain/src/github.com/binance-chain/node/vendor/github.com/cosmos/cosmos-sdk/baseapp/baseapp.go:612 +0x9d
github.com/binance-chain/node/vendor/github.com/cosmos/cosmos-sdk/server/concurrent.(*asyncLocalClient).CheckTxAsync.func1()
        /root/bnbchain/src/github.com/binance-chain/node/vendor/github.com/cosmos/cosmos-sdk/server/concurrent/async_local_client.go:235 +0x19b
github.com/binance-chain/node/vendor/github.com/cosmos/cosmos-sdk/server/concurrent/pool.(*Pool).worker(0xc00ec6b0b0, 0xc010a6cb90)
        /root/bnbchain/src/github.com/binance-chain/node/vendor/github.com/cosmos/cosmos-sdk/server/concurrent/pool/pool.go:72 +0x7d
created by github.com/binance-chain/node/vendor/github.com/cosmos/cosmos-sdk/server/concurrent/pool.(*Pool).schedule
        /root/bnbchain/src/github.com/binance-chain/node/vendor/github.com/cosmos/cosmos-sdk/server/concurrent/pool/pool.go:61 +0x13b
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0xd533f7]

Rationale

N/A

Example

N/A

Changes

recover panic with in

Preflight checks

  • build passed (make build)
  • tests passed (make test)
  • integration tests passed (make integration_test)
  • manual transaction test passed (cli invoke)

Already reviewed by

...

Related issues

... reference related issue #'s here ...

@@ -60,12 +60,19 @@ func InitSigCache(size int) {

// this function is not implemented in AnteHandler in BaseApp.
func NewTxPreChecker() sdk.PreChecker {
return func(ctx sdk.Context, txBytes []byte, tx sdk.Tx) sdk.Result {
return func(ctx sdk.Context, txBytes []byte, tx sdk.Tx) (res sdk.Result) {
stdTx, ok := tx.(auth.StdTx)
if !ok {
return sdk.ErrInternal("tx must be StdTx").Result()
}

Copy link
Contributor

Choose a reason for hiding this comment

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

add a testcase?

@ackratos ackratos changed the title [R4R] hot fix panic is not recovered in ante handler and prechecker [R4R] hot fix panic is not recovered in prechecker Aug 1, 2019
@ackratos ackratos force-pushed the ante_panic branch 2 times, most recently from ede2029 to 8bef9ed Compare August 1, 2019 06:24
@ackratos ackratos merged commit 133fb3d into master Aug 1, 2019
@unclezoro unclezoro deleted the ante_panic branch May 10, 2022 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants