Repository navigation
Description
Bug Report
Setup
CometBFT version (use cometbft version or git rev-parse --verify HEAD if installed from source):
github.com/cometbft/[email protected]
Have you tried the latest version: yes/no
NO
ABCI app (name for built-in, URL for self-written if it's publicly available):
https://github.com/sideprotocol/side
Environment:
- OS (e.g. from /etc/os-release): Linux/Macos
What happened?
The blockchain will stop progressing if the proposer's vote extension fails to pass the VerifyVoteExtensionHandler. This occurs because the proposer does not call VerifyVoteExtensionHandler on its own extension, whereas all other validators do. As a result, the proposer node advances to the next height, while the other nodes repeatedly call VerifyVoteExtensionHandler, causing a consensus deadlock.
What did you expect to happen?
All nodes should call VerifyVoteExtensionHandler to verify data before it included in voteExt.
How to reproduce it
func (h *PriceOracleVoteExtHandler) ExtendVoteHandler() sdk.ExtendVoteHandler {
return func(ctx sdk.Context, req *abci.RequestExtendVote) (*abci.ResponseExtendVote, error) {
if req.Height < ctx.ConsensusParams().Abci.VoteExtensionsEnableHeight {
return &abci.ResponseExtendVote{}, nil
}
proposer := hex.EncodeToString(req.ProposerAddress)
h.logger.Warn("Prepare vote extension", "proposer", CURRENT_PROPOSER, "my", LOCAL_ADDRESS)
prices := make(map[string]string)
// add a mock price data for non-proposer nodes
if proposer != LOCAL_ADDRESS {
prices["ATOMUSD"]="123"
}
voteExt := types.OracleVoteExtension{
Height: req.Height,
Prices: prices,
Proposer: proposer,
}
bz, err := voteExt.Marshal()
if err != nil {
return nil, fmt.Errorf("failed to marshal vote extension: %w", err)
}
return &abci.ResponseExtendVote{VoteExtension: bz}, nil
}
}func (h *PriceOracleVoteExtHandler) VerifyVoteExtensionHandler() sdk.VerifyVoteExtensionHandler {
return func(ctx sdk.Context, req *abci.RequestVerifyVoteExtension) (*abci.ResponseVerifyVoteExtension, error) {
if !voteExtensionEnabled(ctx, req.Height) {
return &abci.ResponseVerifyVoteExtension{Status: abci.ResponseVerifyVoteExtension_ACCEPT}, nil
}
if len(req.VoteExtension) == 0 {
return &abci.ResponseVerifyVoteExtension{Status: abci.ResponseVerifyVoteExtension_REJECT}, nil
}
validator := hex.EncodeToString(req.ValidatorAddress)
var voteExt types.OracleVoteExtension
err := voteExt.Unmarshal(req.VoteExtension)
if err != nil {
return nil, fmt.Errorf("failed to unmarshal vote extension: %w", err)
}
if voteExt.Height != req.Height {
return nil, fmt.Errorf("vote extension height does not match request height; expected: %d, got: %d", req.Height, voteExt.Height)
}
// Since the propoer's price data is empty, will be rejected by other nodes
if len(voteExt.Prices) == 0 {
h.logger.Error("VerifyVoteExtensionHandler", "height", voteExt.Height, "validator", validator, "Price", len(voteExt.Prices), "proposer", voteExt.Proposer)
return &abci.ResponseVerifyVoteExtension{Status: abci.ResponseVerifyVoteExtension_REJECT}, nil
}
h.logger.Info("VerifyVoteExtensionHandler", "height", voteExt.Height, "validator", validator, "Price", len(voteExt.Prices), "proposer", voteExt.Proposer)
return &abci.ResponseVerifyVoteExtension{Status: abci.ResponseVerifyVoteExtension_ACCEPT}, nil
}
}Logs
Logs on the proposer: (height=12)
5:08PM INF Replay: Timeout dur=3000 height=12 module=consensus round=0 step=RoundStepPropose
5:08PM INF Replay: New Step height=12 module=consensus round=0 step=RoundStepPropose
5:08PM INF Replay: Done module=consensus
5:08PM INF Timed out dur=3000 height=12 module=consensus round=0 step=RoundStepPropose
Logs on other nodes: (height=11)
5:05PM ERR VerifyVoteExtensionHandler Price=0 height=0 module=server proposer=93a7c8f465b9a42e63a93be16fdaa76e59330eac validator=93a7c8f465b9a42e63a93be16fdaa76e59330eac
5:05PM INF VerifyVoteExtensionHandler Price=3 height=11 module=server proposer=93a7c8f465b9a42e63a93be16fdaa76e59330eac validator=1b0abcf98fb55f7cffa8ff62a90ac101164e979f
5:05PM INF VerifyVoteExtensionHandler Price=3 height=11 module=server proposer=93a7c8f465b9a42e63a93be16fdaa76e59330eac validator=1b0abcf98fb55f7cffa8ff62a90ac101164e979f
5:05PM ERR VerifyVoteExtensionHandler Price=0 height=0 module=server proposer=93a7c8f465b9a42e63a93be16fdaa76e59330eac validator=93a7c8f465b9a42e63a93be16fdaa76e59330eac
... ...
5:05PM ERR VerifyVoteExtensionHandler Price=0 height=0 module=server proposer=93a7c8f465b9a42e63a93be16fdaa76e59330eac validator=93a7c8f465b9a42e63a93be16fdaa76e59330eac
... ...
Activity
liangping commentedon Jun 11, 2025
More details:
If more than 1/3 of the total voting power validators submit invalid data (i.e., their vote extensions do not pass verification), the consensus will also deadlock. Validators will repeatedly verify the same invalid data, causing the chain to stall.
Expected:
If the data is invalid, the protocol should request the sender to reproduce and submit new valid data, instead of repeatedly verifying the same invalid data.
bit2swaz commentedon Mar 5, 2026
before i start working on a fix for this issue, i wanted to clarify the intended scope:
(a) have the proposer call
VerifyVoteExtensionon its own extension before including it, or(b) handle the deadlock recovery path when >1/3 of extensions are rejected?
would be more than happy to work on this once the direction is clear :)
liangping commentedon Mar 8, 2026
I don't think this can be handled at the application level. Currently, verification must return true even when it shouldn't, otherwise there could be a deadlock.
Option (a) seems better and efficient if it works. I was wondering if verification could be performed in pre_vote rather than pre_commit?
bit2swaz commentedon Mar 8, 2026
thanks for the clarification. agreed that this cant be handled at the application level since forcing VerifyVoteExtension to always return true just to avoid deadlock defeats the purpose of the handler entirely
for option (a): the natural insertion point would be right after ExtendVote returns on the proposer, before the precommit containing that extension is broadcast to peers. that way the proposer self-verifies under the same conditions every other validator applies when it receives that precommit, and an invalid self-extension is caught before it ever reaches the network
on the pre-vote question -- if im not wrong, the vote extensions are created at pre-commit time (ExtendVote is called just before sending a non-nil precommit), broadcast with the precommit vote, and then made available to the next height's proposer via PrepareProposal. they dont exist at pre-vote time in the current architecture, so the earliest safe verification point is immediately after extension creation, which is what option (a) does.
ill dig into the relevant code stuff in consensus/state.go and confirm the exact callsite before proposing a fix :)
liangping commentedon Mar 8, 2026
Option B: When this happens, should it skip directly to the next round?
bit2swaz commentedon Mar 9, 2026
round-skipping alone wouldnt fully resolve the deadlock in the >1/3 case. cometbft already advances rounds via timeout when a commit
doesnt complete, but the problem is that validators dont re-run ExtendVote on a round change. instead, they reuse the same extensions from the previous round. so the invalid extensions would persist across rounds and the chain would loop indefinitely rather than make progress
a proper option (b) fix would likely require one of:
this is why option (a) seems cleaner -- if the proposer self-verifies before broadcasting, at least the proposer's own extension is guaranteed valid, which removes one failure vector. the >1/3 byzantine case is a harder problem that likely needs a separate issue and spec discussion
liangping commentedon Mar 9, 2026
I expected that validators should have a chance to re-submit or update their vote extensions when deadlock happens.
Totally agree!
liangping commentedon Mar 9, 2026
Option (a) is an acceptable update in my case.
bit2swaz commentedon Mar 10, 2026
agreed on option (a). ill proceed with that then
the re-submission idea is worth capturing tho. if validators could re-run ExtendVote on a round increment (instead of reusing the previous
round's extension), the >1/3 deadlock scenario becomes self-healing without needing explicit re-request logic.
that could be a follow up issue once we're done here. its anyway a cleaner protocol change than re-requesting from specific peers
will start on the fix. may take a bit as i have exams coming up but ill report back once i have something :)
liangping commentedon Mar 11, 2026
I remember that our ExtendVote uses the latest data from the local cache.
I left the team a while ago and won't be maintaining the repo anymore, so no rush.
bit2swaz commentedon Mar 11, 2026
good point on the cache. if ExtendVote pulls fresh data on each call, rerunning it on a round increment would naturally produce an updated extension without any explicit rerequest logic. that makes the follow up case even cleaner
thanks for the context on the team situation. no worries on timeline
since this touches consensus behavior, ill wait for a maintainer to confirm the option (a) direction before submitting a fix. just want to make sure the approach is aligned before writing code
@aljo242 we could use your help here :)
SillyZir commentedon Apr 8, 2026
Planning to fix the deadlock in
internal/consensusby ensuring a verification failure on the proposer's vote extension triggers a round transition rather than blocking — does that align with the expected recovery path?liangping commentedon Apr 18, 2026
should work in my case.
satyakwok commentedon May 11, 2026
Taking this — bit2swaz claimed in March (exam-blocked) and SillyZir's PR #5792 was closed. Going with Option A as the maintainer-blessed direction.
Plan: in
consensus/state.go::signVote, immediately aftervote.Extension = ext, callcs.blockExec.VerifyVoteExtension(ctx, vote). On non-ACCEPT, panic with a clear message indicating the application'sExtendVoteandVerifyVoteExtensionhandlers are inconsistent — better operator signal than a silent network-wide deadlock.→ PR opened: #5864
consensus: proposer self-verifies its own vote extension before broad…
test(consensus): cover vote extension self-verification (cometbft#5204)
state: skip proposer-priority advance when loading validators on the …
consensus: proposer self-verifies its own vote extension before broad…
consensus: proposer self-verifies its own vote extension before broad…