Commit c765903
authored
Removed hard-coded constant in
## Summary
Remove a hardcoded constant in sortition.go which was
used as the denominator in determining the selection ratio.
This clarifies what the maximum possible output size is of
the output VRF based on the SHA algorithm used to generate it.
## Purpose
This is simply a code quality change to make it easier to read and
understand without any focus on new functionality or performance.
It is unlikely that the VRF SHA length used by Algorand will changed,
so the generalization to a dynamic length based on the length of the
Crypto digest is only for the reader.
The use of an `init` function to initialize the `maxFloat` once rather than
anytime `sortition` runs is a minor optimization, but likely to be neglibile
in the grand scheme of things.
## Test Plan
Due to the usage of C src code, a simple `go test -v ./data/committee/sortition/`
cannot be executed without the proper configurations. However, circle CI
should be able to execute the unit tests automatically and verify the changes.
Recommendation: Running the recommended make targets to test the changes
did not automatically due to missing dependencies, so potentially a Dockerfile
could help resolve this for future contributors.sortition.go. (#3558)1 parent f0b85f6 commit c765903
1 file changed
+19
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
| 27 | + | |
26 | 28 | | |
| 29 | + | |
27 | 30 | | |
28 | 31 | | |
29 | 32 | | |
30 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
31 | 38 | | |
32 | 39 | | |
33 | 40 | | |
| |||
36 | 43 | | |
37 | 44 | | |
38 | 45 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
50 | | - | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
0 commit comments