Skip to content

panic: precommit length (X) doesn't match valset length (Y) at height Z #3054

@james-ray

Description

@james-ray

What happened:

My pr #3006 would cause a bug if the validatorSet changed after height 0
The call stack is:

goroutine 1 [running]:
github.com/tendermint/tendermint/state.getBeginBlockValidatorInfo(0xc4202b2b40, 0xc421e38500, 0x17a1760, 0xc4200bac10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /root/go/src/github.com/tendermint/tendermint/state/execution.go:313 +0x7cf
github.com/tendermint/tendermint/state.execBlockOnProxyApp(0x1796760, 0xc42226ece0, 0x179c1c0, 0xc42225f040, 0xc4202b2b40, 0xc421e38500, 0x17a1760, 0xc4200bac10, 0x0, 0xc00, ...)
        /root/go/src/github.com/tendermint/tendermint/state/execution.go:250 +0x24c
github.com/tendermint/tendermint/state.ExecCommitBlock(0x179c1c0, 0xc42225f040, 0xc4202b2b40, 0x1796760, 0xc42226ece0, 0xc421e38500, 0x17a1760, 0xc4200bac10, 0xc4225ee060, 0x20, ...)
        /root/go/src/github.com/tendermint/tendermint/state/execution.go:631 +0x9b
github.com/tendermint/tendermint/consensus.(*Handshaker).replayBlocks(0xc438bcc780, 0x7, 0x0, 0xc4219e35c6, 0x6, 0xc4219e35e0, 0xc, 0x14, 0x0, 0xc4200e7980, ...)
        /root/go/src/github.com/tendermint/tendermint/consensus/replay.go:429 +0x250
github.com/tendermint/tendermint/consensus.(*Handshaker).ReplayBlocks(0xc438bcc780, 0x7, 0x0, 0xc4219e35c6, 0x6, 0xc4219e35e0, 0xc, 0x14, 0x0, 0xc4200e7980, ...)
        /root/go/src/github.com/tendermint/tendermint/consensus/replay.go:367 +0xc8a
github.com/tendermint/tendermint/consensus.(*Handshaker).Handshake(0xc438bcc780, 0x17a2160, 0xc420237110, 0x2, 0x1796760)
        /root/go/src/github.com/tendermint/tendermint/consensus/replay.go:256 +0x46f

error info is:

I[12-20|07:31:10.043] Applying block                               module=consensus height=2
panic: precommit length (12) doesn't match valset length (7) at height 2

What you expected to happen:

Recently I was thinking whether the state should be restored from 0 and begin to change again. But what if the appHeight is not 0? For example, if the appHeight==20, stateHeight==40, and 20~40 has some validators change txs. How can we get the state in height 20?

I think there's no need to restore state and replay changes.

What we need is to fetch historical validators in getBeginBlockValidatorInfo (see #3054 (comment)).

Metadata

Metadata

Assignees

No one assigned

    Labels

    C:consensusComponent: ConsensusT:bugType Bug (Confirmed)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions