Skip to content

feat(CCHAIN-740): Implement validator proof protocol per ADR-006#1450

Open
ancazamfir wants to merge 15 commits intocirclefin:mainfrom
ancazamfir:validator-proof
Open

feat(CCHAIN-740): Implement validator proof protocol per ADR-006#1450
ancazamfir wants to merge 15 commits intocirclefin:mainfrom
ancazamfir:validator-proof

Conversation

@ancazamfir
Copy link
Contributor

@ancazamfir ancazamfir commented Feb 4, 2026

Implementation of #1436

Uses libp2p-stream protocol to satisfy the protocol spec and as proposed by @romac

/// signature verification without needing to look up the public key from the
/// validator set.
#[derive_where(Clone, Debug, PartialEq, Eq)]
pub struct ValidatorProof<Ctx: Context> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just familiarizing myself with the ADR and this implementation: Do we need to version this data type? Seems to go through the wire unversioned.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently I use the same approach as for sync and consensus, using protocol names that have version in their names. Haven't added it to defaults yet. But if two nodes use different versions, streams will not be established.
Currently hardcoded with:

pub const PROTOCOL_NAME: StreamProtocol = StreamProtocol::new("/malachitebft-validator-proof/v1")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ancazamfir ancazamfir marked this pull request as ready for review February 27, 2026 22:44
@ancazamfir ancazamfir requested a review from romac as a code owner February 27, 2026 22:44
@ancazamfir
Copy link
Contributor Author

ancazamfir commented Feb 28, 2026

For testing I used the example/channel app, init and started nodes wiht testnet_manager.bash script.
Current settings in the script:

    export MALACHITE__CONSENSUS__P2P__PROTOCOL__TYPE="gossipsub"
    export MALACHITE__CONSENSUS__P2P__PROTOCOL__ENABLE_PEER_SCORING="false"
    export MALACHITE__VALIDATOR_ROTATION__ENABLED="true"
    export MALACHITE__VALIDATOR_ROTATION__ROTATION_PERIOD="10"
    export MALACHITE__VALIDATOR_ROTATION__SELECTION_SIZE="3"
    export MALACHITE__CONSENSUS__P2P__PROTOCOL__ENABLE_EXPLICIT_PEERING="false"
    export MALACHITE__CONSENSUS__P2P__PROTOCOL__ENABLE_FLOOD_PUBLISH="true"

With these settings the validator set rotates every 10 heights and 3 validators are selected from the validators crates.

Testing uses the metrics to determine node classification, for this PR the validator vs persistent or full-node is of interest. Used check_mesh_vals.py to get and process the metrics.

  • init and start the nodes
./scripts/testnet_manager.bash init --validators 5 --full-nodes 10 --home nodes
./scripts/testnet_manager.bash start --nodes all --home node
  • check the node types, verify that every 10 heights the nodes are properly (re)classified after validator rotation
...
Moniker         Type         Cons  Prop  Live  Expl  Peers  InPeers  OutPeers  Conns  InConns  OutConns
-----------------------------------------------------------------------------------------------------------------------------
app-1           validator    11    11    11    0     11     7        4         15     11       4
app-2           validator    10    8     11    0     11     7        4         15     11       4
app-3           validator    6     11    7     0     11     7        4         15     11       4
-----------------------------------------------------------------------------------------------------------------------------
app-0           persistent   11    11    11    0     11     7        4         15     11       4
app-4           persistent   10    7     8     0     11     7        4         15     11       4
-----------------------------------------------------------------------------------------------------------------------------
app-10          full_node    4     4     4     0     5      0        5         5      0        5
app-11          full_node    4     4     4     0     5      0        5         5      0        5
app-5           full_node    4     4     4     0     5      0        5         5      0        5
app-6           full_node    4     4     4     0     5      0        5         5      0        5
app-7           full_node    4     4     4     0     5      0        5         5      0        5
app-8           full_node    4     4     4     0     5      0        5         5      0        5
app-9           full_node    4     4     4     0     5      0        5         5      0        5

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants