Skip to content

Comments

network: disable libp2p message signing#203

Merged
jking-aus merged 2 commits intosigp:unstablefrom
nkryuchkov:libp2p-disable-message-signing
Mar 21, 2025
Merged

network: disable libp2p message signing#203
jking-aus merged 2 commits intosigp:unstablefrom
nkryuchkov:libp2p-disable-message-signing

Conversation

@nkryuchkov
Copy link
Contributor

Issue Addressed

SSV node rejects messages from Anchor on libp2p level with the unexpected signature error:

{"level":"\u001b[35mDEBUG\u001b[0m","time":"2025-03-20T17:49:22.143585Z","name":"P2PNetwork.PubsubTrace","msg":"pubsub event","selfPeer":"16Uiu2HAkvNzRHEEwS8He6iF7esFCBN4nPWsswjVJRPByPjH4sDdh","type":"REJECT_MESSAGE","receivedFrom":"16Uiu2HAmPamdZidzgF47ZqCTCYQ6Lp6nxHtRs64ccFuu2VAChdiZ","msgID":"baea56cec621b52300000000","topic":"ssv.v2.84","reason":"unexpected signature"}

Proposed Changes

Disable message signing on the libp2p level by setting MessageAuthenticity to Anonymous

Additional Info

SSV node disables signing on the libp2p level because its messages have a payload with signature: https://github.com/ssvlabs/ssv/blob/v2.2.0/network/topics/pubsub.go#L138

This allows choosing a signing scheme that's appropriate in terms of resource consumption.

@diegomrsantos
Copy link
Member

@nkryuchkov Thank you for opening this PR. Should we also change the validation to this https://docs.rs/libp2p-gossipsub/latest/libp2p_gossipsub/enum.ValidationMode.html#variant.Anonymous?

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR disables libp2p message signing to address unexpected signature errors by configuring the gossipsub behaviour to use anonymous message authenticity rather than signing messages.

  • Replace MessageAuthenticity::Signed with MessageAuthenticity::Anonymous
  • Update gossipsub configuration in the network component
Comments suppressed due to low confidence (1)

anchor/network/src/network.rs:364

  • [nitpick] Since 'local_keypair' is no longer used with the new anonymous configuration, consider removing the cloning or the variable itself if it isn’t required elsewhere.
-        gossipsub::Behaviour::new(MessageAuthenticity::Signed(local_keypair.clone()), config)

@nkryuchkov
Copy link
Contributor Author

@nkryuchkov Thank you for opening this PR. Should we also change the validation to this https://docs.rs/libp2p-gossipsub/latest/libp2p_gossipsub/enum.ValidationMode.html#variant.Anonymous?

I agree. Although Permissive should work too, Anonymous would match the SSV node behavior. Changed

Copy link
Member

@diegomrsantos diegomrsantos left a comment

Choose a reason for hiding this comment

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

LGTM, thanks again!

Copy link
Member

@jking-aus jking-aus left a comment

Choose a reason for hiding this comment

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

lgtm thanks

@jking-aus jking-aus merged commit fd74cae into sigp:unstable Mar 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants