Import libsodium (Algorand's VRF lib) into Tendermint#12
Merged
Conversation
zemyblue
reviewed
Jan 10, 2020
| @@ -0,0 +1,125 @@ | |||
| // This vrf package makes the VRF API in Algorand's libsodium C library available to golang. | |||
Contributor
There was a problem hiding this comment.
How about adding our license comment?
Contributor
Author
There was a problem hiding this comment.
Then we need to decide on a license declaration for our new files. I'll save it as another discussion ticket.
crypto/vrf/internal/vrf/vrf.go
Outdated
|
|
||
| const OUTPUTBYTES = uint32(C.crypto_vrf_OUTPUTBYTES) | ||
|
|
||
| const PRIMITIVE = C.crypto_vrf_PRIMITIVE |
Contributor
There was a problem hiding this comment.
How about collecting all similar constant values like below?
const (
PUBLICKEYBYTES = uint32(C.crypto_vrf_PUBLICKEYBYTES)
SECRETKEYBYTES = uint32(C.crypto_vrf_SECRETKEYBYTES)
SEEDBYTES = uint32(C.crypto_vrf_SEEDBYTES)
PROOFBYTES = uint32(C.crypto_vrf_PROOFBYTES)
OUTPUTBYTES = uint32(C.crypto_vrf_OUTPUTBYTES)
PRIMITIVE = C.crypto_vrf_PRIMITIVE
)
Contributor
Author
There was a problem hiding this comment.
Yes, it seems better readability. I'll fix it.
crypto/vrf/vrf.go
Outdated
| return newOutput(op), nil | ||
| } | ||
|
|
||
| type Output [OUTPUTBYTES]byte |
Contributor
There was a problem hiding this comment.
I think it's better to move topside, because it is easy to understand that the constant and property values is collected and are existed topside than functions.
tnasu
approved these changes
Jan 14, 2020
Contributor
Author
|
all green |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR on #1, #2 allows us to call the library
libsodiumimplemented in C from within the Tendermint project. This contains golang functions that are equivalent to the VRF functions defined inlibsodium.Note that the
libsodiumused in this PR is a cryptography library of the same name with VRF capability (IRFT Draft 3) added by Algorand. The original libsodium does not contain a VRF.In a newly checked out environment, libsodium must be built and installed before compiling golang.
This PR is a renewed version of #4 with accumulated commits and rebases.