Skip to content

privval: better handling of remote signer errors #5459

Open

Description

@tony-iqlusion

Bug Report

Setup

CometBFT version (use cometbft version or git rev-parse --verify HEAD if installed from source): v0.38.19

Have you tried the latest version: no (but doubtful anything has changed)

ABCI app (name for built-in, URL for self-written if it's publicly available): noble (but also neutron, pretty much every other chain)

Environment: N/A

Config

priv_validator_laddr = "<address of TMKMS>"

What happened?

See also: #850 (comment)

Often during chain upgrades there will be a need to roll back a validator node for whatever reason. When this happens, remote signers like TMKMS detect double signing, and return a RemoteSignerError proto. TMKMS sets the code field of this proto to 2.

When CometBFT receives such a response, it seemingly aborts the connection. This is what appears in logs:

This makes it extremely difficult for validators using remote signers to catch up when there are a large number of rounds or if they ever have to repeatedly restart, because validators in such a configuration are very slow to advance rounds as they're constantly re-establishing the privval conneciton.

What did you expect to happen?

CometBFT handles the error without dropping the entire privval connection.

How to reproduce it

This issue only comes up during chain upgrades where some other problem is occurring which causes the chain to halt and get into a state where there are a large number of rounds waiting for the chain to come to consensus. It's very difficult to reproduce, I'm sorry.

As a more minimal case, you could create a remote signer, proxy a remote signer, or modify a remote signer to occasionally emit RemoteSignerError and observe the behavior.

Logs

NOTE: I am confused by the Ping timeout? Perhaps there's something out-of-sequence between requests and responses.

{"level":"info","module":"server","module":"privval","time":"2025-10-14T16:35:59Z","message":"SignerListener: Listening for new connection"}
{"level":"error","module":"server","module":"privval","time":"2025-10-14T16:35:59Z","message":"SignerListener: Ping timeout"}
{"level":"info","module":"server","module":"privval","time":"2025-10-14T16:35:59Z","message":"SignerListener: Blocking for connection"}
{"level":"info","module":"server","module":"privval","time":"2025-10-14T16:36:00Z","message":"SignerListener: Connected"}
{"level":"info","module":"server","module":"privval","time":"2025-10-14T16:36:00Z","message":"SignerListener: Listening for new connection"}
{"level":"info","module":"server","module":"privval","time":"2025-10-14T16:36:01Z","message":"SignerListener: Blocking for connection"}
{"level":"info","module":"server","module":"privval","time":"2025-10-14T16:36:02Z","message":"SignerListener: Connected"}
{"level":"info","module":"server","module":"privval","time":"2025-10-14T16:36:02Z","message":"SignerListener: Listening for new connection"}

dump_consensus_state output

Can provide if helpful but it's 275kB and not easy to post in this issue.

Anything else we need to know

Separately I had suggested in a hypothetical future gRPC interface that the remote signer be able to communicate the last known round height so the validator can automatically catch up in such cases:

Activity

  1. added
    bug
    needs-triage
    on Oct 14, 2025
  2. linear commented on Oct 14, 2025

    @linear
  3. pyoxa commented on Oct 14, 2025

    @pyoxa

    can you share more logs and the setup? in https://github.com/ChorusOne/nebula, when returning a RemoteSignerError, e.g on step regression, the connection isn't dropped.
    fwiw, nebula sets Code to 1, but I would be surprised if the code was used anywhere but logs

  4. tony-iqlusion commented on Oct 14, 2025

    @tony-iqlusion
    Author

    I'm not sure what additional information would be helpful here regarding the logs and setup. This occurred on a production validator which makes it difficult to do things like adjust log levels or provide further investigation, as I'm waiting for it to catch up with the rest of the network.

    The best I can do is try adjusting the error code that TMKMS sends back and see if that helps in some way the next time this happens.

  5. pyoxa commented on Oct 14, 2025

    @pyoxa

    no, again, I doubt that (adjusting the error code) would be helpful. I asked for logs/setup because that would help checking for any differences between the signers.
    See this one (1 signer-multiple validators setup):

     5:11PM INF received complete proposal block hash=7F1B1D1CA5A449456A72A3FD3DE3924B8A01A160DBEBA8D2FB0DAB45513775C4 height=16440221 module=consensus server=node
     5:11PM ERR failed signing vote err="signerEndpoint returned error #1: Would double-sign vote at same height/round" height=16440221 module=consensus round=0 server=node vote="Vote{8:6D0E9860EF27 16440221/00/SIGNED_MSG_TYPE_PRECOMMIT(Precommit) 7F1B1D1CA5A4 000000000000 000000000000 @ 2025-10-14T17:11:47.082628505Z}"
     5:11PM INF finalizing commit of block hash=7F1B1D1CA5A449456A72A3FD3DE3924B8A01A160DBEBA8D2FB0DAB45513775C4 height=16440221 module=consensus num_txs=1 root=35713FEE794813ABEEB3D7C5D0AEFB6A1B72DE021FF2D430DCF0409D038B72E7 server=node
     5:11PM INF finalized block block_app_hash=23CE2F69BEB67845E6A762B7CEC28BBE056A5F74681C0CC455E529241B548395 height=16440221 module=state num_txs_res=1 num_val_updates=0 server=node
    

    no reconnection happened, the remote signer is connected via tcp on xpla, which is using cometbft v0.38.17

  6. tony-iqlusion commented on Oct 14, 2025

    @tony-iqlusion
    Author

    This is potentially pointing to some kind of TMKMS issue then, but I'm very confused because the error handling in TMKMS uses the exact same codepath it uses to write every other response as a protobuf, it simply writes a RemoteSignerError in that case.

    On the CometBFT side, I am seeing a few loglines with failed signing vote:

    {"level":"error","module":"server","module":"consensus","height":36887001,"round":3,"vote":"Vote{10:9814A41D7ADE 36887001/03/SIGNED_MSG_TYPE_PRECOMMIT(Precommit) 000000000000 000000000000 000000000000 @ 2025-10-14T16:03:51.456629748Z}","err":"exhausted all attempts to sign vote: write tcp [REDACTED]: write: broken pipe: endpoint write timed out","time":"2025-10-14T16:04:14Z","message":"failed signing vote"}
    {"level":"error","module":"server","module":"consensus","height":36887001,"round":4,"vote":"Vote{10:9814A41D7ADE 36887001/04/SIGNED_MSG_TYPE_PREVOTE(Prevote) BD0B9383FDAD 000000000000 000000000000 @ 2025-10-14T16:04:14.3968218Z}","err":"exhausted all attempts to sign vote: EOF","time":"2025-10-14T16:04:38Z","message":"failed signing vote"}
  7. pyoxa commented on Oct 14, 2025

    @pyoxa

    This is potentially pointing to some kind of TMKMS issue then

    potentially yes, but this is a huge dissonance for me, because it would probably have to be on the transport level, rather than the response crafting.
    I would have to dive deeper and make sure that my signer and your signer are put in the exact same situations -- will try to get back to this tomorrow eu time

  8. pyoxa commented on Oct 15, 2025

    @pyoxa

    this indeed looks like some issue with the transport, when returning a RemoteSignerError, you shouldn't even be getting into the codepath that logs exhausted all attempts to sign vote. It should return on the first non-nil resp.Error.

    Looking at the code on either side, I don't see anything obvious, but fortunately it should be pretty easy to reproduce

  9. tony-iqlusion commented on Oct 17, 2025

    @tony-iqlusion
    Author

    @tschuyebuhl is there anything about the framing of error responses which is different from other responses? TMKMS is just writing a proto::privval::Message regardless of success or failure

  10. tony-iqlusion commented on Nov 21, 2025

    @tony-iqlusion
    Author

    I've seen reports these errors seem to be working correctly with TMKMS on the Celestia v6 upgrade, which uses CometBFT v0.38.17:

    ERR failed signing vote err="signerEndpoint returned error #2: double signing requested at height: 8490323"
    

    ...so perhaps the issue was corrected at some point?

    I guess it needs to be confirmed this is still the case in the specific scenario of a chain failing to come to consensus and there being a round conflict.

    Edit: except the problem was occurring with CometBFT v0.38.19 with noble, so I guess it's working in some cases and not others?

  11. pyoxa commented on Nov 21, 2025

    @pyoxa

    celestia is using a fork, right? and the v6 upgrade will come online only on monday

  12. tony-iqlusion commented on Nov 21, 2025

    @tony-iqlusion
    Author

    Yes, they're using a fork:

    #0: - github.com/cometbft/[email protected] => github.com/celestiaorg/[email protected]
    

    Though the upgrade isn't online yet, most validators are running the new binary which signals readiness for the upgrade.

  13. pyoxa commented on Nov 21, 2025

    @pyoxa

    I forgot, but Celestia also had the multiplexer, didn't it? That would activate the "new" binary automatically? So currently they would still be on whatever was in v5, or does it not work like this?

  14. tony-iqlusion commented on Nov 21, 2025

    @tony-iqlusion
    Author

    Yeah, I'm a bit unclear how it all works, but it does indeed have a multiplexer.

    That said, I think it's interesting to see that there are some cases where CometBFT is interpreting the error response correctly from TMKMS.

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