-
Notifications
You must be signed in to change notification settings - Fork 0
Four Rounds RBC Implementation #5
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
thehoul
wants to merge
78
commits into
main
Choose a base branch
from
rbc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
78 commits
Select commit
Hold shift + click to select a range
e6d1cc0
add node struct
thehoul e37dfd6
RBC bracha
thehoul 3afae1b
Fix Bracha RBC implementation and add single test
thehoul 44211ae
Four rounds RBC skeleton
thehoul 932bba3
renaming 4-Round RBC class
thehoul 2e42277
Redefine RBC interface and adapt BrachaRBC. Also add a message interface
thehoul 1601516
temp: try to implement 4RoundsRBC
thehoul ae821b6
move bracha to its own folder
thehoul a915f24
add custom data structures
thehoul 777751f
move and implement RS code
thehoul d747aa8
update RBC interface
thehoul 31cdc6d
export message types to their own file and create protobuf structure
thehoul 6b622b2
move fourround RBC to its own file and implement
thehoul 3fa7549
Temporarily add very basic RS codes and sanity test
thehoul 8790006
remove useless structures
thehoul 6f54cf9
finish 4RoundsRBC implementation and add unit and a simple "everythin…
thehoul 6b6c042
Add 4RoundRBC test with dead nodes
thehoul 6171b25
Remove avss files that should not have been here in the first place
thehoul 34d8e65
Add dying dealer test
thehoul 37d5c31
Change logger and allow disabling
thehoul f62bec1
Add stop channel to receive methods to allow halting
thehoul d799cbd
Create rbc_test.yml in branch RBC
thehoul aa578e0
Change received name for 4Round RBC to f
thehoul 6e0f92d
fix code analysis warnings
thehoul 9ed464c
Update rbc_test.yml
thehoul 640aa73
Update rbc_test.yml
thehoul f43446a
rename Bracha test
thehoul d63606d
Add locks to prevent concurrency issues with received and sent arrays
thehoul 7f8edde
Add timeout in RBC test action
thehoul 4187879
add log message
thehoul b4c53bf
remove ConcurrentMaps
thehoul 7e88edb
update RS codes to use Berlekamp-Welch
thehoul eb90363
removed messages.go
thehoul 2856699
remove generic type to 4 rounds RBC
thehoul 31a8201
remove generic from RBC interface and remove useless InstanceID type
thehoul fcf661b
change to pass contexts as discussed in meeting
thehoul 92f5f21
fix fake_network test and data races
thehoul b145b0a
fix lint
thehoul 35a17af
fix warnings and deprecated gomnd
thehoul 6910234
fix type check in test
thehoul 99b14ae
fix PR reviews
thehoul f07af03
fix lint
thehoul a0bb7bc
use clearer names in message.proto for 4Rounds RBC
thehoul 60573d3
rename bracha and 4rounds to rbc because their package name already r…
thehoul 4f91fc5
add node struct
thehoul 7be11ca
adapt 4rounds RBC test to the new networking
thehoul 47d66ba
fix lint
thehoul 3fac02e
add test on UDP with small network
thehoul 1925e6b
fix lint
thehoul 1d4ff43
get logger from logging package
thehoul da6b3b7
reduce logging
thehoul cd711d6
change reed solomon interface to use pointers
thehoul b7ed2a2
send one broadcast with all shares instead of one broadcast for each
thehoul 3633890
add benchmark test to get data
thehoul 36e5016
fix lint
thehoul b21deab
fix RBC receive READY tests
thehoul 58a1487
remove weird mutex in networking
thehoul 0a33218
update benchmark csv
thehoul fac86fd
fix lint
thehoul 7b14600
remove unused r in 4Rounds RBC
thehoul 1f4f31e
add benchmark
thehoul 04fc272
fix lint
thehoul 0d0c151
multi RBC - stress tests don't pass
thehoul 5c9a5fb
fix lint
thehoul 32d434c
Better channel handling
thehoul 149861c
of course I forgot to fix lint
thehoul 7b1af3f
add multiple instances test
thehoul 3baa8dc
update Bracha implementation to new interface
thehoul 651e2f7
Update RBC interface
thehoul 3273df5
add Instance interface to RBC
thehoul de290d8
add node struct
thehoul bc9e380
add padding for message of size different from multiple of threshold+1
thehoul f7b9951
make RBC broadcast return the instance created
thehoul 6d208b0
add GetInstances and SetPredicate to the RBC interface
thehoul 9f5aca4
udpate test benchmark to add message bytes count
thehoul 083b609
fix lint
thehoul 0df4d66
fix tests and skip benchmark
thehoul ee1c3f8
simplify test
thehoul File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| name: RBC Test | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| pull_request: | ||
| types: | ||
| - opened | ||
| - synchronize | ||
| - reopened | ||
| jobs: | ||
| test: | ||
| strategy: | ||
| matrix: | ||
| platform: [ubuntu-latest, windows-latest, macos-latest] | ||
| runs-on: ${{matrix.platform}} | ||
| env: | ||
| LLVL: trace | ||
| steps: | ||
| - name: Use Go = 1.23 | ||
| uses: actions/setup-go@v3 | ||
| with: | ||
| go-version: '=1.23' | ||
| id: go | ||
|
|
||
| - name: Check out code into the Go module directory | ||
| uses: actions/checkout@v3 | ||
|
|
||
| # Install gotestfmt on the VM running the action. | ||
| - name: Set up gotestfmt | ||
| uses: gotesttools/gotestfmt-action@v2 | ||
| with: | ||
| # Pass GITHUB_TOKEN to avoid rate limiting. | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Create temp directory | ||
| run: | | ||
| mkdir -p ./${{ github.run_attempt }} | ||
|
|
||
| - name: run RBC Bracha tests | ||
| run: go test -json -v -race ./rbc/bracha/... | gotestfmt | ||
|
|
||
| - name: run RBC FourRounds tests | ||
| run: go test -json -timeout 20m -v -race ./rbc/fourrounds/... | gotestfmt |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| syntax='proto3'; | ||
| package typedefs; | ||
| option go_package ='./typedefs'; | ||
|
|
||
| message RBCMessage{ | ||
| message Propose{ | ||
| bytes content=1; | ||
| } | ||
|
|
||
| message Echo{ | ||
| repeated bytes encodingShares=1; | ||
| bytes messageHash=2; | ||
| repeated int64 sharesIndices=3; | ||
| } | ||
|
|
||
| message Ready{ | ||
| bytes encodingShare=1; | ||
| bytes messageHash=2; | ||
| int64 index=3; | ||
| } | ||
|
|
||
| oneof op{ | ||
| Propose propose_inst=1; | ||
| Echo echo_inst=2; | ||
| Ready ready_inst=3; | ||
| } | ||
| } | ||
|
|
||
| message Packet { | ||
| oneof message { | ||
| RBCMessage rbcMessage=1; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| package networking | ||
|
|
||
| import ( | ||
| "context" | ||
| "errors" | ||
| "student_25_adkg/logging" | ||
| "student_25_adkg/typedefs" | ||
| "sync" | ||
|
|
||
| "github.com/rs/zerolog" | ||
| "google.golang.org/protobuf/proto" | ||
| ) | ||
|
|
||
| type Callback func(*typedefs.Packet) error | ||
|
|
||
| type Node struct { | ||
| iface NetworkInterface | ||
| callback Callback | ||
| logger zerolog.Logger | ||
| sync.Mutex | ||
| } | ||
|
|
||
| func NewNode(iface NetworkInterface) *Node { | ||
| return &Node{ | ||
| iface: iface, | ||
| logger: logging.GetLogger(iface.GetID()), | ||
| } | ||
| } | ||
|
|
||
| func (n *Node) Start(ctx context.Context) error { | ||
| for { | ||
| bs, err := n.iface.Receive(ctx) | ||
| if err != nil { | ||
| if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) { | ||
| return err | ||
| } | ||
| } | ||
|
|
||
| err = n.handleMessage(bs) | ||
| if err != nil { | ||
| n.logger.Error().Err(err).Msg("failed to handle message") | ||
| } | ||
|
|
||
| } | ||
| } | ||
|
|
||
| func (n *Node) handleMessage(message []byte) error { | ||
| packet := &typedefs.Packet{} | ||
| err := proto.Unmarshal(message, packet) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| return n.callback(packet) | ||
| } | ||
|
|
||
| func (n *Node) SetCallback(callback Callback) { | ||
| n.Lock() | ||
| defer n.Unlock() | ||
| n.callback = callback | ||
| } | ||
|
|
||
| func (n *Node) Broadcast(packet *typedefs.Packet) error { | ||
| bs, err := proto.Marshal(packet) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| return n.iface.Broadcast(bs) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| package bracha | ||
|
|
||
| type Message struct { | ||
| MsgType MessageType | ||
| Content bool | ||
| } | ||
|
|
||
| func NewBrachaMessage(msgType MessageType, content bool) *Message { | ||
| return &Message{ | ||
| MsgType: msgType, | ||
| Content: content, | ||
| } | ||
| } | ||
|
|
||
| type MessageType uint32 | ||
|
|
||
| const ( | ||
| PROPOSE MessageType = iota | ||
| ECHO | ||
| READY | ||
| ) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.