Skip to content

abci: Consensus Deadlock Caused by Proposer Vote Extension Verification Failure #5204

Closed

Description

@liangping

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
... ...

dump_consensus_state output

Anything else we need to know

Activity

  1. added
    bug
    needs-triage
    on Jun 10, 2025
  2. liangping commented on Jun 11, 2025

    @liangping
    Author

    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.

  3. bit2swaz commented on Mar 5, 2026

    @bit2swaz
    Contributor

    before i start working on a fix for this issue, i wanted to clarify the intended scope:

    1. is this considered a cometbft level bug, or is it expected that applications ensure their own extensions pass verification?
    2. if it is cometbft's responsibility, should the fix be:
      (a) have the proposer call VerifyVoteExtension on 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 :)

  4. liangping commented on Mar 8, 2026

    @liangping
    Author

    is this considered a cometbft level bug, or is it expected that applications ensure their own extensions pass verification?

    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.

    if it is cometbft's responsibility, should the fix be:
    (a) have the proposer call VerifyVoteExtension on its own extension before including it, or
    (b) handle the deadlock recovery path when >1/3 of extensions are rejected?

    Option (a) seems better and efficient if it works. I was wondering if verification could be performed in pre_vote rather than pre_commit?

  5. bit2swaz commented on Mar 8, 2026

    @bit2swaz
    Contributor

    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 :)

  6. liangping commented on Mar 8, 2026

    @liangping
    Author

    Option B: When this happens, should it skip directly to the next round?

  7. bit2swaz commented on Mar 9, 2026

    @bit2swaz
    Contributor

    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:

    • allowing the proposer to explicitly exclude extensions that fail VerifyVoteExtension from the proposal at the next height, or
    • re-requesting extensions from validators whose extensions were rejected, which is a significant protocol change

    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

  8. liangping commented on Mar 9, 2026

    @liangping
    Author

    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

    I expected that validators should have a chance to re-submit or update their vote extensions when deadlock happens.

    re-requesting extensions from validators whose extensions were rejected, which is a significant protocol change

    Totally agree!

  9. liangping commented on Mar 9, 2026

    @liangping
    Author

    Option (a) is an acceptable update in my case.

  10. bit2swaz commented on Mar 10, 2026

    @bit2swaz
    Contributor

    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 :)

  11. liangping commented on Mar 11, 2026

    @liangping
    Author

    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.

    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.

  12. bit2swaz commented on Mar 11, 2026

    @bit2swaz
    Contributor

    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 :)

  13. SillyZir commented on Apr 8, 2026

    @SillyZir

    Planning to fix the deadlock in internal/consensus by 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?

  14. liangping commented on Apr 18, 2026

    @liangping
    Author

    Planning to fix the deadlock in internal/consensus by 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?

    should work in my case.

  15. satyakwok commented on May 11, 2026

    @satyakwok
    Contributor

    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 after vote.Extension = ext, call cs.blockExec.VerifyVoteExtension(ctx, vote). On non-ACCEPT, panic with a clear message indicating the application's ExtendVote and VerifyVoteExtension handlers are inconsistent — better operator signal than a silent network-wide deadlock.

    → PR opened: #5864

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugneeds-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions