diff options
author | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-12 17:31:08 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-09-17 16:57:29 +0800 |
commit | ac088de6322fc16ebe75c2e5554be73754bf1fe2 (patch) | |
tree | 086b7827d46a4d07b834cd94be73beaabb77b734 /vendor | |
parent | 67d565f3f0e398e99bef96827f729e3e4b0edf31 (diff) | |
download | go-tangerine-ac088de6322fc16ebe75c2e5554be73754bf1fe2.tar go-tangerine-ac088de6322fc16ebe75c2e5554be73754bf1fe2.tar.gz go-tangerine-ac088de6322fc16ebe75c2e5554be73754bf1fe2.tar.bz2 go-tangerine-ac088de6322fc16ebe75c2e5554be73754bf1fe2.tar.lz go-tangerine-ac088de6322fc16ebe75c2e5554be73754bf1fe2.tar.xz go-tangerine-ac088de6322fc16ebe75c2e5554be73754bf1fe2.tar.zst go-tangerine-ac088de6322fc16ebe75c2e5554be73754bf1fe2.zip |
Rebrand as tangerine-network/go-tangerine
Diffstat (limited to 'vendor')
-rw-r--r-- | vendor/cloud.google.com/go/storage/storage.go | 34 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/.gitignore (renamed from vendor/github.com/dexon-foundation/bls/.gitignore) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/.travis.yml (renamed from vendor/github.com/dexon-foundation/bls/.travis.yml) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/CMakeLists.txt (renamed from vendor/github.com/dexon-foundation/bls/CMakeLists.txt) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/Makefile (renamed from vendor/github.com/dexon-foundation/bls/Makefile) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/bin/.emptydir (renamed from vendor/github.com/dexon-foundation/bls/bin/.emptydir) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/bls.sln (renamed from vendor/github.com/dexon-foundation/bls/bls.sln) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/bls_smpl.py (renamed from vendor/github.com/dexon-foundation/bls/bls_smpl.py) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/common.props (renamed from vendor/github.com/dexon-foundation/bls/common.props) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/debug.props (renamed from vendor/github.com/dexon-foundation/bls/debug.props) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/ffi/cs/App.config (renamed from vendor/github.com/dexon-foundation/bls/ffi/cs/App.config) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/ffi/cs/Properties/AssemblyInfo.cs (renamed from vendor/github.com/dexon-foundation/bls/ffi/cs/Properties/AssemblyInfo.cs) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/ffi/cs/bls.cs (renamed from vendor/github.com/dexon-foundation/bls/ffi/cs/bls.cs) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/ffi/cs/bls.csproj (renamed from vendor/github.com/dexon-foundation/bls/ffi/cs/bls.csproj) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/ffi/cs/bls.sln (renamed from vendor/github.com/dexon-foundation/bls/ffi/cs/bls.sln) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/ffi/cs/bls256.cs (renamed from vendor/github.com/dexon-foundation/bls/ffi/cs/bls256.cs) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/ffi/cs/bls256.csproj (renamed from vendor/github.com/dexon-foundation/bls/ffi/cs/bls256.csproj) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/ffi/cs/bls256.sln (renamed from vendor/github.com/dexon-foundation/bls/ffi/cs/bls256.sln) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/ffi/cs/bls256_test.cs (renamed from vendor/github.com/dexon-foundation/bls/ffi/cs/bls256_test.cs) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/ffi/cs/bls_test.cs (renamed from vendor/github.com/dexon-foundation/bls/ffi/cs/bls_test.cs) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/ffi/cs/readme-ja.md (renamed from vendor/github.com/dexon-foundation/bls/ffi/cs/readme-ja.md) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/ffi/cs/readme.md (renamed from vendor/github.com/dexon-foundation/bls/ffi/cs/readme.md) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/ffi/go/bls/bls.go (renamed from vendor/github.com/dexon-foundation/bls/ffi/go/bls/bls.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/ffi/go/bls/callback.go (renamed from vendor/github.com/dexon-foundation/bls/ffi/go/bls/callback.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/ffi/go/bls/dummy.cpp (renamed from vendor/github.com/dexon-foundation/bls/ffi/go/bls/dummy.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/ffi/go/bls/mcl.go (renamed from vendor/github.com/dexon-foundation/bls/ffi/go/bls/mcl.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/images/bls-go-alpine/Dockerfile (renamed from vendor/github.com/dexon-foundation/bls/images/bls-go-alpine/Dockerfile) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/include/bls/bls.h (renamed from vendor/github.com/dexon-foundation/bls/include/bls/bls.h) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/include/bls/bls.hpp (renamed from vendor/github.com/dexon-foundation/bls/include/bls/bls.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/lib/.emptydir (renamed from vendor/github.com/dexon-foundation/bls/lib/.emptydir) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/mk.bat (renamed from vendor/github.com/dexon-foundation/bls/mk.bat) | 0 | ||||
-rwxr-xr-x | vendor/github.com/byzantine-lab/bls/mkdll.bat (renamed from vendor/github.com/dexon-foundation/bls/mkdll.bat) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/mklib.bat (renamed from vendor/github.com/dexon-foundation/bls/mklib.bat) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/obj/.emptydir (renamed from vendor/github.com/dexon-foundation/bls/obj/.emptydir) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/readme.md (renamed from vendor/github.com/dexon-foundation/bls/readme.md) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/release.props (renamed from vendor/github.com/dexon-foundation/bls/release.props) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/sample/bls_smpl.cpp (renamed from vendor/github.com/dexon-foundation/bls/sample/bls_smpl.cpp) | 0 | ||||
-rwxr-xr-x | vendor/github.com/byzantine-lab/bls/setvar.bat (renamed from vendor/github.com/dexon-foundation/bls/setvar.bat) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/src/bls_c256.cpp (renamed from vendor/github.com/dexon-foundation/bls/src/bls_c256.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/src/bls_c384.cpp (renamed from vendor/github.com/dexon-foundation/bls/src/bls_c384.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/src/bls_c384_256.cpp (renamed from vendor/github.com/dexon-foundation/bls/src/bls_c384_256.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/src/bls_c_impl.hpp (renamed from vendor/github.com/dexon-foundation/bls/src/bls_c_impl.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/src/proj/bls.vcxproj (renamed from vendor/github.com/dexon-foundation/bls/src/proj/bls.vcxproj) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/src/qcoeff-bn254.hpp (renamed from vendor/github.com/dexon-foundation/bls/src/qcoeff-bn254.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/test/bls256_test.cpp (renamed from vendor/github.com/dexon-foundation/bls/test/bls256_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/test/bls384_256_test.cpp (renamed from vendor/github.com/dexon-foundation/bls/test/bls384_256_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/test/bls384_test.cpp (renamed from vendor/github.com/dexon-foundation/bls/test/bls384_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/test/bls_c256_test.cpp (renamed from vendor/github.com/dexon-foundation/bls/test/bls_c256_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/test/bls_c384_256_test.cpp (renamed from vendor/github.com/dexon-foundation/bls/test/bls_c384_256_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/test/bls_c384_test.cpp (renamed from vendor/github.com/dexon-foundation/bls/test/bls_c384_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/test/bls_c_test.hpp (renamed from vendor/github.com/dexon-foundation/bls/test/bls_c_test.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/test/bls_test.hpp (renamed from vendor/github.com/dexon-foundation/bls/test/bls_test.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/bls/test/proj/bls_test/bls_test.vcxproj (renamed from vendor/github.com/dexon-foundation/bls/test/proj/bls_test/bls_test.vcxproj) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/LICENSE (renamed from vendor/github.com/dexon-foundation/dexon-consensus/LICENSE) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/common/event.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/common/event.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/common/logger.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/common/logger.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/common/types.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/common/types.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/common/utils.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/common/utils.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/agreement-mgr.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/agreement-mgr.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/agreement-state.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/agreement-state.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/agreement.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/agreement.go) | 6 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/blockchain.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/blockchain.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/blockdb/interfaces.go | 70 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/blockdb/level-db.go | 127 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/blockdb/memory.go | 183 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/configuration-chain.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/configuration-chain.go) | 12 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/consensus.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go) | 14 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/constant.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/constant.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/crypto/dkg/constant.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/crypto/dkg/constant.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/crypto/dkg/dkg.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/crypto/dkg/dkg.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/crypto/dkg/utils.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/crypto/dkg/utils.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/crypto/ecdsa/ecdsa.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/crypto/ecdsa/ecdsa.go) | 6 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/crypto/interfaces.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/crypto/interfaces.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/crypto/utils.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/crypto/utils.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/db/interfaces.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/db/interfaces.go) | 6 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/db/level-db.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/db/level-db.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/db/memory.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/db/memory.go) | 6 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/dkg-tsig-protocol.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/dkg-tsig-protocol.go) | 14 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/interfaces.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/interfaces.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/leader-selector.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/leader-selector.go) | 6 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/nonblocking.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/nonblocking.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/syncer/agreement.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/syncer/agreement.go) | 10 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/syncer/consensus.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/syncer/consensus.go) | 12 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/syncer/watch-cat.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/syncer/watch-cat.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/ticker.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/ticker.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/types/block-randomness.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/types/block-randomness.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/types/block.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/types/block.go) | 6 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/types/config.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/types/config.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/types/dkg/dkg.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/types/dkg/dkg.go) | 10 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/types/message.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/types/message.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/types/node.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/types/node.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/types/nodeset.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/types/nodeset.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/types/position.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/types/position.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/types/vote.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/types/vote.go) | 6 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/utils.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/utils.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/utils/crypto.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/utils/crypto.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/utils/nodeset-cache.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/utils/nodeset-cache.go) | 6 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/utils/penalty-helper.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/utils/penalty-helper.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/utils/round-based-config.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/utils/round-based-config.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/utils/round-event.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/utils/round-event.go) | 6 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/utils/signer.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/utils/signer.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/utils/utils.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/utils/utils.go) | 6 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/dexon-consensus/core/utils/vote-filter.go (renamed from vendor/github.com/dexon-foundation/dexon-consensus/core/utils/vote-filter.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/.gitignore (renamed from vendor/github.com/dexon-foundation/mcl/.gitignore) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/.travis.yml (renamed from vendor/github.com/dexon-foundation/mcl/.travis.yml) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/CMakeLists.txt (renamed from vendor/github.com/dexon-foundation/mcl/CMakeLists.txt) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/COPYRIGHT (renamed from vendor/github.com/dexon-foundation/mcl/COPYRIGHT) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/Makefile (renamed from vendor/github.com/dexon-foundation/mcl/Makefile) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/bench.txt (renamed from vendor/github.com/dexon-foundation/mcl/bench.txt) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/common.mk (renamed from vendor/github.com/dexon-foundation/mcl/common.mk) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/common.props (renamed from vendor/github.com/dexon-foundation/mcl/common.props) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/debug.props (renamed from vendor/github.com/dexon-foundation/mcl/debug.props) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/ffi/cs/App.config (renamed from vendor/github.com/dexon-foundation/mcl/ffi/cs/App.config) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/ffi/cs/Properties/AssemblyInfo.cs (renamed from vendor/github.com/dexon-foundation/mcl/ffi/cs/Properties/AssemblyInfo.cs) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/ffi/cs/bn256.cs (renamed from vendor/github.com/dexon-foundation/mcl/ffi/cs/bn256.cs) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/ffi/cs/bn256.csproj (renamed from vendor/github.com/dexon-foundation/mcl/ffi/cs/bn256.csproj) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/ffi/cs/bn256.sln (renamed from vendor/github.com/dexon-foundation/mcl/ffi/cs/bn256.sln) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/ffi/cs/bn256_test.cs (renamed from vendor/github.com/dexon-foundation/mcl/ffi/cs/bn256_test.cs) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/ffi/go/mcl/mcl.go (renamed from vendor/github.com/dexon-foundation/mcl/ffi/go/mcl/mcl.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/ffi/go/mcl/mcl_test.go (renamed from vendor/github.com/dexon-foundation/mcl/ffi/go/mcl/mcl_test.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/ffi/java/Bn256Test.java (renamed from vendor/github.com/dexon-foundation/mcl/ffi/java/Bn256Test.java) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/ffi/java/ElgamalTest.java (renamed from vendor/github.com/dexon-foundation/mcl/ffi/java/ElgamalTest.java) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/ffi/java/Makefile (renamed from vendor/github.com/dexon-foundation/mcl/ffi/java/Makefile) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/ffi/java/bn256.i (renamed from vendor/github.com/dexon-foundation/mcl/ffi/java/bn256.i) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/ffi/java/bn256_impl.hpp (renamed from vendor/github.com/dexon-foundation/mcl/ffi/java/bn256_impl.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/ffi/java/bn256_wrap.cxx (renamed from vendor/github.com/dexon-foundation/mcl/ffi/java/bn256_wrap.cxx) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/ffi/java/elgamal.i (renamed from vendor/github.com/dexon-foundation/mcl/ffi/java/elgamal.i) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/ffi/java/elgamal_impl.hpp (renamed from vendor/github.com/dexon-foundation/mcl/ffi/java/elgamal_impl.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/ffi/java/elgamal_wrap.cxx (renamed from vendor/github.com/dexon-foundation/mcl/ffi/java/elgamal_wrap.cxx) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/ffi/java/java.md (renamed from vendor/github.com/dexon-foundation/mcl/ffi/java/java.md) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/ffi/java/make_wrap.bat (renamed from vendor/github.com/dexon-foundation/mcl/ffi/java/make_wrap.bat) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/ffi/java/run-bn256.bat (renamed from vendor/github.com/dexon-foundation/mcl/ffi/java/run-bn256.bat) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/ffi/java/run-elgamal.bat (renamed from vendor/github.com/dexon-foundation/mcl/ffi/java/run-elgamal.bat) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/ffi/java/set-java-path.bat (renamed from vendor/github.com/dexon-foundation/mcl/ffi/java/set-java-path.bat) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/ffi/js/export-functions.py (renamed from vendor/github.com/dexon-foundation/mcl/ffi/js/export-functions.py) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/ffi/js/pre-mcl.js (renamed from vendor/github.com/dexon-foundation/mcl/ffi/js/pre-mcl.js) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/ffi/python/pairing.py (renamed from vendor/github.com/dexon-foundation/mcl/ffi/python/pairing.py) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/ffi/python/she.py (renamed from vendor/github.com/dexon-foundation/mcl/ffi/python/she.py) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/cybozu/array.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/cybozu/array.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/cybozu/atoi.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/cybozu/atoi.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/cybozu/benchmark.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/cybozu/benchmark.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/cybozu/bit_operation.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/cybozu/bit_operation.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/cybozu/critical_section.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/cybozu/critical_section.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/cybozu/crypto.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/cybozu/crypto.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/cybozu/endian.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/cybozu/endian.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/cybozu/exception.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/cybozu/exception.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/cybozu/hash.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/cybozu/hash.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/cybozu/inttype.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/cybozu/inttype.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/cybozu/itoa.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/cybozu/itoa.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/cybozu/link_libeay32.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/cybozu/link_libeay32.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/cybozu/link_mpir.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/cybozu/link_mpir.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/cybozu/link_ssleay32.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/cybozu/link_ssleay32.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/cybozu/mutex.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/cybozu/mutex.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/cybozu/option.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/cybozu/option.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/cybozu/random_generator.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/cybozu/random_generator.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/cybozu/serializer.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/cybozu/serializer.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/cybozu/sha2.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/cybozu/sha2.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/cybozu/stream.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/cybozu/stream.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/cybozu/test.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/cybozu/test.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/cybozu/unordered_map.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/cybozu/unordered_map.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/cybozu/xorshift.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/cybozu/xorshift.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/mcl/aggregate_sig.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/mcl/aggregate_sig.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/mcl/ahe.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/mcl/ahe.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/mcl/array.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/mcl/array.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/mcl/bls12_381.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/mcl/bls12_381.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/mcl/bn.h (renamed from vendor/github.com/dexon-foundation/mcl/include/mcl/bn.h) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/mcl/bn.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/mcl/bn.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/mcl/bn256.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/mcl/bn256.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/mcl/bn384.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/mcl/bn384.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/mcl/bn512.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/mcl/bn512.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/mcl/conversion.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/mcl/conversion.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/mcl/curve_type.h (renamed from vendor/github.com/dexon-foundation/mcl/include/mcl/curve_type.h) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/mcl/ec.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/mcl/ec.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/mcl/ecdsa.h (renamed from vendor/github.com/dexon-foundation/mcl/include/mcl/ecdsa.h) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/mcl/ecdsa.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/mcl/ecdsa.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/mcl/ecparam.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/mcl/ecparam.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/mcl/elgamal.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/mcl/elgamal.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/mcl/fp.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/mcl/fp.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/mcl/fp_tower.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/mcl/fp_tower.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/mcl/gmp_util.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/mcl/gmp_util.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/mcl/impl/bn_c_impl.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/mcl/impl/bn_c_impl.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/mcl/lagrange.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/mcl/lagrange.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/mcl/op.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/mcl/op.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/mcl/operator.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/mcl/operator.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/mcl/paillier.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/mcl/paillier.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/mcl/randgen.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/mcl/randgen.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/mcl/she.h (renamed from vendor/github.com/dexon-foundation/mcl/include/mcl/she.h) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/mcl/she.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/mcl/she.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/mcl/util.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/mcl/util.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/mcl/vint.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/mcl/vint.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/include/mcl/window_method.hpp (renamed from vendor/github.com/dexon-foundation/mcl/include/mcl/window_method.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/lib/.emptydir (renamed from vendor/github.com/dexon-foundation/mcl/lib/.emptydir) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/mcl.sln (renamed from vendor/github.com/dexon-foundation/mcl/mcl.sln) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/misc/bench.txt (renamed from vendor/github.com/dexon-foundation/mcl/misc/bench.txt) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/misc/karatsuba.cpp (renamed from vendor/github.com/dexon-foundation/mcl/misc/karatsuba.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/misc/mul.cpp (renamed from vendor/github.com/dexon-foundation/mcl/misc/mul.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/misc/precompute.cpp (renamed from vendor/github.com/dexon-foundation/mcl/misc/precompute.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/misc/she/bench.sh (renamed from vendor/github.com/dexon-foundation/mcl/misc/she/bench.sh) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/misc/she/bench4.txt (renamed from vendor/github.com/dexon-foundation/mcl/misc/she/bench4.txt) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/misc/she/bench6.txt (renamed from vendor/github.com/dexon-foundation/mcl/misc/she/bench6.txt) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/misc/she/bench8.txt (renamed from vendor/github.com/dexon-foundation/mcl/misc/she/bench8.txt) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/misc/she/nizkp.pdf (renamed from vendor/github.com/dexon-foundation/mcl/misc/she/nizkp.pdf) | bin | 28787 -> 28787 bytes | |||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/misc/she/she-api-ja.md (renamed from vendor/github.com/dexon-foundation/mcl/misc/she/she-api-ja.md) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/misc/she/she-api.md (renamed from vendor/github.com/dexon-foundation/mcl/misc/she/she-api.md) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/misc/she/she.pdf (renamed from vendor/github.com/dexon-foundation/mcl/misc/she/she.pdf) | bin | 25716 -> 25716 bytes | |||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/mk.bat (renamed from vendor/github.com/dexon-foundation/mcl/mk.bat) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/mklib.bat (renamed from vendor/github.com/dexon-foundation/mcl/mklib.bat) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/obj/.emptydir (renamed from vendor/github.com/dexon-foundation/mcl/obj/.emptydir) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/readme.md (renamed from vendor/github.com/dexon-foundation/mcl/readme.md) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/release.props (renamed from vendor/github.com/dexon-foundation/mcl/release.props) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/sample/bench.cpp (renamed from vendor/github.com/dexon-foundation/mcl/sample/bench.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/sample/bls_sig.cpp (renamed from vendor/github.com/dexon-foundation/mcl/sample/bls_sig.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/sample/ecdh.cpp (renamed from vendor/github.com/dexon-foundation/mcl/sample/ecdh.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/sample/large.cpp (renamed from vendor/github.com/dexon-foundation/mcl/sample/large.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/sample/pairing.cpp (renamed from vendor/github.com/dexon-foundation/mcl/sample/pairing.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/sample/pairing_c.c (renamed from vendor/github.com/dexon-foundation/mcl/sample/pairing_c.c) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/sample/random.cpp (renamed from vendor/github.com/dexon-foundation/mcl/sample/random.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/sample/rawbench.cpp (renamed from vendor/github.com/dexon-foundation/mcl/sample/rawbench.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/sample/she_make_dlp_table.cpp (renamed from vendor/github.com/dexon-foundation/mcl/sample/she_make_dlp_table.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/sample/she_smpl.cpp (renamed from vendor/github.com/dexon-foundation/mcl/sample/she_smpl.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/sample/tri-dh.cpp (renamed from vendor/github.com/dexon-foundation/mcl/sample/tri-dh.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/sample/vote.cpp (renamed from vendor/github.com/dexon-foundation/mcl/sample/vote.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/setvar.bat (renamed from vendor/github.com/dexon-foundation/mcl/setvar.bat) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/src/asm/aarch64.s (renamed from vendor/github.com/dexon-foundation/mcl/src/asm/aarch64.s) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/src/asm/arm.s (renamed from vendor/github.com/dexon-foundation/mcl/src/asm/arm.s) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/src/asm/low_arm.s (renamed from vendor/github.com/dexon-foundation/mcl/src/asm/low_arm.s) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/src/asm/low_x86-64.asm (renamed from vendor/github.com/dexon-foundation/mcl/src/asm/low_x86-64.asm) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/src/asm/low_x86.asm (renamed from vendor/github.com/dexon-foundation/mcl/src/asm/low_x86.asm) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/src/asm/x86-64.bmi2.s (renamed from vendor/github.com/dexon-foundation/mcl/src/asm/x86-64.bmi2.s) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/src/asm/x86-64.s (renamed from vendor/github.com/dexon-foundation/mcl/src/asm/x86-64.s) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/src/asm/x86-64mac.bmi2.s (renamed from vendor/github.com/dexon-foundation/mcl/src/asm/x86-64mac.bmi2.s) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/src/asm/x86-64mac.s (renamed from vendor/github.com/dexon-foundation/mcl/src/asm/x86-64mac.s) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/src/asm/x86.bmi2.s (renamed from vendor/github.com/dexon-foundation/mcl/src/asm/x86.bmi2.s) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/src/asm/x86.s (renamed from vendor/github.com/dexon-foundation/mcl/src/asm/x86.s) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/src/bn_c256.cpp (renamed from vendor/github.com/dexon-foundation/mcl/src/bn_c256.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/src/bn_c384.cpp (renamed from vendor/github.com/dexon-foundation/mcl/src/bn_c384.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/src/bn_c384_256.cpp (renamed from vendor/github.com/dexon-foundation/mcl/src/bn_c384_256.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/src/bn_c512.cpp (renamed from vendor/github.com/dexon-foundation/mcl/src/bn_c512.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/src/bn_c_impl.hpp (renamed from vendor/github.com/dexon-foundation/mcl/src/bn_c_impl.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/src/ecdsa_c.cpp (renamed from vendor/github.com/dexon-foundation/mcl/src/ecdsa_c.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/src/fp.cpp (renamed from vendor/github.com/dexon-foundation/mcl/src/fp.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/src/fp_generator.hpp (renamed from vendor/github.com/dexon-foundation/mcl/src/fp_generator.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/src/gen.cpp (renamed from vendor/github.com/dexon-foundation/mcl/src/gen.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/src/llvm_gen.hpp (renamed from vendor/github.com/dexon-foundation/mcl/src/llvm_gen.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/src/low_func.hpp (renamed from vendor/github.com/dexon-foundation/mcl/src/low_func.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/src/low_func_llvm.hpp (renamed from vendor/github.com/dexon-foundation/mcl/src/low_func_llvm.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/src/proj/mcl.vcxproj (renamed from vendor/github.com/dexon-foundation/mcl/src/proj/mcl.vcxproj) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/src/proto.hpp (renamed from vendor/github.com/dexon-foundation/mcl/src/proto.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/src/she_c256.cpp (renamed from vendor/github.com/dexon-foundation/mcl/src/she_c256.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/src/she_c384.cpp (renamed from vendor/github.com/dexon-foundation/mcl/src/she_c384.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/src/she_c_impl.hpp (renamed from vendor/github.com/dexon-foundation/mcl/src/she_c_impl.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/src/xbyak/xbyak.h (renamed from vendor/github.com/dexon-foundation/mcl/src/xbyak/xbyak.h) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/src/xbyak/xbyak_mnemonic.h (renamed from vendor/github.com/dexon-foundation/mcl/src/xbyak/xbyak_mnemonic.h) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/src/xbyak/xbyak_util.h (renamed from vendor/github.com/dexon-foundation/mcl/src/xbyak/xbyak_util.h) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/aggregate_sig_test.cpp (renamed from vendor/github.com/dexon-foundation/mcl/test/aggregate_sig_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/array_test.cpp (renamed from vendor/github.com/dexon-foundation/mcl/test/array_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/base_test.cpp (renamed from vendor/github.com/dexon-foundation/mcl/test/base_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/bench.hpp (renamed from vendor/github.com/dexon-foundation/mcl/test/bench.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/bls12_test.cpp (renamed from vendor/github.com/dexon-foundation/mcl/test/bls12_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/bn384_test.cpp (renamed from vendor/github.com/dexon-foundation/mcl/test/bn384_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/bn512_test.cpp (renamed from vendor/github.com/dexon-foundation/mcl/test/bn512_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/bn_c256_test.cpp (renamed from vendor/github.com/dexon-foundation/mcl/test/bn_c256_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/bn_c384_256_test.cpp (renamed from vendor/github.com/dexon-foundation/mcl/test/bn_c384_256_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/bn_c384_test.cpp (renamed from vendor/github.com/dexon-foundation/mcl/test/bn_c384_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/bn_c512_test.cpp (renamed from vendor/github.com/dexon-foundation/mcl/test/bn_c512_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/bn_c_test.hpp (renamed from vendor/github.com/dexon-foundation/mcl/test/bn_c_test.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/bn_test.cpp (renamed from vendor/github.com/dexon-foundation/mcl/test/bn_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/conversion_test.cpp (renamed from vendor/github.com/dexon-foundation/mcl/test/conversion_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/ec_test.cpp (renamed from vendor/github.com/dexon-foundation/mcl/test/ec_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/ecdsa_c_test.cpp (renamed from vendor/github.com/dexon-foundation/mcl/test/ecdsa_c_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/ecdsa_test.cpp (renamed from vendor/github.com/dexon-foundation/mcl/test/ecdsa_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/elgamal_test.cpp (renamed from vendor/github.com/dexon-foundation/mcl/test/elgamal_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/fp_generator_test.cpp (renamed from vendor/github.com/dexon-foundation/mcl/test/fp_generator_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/fp_test.cpp (renamed from vendor/github.com/dexon-foundation/mcl/test/fp_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/fp_tower_test.cpp (renamed from vendor/github.com/dexon-foundation/mcl/test/fp_tower_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/fp_util_test.cpp (renamed from vendor/github.com/dexon-foundation/mcl/test/fp_util_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/glv_test.cpp (renamed from vendor/github.com/dexon-foundation/mcl/test/glv_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/gmp_test.cpp (renamed from vendor/github.com/dexon-foundation/mcl/test/gmp_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/low_test.cpp (renamed from vendor/github.com/dexon-foundation/mcl/test/low_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/mk32.sh (renamed from vendor/github.com/dexon-foundation/mcl/test/mk32.sh) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/modp_test.cpp (renamed from vendor/github.com/dexon-foundation/mcl/test/modp_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/mont_fp_test.cpp (renamed from vendor/github.com/dexon-foundation/mcl/test/mont_fp_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/paillier_test.cpp (renamed from vendor/github.com/dexon-foundation/mcl/test/paillier_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/proj/bn_test/bn_test.vcxproj (renamed from vendor/github.com/dexon-foundation/mcl/test/proj/bn_test/bn_test.vcxproj) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/proj/ec_test/ec_test.vcxproj (renamed from vendor/github.com/dexon-foundation/mcl/test/proj/ec_test/ec_test.vcxproj) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/proj/fp_test/fp_test.vcxproj (renamed from vendor/github.com/dexon-foundation/mcl/test/proj/fp_test/fp_test.vcxproj) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/proj/fp_tower_test/fp_tower_test.vcxproj (renamed from vendor/github.com/dexon-foundation/mcl/test/proj/fp_tower_test/fp_tower_test.vcxproj) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/she_c256_test.cpp (renamed from vendor/github.com/dexon-foundation/mcl/test/she_c256_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/she_c384_test.cpp (renamed from vendor/github.com/dexon-foundation/mcl/test/she_c384_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/she_c_test.hpp (renamed from vendor/github.com/dexon-foundation/mcl/test/she_c_test.hpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/she_test.cpp (renamed from vendor/github.com/dexon-foundation/mcl/test/she_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/sq_test.cpp (renamed from vendor/github.com/dexon-foundation/mcl/test/sq_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/vint_test.cpp (renamed from vendor/github.com/dexon-foundation/mcl/test/vint_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/byzantine-lab/mcl/test/window_method_test.cpp (renamed from vendor/github.com/dexon-foundation/mcl/test/window_method_test.cpp) | 0 | ||||
-rw-r--r-- | vendor/github.com/dexon-foundation/bls/ffi/go/bls/bls_test.go | 690 | ||||
-rw-r--r-- | vendor/github.com/dexon-foundation/bls/ffi/go/bls/config.h | 6 | ||||
-rw-r--r-- | vendor/github.com/ethereum/go-ethereum/common/big.go | 30 | ||||
-rw-r--r-- | vendor/github.com/ethereum/go-ethereum/common/bytes.go | 138 | ||||
-rw-r--r-- | vendor/github.com/ethereum/go-ethereum/common/debug.go | 52 | ||||
-rw-r--r-- | vendor/github.com/ethereum/go-ethereum/common/format.go | 82 | ||||
-rw-r--r-- | vendor/github.com/ethereum/go-ethereum/common/hexutil/hexutil.go | 240 | ||||
-rw-r--r-- | vendor/github.com/ethereum/go-ethereum/common/hexutil/json.go | 376 | ||||
-rw-r--r-- | vendor/github.com/ethereum/go-ethereum/common/math/big.go | 219 | ||||
-rw-r--r-- | vendor/github.com/ethereum/go-ethereum/common/math/integer.go | 99 | ||||
-rw-r--r-- | vendor/github.com/ethereum/go-ethereum/common/path.go | 49 | ||||
-rw-r--r-- | vendor/github.com/ethereum/go-ethereum/common/size.go | 56 | ||||
-rw-r--r-- | vendor/github.com/ethereum/go-ethereum/common/test_utils.go | 53 | ||||
-rw-r--r-- | vendor/github.com/ethereum/go-ethereum/common/types.go | 369 | ||||
-rw-r--r-- | vendor/github.com/ethereum/go-ethereum/rlp/decode.go | 1049 | ||||
-rw-r--r-- | vendor/github.com/ethereum/go-ethereum/rlp/doc.go | 33 | ||||
-rw-r--r-- | vendor/github.com/ethereum/go-ethereum/rlp/encode.go | 651 | ||||
-rw-r--r-- | vendor/github.com/ethereum/go-ethereum/rlp/raw.go | 156 | ||||
-rw-r--r-- | vendor/github.com/ethereum/go-ethereum/rlp/typecache.go | 165 | ||||
-rw-r--r-- | vendor/vendor.json | 195 |
314 files changed, 4443 insertions, 923 deletions
diff --git a/vendor/cloud.google.com/go/storage/storage.go b/vendor/cloud.google.com/go/storage/storage.go index 4b4d62eeb..6c62e3e1d 100644 --- a/vendor/cloud.google.com/go/storage/storage.go +++ b/vendor/cloud.google.com/go/storage/storage.go @@ -813,23 +813,23 @@ func newObject(o *raw.Object) *ObjectAttrs { EventBasedHold: o.EventBasedHold, TemporaryHold: o.TemporaryHold, RetentionExpirationTime: convertTime(o.RetentionExpirationTime), - ACL: toObjectACLRules(o.Acl), - Owner: owner, - ContentEncoding: o.ContentEncoding, - ContentDisposition: o.ContentDisposition, - Size: int64(o.Size), - MD5: md5, - CRC32C: crc32c, - MediaLink: o.MediaLink, - Metadata: o.Metadata, - Generation: o.Generation, - Metageneration: o.Metageneration, - StorageClass: o.StorageClass, - CustomerKeySHA256: sha256, - KMSKeyName: o.KmsKeyName, - Created: convertTime(o.TimeCreated), - Deleted: convertTime(o.TimeDeleted), - Updated: convertTime(o.Updated), + ACL: toObjectACLRules(o.Acl), + Owner: owner, + ContentEncoding: o.ContentEncoding, + ContentDisposition: o.ContentDisposition, + Size: int64(o.Size), + MD5: md5, + CRC32C: crc32c, + MediaLink: o.MediaLink, + Metadata: o.Metadata, + Generation: o.Generation, + Metageneration: o.Metageneration, + StorageClass: o.StorageClass, + CustomerKeySHA256: sha256, + KMSKeyName: o.KmsKeyName, + Created: convertTime(o.TimeCreated), + Deleted: convertTime(o.TimeDeleted), + Updated: convertTime(o.Updated), } } diff --git a/vendor/github.com/dexon-foundation/bls/.gitignore b/vendor/github.com/byzantine-lab/bls/.gitignore index dacdfc906..dacdfc906 100644 --- a/vendor/github.com/dexon-foundation/bls/.gitignore +++ b/vendor/github.com/byzantine-lab/bls/.gitignore diff --git a/vendor/github.com/dexon-foundation/bls/.travis.yml b/vendor/github.com/byzantine-lab/bls/.travis.yml index 71a667a2e..71a667a2e 100644 --- a/vendor/github.com/dexon-foundation/bls/.travis.yml +++ b/vendor/github.com/byzantine-lab/bls/.travis.yml diff --git a/vendor/github.com/dexon-foundation/bls/CMakeLists.txt b/vendor/github.com/byzantine-lab/bls/CMakeLists.txt index 30fb90fd5..30fb90fd5 100644 --- a/vendor/github.com/dexon-foundation/bls/CMakeLists.txt +++ b/vendor/github.com/byzantine-lab/bls/CMakeLists.txt diff --git a/vendor/github.com/dexon-foundation/bls/Makefile b/vendor/github.com/byzantine-lab/bls/Makefile index efea22274..efea22274 100644 --- a/vendor/github.com/dexon-foundation/bls/Makefile +++ b/vendor/github.com/byzantine-lab/bls/Makefile diff --git a/vendor/github.com/dexon-foundation/bls/bin/.emptydir b/vendor/github.com/byzantine-lab/bls/bin/.emptydir index e69de29bb..e69de29bb 100644 --- a/vendor/github.com/dexon-foundation/bls/bin/.emptydir +++ b/vendor/github.com/byzantine-lab/bls/bin/.emptydir diff --git a/vendor/github.com/dexon-foundation/bls/bls.sln b/vendor/github.com/byzantine-lab/bls/bls.sln index 4889ec601..4889ec601 100644 --- a/vendor/github.com/dexon-foundation/bls/bls.sln +++ b/vendor/github.com/byzantine-lab/bls/bls.sln diff --git a/vendor/github.com/dexon-foundation/bls/bls_smpl.py b/vendor/github.com/byzantine-lab/bls/bls_smpl.py index f834d80aa..f834d80aa 100644 --- a/vendor/github.com/dexon-foundation/bls/bls_smpl.py +++ b/vendor/github.com/byzantine-lab/bls/bls_smpl.py diff --git a/vendor/github.com/dexon-foundation/bls/common.props b/vendor/github.com/byzantine-lab/bls/common.props index d6fdbb902..d6fdbb902 100644 --- a/vendor/github.com/dexon-foundation/bls/common.props +++ b/vendor/github.com/byzantine-lab/bls/common.props diff --git a/vendor/github.com/dexon-foundation/bls/debug.props b/vendor/github.com/byzantine-lab/bls/debug.props index 1553ae0dc..1553ae0dc 100644 --- a/vendor/github.com/dexon-foundation/bls/debug.props +++ b/vendor/github.com/byzantine-lab/bls/debug.props diff --git a/vendor/github.com/dexon-foundation/bls/ffi/cs/App.config b/vendor/github.com/byzantine-lab/bls/ffi/cs/App.config index 8d234373a..8d234373a 100644 --- a/vendor/github.com/dexon-foundation/bls/ffi/cs/App.config +++ b/vendor/github.com/byzantine-lab/bls/ffi/cs/App.config diff --git a/vendor/github.com/dexon-foundation/bls/ffi/cs/Properties/AssemblyInfo.cs b/vendor/github.com/byzantine-lab/bls/ffi/cs/Properties/AssemblyInfo.cs index 201222c55..201222c55 100644 --- a/vendor/github.com/dexon-foundation/bls/ffi/cs/Properties/AssemblyInfo.cs +++ b/vendor/github.com/byzantine-lab/bls/ffi/cs/Properties/AssemblyInfo.cs diff --git a/vendor/github.com/dexon-foundation/bls/ffi/cs/bls.cs b/vendor/github.com/byzantine-lab/bls/ffi/cs/bls.cs index 6bcaf07fb..6bcaf07fb 100644 --- a/vendor/github.com/dexon-foundation/bls/ffi/cs/bls.cs +++ b/vendor/github.com/byzantine-lab/bls/ffi/cs/bls.cs diff --git a/vendor/github.com/dexon-foundation/bls/ffi/cs/bls.csproj b/vendor/github.com/byzantine-lab/bls/ffi/cs/bls.csproj index c03afa436..c03afa436 100644 --- a/vendor/github.com/dexon-foundation/bls/ffi/cs/bls.csproj +++ b/vendor/github.com/byzantine-lab/bls/ffi/cs/bls.csproj diff --git a/vendor/github.com/dexon-foundation/bls/ffi/cs/bls.sln b/vendor/github.com/byzantine-lab/bls/ffi/cs/bls.sln index 7c3dfba7b..7c3dfba7b 100644 --- a/vendor/github.com/dexon-foundation/bls/ffi/cs/bls.sln +++ b/vendor/github.com/byzantine-lab/bls/ffi/cs/bls.sln diff --git a/vendor/github.com/dexon-foundation/bls/ffi/cs/bls256.cs b/vendor/github.com/byzantine-lab/bls/ffi/cs/bls256.cs index 3ef5fab9a..3ef5fab9a 100644 --- a/vendor/github.com/dexon-foundation/bls/ffi/cs/bls256.cs +++ b/vendor/github.com/byzantine-lab/bls/ffi/cs/bls256.cs diff --git a/vendor/github.com/dexon-foundation/bls/ffi/cs/bls256.csproj b/vendor/github.com/byzantine-lab/bls/ffi/cs/bls256.csproj index 032a1d347..032a1d347 100644 --- a/vendor/github.com/dexon-foundation/bls/ffi/cs/bls256.csproj +++ b/vendor/github.com/byzantine-lab/bls/ffi/cs/bls256.csproj diff --git a/vendor/github.com/dexon-foundation/bls/ffi/cs/bls256.sln b/vendor/github.com/byzantine-lab/bls/ffi/cs/bls256.sln index eb29af97b..eb29af97b 100644 --- a/vendor/github.com/dexon-foundation/bls/ffi/cs/bls256.sln +++ b/vendor/github.com/byzantine-lab/bls/ffi/cs/bls256.sln diff --git a/vendor/github.com/dexon-foundation/bls/ffi/cs/bls256_test.cs b/vendor/github.com/byzantine-lab/bls/ffi/cs/bls256_test.cs index 989993e0f..989993e0f 100644 --- a/vendor/github.com/dexon-foundation/bls/ffi/cs/bls256_test.cs +++ b/vendor/github.com/byzantine-lab/bls/ffi/cs/bls256_test.cs diff --git a/vendor/github.com/dexon-foundation/bls/ffi/cs/bls_test.cs b/vendor/github.com/byzantine-lab/bls/ffi/cs/bls_test.cs index 2eb451ba9..2eb451ba9 100644 --- a/vendor/github.com/dexon-foundation/bls/ffi/cs/bls_test.cs +++ b/vendor/github.com/byzantine-lab/bls/ffi/cs/bls_test.cs diff --git a/vendor/github.com/dexon-foundation/bls/ffi/cs/readme-ja.md b/vendor/github.com/byzantine-lab/bls/ffi/cs/readme-ja.md index 199135725..199135725 100644 --- a/vendor/github.com/dexon-foundation/bls/ffi/cs/readme-ja.md +++ b/vendor/github.com/byzantine-lab/bls/ffi/cs/readme-ja.md diff --git a/vendor/github.com/dexon-foundation/bls/ffi/cs/readme.md b/vendor/github.com/byzantine-lab/bls/ffi/cs/readme.md index 2b7191871..2b7191871 100644 --- a/vendor/github.com/dexon-foundation/bls/ffi/cs/readme.md +++ b/vendor/github.com/byzantine-lab/bls/ffi/cs/readme.md diff --git a/vendor/github.com/dexon-foundation/bls/ffi/go/bls/bls.go b/vendor/github.com/byzantine-lab/bls/ffi/go/bls/bls.go index 56bf08039..56bf08039 100644 --- a/vendor/github.com/dexon-foundation/bls/ffi/go/bls/bls.go +++ b/vendor/github.com/byzantine-lab/bls/ffi/go/bls/bls.go diff --git a/vendor/github.com/dexon-foundation/bls/ffi/go/bls/callback.go b/vendor/github.com/byzantine-lab/bls/ffi/go/bls/callback.go index ba73a5e15..ba73a5e15 100644 --- a/vendor/github.com/dexon-foundation/bls/ffi/go/bls/callback.go +++ b/vendor/github.com/byzantine-lab/bls/ffi/go/bls/callback.go diff --git a/vendor/github.com/dexon-foundation/bls/ffi/go/bls/dummy.cpp b/vendor/github.com/byzantine-lab/bls/ffi/go/bls/dummy.cpp index a5103a1c5..a5103a1c5 100644 --- a/vendor/github.com/dexon-foundation/bls/ffi/go/bls/dummy.cpp +++ b/vendor/github.com/byzantine-lab/bls/ffi/go/bls/dummy.cpp diff --git a/vendor/github.com/dexon-foundation/bls/ffi/go/bls/mcl.go b/vendor/github.com/byzantine-lab/bls/ffi/go/bls/mcl.go index ca8d7f02b..ca8d7f02b 100644 --- a/vendor/github.com/dexon-foundation/bls/ffi/go/bls/mcl.go +++ b/vendor/github.com/byzantine-lab/bls/ffi/go/bls/mcl.go diff --git a/vendor/github.com/dexon-foundation/bls/images/bls-go-alpine/Dockerfile b/vendor/github.com/byzantine-lab/bls/images/bls-go-alpine/Dockerfile index edd49eb4b..edd49eb4b 100644 --- a/vendor/github.com/dexon-foundation/bls/images/bls-go-alpine/Dockerfile +++ b/vendor/github.com/byzantine-lab/bls/images/bls-go-alpine/Dockerfile diff --git a/vendor/github.com/dexon-foundation/bls/include/bls/bls.h b/vendor/github.com/byzantine-lab/bls/include/bls/bls.h index cb300bc49..cb300bc49 100644 --- a/vendor/github.com/dexon-foundation/bls/include/bls/bls.h +++ b/vendor/github.com/byzantine-lab/bls/include/bls/bls.h diff --git a/vendor/github.com/dexon-foundation/bls/include/bls/bls.hpp b/vendor/github.com/byzantine-lab/bls/include/bls/bls.hpp index 741334555..741334555 100644 --- a/vendor/github.com/dexon-foundation/bls/include/bls/bls.hpp +++ b/vendor/github.com/byzantine-lab/bls/include/bls/bls.hpp diff --git a/vendor/github.com/dexon-foundation/bls/lib/.emptydir b/vendor/github.com/byzantine-lab/bls/lib/.emptydir index e69de29bb..e69de29bb 100644 --- a/vendor/github.com/dexon-foundation/bls/lib/.emptydir +++ b/vendor/github.com/byzantine-lab/bls/lib/.emptydir diff --git a/vendor/github.com/dexon-foundation/bls/mk.bat b/vendor/github.com/byzantine-lab/bls/mk.bat index 9bf8dd9e6..9bf8dd9e6 100644 --- a/vendor/github.com/dexon-foundation/bls/mk.bat +++ b/vendor/github.com/byzantine-lab/bls/mk.bat diff --git a/vendor/github.com/dexon-foundation/bls/mkdll.bat b/vendor/github.com/byzantine-lab/bls/mkdll.bat index 17e934f92..17e934f92 100755 --- a/vendor/github.com/dexon-foundation/bls/mkdll.bat +++ b/vendor/github.com/byzantine-lab/bls/mkdll.bat diff --git a/vendor/github.com/dexon-foundation/bls/mklib.bat b/vendor/github.com/byzantine-lab/bls/mklib.bat index 4a60d7196..4a60d7196 100644 --- a/vendor/github.com/dexon-foundation/bls/mklib.bat +++ b/vendor/github.com/byzantine-lab/bls/mklib.bat diff --git a/vendor/github.com/dexon-foundation/bls/obj/.emptydir b/vendor/github.com/byzantine-lab/bls/obj/.emptydir index e69de29bb..e69de29bb 100644 --- a/vendor/github.com/dexon-foundation/bls/obj/.emptydir +++ b/vendor/github.com/byzantine-lab/bls/obj/.emptydir diff --git a/vendor/github.com/dexon-foundation/bls/readme.md b/vendor/github.com/byzantine-lab/bls/readme.md index b1efb3f36..b1efb3f36 100644 --- a/vendor/github.com/dexon-foundation/bls/readme.md +++ b/vendor/github.com/byzantine-lab/bls/readme.md diff --git a/vendor/github.com/dexon-foundation/bls/release.props b/vendor/github.com/byzantine-lab/bls/release.props index 886ce6890..886ce6890 100644 --- a/vendor/github.com/dexon-foundation/bls/release.props +++ b/vendor/github.com/byzantine-lab/bls/release.props diff --git a/vendor/github.com/dexon-foundation/bls/sample/bls_smpl.cpp b/vendor/github.com/byzantine-lab/bls/sample/bls_smpl.cpp index e812cd500..e812cd500 100644 --- a/vendor/github.com/dexon-foundation/bls/sample/bls_smpl.cpp +++ b/vendor/github.com/byzantine-lab/bls/sample/bls_smpl.cpp diff --git a/vendor/github.com/dexon-foundation/bls/setvar.bat b/vendor/github.com/byzantine-lab/bls/setvar.bat index 0ff286ab8..0ff286ab8 100755 --- a/vendor/github.com/dexon-foundation/bls/setvar.bat +++ b/vendor/github.com/byzantine-lab/bls/setvar.bat diff --git a/vendor/github.com/dexon-foundation/bls/src/bls_c256.cpp b/vendor/github.com/byzantine-lab/bls/src/bls_c256.cpp index a9f3412ea..a9f3412ea 100644 --- a/vendor/github.com/dexon-foundation/bls/src/bls_c256.cpp +++ b/vendor/github.com/byzantine-lab/bls/src/bls_c256.cpp diff --git a/vendor/github.com/dexon-foundation/bls/src/bls_c384.cpp b/vendor/github.com/byzantine-lab/bls/src/bls_c384.cpp index d28f8547b..d28f8547b 100644 --- a/vendor/github.com/dexon-foundation/bls/src/bls_c384.cpp +++ b/vendor/github.com/byzantine-lab/bls/src/bls_c384.cpp diff --git a/vendor/github.com/dexon-foundation/bls/src/bls_c384_256.cpp b/vendor/github.com/byzantine-lab/bls/src/bls_c384_256.cpp index 3dcb3e7d7..3dcb3e7d7 100644 --- a/vendor/github.com/dexon-foundation/bls/src/bls_c384_256.cpp +++ b/vendor/github.com/byzantine-lab/bls/src/bls_c384_256.cpp diff --git a/vendor/github.com/dexon-foundation/bls/src/bls_c_impl.hpp b/vendor/github.com/byzantine-lab/bls/src/bls_c_impl.hpp index b38c1ad06..b38c1ad06 100644 --- a/vendor/github.com/dexon-foundation/bls/src/bls_c_impl.hpp +++ b/vendor/github.com/byzantine-lab/bls/src/bls_c_impl.hpp diff --git a/vendor/github.com/dexon-foundation/bls/src/proj/bls.vcxproj b/vendor/github.com/byzantine-lab/bls/src/proj/bls.vcxproj index b78c97919..b78c97919 100644 --- a/vendor/github.com/dexon-foundation/bls/src/proj/bls.vcxproj +++ b/vendor/github.com/byzantine-lab/bls/src/proj/bls.vcxproj diff --git a/vendor/github.com/dexon-foundation/bls/src/qcoeff-bn254.hpp b/vendor/github.com/byzantine-lab/bls/src/qcoeff-bn254.hpp index 18d169568..18d169568 100644 --- a/vendor/github.com/dexon-foundation/bls/src/qcoeff-bn254.hpp +++ b/vendor/github.com/byzantine-lab/bls/src/qcoeff-bn254.hpp diff --git a/vendor/github.com/dexon-foundation/bls/test/bls256_test.cpp b/vendor/github.com/byzantine-lab/bls/test/bls256_test.cpp index e53a87057..e53a87057 100644 --- a/vendor/github.com/dexon-foundation/bls/test/bls256_test.cpp +++ b/vendor/github.com/byzantine-lab/bls/test/bls256_test.cpp diff --git a/vendor/github.com/dexon-foundation/bls/test/bls384_256_test.cpp b/vendor/github.com/byzantine-lab/bls/test/bls384_256_test.cpp index ea8126567..ea8126567 100644 --- a/vendor/github.com/dexon-foundation/bls/test/bls384_256_test.cpp +++ b/vendor/github.com/byzantine-lab/bls/test/bls384_256_test.cpp diff --git a/vendor/github.com/dexon-foundation/bls/test/bls384_test.cpp b/vendor/github.com/byzantine-lab/bls/test/bls384_test.cpp index 2212f8e6b..2212f8e6b 100644 --- a/vendor/github.com/dexon-foundation/bls/test/bls384_test.cpp +++ b/vendor/github.com/byzantine-lab/bls/test/bls384_test.cpp diff --git a/vendor/github.com/dexon-foundation/bls/test/bls_c256_test.cpp b/vendor/github.com/byzantine-lab/bls/test/bls_c256_test.cpp index 8613720b4..8613720b4 100644 --- a/vendor/github.com/dexon-foundation/bls/test/bls_c256_test.cpp +++ b/vendor/github.com/byzantine-lab/bls/test/bls_c256_test.cpp diff --git a/vendor/github.com/dexon-foundation/bls/test/bls_c384_256_test.cpp b/vendor/github.com/byzantine-lab/bls/test/bls_c384_256_test.cpp index 6f153f9d8..6f153f9d8 100644 --- a/vendor/github.com/dexon-foundation/bls/test/bls_c384_256_test.cpp +++ b/vendor/github.com/byzantine-lab/bls/test/bls_c384_256_test.cpp diff --git a/vendor/github.com/dexon-foundation/bls/test/bls_c384_test.cpp b/vendor/github.com/byzantine-lab/bls/test/bls_c384_test.cpp index b6886dd04..b6886dd04 100644 --- a/vendor/github.com/dexon-foundation/bls/test/bls_c384_test.cpp +++ b/vendor/github.com/byzantine-lab/bls/test/bls_c384_test.cpp diff --git a/vendor/github.com/dexon-foundation/bls/test/bls_c_test.hpp b/vendor/github.com/byzantine-lab/bls/test/bls_c_test.hpp index e9b6e6302..e9b6e6302 100644 --- a/vendor/github.com/dexon-foundation/bls/test/bls_c_test.hpp +++ b/vendor/github.com/byzantine-lab/bls/test/bls_c_test.hpp diff --git a/vendor/github.com/dexon-foundation/bls/test/bls_test.hpp b/vendor/github.com/byzantine-lab/bls/test/bls_test.hpp index 346fafe15..346fafe15 100644 --- a/vendor/github.com/dexon-foundation/bls/test/bls_test.hpp +++ b/vendor/github.com/byzantine-lab/bls/test/bls_test.hpp diff --git a/vendor/github.com/dexon-foundation/bls/test/proj/bls_test/bls_test.vcxproj b/vendor/github.com/byzantine-lab/bls/test/proj/bls_test/bls_test.vcxproj index 1755135fb..1755135fb 100644 --- a/vendor/github.com/dexon-foundation/bls/test/proj/bls_test/bls_test.vcxproj +++ b/vendor/github.com/byzantine-lab/bls/test/proj/bls_test/bls_test.vcxproj diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/LICENSE b/vendor/github.com/byzantine-lab/dexon-consensus/LICENSE index 0a041280b..0a041280b 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/LICENSE +++ b/vendor/github.com/byzantine-lab/dexon-consensus/LICENSE diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/common/event.go b/vendor/github.com/byzantine-lab/dexon-consensus/common/event.go index 4e4e23bf3..4e4e23bf3 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/common/event.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/common/event.go diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/common/logger.go b/vendor/github.com/byzantine-lab/dexon-consensus/common/logger.go index 3328e939a..3328e939a 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/common/logger.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/common/logger.go diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/common/types.go b/vendor/github.com/byzantine-lab/dexon-consensus/common/types.go index 883492bf3..883492bf3 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/common/types.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/common/types.go diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/common/utils.go b/vendor/github.com/byzantine-lab/dexon-consensus/common/utils.go index 0e847900f..0e847900f 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/common/utils.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/common/utils.go diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/agreement-mgr.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/agreement-mgr.go index 17def6747..cdbfadf13 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/agreement-mgr.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/agreement-mgr.go @@ -26,10 +26,10 @@ import ( lru "github.com/hashicorp/golang-lru" - "github.com/dexon-foundation/dexon-consensus/common" - "github.com/dexon-foundation/dexon-consensus/core/types" - typesDKG "github.com/dexon-foundation/dexon-consensus/core/types/dkg" - "github.com/dexon-foundation/dexon-consensus/core/utils" + "github.com/byzantine-lab/dexon-consensus/common" + "github.com/byzantine-lab/dexon-consensus/core/types" + typesDKG "github.com/byzantine-lab/dexon-consensus/core/types/dkg" + "github.com/byzantine-lab/dexon-consensus/core/utils" ) // Errors returned from BA modules diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/agreement-state.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/agreement-state.go index 0d1ae58bc..fc2b6f3d5 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/agreement-state.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/agreement-state.go @@ -20,7 +20,7 @@ package core import ( "fmt" - "github.com/dexon-foundation/dexon-consensus/core/types" + "github.com/byzantine-lab/dexon-consensus/core/types" ) // Errors for agreement state module. diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/agreement.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/agreement.go index d90afc610..bad6afa2b 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/agreement.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/agreement.go @@ -24,9 +24,9 @@ import ( "sync/atomic" "time" - "github.com/dexon-foundation/dexon-consensus/common" - "github.com/dexon-foundation/dexon-consensus/core/types" - "github.com/dexon-foundation/dexon-consensus/core/utils" + "github.com/byzantine-lab/dexon-consensus/common" + "github.com/byzantine-lab/dexon-consensus/core/types" + "github.com/byzantine-lab/dexon-consensus/core/utils" ) // closedchan is a reusable closed channel. diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/blockchain.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/blockchain.go index 4fae221c7..579ccd44c 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/blockchain.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/blockchain.go @@ -26,10 +26,10 @@ import ( "sync" "time" - "github.com/dexon-foundation/dexon-consensus/common" - "github.com/dexon-foundation/dexon-consensus/core/crypto" - "github.com/dexon-foundation/dexon-consensus/core/types" - "github.com/dexon-foundation/dexon-consensus/core/utils" + "github.com/byzantine-lab/dexon-consensus/common" + "github.com/byzantine-lab/dexon-consensus/core/crypto" + "github.com/byzantine-lab/dexon-consensus/core/types" + "github.com/byzantine-lab/dexon-consensus/core/utils" ) // Errors for sanity check error. diff --git a/vendor/github.com/byzantine-lab/dexon-consensus/core/blockdb/interfaces.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/blockdb/interfaces.go new file mode 100644 index 000000000..c85630775 --- /dev/null +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/blockdb/interfaces.go @@ -0,0 +1,70 @@ +// Copyright 2018 The dexon-consensus Authors +// This file is part of the dexon-consensus library. +// +// The dexon-consensus 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 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 library. If not, see +// <http://www.gnu.org/licenses/>. + +package blockdb + +import ( + "errors" + "fmt" + + "github.com/dexon-foundation/dexon-consensus/common" + "github.com/dexon-foundation/dexon-consensus/core/types" +) + +var ( + // ErrBlockExists is the error when block eixsts. + ErrBlockExists = errors.New("block exists") + // ErrBlockDoesNotExist is the error when block does not eixst. + ErrBlockDoesNotExist = errors.New("block does not exist") + // ErrIterationFinished is the error to check if the iteration is finished. + ErrIterationFinished = errors.New("iteration finished") + // ErrEmptyPath is the error when the required path is empty. + ErrEmptyPath = fmt.Errorf("empty path") + // ErrClosed is the error when using DB after it's closed. + ErrClosed = fmt.Errorf("db closed") + // ErrNotImplemented is the error that some interface is not implemented. + ErrNotImplemented = fmt.Errorf("not implemented") +) + +// BlockDatabase is the interface for a BlockDatabase. +type BlockDatabase interface { + Reader + Writer + + // Close allows database implementation able to + // release resource when finishing. + Close() error +} + +// Reader defines the interface for reading blocks into DB. +type Reader interface { + Has(hash common.Hash) bool + Get(hash common.Hash) (types.Block, error) + GetAll() (BlockIterator, error) +} + +// Writer defines the interface for writing blocks into DB. +type Writer interface { + Update(block types.Block) error + Put(block types.Block) error +} + +// BlockIterator defines an iterator on blocks hold +// in a DB. +type BlockIterator interface { + Next() (types.Block, error) +} diff --git a/vendor/github.com/byzantine-lab/dexon-consensus/core/blockdb/level-db.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/blockdb/level-db.go new file mode 100644 index 000000000..76730fc9c --- /dev/null +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/blockdb/level-db.go @@ -0,0 +1,127 @@ +// Copyright 2018 The dexon-consensus Authors +// This file is part of the dexon-consensus library. +// +// The dexon-consensus 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 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 library. If not, see +// <http://www.gnu.org/licenses/>. + +package blockdb + +import ( + "encoding/json" + + "github.com/syndtr/goleveldb/leveldb" + + "github.com/dexon-foundation/dexon-consensus/common" + "github.com/dexon-foundation/dexon-consensus/core/types" +) + +// LevelDBBackedBlockDB is a leveldb backed BlockDB implementation. +type LevelDBBackedBlockDB struct { + db *leveldb.DB +} + +// NewLevelDBBackedBlockDB initialize a leveldb-backed block database. +func NewLevelDBBackedBlockDB( + path string) (lvl *LevelDBBackedBlockDB, err error) { + + db, err := leveldb.OpenFile(path, nil) + if err != nil { + return + } + lvl = &LevelDBBackedBlockDB{db: db} + return +} + +// Close implement Closer interface, which would release allocated resource. +func (lvl *LevelDBBackedBlockDB) Close() error { + return lvl.db.Close() +} + +// Has implements the Reader.Has method. +func (lvl *LevelDBBackedBlockDB) Has(hash common.Hash) bool { + exists, err := lvl.db.Has([]byte(hash[:]), nil) + if err != nil { + // TODO(missionliao): Modify the interface to return error. + panic(err) + } + return exists +} + +// Get implements the Reader.Get method. +func (lvl *LevelDBBackedBlockDB) Get( + hash common.Hash) (block types.Block, err error) { + + queried, err := lvl.db.Get([]byte(hash[:]), nil) + if err != nil { + if err == leveldb.ErrNotFound { + err = ErrBlockDoesNotExist + } + return + } + err = json.Unmarshal(queried, &block) + if err != nil { + return + } + return +} + +// Update implements the Writer.Update method. +func (lvl *LevelDBBackedBlockDB) Update(block types.Block) (err error) { + // NOTE: we didn't handle changes of block hash (and it + // should not happen). + marshaled, err := json.Marshal(&block) + if err != nil { + return + } + + if !lvl.Has(block.Hash) { + err = ErrBlockDoesNotExist + return + } + err = lvl.db.Put( + []byte(block.Hash[:]), + marshaled, + nil) + if err != nil { + return + } + return +} + +// Put implements the Writer.Put method. +func (lvl *LevelDBBackedBlockDB) Put(block types.Block) (err error) { + marshaled, err := json.Marshal(&block) + if err != nil { + return + } + if lvl.Has(block.Hash) { + err = ErrBlockExists + return + } + err = lvl.db.Put( + []byte(block.Hash[:]), + marshaled, + nil) + if err != nil { + return + } + return +} + +// GetAll implements Reader.GetAll method, which allows callers +// to retrieve all blocks in DB. +func (lvl *LevelDBBackedBlockDB) GetAll() (BlockIterator, error) { + // TODO (mission): Implement this part via goleveldb's iterator. + return nil, ErrNotImplemented +} diff --git a/vendor/github.com/byzantine-lab/dexon-consensus/core/blockdb/memory.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/blockdb/memory.go new file mode 100644 index 000000000..b45af229b --- /dev/null +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/blockdb/memory.go @@ -0,0 +1,183 @@ +// Copyright 2018 The dexon-consensus Authors +// This file is part of the dexon-consensus library. +// +// The dexon-consensus 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 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 library. If not, see +// <http://www.gnu.org/licenses/>. + +package blockdb + +import ( + "encoding/json" + "io/ioutil" + "os" + "sync" + + "github.com/dexon-foundation/dexon-consensus/common" + "github.com/dexon-foundation/dexon-consensus/core/types" +) + +type seqIterator struct { + idx int + db *MemBackedBlockDB +} + +func (seq *seqIterator) Next() (types.Block, error) { + curIdx := seq.idx + seq.idx++ + return seq.db.getByIndex(curIdx) +} + +// MemBackedBlockDB is a memory backed BlockDB implementation. +type MemBackedBlockDB struct { + blocksMutex sync.RWMutex + blockHashSequence common.Hashes + blocksByHash map[common.Hash]*types.Block + persistantFilePath string +} + +// NewMemBackedBlockDB initialize a memory-backed block database. +func NewMemBackedBlockDB(persistantFilePath ...string) (db *MemBackedBlockDB, err error) { + db = &MemBackedBlockDB{ + blockHashSequence: common.Hashes{}, + blocksByHash: make(map[common.Hash]*types.Block), + } + if len(persistantFilePath) == 0 || len(persistantFilePath[0]) == 0 { + return + } + db.persistantFilePath = persistantFilePath[0] + buf, err := ioutil.ReadFile(db.persistantFilePath) + if err != nil { + if !os.IsNotExist(err) { + // Something unexpected happened. + return + } + // It's expected behavior that file doesn't exists, we should not + // report error on it. + err = nil + return + } + + // Init this instance by file content, it's a temporary way + // to export those private field for JSON encoding. + toLoad := struct { + Sequence common.Hashes + ByHash map[common.Hash]*types.Block + }{} + err = json.Unmarshal(buf, &toLoad) + if err != nil { + return + } + db.blockHashSequence = toLoad.Sequence + db.blocksByHash = toLoad.ByHash + return +} + +// Has returns wheter or not the DB has a block identified with the hash. +func (m *MemBackedBlockDB) Has(hash common.Hash) bool { + m.blocksMutex.RLock() + defer m.blocksMutex.RUnlock() + + _, ok := m.blocksByHash[hash] + return ok +} + +// Get returns a block given a hash. +func (m *MemBackedBlockDB) Get(hash common.Hash) (types.Block, error) { + m.blocksMutex.RLock() + defer m.blocksMutex.RUnlock() + + return m.internalGet(hash) +} + +func (m *MemBackedBlockDB) internalGet(hash common.Hash) (types.Block, error) { + b, ok := m.blocksByHash[hash] + if !ok { + return types.Block{}, ErrBlockDoesNotExist + } + return *b, nil +} + +// Put inserts a new block into the database. +func (m *MemBackedBlockDB) Put(block types.Block) error { + if m.Has(block.Hash) { + return ErrBlockExists + } + + m.blocksMutex.Lock() + defer m.blocksMutex.Unlock() + + m.blockHashSequence = append(m.blockHashSequence, block.Hash) + m.blocksByHash[block.Hash] = &block + return nil +} + +// Update updates a block in the database. +func (m *MemBackedBlockDB) Update(block types.Block) error { + if !m.Has(block.Hash) { + return ErrBlockDoesNotExist + } + + m.blocksMutex.Lock() + defer m.blocksMutex.Unlock() + + m.blocksByHash[block.Hash] = &block + return nil +} + +// Close implement Closer interface, which would release allocated resource. +func (m *MemBackedBlockDB) Close() (err error) { + // Save internal state to a pretty-print json file. It's a temporary way + // to dump private file via JSON encoding. + if len(m.persistantFilePath) == 0 { + return + } + + m.blocksMutex.RLock() + defer m.blocksMutex.RUnlock() + + toDump := struct { + Sequence common.Hashes + ByHash map[common.Hash]*types.Block + }{ + Sequence: m.blockHashSequence, + ByHash: m.blocksByHash, + } + + // Dump to JSON with 2-space indent. + buf, err := json.Marshal(&toDump) + if err != nil { + return + } + + err = ioutil.WriteFile(m.persistantFilePath, buf, 0644) + return +} + +func (m *MemBackedBlockDB) getByIndex(idx int) (types.Block, error) { + m.blocksMutex.RLock() + defer m.blocksMutex.RUnlock() + + if idx >= len(m.blockHashSequence) { + return types.Block{}, ErrIterationFinished + } + + hash := m.blockHashSequence[idx] + return m.internalGet(hash) +} + +// GetAll implement Reader.GetAll method, which allows caller +// to retrieve all blocks in DB. +func (m *MemBackedBlockDB) GetAll() (BlockIterator, error) { + return &seqIterator{db: m}, nil +} diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/configuration-chain.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/configuration-chain.go index 3b4cdbbc8..0f1400cb5 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/configuration-chain.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/configuration-chain.go @@ -23,12 +23,12 @@ import ( "sync" "time" - "github.com/dexon-foundation/dexon-consensus/common" - "github.com/dexon-foundation/dexon-consensus/core/crypto" - "github.com/dexon-foundation/dexon-consensus/core/db" - "github.com/dexon-foundation/dexon-consensus/core/types" - typesDKG "github.com/dexon-foundation/dexon-consensus/core/types/dkg" - "github.com/dexon-foundation/dexon-consensus/core/utils" + "github.com/byzantine-lab/dexon-consensus/common" + "github.com/byzantine-lab/dexon-consensus/core/crypto" + "github.com/byzantine-lab/dexon-consensus/core/db" + "github.com/byzantine-lab/dexon-consensus/core/types" + typesDKG "github.com/byzantine-lab/dexon-consensus/core/types/dkg" + "github.com/byzantine-lab/dexon-consensus/core/utils" ) // Errors for configuration chain.. diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/consensus.go index fd8456487..8b2b9a048 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/consensus.go @@ -24,13 +24,13 @@ import ( "sync" "time" - "github.com/dexon-foundation/dexon-consensus/common" - "github.com/dexon-foundation/dexon-consensus/core/crypto" - cryptoDKG "github.com/dexon-foundation/dexon-consensus/core/crypto/dkg" - "github.com/dexon-foundation/dexon-consensus/core/db" - "github.com/dexon-foundation/dexon-consensus/core/types" - typesDKG "github.com/dexon-foundation/dexon-consensus/core/types/dkg" - "github.com/dexon-foundation/dexon-consensus/core/utils" + "github.com/byzantine-lab/dexon-consensus/common" + "github.com/byzantine-lab/dexon-consensus/core/crypto" + cryptoDKG "github.com/byzantine-lab/dexon-consensus/core/crypto/dkg" + "github.com/byzantine-lab/dexon-consensus/core/db" + "github.com/byzantine-lab/dexon-consensus/core/types" + typesDKG "github.com/byzantine-lab/dexon-consensus/core/types/dkg" + "github.com/byzantine-lab/dexon-consensus/core/utils" ) // Errors for consensus core. diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/constant.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/constant.go index 29dae8b73..51b95a3c0 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/constant.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/constant.go @@ -17,7 +17,7 @@ package core -import "github.com/dexon-foundation/dexon-consensus/core/utils" +import "github.com/byzantine-lab/dexon-consensus/core/utils" // ConfigRoundShift refers to the difference between block's round and config // round derived from its state. diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/crypto/dkg/constant.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/crypto/dkg/constant.go index 37d873d6f..3f6627b92 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/crypto/dkg/constant.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/crypto/dkg/constant.go @@ -18,7 +18,7 @@ package dkg import ( - "github.com/dexon-foundation/bls/ffi/go/bls" + "github.com/byzantine-lab/bls/ffi/go/bls" ) const ( diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/crypto/dkg/dkg.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/crypto/dkg/dkg.go index ab43f5130..b9dd038ce 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/crypto/dkg/dkg.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/crypto/dkg/dkg.go @@ -24,11 +24,11 @@ import ( "sync" "sync/atomic" - "github.com/dexon-foundation/bls/ffi/go/bls" - "github.com/dexon-foundation/dexon/rlp" + "github.com/byzantine-lab/bls/ffi/go/bls" + "github.com/byzantine-lab/go-tangerine/rlp" - "github.com/dexon-foundation/dexon-consensus/common" - "github.com/dexon-foundation/dexon-consensus/core/crypto" + "github.com/byzantine-lab/dexon-consensus/common" + "github.com/byzantine-lab/dexon-consensus/core/crypto" ) var ( diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/crypto/dkg/utils.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/crypto/dkg/utils.go index 9e470f0cf..589480a3b 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/crypto/dkg/utils.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/crypto/dkg/utils.go @@ -22,9 +22,9 @@ import ( "fmt" "math/rand" - "github.com/dexon-foundation/bls/ffi/go/bls" + "github.com/byzantine-lab/bls/ffi/go/bls" - "github.com/dexon-foundation/dexon-consensus/core/crypto" + "github.com/byzantine-lab/dexon-consensus/core/crypto" ) // PartialSignature is a partial signature in DKG+TSIG protocol. diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/crypto/ecdsa/ecdsa.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/crypto/ecdsa/ecdsa.go index 9da5f4fb5..5c3bf96bb 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/crypto/ecdsa/ecdsa.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/crypto/ecdsa/ecdsa.go @@ -20,10 +20,10 @@ package ecdsa import ( "crypto/ecdsa" - dexCrypto "github.com/dexon-foundation/dexon/crypto" + dexCrypto "github.com/byzantine-lab/go-tangerine/crypto" - "github.com/dexon-foundation/dexon-consensus/common" - "github.com/dexon-foundation/dexon-consensus/core/crypto" + "github.com/byzantine-lab/dexon-consensus/common" + "github.com/byzantine-lab/dexon-consensus/core/crypto" ) const cryptoType = "ecdsa" diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/crypto/interfaces.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/crypto/interfaces.go index f3e01e42c..9fe47f7dc 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/crypto/interfaces.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/crypto/interfaces.go @@ -18,7 +18,7 @@ package crypto import ( - "github.com/dexon-foundation/dexon-consensus/common" + "github.com/byzantine-lab/dexon-consensus/common" ) // Signature is the basic signature type in DEXON. diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/crypto/utils.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/crypto/utils.go index 59e91f5a5..744be3e5f 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/crypto/utils.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/crypto/utils.go @@ -21,9 +21,9 @@ import ( "encoding/hex" "fmt" - "github.com/dexon-foundation/dexon/crypto" + "github.com/byzantine-lab/go-tangerine/crypto" - "github.com/dexon-foundation/dexon-consensus/common" + "github.com/byzantine-lab/dexon-consensus/common" ) var ( diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/db/interfaces.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/db/interfaces.go index a571a8021..1d15c68a0 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/db/interfaces.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/db/interfaces.go @@ -21,9 +21,9 @@ import ( "errors" "fmt" - "github.com/dexon-foundation/dexon-consensus/common" - "github.com/dexon-foundation/dexon-consensus/core/crypto/dkg" - "github.com/dexon-foundation/dexon-consensus/core/types" + "github.com/byzantine-lab/dexon-consensus/common" + "github.com/byzantine-lab/dexon-consensus/core/crypto/dkg" + "github.com/byzantine-lab/dexon-consensus/core/types" ) var ( diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/db/level-db.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/db/level-db.go index da8bc0bc1..9e3564b50 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/db/level-db.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/db/level-db.go @@ -23,10 +23,10 @@ import ( "github.com/syndtr/goleveldb/leveldb" - "github.com/dexon-foundation/dexon-consensus/common" - "github.com/dexon-foundation/dexon-consensus/core/crypto/dkg" - "github.com/dexon-foundation/dexon-consensus/core/types" - "github.com/dexon-foundation/dexon/rlp" + "github.com/byzantine-lab/dexon-consensus/common" + "github.com/byzantine-lab/dexon-consensus/core/crypto/dkg" + "github.com/byzantine-lab/dexon-consensus/core/types" + "github.com/byzantine-lab/go-tangerine/rlp" ) var ( diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/db/memory.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/db/memory.go index 6555de855..2ad5cda9e 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/db/memory.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/db/memory.go @@ -23,9 +23,9 @@ import ( "os" "sync" - "github.com/dexon-foundation/dexon-consensus/common" - "github.com/dexon-foundation/dexon-consensus/core/crypto/dkg" - "github.com/dexon-foundation/dexon-consensus/core/types" + "github.com/byzantine-lab/dexon-consensus/common" + "github.com/byzantine-lab/dexon-consensus/core/crypto/dkg" + "github.com/byzantine-lab/dexon-consensus/core/types" ) type blockSeqIterator struct { diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/dkg-tsig-protocol.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/dkg-tsig-protocol.go index ce5c89c47..38739da4e 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/dkg-tsig-protocol.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/dkg-tsig-protocol.go @@ -21,13 +21,13 @@ import ( "fmt" "sync" - "github.com/dexon-foundation/dexon-consensus/common" - "github.com/dexon-foundation/dexon-consensus/core/crypto" - "github.com/dexon-foundation/dexon-consensus/core/crypto/dkg" - "github.com/dexon-foundation/dexon-consensus/core/db" - "github.com/dexon-foundation/dexon-consensus/core/types" - typesDKG "github.com/dexon-foundation/dexon-consensus/core/types/dkg" - "github.com/dexon-foundation/dexon-consensus/core/utils" + "github.com/byzantine-lab/dexon-consensus/common" + "github.com/byzantine-lab/dexon-consensus/core/crypto" + "github.com/byzantine-lab/dexon-consensus/core/crypto/dkg" + "github.com/byzantine-lab/dexon-consensus/core/db" + "github.com/byzantine-lab/dexon-consensus/core/types" + typesDKG "github.com/byzantine-lab/dexon-consensus/core/types/dkg" + "github.com/byzantine-lab/dexon-consensus/core/utils" ) // Errors for dkg module. diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/interfaces.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/interfaces.go index c88b3dcb4..3adcf78c9 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/interfaces.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/interfaces.go @@ -20,10 +20,10 @@ package core import ( "time" - "github.com/dexon-foundation/dexon-consensus/common" - "github.com/dexon-foundation/dexon-consensus/core/crypto" - "github.com/dexon-foundation/dexon-consensus/core/types" - typesDKG "github.com/dexon-foundation/dexon-consensus/core/types/dkg" + "github.com/byzantine-lab/dexon-consensus/common" + "github.com/byzantine-lab/dexon-consensus/core/crypto" + "github.com/byzantine-lab/dexon-consensus/core/types" + typesDKG "github.com/byzantine-lab/dexon-consensus/core/types/dkg" ) // Application describes the application interface that interacts with DEXON diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/leader-selector.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/leader-selector.go index 91b2e9979..9e3d406a7 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/leader-selector.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/leader-selector.go @@ -21,9 +21,9 @@ import ( "math/big" "sync" - "github.com/dexon-foundation/dexon-consensus/common" - "github.com/dexon-foundation/dexon-consensus/core/crypto" - "github.com/dexon-foundation/dexon-consensus/core/types" + "github.com/byzantine-lab/dexon-consensus/common" + "github.com/byzantine-lab/dexon-consensus/core/crypto" + "github.com/byzantine-lab/dexon-consensus/core/types" ) type validLeaderFn func(block *types.Block, crs common.Hash) (bool, error) diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/nonblocking.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/nonblocking.go index 10b47b822..516138a63 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/nonblocking.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/nonblocking.go @@ -21,8 +21,8 @@ import ( "fmt" "sync" - "github.com/dexon-foundation/dexon-consensus/common" - "github.com/dexon-foundation/dexon-consensus/core/types" + "github.com/byzantine-lab/dexon-consensus/common" + "github.com/byzantine-lab/dexon-consensus/core/types" ) type blockConfirmedEvent struct { diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/syncer/agreement.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/syncer/agreement.go index d39c24627..274cbfc79 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/syncer/agreement.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/syncer/agreement.go @@ -23,11 +23,11 @@ import ( "fmt" "time" - "github.com/dexon-foundation/dexon-consensus/common" - "github.com/dexon-foundation/dexon-consensus/core" - "github.com/dexon-foundation/dexon-consensus/core/crypto" - "github.com/dexon-foundation/dexon-consensus/core/types" - "github.com/dexon-foundation/dexon-consensus/core/utils" + "github.com/byzantine-lab/dexon-consensus/common" + "github.com/byzantine-lab/dexon-consensus/core" + "github.com/byzantine-lab/dexon-consensus/core/crypto" + "github.com/byzantine-lab/dexon-consensus/core/types" + "github.com/byzantine-lab/dexon-consensus/core/utils" ) // Struct agreement implements struct of BA (Byzantine Agreement) protocol diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/syncer/consensus.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/syncer/consensus.go index 496c0f9a8..d12dc4863 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/syncer/consensus.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/syncer/consensus.go @@ -24,12 +24,12 @@ import ( "sync" "time" - "github.com/dexon-foundation/dexon-consensus/common" - "github.com/dexon-foundation/dexon-consensus/core" - "github.com/dexon-foundation/dexon-consensus/core/crypto" - "github.com/dexon-foundation/dexon-consensus/core/db" - "github.com/dexon-foundation/dexon-consensus/core/types" - "github.com/dexon-foundation/dexon-consensus/core/utils" + "github.com/byzantine-lab/dexon-consensus/common" + "github.com/byzantine-lab/dexon-consensus/core" + "github.com/byzantine-lab/dexon-consensus/core/crypto" + "github.com/byzantine-lab/dexon-consensus/core/db" + "github.com/byzantine-lab/dexon-consensus/core/types" + "github.com/byzantine-lab/dexon-consensus/core/utils" ) var ( diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/syncer/watch-cat.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/syncer/watch-cat.go index f2e197ebe..e5ba911a7 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/syncer/watch-cat.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/syncer/watch-cat.go @@ -21,10 +21,10 @@ import ( "context" "time" - "github.com/dexon-foundation/dexon-consensus/common" - "github.com/dexon-foundation/dexon-consensus/core" - "github.com/dexon-foundation/dexon-consensus/core/types" - "github.com/dexon-foundation/dexon-consensus/core/utils" + "github.com/byzantine-lab/dexon-consensus/common" + "github.com/byzantine-lab/dexon-consensus/core" + "github.com/byzantine-lab/dexon-consensus/core/types" + "github.com/byzantine-lab/dexon-consensus/core/utils" ) type configReader interface { diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/ticker.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/ticker.go index 636fb8c49..aba56ef9f 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/ticker.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/ticker.go @@ -23,7 +23,7 @@ import ( "sync" "time" - "github.com/dexon-foundation/dexon-consensus/core/utils" + "github.com/byzantine-lab/dexon-consensus/core/utils" ) // TickerType is the type of ticker. diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/types/block-randomness.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/types/block-randomness.go index 1c7454398..b97188705 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/types/block-randomness.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/types/block-randomness.go @@ -21,7 +21,7 @@ import ( "encoding/hex" "fmt" - "github.com/dexon-foundation/dexon-consensus/common" + "github.com/byzantine-lab/dexon-consensus/common" ) // AgreementResult describes an agremeent result. diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/types/block.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/types/block.go index 1dcd41b9e..bc92211b9 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/types/block.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/types/block.go @@ -25,10 +25,10 @@ import ( "io" "time" - "github.com/dexon-foundation/dexon/rlp" + "github.com/byzantine-lab/go-tangerine/rlp" - "github.com/dexon-foundation/dexon-consensus/common" - "github.com/dexon-foundation/dexon-consensus/core/crypto" + "github.com/byzantine-lab/dexon-consensus/common" + "github.com/byzantine-lab/dexon-consensus/core/crypto" ) // GenesisHeight refers to the initial height the genesis block should be. diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/types/config.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/types/config.go index dce38369e..dce38369e 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/types/config.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/types/config.go diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/types/dkg/dkg.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/types/dkg/dkg.go index cb921e586..6c2b777cd 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/types/dkg/dkg.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/types/dkg/dkg.go @@ -23,12 +23,12 @@ import ( "fmt" "io" - "github.com/dexon-foundation/dexon/rlp" + "github.com/byzantine-lab/go-tangerine/rlp" - "github.com/dexon-foundation/dexon-consensus/common" - "github.com/dexon-foundation/dexon-consensus/core/crypto" - cryptoDKG "github.com/dexon-foundation/dexon-consensus/core/crypto/dkg" - "github.com/dexon-foundation/dexon-consensus/core/types" + "github.com/byzantine-lab/dexon-consensus/common" + "github.com/byzantine-lab/dexon-consensus/core/crypto" + cryptoDKG "github.com/byzantine-lab/dexon-consensus/core/crypto/dkg" + "github.com/byzantine-lab/dexon-consensus/core/types" ) // Errors for typesDKG package. diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/types/message.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/types/message.go index 0335cfaae..0335cfaae 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/types/message.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/types/message.go diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/types/node.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/types/node.go index 18b6831e0..84b38a3b1 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/types/node.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/types/node.go @@ -21,8 +21,8 @@ import ( "bytes" "encoding/hex" - "github.com/dexon-foundation/dexon-consensus/common" - "github.com/dexon-foundation/dexon-consensus/core/crypto" + "github.com/byzantine-lab/dexon-consensus/common" + "github.com/byzantine-lab/dexon-consensus/core/crypto" ) // NodeID is the ID type for nodes. diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/types/nodeset.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/types/nodeset.go index 806000763..522bcb224 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/types/nodeset.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/types/nodeset.go @@ -22,8 +22,8 @@ import ( "encoding/binary" "math/big" - "github.com/dexon-foundation/dexon-consensus/common" - "github.com/dexon-foundation/dexon-consensus/core/crypto" + "github.com/byzantine-lab/dexon-consensus/common" + "github.com/byzantine-lab/dexon-consensus/core/crypto" ) // NodeSet is the node set structure as defined in DEXON consensus core. diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/types/position.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/types/position.go index 81d23c266..81d23c266 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/types/position.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/types/position.go diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/types/vote.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/types/vote.go index 8bc0c78c2..def09293a 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/types/vote.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/types/vote.go @@ -20,9 +20,9 @@ package types import ( "fmt" - "github.com/dexon-foundation/dexon-consensus/common" - "github.com/dexon-foundation/dexon-consensus/core/crypto" - cryptoDKG "github.com/dexon-foundation/dexon-consensus/core/crypto/dkg" + "github.com/byzantine-lab/dexon-consensus/common" + "github.com/byzantine-lab/dexon-consensus/core/crypto" + cryptoDKG "github.com/byzantine-lab/dexon-consensus/core/crypto/dkg" ) // VoteType is the type of vote. diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/utils.go index c4d7b0fc3..4cb3bf18a 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/utils.go @@ -25,10 +25,10 @@ import ( "sort" "time" - "github.com/dexon-foundation/dexon-consensus/common" - "github.com/dexon-foundation/dexon-consensus/core/crypto" - "github.com/dexon-foundation/dexon-consensus/core/types" - "github.com/dexon-foundation/dexon-consensus/core/utils" + "github.com/byzantine-lab/dexon-consensus/common" + "github.com/byzantine-lab/dexon-consensus/core/crypto" + "github.com/byzantine-lab/dexon-consensus/core/types" + "github.com/byzantine-lab/dexon-consensus/core/utils" ) // Errors for utils. diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/crypto.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/utils/crypto.go index 42ee6122e..161c1d495 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/crypto.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/utils/crypto.go @@ -21,10 +21,10 @@ import ( "bytes" "encoding/binary" - "github.com/dexon-foundation/dexon-consensus/common" - "github.com/dexon-foundation/dexon-consensus/core/crypto" - "github.com/dexon-foundation/dexon-consensus/core/types" - typesDKG "github.com/dexon-foundation/dexon-consensus/core/types/dkg" + "github.com/byzantine-lab/dexon-consensus/common" + "github.com/byzantine-lab/dexon-consensus/core/crypto" + "github.com/byzantine-lab/dexon-consensus/core/types" + typesDKG "github.com/byzantine-lab/dexon-consensus/core/types/dkg" ) func hashWitness(witness *types.Witness) (common.Hash, error) { diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/nodeset-cache.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/utils/nodeset-cache.go index 89dcfc86b..028690e18 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/nodeset-cache.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/utils/nodeset-cache.go @@ -21,9 +21,9 @@ import ( "errors" "sync" - "github.com/dexon-foundation/dexon-consensus/common" - "github.com/dexon-foundation/dexon-consensus/core/crypto" - "github.com/dexon-foundation/dexon-consensus/core/types" + "github.com/byzantine-lab/dexon-consensus/common" + "github.com/byzantine-lab/dexon-consensus/core/crypto" + "github.com/byzantine-lab/dexon-consensus/core/types" ) var ( diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/penalty-helper.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/utils/penalty-helper.go index 0b38474a6..658fe79a9 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/penalty-helper.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/utils/penalty-helper.go @@ -20,8 +20,8 @@ package utils import ( "errors" - "github.com/dexon-foundation/dexon-consensus/core/types" - typesDKG "github.com/dexon-foundation/dexon-consensus/core/types/dkg" + "github.com/byzantine-lab/dexon-consensus/core/types" + typesDKG "github.com/byzantine-lab/dexon-consensus/core/types/dkg" ) var ( diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/round-based-config.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/utils/round-based-config.go index 4c83d046b..88842cacf 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/round-based-config.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/utils/round-based-config.go @@ -20,7 +20,7 @@ package utils import ( "fmt" - "github.com/dexon-foundation/dexon-consensus/core/types" + "github.com/byzantine-lab/dexon-consensus/core/types" ) // RoundBasedConfig is based config for rounds and provide boundary checking diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/round-event.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/utils/round-event.go index bda4383fa..4f4b04542 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/round-event.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/utils/round-event.go @@ -22,9 +22,9 @@ import ( "fmt" "sync" - "github.com/dexon-foundation/dexon-consensus/common" - "github.com/dexon-foundation/dexon-consensus/core/types" - typesDKG "github.com/dexon-foundation/dexon-consensus/core/types/dkg" + "github.com/byzantine-lab/dexon-consensus/common" + "github.com/byzantine-lab/dexon-consensus/core/types" + typesDKG "github.com/byzantine-lab/dexon-consensus/core/types/dkg" ) // ErrUnmatchedBlockHeightWithConfig is for invalid parameters for NewRoundEvent. diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/signer.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/utils/signer.go index ff767437f..9128e264c 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/signer.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/utils/signer.go @@ -20,10 +20,10 @@ package utils import ( "errors" - "github.com/dexon-foundation/dexon-consensus/common" - "github.com/dexon-foundation/dexon-consensus/core/crypto" - "github.com/dexon-foundation/dexon-consensus/core/types" - typesDKG "github.com/dexon-foundation/dexon-consensus/core/types/dkg" + "github.com/byzantine-lab/dexon-consensus/common" + "github.com/byzantine-lab/dexon-consensus/core/crypto" + "github.com/byzantine-lab/dexon-consensus/core/types" + typesDKG "github.com/byzantine-lab/dexon-consensus/core/types/dkg" ) // Errors for signer. diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/utils.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/utils/utils.go index f259f34bb..6ff5bb62f 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/utils.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/utils/utils.go @@ -21,9 +21,9 @@ import ( "context" "fmt" - "github.com/dexon-foundation/dexon-consensus/common" - "github.com/dexon-foundation/dexon-consensus/core/types" - typesDKG "github.com/dexon-foundation/dexon-consensus/core/types/dkg" + "github.com/byzantine-lab/dexon-consensus/common" + "github.com/byzantine-lab/dexon-consensus/core/types" + typesDKG "github.com/byzantine-lab/dexon-consensus/core/types/dkg" ) var dkgDelayRound uint64 diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/vote-filter.go b/vendor/github.com/byzantine-lab/dexon-consensus/core/utils/vote-filter.go index 446d88a64..556c2489a 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/vote-filter.go +++ b/vendor/github.com/byzantine-lab/dexon-consensus/core/utils/vote-filter.go @@ -18,7 +18,7 @@ package utils import ( - "github.com/dexon-foundation/dexon-consensus/core/types" + "github.com/byzantine-lab/dexon-consensus/core/types" ) // VoteFilter filters votes that are useless for now. diff --git a/vendor/github.com/dexon-foundation/mcl/.gitignore b/vendor/github.com/byzantine-lab/mcl/.gitignore index f5edb3706..f5edb3706 100644 --- a/vendor/github.com/dexon-foundation/mcl/.gitignore +++ b/vendor/github.com/byzantine-lab/mcl/.gitignore diff --git a/vendor/github.com/dexon-foundation/mcl/.travis.yml b/vendor/github.com/byzantine-lab/mcl/.travis.yml index 73a97e6aa..73a97e6aa 100644 --- a/vendor/github.com/dexon-foundation/mcl/.travis.yml +++ b/vendor/github.com/byzantine-lab/mcl/.travis.yml diff --git a/vendor/github.com/dexon-foundation/mcl/CMakeLists.txt b/vendor/github.com/byzantine-lab/mcl/CMakeLists.txt index aaa0a8cf2..aaa0a8cf2 100644 --- a/vendor/github.com/dexon-foundation/mcl/CMakeLists.txt +++ b/vendor/github.com/byzantine-lab/mcl/CMakeLists.txt diff --git a/vendor/github.com/dexon-foundation/mcl/COPYRIGHT b/vendor/github.com/byzantine-lab/mcl/COPYRIGHT index 90e49b4bc..90e49b4bc 100644 --- a/vendor/github.com/dexon-foundation/mcl/COPYRIGHT +++ b/vendor/github.com/byzantine-lab/mcl/COPYRIGHT diff --git a/vendor/github.com/dexon-foundation/mcl/Makefile b/vendor/github.com/byzantine-lab/mcl/Makefile index 7df1dd300..7df1dd300 100644 --- a/vendor/github.com/dexon-foundation/mcl/Makefile +++ b/vendor/github.com/byzantine-lab/mcl/Makefile diff --git a/vendor/github.com/dexon-foundation/mcl/bench.txt b/vendor/github.com/byzantine-lab/mcl/bench.txt index 35e47dca5..35e47dca5 100644 --- a/vendor/github.com/dexon-foundation/mcl/bench.txt +++ b/vendor/github.com/byzantine-lab/mcl/bench.txt diff --git a/vendor/github.com/dexon-foundation/mcl/common.mk b/vendor/github.com/byzantine-lab/mcl/common.mk index 5c749e1a6..5c749e1a6 100644 --- a/vendor/github.com/dexon-foundation/mcl/common.mk +++ b/vendor/github.com/byzantine-lab/mcl/common.mk diff --git a/vendor/github.com/dexon-foundation/mcl/common.props b/vendor/github.com/byzantine-lab/mcl/common.props index 912f39e30..912f39e30 100644 --- a/vendor/github.com/dexon-foundation/mcl/common.props +++ b/vendor/github.com/byzantine-lab/mcl/common.props diff --git a/vendor/github.com/dexon-foundation/mcl/debug.props b/vendor/github.com/byzantine-lab/mcl/debug.props index 1553ae0dc..1553ae0dc 100644 --- a/vendor/github.com/dexon-foundation/mcl/debug.props +++ b/vendor/github.com/byzantine-lab/mcl/debug.props diff --git a/vendor/github.com/dexon-foundation/mcl/ffi/cs/App.config b/vendor/github.com/byzantine-lab/mcl/ffi/cs/App.config index 88fa4027b..88fa4027b 100644 --- a/vendor/github.com/dexon-foundation/mcl/ffi/cs/App.config +++ b/vendor/github.com/byzantine-lab/mcl/ffi/cs/App.config diff --git a/vendor/github.com/dexon-foundation/mcl/ffi/cs/Properties/AssemblyInfo.cs b/vendor/github.com/byzantine-lab/mcl/ffi/cs/Properties/AssemblyInfo.cs index c87e1d44b..c87e1d44b 100644 --- a/vendor/github.com/dexon-foundation/mcl/ffi/cs/Properties/AssemblyInfo.cs +++ b/vendor/github.com/byzantine-lab/mcl/ffi/cs/Properties/AssemblyInfo.cs diff --git a/vendor/github.com/dexon-foundation/mcl/ffi/cs/bn256.cs b/vendor/github.com/byzantine-lab/mcl/ffi/cs/bn256.cs index 0e1ed032c..0e1ed032c 100644 --- a/vendor/github.com/dexon-foundation/mcl/ffi/cs/bn256.cs +++ b/vendor/github.com/byzantine-lab/mcl/ffi/cs/bn256.cs diff --git a/vendor/github.com/dexon-foundation/mcl/ffi/cs/bn256.csproj b/vendor/github.com/byzantine-lab/mcl/ffi/cs/bn256.csproj index 21a049f01..21a049f01 100644 --- a/vendor/github.com/dexon-foundation/mcl/ffi/cs/bn256.csproj +++ b/vendor/github.com/byzantine-lab/mcl/ffi/cs/bn256.csproj diff --git a/vendor/github.com/dexon-foundation/mcl/ffi/cs/bn256.sln b/vendor/github.com/byzantine-lab/mcl/ffi/cs/bn256.sln index 6e6aa67ee..6e6aa67ee 100644 --- a/vendor/github.com/dexon-foundation/mcl/ffi/cs/bn256.sln +++ b/vendor/github.com/byzantine-lab/mcl/ffi/cs/bn256.sln diff --git a/vendor/github.com/dexon-foundation/mcl/ffi/cs/bn256_test.cs b/vendor/github.com/byzantine-lab/mcl/ffi/cs/bn256_test.cs index cad8c03d3..cad8c03d3 100644 --- a/vendor/github.com/dexon-foundation/mcl/ffi/cs/bn256_test.cs +++ b/vendor/github.com/byzantine-lab/mcl/ffi/cs/bn256_test.cs diff --git a/vendor/github.com/dexon-foundation/mcl/ffi/go/mcl/mcl.go b/vendor/github.com/byzantine-lab/mcl/ffi/go/mcl/mcl.go index a0c8bb4d3..a0c8bb4d3 100644 --- a/vendor/github.com/dexon-foundation/mcl/ffi/go/mcl/mcl.go +++ b/vendor/github.com/byzantine-lab/mcl/ffi/go/mcl/mcl.go diff --git a/vendor/github.com/dexon-foundation/mcl/ffi/go/mcl/mcl_test.go b/vendor/github.com/byzantine-lab/mcl/ffi/go/mcl/mcl_test.go index 16bb6910f..16bb6910f 100644 --- a/vendor/github.com/dexon-foundation/mcl/ffi/go/mcl/mcl_test.go +++ b/vendor/github.com/byzantine-lab/mcl/ffi/go/mcl/mcl_test.go diff --git a/vendor/github.com/dexon-foundation/mcl/ffi/java/Bn256Test.java b/vendor/github.com/byzantine-lab/mcl/ffi/java/Bn256Test.java index b1f9f6f34..b1f9f6f34 100644 --- a/vendor/github.com/dexon-foundation/mcl/ffi/java/Bn256Test.java +++ b/vendor/github.com/byzantine-lab/mcl/ffi/java/Bn256Test.java diff --git a/vendor/github.com/dexon-foundation/mcl/ffi/java/ElgamalTest.java b/vendor/github.com/byzantine-lab/mcl/ffi/java/ElgamalTest.java index 0cf49e144..0cf49e144 100644 --- a/vendor/github.com/dexon-foundation/mcl/ffi/java/ElgamalTest.java +++ b/vendor/github.com/byzantine-lab/mcl/ffi/java/ElgamalTest.java diff --git a/vendor/github.com/dexon-foundation/mcl/ffi/java/Makefile b/vendor/github.com/byzantine-lab/mcl/ffi/java/Makefile index d69c043fb..d69c043fb 100644 --- a/vendor/github.com/dexon-foundation/mcl/ffi/java/Makefile +++ b/vendor/github.com/byzantine-lab/mcl/ffi/java/Makefile diff --git a/vendor/github.com/dexon-foundation/mcl/ffi/java/bn256.i b/vendor/github.com/byzantine-lab/mcl/ffi/java/bn256.i index 94a8edb7a..94a8edb7a 100644 --- a/vendor/github.com/dexon-foundation/mcl/ffi/java/bn256.i +++ b/vendor/github.com/byzantine-lab/mcl/ffi/java/bn256.i diff --git a/vendor/github.com/dexon-foundation/mcl/ffi/java/bn256_impl.hpp b/vendor/github.com/byzantine-lab/mcl/ffi/java/bn256_impl.hpp index c4caaf3ca..c4caaf3ca 100644 --- a/vendor/github.com/dexon-foundation/mcl/ffi/java/bn256_impl.hpp +++ b/vendor/github.com/byzantine-lab/mcl/ffi/java/bn256_impl.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/ffi/java/bn256_wrap.cxx b/vendor/github.com/byzantine-lab/mcl/ffi/java/bn256_wrap.cxx index 0c8257af5..0c8257af5 100644 --- a/vendor/github.com/dexon-foundation/mcl/ffi/java/bn256_wrap.cxx +++ b/vendor/github.com/byzantine-lab/mcl/ffi/java/bn256_wrap.cxx diff --git a/vendor/github.com/dexon-foundation/mcl/ffi/java/elgamal.i b/vendor/github.com/byzantine-lab/mcl/ffi/java/elgamal.i index 410723174..410723174 100644 --- a/vendor/github.com/dexon-foundation/mcl/ffi/java/elgamal.i +++ b/vendor/github.com/byzantine-lab/mcl/ffi/java/elgamal.i diff --git a/vendor/github.com/dexon-foundation/mcl/ffi/java/elgamal_impl.hpp b/vendor/github.com/byzantine-lab/mcl/ffi/java/elgamal_impl.hpp index dbf2ba64e..dbf2ba64e 100644 --- a/vendor/github.com/dexon-foundation/mcl/ffi/java/elgamal_impl.hpp +++ b/vendor/github.com/byzantine-lab/mcl/ffi/java/elgamal_impl.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/ffi/java/elgamal_wrap.cxx b/vendor/github.com/byzantine-lab/mcl/ffi/java/elgamal_wrap.cxx index 38d05f489..38d05f489 100644 --- a/vendor/github.com/dexon-foundation/mcl/ffi/java/elgamal_wrap.cxx +++ b/vendor/github.com/byzantine-lab/mcl/ffi/java/elgamal_wrap.cxx diff --git a/vendor/github.com/dexon-foundation/mcl/ffi/java/java.md b/vendor/github.com/byzantine-lab/mcl/ffi/java/java.md index 3fe861351..3fe861351 100644 --- a/vendor/github.com/dexon-foundation/mcl/ffi/java/java.md +++ b/vendor/github.com/byzantine-lab/mcl/ffi/java/java.md diff --git a/vendor/github.com/dexon-foundation/mcl/ffi/java/make_wrap.bat b/vendor/github.com/byzantine-lab/mcl/ffi/java/make_wrap.bat index b7008bc02..b7008bc02 100644 --- a/vendor/github.com/dexon-foundation/mcl/ffi/java/make_wrap.bat +++ b/vendor/github.com/byzantine-lab/mcl/ffi/java/make_wrap.bat diff --git a/vendor/github.com/dexon-foundation/mcl/ffi/java/run-bn256.bat b/vendor/github.com/byzantine-lab/mcl/ffi/java/run-bn256.bat index 903876ec6..903876ec6 100644 --- a/vendor/github.com/dexon-foundation/mcl/ffi/java/run-bn256.bat +++ b/vendor/github.com/byzantine-lab/mcl/ffi/java/run-bn256.bat diff --git a/vendor/github.com/dexon-foundation/mcl/ffi/java/run-elgamal.bat b/vendor/github.com/byzantine-lab/mcl/ffi/java/run-elgamal.bat index 8b889a64c..8b889a64c 100644 --- a/vendor/github.com/dexon-foundation/mcl/ffi/java/run-elgamal.bat +++ b/vendor/github.com/byzantine-lab/mcl/ffi/java/run-elgamal.bat diff --git a/vendor/github.com/dexon-foundation/mcl/ffi/java/set-java-path.bat b/vendor/github.com/byzantine-lab/mcl/ffi/java/set-java-path.bat index c66f81830..c66f81830 100644 --- a/vendor/github.com/dexon-foundation/mcl/ffi/java/set-java-path.bat +++ b/vendor/github.com/byzantine-lab/mcl/ffi/java/set-java-path.bat diff --git a/vendor/github.com/dexon-foundation/mcl/ffi/js/export-functions.py b/vendor/github.com/byzantine-lab/mcl/ffi/js/export-functions.py index 2a929564b..2a929564b 100644 --- a/vendor/github.com/dexon-foundation/mcl/ffi/js/export-functions.py +++ b/vendor/github.com/byzantine-lab/mcl/ffi/js/export-functions.py diff --git a/vendor/github.com/dexon-foundation/mcl/ffi/js/pre-mcl.js b/vendor/github.com/byzantine-lab/mcl/ffi/js/pre-mcl.js index ebc93e581..ebc93e581 100644 --- a/vendor/github.com/dexon-foundation/mcl/ffi/js/pre-mcl.js +++ b/vendor/github.com/byzantine-lab/mcl/ffi/js/pre-mcl.js diff --git a/vendor/github.com/dexon-foundation/mcl/ffi/python/pairing.py b/vendor/github.com/byzantine-lab/mcl/ffi/python/pairing.py index 88b729176..88b729176 100644 --- a/vendor/github.com/dexon-foundation/mcl/ffi/python/pairing.py +++ b/vendor/github.com/byzantine-lab/mcl/ffi/python/pairing.py diff --git a/vendor/github.com/dexon-foundation/mcl/ffi/python/she.py b/vendor/github.com/byzantine-lab/mcl/ffi/python/she.py index ab8975274..ab8975274 100644 --- a/vendor/github.com/dexon-foundation/mcl/ffi/python/she.py +++ b/vendor/github.com/byzantine-lab/mcl/ffi/python/she.py diff --git a/vendor/github.com/dexon-foundation/mcl/include/cybozu/array.hpp b/vendor/github.com/byzantine-lab/mcl/include/cybozu/array.hpp index 30df3667d..30df3667d 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/cybozu/array.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/cybozu/array.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/cybozu/atoi.hpp b/vendor/github.com/byzantine-lab/mcl/include/cybozu/atoi.hpp index a22853a17..a22853a17 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/cybozu/atoi.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/cybozu/atoi.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/cybozu/benchmark.hpp b/vendor/github.com/byzantine-lab/mcl/include/cybozu/benchmark.hpp index 4c02f1869..4c02f1869 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/cybozu/benchmark.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/cybozu/benchmark.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/cybozu/bit_operation.hpp b/vendor/github.com/byzantine-lab/mcl/include/cybozu/bit_operation.hpp index 865c1e47d..865c1e47d 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/cybozu/bit_operation.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/cybozu/bit_operation.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/cybozu/critical_section.hpp b/vendor/github.com/byzantine-lab/mcl/include/cybozu/critical_section.hpp index 13d7f3a0e..13d7f3a0e 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/cybozu/critical_section.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/cybozu/critical_section.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/cybozu/crypto.hpp b/vendor/github.com/byzantine-lab/mcl/include/cybozu/crypto.hpp index d427179d9..d427179d9 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/cybozu/crypto.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/cybozu/crypto.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/cybozu/endian.hpp b/vendor/github.com/byzantine-lab/mcl/include/cybozu/endian.hpp index 3f1575c46..3f1575c46 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/cybozu/endian.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/cybozu/endian.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/cybozu/exception.hpp b/vendor/github.com/byzantine-lab/mcl/include/cybozu/exception.hpp index 247ba4de0..247ba4de0 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/cybozu/exception.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/cybozu/exception.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/cybozu/hash.hpp b/vendor/github.com/byzantine-lab/mcl/include/cybozu/hash.hpp index 3fd246fa1..3fd246fa1 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/cybozu/hash.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/cybozu/hash.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/cybozu/inttype.hpp b/vendor/github.com/byzantine-lab/mcl/include/cybozu/inttype.hpp index 62856bdb3..62856bdb3 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/cybozu/inttype.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/cybozu/inttype.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/cybozu/itoa.hpp b/vendor/github.com/byzantine-lab/mcl/include/cybozu/itoa.hpp index 072e5b8b4..072e5b8b4 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/cybozu/itoa.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/cybozu/itoa.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/cybozu/link_libeay32.hpp b/vendor/github.com/byzantine-lab/mcl/include/cybozu/link_libeay32.hpp index d83f1b6ea..d83f1b6ea 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/cybozu/link_libeay32.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/cybozu/link_libeay32.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/cybozu/link_mpir.hpp b/vendor/github.com/byzantine-lab/mcl/include/cybozu/link_mpir.hpp index d20d7b1a9..d20d7b1a9 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/cybozu/link_mpir.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/cybozu/link_mpir.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/cybozu/link_ssleay32.hpp b/vendor/github.com/byzantine-lab/mcl/include/cybozu/link_ssleay32.hpp index 60c2361ae..60c2361ae 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/cybozu/link_ssleay32.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/cybozu/link_ssleay32.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/cybozu/mutex.hpp b/vendor/github.com/byzantine-lab/mcl/include/cybozu/mutex.hpp index acde6bcbf..acde6bcbf 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/cybozu/mutex.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/cybozu/mutex.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/cybozu/option.hpp b/vendor/github.com/byzantine-lab/mcl/include/cybozu/option.hpp index a5dfd137d..a5dfd137d 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/cybozu/option.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/cybozu/option.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/cybozu/random_generator.hpp b/vendor/github.com/byzantine-lab/mcl/include/cybozu/random_generator.hpp index ff4a78da5..ff4a78da5 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/cybozu/random_generator.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/cybozu/random_generator.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/cybozu/serializer.hpp b/vendor/github.com/byzantine-lab/mcl/include/cybozu/serializer.hpp index 1e23c8f42..1e23c8f42 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/cybozu/serializer.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/cybozu/serializer.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/cybozu/sha2.hpp b/vendor/github.com/byzantine-lab/mcl/include/cybozu/sha2.hpp index 1830936f0..1830936f0 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/cybozu/sha2.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/cybozu/sha2.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/cybozu/stream.hpp b/vendor/github.com/byzantine-lab/mcl/include/cybozu/stream.hpp index bc110bdb0..bc110bdb0 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/cybozu/stream.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/cybozu/stream.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/cybozu/test.hpp b/vendor/github.com/byzantine-lab/mcl/include/cybozu/test.hpp index 7dfffab96..7dfffab96 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/cybozu/test.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/cybozu/test.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/cybozu/unordered_map.hpp b/vendor/github.com/byzantine-lab/mcl/include/cybozu/unordered_map.hpp index 89f8f8774..89f8f8774 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/cybozu/unordered_map.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/cybozu/unordered_map.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/cybozu/xorshift.hpp b/vendor/github.com/byzantine-lab/mcl/include/cybozu/xorshift.hpp index 08c6a04f9..08c6a04f9 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/cybozu/xorshift.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/cybozu/xorshift.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/mcl/aggregate_sig.hpp b/vendor/github.com/byzantine-lab/mcl/include/mcl/aggregate_sig.hpp index f31405705..f31405705 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/mcl/aggregate_sig.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/mcl/aggregate_sig.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/mcl/ahe.hpp b/vendor/github.com/byzantine-lab/mcl/include/mcl/ahe.hpp index 239319d0d..239319d0d 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/mcl/ahe.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/mcl/ahe.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/mcl/array.hpp b/vendor/github.com/byzantine-lab/mcl/include/mcl/array.hpp index a6d2a8fa3..a6d2a8fa3 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/mcl/array.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/mcl/array.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/mcl/bls12_381.hpp b/vendor/github.com/byzantine-lab/mcl/include/mcl/bls12_381.hpp index 316e142af..316e142af 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/mcl/bls12_381.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/mcl/bls12_381.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/mcl/bn.h b/vendor/github.com/byzantine-lab/mcl/include/mcl/bn.h index 0a31d5501..0a31d5501 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/mcl/bn.h +++ b/vendor/github.com/byzantine-lab/mcl/include/mcl/bn.h diff --git a/vendor/github.com/dexon-foundation/mcl/include/mcl/bn.hpp b/vendor/github.com/byzantine-lab/mcl/include/mcl/bn.hpp index 5ebe5d956..5ebe5d956 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/mcl/bn.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/mcl/bn.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/mcl/bn256.hpp b/vendor/github.com/byzantine-lab/mcl/include/mcl/bn256.hpp index 7a5da7a05..7a5da7a05 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/mcl/bn256.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/mcl/bn256.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/mcl/bn384.hpp b/vendor/github.com/byzantine-lab/mcl/include/mcl/bn384.hpp index 8aa14fe5c..8aa14fe5c 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/mcl/bn384.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/mcl/bn384.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/mcl/bn512.hpp b/vendor/github.com/byzantine-lab/mcl/include/mcl/bn512.hpp index c87ad9035..c87ad9035 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/mcl/bn512.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/mcl/bn512.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/mcl/conversion.hpp b/vendor/github.com/byzantine-lab/mcl/include/mcl/conversion.hpp index 7a04b7fa2..7a04b7fa2 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/mcl/conversion.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/mcl/conversion.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/mcl/curve_type.h b/vendor/github.com/byzantine-lab/mcl/include/mcl/curve_type.h index 9e4a941a0..9e4a941a0 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/mcl/curve_type.h +++ b/vendor/github.com/byzantine-lab/mcl/include/mcl/curve_type.h diff --git a/vendor/github.com/dexon-foundation/mcl/include/mcl/ec.hpp b/vendor/github.com/byzantine-lab/mcl/include/mcl/ec.hpp index b8eb10be3..b8eb10be3 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/mcl/ec.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/mcl/ec.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/mcl/ecdsa.h b/vendor/github.com/byzantine-lab/mcl/include/mcl/ecdsa.h index daeb6be53..daeb6be53 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/mcl/ecdsa.h +++ b/vendor/github.com/byzantine-lab/mcl/include/mcl/ecdsa.h diff --git a/vendor/github.com/dexon-foundation/mcl/include/mcl/ecdsa.hpp b/vendor/github.com/byzantine-lab/mcl/include/mcl/ecdsa.hpp index cf3ed3f65..cf3ed3f65 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/mcl/ecdsa.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/mcl/ecdsa.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/mcl/ecparam.hpp b/vendor/github.com/byzantine-lab/mcl/include/mcl/ecparam.hpp index 087bf8b6c..087bf8b6c 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/mcl/ecparam.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/mcl/ecparam.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/mcl/elgamal.hpp b/vendor/github.com/byzantine-lab/mcl/include/mcl/elgamal.hpp index 431148508..431148508 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/mcl/elgamal.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/mcl/elgamal.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/mcl/fp.hpp b/vendor/github.com/byzantine-lab/mcl/include/mcl/fp.hpp index 2e69729dd..2e69729dd 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/mcl/fp.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/mcl/fp.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/mcl/fp_tower.hpp b/vendor/github.com/byzantine-lab/mcl/include/mcl/fp_tower.hpp index 95722e2d5..95722e2d5 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/mcl/fp_tower.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/mcl/fp_tower.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/mcl/gmp_util.hpp b/vendor/github.com/byzantine-lab/mcl/include/mcl/gmp_util.hpp index bcbd91a1e..bcbd91a1e 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/mcl/gmp_util.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/mcl/gmp_util.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/mcl/impl/bn_c_impl.hpp b/vendor/github.com/byzantine-lab/mcl/include/mcl/impl/bn_c_impl.hpp index bec2466dd..bec2466dd 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/mcl/impl/bn_c_impl.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/mcl/impl/bn_c_impl.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/mcl/lagrange.hpp b/vendor/github.com/byzantine-lab/mcl/include/mcl/lagrange.hpp index 18e0597ec..18e0597ec 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/mcl/lagrange.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/mcl/lagrange.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/mcl/op.hpp b/vendor/github.com/byzantine-lab/mcl/include/mcl/op.hpp index 36d37035e..36d37035e 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/mcl/op.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/mcl/op.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/mcl/operator.hpp b/vendor/github.com/byzantine-lab/mcl/include/mcl/operator.hpp index e9bc506df..e9bc506df 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/mcl/operator.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/mcl/operator.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/mcl/paillier.hpp b/vendor/github.com/byzantine-lab/mcl/include/mcl/paillier.hpp index 03e44cb16..03e44cb16 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/mcl/paillier.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/mcl/paillier.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/mcl/randgen.hpp b/vendor/github.com/byzantine-lab/mcl/include/mcl/randgen.hpp index 30502fc10..30502fc10 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/mcl/randgen.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/mcl/randgen.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/mcl/she.h b/vendor/github.com/byzantine-lab/mcl/include/mcl/she.h index 60b399c65..60b399c65 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/mcl/she.h +++ b/vendor/github.com/byzantine-lab/mcl/include/mcl/she.h diff --git a/vendor/github.com/dexon-foundation/mcl/include/mcl/she.hpp b/vendor/github.com/byzantine-lab/mcl/include/mcl/she.hpp index 3ce361454..3ce361454 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/mcl/she.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/mcl/she.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/mcl/util.hpp b/vendor/github.com/byzantine-lab/mcl/include/mcl/util.hpp index edef971cb..edef971cb 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/mcl/util.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/mcl/util.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/mcl/vint.hpp b/vendor/github.com/byzantine-lab/mcl/include/mcl/vint.hpp index b087688c3..b087688c3 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/mcl/vint.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/mcl/vint.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/include/mcl/window_method.hpp b/vendor/github.com/byzantine-lab/mcl/include/mcl/window_method.hpp index cb4fad37e..cb4fad37e 100644 --- a/vendor/github.com/dexon-foundation/mcl/include/mcl/window_method.hpp +++ b/vendor/github.com/byzantine-lab/mcl/include/mcl/window_method.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/lib/.emptydir b/vendor/github.com/byzantine-lab/mcl/lib/.emptydir index e69de29bb..e69de29bb 100644 --- a/vendor/github.com/dexon-foundation/mcl/lib/.emptydir +++ b/vendor/github.com/byzantine-lab/mcl/lib/.emptydir diff --git a/vendor/github.com/dexon-foundation/mcl/mcl.sln b/vendor/github.com/byzantine-lab/mcl/mcl.sln index 7c4fe8f0c..7c4fe8f0c 100644 --- a/vendor/github.com/dexon-foundation/mcl/mcl.sln +++ b/vendor/github.com/byzantine-lab/mcl/mcl.sln diff --git a/vendor/github.com/dexon-foundation/mcl/misc/bench.txt b/vendor/github.com/byzantine-lab/mcl/misc/bench.txt index 3e18e6b44..3e18e6b44 100644 --- a/vendor/github.com/dexon-foundation/mcl/misc/bench.txt +++ b/vendor/github.com/byzantine-lab/mcl/misc/bench.txt diff --git a/vendor/github.com/dexon-foundation/mcl/misc/karatsuba.cpp b/vendor/github.com/byzantine-lab/mcl/misc/karatsuba.cpp index 7c150c6e3..7c150c6e3 100644 --- a/vendor/github.com/dexon-foundation/mcl/misc/karatsuba.cpp +++ b/vendor/github.com/byzantine-lab/mcl/misc/karatsuba.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/misc/mul.cpp b/vendor/github.com/byzantine-lab/mcl/misc/mul.cpp index 146ac33a9..146ac33a9 100644 --- a/vendor/github.com/dexon-foundation/mcl/misc/mul.cpp +++ b/vendor/github.com/byzantine-lab/mcl/misc/mul.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/misc/precompute.cpp b/vendor/github.com/byzantine-lab/mcl/misc/precompute.cpp index 63cdd663b..63cdd663b 100644 --- a/vendor/github.com/dexon-foundation/mcl/misc/precompute.cpp +++ b/vendor/github.com/byzantine-lab/mcl/misc/precompute.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/misc/she/bench.sh b/vendor/github.com/byzantine-lab/mcl/misc/she/bench.sh index ced87b4db..ced87b4db 100644 --- a/vendor/github.com/dexon-foundation/mcl/misc/she/bench.sh +++ b/vendor/github.com/byzantine-lab/mcl/misc/she/bench.sh diff --git a/vendor/github.com/dexon-foundation/mcl/misc/she/bench4.txt b/vendor/github.com/byzantine-lab/mcl/misc/she/bench4.txt index 99b2593c4..99b2593c4 100644 --- a/vendor/github.com/dexon-foundation/mcl/misc/she/bench4.txt +++ b/vendor/github.com/byzantine-lab/mcl/misc/she/bench4.txt diff --git a/vendor/github.com/dexon-foundation/mcl/misc/she/bench6.txt b/vendor/github.com/byzantine-lab/mcl/misc/she/bench6.txt index 863f7129a..863f7129a 100644 --- a/vendor/github.com/dexon-foundation/mcl/misc/she/bench6.txt +++ b/vendor/github.com/byzantine-lab/mcl/misc/she/bench6.txt diff --git a/vendor/github.com/dexon-foundation/mcl/misc/she/bench8.txt b/vendor/github.com/byzantine-lab/mcl/misc/she/bench8.txt index f8fe8fd75..f8fe8fd75 100644 --- a/vendor/github.com/dexon-foundation/mcl/misc/she/bench8.txt +++ b/vendor/github.com/byzantine-lab/mcl/misc/she/bench8.txt diff --git a/vendor/github.com/dexon-foundation/mcl/misc/she/nizkp.pdf b/vendor/github.com/byzantine-lab/mcl/misc/she/nizkp.pdf Binary files differindex 7e61b5a64..7e61b5a64 100644 --- a/vendor/github.com/dexon-foundation/mcl/misc/she/nizkp.pdf +++ b/vendor/github.com/byzantine-lab/mcl/misc/she/nizkp.pdf diff --git a/vendor/github.com/dexon-foundation/mcl/misc/she/she-api-ja.md b/vendor/github.com/byzantine-lab/mcl/misc/she/she-api-ja.md index 850f11ff3..850f11ff3 100644 --- a/vendor/github.com/dexon-foundation/mcl/misc/she/she-api-ja.md +++ b/vendor/github.com/byzantine-lab/mcl/misc/she/she-api-ja.md diff --git a/vendor/github.com/dexon-foundation/mcl/misc/she/she-api.md b/vendor/github.com/byzantine-lab/mcl/misc/she/she-api.md index af54311e9..af54311e9 100644 --- a/vendor/github.com/dexon-foundation/mcl/misc/she/she-api.md +++ b/vendor/github.com/byzantine-lab/mcl/misc/she/she-api.md diff --git a/vendor/github.com/dexon-foundation/mcl/misc/she/she.pdf b/vendor/github.com/byzantine-lab/mcl/misc/she/she.pdf Binary files differindex 355a308b3..355a308b3 100644 --- a/vendor/github.com/dexon-foundation/mcl/misc/she/she.pdf +++ b/vendor/github.com/byzantine-lab/mcl/misc/she/she.pdf diff --git a/vendor/github.com/dexon-foundation/mcl/mk.bat b/vendor/github.com/byzantine-lab/mcl/mk.bat index 19eb84197..19eb84197 100644 --- a/vendor/github.com/dexon-foundation/mcl/mk.bat +++ b/vendor/github.com/byzantine-lab/mcl/mk.bat diff --git a/vendor/github.com/dexon-foundation/mcl/mklib.bat b/vendor/github.com/byzantine-lab/mcl/mklib.bat index 389b69009..389b69009 100644 --- a/vendor/github.com/dexon-foundation/mcl/mklib.bat +++ b/vendor/github.com/byzantine-lab/mcl/mklib.bat diff --git a/vendor/github.com/dexon-foundation/mcl/obj/.emptydir b/vendor/github.com/byzantine-lab/mcl/obj/.emptydir index e69de29bb..e69de29bb 100644 --- a/vendor/github.com/dexon-foundation/mcl/obj/.emptydir +++ b/vendor/github.com/byzantine-lab/mcl/obj/.emptydir diff --git a/vendor/github.com/dexon-foundation/mcl/readme.md b/vendor/github.com/byzantine-lab/mcl/readme.md index 39b3d4d42..39b3d4d42 100644 --- a/vendor/github.com/dexon-foundation/mcl/readme.md +++ b/vendor/github.com/byzantine-lab/mcl/readme.md diff --git a/vendor/github.com/dexon-foundation/mcl/release.props b/vendor/github.com/byzantine-lab/mcl/release.props index 886ce6890..886ce6890 100644 --- a/vendor/github.com/dexon-foundation/mcl/release.props +++ b/vendor/github.com/byzantine-lab/mcl/release.props diff --git a/vendor/github.com/dexon-foundation/mcl/sample/bench.cpp b/vendor/github.com/byzantine-lab/mcl/sample/bench.cpp index 0f865b189..0f865b189 100644 --- a/vendor/github.com/dexon-foundation/mcl/sample/bench.cpp +++ b/vendor/github.com/byzantine-lab/mcl/sample/bench.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/sample/bls_sig.cpp b/vendor/github.com/byzantine-lab/mcl/sample/bls_sig.cpp index d75f7d427..d75f7d427 100644 --- a/vendor/github.com/dexon-foundation/mcl/sample/bls_sig.cpp +++ b/vendor/github.com/byzantine-lab/mcl/sample/bls_sig.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/sample/ecdh.cpp b/vendor/github.com/byzantine-lab/mcl/sample/ecdh.cpp index d5c4a31b2..d5c4a31b2 100644 --- a/vendor/github.com/dexon-foundation/mcl/sample/ecdh.cpp +++ b/vendor/github.com/byzantine-lab/mcl/sample/ecdh.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/sample/large.cpp b/vendor/github.com/byzantine-lab/mcl/sample/large.cpp index 60b2ac900..60b2ac900 100644 --- a/vendor/github.com/dexon-foundation/mcl/sample/large.cpp +++ b/vendor/github.com/byzantine-lab/mcl/sample/large.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/sample/pairing.cpp b/vendor/github.com/byzantine-lab/mcl/sample/pairing.cpp index 230583b6e..230583b6e 100644 --- a/vendor/github.com/dexon-foundation/mcl/sample/pairing.cpp +++ b/vendor/github.com/byzantine-lab/mcl/sample/pairing.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/sample/pairing_c.c b/vendor/github.com/byzantine-lab/mcl/sample/pairing_c.c index 5c2cd222a..5c2cd222a 100644 --- a/vendor/github.com/dexon-foundation/mcl/sample/pairing_c.c +++ b/vendor/github.com/byzantine-lab/mcl/sample/pairing_c.c diff --git a/vendor/github.com/dexon-foundation/mcl/sample/random.cpp b/vendor/github.com/byzantine-lab/mcl/sample/random.cpp index a2a3619ad..a2a3619ad 100644 --- a/vendor/github.com/dexon-foundation/mcl/sample/random.cpp +++ b/vendor/github.com/byzantine-lab/mcl/sample/random.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/sample/rawbench.cpp b/vendor/github.com/byzantine-lab/mcl/sample/rawbench.cpp index 4d7506ef5..4d7506ef5 100644 --- a/vendor/github.com/dexon-foundation/mcl/sample/rawbench.cpp +++ b/vendor/github.com/byzantine-lab/mcl/sample/rawbench.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/sample/she_make_dlp_table.cpp b/vendor/github.com/byzantine-lab/mcl/sample/she_make_dlp_table.cpp index 41f18e225..41f18e225 100644 --- a/vendor/github.com/dexon-foundation/mcl/sample/she_make_dlp_table.cpp +++ b/vendor/github.com/byzantine-lab/mcl/sample/she_make_dlp_table.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/sample/she_smpl.cpp b/vendor/github.com/byzantine-lab/mcl/sample/she_smpl.cpp index e01b9c130..e01b9c130 100644 --- a/vendor/github.com/dexon-foundation/mcl/sample/she_smpl.cpp +++ b/vendor/github.com/byzantine-lab/mcl/sample/she_smpl.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/sample/tri-dh.cpp b/vendor/github.com/byzantine-lab/mcl/sample/tri-dh.cpp index 8b720edbf..8b720edbf 100644 --- a/vendor/github.com/dexon-foundation/mcl/sample/tri-dh.cpp +++ b/vendor/github.com/byzantine-lab/mcl/sample/tri-dh.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/sample/vote.cpp b/vendor/github.com/byzantine-lab/mcl/sample/vote.cpp index 88137187c..88137187c 100644 --- a/vendor/github.com/dexon-foundation/mcl/sample/vote.cpp +++ b/vendor/github.com/byzantine-lab/mcl/sample/vote.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/setvar.bat b/vendor/github.com/byzantine-lab/mcl/setvar.bat index 1d57fa69e..1d57fa69e 100644 --- a/vendor/github.com/dexon-foundation/mcl/setvar.bat +++ b/vendor/github.com/byzantine-lab/mcl/setvar.bat diff --git a/vendor/github.com/dexon-foundation/mcl/src/asm/aarch64.s b/vendor/github.com/byzantine-lab/mcl/src/asm/aarch64.s index a49a36e3a..a49a36e3a 100644 --- a/vendor/github.com/dexon-foundation/mcl/src/asm/aarch64.s +++ b/vendor/github.com/byzantine-lab/mcl/src/asm/aarch64.s diff --git a/vendor/github.com/dexon-foundation/mcl/src/asm/arm.s b/vendor/github.com/byzantine-lab/mcl/src/asm/arm.s index 2df9bfb92..2df9bfb92 100644 --- a/vendor/github.com/dexon-foundation/mcl/src/asm/arm.s +++ b/vendor/github.com/byzantine-lab/mcl/src/asm/arm.s diff --git a/vendor/github.com/dexon-foundation/mcl/src/asm/low_arm.s b/vendor/github.com/byzantine-lab/mcl/src/asm/low_arm.s index 1ed2a1233..1ed2a1233 100644 --- a/vendor/github.com/dexon-foundation/mcl/src/asm/low_arm.s +++ b/vendor/github.com/byzantine-lab/mcl/src/asm/low_arm.s diff --git a/vendor/github.com/dexon-foundation/mcl/src/asm/low_x86-64.asm b/vendor/github.com/byzantine-lab/mcl/src/asm/low_x86-64.asm index b09b9dcd3..b09b9dcd3 100644 --- a/vendor/github.com/dexon-foundation/mcl/src/asm/low_x86-64.asm +++ b/vendor/github.com/byzantine-lab/mcl/src/asm/low_x86-64.asm diff --git a/vendor/github.com/dexon-foundation/mcl/src/asm/low_x86.asm b/vendor/github.com/byzantine-lab/mcl/src/asm/low_x86.asm index e69de29bb..e69de29bb 100644 --- a/vendor/github.com/dexon-foundation/mcl/src/asm/low_x86.asm +++ b/vendor/github.com/byzantine-lab/mcl/src/asm/low_x86.asm diff --git a/vendor/github.com/dexon-foundation/mcl/src/asm/x86-64.bmi2.s b/vendor/github.com/byzantine-lab/mcl/src/asm/x86-64.bmi2.s index e12174ac6..e12174ac6 100644 --- a/vendor/github.com/dexon-foundation/mcl/src/asm/x86-64.bmi2.s +++ b/vendor/github.com/byzantine-lab/mcl/src/asm/x86-64.bmi2.s diff --git a/vendor/github.com/dexon-foundation/mcl/src/asm/x86-64.s b/vendor/github.com/byzantine-lab/mcl/src/asm/x86-64.s index aa677d2ea..aa677d2ea 100644 --- a/vendor/github.com/dexon-foundation/mcl/src/asm/x86-64.s +++ b/vendor/github.com/byzantine-lab/mcl/src/asm/x86-64.s diff --git a/vendor/github.com/dexon-foundation/mcl/src/asm/x86-64mac.bmi2.s b/vendor/github.com/byzantine-lab/mcl/src/asm/x86-64mac.bmi2.s index 849c66649..849c66649 100644 --- a/vendor/github.com/dexon-foundation/mcl/src/asm/x86-64mac.bmi2.s +++ b/vendor/github.com/byzantine-lab/mcl/src/asm/x86-64mac.bmi2.s diff --git a/vendor/github.com/dexon-foundation/mcl/src/asm/x86-64mac.s b/vendor/github.com/byzantine-lab/mcl/src/asm/x86-64mac.s index 0dc7014a3..0dc7014a3 100644 --- a/vendor/github.com/dexon-foundation/mcl/src/asm/x86-64mac.s +++ b/vendor/github.com/byzantine-lab/mcl/src/asm/x86-64mac.s diff --git a/vendor/github.com/dexon-foundation/mcl/src/asm/x86.bmi2.s b/vendor/github.com/byzantine-lab/mcl/src/asm/x86.bmi2.s index 77729c530..77729c530 100644 --- a/vendor/github.com/dexon-foundation/mcl/src/asm/x86.bmi2.s +++ b/vendor/github.com/byzantine-lab/mcl/src/asm/x86.bmi2.s diff --git a/vendor/github.com/dexon-foundation/mcl/src/asm/x86.s b/vendor/github.com/byzantine-lab/mcl/src/asm/x86.s index cdd988ad3..cdd988ad3 100644 --- a/vendor/github.com/dexon-foundation/mcl/src/asm/x86.s +++ b/vendor/github.com/byzantine-lab/mcl/src/asm/x86.s diff --git a/vendor/github.com/dexon-foundation/mcl/src/bn_c256.cpp b/vendor/github.com/byzantine-lab/mcl/src/bn_c256.cpp index 2f975a287..2f975a287 100644 --- a/vendor/github.com/dexon-foundation/mcl/src/bn_c256.cpp +++ b/vendor/github.com/byzantine-lab/mcl/src/bn_c256.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/src/bn_c384.cpp b/vendor/github.com/byzantine-lab/mcl/src/bn_c384.cpp index 934a078ae..934a078ae 100644 --- a/vendor/github.com/dexon-foundation/mcl/src/bn_c384.cpp +++ b/vendor/github.com/byzantine-lab/mcl/src/bn_c384.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/src/bn_c384_256.cpp b/vendor/github.com/byzantine-lab/mcl/src/bn_c384_256.cpp index ecd968efd..ecd968efd 100644 --- a/vendor/github.com/dexon-foundation/mcl/src/bn_c384_256.cpp +++ b/vendor/github.com/byzantine-lab/mcl/src/bn_c384_256.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/src/bn_c512.cpp b/vendor/github.com/byzantine-lab/mcl/src/bn_c512.cpp index 7c1029522..7c1029522 100644 --- a/vendor/github.com/dexon-foundation/mcl/src/bn_c512.cpp +++ b/vendor/github.com/byzantine-lab/mcl/src/bn_c512.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/src/bn_c_impl.hpp b/vendor/github.com/byzantine-lab/mcl/src/bn_c_impl.hpp index bb0b4ba8e..bb0b4ba8e 100644 --- a/vendor/github.com/dexon-foundation/mcl/src/bn_c_impl.hpp +++ b/vendor/github.com/byzantine-lab/mcl/src/bn_c_impl.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/src/ecdsa_c.cpp b/vendor/github.com/byzantine-lab/mcl/src/ecdsa_c.cpp index f2222a224..f2222a224 100644 --- a/vendor/github.com/dexon-foundation/mcl/src/ecdsa_c.cpp +++ b/vendor/github.com/byzantine-lab/mcl/src/ecdsa_c.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/src/fp.cpp b/vendor/github.com/byzantine-lab/mcl/src/fp.cpp index df72d6d07..df72d6d07 100644 --- a/vendor/github.com/dexon-foundation/mcl/src/fp.cpp +++ b/vendor/github.com/byzantine-lab/mcl/src/fp.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/src/fp_generator.hpp b/vendor/github.com/byzantine-lab/mcl/src/fp_generator.hpp index b496bc4d4..b496bc4d4 100644 --- a/vendor/github.com/dexon-foundation/mcl/src/fp_generator.hpp +++ b/vendor/github.com/byzantine-lab/mcl/src/fp_generator.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/src/gen.cpp b/vendor/github.com/byzantine-lab/mcl/src/gen.cpp index 763f64b98..763f64b98 100644 --- a/vendor/github.com/dexon-foundation/mcl/src/gen.cpp +++ b/vendor/github.com/byzantine-lab/mcl/src/gen.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/src/llvm_gen.hpp b/vendor/github.com/byzantine-lab/mcl/src/llvm_gen.hpp index bbc5b9030..bbc5b9030 100644 --- a/vendor/github.com/dexon-foundation/mcl/src/llvm_gen.hpp +++ b/vendor/github.com/byzantine-lab/mcl/src/llvm_gen.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/src/low_func.hpp b/vendor/github.com/byzantine-lab/mcl/src/low_func.hpp index 57c63cfa3..57c63cfa3 100644 --- a/vendor/github.com/dexon-foundation/mcl/src/low_func.hpp +++ b/vendor/github.com/byzantine-lab/mcl/src/low_func.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/src/low_func_llvm.hpp b/vendor/github.com/byzantine-lab/mcl/src/low_func_llvm.hpp index 8a44c2277..8a44c2277 100644 --- a/vendor/github.com/dexon-foundation/mcl/src/low_func_llvm.hpp +++ b/vendor/github.com/byzantine-lab/mcl/src/low_func_llvm.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/src/proj/mcl.vcxproj b/vendor/github.com/byzantine-lab/mcl/src/proj/mcl.vcxproj index b247982ab..b247982ab 100644 --- a/vendor/github.com/dexon-foundation/mcl/src/proj/mcl.vcxproj +++ b/vendor/github.com/byzantine-lab/mcl/src/proj/mcl.vcxproj diff --git a/vendor/github.com/dexon-foundation/mcl/src/proto.hpp b/vendor/github.com/byzantine-lab/mcl/src/proto.hpp index 97c331194..97c331194 100644 --- a/vendor/github.com/dexon-foundation/mcl/src/proto.hpp +++ b/vendor/github.com/byzantine-lab/mcl/src/proto.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/src/she_c256.cpp b/vendor/github.com/byzantine-lab/mcl/src/she_c256.cpp index 84873e4ca..84873e4ca 100644 --- a/vendor/github.com/dexon-foundation/mcl/src/she_c256.cpp +++ b/vendor/github.com/byzantine-lab/mcl/src/she_c256.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/src/she_c384.cpp b/vendor/github.com/byzantine-lab/mcl/src/she_c384.cpp index bfc456a05..bfc456a05 100644 --- a/vendor/github.com/dexon-foundation/mcl/src/she_c384.cpp +++ b/vendor/github.com/byzantine-lab/mcl/src/she_c384.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/src/she_c_impl.hpp b/vendor/github.com/byzantine-lab/mcl/src/she_c_impl.hpp index 073bc2b34..073bc2b34 100644 --- a/vendor/github.com/dexon-foundation/mcl/src/she_c_impl.hpp +++ b/vendor/github.com/byzantine-lab/mcl/src/she_c_impl.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/src/xbyak/xbyak.h b/vendor/github.com/byzantine-lab/mcl/src/xbyak/xbyak.h index bcfeb34bf..bcfeb34bf 100644 --- a/vendor/github.com/dexon-foundation/mcl/src/xbyak/xbyak.h +++ b/vendor/github.com/byzantine-lab/mcl/src/xbyak/xbyak.h diff --git a/vendor/github.com/dexon-foundation/mcl/src/xbyak/xbyak_mnemonic.h b/vendor/github.com/byzantine-lab/mcl/src/xbyak/xbyak_mnemonic.h index 766f2f6ec..766f2f6ec 100644 --- a/vendor/github.com/dexon-foundation/mcl/src/xbyak/xbyak_mnemonic.h +++ b/vendor/github.com/byzantine-lab/mcl/src/xbyak/xbyak_mnemonic.h diff --git a/vendor/github.com/dexon-foundation/mcl/src/xbyak/xbyak_util.h b/vendor/github.com/byzantine-lab/mcl/src/xbyak/xbyak_util.h index 01544501d..01544501d 100644 --- a/vendor/github.com/dexon-foundation/mcl/src/xbyak/xbyak_util.h +++ b/vendor/github.com/byzantine-lab/mcl/src/xbyak/xbyak_util.h diff --git a/vendor/github.com/dexon-foundation/mcl/test/aggregate_sig_test.cpp b/vendor/github.com/byzantine-lab/mcl/test/aggregate_sig_test.cpp index c3a0e758d..c3a0e758d 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/aggregate_sig_test.cpp +++ b/vendor/github.com/byzantine-lab/mcl/test/aggregate_sig_test.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/array_test.cpp b/vendor/github.com/byzantine-lab/mcl/test/array_test.cpp index 2168a28fa..2168a28fa 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/array_test.cpp +++ b/vendor/github.com/byzantine-lab/mcl/test/array_test.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/base_test.cpp b/vendor/github.com/byzantine-lab/mcl/test/base_test.cpp index 2733d17ca..2733d17ca 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/base_test.cpp +++ b/vendor/github.com/byzantine-lab/mcl/test/base_test.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/bench.hpp b/vendor/github.com/byzantine-lab/mcl/test/bench.hpp index cc1639e6e..cc1639e6e 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/bench.hpp +++ b/vendor/github.com/byzantine-lab/mcl/test/bench.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/bls12_test.cpp b/vendor/github.com/byzantine-lab/mcl/test/bls12_test.cpp index 7011516bd..7011516bd 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/bls12_test.cpp +++ b/vendor/github.com/byzantine-lab/mcl/test/bls12_test.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/bn384_test.cpp b/vendor/github.com/byzantine-lab/mcl/test/bn384_test.cpp index b5674a918..b5674a918 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/bn384_test.cpp +++ b/vendor/github.com/byzantine-lab/mcl/test/bn384_test.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/bn512_test.cpp b/vendor/github.com/byzantine-lab/mcl/test/bn512_test.cpp index 905bfd3db..905bfd3db 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/bn512_test.cpp +++ b/vendor/github.com/byzantine-lab/mcl/test/bn512_test.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/bn_c256_test.cpp b/vendor/github.com/byzantine-lab/mcl/test/bn_c256_test.cpp index 2ce85162d..2ce85162d 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/bn_c256_test.cpp +++ b/vendor/github.com/byzantine-lab/mcl/test/bn_c256_test.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/bn_c384_256_test.cpp b/vendor/github.com/byzantine-lab/mcl/test/bn_c384_256_test.cpp index e7bbefda9..e7bbefda9 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/bn_c384_256_test.cpp +++ b/vendor/github.com/byzantine-lab/mcl/test/bn_c384_256_test.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/bn_c384_test.cpp b/vendor/github.com/byzantine-lab/mcl/test/bn_c384_test.cpp index a9f20243a..a9f20243a 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/bn_c384_test.cpp +++ b/vendor/github.com/byzantine-lab/mcl/test/bn_c384_test.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/bn_c512_test.cpp b/vendor/github.com/byzantine-lab/mcl/test/bn_c512_test.cpp index c6af3989f..c6af3989f 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/bn_c512_test.cpp +++ b/vendor/github.com/byzantine-lab/mcl/test/bn_c512_test.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/bn_c_test.hpp b/vendor/github.com/byzantine-lab/mcl/test/bn_c_test.hpp index e9dc59393..e9dc59393 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/bn_c_test.hpp +++ b/vendor/github.com/byzantine-lab/mcl/test/bn_c_test.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/bn_test.cpp b/vendor/github.com/byzantine-lab/mcl/test/bn_test.cpp index 071ec706c..071ec706c 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/bn_test.cpp +++ b/vendor/github.com/byzantine-lab/mcl/test/bn_test.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/conversion_test.cpp b/vendor/github.com/byzantine-lab/mcl/test/conversion_test.cpp index ec11fe900..ec11fe900 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/conversion_test.cpp +++ b/vendor/github.com/byzantine-lab/mcl/test/conversion_test.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/ec_test.cpp b/vendor/github.com/byzantine-lab/mcl/test/ec_test.cpp index ec49adbfe..ec49adbfe 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/ec_test.cpp +++ b/vendor/github.com/byzantine-lab/mcl/test/ec_test.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/ecdsa_c_test.cpp b/vendor/github.com/byzantine-lab/mcl/test/ecdsa_c_test.cpp index e0af38182..e0af38182 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/ecdsa_c_test.cpp +++ b/vendor/github.com/byzantine-lab/mcl/test/ecdsa_c_test.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/ecdsa_test.cpp b/vendor/github.com/byzantine-lab/mcl/test/ecdsa_test.cpp index 332c9ee27..332c9ee27 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/ecdsa_test.cpp +++ b/vendor/github.com/byzantine-lab/mcl/test/ecdsa_test.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/elgamal_test.cpp b/vendor/github.com/byzantine-lab/mcl/test/elgamal_test.cpp index 9532fc597..9532fc597 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/elgamal_test.cpp +++ b/vendor/github.com/byzantine-lab/mcl/test/elgamal_test.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/fp_generator_test.cpp b/vendor/github.com/byzantine-lab/mcl/test/fp_generator_test.cpp index 60ec5cd41..60ec5cd41 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/fp_generator_test.cpp +++ b/vendor/github.com/byzantine-lab/mcl/test/fp_generator_test.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/fp_test.cpp b/vendor/github.com/byzantine-lab/mcl/test/fp_test.cpp index dc1b01ef4..dc1b01ef4 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/fp_test.cpp +++ b/vendor/github.com/byzantine-lab/mcl/test/fp_test.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/fp_tower_test.cpp b/vendor/github.com/byzantine-lab/mcl/test/fp_tower_test.cpp index a7123f7a5..a7123f7a5 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/fp_tower_test.cpp +++ b/vendor/github.com/byzantine-lab/mcl/test/fp_tower_test.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/fp_util_test.cpp b/vendor/github.com/byzantine-lab/mcl/test/fp_util_test.cpp index e8a9f9aa5..e8a9f9aa5 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/fp_util_test.cpp +++ b/vendor/github.com/byzantine-lab/mcl/test/fp_util_test.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/glv_test.cpp b/vendor/github.com/byzantine-lab/mcl/test/glv_test.cpp index a917f51f4..a917f51f4 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/glv_test.cpp +++ b/vendor/github.com/byzantine-lab/mcl/test/glv_test.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/gmp_test.cpp b/vendor/github.com/byzantine-lab/mcl/test/gmp_test.cpp index 1fe9d4eb6..1fe9d4eb6 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/gmp_test.cpp +++ b/vendor/github.com/byzantine-lab/mcl/test/gmp_test.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/low_test.cpp b/vendor/github.com/byzantine-lab/mcl/test/low_test.cpp index f5e72a0b3..f5e72a0b3 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/low_test.cpp +++ b/vendor/github.com/byzantine-lab/mcl/test/low_test.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/mk32.sh b/vendor/github.com/byzantine-lab/mcl/test/mk32.sh index 4d5f60711..4d5f60711 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/mk32.sh +++ b/vendor/github.com/byzantine-lab/mcl/test/mk32.sh diff --git a/vendor/github.com/dexon-foundation/mcl/test/modp_test.cpp b/vendor/github.com/byzantine-lab/mcl/test/modp_test.cpp index bf9da38bf..bf9da38bf 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/modp_test.cpp +++ b/vendor/github.com/byzantine-lab/mcl/test/modp_test.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/mont_fp_test.cpp b/vendor/github.com/byzantine-lab/mcl/test/mont_fp_test.cpp index e41e77a53..e41e77a53 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/mont_fp_test.cpp +++ b/vendor/github.com/byzantine-lab/mcl/test/mont_fp_test.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/paillier_test.cpp b/vendor/github.com/byzantine-lab/mcl/test/paillier_test.cpp index 31d2b26fc..31d2b26fc 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/paillier_test.cpp +++ b/vendor/github.com/byzantine-lab/mcl/test/paillier_test.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/proj/bn_test/bn_test.vcxproj b/vendor/github.com/byzantine-lab/mcl/test/proj/bn_test/bn_test.vcxproj index 936e075aa..936e075aa 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/proj/bn_test/bn_test.vcxproj +++ b/vendor/github.com/byzantine-lab/mcl/test/proj/bn_test/bn_test.vcxproj diff --git a/vendor/github.com/dexon-foundation/mcl/test/proj/ec_test/ec_test.vcxproj b/vendor/github.com/byzantine-lab/mcl/test/proj/ec_test/ec_test.vcxproj index 4bdfda2cb..4bdfda2cb 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/proj/ec_test/ec_test.vcxproj +++ b/vendor/github.com/byzantine-lab/mcl/test/proj/ec_test/ec_test.vcxproj diff --git a/vendor/github.com/dexon-foundation/mcl/test/proj/fp_test/fp_test.vcxproj b/vendor/github.com/byzantine-lab/mcl/test/proj/fp_test/fp_test.vcxproj index f705982bf..f705982bf 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/proj/fp_test/fp_test.vcxproj +++ b/vendor/github.com/byzantine-lab/mcl/test/proj/fp_test/fp_test.vcxproj diff --git a/vendor/github.com/dexon-foundation/mcl/test/proj/fp_tower_test/fp_tower_test.vcxproj b/vendor/github.com/byzantine-lab/mcl/test/proj/fp_tower_test/fp_tower_test.vcxproj index d5720678f..d5720678f 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/proj/fp_tower_test/fp_tower_test.vcxproj +++ b/vendor/github.com/byzantine-lab/mcl/test/proj/fp_tower_test/fp_tower_test.vcxproj diff --git a/vendor/github.com/dexon-foundation/mcl/test/she_c256_test.cpp b/vendor/github.com/byzantine-lab/mcl/test/she_c256_test.cpp index 3e458b623..3e458b623 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/she_c256_test.cpp +++ b/vendor/github.com/byzantine-lab/mcl/test/she_c256_test.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/she_c384_test.cpp b/vendor/github.com/byzantine-lab/mcl/test/she_c384_test.cpp index 5c7bd9882..5c7bd9882 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/she_c384_test.cpp +++ b/vendor/github.com/byzantine-lab/mcl/test/she_c384_test.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/she_c_test.hpp b/vendor/github.com/byzantine-lab/mcl/test/she_c_test.hpp index 8287c0e0a..8287c0e0a 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/she_c_test.hpp +++ b/vendor/github.com/byzantine-lab/mcl/test/she_c_test.hpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/she_test.cpp b/vendor/github.com/byzantine-lab/mcl/test/she_test.cpp index 9292c35f4..9292c35f4 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/she_test.cpp +++ b/vendor/github.com/byzantine-lab/mcl/test/she_test.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/sq_test.cpp b/vendor/github.com/byzantine-lab/mcl/test/sq_test.cpp index 4c386d23b..4c386d23b 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/sq_test.cpp +++ b/vendor/github.com/byzantine-lab/mcl/test/sq_test.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/vint_test.cpp b/vendor/github.com/byzantine-lab/mcl/test/vint_test.cpp index 15e14266a..15e14266a 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/vint_test.cpp +++ b/vendor/github.com/byzantine-lab/mcl/test/vint_test.cpp diff --git a/vendor/github.com/dexon-foundation/mcl/test/window_method_test.cpp b/vendor/github.com/byzantine-lab/mcl/test/window_method_test.cpp index 1b0f702af..1b0f702af 100644 --- a/vendor/github.com/dexon-foundation/mcl/test/window_method_test.cpp +++ b/vendor/github.com/byzantine-lab/mcl/test/window_method_test.cpp diff --git a/vendor/github.com/dexon-foundation/bls/ffi/go/bls/bls_test.go b/vendor/github.com/dexon-foundation/bls/ffi/go/bls/bls_test.go deleted file mode 100644 index a13ee02f4..000000000 --- a/vendor/github.com/dexon-foundation/bls/ffi/go/bls/bls_test.go +++ /dev/null @@ -1,690 +0,0 @@ -package bls - -import "testing" -import "strconv" -import "crypto/sha256" -import "crypto/sha512" -import "fmt" -import "crypto/rand" - -var unitN = 0 - -// Tests (for Benchmarks see below) - -func testPre(t *testing.T) { - t.Log("init") - { - var id ID - err := id.SetLittleEndian([]byte{6, 5, 4, 3, 2, 1}) - if err != nil { - t.Error(err) - } - t.Log("id :", id.GetHexString()) - var id2 ID - err = id2.SetHexString(id.GetHexString()) - if err != nil { - t.Fatal(err) - } - if !id.IsEqual(&id2) { - t.Errorf("not same id\n%s\n%s", id.GetHexString(), id2.GetHexString()) - } - err = id2.SetDecString(id.GetDecString()) - if err != nil { - t.Fatal(err) - } - if !id.IsEqual(&id2) { - t.Errorf("not same id\n%s\n%s", id.GetDecString(), id2.GetDecString()) - } - } - { - var sec SecretKey - err := sec.SetLittleEndian([]byte{1, 2, 3, 4, 5, 6}) - if err != nil { - t.Error(err) - } - t.Log("sec=", sec.GetHexString()) - } - - t.Log("create secret key") - m := "this is a bls sample for go" - var sec SecretKey - sec.SetByCSPRNG() - t.Log("sec:", sec.GetHexString()) - t.Log("create public key") - pub := sec.GetPublicKey() - t.Log("pub:", pub.GetHexString()) - sign := sec.Sign(m) - t.Log("sign:", sign.GetHexString()) - if !sign.Verify(pub, m) { - t.Error("Signature does not verify") - } - - // How to make array of SecretKey - { - sec := make([]SecretKey, 3) - for i := 0; i < len(sec); i++ { - sec[i].SetByCSPRNG() - t.Log("sec=", sec[i].GetHexString()) - } - } -} - -func testStringConversion(t *testing.T) { - t.Log("testRecoverSecretKey") - var sec SecretKey - var s string - if unitN == 6 { - s = "16798108731015832284940804142231733909759579603404752749028378864165570215949" - } else { - s = "40804142231733909759579603404752749028378864165570215949" - } - err := sec.SetDecString(s) - if err != nil { - t.Fatal(err) - } - if s != sec.GetDecString() { - t.Error("not equal") - } - s = sec.GetHexString() - var sec2 SecretKey - err = sec2.SetHexString(s) - if err != nil { - t.Fatal(err) - } - if !sec.IsEqual(&sec2) { - t.Error("not equal") - } -} - -func testRecoverSecretKey(t *testing.T) { - t.Log("testRecoverSecretKey") - k := 3000 - var sec SecretKey - sec.SetByCSPRNG() - t.Logf("sec=%s\n", sec.GetHexString()) - - // make master secret key - msk := sec.GetMasterSecretKey(k) - - n := k - secVec := make([]SecretKey, n) - idVec := make([]ID, n) - for i := 0; i < n; i++ { - err := idVec[i].SetLittleEndian([]byte{byte(i & 255), byte(i >> 8), 2, 3, 4, 5}) - if err != nil { - t.Error(err) - } - err = secVec[i].Set(msk, &idVec[i]) - if err != nil { - t.Error(err) - } - // t.Logf("idVec[%d]=%s\n", i, idVec[i].GetHexString()) - } - // recover sec2 from secVec and idVec - var sec2 SecretKey - err := sec2.Recover(secVec, idVec) - if err != nil { - t.Error(err) - } - if !sec.IsEqual(&sec2) { - t.Errorf("Mismatch in recovered secret key:\n %s\n %s.", sec.GetHexString(), sec2.GetHexString()) - } -} - -func testEachSign(t *testing.T, m string, msk []SecretKey, mpk []PublicKey) ([]ID, []SecretKey, []PublicKey, []Sign) { - idTbl := []byte{3, 5, 193, 22, 15} - n := len(idTbl) - - secVec := make([]SecretKey, n) - pubVec := make([]PublicKey, n) - signVec := make([]Sign, n) - idVec := make([]ID, n) - - for i := 0; i < n; i++ { - err := idVec[i].SetLittleEndian([]byte{idTbl[i], 0, 0, 0, 0, 0}) - if err != nil { - t.Error(err) - } - t.Logf("idVec[%d]=%s\n", i, idVec[i].GetHexString()) - - err = secVec[i].Set(msk, &idVec[i]) - if err != nil { - t.Error(err) - } - - err = pubVec[i].Set(mpk, &idVec[i]) - if err != nil { - t.Error(err) - } - t.Logf("pubVec[%d]=%s\n", i, pubVec[i].GetHexString()) - - if !pubVec[i].IsEqual(secVec[i].GetPublicKey()) { - t.Errorf("Pubkey derivation does not match\n%s\n%s", pubVec[i].GetHexString(), secVec[i].GetPublicKey().GetHexString()) - } - - signVec[i] = *secVec[i].Sign(m) - if !signVec[i].Verify(&pubVec[i], m) { - t.Error("Pubkey derivation does not match") - } - } - return idVec, secVec, pubVec, signVec -} -func testSign(t *testing.T) { - m := "testSign" - t.Log(m) - - var sec0 SecretKey - sec0.SetByCSPRNG() - pub0 := sec0.GetPublicKey() - s0 := sec0.Sign(m) - if !s0.Verify(pub0, m) { - t.Error("Signature does not verify") - } - - k := 3 - msk := sec0.GetMasterSecretKey(k) - mpk := GetMasterPublicKey(msk) - idVec, secVec, pubVec, signVec := testEachSign(t, m, msk, mpk) - - var sec1 SecretKey - err := sec1.Recover(secVec, idVec) - if err != nil { - t.Error(err) - } - if !sec0.IsEqual(&sec1) { - t.Error("Mismatch in recovered seckey.") - } - var pub1 PublicKey - err = pub1.Recover(pubVec, idVec) - if err != nil { - t.Error(err) - } - if !pub0.IsEqual(&pub1) { - t.Error("Mismatch in recovered pubkey.") - } - var s1 Sign - err = s1.Recover(signVec, idVec) - if err != nil { - t.Error(err) - } - if !s0.IsEqual(&s1) { - t.Error("Mismatch in recovered signature.") - } -} - -func testAdd(t *testing.T) { - t.Log("testAdd") - var sec1 SecretKey - var sec2 SecretKey - sec1.SetByCSPRNG() - sec2.SetByCSPRNG() - - pub1 := sec1.GetPublicKey() - pub2 := sec2.GetPublicKey() - - m := "test test" - sign1 := sec1.Sign(m) - sign2 := sec2.Sign(m) - - t.Log("sign1 :", sign1.GetHexString()) - sign1.Add(sign2) - t.Log("sign1 add:", sign1.GetHexString()) - pub1.Add(pub2) - if !sign1.Verify(pub1, m) { - t.Fail() - } -} - -func testPop(t *testing.T) { - t.Log("testPop") - var sec SecretKey - sec.SetByCSPRNG() - pop := sec.GetPop() - if !pop.VerifyPop(sec.GetPublicKey()) { - t.Errorf("Valid Pop does not verify") - } - sec.SetByCSPRNG() - if pop.VerifyPop(sec.GetPublicKey()) { - t.Errorf("Invalid Pop verifies") - } -} - -func testData(t *testing.T) { - t.Log("testData") - var sec1, sec2 SecretKey - sec1.SetByCSPRNG() - b := sec1.GetLittleEndian() - err := sec2.SetLittleEndian(b) - if err != nil { - t.Fatal(err) - } - if !sec1.IsEqual(&sec2) { - t.Error("SecretKey not same") - } - pub1 := sec1.GetPublicKey() - b = pub1.Serialize() - var pub2 PublicKey - err = pub2.Deserialize(b) - if err != nil { - t.Fatal(err) - } - if !pub1.IsEqual(&pub2) { - t.Error("PublicKey not same") - } - m := "doremi" - sign1 := sec1.Sign(m) - b = sign1.Serialize() - var sign2 Sign - err = sign2.Deserialize(b) - if err != nil { - t.Fatal(err) - } - if !sign1.IsEqual(&sign2) { - t.Error("Sign not same") - } -} - -func testSerializeToHexStr(t *testing.T) { - t.Log("testSerializeToHexStr") - var sec1, sec2 SecretKey - sec1.SetByCSPRNG() - s := sec1.SerializeToHexStr() - err := sec2.DeserializeHexStr(s) - if err != nil { - t.Fatal(err) - } - if !sec1.IsEqual(&sec2) { - t.Error("SecretKey not same") - } - pub1 := sec1.GetPublicKey() - s = pub1.SerializeToHexStr() - var pub2 PublicKey - err = pub2.DeserializeHexStr(s) - if err != nil { - t.Fatal(err) - } - if !pub1.IsEqual(&pub2) { - t.Error("PublicKey not same") - } - m := "doremi" - sign1 := sec1.Sign(m) - s = sign1.SerializeToHexStr() - var sign2 Sign - err = sign2.DeserializeHexStr(s) - if err != nil { - t.Fatal(err) - } - if !sign1.IsEqual(&sign2) { - t.Error("Sign not same") - } -} - -func testOrder(t *testing.T, c int) { - var curve string - var field string - if c == CurveFp254BNb { - curve = "16798108731015832284940804142231733909759579603404752749028378864165570215949" - field = "16798108731015832284940804142231733909889187121439069848933715426072753864723" - } else if c == CurveFp382_1 { - curve = "5540996953667913971058039301942914304734176495422447785042938606876043190415948413757785063597439175372845535461389" - field = "5540996953667913971058039301942914304734176495422447785045292539108217242186829586959562222833658991069414454984723" - } else if c == CurveFp382_2 { - curve = "5541245505022739011583672869577435255026888277144126952448297309161979278754528049907713682488818304329661351460877" - field = "5541245505022739011583672869577435255026888277144126952450651294188487038640194767986566260919128250811286032482323" - } else if c == BLS12_381 { - curve = "52435875175126190479447740508185965837690552500527637822603658699938581184513" - field = "4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787" - } else { - t.Fatal("bad c", c) - } - s := GetCurveOrder() - if s != curve { - t.Errorf("bad curve order\n%s\n%s\n", s, curve) - } - s = GetFieldOrder() - if s != field { - t.Errorf("bad field order\n%s\n%s\n", s, field) - } -} - -func testDHKeyExchange(t *testing.T) { - var sec1, sec2 SecretKey - sec1.SetByCSPRNG() - sec2.SetByCSPRNG() - pub1 := sec1.GetPublicKey() - pub2 := sec2.GetPublicKey() - out1 := DHKeyExchange(&sec1, pub2) - out2 := DHKeyExchange(&sec2, pub1) - if !out1.IsEqual(&out2) { - t.Errorf("DH key is not equal") - } -} - -func testPairing(t *testing.T) { - var sec SecretKey - sec.SetByCSPRNG() - pub := sec.GetPublicKey() - m := "abc" - sig1 := sec.Sign(m) - sig2 := HashAndMapToSignature([]byte(m)) - if !VerifyPairing(sig1, sig2, pub) { - t.Errorf("VerifyPairing") - } -} - -func testAggregate(t *testing.T) { - var sec SecretKey - sec.SetByCSPRNG() - pub := sec.GetPublicKey() - msgTbl := []string{"abc", "def", "123"} - n := len(msgTbl) - sigVec := make([]*Sign, n) - for i := 0; i < n; i++ { - m := msgTbl[i] - sigVec[i] = sec.Sign(m) - } - aggSign := sigVec[0] - for i := 1; i < n; i++ { - aggSign.Add(sigVec[i]) - } - hashPt := HashAndMapToSignature([]byte(msgTbl[0])) - for i := 1; i < n; i++ { - hashPt.Add(HashAndMapToSignature([]byte(msgTbl[i]))) - } - if !VerifyPairing(aggSign, hashPt, pub) { - t.Errorf("aggregate2") - } -} - -func Hash(buf []byte) []byte { - if GetOpUnitSize() == 4 { - d := sha256.Sum256([]byte(buf)) - return d[:] - } else { - // use SHA512 if bitSize > 256 - d := sha512.Sum512([]byte(buf)) - return d[:] - } -} - -func testHash(t *testing.T) { - var sec SecretKey - sec.SetByCSPRNG() - pub := sec.GetPublicKey() - m := "abc" - h := Hash([]byte(m)) - sig1 := sec.Sign(m) - sig2 := sec.SignHash(h) - if !sig1.IsEqual(sig2) { - t.Errorf("SignHash") - } - if !sig1.Verify(pub, m) { - t.Errorf("sig1.Verify") - } - if !sig2.VerifyHash(pub, h) { - t.Errorf("sig2.VerifyHash") - } -} - -func testAggregateHashes(t *testing.T) { - n := 1000 - pubVec := make([]PublicKey, n) - sigVec := make([]*Sign, n) - h := make([][]byte, n) - for i := 0; i < n; i++ { - sec := new(SecretKey) - sec.SetByCSPRNG() - pubVec[i] = *sec.GetPublicKey() - m := fmt.Sprintf("abc-%d", i) - h[i] = Hash([]byte(m)) - sigVec[i] = sec.SignHash(h[i]) - } - // aggregate sig - sig := sigVec[0] - for i := 1; i < n; i++ { - sig.Add(sigVec[i]) - } - if !sig.VerifyAggregateHashes(pubVec, h) { - t.Errorf("sig.VerifyAggregateHashes") - } -} - -type SeqRead struct { -} - -func (self *SeqRead) Read(buf []byte) (int, error) { - n := len(buf) - for i := 0; i < n; i++ { - buf[i] = byte(i) - } - return n, nil -} - -func testReadRand(t *testing.T) { - s1 := new(SeqRead) - SetRandFunc(s1) - var sec SecretKey - sec.SetByCSPRNG() - buf := sec.GetLittleEndian() - fmt.Printf("(SeqRead) buf=%x\n", buf) - for i := 0; i < len(buf)-1; i++ { - // ommit buf[len(buf) - 1] because it may be masked - if buf[i] != byte(i) { - t.Fatal("buf") - } - } - SetRandFunc(rand.Reader) - sec.SetByCSPRNG() - buf = sec.GetLittleEndian() - fmt.Printf("(rand.Reader) buf=%x\n", buf) - SetRandFunc(nil) - sec.SetByCSPRNG() - buf = sec.GetLittleEndian() - fmt.Printf("(default) buf=%x\n", buf) -} - -func test(t *testing.T, c int) { - err := Init(c) - if err != nil { - t.Fatal(err) - } - unitN = GetOpUnitSize() - t.Logf("unitN=%d\n", unitN) - testReadRand(t) - testPre(t) - testRecoverSecretKey(t) - testAdd(t) - testSign(t) - testPop(t) - testData(t) - testStringConversion(t) - testOrder(t, c) - testDHKeyExchange(t) - testSerializeToHexStr(t) - testPairing(t) - testAggregate(t) - testHash(t) - testAggregateHashes(t) -} - -func TestMain(t *testing.T) { - t.Logf("GetMaxOpUnitSize() = %d\n", GetMaxOpUnitSize()) - t.Log("CurveFp254BNb") - test(t, CurveFp254BNb) - if GetMaxOpUnitSize() == 6 { - if GetFrUnitSize() == 6 { - t.Log("CurveFp382_1") - test(t, CurveFp382_1) - } - t.Log("BLS12_381") - test(t, BLS12_381) - } -} - -// Benchmarks - -var curve = CurveFp382_1 - -//var curve = CurveFp254BNb - -func BenchmarkPubkeyFromSeckey(b *testing.B) { - b.StopTimer() - err := Init(curve) - if err != nil { - b.Fatal(err) - } - var sec SecretKey - for n := 0; n < b.N; n++ { - sec.SetByCSPRNG() - b.StartTimer() - sec.GetPublicKey() - b.StopTimer() - } -} - -func BenchmarkSigning(b *testing.B) { - b.StopTimer() - err := Init(curve) - if err != nil { - b.Fatal(err) - } - var sec SecretKey - for n := 0; n < b.N; n++ { - sec.SetByCSPRNG() - b.StartTimer() - sec.Sign(strconv.Itoa(n)) - b.StopTimer() - } -} - -func BenchmarkValidation(b *testing.B) { - b.StopTimer() - err := Init(curve) - if err != nil { - b.Fatal(err) - } - var sec SecretKey - for n := 0; n < b.N; n++ { - sec.SetByCSPRNG() - pub := sec.GetPublicKey() - m := strconv.Itoa(n) - sig := sec.Sign(m) - b.StartTimer() - sig.Verify(pub, m) - b.StopTimer() - } -} - -func benchmarkDeriveSeckeyShare(k int, b *testing.B) { - b.StopTimer() - err := Init(curve) - if err != nil { - b.Fatal(err) - } - var sec SecretKey - sec.SetByCSPRNG() - msk := sec.GetMasterSecretKey(k) - var id ID - for n := 0; n < b.N; n++ { - err = id.SetLittleEndian([]byte{1, 2, 3, 4, 5, byte(n)}) - if err != nil { - b.Error(err) - } - b.StartTimer() - err := sec.Set(msk, &id) - b.StopTimer() - if err != nil { - b.Error(err) - } - } -} - -//func BenchmarkDeriveSeckeyShare100(b *testing.B) { benchmarkDeriveSeckeyShare(100, b) } -//func BenchmarkDeriveSeckeyShare200(b *testing.B) { benchmarkDeriveSeckeyShare(200, b) } -func BenchmarkDeriveSeckeyShare500(b *testing.B) { benchmarkDeriveSeckeyShare(500, b) } - -//func BenchmarkDeriveSeckeyShare1000(b *testing.B) { benchmarkDeriveSeckeyShare(1000, b) } - -func benchmarkRecoverSeckey(k int, b *testing.B) { - b.StopTimer() - err := Init(curve) - if err != nil { - b.Fatal(err) - } - var sec SecretKey - sec.SetByCSPRNG() - msk := sec.GetMasterSecretKey(k) - - // derive n shares - n := k - secVec := make([]SecretKey, n) - idVec := make([]ID, n) - for i := 0; i < n; i++ { - err := idVec[i].SetLittleEndian([]byte{1, 2, 3, 4, 5, byte(i)}) - if err != nil { - b.Error(err) - } - err = secVec[i].Set(msk, &idVec[i]) - if err != nil { - b.Error(err) - } - } - - // recover from secVec and idVec - var sec2 SecretKey - b.StartTimer() - for n := 0; n < b.N; n++ { - err := sec2.Recover(secVec, idVec) - if err != nil { - b.Errorf("%s\n", err) - } - } -} - -func BenchmarkRecoverSeckey100(b *testing.B) { benchmarkRecoverSeckey(100, b) } -func BenchmarkRecoverSeckey200(b *testing.B) { benchmarkRecoverSeckey(200, b) } -func BenchmarkRecoverSeckey500(b *testing.B) { benchmarkRecoverSeckey(500, b) } -func BenchmarkRecoverSeckey1000(b *testing.B) { benchmarkRecoverSeckey(1000, b) } - -func benchmarkRecoverSignature(k int, b *testing.B) { - b.StopTimer() - err := Init(curve) - if err != nil { - b.Fatal(err) - } - var sec SecretKey - sec.SetByCSPRNG() - msk := sec.GetMasterSecretKey(k) - - // derive n shares - n := k - idVec := make([]ID, n) - secVec := make([]SecretKey, n) - signVec := make([]Sign, n) - for i := 0; i < n; i++ { - err := idVec[i].SetLittleEndian([]byte{1, 2, 3, 4, 5, byte(i)}) - if err != nil { - b.Error(err) - } - err = secVec[i].Set(msk, &idVec[i]) - if err != nil { - b.Error(err) - } - signVec[i] = *secVec[i].Sign("test message") - } - - // recover signature - var sig Sign - b.StartTimer() - for n := 0; n < b.N; n++ { - err := sig.Recover(signVec, idVec) - if err != nil { - b.Error(err) - } - } -} - -func BenchmarkRecoverSignature100(b *testing.B) { benchmarkRecoverSignature(100, b) } -func BenchmarkRecoverSignature200(b *testing.B) { benchmarkRecoverSignature(200, b) } -func BenchmarkRecoverSignature500(b *testing.B) { benchmarkRecoverSignature(500, b) } -func BenchmarkRecoverSignature1000(b *testing.B) { benchmarkRecoverSignature(1000, b) } diff --git a/vendor/github.com/dexon-foundation/bls/ffi/go/bls/config.h b/vendor/github.com/dexon-foundation/bls/ffi/go/bls/config.h deleted file mode 100644 index 07e148137..000000000 --- a/vendor/github.com/dexon-foundation/bls/ffi/go/bls/config.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma -// use bn384 unless tags is specified -#ifndef MCLBN_FP_UNIT_SIZE - #define MCLBN_FP_UNIT_SIZE 6 -#endif - diff --git a/vendor/github.com/ethereum/go-ethereum/common/big.go b/vendor/github.com/ethereum/go-ethereum/common/big.go new file mode 100644 index 000000000..65d4377bf --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/common/big.go @@ -0,0 +1,30 @@ +// Copyright 2014 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum 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 go-ethereum 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 go-ethereum library. If not, see <http://www.gnu.org/licenses/>. + +package common + +import "math/big" + +// Common big integers often used +var ( + Big1 = big.NewInt(1) + Big2 = big.NewInt(2) + Big3 = big.NewInt(3) + Big0 = big.NewInt(0) + Big32 = big.NewInt(32) + Big256 = big.NewInt(256) + Big257 = big.NewInt(257) +) diff --git a/vendor/github.com/ethereum/go-ethereum/common/bytes.go b/vendor/github.com/ethereum/go-ethereum/common/bytes.go new file mode 100644 index 000000000..c82e61624 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/common/bytes.go @@ -0,0 +1,138 @@ +// Copyright 2014 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum 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 go-ethereum 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 go-ethereum library. If not, see <http://www.gnu.org/licenses/>. + +// Package common contains various helper functions. +package common + +import "encoding/hex" + +// ToHex returns the hex representation of b, prefixed with '0x'. +// For empty slices, the return value is "0x0". +// +// Deprecated: use hexutil.Encode instead. +func ToHex(b []byte) string { + hex := Bytes2Hex(b) + if len(hex) == 0 { + hex = "0" + } + return "0x" + hex +} + +// ToHexArray creates a array of hex-string based on []byte +func ToHexArray(b [][]byte) []string { + r := make([]string, len(b)) + for i := range b { + r[i] = ToHex(b[i]) + } + return r +} + +// FromHex returns the bytes represented by the hexadecimal string s. +// s may be prefixed with "0x". +func FromHex(s string) []byte { + if len(s) > 1 { + if s[0:2] == "0x" || s[0:2] == "0X" { + s = s[2:] + } + } + if len(s)%2 == 1 { + s = "0" + s + } + return Hex2Bytes(s) +} + +// CopyBytes returns an exact copy of the provided bytes. +func CopyBytes(b []byte) (copiedBytes []byte) { + if b == nil { + return nil + } + copiedBytes = make([]byte, len(b)) + copy(copiedBytes, b) + + return +} + +// hasHexPrefix validates str begins with '0x' or '0X'. +func hasHexPrefix(str string) bool { + return len(str) >= 2 && str[0] == '0' && (str[1] == 'x' || str[1] == 'X') +} + +// isHexCharacter returns bool of c being a valid hexadecimal. +func isHexCharacter(c byte) bool { + return ('0' <= c && c <= '9') || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F') +} + +// isHex validates whether each byte is valid hexadecimal string. +func isHex(str string) bool { + if len(str)%2 != 0 { + return false + } + for _, c := range []byte(str) { + if !isHexCharacter(c) { + return false + } + } + return true +} + +// Bytes2Hex returns the hexadecimal encoding of d. +func Bytes2Hex(d []byte) string { + return hex.EncodeToString(d) +} + +// Hex2Bytes returns the bytes represented by the hexadecimal string str. +func Hex2Bytes(str string) []byte { + h, _ := hex.DecodeString(str) + return h +} + +// Hex2BytesFixed returns bytes of a specified fixed length flen. +func Hex2BytesFixed(str string, flen int) []byte { + h, _ := hex.DecodeString(str) + if len(h) == flen { + return h + } + if len(h) > flen { + return h[len(h)-flen:] + } + hh := make([]byte, flen) + copy(hh[flen-len(h):flen], h) + return hh +} + +// RightPadBytes zero-pads slice to the right up to length l. +func RightPadBytes(slice []byte, l int) []byte { + if l <= len(slice) { + return slice + } + + padded := make([]byte, l) + copy(padded, slice) + + return padded +} + +// LeftPadBytes zero-pads slice to the left up to length l. +func LeftPadBytes(slice []byte, l int) []byte { + if l <= len(slice) { + return slice + } + + padded := make([]byte, l) + copy(padded[l-len(slice):], slice) + + return padded +} diff --git a/vendor/github.com/ethereum/go-ethereum/common/debug.go b/vendor/github.com/ethereum/go-ethereum/common/debug.go new file mode 100644 index 000000000..61acd8ce7 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/common/debug.go @@ -0,0 +1,52 @@ +// Copyright 2015 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum 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 go-ethereum 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 go-ethereum library. If not, see <http://www.gnu.org/licenses/>. + +package common + +import ( + "fmt" + "os" + "runtime" + "runtime/debug" + "strings" +) + +// Report gives off a warning requesting the user to submit an issue to the github tracker. +func Report(extra ...interface{}) { + fmt.Fprintln(os.Stderr, "You've encountered a sought after, hard to reproduce bug. Please report this to the developers <3 https://github.com/ethereum/go-ethereum/issues") + fmt.Fprintln(os.Stderr, extra...) + + _, file, line, _ := runtime.Caller(1) + fmt.Fprintf(os.Stderr, "%v:%v\n", file, line) + + debug.PrintStack() + + fmt.Fprintln(os.Stderr, "#### BUG! PLEASE REPORT ####") +} + +// PrintDepricationWarning prinst the given string in a box using fmt.Println. +func PrintDepricationWarning(str string) { + line := strings.Repeat("#", len(str)+4) + emptyLine := strings.Repeat(" ", len(str)) + fmt.Printf(` +%s +# %s # +# %s # +# %s # +%s + +`, line, emptyLine, str, emptyLine, line) +} diff --git a/vendor/github.com/ethereum/go-ethereum/common/format.go b/vendor/github.com/ethereum/go-ethereum/common/format.go new file mode 100644 index 000000000..6fc21af71 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/common/format.go @@ -0,0 +1,82 @@ +// Copyright 2016 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum 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 go-ethereum 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 go-ethereum library. If not, see <http://www.gnu.org/licenses/>. + +package common + +import ( + "fmt" + "regexp" + "strings" + "time" +) + +// PrettyDuration is a pretty printed version of a time.Duration value that cuts +// the unnecessary precision off from the formatted textual representation. +type PrettyDuration time.Duration + +var prettyDurationRe = regexp.MustCompile(`\.[0-9]+`) + +// String implements the Stringer interface, allowing pretty printing of duration +// values rounded to three decimals. +func (d PrettyDuration) String() string { + label := fmt.Sprintf("%v", time.Duration(d)) + if match := prettyDurationRe.FindString(label); len(match) > 4 { + label = strings.Replace(label, match, match[:4], 1) + } + return label +} + +// PrettyAge is a pretty printed version of a time.Duration value that rounds +// the values up to a single most significant unit, days/weeks/years included. +type PrettyAge time.Time + +// ageUnits is a list of units the age pretty printing uses. +var ageUnits = []struct { + Size time.Duration + Symbol string +}{ + {12 * 30 * 24 * time.Hour, "y"}, + {30 * 24 * time.Hour, "mo"}, + {7 * 24 * time.Hour, "w"}, + {24 * time.Hour, "d"}, + {time.Hour, "h"}, + {time.Minute, "m"}, + {time.Second, "s"}, +} + +// String implements the Stringer interface, allowing pretty printing of duration +// values rounded to the most significant time unit. +func (t PrettyAge) String() string { + // Calculate the time difference and handle the 0 cornercase + diff := time.Since(time.Time(t)) + if diff < time.Second { + return "0" + } + // Accumulate a precision of 3 components before returning + result, prec := "", 0 + + for _, unit := range ageUnits { + if diff > unit.Size { + result = fmt.Sprintf("%s%d%s", result, diff/unit.Size, unit.Symbol) + diff %= unit.Size + + if prec += 1; prec >= 3 { + break + } + } + } + return result +} diff --git a/vendor/github.com/ethereum/go-ethereum/common/hexutil/hexutil.go b/vendor/github.com/ethereum/go-ethereum/common/hexutil/hexutil.go new file mode 100644 index 000000000..46223a281 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/common/hexutil/hexutil.go @@ -0,0 +1,240 @@ +// Copyright 2016 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum 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 go-ethereum 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 go-ethereum library. If not, see <http://www.gnu.org/licenses/>. + +/* +Package hexutil implements hex encoding with 0x prefix. +This encoding is used by the Ethereum RPC API to transport binary data in JSON payloads. + +Encoding Rules + +All hex data must have prefix "0x". + +For byte slices, the hex data must be of even length. An empty byte slice +encodes as "0x". + +Integers are encoded using the least amount of digits (no leading zero digits). Their +encoding may be of uneven length. The number zero encodes as "0x0". +*/ +package hexutil + +import ( + "encoding/hex" + "fmt" + "math/big" + "strconv" +) + +const uintBits = 32 << (uint64(^uint(0)) >> 63) + +// Errors +var ( + ErrEmptyString = &decError{"empty hex string"} + ErrSyntax = &decError{"invalid hex string"} + ErrMissingPrefix = &decError{"hex string without 0x prefix"} + ErrOddLength = &decError{"hex string of odd length"} + ErrEmptyNumber = &decError{"hex string \"0x\""} + ErrLeadingZero = &decError{"hex number with leading zero digits"} + ErrUint64Range = &decError{"hex number > 64 bits"} + ErrUintRange = &decError{fmt.Sprintf("hex number > %d bits", uintBits)} + ErrBig256Range = &decError{"hex number > 256 bits"} +) + +type decError struct{ msg string } + +func (err decError) Error() string { return err.msg } + +// Decode decodes a hex string with 0x prefix. +func Decode(input string) ([]byte, error) { + if len(input) == 0 { + return nil, ErrEmptyString + } + if !has0xPrefix(input) { + return nil, ErrMissingPrefix + } + b, err := hex.DecodeString(input[2:]) + if err != nil { + err = mapError(err) + } + return b, err +} + +// MustDecode decodes a hex string with 0x prefix. It panics for invalid input. +func MustDecode(input string) []byte { + dec, err := Decode(input) + if err != nil { + panic(err) + } + return dec +} + +// Encode encodes b as a hex string with 0x prefix. +func Encode(b []byte) string { + enc := make([]byte, len(b)*2+2) + copy(enc, "0x") + hex.Encode(enc[2:], b) + return string(enc) +} + +// DecodeUint64 decodes a hex string with 0x prefix as a quantity. +func DecodeUint64(input string) (uint64, error) { + raw, err := checkNumber(input) + if err != nil { + return 0, err + } + dec, err := strconv.ParseUint(raw, 16, 64) + if err != nil { + err = mapError(err) + } + return dec, err +} + +// MustDecodeUint64 decodes a hex string with 0x prefix as a quantity. +// It panics for invalid input. +func MustDecodeUint64(input string) uint64 { + dec, err := DecodeUint64(input) + if err != nil { + panic(err) + } + return dec +} + +// EncodeUint64 encodes i as a hex string with 0x prefix. +func EncodeUint64(i uint64) string { + enc := make([]byte, 2, 10) + copy(enc, "0x") + return string(strconv.AppendUint(enc, i, 16)) +} + +var bigWordNibbles int + +func init() { + // This is a weird way to compute the number of nibbles required for big.Word. + // The usual way would be to use constant arithmetic but go vet can't handle that. + b, _ := new(big.Int).SetString("FFFFFFFFFF", 16) + switch len(b.Bits()) { + case 1: + bigWordNibbles = 16 + case 2: + bigWordNibbles = 8 + default: + panic("weird big.Word size") + } +} + +// DecodeBig decodes a hex string with 0x prefix as a quantity. +// Numbers larger than 256 bits are not accepted. +func DecodeBig(input string) (*big.Int, error) { + raw, err := checkNumber(input) + if err != nil { + return nil, err + } + if len(raw) > 64 { + return nil, ErrBig256Range + } + words := make([]big.Word, len(raw)/bigWordNibbles+1) + end := len(raw) + for i := range words { + start := end - bigWordNibbles + if start < 0 { + start = 0 + } + for ri := start; ri < end; ri++ { + nib := decodeNibble(raw[ri]) + if nib == badNibble { + return nil, ErrSyntax + } + words[i] *= 16 + words[i] += big.Word(nib) + } + end = start + } + dec := new(big.Int).SetBits(words) + return dec, nil +} + +// MustDecodeBig decodes a hex string with 0x prefix as a quantity. +// It panics for invalid input. +func MustDecodeBig(input string) *big.Int { + dec, err := DecodeBig(input) + if err != nil { + panic(err) + } + return dec +} + +// EncodeBig encodes bigint as a hex string with 0x prefix. +// The sign of the integer is ignored. +func EncodeBig(bigint *big.Int) string { + nbits := bigint.BitLen() + if nbits == 0 { + return "0x0" + } + return fmt.Sprintf("%#x", bigint) +} + +func has0xPrefix(input string) bool { + return len(input) >= 2 && input[0] == '0' && (input[1] == 'x' || input[1] == 'X') +} + +func checkNumber(input string) (raw string, err error) { + if len(input) == 0 { + return "", ErrEmptyString + } + if !has0xPrefix(input) { + return "", ErrMissingPrefix + } + input = input[2:] + if len(input) == 0 { + return "", ErrEmptyNumber + } + if len(input) > 1 && input[0] == '0' { + return "", ErrLeadingZero + } + return input, nil +} + +const badNibble = ^uint64(0) + +func decodeNibble(in byte) uint64 { + switch { + case in >= '0' && in <= '9': + return uint64(in - '0') + case in >= 'A' && in <= 'F': + return uint64(in - 'A' + 10) + case in >= 'a' && in <= 'f': + return uint64(in - 'a' + 10) + default: + return badNibble + } +} + +func mapError(err error) error { + if err, ok := err.(*strconv.NumError); ok { + switch err.Err { + case strconv.ErrRange: + return ErrUint64Range + case strconv.ErrSyntax: + return ErrSyntax + } + } + if _, ok := err.(hex.InvalidByteError); ok { + return ErrSyntax + } + if err == hex.ErrLength { + return ErrOddLength + } + return err +} diff --git a/vendor/github.com/ethereum/go-ethereum/common/hexutil/json.go b/vendor/github.com/ethereum/go-ethereum/common/hexutil/json.go new file mode 100644 index 000000000..777b08eca --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/common/hexutil/json.go @@ -0,0 +1,376 @@ +// Copyright 2016 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum 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 go-ethereum 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 go-ethereum library. If not, see <http://www.gnu.org/licenses/>. + +package hexutil + +import ( + "encoding/hex" + "encoding/json" + "fmt" + "math/big" + "reflect" + "strconv" +) + +var ( + bytesT = reflect.TypeOf(Bytes(nil)) + bigT = reflect.TypeOf((*Big)(nil)) + uintT = reflect.TypeOf(Uint(0)) + uint64T = reflect.TypeOf(Uint64(0)) +) + +// Bytes marshals/unmarshals as a JSON string with 0x prefix. +// The empty slice marshals as "0x". +type Bytes []byte + +// MarshalText implements encoding.TextMarshaler +func (b Bytes) MarshalText() ([]byte, error) { + result := make([]byte, len(b)*2+2) + copy(result, `0x`) + hex.Encode(result[2:], b) + return result, nil +} + +// UnmarshalJSON implements json.Unmarshaler. +func (b *Bytes) UnmarshalJSON(input []byte) error { + if !isString(input) { + return errNonString(bytesT) + } + return wrapTypeError(b.UnmarshalText(input[1:len(input)-1]), bytesT) +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (b *Bytes) UnmarshalText(input []byte) error { + raw, err := checkText(input, true) + if err != nil { + return err + } + dec := make([]byte, len(raw)/2) + if _, err = hex.Decode(dec, raw); err != nil { + err = mapError(err) + } else { + *b = dec + } + return err +} + +// String returns the hex encoding of b. +func (b Bytes) String() string { + return Encode(b) +} + +// ImplementsGraphQLType returns true if Bytes implements the specified GraphQL type. +func (b Bytes) ImplementsGraphQLType(name string) bool { return name == "Bytes" } + +// UnmarshalGraphQL unmarshals the provided GraphQL query data. +func (b *Bytes) UnmarshalGraphQL(input interface{}) error { + var err error + switch input := input.(type) { + case string: + data, err := Decode(input) + if err != nil { + return err + } + *b = data + default: + err = fmt.Errorf("Unexpected type for Bytes: %v", input) + } + return err +} + +// UnmarshalFixedJSON decodes the input as a string with 0x prefix. The length of out +// determines the required input length. This function is commonly used to implement the +// UnmarshalJSON method for fixed-size types. +func UnmarshalFixedJSON(typ reflect.Type, input, out []byte) error { + if !isString(input) { + return errNonString(typ) + } + return wrapTypeError(UnmarshalFixedText(typ.String(), input[1:len(input)-1], out), typ) +} + +// UnmarshalFixedText decodes the input as a string with 0x prefix. The length of out +// determines the required input length. This function is commonly used to implement the +// UnmarshalText method for fixed-size types. +func UnmarshalFixedText(typname string, input, out []byte) error { + raw, err := checkText(input, true) + if err != nil { + return err + } + if len(raw)/2 != len(out) { + return fmt.Errorf("hex string has length %d, want %d for %s", len(raw), len(out)*2, typname) + } + // Pre-verify syntax before modifying out. + for _, b := range raw { + if decodeNibble(b) == badNibble { + return ErrSyntax + } + } + hex.Decode(out, raw) + return nil +} + +// UnmarshalFixedUnprefixedText decodes the input as a string with optional 0x prefix. The +// length of out determines the required input length. This function is commonly used to +// implement the UnmarshalText method for fixed-size types. +func UnmarshalFixedUnprefixedText(typname string, input, out []byte) error { + raw, err := checkText(input, false) + if err != nil { + return err + } + if len(raw)/2 != len(out) { + return fmt.Errorf("hex string has length %d, want %d for %s", len(raw), len(out)*2, typname) + } + // Pre-verify syntax before modifying out. + for _, b := range raw { + if decodeNibble(b) == badNibble { + return ErrSyntax + } + } + hex.Decode(out, raw) + return nil +} + +// Big marshals/unmarshals as a JSON string with 0x prefix. +// The zero value marshals as "0x0". +// +// Negative integers are not supported at this time. Attempting to marshal them will +// return an error. Values larger than 256bits are rejected by Unmarshal but will be +// marshaled without error. +type Big big.Int + +// MarshalText implements encoding.TextMarshaler +func (b Big) MarshalText() ([]byte, error) { + return []byte(EncodeBig((*big.Int)(&b))), nil +} + +// UnmarshalJSON implements json.Unmarshaler. +func (b *Big) UnmarshalJSON(input []byte) error { + if !isString(input) { + return errNonString(bigT) + } + return wrapTypeError(b.UnmarshalText(input[1:len(input)-1]), bigT) +} + +// UnmarshalText implements encoding.TextUnmarshaler +func (b *Big) UnmarshalText(input []byte) error { + raw, err := checkNumberText(input) + if err != nil { + return err + } + if len(raw) > 64 { + return ErrBig256Range + } + words := make([]big.Word, len(raw)/bigWordNibbles+1) + end := len(raw) + for i := range words { + start := end - bigWordNibbles + if start < 0 { + start = 0 + } + for ri := start; ri < end; ri++ { + nib := decodeNibble(raw[ri]) + if nib == badNibble { + return ErrSyntax + } + words[i] *= 16 + words[i] += big.Word(nib) + } + end = start + } + var dec big.Int + dec.SetBits(words) + *b = (Big)(dec) + return nil +} + +// ToInt converts b to a big.Int. +func (b *Big) ToInt() *big.Int { + return (*big.Int)(b) +} + +// String returns the hex encoding of b. +func (b *Big) String() string { + return EncodeBig(b.ToInt()) +} + +// ImplementsGraphQLType returns true if Big implements the provided GraphQL type. +func (b Big) ImplementsGraphQLType(name string) bool { return name == "BigInt" } + +// UnmarshalGraphQL unmarshals the provided GraphQL query data. +func (b *Big) UnmarshalGraphQL(input interface{}) error { + var err error + switch input := input.(type) { + case string: + return b.UnmarshalText([]byte(input)) + case int32: + var num big.Int + num.SetInt64(int64(input)) + *b = Big(num) + default: + err = fmt.Errorf("Unexpected type for BigInt: %v", input) + } + return err +} + +// Uint64 marshals/unmarshals as a JSON string with 0x prefix. +// The zero value marshals as "0x0". +type Uint64 uint64 + +// MarshalText implements encoding.TextMarshaler. +func (b Uint64) MarshalText() ([]byte, error) { + buf := make([]byte, 2, 10) + copy(buf, `0x`) + buf = strconv.AppendUint(buf, uint64(b), 16) + return buf, nil +} + +// UnmarshalJSON implements json.Unmarshaler. +func (b *Uint64) UnmarshalJSON(input []byte) error { + if !isString(input) { + return errNonString(uint64T) + } + return wrapTypeError(b.UnmarshalText(input[1:len(input)-1]), uint64T) +} + +// UnmarshalText implements encoding.TextUnmarshaler +func (b *Uint64) UnmarshalText(input []byte) error { + raw, err := checkNumberText(input) + if err != nil { + return err + } + if len(raw) > 16 { + return ErrUint64Range + } + var dec uint64 + for _, byte := range raw { + nib := decodeNibble(byte) + if nib == badNibble { + return ErrSyntax + } + dec *= 16 + dec += nib + } + *b = Uint64(dec) + return nil +} + +// String returns the hex encoding of b. +func (b Uint64) String() string { + return EncodeUint64(uint64(b)) +} + +// ImplementsGraphQLType returns true if Uint64 implements the provided GraphQL type. +func (b Uint64) ImplementsGraphQLType(name string) bool { return name == "Long" } + +// UnmarshalGraphQL unmarshals the provided GraphQL query data. +func (b *Uint64) UnmarshalGraphQL(input interface{}) error { + var err error + switch input := input.(type) { + case string: + return b.UnmarshalText([]byte(input)) + case int32: + *b = Uint64(input) + default: + err = fmt.Errorf("Unexpected type for Long: %v", input) + } + return err +} + +// Uint marshals/unmarshals as a JSON string with 0x prefix. +// The zero value marshals as "0x0". +type Uint uint + +// MarshalText implements encoding.TextMarshaler. +func (b Uint) MarshalText() ([]byte, error) { + return Uint64(b).MarshalText() +} + +// UnmarshalJSON implements json.Unmarshaler. +func (b *Uint) UnmarshalJSON(input []byte) error { + if !isString(input) { + return errNonString(uintT) + } + return wrapTypeError(b.UnmarshalText(input[1:len(input)-1]), uintT) +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (b *Uint) UnmarshalText(input []byte) error { + var u64 Uint64 + err := u64.UnmarshalText(input) + if u64 > Uint64(^uint(0)) || err == ErrUint64Range { + return ErrUintRange + } else if err != nil { + return err + } + *b = Uint(u64) + return nil +} + +// String returns the hex encoding of b. +func (b Uint) String() string { + return EncodeUint64(uint64(b)) +} + +func isString(input []byte) bool { + return len(input) >= 2 && input[0] == '"' && input[len(input)-1] == '"' +} + +func bytesHave0xPrefix(input []byte) bool { + return len(input) >= 2 && input[0] == '0' && (input[1] == 'x' || input[1] == 'X') +} + +func checkText(input []byte, wantPrefix bool) ([]byte, error) { + if len(input) == 0 { + return nil, nil // empty strings are allowed + } + if bytesHave0xPrefix(input) { + input = input[2:] + } else if wantPrefix { + return nil, ErrMissingPrefix + } + if len(input)%2 != 0 { + return nil, ErrOddLength + } + return input, nil +} + +func checkNumberText(input []byte) (raw []byte, err error) { + if len(input) == 0 { + return nil, nil // empty strings are allowed + } + if !bytesHave0xPrefix(input) { + return nil, ErrMissingPrefix + } + input = input[2:] + if len(input) == 0 { + return nil, ErrEmptyNumber + } + if len(input) > 1 && input[0] == '0' { + return nil, ErrLeadingZero + } + return input, nil +} + +func wrapTypeError(err error, typ reflect.Type) error { + if _, ok := err.(*decError); ok { + return &json.UnmarshalTypeError{Value: err.Error(), Type: typ} + } + return err +} + +func errNonString(typ reflect.Type) error { + return &json.UnmarshalTypeError{Value: "non-string", Type: typ} +} diff --git a/vendor/github.com/ethereum/go-ethereum/common/math/big.go b/vendor/github.com/ethereum/go-ethereum/common/math/big.go new file mode 100644 index 000000000..d31c59af1 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/common/math/big.go @@ -0,0 +1,219 @@ +// Copyright 2017 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum 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 go-ethereum 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 go-ethereum library. If not, see <http://www.gnu.org/licenses/>. + +// Package math provides integer math utilities. +package math + +import ( + "fmt" + "math/big" +) + +// Various big integer limit values. +var ( + tt255 = BigPow(2, 255) + tt256 = BigPow(2, 256) + tt256m1 = new(big.Int).Sub(tt256, big.NewInt(1)) + tt63 = BigPow(2, 63) + MaxBig256 = new(big.Int).Set(tt256m1) + MaxBig63 = new(big.Int).Sub(tt63, big.NewInt(1)) +) + +const ( + // number of bits in a big.Word + wordBits = 32 << (uint64(^big.Word(0)) >> 63) + // number of bytes in a big.Word + wordBytes = wordBits / 8 +) + +// HexOrDecimal256 marshals big.Int as hex or decimal. +type HexOrDecimal256 big.Int + +// NewHexOrDecimal256 creates a new HexOrDecimal256 +func NewHexOrDecimal256(x int64) *HexOrDecimal256 { + b := big.NewInt(x) + h := HexOrDecimal256(*b) + return &h +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (i *HexOrDecimal256) UnmarshalText(input []byte) error { + bigint, ok := ParseBig256(string(input)) + if !ok { + return fmt.Errorf("invalid hex or decimal integer %q", input) + } + *i = HexOrDecimal256(*bigint) + return nil +} + +// MarshalText implements encoding.TextMarshaler. +func (i *HexOrDecimal256) MarshalText() ([]byte, error) { + if i == nil { + return []byte("0x0"), nil + } + return []byte(fmt.Sprintf("%#x", (*big.Int)(i))), nil +} + +// ParseBig256 parses s as a 256 bit integer in decimal or hexadecimal syntax. +// Leading zeros are accepted. The empty string parses as zero. +func ParseBig256(s string) (*big.Int, bool) { + if s == "" { + return new(big.Int), true + } + var bigint *big.Int + var ok bool + if len(s) >= 2 && (s[:2] == "0x" || s[:2] == "0X") { + bigint, ok = new(big.Int).SetString(s[2:], 16) + } else { + bigint, ok = new(big.Int).SetString(s, 10) + } + if ok && bigint.BitLen() > 256 { + bigint, ok = nil, false + } + return bigint, ok +} + +// MustParseBig256 parses s as a 256 bit big integer and panics if the string is invalid. +func MustParseBig256(s string) *big.Int { + v, ok := ParseBig256(s) + if !ok { + panic("invalid 256 bit integer: " + s) + } + return v +} + +// BigPow returns a ** b as a big integer. +func BigPow(a, b int64) *big.Int { + r := big.NewInt(a) + return r.Exp(r, big.NewInt(b), nil) +} + +// BigMax returns the larger of x or y. +func BigMax(x, y *big.Int) *big.Int { + if x.Cmp(y) < 0 { + return y + } + return x +} + +// BigMin returns the smaller of x or y. +func BigMin(x, y *big.Int) *big.Int { + if x.Cmp(y) > 0 { + return y + } + return x +} + +// FirstBitSet returns the index of the first 1 bit in v, counting from LSB. +func FirstBitSet(v *big.Int) int { + for i := 0; i < v.BitLen(); i++ { + if v.Bit(i) > 0 { + return i + } + } + return v.BitLen() +} + +// PaddedBigBytes encodes a big integer as a big-endian byte slice. The length +// of the slice is at least n bytes. +func PaddedBigBytes(bigint *big.Int, n int) []byte { + if bigint.BitLen()/8 >= n { + return bigint.Bytes() + } + ret := make([]byte, n) + ReadBits(bigint, ret) + return ret +} + +// bigEndianByteAt returns the byte at position n, +// in Big-Endian encoding +// So n==0 returns the least significant byte +func bigEndianByteAt(bigint *big.Int, n int) byte { + words := bigint.Bits() + // Check word-bucket the byte will reside in + i := n / wordBytes + if i >= len(words) { + return byte(0) + } + word := words[i] + // Offset of the byte + shift := 8 * uint(n%wordBytes) + + return byte(word >> shift) +} + +// Byte returns the byte at position n, +// with the supplied padlength in Little-Endian encoding. +// n==0 returns the MSB +// Example: bigint '5', padlength 32, n=31 => 5 +func Byte(bigint *big.Int, padlength, n int) byte { + if n >= padlength { + return byte(0) + } + return bigEndianByteAt(bigint, padlength-1-n) +} + +// ReadBits encodes the absolute value of bigint as big-endian bytes. Callers must ensure +// that buf has enough space. If buf is too short the result will be incomplete. +func ReadBits(bigint *big.Int, buf []byte) { + i := len(buf) + for _, d := range bigint.Bits() { + for j := 0; j < wordBytes && i > 0; j++ { + i-- + buf[i] = byte(d) + d >>= 8 + } + } +} + +// U256 encodes as a 256 bit two's complement number. This operation is destructive. +func U256(x *big.Int) *big.Int { + return x.And(x, tt256m1) +} + +// S256 interprets x as a two's complement number. +// x must not exceed 256 bits (the result is undefined if it does) and is not modified. +// +// S256(0) = 0 +// S256(1) = 1 +// S256(2**255) = -2**255 +// S256(2**256-1) = -1 +func S256(x *big.Int) *big.Int { + if x.Cmp(tt255) < 0 { + return x + } + return new(big.Int).Sub(x, tt256) +} + +// Exp implements exponentiation by squaring. +// Exp returns a newly-allocated big integer and does not change +// base or exponent. The result is truncated to 256 bits. +// +// Courtesy @karalabe and @chfast +func Exp(base, exponent *big.Int) *big.Int { + result := big.NewInt(1) + + for _, word := range exponent.Bits() { + for i := 0; i < wordBits; i++ { + if word&1 == 1 { + U256(result.Mul(result, base)) + } + U256(base.Mul(base, base)) + word >>= 1 + } + } + return result +} diff --git a/vendor/github.com/ethereum/go-ethereum/common/math/integer.go b/vendor/github.com/ethereum/go-ethereum/common/math/integer.go new file mode 100644 index 000000000..93b1d036d --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/common/math/integer.go @@ -0,0 +1,99 @@ +// Copyright 2017 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum 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 go-ethereum 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 go-ethereum library. If not, see <http://www.gnu.org/licenses/>. + +package math + +import ( + "fmt" + "strconv" +) + +// Integer limit values. +const ( + MaxInt8 = 1<<7 - 1 + MinInt8 = -1 << 7 + MaxInt16 = 1<<15 - 1 + MinInt16 = -1 << 15 + MaxInt32 = 1<<31 - 1 + MinInt32 = -1 << 31 + MaxInt64 = 1<<63 - 1 + MinInt64 = -1 << 63 + MaxUint8 = 1<<8 - 1 + MaxUint16 = 1<<16 - 1 + MaxUint32 = 1<<32 - 1 + MaxUint64 = 1<<64 - 1 +) + +// HexOrDecimal64 marshals uint64 as hex or decimal. +type HexOrDecimal64 uint64 + +// UnmarshalText implements encoding.TextUnmarshaler. +func (i *HexOrDecimal64) UnmarshalText(input []byte) error { + int, ok := ParseUint64(string(input)) + if !ok { + return fmt.Errorf("invalid hex or decimal integer %q", input) + } + *i = HexOrDecimal64(int) + return nil +} + +// MarshalText implements encoding.TextMarshaler. +func (i HexOrDecimal64) MarshalText() ([]byte, error) { + return []byte(fmt.Sprintf("%#x", uint64(i))), nil +} + +// ParseUint64 parses s as an integer in decimal or hexadecimal syntax. +// Leading zeros are accepted. The empty string parses as zero. +func ParseUint64(s string) (uint64, bool) { + if s == "" { + return 0, true + } + if len(s) >= 2 && (s[:2] == "0x" || s[:2] == "0X") { + v, err := strconv.ParseUint(s[2:], 16, 64) + return v, err == nil + } + v, err := strconv.ParseUint(s, 10, 64) + return v, err == nil +} + +// MustParseUint64 parses s as an integer and panics if the string is invalid. +func MustParseUint64(s string) uint64 { + v, ok := ParseUint64(s) + if !ok { + panic("invalid unsigned 64 bit integer: " + s) + } + return v +} + +// NOTE: The following methods need to be optimised using either bit checking or asm + +// SafeSub returns subtraction result and whether overflow occurred. +func SafeSub(x, y uint64) (uint64, bool) { + return x - y, x < y +} + +// SafeAdd returns the result and whether overflow occurred. +func SafeAdd(x, y uint64) (uint64, bool) { + return x + y, y > MaxUint64-x +} + +// SafeMul returns multiplication result and whether overflow occurred. +func SafeMul(x, y uint64) (uint64, bool) { + if x == 0 || y == 0 { + return 0, false + } + return x * y, y > MaxUint64/x +} diff --git a/vendor/github.com/ethereum/go-ethereum/common/path.go b/vendor/github.com/ethereum/go-ethereum/common/path.go new file mode 100644 index 000000000..69820cfe5 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/common/path.go @@ -0,0 +1,49 @@ +// Copyright 2014 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum 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 go-ethereum 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 go-ethereum library. If not, see <http://www.gnu.org/licenses/>. + +package common + +import ( + "fmt" + "os" + "path/filepath" + "runtime" +) + +// MakeName creates a node name that follows the ethereum convention +// for such names. It adds the operation system name and Go runtime version +// the name. +func MakeName(name, version string) string { + return fmt.Sprintf("%s/v%s/%s/%s", name, version, runtime.GOOS, runtime.Version()) +} + +// FileExist checks if a file exists at filePath. +func FileExist(filePath string) bool { + _, err := os.Stat(filePath) + if err != nil && os.IsNotExist(err) { + return false + } + + return true +} + +// AbsolutePath returns datadir + filename, or filename if it is absolute. +func AbsolutePath(datadir string, filename string) string { + if filepath.IsAbs(filename) { + return filename + } + return filepath.Join(datadir, filename) +} diff --git a/vendor/github.com/ethereum/go-ethereum/common/size.go b/vendor/github.com/ethereum/go-ethereum/common/size.go new file mode 100644 index 000000000..097b6304a --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/common/size.go @@ -0,0 +1,56 @@ +// Copyright 2014 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum 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 go-ethereum 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 go-ethereum library. If not, see <http://www.gnu.org/licenses/>. + +package common + +import ( + "fmt" +) + +// StorageSize is a wrapper around a float value that supports user friendly +// formatting. +type StorageSize float64 + +// String implements the stringer interface. +func (s StorageSize) String() string { + if s > 1099511627776 { + return fmt.Sprintf("%.2f TiB", s/1099511627776) + } else if s > 1073741824 { + return fmt.Sprintf("%.2f GiB", s/1073741824) + } else if s > 1048576 { + return fmt.Sprintf("%.2f MiB", s/1048576) + } else if s > 1024 { + return fmt.Sprintf("%.2f KiB", s/1024) + } else { + return fmt.Sprintf("%.2f B", s) + } +} + +// TerminalString implements log.TerminalStringer, formatting a string for console +// output during logging. +func (s StorageSize) TerminalString() string { + if s > 1099511627776 { + return fmt.Sprintf("%.2fTiB", s/1099511627776) + } else if s > 1073741824 { + return fmt.Sprintf("%.2fGiB", s/1073741824) + } else if s > 1048576 { + return fmt.Sprintf("%.2fMiB", s/1048576) + } else if s > 1024 { + return fmt.Sprintf("%.2fKiB", s/1024) + } else { + return fmt.Sprintf("%.2fB", s) + } +} diff --git a/vendor/github.com/ethereum/go-ethereum/common/test_utils.go b/vendor/github.com/ethereum/go-ethereum/common/test_utils.go new file mode 100644 index 000000000..a848642f7 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/common/test_utils.go @@ -0,0 +1,53 @@ +// Copyright 2015 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum 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 go-ethereum 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 go-ethereum library. If not, see <http://www.gnu.org/licenses/>. + +package common + +import ( + "encoding/json" + "fmt" + "io/ioutil" +) + +// LoadJSON reads the given file and unmarshals its content. +func LoadJSON(file string, val interface{}) error { + content, err := ioutil.ReadFile(file) + if err != nil { + return err + } + if err := json.Unmarshal(content, val); err != nil { + if syntaxerr, ok := err.(*json.SyntaxError); ok { + line := findLine(content, syntaxerr.Offset) + return fmt.Errorf("JSON syntax error at %v:%v: %v", file, line, err) + } + return fmt.Errorf("JSON unmarshal error in %v: %v", file, err) + } + return nil +} + +// findLine returns the line number for the given offset into data. +func findLine(data []byte, offset int64) (line int) { + line = 1 + for i, r := range string(data) { + if int64(i) >= offset { + return + } + if r == '\n' { + line++ + } + } + return +} diff --git a/vendor/github.com/ethereum/go-ethereum/common/types.go b/vendor/github.com/ethereum/go-ethereum/common/types.go new file mode 100644 index 000000000..98c83edd4 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/common/types.go @@ -0,0 +1,369 @@ +// Copyright 2015 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum 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 go-ethereum 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 go-ethereum library. If not, see <http://www.gnu.org/licenses/>. + +package common + +import ( + "database/sql/driver" + "encoding/hex" + "encoding/json" + "fmt" + "math/big" + "math/rand" + "reflect" + "strings" + + "github.com/ethereum/go-ethereum/common/hexutil" + "golang.org/x/crypto/sha3" +) + +// Lengths of hashes and addresses in bytes. +const ( + // HashLength is the expected length of the hash + HashLength = 32 + // AddressLength is the expected length of the address + AddressLength = 20 +) + +var ( + hashT = reflect.TypeOf(Hash{}) + addressT = reflect.TypeOf(Address{}) +) + +// Hash represents the 32 byte Keccak256 hash of arbitrary data. +type Hash [HashLength]byte + +// BytesToHash sets b to hash. +// If b is larger than len(h), b will be cropped from the left. +func BytesToHash(b []byte) Hash { + var h Hash + h.SetBytes(b) + return h +} + +// BigToHash sets byte representation of b to hash. +// If b is larger than len(h), b will be cropped from the left. +func BigToHash(b *big.Int) Hash { return BytesToHash(b.Bytes()) } + +// HexToHash sets byte representation of s to hash. +// If b is larger than len(h), b will be cropped from the left. +func HexToHash(s string) Hash { return BytesToHash(FromHex(s)) } + +// Bytes gets the byte representation of the underlying hash. +func (h Hash) Bytes() []byte { return h[:] } + +// Big converts a hash to a big integer. +func (h Hash) Big() *big.Int { return new(big.Int).SetBytes(h[:]) } + +// Hex converts a hash to a hex string. +func (h Hash) Hex() string { return hexutil.Encode(h[:]) } + +// TerminalString implements log.TerminalStringer, formatting a string for console +// output during logging. +func (h Hash) TerminalString() string { + return fmt.Sprintf("%x…%x", h[:3], h[29:]) +} + +// String implements the stringer interface and is used also by the logger when +// doing full logging into a file. +func (h Hash) String() string { + return h.Hex() +} + +// Format implements fmt.Formatter, forcing the byte slice to be formatted as is, +// without going through the stringer interface used for logging. +func (h Hash) Format(s fmt.State, c rune) { + fmt.Fprintf(s, "%"+string(c), h[:]) +} + +// UnmarshalText parses a hash in hex syntax. +func (h *Hash) UnmarshalText(input []byte) error { + return hexutil.UnmarshalFixedText("Hash", input, h[:]) +} + +// UnmarshalJSON parses a hash in hex syntax. +func (h *Hash) UnmarshalJSON(input []byte) error { + return hexutil.UnmarshalFixedJSON(hashT, input, h[:]) +} + +// MarshalText returns the hex representation of h. +func (h Hash) MarshalText() ([]byte, error) { + return hexutil.Bytes(h[:]).MarshalText() +} + +// SetBytes sets the hash to the value of b. +// If b is larger than len(h), b will be cropped from the left. +func (h *Hash) SetBytes(b []byte) { + if len(b) > len(h) { + b = b[len(b)-HashLength:] + } + + copy(h[HashLength-len(b):], b) +} + +// Generate implements testing/quick.Generator. +func (h Hash) Generate(rand *rand.Rand, size int) reflect.Value { + m := rand.Intn(len(h)) + for i := len(h) - 1; i > m; i-- { + h[i] = byte(rand.Uint32()) + } + return reflect.ValueOf(h) +} + +// Scan implements Scanner for database/sql. +func (h *Hash) Scan(src interface{}) error { + srcB, ok := src.([]byte) + if !ok { + return fmt.Errorf("can't scan %T into Hash", src) + } + if len(srcB) != HashLength { + return fmt.Errorf("can't scan []byte of len %d into Hash, want %d", len(srcB), HashLength) + } + copy(h[:], srcB) + return nil +} + +// Value implements valuer for database/sql. +func (h Hash) Value() (driver.Value, error) { + return h[:], nil +} + +// ImplementsGraphQLType returns true if Hash implements the specified GraphQL type. +func (_ Hash) ImplementsGraphQLType(name string) bool { return name == "Bytes32" } + +// UnmarshalGraphQL unmarshals the provided GraphQL query data. +func (h *Hash) UnmarshalGraphQL(input interface{}) error { + var err error + switch input := input.(type) { + case string: + *h = HexToHash(input) + default: + err = fmt.Errorf("Unexpected type for Bytes32: %v", input) + } + return err +} + +// UnprefixedHash allows marshaling a Hash without 0x prefix. +type UnprefixedHash Hash + +// UnmarshalText decodes the hash from hex. The 0x prefix is optional. +func (h *UnprefixedHash) UnmarshalText(input []byte) error { + return hexutil.UnmarshalFixedUnprefixedText("UnprefixedHash", input, h[:]) +} + +// MarshalText encodes the hash as hex. +func (h UnprefixedHash) MarshalText() ([]byte, error) { + return []byte(hex.EncodeToString(h[:])), nil +} + +/////////// Address + +// Address represents the 20 byte address of an Ethereum account. +type Address [AddressLength]byte + +// BytesToAddress returns Address with value b. +// If b is larger than len(h), b will be cropped from the left. +func BytesToAddress(b []byte) Address { + var a Address + a.SetBytes(b) + return a +} + +// BigToAddress returns Address with byte values of b. +// If b is larger than len(h), b will be cropped from the left. +func BigToAddress(b *big.Int) Address { return BytesToAddress(b.Bytes()) } + +// HexToAddress returns Address with byte values of s. +// If s is larger than len(h), s will be cropped from the left. +func HexToAddress(s string) Address { return BytesToAddress(FromHex(s)) } + +// IsHexAddress verifies whether a string can represent a valid hex-encoded +// Ethereum address or not. +func IsHexAddress(s string) bool { + if hasHexPrefix(s) { + s = s[2:] + } + return len(s) == 2*AddressLength && isHex(s) +} + +// Bytes gets the string representation of the underlying address. +func (a Address) Bytes() []byte { return a[:] } + +// Hash converts an address to a hash by left-padding it with zeros. +func (a Address) Hash() Hash { return BytesToHash(a[:]) } + +// Hex returns an EIP55-compliant hex string representation of the address. +func (a Address) Hex() string { + unchecksummed := hex.EncodeToString(a[:]) + sha := sha3.NewLegacyKeccak256() + sha.Write([]byte(unchecksummed)) + hash := sha.Sum(nil) + + result := []byte(unchecksummed) + for i := 0; i < len(result); i++ { + hashByte := hash[i/2] + if i%2 == 0 { + hashByte = hashByte >> 4 + } else { + hashByte &= 0xf + } + if result[i] > '9' && hashByte > 7 { + result[i] -= 32 + } + } + return "0x" + string(result) +} + +// String implements fmt.Stringer. +func (a Address) String() string { + return a.Hex() +} + +// Format implements fmt.Formatter, forcing the byte slice to be formatted as is, +// without going through the stringer interface used for logging. +func (a Address) Format(s fmt.State, c rune) { + fmt.Fprintf(s, "%"+string(c), a[:]) +} + +// SetBytes sets the address to the value of b. +// If b is larger than len(a) it will panic. +func (a *Address) SetBytes(b []byte) { + if len(b) > len(a) { + b = b[len(b)-AddressLength:] + } + copy(a[AddressLength-len(b):], b) +} + +// MarshalText returns the hex representation of a. +func (a Address) MarshalText() ([]byte, error) { + return hexutil.Bytes(a[:]).MarshalText() +} + +// UnmarshalText parses a hash in hex syntax. +func (a *Address) UnmarshalText(input []byte) error { + return hexutil.UnmarshalFixedText("Address", input, a[:]) +} + +// UnmarshalJSON parses a hash in hex syntax. +func (a *Address) UnmarshalJSON(input []byte) error { + return hexutil.UnmarshalFixedJSON(addressT, input, a[:]) +} + +// Scan implements Scanner for database/sql. +func (a *Address) Scan(src interface{}) error { + srcB, ok := src.([]byte) + if !ok { + return fmt.Errorf("can't scan %T into Address", src) + } + if len(srcB) != AddressLength { + return fmt.Errorf("can't scan []byte of len %d into Address, want %d", len(srcB), AddressLength) + } + copy(a[:], srcB) + return nil +} + +// Value implements valuer for database/sql. +func (a Address) Value() (driver.Value, error) { + return a[:], nil +} + +// ImplementsGraphQLType returns true if Hash implements the specified GraphQL type. +func (a Address) ImplementsGraphQLType(name string) bool { return name == "Address" } + +// UnmarshalGraphQL unmarshals the provided GraphQL query data. +func (a *Address) UnmarshalGraphQL(input interface{}) error { + var err error + switch input := input.(type) { + case string: + *a = HexToAddress(input) + default: + err = fmt.Errorf("Unexpected type for Address: %v", input) + } + return err +} + +// UnprefixedAddress allows marshaling an Address without 0x prefix. +type UnprefixedAddress Address + +// UnmarshalText decodes the address from hex. The 0x prefix is optional. +func (a *UnprefixedAddress) UnmarshalText(input []byte) error { + return hexutil.UnmarshalFixedUnprefixedText("UnprefixedAddress", input, a[:]) +} + +// MarshalText encodes the address as hex. +func (a UnprefixedAddress) MarshalText() ([]byte, error) { + return []byte(hex.EncodeToString(a[:])), nil +} + +// MixedcaseAddress retains the original string, which may or may not be +// correctly checksummed +type MixedcaseAddress struct { + addr Address + original string +} + +// NewMixedcaseAddress constructor (mainly for testing) +func NewMixedcaseAddress(addr Address) MixedcaseAddress { + return MixedcaseAddress{addr: addr, original: addr.Hex()} +} + +// NewMixedcaseAddressFromString is mainly meant for unit-testing +func NewMixedcaseAddressFromString(hexaddr string) (*MixedcaseAddress, error) { + if !IsHexAddress(hexaddr) { + return nil, fmt.Errorf("Invalid address") + } + a := FromHex(hexaddr) + return &MixedcaseAddress{addr: BytesToAddress(a), original: hexaddr}, nil +} + +// UnmarshalJSON parses MixedcaseAddress +func (ma *MixedcaseAddress) UnmarshalJSON(input []byte) error { + if err := hexutil.UnmarshalFixedJSON(addressT, input, ma.addr[:]); err != nil { + return err + } + return json.Unmarshal(input, &ma.original) +} + +// MarshalJSON marshals the original value +func (ma *MixedcaseAddress) MarshalJSON() ([]byte, error) { + if strings.HasPrefix(ma.original, "0x") || strings.HasPrefix(ma.original, "0X") { + return json.Marshal(fmt.Sprintf("0x%s", ma.original[2:])) + } + return json.Marshal(fmt.Sprintf("0x%s", ma.original)) +} + +// Address returns the address +func (ma *MixedcaseAddress) Address() Address { + return ma.addr +} + +// String implements fmt.Stringer +func (ma *MixedcaseAddress) String() string { + if ma.ValidChecksum() { + return fmt.Sprintf("%s [chksum ok]", ma.original) + } + return fmt.Sprintf("%s [chksum INVALID]", ma.original) +} + +// ValidChecksum returns true if the address has valid checksum +func (ma *MixedcaseAddress) ValidChecksum() bool { + return ma.original == ma.addr.Hex() +} + +// Original returns the mixed-case input string +func (ma *MixedcaseAddress) Original() string { + return ma.original +} diff --git a/vendor/github.com/ethereum/go-ethereum/rlp/decode.go b/vendor/github.com/ethereum/go-ethereum/rlp/decode.go new file mode 100644 index 000000000..4f29f2fb0 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/rlp/decode.go @@ -0,0 +1,1049 @@ +// Copyright 2014 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum 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 go-ethereum 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 go-ethereum library. If not, see <http://www.gnu.org/licenses/>. + +package rlp + +import ( + "bufio" + "bytes" + "encoding/binary" + "errors" + "fmt" + "io" + "math/big" + "reflect" + "strings" + "sync" +) + +var ( + // EOL is returned when the end of the current list + // has been reached during streaming. + EOL = errors.New("rlp: end of list") + + // Actual Errors + ErrExpectedString = errors.New("rlp: expected String or Byte") + ErrExpectedList = errors.New("rlp: expected List") + ErrCanonInt = errors.New("rlp: non-canonical integer format") + ErrCanonSize = errors.New("rlp: non-canonical size information") + ErrElemTooLarge = errors.New("rlp: element is larger than containing list") + ErrValueTooLarge = errors.New("rlp: value size exceeds available input length") + ErrMoreThanOneValue = errors.New("rlp: input contains more than one value") + + // internal errors + errNotInList = errors.New("rlp: call of ListEnd outside of any list") + errNotAtEOL = errors.New("rlp: call of ListEnd not positioned at EOL") + errUintOverflow = errors.New("rlp: uint overflow") + errNoPointer = errors.New("rlp: interface given to Decode must be a pointer") + errDecodeIntoNil = errors.New("rlp: pointer given to Decode must not be nil") + + streamPool = sync.Pool{ + New: func() interface{} { return new(Stream) }, + } +) + +// Decoder is implemented by types that require custom RLP +// decoding rules or need to decode into private fields. +// +// The DecodeRLP method should read one value from the given +// Stream. It is not forbidden to read less or more, but it might +// be confusing. +type Decoder interface { + DecodeRLP(*Stream) error +} + +// Decode parses RLP-encoded data from r and stores the result in the +// value pointed to by val. Val must be a non-nil pointer. If r does +// not implement ByteReader, Decode will do its own buffering. +// +// Decode uses the following type-dependent decoding rules: +// +// If the type implements the Decoder interface, decode calls +// DecodeRLP. +// +// To decode into a pointer, Decode will decode into the value pointed +// to. If the pointer is nil, a new value of the pointer's element +// type is allocated. If the pointer is non-nil, the existing value +// will be reused. +// +// To decode into a struct, Decode expects the input to be an RLP +// list. The decoded elements of the list are assigned to each public +// field in the order given by the struct's definition. The input list +// must contain an element for each decoded field. Decode returns an +// error if there are too few or too many elements. +// +// The decoding of struct fields honours certain struct tags, "tail", +// "nil" and "-". +// +// The "-" tag ignores fields. +// +// For an explanation of "tail", see the example. +// +// The "nil" tag applies to pointer-typed fields and changes the decoding +// rules for the field such that input values of size zero decode as a nil +// pointer. This tag can be useful when decoding recursive types. +// +// type StructWithEmptyOK struct { +// Foo *[20]byte `rlp:"nil"` +// } +// +// To decode into a slice, the input must be a list and the resulting +// slice will contain the input elements in order. For byte slices, +// the input must be an RLP string. Array types decode similarly, with +// the additional restriction that the number of input elements (or +// bytes) must match the array's length. +// +// To decode into a Go string, the input must be an RLP string. The +// input bytes are taken as-is and will not necessarily be valid UTF-8. +// +// To decode into an unsigned integer type, the input must also be an RLP +// string. The bytes are interpreted as a big endian representation of +// the integer. If the RLP string is larger than the bit size of the +// type, Decode will return an error. Decode also supports *big.Int. +// There is no size limit for big integers. +// +// To decode into a boolean, the input must contain an unsigned integer +// of value zero (false) or one (true). +// +// To decode into an interface value, Decode stores one of these +// in the value: +// +// []interface{}, for RLP lists +// []byte, for RLP strings +// +// Non-empty interface types are not supported, nor are signed integers, +// floating point numbers, maps, channels and functions. +// +// Note that Decode does not set an input limit for all readers +// and may be vulnerable to panics cause by huge value sizes. If +// you need an input limit, use +// +// NewStream(r, limit).Decode(val) +func Decode(r io.Reader, val interface{}) error { + stream := streamPool.Get().(*Stream) + defer streamPool.Put(stream) + + stream.Reset(r, 0) + return stream.Decode(val) +} + +// DecodeBytes parses RLP data from b into val. +// Please see the documentation of Decode for the decoding rules. +// The input must contain exactly one value and no trailing data. +func DecodeBytes(b []byte, val interface{}) error { + r := bytes.NewReader(b) + + stream := streamPool.Get().(*Stream) + defer streamPool.Put(stream) + + stream.Reset(r, uint64(len(b))) + if err := stream.Decode(val); err != nil { + return err + } + if r.Len() > 0 { + return ErrMoreThanOneValue + } + return nil +} + +type decodeError struct { + msg string + typ reflect.Type + ctx []string +} + +func (err *decodeError) Error() string { + ctx := "" + if len(err.ctx) > 0 { + ctx = ", decoding into " + for i := len(err.ctx) - 1; i >= 0; i-- { + ctx += err.ctx[i] + } + } + return fmt.Sprintf("rlp: %s for %v%s", err.msg, err.typ, ctx) +} + +func wrapStreamError(err error, typ reflect.Type) error { + switch err { + case ErrCanonInt: + return &decodeError{msg: "non-canonical integer (leading zero bytes)", typ: typ} + case ErrCanonSize: + return &decodeError{msg: "non-canonical size information", typ: typ} + case ErrExpectedList: + return &decodeError{msg: "expected input list", typ: typ} + case ErrExpectedString: + return &decodeError{msg: "expected input string or byte", typ: typ} + case errUintOverflow: + return &decodeError{msg: "input string too long", typ: typ} + case errNotAtEOL: + return &decodeError{msg: "input list has too many elements", typ: typ} + } + return err +} + +func addErrorContext(err error, ctx string) error { + if decErr, ok := err.(*decodeError); ok { + decErr.ctx = append(decErr.ctx, ctx) + } + return err +} + +var ( + decoderInterface = reflect.TypeOf(new(Decoder)).Elem() + bigInt = reflect.TypeOf(big.Int{}) +) + +func makeDecoder(typ reflect.Type, tags tags) (dec decoder, err error) { + kind := typ.Kind() + switch { + case typ == rawValueType: + return decodeRawValue, nil + case typ.Implements(decoderInterface): + return decodeDecoder, nil + case kind != reflect.Ptr && reflect.PtrTo(typ).Implements(decoderInterface): + return decodeDecoderNoPtr, nil + case typ.AssignableTo(reflect.PtrTo(bigInt)): + return decodeBigInt, nil + case typ.AssignableTo(bigInt): + return decodeBigIntNoPtr, nil + case isUint(kind): + return decodeUint, nil + case kind == reflect.Bool: + return decodeBool, nil + case kind == reflect.String: + return decodeString, nil + case kind == reflect.Slice || kind == reflect.Array: + return makeListDecoder(typ, tags) + case kind == reflect.Struct: + return makeStructDecoder(typ) + case kind == reflect.Ptr: + if tags.nilOK { + return makeOptionalPtrDecoder(typ) + } + return makePtrDecoder(typ) + case kind == reflect.Interface: + return decodeInterface, nil + default: + return nil, fmt.Errorf("rlp: type %v is not RLP-serializable", typ) + } +} + +func decodeRawValue(s *Stream, val reflect.Value) error { + r, err := s.Raw() + if err != nil { + return err + } + val.SetBytes(r) + return nil +} + +func decodeUint(s *Stream, val reflect.Value) error { + typ := val.Type() + num, err := s.uint(typ.Bits()) + if err != nil { + return wrapStreamError(err, val.Type()) + } + val.SetUint(num) + return nil +} + +func decodeBool(s *Stream, val reflect.Value) error { + b, err := s.Bool() + if err != nil { + return wrapStreamError(err, val.Type()) + } + val.SetBool(b) + return nil +} + +func decodeString(s *Stream, val reflect.Value) error { + b, err := s.Bytes() + if err != nil { + return wrapStreamError(err, val.Type()) + } + val.SetString(string(b)) + return nil +} + +func decodeBigIntNoPtr(s *Stream, val reflect.Value) error { + return decodeBigInt(s, val.Addr()) +} + +func decodeBigInt(s *Stream, val reflect.Value) error { + b, err := s.Bytes() + if err != nil { + return wrapStreamError(err, val.Type()) + } + i := val.Interface().(*big.Int) + if i == nil { + i = new(big.Int) + val.Set(reflect.ValueOf(i)) + } + // Reject leading zero bytes + if len(b) > 0 && b[0] == 0 { + return wrapStreamError(ErrCanonInt, val.Type()) + } + i.SetBytes(b) + return nil +} + +func makeListDecoder(typ reflect.Type, tag tags) (decoder, error) { + etype := typ.Elem() + if etype.Kind() == reflect.Uint8 && !reflect.PtrTo(etype).Implements(decoderInterface) { + if typ.Kind() == reflect.Array { + return decodeByteArray, nil + } + return decodeByteSlice, nil + } + etypeinfo := cachedTypeInfo1(etype, tags{}) + if etypeinfo.decoderErr != nil { + return nil, etypeinfo.decoderErr + } + var dec decoder + switch { + case typ.Kind() == reflect.Array: + dec = func(s *Stream, val reflect.Value) error { + return decodeListArray(s, val, etypeinfo.decoder) + } + case tag.tail: + // A slice with "tail" tag can occur as the last field + // of a struct and is supposed to swallow all remaining + // list elements. The struct decoder already called s.List, + // proceed directly to decoding the elements. + dec = func(s *Stream, val reflect.Value) error { + return decodeSliceElems(s, val, etypeinfo.decoder) + } + default: + dec = func(s *Stream, val reflect.Value) error { + return decodeListSlice(s, val, etypeinfo.decoder) + } + } + return dec, nil +} + +func decodeListSlice(s *Stream, val reflect.Value, elemdec decoder) error { + size, err := s.List() + if err != nil { + return wrapStreamError(err, val.Type()) + } + if size == 0 { + val.Set(reflect.MakeSlice(val.Type(), 0, 0)) + return s.ListEnd() + } + if err := decodeSliceElems(s, val, elemdec); err != nil { + return err + } + return s.ListEnd() +} + +func decodeSliceElems(s *Stream, val reflect.Value, elemdec decoder) error { + i := 0 + for ; ; i++ { + // grow slice if necessary + if i >= val.Cap() { + newcap := val.Cap() + val.Cap()/2 + if newcap < 4 { + newcap = 4 + } + newv := reflect.MakeSlice(val.Type(), val.Len(), newcap) + reflect.Copy(newv, val) + val.Set(newv) + } + if i >= val.Len() { + val.SetLen(i + 1) + } + // decode into element + if err := elemdec(s, val.Index(i)); err == EOL { + break + } else if err != nil { + return addErrorContext(err, fmt.Sprint("[", i, "]")) + } + } + if i < val.Len() { + val.SetLen(i) + } + return nil +} + +func decodeListArray(s *Stream, val reflect.Value, elemdec decoder) error { + if _, err := s.List(); err != nil { + return wrapStreamError(err, val.Type()) + } + vlen := val.Len() + i := 0 + for ; i < vlen; i++ { + if err := elemdec(s, val.Index(i)); err == EOL { + break + } else if err != nil { + return addErrorContext(err, fmt.Sprint("[", i, "]")) + } + } + if i < vlen { + return &decodeError{msg: "input list has too few elements", typ: val.Type()} + } + return wrapStreamError(s.ListEnd(), val.Type()) +} + +func decodeByteSlice(s *Stream, val reflect.Value) error { + b, err := s.Bytes() + if err != nil { + return wrapStreamError(err, val.Type()) + } + val.SetBytes(b) + return nil +} + +func decodeByteArray(s *Stream, val reflect.Value) error { + kind, size, err := s.Kind() + if err != nil { + return err + } + vlen := val.Len() + switch kind { + case Byte: + if vlen == 0 { + return &decodeError{msg: "input string too long", typ: val.Type()} + } + if vlen > 1 { + return &decodeError{msg: "input string too short", typ: val.Type()} + } + bv, _ := s.Uint() + val.Index(0).SetUint(bv) + case String: + if uint64(vlen) < size { + return &decodeError{msg: "input string too long", typ: val.Type()} + } + if uint64(vlen) > size { + return &decodeError{msg: "input string too short", typ: val.Type()} + } + slice := val.Slice(0, vlen).Interface().([]byte) + if err := s.readFull(slice); err != nil { + return err + } + // Reject cases where single byte encoding should have been used. + if size == 1 && slice[0] < 128 { + return wrapStreamError(ErrCanonSize, val.Type()) + } + case List: + return wrapStreamError(ErrExpectedString, val.Type()) + } + return nil +} + +func makeStructDecoder(typ reflect.Type) (decoder, error) { + fields, err := structFields(typ) + if err != nil { + return nil, err + } + dec := func(s *Stream, val reflect.Value) (err error) { + if _, err := s.List(); err != nil { + return wrapStreamError(err, typ) + } + for _, f := range fields { + err := f.info.decoder(s, val.Field(f.index)) + if err == EOL { + return &decodeError{msg: "too few elements", typ: typ} + } else if err != nil { + return addErrorContext(err, "."+typ.Field(f.index).Name) + } + } + return wrapStreamError(s.ListEnd(), typ) + } + return dec, nil +} + +// makePtrDecoder creates a decoder that decodes into +// the pointer's element type. +func makePtrDecoder(typ reflect.Type) (decoder, error) { + etype := typ.Elem() + etypeinfo := cachedTypeInfo1(etype, tags{}) + if etypeinfo.decoderErr != nil { + return nil, etypeinfo.decoderErr + } + dec := func(s *Stream, val reflect.Value) (err error) { + newval := val + if val.IsNil() { + newval = reflect.New(etype) + } + if err = etypeinfo.decoder(s, newval.Elem()); err == nil { + val.Set(newval) + } + return err + } + return dec, nil +} + +// makeOptionalPtrDecoder creates a decoder that decodes empty values +// as nil. Non-empty values are decoded into a value of the element type, +// just like makePtrDecoder does. +// +// This decoder is used for pointer-typed struct fields with struct tag "nil". +func makeOptionalPtrDecoder(typ reflect.Type) (decoder, error) { + etype := typ.Elem() + etypeinfo := cachedTypeInfo1(etype, tags{}) + if etypeinfo.decoderErr != nil { + return nil, etypeinfo.decoderErr + } + dec := func(s *Stream, val reflect.Value) (err error) { + kind, size, err := s.Kind() + if err != nil || size == 0 && kind != Byte { + // rearm s.Kind. This is important because the input + // position must advance to the next value even though + // we don't read anything. + s.kind = -1 + // set the pointer to nil. + val.Set(reflect.Zero(typ)) + return err + } + newval := val + if val.IsNil() { + newval = reflect.New(etype) + } + if err = etypeinfo.decoder(s, newval.Elem()); err == nil { + val.Set(newval) + } + return err + } + return dec, nil +} + +var ifsliceType = reflect.TypeOf([]interface{}{}) + +func decodeInterface(s *Stream, val reflect.Value) error { + if val.Type().NumMethod() != 0 { + return fmt.Errorf("rlp: type %v is not RLP-serializable", val.Type()) + } + kind, _, err := s.Kind() + if err != nil { + return err + } + if kind == List { + slice := reflect.New(ifsliceType).Elem() + if err := decodeListSlice(s, slice, decodeInterface); err != nil { + return err + } + val.Set(slice) + } else { + b, err := s.Bytes() + if err != nil { + return err + } + val.Set(reflect.ValueOf(b)) + } + return nil +} + +// This decoder is used for non-pointer values of types +// that implement the Decoder interface using a pointer receiver. +func decodeDecoderNoPtr(s *Stream, val reflect.Value) error { + return val.Addr().Interface().(Decoder).DecodeRLP(s) +} + +func decodeDecoder(s *Stream, val reflect.Value) error { + // Decoder instances are not handled using the pointer rule if the type + // implements Decoder with pointer receiver (i.e. always) + // because it might handle empty values specially. + // We need to allocate one here in this case, like makePtrDecoder does. + if val.Kind() == reflect.Ptr && val.IsNil() { + val.Set(reflect.New(val.Type().Elem())) + } + return val.Interface().(Decoder).DecodeRLP(s) +} + +// Kind represents the kind of value contained in an RLP stream. +type Kind int + +const ( + Byte Kind = iota + String + List +) + +func (k Kind) String() string { + switch k { + case Byte: + return "Byte" + case String: + return "String" + case List: + return "List" + default: + return fmt.Sprintf("Unknown(%d)", k) + } +} + +// ByteReader must be implemented by any input reader for a Stream. It +// is implemented by e.g. bufio.Reader and bytes.Reader. +type ByteReader interface { + io.Reader + io.ByteReader +} + +// Stream can be used for piecemeal decoding of an input stream. This +// is useful if the input is very large or if the decoding rules for a +// type depend on the input structure. Stream does not keep an +// internal buffer. After decoding a value, the input reader will be +// positioned just before the type information for the next value. +// +// When decoding a list and the input position reaches the declared +// length of the list, all operations will return error EOL. +// The end of the list must be acknowledged using ListEnd to continue +// reading the enclosing list. +// +// Stream is not safe for concurrent use. +type Stream struct { + r ByteReader + + // number of bytes remaining to be read from r. + remaining uint64 + limited bool + + // auxiliary buffer for integer decoding + uintbuf []byte + + kind Kind // kind of value ahead + size uint64 // size of value ahead + byteval byte // value of single byte in type tag + kinderr error // error from last readKind + stack []listpos +} + +type listpos struct{ pos, size uint64 } + +// NewStream creates a new decoding stream reading from r. +// +// If r implements the ByteReader interface, Stream will +// not introduce any buffering. +// +// For non-toplevel values, Stream returns ErrElemTooLarge +// for values that do not fit into the enclosing list. +// +// Stream supports an optional input limit. If a limit is set, the +// size of any toplevel value will be checked against the remaining +// input length. Stream operations that encounter a value exceeding +// the remaining input length will return ErrValueTooLarge. The limit +// can be set by passing a non-zero value for inputLimit. +// +// If r is a bytes.Reader or strings.Reader, the input limit is set to +// the length of r's underlying data unless an explicit limit is +// provided. +func NewStream(r io.Reader, inputLimit uint64) *Stream { + s := new(Stream) + s.Reset(r, inputLimit) + return s +} + +// NewListStream creates a new stream that pretends to be positioned +// at an encoded list of the given length. +func NewListStream(r io.Reader, len uint64) *Stream { + s := new(Stream) + s.Reset(r, len) + s.kind = List + s.size = len + return s +} + +// Bytes reads an RLP string and returns its contents as a byte slice. +// If the input does not contain an RLP string, the returned +// error will be ErrExpectedString. +func (s *Stream) Bytes() ([]byte, error) { + kind, size, err := s.Kind() + if err != nil { + return nil, err + } + switch kind { + case Byte: + s.kind = -1 // rearm Kind + return []byte{s.byteval}, nil + case String: + b := make([]byte, size) + if err = s.readFull(b); err != nil { + return nil, err + } + if size == 1 && b[0] < 128 { + return nil, ErrCanonSize + } + return b, nil + default: + return nil, ErrExpectedString + } +} + +// Raw reads a raw encoded value including RLP type information. +func (s *Stream) Raw() ([]byte, error) { + kind, size, err := s.Kind() + if err != nil { + return nil, err + } + if kind == Byte { + s.kind = -1 // rearm Kind + return []byte{s.byteval}, nil + } + // the original header has already been read and is no longer + // available. read content and put a new header in front of it. + start := headsize(size) + buf := make([]byte, uint64(start)+size) + if err := s.readFull(buf[start:]); err != nil { + return nil, err + } + if kind == String { + puthead(buf, 0x80, 0xB7, size) + } else { + puthead(buf, 0xC0, 0xF7, size) + } + return buf, nil +} + +// Uint reads an RLP string of up to 8 bytes and returns its contents +// as an unsigned integer. If the input does not contain an RLP string, the +// returned error will be ErrExpectedString. +func (s *Stream) Uint() (uint64, error) { + return s.uint(64) +} + +func (s *Stream) uint(maxbits int) (uint64, error) { + kind, size, err := s.Kind() + if err != nil { + return 0, err + } + switch kind { + case Byte: + if s.byteval == 0 { + return 0, ErrCanonInt + } + s.kind = -1 // rearm Kind + return uint64(s.byteval), nil + case String: + if size > uint64(maxbits/8) { + return 0, errUintOverflow + } + v, err := s.readUint(byte(size)) + switch { + case err == ErrCanonSize: + // Adjust error because we're not reading a size right now. + return 0, ErrCanonInt + case err != nil: + return 0, err + case size > 0 && v < 128: + return 0, ErrCanonSize + default: + return v, nil + } + default: + return 0, ErrExpectedString + } +} + +// Bool reads an RLP string of up to 1 byte and returns its contents +// as a boolean. If the input does not contain an RLP string, the +// returned error will be ErrExpectedString. +func (s *Stream) Bool() (bool, error) { + num, err := s.uint(8) + if err != nil { + return false, err + } + switch num { + case 0: + return false, nil + case 1: + return true, nil + default: + return false, fmt.Errorf("rlp: invalid boolean value: %d", num) + } +} + +// List starts decoding an RLP list. If the input does not contain a +// list, the returned error will be ErrExpectedList. When the list's +// end has been reached, any Stream operation will return EOL. +func (s *Stream) List() (size uint64, err error) { + kind, size, err := s.Kind() + if err != nil { + return 0, err + } + if kind != List { + return 0, ErrExpectedList + } + s.stack = append(s.stack, listpos{0, size}) + s.kind = -1 + s.size = 0 + return size, nil +} + +// ListEnd returns to the enclosing list. +// The input reader must be positioned at the end of a list. +func (s *Stream) ListEnd() error { + if len(s.stack) == 0 { + return errNotInList + } + tos := s.stack[len(s.stack)-1] + if tos.pos != tos.size { + return errNotAtEOL + } + s.stack = s.stack[:len(s.stack)-1] // pop + if len(s.stack) > 0 { + s.stack[len(s.stack)-1].pos += tos.size + } + s.kind = -1 + s.size = 0 + return nil +} + +// Decode decodes a value and stores the result in the value pointed +// to by val. Please see the documentation for the Decode function +// to learn about the decoding rules. +func (s *Stream) Decode(val interface{}) error { + if val == nil { + return errDecodeIntoNil + } + rval := reflect.ValueOf(val) + rtyp := rval.Type() + if rtyp.Kind() != reflect.Ptr { + return errNoPointer + } + if rval.IsNil() { + return errDecodeIntoNil + } + decoder, err := cachedDecoder(rtyp.Elem()) + if err != nil { + return err + } + + err = decoder(s, rval.Elem()) + if decErr, ok := err.(*decodeError); ok && len(decErr.ctx) > 0 { + // add decode target type to error so context has more meaning + decErr.ctx = append(decErr.ctx, fmt.Sprint("(", rtyp.Elem(), ")")) + } + return err +} + +// Reset discards any information about the current decoding context +// and starts reading from r. This method is meant to facilitate reuse +// of a preallocated Stream across many decoding operations. +// +// If r does not also implement ByteReader, Stream will do its own +// buffering. +func (s *Stream) Reset(r io.Reader, inputLimit uint64) { + if inputLimit > 0 { + s.remaining = inputLimit + s.limited = true + } else { + // Attempt to automatically discover + // the limit when reading from a byte slice. + switch br := r.(type) { + case *bytes.Reader: + s.remaining = uint64(br.Len()) + s.limited = true + case *strings.Reader: + s.remaining = uint64(br.Len()) + s.limited = true + default: + s.limited = false + } + } + // Wrap r with a buffer if it doesn't have one. + bufr, ok := r.(ByteReader) + if !ok { + bufr = bufio.NewReader(r) + } + s.r = bufr + // Reset the decoding context. + s.stack = s.stack[:0] + s.size = 0 + s.kind = -1 + s.kinderr = nil + if s.uintbuf == nil { + s.uintbuf = make([]byte, 8) + } + s.byteval = 0 +} + +// Kind returns the kind and size of the next value in the +// input stream. +// +// The returned size is the number of bytes that make up the value. +// For kind == Byte, the size is zero because the value is +// contained in the type tag. +// +// The first call to Kind will read size information from the input +// reader and leave it positioned at the start of the actual bytes of +// the value. Subsequent calls to Kind (until the value is decoded) +// will not advance the input reader and return cached information. +func (s *Stream) Kind() (kind Kind, size uint64, err error) { + var tos *listpos + if len(s.stack) > 0 { + tos = &s.stack[len(s.stack)-1] + } + if s.kind < 0 { + s.kinderr = nil + // Don't read further if we're at the end of the + // innermost list. + if tos != nil && tos.pos == tos.size { + return 0, 0, EOL + } + s.kind, s.size, s.kinderr = s.readKind() + if s.kinderr == nil { + if tos == nil { + // At toplevel, check that the value is smaller + // than the remaining input length. + if s.limited && s.size > s.remaining { + s.kinderr = ErrValueTooLarge + } + } else { + // Inside a list, check that the value doesn't overflow the list. + if s.size > tos.size-tos.pos { + s.kinderr = ErrElemTooLarge + } + } + } + } + // Note: this might return a sticky error generated + // by an earlier call to readKind. + return s.kind, s.size, s.kinderr +} + +func (s *Stream) readKind() (kind Kind, size uint64, err error) { + b, err := s.readByte() + if err != nil { + if len(s.stack) == 0 { + // At toplevel, Adjust the error to actual EOF. io.EOF is + // used by callers to determine when to stop decoding. + switch err { + case io.ErrUnexpectedEOF: + err = io.EOF + case ErrValueTooLarge: + err = io.EOF + } + } + return 0, 0, err + } + s.byteval = 0 + switch { + case b < 0x80: + // For a single byte whose value is in the [0x00, 0x7F] range, that byte + // is its own RLP encoding. + s.byteval = b + return Byte, 0, nil + case b < 0xB8: + // Otherwise, if a string is 0-55 bytes long, + // the RLP encoding consists of a single byte with value 0x80 plus the + // length of the string followed by the string. The range of the first + // byte is thus [0x80, 0xB7]. + return String, uint64(b - 0x80), nil + case b < 0xC0: + // If a string is more than 55 bytes long, the + // RLP encoding consists of a single byte with value 0xB7 plus the length + // of the length of the string in binary form, followed by the length of + // the string, followed by the string. For example, a length-1024 string + // would be encoded as 0xB90400 followed by the string. The range of + // the first byte is thus [0xB8, 0xBF]. + size, err = s.readUint(b - 0xB7) + if err == nil && size < 56 { + err = ErrCanonSize + } + return String, size, err + case b < 0xF8: + // If the total payload of a list + // (i.e. the combined length of all its items) is 0-55 bytes long, the + // RLP encoding consists of a single byte with value 0xC0 plus the length + // of the list followed by the concatenation of the RLP encodings of the + // items. The range of the first byte is thus [0xC0, 0xF7]. + return List, uint64(b - 0xC0), nil + default: + // If the total payload of a list is more than 55 bytes long, + // the RLP encoding consists of a single byte with value 0xF7 + // plus the length of the length of the payload in binary + // form, followed by the length of the payload, followed by + // the concatenation of the RLP encodings of the items. The + // range of the first byte is thus [0xF8, 0xFF]. + size, err = s.readUint(b - 0xF7) + if err == nil && size < 56 { + err = ErrCanonSize + } + return List, size, err + } +} + +func (s *Stream) readUint(size byte) (uint64, error) { + switch size { + case 0: + s.kind = -1 // rearm Kind + return 0, nil + case 1: + b, err := s.readByte() + return uint64(b), err + default: + start := int(8 - size) + for i := 0; i < start; i++ { + s.uintbuf[i] = 0 + } + if err := s.readFull(s.uintbuf[start:]); err != nil { + return 0, err + } + if s.uintbuf[start] == 0 { + // Note: readUint is also used to decode integer + // values. The error needs to be adjusted to become + // ErrCanonInt in this case. + return 0, ErrCanonSize + } + return binary.BigEndian.Uint64(s.uintbuf), nil + } +} + +func (s *Stream) readFull(buf []byte) (err error) { + if err := s.willRead(uint64(len(buf))); err != nil { + return err + } + var nn, n int + for n < len(buf) && err == nil { + nn, err = s.r.Read(buf[n:]) + n += nn + } + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + return err +} + +func (s *Stream) readByte() (byte, error) { + if err := s.willRead(1); err != nil { + return 0, err + } + b, err := s.r.ReadByte() + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + return b, err +} + +func (s *Stream) willRead(n uint64) error { + s.kind = -1 // rearm Kind + + if len(s.stack) > 0 { + // check list overflow + tos := s.stack[len(s.stack)-1] + if n > tos.size-tos.pos { + return ErrElemTooLarge + } + s.stack[len(s.stack)-1].pos += n + } + if s.limited { + if n > s.remaining { + return ErrValueTooLarge + } + s.remaining -= n + } + return nil +} diff --git a/vendor/github.com/ethereum/go-ethereum/rlp/doc.go b/vendor/github.com/ethereum/go-ethereum/rlp/doc.go new file mode 100644 index 000000000..b3a81fe23 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/rlp/doc.go @@ -0,0 +1,33 @@ +// Copyright 2014 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum 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 go-ethereum 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 go-ethereum library. If not, see <http://www.gnu.org/licenses/>. + +/* +Package rlp implements the RLP serialization format. + +The purpose of RLP (Recursive Linear Prefix) is to encode arbitrarily +nested arrays of binary data, and RLP is the main encoding method used +to serialize objects in Ethereum. The only purpose of RLP is to encode +structure; encoding specific atomic data types (eg. strings, ints, +floats) is left up to higher-order protocols; in Ethereum integers +must be represented in big endian binary form with no leading zeroes +(thus making the integer value zero equivalent to the empty byte +array). + +RLP values are distinguished by a type tag. The type tag precedes the +value in the input stream and defines the size and kind of the bytes +that follow. +*/ +package rlp diff --git a/vendor/github.com/ethereum/go-ethereum/rlp/encode.go b/vendor/github.com/ethereum/go-ethereum/rlp/encode.go new file mode 100644 index 000000000..f255c38a9 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/rlp/encode.go @@ -0,0 +1,651 @@ +// Copyright 2014 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum 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 go-ethereum 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 go-ethereum library. If not, see <http://www.gnu.org/licenses/>. + +package rlp + +import ( + "fmt" + "io" + "math/big" + "reflect" + "sync" +) + +var ( + // Common encoded values. + // These are useful when implementing EncodeRLP. + EmptyString = []byte{0x80} + EmptyList = []byte{0xC0} +) + +// Encoder is implemented by types that require custom +// encoding rules or want to encode private fields. +type Encoder interface { + // EncodeRLP should write the RLP encoding of its receiver to w. + // If the implementation is a pointer method, it may also be + // called for nil pointers. + // + // Implementations should generate valid RLP. The data written is + // not verified at the moment, but a future version might. It is + // recommended to write only a single value but writing multiple + // values or no value at all is also permitted. + EncodeRLP(io.Writer) error +} + +// Encode writes the RLP encoding of val to w. Note that Encode may +// perform many small writes in some cases. Consider making w +// buffered. +// +// Encode uses the following type-dependent encoding rules: +// +// If the type implements the Encoder interface, Encode calls +// EncodeRLP. This is true even for nil pointers, please see the +// documentation for Encoder. +// +// To encode a pointer, the value being pointed to is encoded. For nil +// pointers, Encode will encode the zero value of the type. A nil +// pointer to a struct type always encodes as an empty RLP list. +// A nil pointer to an array encodes as an empty list (or empty string +// if the array has element type byte). +// +// Struct values are encoded as an RLP list of all their encoded +// public fields. Recursive struct types are supported. +// +// To encode slices and arrays, the elements are encoded as an RLP +// list of the value's elements. Note that arrays and slices with +// element type uint8 or byte are always encoded as an RLP string. +// +// A Go string is encoded as an RLP string. +// +// An unsigned integer value is encoded as an RLP string. Zero always +// encodes as an empty RLP string. Encode also supports *big.Int. +// +// Boolean values are encoded as unsigned integers zero (false) and one (true). +// +// An interface value encodes as the value contained in the interface. +// +// Signed integers are not supported, nor are floating point numbers, maps, +// channels and functions. +func Encode(w io.Writer, val interface{}) error { + if outer, ok := w.(*encbuf); ok { + // Encode was called by some type's EncodeRLP. + // Avoid copying by writing to the outer encbuf directly. + return outer.encode(val) + } + eb := encbufPool.Get().(*encbuf) + defer encbufPool.Put(eb) + eb.reset() + if err := eb.encode(val); err != nil { + return err + } + return eb.toWriter(w) +} + +// EncodeToBytes returns the RLP encoding of val. +// Please see the documentation of Encode for the encoding rules. +func EncodeToBytes(val interface{}) ([]byte, error) { + eb := encbufPool.Get().(*encbuf) + defer encbufPool.Put(eb) + eb.reset() + if err := eb.encode(val); err != nil { + return nil, err + } + return eb.toBytes(), nil +} + +// EncodeToReader returns a reader from which the RLP encoding of val +// can be read. The returned size is the total size of the encoded +// data. +// +// Please see the documentation of Encode for the encoding rules. +func EncodeToReader(val interface{}) (size int, r io.Reader, err error) { + eb := encbufPool.Get().(*encbuf) + eb.reset() + if err := eb.encode(val); err != nil { + return 0, nil, err + } + return eb.size(), &encReader{buf: eb}, nil +} + +type encbuf struct { + str []byte // string data, contains everything except list headers + lheads []*listhead // all list headers + lhsize int // sum of sizes of all encoded list headers + sizebuf []byte // 9-byte auxiliary buffer for uint encoding +} + +type listhead struct { + offset int // index of this header in string data + size int // total size of encoded data (including list headers) +} + +// encode writes head to the given buffer, which must be at least +// 9 bytes long. It returns the encoded bytes. +func (head *listhead) encode(buf []byte) []byte { + return buf[:puthead(buf, 0xC0, 0xF7, uint64(head.size))] +} + +// headsize returns the size of a list or string header +// for a value of the given size. +func headsize(size uint64) int { + if size < 56 { + return 1 + } + return 1 + intsize(size) +} + +// puthead writes a list or string header to buf. +// buf must be at least 9 bytes long. +func puthead(buf []byte, smalltag, largetag byte, size uint64) int { + if size < 56 { + buf[0] = smalltag + byte(size) + return 1 + } + sizesize := putint(buf[1:], size) + buf[0] = largetag + byte(sizesize) + return sizesize + 1 +} + +// encbufs are pooled. +var encbufPool = sync.Pool{ + New: func() interface{} { return &encbuf{sizebuf: make([]byte, 9)} }, +} + +func (w *encbuf) reset() { + w.lhsize = 0 + if w.str != nil { + w.str = w.str[:0] + } + if w.lheads != nil { + w.lheads = w.lheads[:0] + } +} + +// encbuf implements io.Writer so it can be passed it into EncodeRLP. +func (w *encbuf) Write(b []byte) (int, error) { + w.str = append(w.str, b...) + return len(b), nil +} + +func (w *encbuf) encode(val interface{}) error { + rval := reflect.ValueOf(val) + writer, err := cachedWriter(rval.Type()) + if err != nil { + return err + } + return writer(rval, w) +} + +func (w *encbuf) encodeStringHeader(size int) { + if size < 56 { + w.str = append(w.str, 0x80+byte(size)) + } else { + // TODO: encode to w.str directly + sizesize := putint(w.sizebuf[1:], uint64(size)) + w.sizebuf[0] = 0xB7 + byte(sizesize) + w.str = append(w.str, w.sizebuf[:sizesize+1]...) + } +} + +func (w *encbuf) encodeString(b []byte) { + if len(b) == 1 && b[0] <= 0x7F { + // fits single byte, no string header + w.str = append(w.str, b[0]) + } else { + w.encodeStringHeader(len(b)) + w.str = append(w.str, b...) + } +} + +func (w *encbuf) list() *listhead { + lh := &listhead{offset: len(w.str), size: w.lhsize} + w.lheads = append(w.lheads, lh) + return lh +} + +func (w *encbuf) listEnd(lh *listhead) { + lh.size = w.size() - lh.offset - lh.size + if lh.size < 56 { + w.lhsize++ // length encoded into kind tag + } else { + w.lhsize += 1 + intsize(uint64(lh.size)) + } +} + +func (w *encbuf) size() int { + return len(w.str) + w.lhsize +} + +func (w *encbuf) toBytes() []byte { + out := make([]byte, w.size()) + strpos := 0 + pos := 0 + for _, head := range w.lheads { + // write string data before header + n := copy(out[pos:], w.str[strpos:head.offset]) + pos += n + strpos += n + // write the header + enc := head.encode(out[pos:]) + pos += len(enc) + } + // copy string data after the last list header + copy(out[pos:], w.str[strpos:]) + return out +} + +func (w *encbuf) toWriter(out io.Writer) (err error) { + strpos := 0 + for _, head := range w.lheads { + // write string data before header + if head.offset-strpos > 0 { + n, err := out.Write(w.str[strpos:head.offset]) + strpos += n + if err != nil { + return err + } + } + // write the header + enc := head.encode(w.sizebuf) + if _, err = out.Write(enc); err != nil { + return err + } + } + if strpos < len(w.str) { + // write string data after the last list header + _, err = out.Write(w.str[strpos:]) + } + return err +} + +// encReader is the io.Reader returned by EncodeToReader. +// It releases its encbuf at EOF. +type encReader struct { + buf *encbuf // the buffer we're reading from. this is nil when we're at EOF. + lhpos int // index of list header that we're reading + strpos int // current position in string buffer + piece []byte // next piece to be read +} + +func (r *encReader) Read(b []byte) (n int, err error) { + for { + if r.piece = r.next(); r.piece == nil { + // Put the encode buffer back into the pool at EOF when it + // is first encountered. Subsequent calls still return EOF + // as the error but the buffer is no longer valid. + if r.buf != nil { + encbufPool.Put(r.buf) + r.buf = nil + } + return n, io.EOF + } + nn := copy(b[n:], r.piece) + n += nn + if nn < len(r.piece) { + // piece didn't fit, see you next time. + r.piece = r.piece[nn:] + return n, nil + } + r.piece = nil + } +} + +// next returns the next piece of data to be read. +// it returns nil at EOF. +func (r *encReader) next() []byte { + switch { + case r.buf == nil: + return nil + + case r.piece != nil: + // There is still data available for reading. + return r.piece + + case r.lhpos < len(r.buf.lheads): + // We're before the last list header. + head := r.buf.lheads[r.lhpos] + sizebefore := head.offset - r.strpos + if sizebefore > 0 { + // String data before header. + p := r.buf.str[r.strpos:head.offset] + r.strpos += sizebefore + return p + } + r.lhpos++ + return head.encode(r.buf.sizebuf) + + case r.strpos < len(r.buf.str): + // String data at the end, after all list headers. + p := r.buf.str[r.strpos:] + r.strpos = len(r.buf.str) + return p + + default: + return nil + } +} + +var ( + encoderInterface = reflect.TypeOf(new(Encoder)).Elem() + big0 = big.NewInt(0) +) + +// makeWriter creates a writer function for the given type. +func makeWriter(typ reflect.Type, ts tags) (writer, error) { + kind := typ.Kind() + switch { + case typ == rawValueType: + return writeRawValue, nil + case typ.Implements(encoderInterface): + return writeEncoder, nil + case kind != reflect.Ptr && reflect.PtrTo(typ).Implements(encoderInterface): + return writeEncoderNoPtr, nil + case kind == reflect.Interface: + return writeInterface, nil + case typ.AssignableTo(reflect.PtrTo(bigInt)): + return writeBigIntPtr, nil + case typ.AssignableTo(bigInt): + return writeBigIntNoPtr, nil + case isUint(kind): + return writeUint, nil + case kind == reflect.Bool: + return writeBool, nil + case kind == reflect.String: + return writeString, nil + case kind == reflect.Slice && isByte(typ.Elem()): + return writeBytes, nil + case kind == reflect.Array && isByte(typ.Elem()): + return writeByteArray, nil + case kind == reflect.Slice || kind == reflect.Array: + return makeSliceWriter(typ, ts) + case kind == reflect.Struct: + return makeStructWriter(typ) + case kind == reflect.Ptr: + return makePtrWriter(typ) + default: + return nil, fmt.Errorf("rlp: type %v is not RLP-serializable", typ) + } +} + +func isByte(typ reflect.Type) bool { + return typ.Kind() == reflect.Uint8 && !typ.Implements(encoderInterface) +} + +func writeRawValue(val reflect.Value, w *encbuf) error { + w.str = append(w.str, val.Bytes()...) + return nil +} + +func writeUint(val reflect.Value, w *encbuf) error { + i := val.Uint() + if i == 0 { + w.str = append(w.str, 0x80) + } else if i < 128 { + // fits single byte + w.str = append(w.str, byte(i)) + } else { + // TODO: encode int to w.str directly + s := putint(w.sizebuf[1:], i) + w.sizebuf[0] = 0x80 + byte(s) + w.str = append(w.str, w.sizebuf[:s+1]...) + } + return nil +} + +func writeBool(val reflect.Value, w *encbuf) error { + if val.Bool() { + w.str = append(w.str, 0x01) + } else { + w.str = append(w.str, 0x80) + } + return nil +} + +func writeBigIntPtr(val reflect.Value, w *encbuf) error { + ptr := val.Interface().(*big.Int) + if ptr == nil { + w.str = append(w.str, 0x80) + return nil + } + return writeBigInt(ptr, w) +} + +func writeBigIntNoPtr(val reflect.Value, w *encbuf) error { + i := val.Interface().(big.Int) + return writeBigInt(&i, w) +} + +func writeBigInt(i *big.Int, w *encbuf) error { + if cmp := i.Cmp(big0); cmp == -1 { + return fmt.Errorf("rlp: cannot encode negative *big.Int") + } else if cmp == 0 { + w.str = append(w.str, 0x80) + } else { + w.encodeString(i.Bytes()) + } + return nil +} + +func writeBytes(val reflect.Value, w *encbuf) error { + w.encodeString(val.Bytes()) + return nil +} + +func writeByteArray(val reflect.Value, w *encbuf) error { + if !val.CanAddr() { + // Slice requires the value to be addressable. + // Make it addressable by copying. + copy := reflect.New(val.Type()).Elem() + copy.Set(val) + val = copy + } + size := val.Len() + slice := val.Slice(0, size).Bytes() + w.encodeString(slice) + return nil +} + +func writeString(val reflect.Value, w *encbuf) error { + s := val.String() + if len(s) == 1 && s[0] <= 0x7f { + // fits single byte, no string header + w.str = append(w.str, s[0]) + } else { + w.encodeStringHeader(len(s)) + w.str = append(w.str, s...) + } + return nil +} + +func writeEncoder(val reflect.Value, w *encbuf) error { + return val.Interface().(Encoder).EncodeRLP(w) +} + +// writeEncoderNoPtr handles non-pointer values that implement Encoder +// with a pointer receiver. +func writeEncoderNoPtr(val reflect.Value, w *encbuf) error { + if !val.CanAddr() { + // We can't get the address. It would be possible to make the + // value addressable by creating a shallow copy, but this + // creates other problems so we're not doing it (yet). + // + // package json simply doesn't call MarshalJSON for cases like + // this, but encodes the value as if it didn't implement the + // interface. We don't want to handle it that way. + return fmt.Errorf("rlp: game over: unadressable value of type %v, EncodeRLP is pointer method", val.Type()) + } + return val.Addr().Interface().(Encoder).EncodeRLP(w) +} + +func writeInterface(val reflect.Value, w *encbuf) error { + if val.IsNil() { + // Write empty list. This is consistent with the previous RLP + // encoder that we had and should therefore avoid any + // problems. + w.str = append(w.str, 0xC0) + return nil + } + eval := val.Elem() + writer, err := cachedWriter(eval.Type()) + if err != nil { + return err + } + return writer(eval, w) +} + +func makeSliceWriter(typ reflect.Type, ts tags) (writer, error) { + etypeinfo := cachedTypeInfo1(typ.Elem(), tags{}) + if etypeinfo.writerErr != nil { + return nil, etypeinfo.writerErr + } + writer := func(val reflect.Value, w *encbuf) error { + if !ts.tail { + defer w.listEnd(w.list()) + } + vlen := val.Len() + for i := 0; i < vlen; i++ { + if err := etypeinfo.writer(val.Index(i), w); err != nil { + return err + } + } + return nil + } + return writer, nil +} + +func makeStructWriter(typ reflect.Type) (writer, error) { + fields, err := structFields(typ) + if err != nil { + return nil, err + } + writer := func(val reflect.Value, w *encbuf) error { + lh := w.list() + for _, f := range fields { + if err := f.info.writer(val.Field(f.index), w); err != nil { + return err + } + } + w.listEnd(lh) + return nil + } + return writer, nil +} + +func makePtrWriter(typ reflect.Type) (writer, error) { + etypeinfo := cachedTypeInfo1(typ.Elem(), tags{}) + if etypeinfo.writerErr != nil { + return nil, etypeinfo.writerErr + } + + // determine nil pointer handler + var nilfunc func(*encbuf) error + kind := typ.Elem().Kind() + switch { + case kind == reflect.Array && isByte(typ.Elem().Elem()): + nilfunc = func(w *encbuf) error { + w.str = append(w.str, 0x80) + return nil + } + case kind == reflect.Struct || kind == reflect.Array: + nilfunc = func(w *encbuf) error { + // encoding the zero value of a struct/array could trigger + // infinite recursion, avoid that. + w.listEnd(w.list()) + return nil + } + default: + zero := reflect.Zero(typ.Elem()) + nilfunc = func(w *encbuf) error { + return etypeinfo.writer(zero, w) + } + } + + writer := func(val reflect.Value, w *encbuf) error { + if val.IsNil() { + return nilfunc(w) + } + return etypeinfo.writer(val.Elem(), w) + } + return writer, nil +} + +// putint writes i to the beginning of b in big endian byte +// order, using the least number of bytes needed to represent i. +func putint(b []byte, i uint64) (size int) { + switch { + case i < (1 << 8): + b[0] = byte(i) + return 1 + case i < (1 << 16): + b[0] = byte(i >> 8) + b[1] = byte(i) + return 2 + case i < (1 << 24): + b[0] = byte(i >> 16) + b[1] = byte(i >> 8) + b[2] = byte(i) + return 3 + case i < (1 << 32): + b[0] = byte(i >> 24) + b[1] = byte(i >> 16) + b[2] = byte(i >> 8) + b[3] = byte(i) + return 4 + case i < (1 << 40): + b[0] = byte(i >> 32) + b[1] = byte(i >> 24) + b[2] = byte(i >> 16) + b[3] = byte(i >> 8) + b[4] = byte(i) + return 5 + case i < (1 << 48): + b[0] = byte(i >> 40) + b[1] = byte(i >> 32) + b[2] = byte(i >> 24) + b[3] = byte(i >> 16) + b[4] = byte(i >> 8) + b[5] = byte(i) + return 6 + case i < (1 << 56): + b[0] = byte(i >> 48) + b[1] = byte(i >> 40) + b[2] = byte(i >> 32) + b[3] = byte(i >> 24) + b[4] = byte(i >> 16) + b[5] = byte(i >> 8) + b[6] = byte(i) + return 7 + default: + b[0] = byte(i >> 56) + b[1] = byte(i >> 48) + b[2] = byte(i >> 40) + b[3] = byte(i >> 32) + b[4] = byte(i >> 24) + b[5] = byte(i >> 16) + b[6] = byte(i >> 8) + b[7] = byte(i) + return 8 + } +} + +// intsize computes the minimum number of bytes required to store i. +func intsize(i uint64) (size int) { + for size = 1; ; size++ { + if i >>= 8; i == 0 { + return size + } + } +} diff --git a/vendor/github.com/ethereum/go-ethereum/rlp/raw.go b/vendor/github.com/ethereum/go-ethereum/rlp/raw.go new file mode 100644 index 000000000..2b3f328f6 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/rlp/raw.go @@ -0,0 +1,156 @@ +// Copyright 2015 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum 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 go-ethereum 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 go-ethereum library. If not, see <http://www.gnu.org/licenses/>. + +package rlp + +import ( + "io" + "reflect" +) + +// RawValue represents an encoded RLP value and can be used to delay +// RLP decoding or to precompute an encoding. Note that the decoder does +// not verify whether the content of RawValues is valid RLP. +type RawValue []byte + +var rawValueType = reflect.TypeOf(RawValue{}) + +// ListSize returns the encoded size of an RLP list with the given +// content size. +func ListSize(contentSize uint64) uint64 { + return uint64(headsize(contentSize)) + contentSize +} + +// Split returns the content of first RLP value and any +// bytes after the value as subslices of b. +func Split(b []byte) (k Kind, content, rest []byte, err error) { + k, ts, cs, err := readKind(b) + if err != nil { + return 0, nil, b, err + } + return k, b[ts : ts+cs], b[ts+cs:], nil +} + +// SplitString splits b into the content of an RLP string +// and any remaining bytes after the string. +func SplitString(b []byte) (content, rest []byte, err error) { + k, content, rest, err := Split(b) + if err != nil { + return nil, b, err + } + if k == List { + return nil, b, ErrExpectedString + } + return content, rest, nil +} + +// SplitList splits b into the content of a list and any remaining +// bytes after the list. +func SplitList(b []byte) (content, rest []byte, err error) { + k, content, rest, err := Split(b) + if err != nil { + return nil, b, err + } + if k != List { + return nil, b, ErrExpectedList + } + return content, rest, nil +} + +// CountValues counts the number of encoded values in b. +func CountValues(b []byte) (int, error) { + i := 0 + for ; len(b) > 0; i++ { + _, tagsize, size, err := readKind(b) + if err != nil { + return 0, err + } + b = b[tagsize+size:] + } + return i, nil +} + +func readKind(buf []byte) (k Kind, tagsize, contentsize uint64, err error) { + if len(buf) == 0 { + return 0, 0, 0, io.ErrUnexpectedEOF + } + b := buf[0] + switch { + case b < 0x80: + k = Byte + tagsize = 0 + contentsize = 1 + case b < 0xB8: + k = String + tagsize = 1 + contentsize = uint64(b - 0x80) + // Reject strings that should've been single bytes. + if contentsize == 1 && len(buf) > 1 && buf[1] < 128 { + return 0, 0, 0, ErrCanonSize + } + case b < 0xC0: + k = String + tagsize = uint64(b-0xB7) + 1 + contentsize, err = readSize(buf[1:], b-0xB7) + case b < 0xF8: + k = List + tagsize = 1 + contentsize = uint64(b - 0xC0) + default: + k = List + tagsize = uint64(b-0xF7) + 1 + contentsize, err = readSize(buf[1:], b-0xF7) + } + if err != nil { + return 0, 0, 0, err + } + // Reject values larger than the input slice. + if contentsize > uint64(len(buf))-tagsize { + return 0, 0, 0, ErrValueTooLarge + } + return k, tagsize, contentsize, err +} + +func readSize(b []byte, slen byte) (uint64, error) { + if int(slen) > len(b) { + return 0, io.ErrUnexpectedEOF + } + var s uint64 + switch slen { + case 1: + s = uint64(b[0]) + case 2: + s = uint64(b[0])<<8 | uint64(b[1]) + case 3: + s = uint64(b[0])<<16 | uint64(b[1])<<8 | uint64(b[2]) + case 4: + s = uint64(b[0])<<24 | uint64(b[1])<<16 | uint64(b[2])<<8 | uint64(b[3]) + case 5: + s = uint64(b[0])<<32 | uint64(b[1])<<24 | uint64(b[2])<<16 | uint64(b[3])<<8 | uint64(b[4]) + case 6: + s = uint64(b[0])<<40 | uint64(b[1])<<32 | uint64(b[2])<<24 | uint64(b[3])<<16 | uint64(b[4])<<8 | uint64(b[5]) + case 7: + s = uint64(b[0])<<48 | uint64(b[1])<<40 | uint64(b[2])<<32 | uint64(b[3])<<24 | uint64(b[4])<<16 | uint64(b[5])<<8 | uint64(b[6]) + case 8: + s = uint64(b[0])<<56 | uint64(b[1])<<48 | uint64(b[2])<<40 | uint64(b[3])<<32 | uint64(b[4])<<24 | uint64(b[5])<<16 | uint64(b[6])<<8 | uint64(b[7]) + } + // Reject sizes < 56 (shouldn't have separate size) and sizes with + // leading zero bytes. + if s < 56 || b[0] == 0 { + return 0, ErrCanonSize + } + return s, nil +} diff --git a/vendor/github.com/ethereum/go-ethereum/rlp/typecache.go b/vendor/github.com/ethereum/go-ethereum/rlp/typecache.go new file mode 100644 index 000000000..ab5ee3da7 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/rlp/typecache.go @@ -0,0 +1,165 @@ +// Copyright 2014 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum 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 go-ethereum 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 go-ethereum library. If not, see <http://www.gnu.org/licenses/>. + +package rlp + +import ( + "fmt" + "reflect" + "strings" + "sync" +) + +var ( + typeCacheMutex sync.RWMutex + typeCache = make(map[typekey]*typeinfo) +) + +type typeinfo struct { + decoder decoder + decoderErr error // error from makeDecoder + writer writer + writerErr error // error from makeWriter +} + +// represents struct tags +type tags struct { + // rlp:"nil" controls whether empty input results in a nil pointer. + nilOK bool + // rlp:"tail" controls whether this field swallows additional list + // elements. It can only be set for the last field, which must be + // of slice type. + tail bool + // rlp:"-" ignores fields. + ignored bool +} + +type typekey struct { + reflect.Type + // the key must include the struct tags because they + // might generate a different decoder. + tags +} + +type decoder func(*Stream, reflect.Value) error + +type writer func(reflect.Value, *encbuf) error + +func cachedDecoder(typ reflect.Type) (decoder, error) { + info := cachedTypeInfo(typ, tags{}) + return info.decoder, info.decoderErr +} + +func cachedWriter(typ reflect.Type) (writer, error) { + info := cachedTypeInfo(typ, tags{}) + return info.writer, info.writerErr +} + +func cachedTypeInfo(typ reflect.Type, tags tags) *typeinfo { + typeCacheMutex.RLock() + info := typeCache[typekey{typ, tags}] + typeCacheMutex.RUnlock() + if info != nil { + return info + } + // not in the cache, need to generate info for this type. + typeCacheMutex.Lock() + defer typeCacheMutex.Unlock() + return cachedTypeInfo1(typ, tags) +} + +func cachedTypeInfo1(typ reflect.Type, tags tags) *typeinfo { + key := typekey{typ, tags} + info := typeCache[key] + if info != nil { + // another goroutine got the write lock first + return info + } + // put a dummy value into the cache before generating. + // if the generator tries to lookup itself, it will get + // the dummy value and won't call itself recursively. + info = new(typeinfo) + typeCache[key] = info + info.generate(typ, tags) + return info +} + +type field struct { + index int + info *typeinfo +} + +func structFields(typ reflect.Type) (fields []field, err error) { + lastPublic := lastPublicField(typ) + for i := 0; i < typ.NumField(); i++ { + if f := typ.Field(i); f.PkgPath == "" { // exported + tags, err := parseStructTag(typ, i, lastPublic) + if err != nil { + return nil, err + } + if tags.ignored { + continue + } + info := cachedTypeInfo1(f.Type, tags) + fields = append(fields, field{i, info}) + } + } + return fields, nil +} + +func parseStructTag(typ reflect.Type, fi, lastPublic int) (tags, error) { + f := typ.Field(fi) + var ts tags + for _, t := range strings.Split(f.Tag.Get("rlp"), ",") { + switch t = strings.TrimSpace(t); t { + case "": + case "-": + ts.ignored = true + case "nil": + ts.nilOK = true + case "tail": + ts.tail = true + if fi != lastPublic { + return ts, fmt.Errorf(`rlp: invalid struct tag "tail" for %v.%s (must be on last field)`, typ, f.Name) + } + if f.Type.Kind() != reflect.Slice { + return ts, fmt.Errorf(`rlp: invalid struct tag "tail" for %v.%s (field type is not slice)`, typ, f.Name) + } + default: + return ts, fmt.Errorf("rlp: unknown struct tag %q on %v.%s", t, typ, f.Name) + } + } + return ts, nil +} + +func lastPublicField(typ reflect.Type) int { + last := 0 + for i := 0; i < typ.NumField(); i++ { + if typ.Field(i).PkgPath == "" { + last = i + } + } + return last +} + +func (i *typeinfo) generate(typ reflect.Type, tags tags) { + i.decoder, i.decoderErr = makeDecoder(typ, tags) + i.writer, i.writerErr = makeWriter(typ, tags) +} + +func isUint(k reflect.Kind) bool { + return k >= reflect.Uint && k <= reflect.Uintptr +} diff --git a/vendor/vendor.json b/vendor/vendor.json index ff47da121..789eb8ab2 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -99,138 +99,133 @@ "revisionTime": "2017-11-28T15:02:46Z" }, { - "checksumSHA1": "cDMtzKmdTx4CcIpP4broa+16X9g=", - "path": "github.com/cespare/cp", - "revision": "165db2f241fd235aec29ba6d9b1ccd5f1c14637c", - "revisionTime": "2015-01-22T07:26:53Z" - }, - { - "checksumSHA1": "7gK+lSShSu1NRw83/A95BcgMqsI=", - "path": "github.com/codahale/hdrhistogram", - "revision": "3a0bb77429bd3a61596f5e8a3172445844342120", - "revisionTime": "2016-10-10T02:54:55Z" - }, - { - "checksumSHA1": "dvabztWVQX8f6oMLRyv4dLH+TGY=", - "path": "github.com/davecgh/go-spew/spew", - "revision": "346938d642f2ec3594ed81d874461961cd0faa76", - "revisionTime": "2016-10-29T20:57:26Z" - }, - { - "checksumSHA1": "1xK7ycc1ICRInk/S9iiyB9Rpv50=", - "path": "github.com/deckarep/golang-set", - "revision": "504e848d77ea4752b3057b8fb46da0e7f746ccf3", - "revisionTime": "2018-06-03T19:32:48Z" - }, - { - "checksumSHA1": "jqxT0OeSE30j5pVqR+ia/AxtdAI=", - "path": "github.com/dexon-foundation/bls", - "revision": "dda43effd59cb08b3e99198c6d066a723e10a86b", - "revisionTime": "2018-12-27T09:54:38Z", - "version": "dev", - "versionExact": "dev" + "checksumSHA1": "Rls1USg65f0XKk3xOEo23d79nTs=", + "path": "github.com/byzantine-lab/bls/ffi/go/bls", + "revision": "5e8e1cd9adf37e993a5bea2ad116e107652f0301", + "revisionTime": "2019-04-12T05:24:20Z" }, { - "checksumSHA1": "yPWDIKToXWyTkkq3ZU8M461UFJI=", - "path": "github.com/dexon-foundation/bls/ffi/go/bls", - "revision": "dda43effd59cb08b3e99198c6d066a723e10a86b", - "revisionTime": "2018-12-27T09:54:38Z", - "version": "dev", - "versionExact": "dev" - }, - { - "checksumSHA1": "In6vBHYUsX7DUIGiFN2hQggBgvI=", - "path": "github.com/dexon-foundation/dexon-consensus/common", - "revision": "42d585f1e5c9420f15b1d7333e7874a04345cc36", - "revisionTime": "2019-05-06T04:02:43Z", + "checksumSHA1": "YNFLm0hecMirCfnG+yC1hwrq63w=", + "origin": "gitlab.com/byzantine-lab/dexon-consensus/common", + "path": "github.com/byzantine-lab/dexon-consensus/common", + "revision": "f05d9c34d6595ebced2de25d9b436f3aac35a53f", + "revisionTime": "2019-06-10T16:05:10Z", "version": "master", "versionExact": "master" }, { - "checksumSHA1": "3/fzuY8PZ1Fd1dw6Fol6hbvZXWk=", - "path": "github.com/dexon-foundation/dexon-consensus/core", - "revision": "42d585f1e5c9420f15b1d7333e7874a04345cc36", - "revisionTime": "2019-05-06T04:02:43Z", + "checksumSHA1": "mVmTRuUjdKaeLKOIPDr9WlrWbM8=", + "origin": "gitlab.com/byzantine-lab/dexon-consensus/core", + "path": "github.com/byzantine-lab/dexon-consensus/core", + "revision": "f05d9c34d6595ebced2de25d9b436f3aac35a53f", + "revisionTime": "2019-06-10T16:05:10Z", "version": "master", "versionExact": "master" }, { - "checksumSHA1": "v4fKR7uhoyufi6hAVO44cFEb+tY=", - "path": "github.com/dexon-foundation/dexon-consensus/core/blockdb", + "checksumSHA1": "giMmtUvHD7fKNXEyYpXL1bWhZms=", + "origin": "gitlab.com/byzantine-lab/dexon-consensus/core/blockdb", + "path": "github.com/byzantine-lab/dexon-consensus/core/blockdb", "revision": "56e872f84131348adbc0861afb3554bba4a8e5db", "revisionTime": "2018-12-05T06:29:54Z", "version": "master", "versionExact": "master" }, { - "checksumSHA1": "tQSbYCu5P00lUhKsx3IbBZCuSLY=", - "path": "github.com/dexon-foundation/dexon-consensus/core/crypto", - "revision": "42d585f1e5c9420f15b1d7333e7874a04345cc36", - "revisionTime": "2019-05-06T04:02:43Z", + "checksumSHA1": "Ta8d9OKIAYDXuh32bHFyqdAzhEM=", + "origin": "gitlab.com/byzantine-lab/dexon-consensus/core/crypto", + "path": "github.com/byzantine-lab/dexon-consensus/core/crypto", + "revision": "f05d9c34d6595ebced2de25d9b436f3aac35a53f", + "revisionTime": "2019-06-10T16:05:10Z", "version": "master", "versionExact": "master" }, { - "checksumSHA1": "4besQaa0rm8jRUAJjpEaLZ/ZOYs=", - "path": "github.com/dexon-foundation/dexon-consensus/core/crypto/dkg", - "revision": "42d585f1e5c9420f15b1d7333e7874a04345cc36", - "revisionTime": "2019-05-06T04:02:43Z", + "checksumSHA1": "haQqxxRfx8Tk8dhuilDmDMZ6rO8=", + "origin": "gitlab.com/byzantine-lab/dexon-consensus/core/crypto/dkg", + "path": "github.com/byzantine-lab/dexon-consensus/core/crypto/dkg", + "revision": "f05d9c34d6595ebced2de25d9b436f3aac35a53f", + "revisionTime": "2019-06-10T16:05:10Z", "version": "master", "versionExact": "master" }, { - "checksumSHA1": "BhLKK8RveoLaeXc9UyUKMwQqchU=", - "path": "github.com/dexon-foundation/dexon-consensus/core/crypto/ecdsa", - "revision": "42d585f1e5c9420f15b1d7333e7874a04345cc36", - "revisionTime": "2019-05-06T04:02:43Z", + "checksumSHA1": "0Tj49Z4zfOogG6lEnMaZae11/1s=", + "origin": "gitlab.com/byzantine-lab/dexon-consensus/core/crypto/ecdsa", + "path": "github.com/byzantine-lab/dexon-consensus/core/crypto/ecdsa", + "revision": "f05d9c34d6595ebced2de25d9b436f3aac35a53f", + "revisionTime": "2019-06-10T16:05:10Z", "version": "master", "versionExact": "master" }, { - "checksumSHA1": "3Ludp/1V4dMBZH/c1oIVjHj0CqY=", - "path": "github.com/dexon-foundation/dexon-consensus/core/db", - "revision": "42d585f1e5c9420f15b1d7333e7874a04345cc36", - "revisionTime": "2019-05-06T04:02:43Z", + "checksumSHA1": "J2Lgj2veHRGtHlfXFyzrM4qnKow=", + "origin": "gitlab.com/byzantine-lab/dexon-consensus/core/db", + "path": "github.com/byzantine-lab/dexon-consensus/core/db", + "revision": "f05d9c34d6595ebced2de25d9b436f3aac35a53f", + "revisionTime": "2019-06-10T16:05:10Z", "version": "master", "versionExact": "master" }, { - "checksumSHA1": "oi/m368rTLcDsKxpP3RnYLnHVqg=", - "path": "github.com/dexon-foundation/dexon-consensus/core/syncer", - "revision": "42d585f1e5c9420f15b1d7333e7874a04345cc36", - "revisionTime": "2019-05-06T04:02:43Z", + "checksumSHA1": "6VjD99+YZ1DN86I3qg/nKklpT58=", + "origin": "gitlab.com/byzantine-lab/dexon-consensus/core/syncer", + "path": "github.com/byzantine-lab/dexon-consensus/core/syncer", + "revision": "f05d9c34d6595ebced2de25d9b436f3aac35a53f", + "revisionTime": "2019-06-10T16:05:10Z", "version": "master", "versionExact": "master" }, { - "checksumSHA1": "0BY+E0E2cM7IHIMqunXwoolDS5Y=", - "path": "github.com/dexon-foundation/dexon-consensus/core/types", - "revision": "42d585f1e5c9420f15b1d7333e7874a04345cc36", - "revisionTime": "2019-05-06T04:02:43Z", + "checksumSHA1": "gSe2rW85N3hdJ8B10xcHboUJq8g=", + "origin": "gitlab.com/byzantine-lab/dexon-consensus/core/types", + "path": "github.com/byzantine-lab/dexon-consensus/core/types", + "revision": "f05d9c34d6595ebced2de25d9b436f3aac35a53f", + "revisionTime": "2019-06-10T16:05:10Z", "version": "master", "versionExact": "master" }, { - "checksumSHA1": "yEPSfn48GaJmDbd2OFY+QRhjJ0w=", - "path": "github.com/dexon-foundation/dexon-consensus/core/types/dkg", - "revision": "42d585f1e5c9420f15b1d7333e7874a04345cc36", - "revisionTime": "2019-05-06T04:02:43Z", + "checksumSHA1": "R6k6vmgePKuYJlQgA05kh9HqCx8=", + "origin": "gitlab.com/byzantine-lab/dexon-consensus/core/types/dkg", + "path": "github.com/byzantine-lab/dexon-consensus/core/types/dkg", + "revision": "f05d9c34d6595ebced2de25d9b436f3aac35a53f", + "revisionTime": "2019-06-10T16:05:10Z", "version": "master", "versionExact": "master" }, { - "checksumSHA1": "51hQ5Wl/n9A5cu8t2yNIqfUuIR8=", - "path": "github.com/dexon-foundation/dexon-consensus/core/utils", - "revision": "42d585f1e5c9420f15b1d7333e7874a04345cc36", - "revisionTime": "2019-05-06T04:02:43Z", + "checksumSHA1": "orcvISLeKABwd4AGsC2jAMQkd04=", + "origin": "gitlab.com/byzantine-lab/dexon-consensus/core/utils", + "path": "github.com/byzantine-lab/dexon-consensus/core/utils", + "revision": "f05d9c34d6595ebced2de25d9b436f3aac35a53f", + "revisionTime": "2019-06-10T16:05:10Z", "version": "master", "versionExact": "master" }, { - "checksumSHA1": "TAkwduKZqLyimyTPPWIllZWYFuE=", - "path": "github.com/dexon-foundation/mcl", - "revision": "151f876c92eaa7705f1203791a16cc517bd2d940", - "revisionTime": "2018-10-23T00:43:37Z" + "checksumSHA1": "cDMtzKmdTx4CcIpP4broa+16X9g=", + "path": "github.com/cespare/cp", + "revision": "165db2f241fd235aec29ba6d9b1ccd5f1c14637c", + "revisionTime": "2015-01-22T07:26:53Z" + }, + { + "checksumSHA1": "7gK+lSShSu1NRw83/A95BcgMqsI=", + "path": "github.com/codahale/hdrhistogram", + "revision": "3a0bb77429bd3a61596f5e8a3172445844342120", + "revisionTime": "2016-10-10T02:54:55Z" + }, + { + "checksumSHA1": "dvabztWVQX8f6oMLRyv4dLH+TGY=", + "path": "github.com/davecgh/go-spew/spew", + "revision": "346938d642f2ec3594ed81d874461961cd0faa76", + "revisionTime": "2016-10-29T20:57:26Z" + }, + { + "checksumSHA1": "1xK7ycc1ICRInk/S9iiyB9Rpv50=", + "path": "github.com/deckarep/golang-set", + "revision": "504e848d77ea4752b3057b8fb46da0e7f746ccf3", + "revisionTime": "2018-06-03T19:32:48Z" }, { "checksumSHA1": "2Fy1Y6Z3lRRX1891WF/+HT4XS2I=", @@ -263,10 +258,34 @@ "revisionTime": "2018-01-22T22:25:45Z" }, { + "checksumSHA1": "dZshPS4Pesrg9ubQ+1jT/MAfF9o=", + "path": "github.com/ethereum/go-ethereum/common", + "revision": "50e3795eef884ce8c5ae41ee31c7a4fa40196755", + "revisionTime": "2019-06-12T07:22:34Z" + }, + { + "checksumSHA1": "tvdkin+xdCuyH0IPqxbrHYGL1gc=", + "path": "github.com/ethereum/go-ethereum/common/hexutil", + "revision": "50e3795eef884ce8c5ae41ee31c7a4fa40196755", + "revisionTime": "2019-06-12T07:22:34Z" + }, + { + "checksumSHA1": "DHETzc73aN40YHhMczku7MQV1iE=", + "path": "github.com/ethereum/go-ethereum/common/math", + "revision": "50e3795eef884ce8c5ae41ee31c7a4fa40196755", + "revisionTime": "2019-06-12T07:22:34Z" + }, + { "checksumSHA1": "09V3eE1EhOkdfksyjsH+03c5fQg=", "path": "github.com/ethereum/go-ethereum/crypto/secp256k1", - "revision": "78ec90717aaa34c6ac981e791ca7fb04077cca33", - "revisionTime": "2019-04-17T12:50:41Z" + "revision": "32dafea1f0aeae72a424126195d1a3bb1d832eea", + "revisionTime": "2019-06-12T10:08:42Z" + }, + { + "checksumSHA1": "QNmhEac8r360UlJqrw8w9cJioVI=", + "path": "github.com/ethereum/go-ethereum/rlp", + "revision": "50e3795eef884ce8c5ae41ee31c7a4fa40196755", + "revisionTime": "2019-06-12T07:22:34Z" }, { "checksumSHA1": "7oFpbmDfGobwKsFLIf6wMUvVoKw=", @@ -655,7 +674,7 @@ "revisionTime": "2018-10-09T18:43:15Z" }, { - "checksumSHA1": "k6zbR5hiI10hkWtiK91rIY5s5/E=", + "checksumSHA1": "LV0VMVON7xY1ttV+s2ph83ntmDQ=", "path": "github.com/syndtr/goleveldb/leveldb", "revision": "b001fa50d6b27f3f0bb175a87d0cb55426d0a0ae", "revisionTime": "2018-11-28T10:09:59Z" @@ -1632,5 +1651,5 @@ "revisionTime": "2017-08-11T01:42:03Z" } ], - "rootPath": "github.com/dexon-foundation/dexon" + "rootPath": "github.com/tangerine-network/go-tangerine" } |