-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix exponentialBackoffer overflowing into negative, bump protocol ver…
…sion (#516) * Fix exponentialBackoffer overflowing into negative Signed-off-by: Jakub Sztandera <[email protected]> * Bump protocol version Signed-off-by: Jakub Sztandera <[email protected]> * Bump default protocol version Signed-off-by: Jakub Sztandera <[email protected]> * Bump version Signed-off-by: Jakub Sztandera <[email protected]> --------- Signed-off-by: Jakub Sztandera <[email protected]>
- Loading branch information
Showing
4 changed files
with
26 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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 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,18 @@ | ||
package gpbft | ||
|
||
import ( | ||
"testing" | ||
"time" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func Test_exponentialBackoffer(t *testing.T) { | ||
maxBackoff := 30 * time.Second | ||
backoffer := exponentialBackoffer(1.3, 3*time.Second, maxBackoff) | ||
for i := 0; i < 10_000; i++ { | ||
backoff := backoffer(i) | ||
require.Positivef(t, backoff, "at %d", i) | ||
require.LessOrEqualf(t, backoff, maxBackoff, "at %d", i) | ||
} | ||
} |
This file contains 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 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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"version": "v0.0.5" | ||
"version": "v0.0.6" | ||
} |