-
Notifications
You must be signed in to change notification settings - Fork 28
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
Import libsodium (Algorand's VRF lib) into Tendermint #12
Conversation
@@ -0,0 +1,125 @@ | |||
// This vrf package makes the VRF API in Algorand's libsodium C library available to golang. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about adding our license comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it seems better readability. I'll fix it.
crypto/vrf/vrf.go
Outdated
return newOutput(op), nil | ||
} | ||
|
||
type Output [OUTPUTBYTES]byte |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
all green |
This PR on #1, #2 allows us to call the library
libsodium
implemented in C from within the Tendermint project. This contains golang functions that are equivalent to the VRF functions defined inlibsodium
.Note that the
libsodium
used 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.