Skip to content

Four Rounds RBC Implementation#5

Open
thehoul wants to merge 78 commits intomainfrom
rbc
Open

Four Rounds RBC Implementation#5
thehoul wants to merge 78 commits intomainfrom
rbc

Conversation

@thehoul
Copy link
Contributor

@thehoul thehoul commented Apr 10, 2025

Implementation according to algorithm 4 in this paper: https://eprint.iacr.org/2021/777.pdf

@thehoul thehoul marked this pull request as draft April 14, 2025 18:42
@thehoul
Copy link
Contributor Author

thehoul commented Apr 16, 2025

Test implemented summary

Unit

  • Send a PROPOSE message to a node, checks that it answers correctly
  • Send enough ECHO messages to a node, check that it answers correctly after the correct threshold
  • Send enough READY messages to a node after having sent enough ECHO messages, check that it answers correctly after the correct threshold
  • Send enough READY messages to a node before sending enough ECHO messages, check that it answers correctly after the correct threshold

Integration

  • Send a broadcast from a node, and all nodes work fine. Check that all nodes terminate the algorithm, and all agree on the same value.
    t=2, r=2, nbNodes=7 (3*t+1)
  • Send a broadcast from a node, and one node is dead. Check that all nodes terminate the algorithm, and all agree on the same value.
    t=2, r=2, nbNodes=7 (3*t+1)
  • Send a broadcast from a node, and two nodes are dead. Check that all nodes terminate the algorithm, and all agree on the same value.
    t=2, r=2, nbNodes=7 (3*t+1)
  • Send a broadcast from a node, and three nodes are dead. Check that no node terminates the algorithm.
    t=2, r=2, nbNodes=7 (3*t+1)
  • Dealer sends a broadcast and then dies immediately. Check that the algorithm finishes correctly for all other nodes
    t=2, r=2, nbNodes=7 (3*t+1)
  • Dealer sends a broadcast and then is stopped after a short delay. Check that the algorithm finished correctly for all others nodes
    t=2, r=2, nbNodes=7 (3*t+1)
  • Test the Stop method. A node is started with first Listen and after with Broadcast in both cases the node is alone in the network, so nothing will happen. After a short delay, the Stop method is called, and no timeout is expected (i.e. the Listen or Broadcast method was cancelled)
  • Dealer deals, and after some time, a listener node dies. Expect everything to still finish for the other nodes.
    t=2, r=2, nbNodes=7 (3*t+1)
  • Dealer deals, and after some time, two listener nodes die. Expect everything to still finish for the other nodes.
    t=2, r=2, nbNodes=7 (3*t+1)
  • Dealer deals and a single node in the network answers slowly (500 milliseconds delay when reading and writing). Everything should finish correctly for all nodes
    t=2, r=2, nbNodes=7 (3*t+1)
  • Dealer deals and three nodes in the network answer slowly (500 milliseconds delay when reading and writing). Everything should finish correctly for all nodes
    t=2, r=2, nbNodes=7 (3*t+1)
  • Stress test, dealer deals and expect everyone to finish correctly.
    t=20, r=2, nbNodes=61

@pierluca @AnomalRoil What do you think of this test coverage? Can you think of more tests that I should have?

@AnomalRoil
Copy link

One test I would add is:

  • dealer is connected to a single node (no node id dead, but dealer can only talk to one node), check it still works
  • a non-dealer node is connected to a single node (no node is dead again), check it still works

That is: assuming partial connectivity rather than full connectivity.

Copy link

@AnomalRoil AnomalRoil left a comment

Choose a reason for hiding this comment

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

LGTM so far, but I'm a bit confused with all the Message types you have:

  • generic message types
  • concrete message types
  • protobuf message types

Why can't you rely on just the protobuf types and use them directly?

@thehoul thehoul marked this pull request as ready for review April 23, 2025 09:38
@thehoul thehoul force-pushed the rbc branch 4 times, most recently from fd43447 to 5efba0d Compare April 23, 2025 11:56
@thehoul
Copy link
Contributor Author

thehoul commented Apr 23, 2025

Left todo

  • Reed Solomon codes
  • Try to use concurrent maps from Go instead of custom ones
  • Multiple instances test
  • Lint

@thehoul thehoul force-pushed the rbc branch 2 times, most recently from b69ce9f to f5817e1 Compare April 24, 2025 10:29
@thehoul thehoul requested a review from pierluca April 24, 2025 12:03
Copy link

@pierluca pierluca left a comment

Choose a reason for hiding this comment

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

First chunk of review, working my way through the various files :-)
More will come...

Copy link

@AnomalRoil AnomalRoil left a comment

Choose a reason for hiding this comment

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

Here's some comments

package reedsolomon

import (
"github.com/HACKERALERT/infectious"

Choose a reason for hiding this comment

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

Let's avoid pulling that dependency and copy the structs you need instead.

Copy link

@pierluca pierluca May 1, 2025

Choose a reason for hiding this comment

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

Their licensing is clear and compatible, but non-trivial, I'd be very cautious either ways when adjusting the licensing in this repo as well.
https://github.com/HACKERALERT/infectious/blob/master/LICENSE

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll need help to figure out the licensing, I've never done it before!

Comment on lines 227 to 228
b.finished = true
b.value = s

Choose a reason for hiding this comment

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

these look like "writes", are you sure you don't need a b.Lock rather for these?

Comment on lines +157 to +165
func checkReadyThreshold(readyCount, threshold int) bool {
return readyCount > threshold
}

// checkEchoThreshold checks if the number of ECHO messages has
// reached the required threshold
func checkEchoThreshold(echoCount, threshold int) bool {
return echoCount > 2*threshold
}

Choose a reason for hiding this comment

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

do we want >= or > to consider the threshold is reached? I think it depends on whether you talk about the threshold of malicious parties, as in 3f+1 for at most f malicious, and then you want at least 2f+1, or if we are talking about the threshold t of required messages in which case I think >= is more correct.

Opinion?

// Config
network := networking.NewFakeNetwork()
threshold := 1
nbNodes := 3*threshold + 1

Choose a reason for hiding this comment

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

looks like this answers my previous comment, but you might want to document you're talking about the threshold of malicious parties f whenever you say threshold somewhere in the documentation.

thehoul added a commit that referenced this pull request Jan 12, 2026
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.

3 participants