Skip to content

Comm Component for Simplex #3998

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open

Comm Component for Simplex #3998

wants to merge 30 commits into from

Conversation

samliok
Copy link
Contributor

@samliok samliok commented Jun 5, 2025

Why this should be merged

The Comm interface is used by simplex to send and broadcast messages. This PR builds off pr #3993 and should be merged after

How this works

This PR adds two new fields to the Config struct—Sender and OutboundMsgBuilder—which enable the Simplex engine to construct and send outbound messages to other nodes.

How this was tested

Using generated mocks for ExternalSender and OutboundMessageBuilder, I added tests in comm_test to verify that the correct messages are sent the expected number of times.

Need to be documented in RELEASES.md?

No

@Copilot Copilot AI review requested due to automatic review settings June 5, 2025 21:33
@samliok samliok requested a review from StephenButtolph as a code owner June 5, 2025 21:33
@samliok samliok marked this pull request as draft June 5, 2025 21:33
Copy link
Contributor

@Copilot 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 introduces the communication component for Simplex by adding new fields to the Config struct and implementing a Comm type for sending and broadcasting messages among validators. Key changes include:

  • Adding new Config fields (Sender and OutboundMsgBuilder) to support message construction and delivery.
  • Implementing Comm with methods for SendMessage and Broadcast.
  • Updating tests and mocks to validate the communication flow and BLS signing functionality.

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
simplex/test_utils.go Added test utilities for validator info and engine config
simplex/config.go Extended Config struct to include Sender and MsgBuilder
simplex/comm_test.go Added tests for Comm functionality and error conditions
simplex/comm.go Implemented Comm with SendMessage and Broadcast methods
simplex/bls_test.go, simplex/bls.go Added BLS authentication with signing and verification
message/simplex_outbound_msg_builder.go Added Simplex-specific outbound message builder functions
message/outbound_msg_builder.go Integrated Simplex builder into general outbound messaging
message/messagemock/outbound_message_builder.go Updated mocks with Simplex message methods
go.mod Updated dependency for simplex package

@samliok samliok self-assigned this Jun 6, 2025
@samliok samliok changed the base branch from master to simplex-bls June 9, 2025 16:56
@@ -181,6 +181,8 @@ type OutboundMsgBuilder interface {
chainID ids.ID,
msg []byte,
) (OutboundMessage, error)

SimplexOutboundMessageBuilder
Copy link
Contributor Author

Choose a reason for hiding this comment

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

rather than bloating this file up, i thought it would be cleaner to separate the simplex outbound messages into their own file

@samliok samliok marked this pull request as ready for review June 9, 2025 18:40
@samliok samliok requested a review from maru-ava as a code owner June 12, 2025 19:24
@maru-ava maru-ava removed their request for review June 13, 2025 11:47
@samliok samliok moved this to In Progress 🏗️ in avalanchego Jun 16, 2025
Base automatically changed from simplex-bls to master June 17, 2025 17:57
@@ -181,6 +181,8 @@ type OutboundMsgBuilder interface {
chainID ids.ID,
msg []byte,
) (OutboundMessage, error)

SimplexOutboundMessageBuilder
}

type outMsgBuilder struct {
Copy link
Contributor

@yacovm yacovm Jun 18, 2025

Choose a reason for hiding this comment

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

Unrelated to this PR, but I have to say I am not sure I understand why this is an un-exported struct. it Makes it impossible to use anywhere in the code (for tests) and we also have only one concrete implementation of it.

@StephenButtolph do you know why?

"github.com/ava-labs/avalanchego/utils/set"
)

var errNodeNotFound = errors.New("node not found in the validator list")
Copy link
Contributor

Choose a reason for hiding this comment

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

can we emphasize that it is our node that is not found?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added to the error where it was being returned, so this err could potentially be reused

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress 🏗️
Development

Successfully merging this pull request may close these issues.

2 participants