diff options
-rw-r--r-- | dex/network.go | 5 | ||||
-rw-r--r-- | vendor/github.com/Spiderpowa/bls/ffi/go/bls/bls.go (renamed from vendor/github.com/herumi/bls/ffi/go/bls/bls.go) | 96 | ||||
-rw-r--r-- | vendor/github.com/Spiderpowa/bls/ffi/go/bls/mcl.go (renamed from vendor/github.com/herumi/bls/ffi/go/bls/mcl.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/Spiderpowa/bls/lib/libbls384.a | bin | 0 -> 10756688 bytes | |||
-rw-r--r-- | vendor/github.com/btcsuite/btcd/btcec/genprecomps.go | 63 | ||||
-rw-r--r-- | vendor/github.com/btcsuite/btcd/btcjson/CONTRIBUTORS | 16 | ||||
-rw-r--r-- | vendor/github.com/btcsuite/btcd/rpcclient/CONTRIBUTORS | 13 | ||||
-rw-r--r-- | vendor/github.com/btcsuite/btcd/txscript/data/LICENSE | 8 | ||||
-rw-r--r-- | vendor/github.com/golang/snappy/.gitignore | 16 | ||||
-rw-r--r-- | vendor/github.com/naoina/go-stringutil/.travis.yml | 9 | ||||
-rw-r--r-- | vendor/github.com/naoina/toml/.travis.yml | 11 | ||||
-rw-r--r-- | vendor/github.com/stretchr/testify/suite/doc.go | 65 | ||||
-rw-r--r-- | vendor/github.com/stretchr/testify/suite/interfaces.go | 46 | ||||
-rw-r--r-- | vendor/github.com/stretchr/testify/suite/suite.go | 136 |
14 files changed, 99 insertions, 385 deletions
diff --git a/dex/network.go b/dex/network.go index d0b8b5d77..a12e357eb 100644 --- a/dex/network.go +++ b/dex/network.go @@ -29,6 +29,11 @@ func (n *DexconNetwork) SendDKGPrivateShare( recv types.NodeID, prvShare *types.DKGPrivateShare) { } +// BroadcastDKGPrivateShare broadcasts PrivateShare to all DKG participants. +func (n *DexconNetwork) BroadcastDKGPrivateShare( + prvShare *types.DKGPrivateShare) { +} + // ReceiveChan returns a channel to receive messages from DEXON network. func (n *DexconNetwork) ReceiveChan() <-chan interface{} { return n.receiveChan diff --git a/vendor/github.com/herumi/bls/ffi/go/bls/bls.go b/vendor/github.com/Spiderpowa/bls/ffi/go/bls/bls.go index 4d89baf6e..4d79430a5 100644 --- a/vendor/github.com/herumi/bls/ffi/go/bls/bls.go +++ b/vendor/github.com/Spiderpowa/bls/ffi/go/bls/bls.go @@ -2,14 +2,14 @@ package bls /* #cgo CFLAGS:-I../../../include -I../../../../mcl/include/ -#cgo LDFLAGS:-L../../../lib +#cgo LDFLAGS:${SRCDIR}/../../../lib/libbls384.a -lstdc++ #cgo CFLAGS:-DMCLBN_FP_UNIT_SIZE=6 -#cgo LDFLAGS:-lbls384_dy -lcrypto -lgmp -lgmpxx -lstdc++ #include <bls/bls.h> */ import "C" import "fmt" import "unsafe" +import "encoding/json" // Init -- // call this function before calling all the other operations @@ -68,6 +68,29 @@ func (id *ID) IsEqual(rhs *ID) bool { return id.v.IsEqual(&rhs.v) } +// MarshalJSON implements json.Marshaller. +func (id *ID) MarshalJSON() ([]byte, error) { + return json.Marshal(&struct { + ID []byte `json:"id"` + }{ + id.GetLittleEndian(), + }) +} + +// UnmarshalJSON implements json.Unmarshaller. +func (id *ID) UnmarshalJSON(data []byte) error { + aux := &struct { + ID []byte `json:"id"` + }{} + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + if err := id.SetLittleEndian(aux.ID); err != nil { + return err + } + return nil +} + // SecretKey -- type SecretKey struct { v Fr @@ -134,6 +157,29 @@ func (sec *SecretKey) GetMasterSecretKey(k int) (msk []SecretKey) { return msk } +// MarshalJSON implements json.Marshaller. +func (sec *SecretKey) MarshalJSON() ([]byte, error) { + return json.Marshal(&struct { + SecretKey []byte `json:"secret_key"` + }{ + sec.GetLittleEndian(), + }) +} + +// UnmarshalJSON implements json.Unmarshaller. +func (sec *SecretKey) UnmarshalJSON(data []byte) error { + aux := &struct { + SecretKey []byte `json:"secret_key"` + }{} + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + if err := sec.SetLittleEndian(aux.SecretKey); err != nil { + return err + } + return nil +} + // GetMasterPublicKey -- func GetMasterPublicKey(msk []SecretKey) (mpk []PublicKey) { n := len(msk) @@ -216,6 +262,29 @@ func (pub *PublicKey) Recover(pubVec []PublicKey, idVec []ID) error { return G2LagrangeInterpolation(&pub.v, *(*[]Fr)(unsafe.Pointer(&idVec)), *(*[]G2)(unsafe.Pointer(&pubVec))) } +// MarshalJSON implements json.Marshaller. +func (pub *PublicKey) MarshalJSON() ([]byte, error) { + return json.Marshal(&struct { + PublicKey []byte `json:"public_key"` + }{ + pub.Serialize(), + }) +} + +// UnmarshalJSON implements json.Unmarshaller. +func (pub *PublicKey) UnmarshalJSON(data []byte) error { + aux := &struct { + PublicKey []byte `json:"public_key"` + }{} + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + if err := pub.Deserialize(aux.PublicKey); err != nil { + return err + } + return nil +} + // Sign -- type Sign struct { v G1 @@ -291,6 +360,29 @@ func (sign *Sign) VerifyPop(pub *PublicKey) bool { return C.blsVerifyPop(sign.getPointer(), pub.getPointer()) == 1 } +// MarshalJSON implements json.Marshaller. +func (sign *Sign) MarshalJSON() ([]byte, error) { + return json.Marshal(&struct { + Sign []byte `json:"sign"` + }{ + sign.Serialize(), + }) +} + +// UnmarshalJSON implements json.Unmarshaller. +func (sign *Sign) UnmarshalJSON(data []byte) error { + aux := &struct { + Sign []byte `json:"sign"` + }{} + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + if err := sign.Deserialize(aux.Sign); err != nil { + return err + } + return nil +} + // DHKeyExchange -- func DHKeyExchange(sec *SecretKey, pub *PublicKey) (out PublicKey) { C.blsDHKeyExchange(out.getPointer(), sec.getPointer(), pub.getPointer()) diff --git a/vendor/github.com/herumi/bls/ffi/go/bls/mcl.go b/vendor/github.com/Spiderpowa/bls/ffi/go/bls/mcl.go index 713a8cc55..713a8cc55 100644 --- a/vendor/github.com/herumi/bls/ffi/go/bls/mcl.go +++ b/vendor/github.com/Spiderpowa/bls/ffi/go/bls/mcl.go diff --git a/vendor/github.com/Spiderpowa/bls/lib/libbls384.a b/vendor/github.com/Spiderpowa/bls/lib/libbls384.a Binary files differnew file mode 100644 index 000000000..9e048acda --- /dev/null +++ b/vendor/github.com/Spiderpowa/bls/lib/libbls384.a diff --git a/vendor/github.com/btcsuite/btcd/btcec/genprecomps.go b/vendor/github.com/btcsuite/btcd/btcec/genprecomps.go deleted file mode 100644 index d4a9c1b83..000000000 --- a/vendor/github.com/btcsuite/btcd/btcec/genprecomps.go +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2015 The btcsuite developers -// Use of this source code is governed by an ISC -// license that can be found in the LICENSE file. - -// This file is ignored during the regular build due to the following build tag. -// It is called by go generate and used to automatically generate pre-computed -// tables used to accelerate operations. -// +build ignore - -package main - -import ( - "bytes" - "compress/zlib" - "encoding/base64" - "fmt" - "log" - "os" - - "github.com/btcsuite/btcd/btcec" -) - -func main() { - fi, err := os.Create("secp256k1.go") - if err != nil { - log.Fatal(err) - } - defer fi.Close() - - // Compress the serialized byte points. - serialized := btcec.S256().SerializedBytePoints() - var compressed bytes.Buffer - w := zlib.NewWriter(&compressed) - if _, err := w.Write(serialized); err != nil { - fmt.Println(err) - os.Exit(1) - } - w.Close() - - // Encode the compressed byte points with base64. - encoded := make([]byte, base64.StdEncoding.EncodedLen(compressed.Len())) - base64.StdEncoding.Encode(encoded, compressed.Bytes()) - - fmt.Fprintln(fi, "// Copyright (c) 2015 The btcsuite developers") - fmt.Fprintln(fi, "// Use of this source code is governed by an ISC") - fmt.Fprintln(fi, "// license that can be found in the LICENSE file.") - fmt.Fprintln(fi) - fmt.Fprintln(fi, "package btcec") - fmt.Fprintln(fi) - fmt.Fprintln(fi, "// Auto-generated file (see genprecomps.go)") - fmt.Fprintln(fi, "// DO NOT EDIT") - fmt.Fprintln(fi) - fmt.Fprintf(fi, "var secp256k1BytePoints = %q\n", string(encoded)) - - a1, b1, a2, b2 := btcec.S256().EndomorphismVectors() - fmt.Println("The following values are the computed linearly " + - "independent vectors needed to make use of the secp256k1 " + - "endomorphism:") - fmt.Printf("a1: %x\n", a1) - fmt.Printf("b1: %x\n", b1) - fmt.Printf("a2: %x\n", a2) - fmt.Printf("b2: %x\n", b2) -} diff --git a/vendor/github.com/btcsuite/btcd/btcjson/CONTRIBUTORS b/vendor/github.com/btcsuite/btcd/btcjson/CONTRIBUTORS deleted file mode 100644 index b8d98b32f..000000000 --- a/vendor/github.com/btcsuite/btcd/btcjson/CONTRIBUTORS +++ /dev/null @@ -1,16 +0,0 @@ -# This is the list of people who have contributed code to the repository. -# -# Names should be added to this file only after verifying that the individual -# or the individual's organization has agreed to the LICENSE. -# -# Names should be added to this file like so: -# Name <email address> - -John C. Vernaleo <jcv@conformal.com> -Dave Collins <davec@conformal.com> -Owain G. Ainsworth <oga@conformal.com> -David Hill <dhill@conformal.com> -Josh Rickmar <jrick@conformal.com> -Andreas Metsälä <andreas.metsala@gmail.com> -Francis Lam <flam@alum.mit.edu> -Geert-Johan Riemer <geertjohan.riemer@gmail.com> diff --git a/vendor/github.com/btcsuite/btcd/rpcclient/CONTRIBUTORS b/vendor/github.com/btcsuite/btcd/rpcclient/CONTRIBUTORS deleted file mode 100644 index 86c2b9938..000000000 --- a/vendor/github.com/btcsuite/btcd/rpcclient/CONTRIBUTORS +++ /dev/null @@ -1,13 +0,0 @@ -# This is the list of people who have contributed code to the repository. -# -# Names should be added to this file only after verifying that the individual -# or the individual's organization has agreed to the LICENSE. -# -# Names should be added to this file like so: -# Name <email address> - -Dave Collins <davec@conformal.com> -Geert-Johan Riemer <geertjohan.riemer@gmail.com> -Josh Rickmar <jrick@conformal.com> -Michalis Kargakis <michaliskargakis@gmail.com> -Ruben de Vries <ruben@rubensayshi.com diff --git a/vendor/github.com/btcsuite/btcd/txscript/data/LICENSE b/vendor/github.com/btcsuite/btcd/txscript/data/LICENSE deleted file mode 100644 index 30d808c58..000000000 --- a/vendor/github.com/btcsuite/btcd/txscript/data/LICENSE +++ /dev/null @@ -1,8 +0,0 @@ -The json files in this directory come from the bitcoind project -(https://github.com/bitcoin/bitcoin) and is released under the following -license: - - Copyright (c) 2012-2014 The Bitcoin Core developers - Distributed under the MIT/X11 software license, see the accompanying - file COPYING or http://www.opensource.org/licenses/mit-license.php. - diff --git a/vendor/github.com/golang/snappy/.gitignore b/vendor/github.com/golang/snappy/.gitignore deleted file mode 100644 index 042091d9b..000000000 --- a/vendor/github.com/golang/snappy/.gitignore +++ /dev/null @@ -1,16 +0,0 @@ -cmd/snappytool/snappytool -testdata/bench - -# These explicitly listed benchmark data files are for an obsolete version of -# snappy_test.go. -testdata/alice29.txt -testdata/asyoulik.txt -testdata/fireworks.jpeg -testdata/geo.protodata -testdata/html -testdata/html_x_4 -testdata/kppkn.gtb -testdata/lcet10.txt -testdata/paper-100k.pdf -testdata/plrabn12.txt -testdata/urls.10K diff --git a/vendor/github.com/naoina/go-stringutil/.travis.yml b/vendor/github.com/naoina/go-stringutil/.travis.yml deleted file mode 100644 index 0489ad5ea..000000000 --- a/vendor/github.com/naoina/go-stringutil/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: go -go: - - 1.4 - - 1.5 - - tip -install: - - go get -v github.com/naoina/go-stringutil -script: - - go test -v -bench . -benchmem ./... diff --git a/vendor/github.com/naoina/toml/.travis.yml b/vendor/github.com/naoina/toml/.travis.yml deleted file mode 100644 index 7b7551caa..000000000 --- a/vendor/github.com/naoina/toml/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -language: go - -go: - - 1.3 - - 1.x - -install: - - go get -t -v ./... - -script: - - go test ./... diff --git a/vendor/github.com/stretchr/testify/suite/doc.go b/vendor/github.com/stretchr/testify/suite/doc.go deleted file mode 100644 index f91a245d3..000000000 --- a/vendor/github.com/stretchr/testify/suite/doc.go +++ /dev/null @@ -1,65 +0,0 @@ -// Package suite contains logic for creating testing suite structs -// and running the methods on those structs as tests. The most useful -// piece of this package is that you can create setup/teardown methods -// on your testing suites, which will run before/after the whole suite -// or individual tests (depending on which interface(s) you -// implement). -// -// A testing suite is usually built by first extending the built-in -// suite functionality from suite.Suite in testify. Alternatively, -// you could reproduce that logic on your own if you wanted (you -// just need to implement the TestingSuite interface from -// suite/interfaces.go). -// -// After that, you can implement any of the interfaces in -// suite/interfaces.go to add setup/teardown functionality to your -// suite, and add any methods that start with "Test" to add tests. -// Methods that do not match any suite interfaces and do not begin -// with "Test" will not be run by testify, and can safely be used as -// helper methods. -// -// Once you've built your testing suite, you need to run the suite -// (using suite.Run from testify) inside any function that matches the -// identity that "go test" is already looking for (i.e. -// func(*testing.T)). -// -// Regular expression to select test suites specified command-line -// argument "-run". Regular expression to select the methods -// of test suites specified command-line argument "-m". -// Suite object has assertion methods. -// -// A crude example: -// // Basic imports -// import ( -// "testing" -// "github.com/stretchr/testify/assert" -// "github.com/stretchr/testify/suite" -// ) -// -// // Define the suite, and absorb the built-in basic suite -// // functionality from testify - including a T() method which -// // returns the current testing context -// type ExampleTestSuite struct { -// suite.Suite -// VariableThatShouldStartAtFive int -// } -// -// // Make sure that VariableThatShouldStartAtFive is set to five -// // before each test -// func (suite *ExampleTestSuite) SetupTest() { -// suite.VariableThatShouldStartAtFive = 5 -// } -// -// // All methods that begin with "Test" are run as tests within a -// // suite. -// func (suite *ExampleTestSuite) TestExample() { -// assert.Equal(suite.T(), 5, suite.VariableThatShouldStartAtFive) -// suite.Equal(5, suite.VariableThatShouldStartAtFive) -// } -// -// // In order for 'go test' to run this suite, we need to create -// // a normal test function and pass our suite to suite.Run -// func TestExampleTestSuite(t *testing.T) { -// suite.Run(t, new(ExampleTestSuite)) -// } -package suite diff --git a/vendor/github.com/stretchr/testify/suite/interfaces.go b/vendor/github.com/stretchr/testify/suite/interfaces.go deleted file mode 100644 index b37cb0409..000000000 --- a/vendor/github.com/stretchr/testify/suite/interfaces.go +++ /dev/null @@ -1,46 +0,0 @@ -package suite - -import "testing" - -// TestingSuite can store and return the current *testing.T context -// generated by 'go test'. -type TestingSuite interface { - T() *testing.T - SetT(*testing.T) -} - -// SetupAllSuite has a SetupSuite method, which will run before the -// tests in the suite are run. -type SetupAllSuite interface { - SetupSuite() -} - -// SetupTestSuite has a SetupTest method, which will run before each -// test in the suite. -type SetupTestSuite interface { - SetupTest() -} - -// TearDownAllSuite has a TearDownSuite method, which will run after -// all the tests in the suite have been run. -type TearDownAllSuite interface { - TearDownSuite() -} - -// TearDownTestSuite has a TearDownTest method, which will run after -// each test in the suite. -type TearDownTestSuite interface { - TearDownTest() -} - -// BeforeTest has a function to be executed right before the test -// starts and receives the suite and test names as input -type BeforeTest interface { - BeforeTest(suiteName, testName string) -} - -// AfterTest has a function to be executed right after the test -// finishes and receives the suite and test names as input -type AfterTest interface { - AfterTest(suiteName, testName string) -} diff --git a/vendor/github.com/stretchr/testify/suite/suite.go b/vendor/github.com/stretchr/testify/suite/suite.go deleted file mode 100644 index e20afbc21..000000000 --- a/vendor/github.com/stretchr/testify/suite/suite.go +++ /dev/null @@ -1,136 +0,0 @@ -package suite - -import ( - "flag" - "fmt" - "os" - "reflect" - "regexp" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -var allTestsFilter = func(_, _ string) (bool, error) { return true, nil } -var matchMethod = flag.String("testify.m", "", "regular expression to select tests of the testify suite to run") - -// Suite is a basic testing suite with methods for storing and -// retrieving the current *testing.T context. -type Suite struct { - *assert.Assertions - require *require.Assertions - t *testing.T -} - -// T retrieves the current *testing.T context. -func (suite *Suite) T() *testing.T { - return suite.t -} - -// SetT sets the current *testing.T context. -func (suite *Suite) SetT(t *testing.T) { - suite.t = t - suite.Assertions = assert.New(t) - suite.require = require.New(t) -} - -// Require returns a require context for suite. -func (suite *Suite) Require() *require.Assertions { - if suite.require == nil { - suite.require = require.New(suite.T()) - } - return suite.require -} - -// Assert returns an assert context for suite. Normally, you can call -// `suite.NoError(expected, actual)`, but for situations where the embedded -// methods are overridden (for example, you might want to override -// assert.Assertions with require.Assertions), this method is provided so you -// can call `suite.Assert().NoError()`. -func (suite *Suite) Assert() *assert.Assertions { - if suite.Assertions == nil { - suite.Assertions = assert.New(suite.T()) - } - return suite.Assertions -} - -// Run takes a testing suite and runs all of the tests attached -// to it. -func Run(t *testing.T, suite TestingSuite) { - suite.SetT(t) - - if setupAllSuite, ok := suite.(SetupAllSuite); ok { - setupAllSuite.SetupSuite() - } - defer func() { - if tearDownAllSuite, ok := suite.(TearDownAllSuite); ok { - tearDownAllSuite.TearDownSuite() - } - }() - - methodFinder := reflect.TypeOf(suite) - tests := []testing.InternalTest{} - for index := 0; index < methodFinder.NumMethod(); index++ { - method := methodFinder.Method(index) - ok, err := methodFilter(method.Name) - if err != nil { - fmt.Fprintf(os.Stderr, "testify: invalid regexp for -m: %s\n", err) - os.Exit(1) - } - if ok { - test := testing.InternalTest{ - Name: method.Name, - F: func(t *testing.T) { - parentT := suite.T() - suite.SetT(t) - if setupTestSuite, ok := suite.(SetupTestSuite); ok { - setupTestSuite.SetupTest() - } - if beforeTestSuite, ok := suite.(BeforeTest); ok { - beforeTestSuite.BeforeTest(methodFinder.Elem().Name(), method.Name) - } - defer func() { - if afterTestSuite, ok := suite.(AfterTest); ok { - afterTestSuite.AfterTest(methodFinder.Elem().Name(), method.Name) - } - if tearDownTestSuite, ok := suite.(TearDownTestSuite); ok { - tearDownTestSuite.TearDownTest() - } - suite.SetT(parentT) - }() - method.Func.Call([]reflect.Value{reflect.ValueOf(suite)}) - }, - } - tests = append(tests, test) - } - } - runTests(t, tests) -} - -func runTests(t testing.TB, tests []testing.InternalTest) { - r, ok := t.(runner) - if !ok { // backwards compatibility with Go 1.6 and below - if !testing.RunTests(allTestsFilter, tests) { - t.Fail() - } - return - } - - for _, test := range tests { - r.Run(test.Name, test.F) - } -} - -// Filtering method according to set regular expression -// specified command-line argument -m -func methodFilter(name string) (bool, error) { - if ok, _ := regexp.MatchString("^Test", name); !ok { - return false, nil - } - return regexp.MatchString(*matchMethod, name) -} - -type runner interface { - Run(name string, f func(t *testing.T)) bool -} |