diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2018-09-05 13:35:20 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-05 13:35:20 +0800 |
commit | 2b5c97e53e9734dda971456ff483bf2b34f0f021 (patch) | |
tree | 38f85928ce552762de4243df5feb7757c2a75410 | |
parent | 41641e10286dd7b1fdcced6a51157e061d545ef5 (diff) | |
download | dexon-consensus-2b5c97e53e9734dda971456ff483bf2b34f0f021.tar dexon-consensus-2b5c97e53e9734dda971456ff483bf2b34f0f021.tar.gz dexon-consensus-2b5c97e53e9734dda971456ff483bf2b34f0f021.tar.bz2 dexon-consensus-2b5c97e53e9734dda971456ff483bf2b34f0f021.tar.lz dexon-consensus-2b5c97e53e9734dda971456ff483bf2b34f0f021.tar.xz dexon-consensus-2b5c97e53e9734dda971456ff483bf2b34f0f021.tar.zst dexon-consensus-2b5c97e53e9734dda971456ff483bf2b34f0f021.zip |
CRYPTO: dkg library (#95)
-rw-r--r-- | .circleci/config.yml | 7 | ||||
-rw-r--r-- | GNUmakefile | 7 | ||||
-rw-r--r-- | Gopkg.lock | 45 | ||||
-rw-r--r-- | Gopkg.toml | 4 | ||||
-rwxr-xr-x | bin/install_dkg_dep.sh | 21 | ||||
-rw-r--r-- | crypto/dkg/dkg.go | 26 |
6 files changed, 101 insertions, 9 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml index 1f681e5..818aa2c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,6 +9,11 @@ jobs: environment: steps: + - run: + name: Install Dependency Libraries + command: | + sudo apt-get update + sudo apt-get install openssl libssl-dev libgmp-dev - checkout - restore_cache: keys: @@ -27,7 +32,7 @@ jobs: key: v1-vendor-{{ .Branch }}-{{ checksum "Gopkg.lock" }} paths: - vendor - - run: make eth-dep + - run: make dep - run: make lint - run: make vet - run: make test diff --git a/GNUmakefile b/GNUmakefile index ed296e9..1152468 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -51,12 +51,13 @@ all: $(COMPONENTS) $(foreach component, $(COMPONENTS), $(eval $(call BUILD_RULE,$(component)))) -pre-build: eth-dep +pre-build: dep -pre-submit: eth-dep check-format lint test vet +pre-submit: dep check-format lint test vet -eth-dep: +dep: @bin/install_eth_dep.sh + @bin/install_dkg_dep.sh format: @go fmt `go list ./... | grep -v 'vendor'` @@ -3,17 +3,22 @@ [[projects]] branch = "master" + digest = "1:6aabc1566d6351115d561d038da82a4c19b46c3b6e17f4a0a2fa60260663dc79" name = "github.com/btcsuite/btcd" packages = ["btcec"] + pruneopts = "UT" revision = "cf05f92c3f815bbd5091ed6c73eff51f7b1945e8" [[projects]] + digest = "1:a2c1d0e43bd3baaa071d1b9ed72c27d78169b2b269f71c105ac4ba34b1be4a39" name = "github.com/davecgh/go-spew" packages = ["spew"] + pruneopts = "UT" revision = "346938d642f2ec3594ed81d874461961cd0faa76" version = "v1.1.0" [[projects]] + digest = "1:43ed8fc36b293bbbcaa61bd5f6cbad47a4f863bf2a6e3360ce2771216a434cae" name = "github.com/ethereum/go-ethereum" packages = [ "common", @@ -22,56 +27,78 @@ "crypto", "crypto/secp256k1", "crypto/sha3", - "rlp" + "rlp", ] + pruneopts = "UT" revision = "225171a4bfcc16bd12a1906b1e0d43d0b18c353b" version = "v1.8.13" [[projects]] branch = "master" + digest = "1:4a0c6bb4805508a6287675fac876be2ac1182539ca8a32468d8128882e9d5009" name = "github.com/golang/snappy" packages = ["."] + pruneopts = "UT" revision = "2e65f85255dbc3072edf28d6b5b8efc472979f5a" [[projects]] + branch = "master" + digest = "1:575eb8ef612810bdfc3787cab5583a81278e81c060ae7d68ed7486ad55d0a5a6" + name = "github.com/herumi/bls" + packages = ["ffi/go/bls"] + pruneopts = "UT" + revision = "1fea3145f1a595de561527888ffc961bdf7907af" + +[[projects]] + digest = "1:b56c589214f01a5601e0821387db484617392d0042f26234bf2da853a2f498a1" name = "github.com/naoina/go-stringutil" packages = ["."] + pruneopts = "UT" revision = "6b638e95a32d0c1131db0e7fe83775cbea4a0d0b" version = "v0.1.0" [[projects]] + digest = "1:ce268ac5ab983535f7372bf9d4f8e4807f51ea961f71510d73e433e164208e34" name = "github.com/naoina/toml" packages = [ ".", - "ast" + "ast", ] + pruneopts = "UT" revision = "e6f5723bf2a66af014955e0888881314cf294129" version = "v0.1.1" [[projects]] + digest = "1:0028cb19b2e4c3112225cd871870f2d9cf49b9b4276531f03438a88e94be86fe" name = "github.com/pmezard/go-difflib" packages = ["difflib"] + pruneopts = "UT" revision = "792786c7400a136282c1664665ae0a8db921c6c2" version = "v1.0.0" [[projects]] + digest = "1:81e02c4edb639c80559c0650f9401d3e2dcc3256d1fa215382bb7c83c1db9126" name = "github.com/shopspring/decimal" packages = ["."] + pruneopts = "UT" revision = "cd690d0c9e2447b1ef2a129a6b7b49077da89b8e" version = "1.1.0" [[projects]] + digest = "1:38aee443dc6b1610660b68fb6ff259315aa4219c4772da84a410029a06bc1f76" name = "github.com/stretchr/testify" packages = [ "assert", "require", - "suite" + "suite", ] + pruneopts = "UT" revision = "f35b8ab0b5a2cef36673838d662e249dd9c94686" version = "v1.2.2" [[projects]] branch = "master" + digest = "1:922191411ad8f61bcd8018ac127589bb489712c1d1a0ab2497aca4b16de417d2" name = "github.com/syndtr/goleveldb" packages = [ "leveldb", @@ -85,13 +112,21 @@ "leveldb/opt", "leveldb/storage", "leveldb/table", - "leveldb/util" + "leveldb/util", ] + pruneopts = "UT" revision = "c4c61651e9e37fa117f53c5a906d3b63090d8445" [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "69f6056ad1b79c7d8e48eb9b1fbca44f068a1b5e6bb65e9a1112b627508ce63f" + input-imports = [ + "github.com/ethereum/go-ethereum/crypto", + "github.com/herumi/bls/ffi/go/bls", + "github.com/naoina/toml", + "github.com/shopspring/decimal", + "github.com/stretchr/testify/suite", + "github.com/syndtr/goleveldb/leveldb", + ] solver-name = "gps-cdcl" solver-version = 1 @@ -41,6 +41,10 @@ branch = "master" name = "github.com/syndtr/goleveldb" +[[constraint]] + branch = "master" + name = "github.com/herumi/bls" + [prune] go-tests = true unused-packages = true diff --git a/bin/install_dkg_dep.sh b/bin/install_dkg_dep.sh new file mode 100755 index 0000000..eb41460 --- /dev/null +++ b/bin/install_dkg_dep.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +if [ -e .dep/dkg ]; then + exit 0 +fi + +rm -rf vendor/github.com/herumi/* +if [ ! -d .dep/dkg ]; then + mkdir -p .dep/dkg + cd .dep/dkg + git clone --depth 1 git://github.com/herumi/xbyak.git & + git clone --depth 1 git://github.com/herumi/cybozulib.git & + git clone --depth 1 git://github.com/herumi/bls.git & + git clone --depth 1 git://github.com/herumi/mcl.git & + wait + cd bls + make test_go -j + cd ../../../ +fi +cp -r .dep/dkg/* \ + vendor/github.com/herumi diff --git a/crypto/dkg/dkg.go b/crypto/dkg/dkg.go new file mode 100644 index 0000000..b5e8d03 --- /dev/null +++ b/crypto/dkg/dkg.go @@ -0,0 +1,26 @@ +// Copyright 2018 The dexon-consensus-core Authors +// This file is part of the dexon-consensus-core library. +// +// The dexon-consensus-core library is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The dexon-consensus-core library is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the dexon-consensus-core library. If not, see +// <http://www.gnu.org/licenses/>. + +package dkg + +import ( + "github.com/herumi/bls/ffi/go/bls" +) + +func init() { + bls.Init(0) +} |