-
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
Update libsodium impl and add benchmark test #303
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -10,6 +10,25 @@ Ostracon is forked from Tendermint Core at 2021-03-15. | |
|
||
# Quick Start | ||
|
||
## git clone | ||
```shell | ||
git clone https://github.com/line/ostracon.git | ||
# or | ||
git clone [email protected]:line/ostracon.git | ||
``` | ||
|
||
### git clone with recursive if you want to use libsodium | ||
```shell | ||
git clone --recursive https://github.com/line/ostracon.git | ||
# or | ||
git clone --recursive [email protected]:line/ostracon.git | ||
``` | ||
|
||
### git submodule if you forget to clone with submodule | ||
```shell | ||
git submodule update --init --recursive | ||
``` | ||
|
||
## Local Standalone | ||
**Build** | ||
```sh | ||
|
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
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,91 @@ | ||
# VRF | ||
|
||
VRF implementation is set by `func init()` with `build` option | ||
|
||
## Interface | ||
* package/file | ||
* line/ostracon/crypto/vrf | ||
* `var defaultVrf vrfEd25519` | ||
* vrf.go | ||
* vrf_test.go | ||
```go | ||
type vrfEd25519 interface { | ||
Prove(privateKey []byte, message []byte) (Proof, error) | ||
Verify(publicKey []byte, proof Proof, message []byte) (bool, error) | ||
ProofToHash(proof Proof) (Output, error) | ||
``` | ||
|
||
## Implementations | ||
|
||
Use `func init()` with `build` option | ||
|
||
* package/file | ||
* line/ostracon/crypto/vrf | ||
* (r2ishiguro = default) | ||
* `// +build !libsodium,!coniks` | ||
* `func init() { defaultVrf = newVrfEd25519r2ishiguro() }` | ||
* vrf_r2ishiguro.go | ||
* (coniks) | ||
* `// +build coniks` | ||
* `func init() { defaultVrf = newVrfEd25519coniks() }` | ||
* vrf_coniks.go | ||
* vrf_coniks_test.go | ||
* (libsodium) | ||
* `// +build libsodium` | ||
* `func init() { defaultVrf = newVrfEd25519libsodium() }` | ||
* vrf_libsodium.go | ||
* vrf_libsodium_test.go | ||
|
||
### Status | ||
|
||
| impl | available | memo | | ||
|:---|:---|:---| | ||
|r2ishiguro|o|(default)| | ||
|coniks|x|no compatibility between *crypto ED25519* and *coniks ED25519* (See `TestProveAndVerify_ConiksByCryptoED25519`)| | ||
|libsodium|o| need to build libsodium (See `libsodium` task of `Makefile`)| | ||
|
||
### Attention | ||
|
||
* There is no compatibility between *r2ishiguro.Prove/libsodium.Verify* and *libsodium.Prove/r2ishiguro.Verify* (See `TestProveAndVerifyCompatibilityLibsodium`) | ||
* Ostracon Network should use `r2ishiguro` or `libsodium` (Can't use both at the same time in Ostracon Network) | ||
|
||
### libsodium (bind C implementations) | ||
* package/file | ||
* line/ostracon/crypto/vrf/internal/vrf | ||
* `// +build libsodium` | ||
* vrf.go | ||
* vrf_test.go | ||
* libsodium: submodule (See `.gitmodule`) | ||
* sodium: libs (See `libsodium` task of `Makefile`) | ||
|
||
## How to test | ||
|
||
```shell | ||
# r2ishiguro | ||
go test github.com/line/ostracon/crypto/vrf -tags r2ishiguro | ||
# libsodium | ||
go test github.com/line/ostracon/crypto/vrf -tags libsodium | ||
# internal libsodium only | ||
go test github.com/line/ostracon/crypto/vrf/internal/vrf -v -tags libsodium | ||
|
||
# coniks is not available, but if you want to do, you can see no-compatibility | ||
go test github.com/line/ostracon/crypto/vrf -tags coniks | ||
``` | ||
|
||
## How to benchmark | ||
|
||
```shell | ||
# r2ishiguro | ||
go test -bench Benchmark github.com/line/ostracon/crypto/vrf -run ^$ -benchtime=1000x -count 10 -benchmem -v | ||
# libsodium | ||
go test -bench Benchmark github.com/line/ostracon/crypto/vrf -run ^$ -benchtime=1000x -count 10 -benchmem -v -tags libsodium | ||
``` | ||
|
||
## How to build | ||
|
||
```shell | ||
# r2ishiguro | ||
make build | ||
# libsodium | ||
LIBSODIUM=1 make build | ||
``` |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
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.
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.
Why is
node.js
required to build libsodium?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.
There is no relation
node.js
. This is a just temporary data directory on the test.