Skip to content

Commit

Permalink
Final Feedback (#21)
Browse files Browse the repository at this point in the history
* Empty branch

* Simplify loop conditional

* Add quorum optimal helper to test

* Remove newlines

* Expand abbreviation:

* Change SubscriptionDetails field

* add common proposal validation method

* Change variable name in log

* Change variable name in log

* Add syntax sugar for transport multicasts

* Add simple start method for state

* Add log for invalid proposal

* Change naming of routine method

* Simplify block preprepare acceptance

* Add explainer for loop iteration

* Add to barrier before starting the routine

* Have the barrier increase right before the go routines

* Make the conditional for subscription pushes more clear

* Fix conditional for higher rounds
  • Loading branch information
zivkovicmilos authored Jul 29, 2022
1 parent f0abb68 commit 0f95a9c
Show file tree
Hide file tree
Showing 11 changed files with 305 additions and 209 deletions.
16 changes: 10 additions & 6 deletions core/consensus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
func generateNodeAddresses(count int) [][]byte {
addresses := make([][]byte, count)

for index := 0; index < count; index++ {
for index := range addresses {
addresses[index] = []byte(fmt.Sprintf("node %d", index))
}

Expand Down Expand Up @@ -291,16 +291,20 @@ func TestConsensus_InvalidBlock(t *testing.T) {
return uint64((nodeCount - 1) / 3)
}

quorumOptimal := func(numNodes int) uint64 {
if maxFaulty(numNodes) == 0 {
return uint64(numNodes)
}

return uint64(math.Ceil(2 * float64(numNodes) / 3))
}

// commonBackendCallback is the common method modification required
// for the Backend, for all nodes
commonBackendCallback := func(backend *mockBackend, nodeIndex int) {
// Make sure the quorum function is Quorum optimal
backend.quorumFn = func(_ uint64) uint64 {
if maxFaulty(numNodes) == 0 {
return uint64(numNodes)
}

return uint64(math.Ceil(2 * float64(numNodes) / 3))
return quorumOptimal(numNodes)
}

// Make sure the allowed faulty nodes function is accurate
Expand Down
Loading

0 comments on commit 0f95a9c

Please sign in to comment.