├── Godeps ├── _workspace │ ├── .gitignore │ └── src │ │ ├── github.com │ │ ├── ethereum │ │ │ └── go-ethereum │ │ │ │ ├── crypto │ │ │ │ ├── secp256k1 │ │ │ │ │ ├── libsecp256k1 │ │ │ │ │ │ ├── obj │ │ │ │ │ │ │ └── .gitignore │ │ │ │ │ │ ├── autogen.sh │ │ │ │ │ │ ├── TODO │ │ │ │ │ │ ├── src │ │ │ │ │ │ │ ├── modules │ │ │ │ │ │ │ │ ├── ecdh │ │ │ │ │ │ │ │ │ ├── Makefile.am.include │ │ │ │ │ │ │ │ │ └── main_impl.h │ │ │ │ │ │ │ │ └── recovery │ │ │ │ │ │ │ │ │ └── Makefile.am.include │ │ │ │ │ │ │ ├── java │ │ │ │ │ │ │ │ ├── org_bitcoin_Secp256k1Context.c │ │ │ │ │ │ │ │ ├── org_bitcoin_Secp256k1Context.h │ │ │ │ │ │ │ │ └── org │ │ │ │ │ │ │ │ │ └── bitcoin │ │ │ │ │ │ │ │ │ ├── NativeSecp256k1Util.java │ │ │ │ │ │ │ │ │ └── Secp256k1Context.java │ │ │ │ │ │ │ ├── scalar_low.h │ │ │ │ │ │ │ ├── ecmult_const.h │ │ │ │ │ │ │ ├── num_gmp.h │ │ │ │ │ │ │ ├── num_impl.h │ │ │ │ │ │ │ ├── scalar_8x32.h │ │ │ │ │ │ │ ├── scalar_4x64.h │ │ │ │ │ │ │ ├── basic-config.h │ │ │ │ │ │ │ ├── ecdsa.h │ │ │ │ │ │ │ ├── eckey.h │ │ │ │ │ │ │ ├── ecmult.h │ │ │ │ │ │ │ ├── testrand.h │ │ │ │ │ │ │ ├── bench_sign.c │ │ │ │ │ │ │ ├── hash.h │ │ │ │ │ │ │ ├── bench_ecdh.c │ │ │ │ │ │ │ ├── field_5x52.h │ │ │ │ │ │ │ ├── bench.h │ │ │ │ │ │ │ ├── field_10x26.h │ │ │ │ │ │ │ ├── bench_recover.c │ │ │ │ │ │ │ └── ecmult_gen.h │ │ │ │ │ │ ├── libsecp256k1.pc.in │ │ │ │ │ │ ├── .gitignore │ │ │ │ │ │ ├── COPYING │ │ │ │ │ │ └── include │ │ │ │ │ │ │ └── secp256k1_ecdh.h │ │ │ │ │ ├── .gitignore │ │ │ │ │ └── panic_cb.go │ │ │ │ ├── sha3 │ │ │ │ │ ├── keccakf_amd64.go │ │ │ │ │ ├── xor.go │ │ │ │ │ ├── register.go │ │ │ │ │ ├── xor_generic.go │ │ │ │ │ ├── xor_unaligned.go │ │ │ │ │ ├── PATENTS │ │ │ │ │ ├── LICENSE │ │ │ │ │ └── shake.go │ │ │ │ └── bn256 │ │ │ │ │ ├── cloudflare │ │ │ │ │ ├── gfp_decl.go │ │ │ │ │ └── gfp.go │ │ │ │ │ ├── bn256_slow.go │ │ │ │ │ └── bn256_fast.go │ │ │ │ ├── metrics │ │ │ │ ├── FORK.md │ │ │ │ ├── runtime_no_cgo.go │ │ │ │ ├── runtime_cgo.go │ │ │ │ ├── runtime_no_gccpufraction.go │ │ │ │ ├── runtime_gccpufraction.go │ │ │ │ ├── validate.sh │ │ │ │ ├── json.go │ │ │ │ ├── disk_nop.go │ │ │ │ ├── disk.go │ │ │ │ ├── LICENSE │ │ │ │ ├── healthcheck.go │ │ │ │ ├── disk_linux.go │ │ │ │ └── syslog.go │ │ │ │ ├── log │ │ │ │ ├── CONTRIBUTORS │ │ │ │ ├── README_ETHEREUM.md │ │ │ │ ├── handler_go14.go │ │ │ │ ├── LICENSE │ │ │ │ ├── handler_go13.go │ │ │ │ ├── root.go │ │ │ │ └── syslog.go │ │ │ │ ├── ethdb │ │ │ │ ├── .gitignore │ │ │ │ └── interface.go │ │ │ │ ├── common │ │ │ │ ├── big.go │ │ │ │ ├── format.go │ │ │ │ ├── path.go │ │ │ │ ├── size.go │ │ │ │ ├── test_utils.go │ │ │ │ ├── debug.go │ │ │ │ └── types_template.go │ │ │ │ ├── params │ │ │ │ ├── network_params.go │ │ │ │ ├── denomination.go │ │ │ │ ├── version.go │ │ │ │ └── gas_table.go │ │ │ │ ├── accounts │ │ │ │ └── abi │ │ │ │ │ ├── doc.go │ │ │ │ │ ├── event.go │ │ │ │ │ └── numbers.go │ │ │ │ ├── trie │ │ │ │ └── errors.go │ │ │ │ └── rlp │ │ │ │ └── doc.go │ │ ├── rcrowley │ │ │ └── go-metrics │ │ │ │ ├── runtime_no_cgo.go │ │ │ │ ├── .gitignore │ │ │ │ ├── runtime_cgo.go │ │ │ │ ├── runtime_no_gccpufraction.go │ │ │ │ ├── runtime_gccpufraction.go │ │ │ │ ├── validate.sh │ │ │ │ ├── .travis.yml │ │ │ │ ├── metrics.go │ │ │ │ ├── json.go │ │ │ │ ├── LICENSE │ │ │ │ ├── healthcheck.go │ │ │ │ └── syslog.go │ │ ├── go-stack │ │ │ └── stack │ │ │ │ ├── .travis.yml │ │ │ │ ├── LICENSE.md │ │ │ │ └── README.md │ │ ├── hashicorp │ │ │ └── golang-lru │ │ │ │ ├── .gitignore │ │ │ │ ├── README.md │ │ │ │ ├── doc.go │ │ │ │ └── simplelru │ │ │ │ └── lru_interface.go │ │ ├── golang │ │ │ └── snappy │ │ │ │ ├── decode_amd64.go │ │ │ │ ├── .gitignore │ │ │ │ ├── AUTHORS │ │ │ │ ├── encode_amd64.go │ │ │ │ ├── CONTRIBUTORS │ │ │ │ └── LICENSE │ │ ├── syndtr │ │ │ └── goleveldb │ │ │ │ ├── leveldb │ │ │ │ ├── errors.go │ │ │ │ ├── storage │ │ │ │ │ ├── file_storage_nacl.go │ │ │ │ │ ├── file_storage_plan9.go │ │ │ │ │ ├── file_storage_solaris.go │ │ │ │ │ ├── file_storage_unix.go │ │ │ │ │ └── file_storage_windows.go │ │ │ │ ├── filter.go │ │ │ │ ├── util │ │ │ │ │ ├── crc32.go │ │ │ │ │ ├── range.go │ │ │ │ │ ├── hash.go │ │ │ │ │ └── util.go │ │ │ │ ├── comparer │ │ │ │ │ ├── bytes_comparer.go │ │ │ │ │ └── comparer.go │ │ │ │ ├── storage.go │ │ │ │ ├── comparer.go │ │ │ │ ├── util.go │ │ │ │ ├── errors │ │ │ │ │ └── errors.go │ │ │ │ └── filter │ │ │ │ │ └── filter.go │ │ │ │ └── LICENSE │ │ ├── davecgh │ │ │ └── go-spew │ │ │ │ ├── LICENSE │ │ │ │ └── spew │ │ │ │ └── bypasssafe.go │ │ └── btcsuite │ │ │ └── btcd │ │ │ ├── LICENSE │ │ │ └── btcec │ │ │ ├── doc.go │ │ │ ├── genprecomps.go │ │ │ └── precompute.go │ │ ├── golang.org │ │ └── x │ │ │ └── crypto │ │ │ ├── AUTHORS │ │ │ ├── CONTRIBUTORS │ │ │ ├── PATENTS │ │ │ └── LICENSE │ │ └── gopkg.in │ │ └── karalabe │ │ └── cookiejar.v2 │ │ ├── LICENSE │ │ └── collections │ │ └── prque │ │ └── prque.go └── Readme ├── Makefile.fake ├── examples ├── sum │ ├── sum.sol │ ├── sum_sol_sum.abi │ └── sum_sol_sum.bin └── event │ ├── coin_sol_Coin.abi │ ├── coin.sol │ ├── main_statedb.go │ └── coin_sol_Coin.bin ├── vm ├── runtime │ ├── doc.go │ ├── runtime_example_test.go │ ├── fuzz.go │ └── env.go ├── int_pool_verifier_empty.go ├── doc.go ├── int_pool_verifier.go ├── gas_table_test.go ├── errors.go ├── stack_table.go ├── gas.go └── intpool.go ├── state ├── main_test.go ├── sync.go └── iterator_test.go ├── types ├── derive_sha.go └── bloom9_test.go └── core └── message.go /Godeps/_workspace/.gitignore: -------------------------------------------------------------------------------- 1 | /pkg 2 | /bin 3 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/obj/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Makefile.fake: -------------------------------------------------------------------------------- 1 | all: 2 | #GDB enabled 3 | go build -gcflags "-N -l" -ldflags -s main.go 4 | .PHONY : all 5 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | autoreconf -if --warnings=all 4 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/metrics/FORK.md: -------------------------------------------------------------------------------- 1 | This repo has been forked from https://github.com/rcrowley/go-metrics at commit e181e09 2 | -------------------------------------------------------------------------------- /examples/sum/sum.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.20; 2 | contract sum { 3 | function multiply(uint a) returns(uint d) { 4 | return a * 7; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Godeps/Readme: -------------------------------------------------------------------------------- 1 | This directory tree is generated automatically by godep. 2 | 3 | Please do not edit. 4 | 5 | See https://github.com/tools/godep for more information. 6 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/rcrowley/go-metrics/runtime_no_cgo.go: -------------------------------------------------------------------------------- 1 | // +build !cgo appengine 2 | 3 | package metrics 4 | 5 | func numCgoCall() int64 { 6 | return 0 7 | } 8 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/metrics/runtime_no_cgo.go: -------------------------------------------------------------------------------- 1 | // +build !cgo appengine 2 | 3 | package metrics 4 | 5 | func numCgoCall() int64 { 6 | return 0 7 | } 8 | -------------------------------------------------------------------------------- /examples/sum/sum_sol_sum.abi: -------------------------------------------------------------------------------- 1 | [{"constant":false,"inputs":[{"name":"a","type":"uint256"}],"name":"multiply","outputs":[{"name":"d","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"}] -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/crypto/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at https://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/crypto/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at https://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/rcrowley/go-metrics/.gitignore: -------------------------------------------------------------------------------- 1 | *.[68] 2 | *.a 3 | *.out 4 | *.swp 5 | _obj 6 | _testmain.go 7 | cmd/metrics-bench/metrics-bench 8 | cmd/metrics-example/metrics-example 9 | cmd/never-read/never-read 10 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/rcrowley/go-metrics/runtime_cgo.go: -------------------------------------------------------------------------------- 1 | // +build cgo 2 | // +build !appengine 3 | 4 | package metrics 5 | 6 | import "runtime" 7 | 8 | func numCgoCall() int64 { 9 | return runtime.NumCgoCall() 10 | } 11 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/rcrowley/go-metrics/runtime_no_gccpufraction.go: -------------------------------------------------------------------------------- 1 | // +build !go1.5 2 | 3 | package metrics 4 | 5 | import "runtime" 6 | 7 | func gcCPUFraction(memStats *runtime.MemStats) float64 { 8 | return 0 9 | } 10 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/TODO: -------------------------------------------------------------------------------- 1 | * Unit tests for fieldelem/groupelem, including ones intended to 2 | trigger fieldelem's boundary cases. 3 | * Complete constant-time operations for signing/keygen 4 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/metrics/runtime_cgo.go: -------------------------------------------------------------------------------- 1 | // +build cgo 2 | // +build !appengine 3 | 4 | package metrics 5 | 6 | import "runtime" 7 | 8 | func numCgoCall() int64 { 9 | return runtime.NumCgoCall() 10 | } 11 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/metrics/runtime_no_gccpufraction.go: -------------------------------------------------------------------------------- 1 | // +build !go1.5 2 | 3 | package metrics 4 | 5 | import "runtime" 6 | 7 | func gcCPUFraction(memStats *runtime.MemStats) float64 { 8 | return 0 9 | } 10 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/rcrowley/go-metrics/runtime_gccpufraction.go: -------------------------------------------------------------------------------- 1 | // +build go1.5 2 | 3 | package metrics 4 | 5 | import "runtime" 6 | 7 | func gcCPUFraction(memStats *runtime.MemStats) float64 { 8 | return memStats.GCCPUFraction 9 | } 10 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/metrics/runtime_gccpufraction.go: -------------------------------------------------------------------------------- 1 | // +build go1.5 2 | 3 | package metrics 4 | 5 | import "runtime" 6 | 7 | func gcCPUFraction(memStats *runtime.MemStats) float64 { 8 | return memStats.GCCPUFraction 9 | } 10 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/go-stack/stack/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | sudo: false 3 | go: 4 | - 1.7 5 | - 1.8 6 | - 1.9 7 | - tip 8 | 9 | before_install: 10 | - go get github.com/mattn/goveralls 11 | 12 | script: 13 | - goveralls -service=travis-ci 14 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/log/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | Contributors to log15: 2 | 3 | - Aaron L 4 | - Alan Shreve 5 | - Chris Hines 6 | - Ciaran Downey 7 | - Dmitry Chestnykh 8 | - Evan Shaw 9 | - Péter Szilágyi 10 | - Trevor Gattis 11 | - Vincent Vanackere 12 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/log/README_ETHEREUM.md: -------------------------------------------------------------------------------- 1 | This package is a fork of https://github.com/inconshreveable/log15, with some 2 | minor modifications required by the go-ethereum codebase: 3 | 4 | * Support for log level `trace` 5 | * Modified behavior to exit on `critical` failure 6 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/rcrowley/go-metrics/validate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | # check there are no formatting issues 6 | GOFMT_LINES=`gofmt -l . | wc -l | xargs` 7 | test $GOFMT_LINES -eq 0 || echo "gofmt needs to be run, ${GOFMT_LINES} files have issues" 8 | 9 | # run the tests for the root package 10 | go test -race . 11 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/metrics/validate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | # check there are no formatting issues 6 | GOFMT_LINES=`gofmt -l . | wc -l | xargs` 7 | test $GOFMT_LINES -eq 0 || echo "gofmt needs to be run, ${GOFMT_LINES} files have issues" 8 | 9 | # run the tests for the root package 10 | go test -race . 11 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/rcrowley/go-metrics/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.2 5 | - 1.3 6 | - 1.4 7 | - 1.5 8 | - 1.6 9 | - 1.7 10 | - 1.8 11 | - 1.9 12 | 13 | script: 14 | - ./validate.sh 15 | 16 | # this should give us faster builds according to 17 | # http://docs.travis-ci.com/user/migrating-from-legacy/ 18 | sudo: false 19 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/hashicorp/golang-lru/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | -------------------------------------------------------------------------------- /examples/sum/sum_sol_sum.bin: -------------------------------------------------------------------------------- 1 | 6060604052341561000f57600080fd5b60b18061001d6000396000f300606060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063c6888fa1146044575b600080fd5b3415604e57600080fd5b606260048080359060200190919050506078565b6040518082815260200191505060405180910390f35b60006007820290509190505600a165627a7a723058205c6811eb58f028a4815fd092a9b5fd95779d7c3e2e43dfbfe1b304f4672e2c180029 -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/src/modules/ecdh/Makefile.am.include: -------------------------------------------------------------------------------- 1 | include_HEADERS += include/secp256k1_ecdh.h 2 | noinst_HEADERS += src/modules/ecdh/main_impl.h 3 | noinst_HEADERS += src/modules/ecdh/tests_impl.h 4 | if USE_BENCHMARK 5 | noinst_PROGRAMS += bench_ecdh 6 | bench_ecdh_SOURCES = src/bench_ecdh.c 7 | bench_ecdh_LDADD = libsecp256k1.la $(SECP_LIBS) $(COMMON_LIB) 8 | endif 9 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | 24 | *~ 25 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/sha3/keccakf_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,!appengine,!gccgo 6 | 7 | package sha3 8 | 9 | // This function is implemented in keccakf_amd64.s. 10 | 11 | //go:noescape 12 | 13 | func keccakF1600(state *[25]uint64) 14 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/ethdb/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile ~/.gitignore_global 6 | 7 | /tmp 8 | */**/*un~ 9 | *un~ 10 | .DS_Store 11 | */**/.DS_Store 12 | 13 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/src/modules/recovery/Makefile.am.include: -------------------------------------------------------------------------------- 1 | include_HEADERS += include/secp256k1_recovery.h 2 | noinst_HEADERS += src/modules/recovery/main_impl.h 3 | noinst_HEADERS += src/modules/recovery/tests_impl.h 4 | if USE_BENCHMARK 5 | noinst_PROGRAMS += bench_recover 6 | bench_recover_SOURCES = src/bench_recover.c 7 | bench_recover_LDADD = libsecp256k1.la $(SECP_LIBS) $(COMMON_LIB) 8 | endif 9 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/golang/snappy/decode_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Snappy-Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !appengine 6 | // +build gc 7 | // +build !noasm 8 | 9 | package snappy 10 | 11 | // decode has the same semantics as in decode_other.go. 12 | // 13 | //go:noescape 14 | func decode(dst, src []byte) int 15 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/libsecp256k1.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: libsecp256k1 7 | Description: Optimized C library for EC operations on curve secp256k1 8 | URL: https://github.com/bitcoin-core/secp256k1 9 | Version: @PACKAGE_VERSION@ 10 | Cflags: -I${includedir} 11 | Libs.private: @SECP_LIBS@ 12 | Libs: -L${libdir} -lsecp256k1 13 | 14 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/golang/snappy/.gitignore: -------------------------------------------------------------------------------- 1 | cmd/snappytool/snappytool 2 | testdata/bench 3 | 4 | # These explicitly listed benchmark data files are for an obsolete version of 5 | # snappy_test.go. 6 | testdata/alice29.txt 7 | testdata/asyoulik.txt 8 | testdata/fireworks.jpeg 9 | testdata/geo.protodata 10 | testdata/html 11 | testdata/html_x_4 12 | testdata/kppkn.gtb 13 | testdata/lcet10.txt 14 | testdata/paper-100k.pdf 15 | testdata/plrabn12.txt 16 | testdata/urls.10K 17 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/bn256/cloudflare/gfp_decl.go: -------------------------------------------------------------------------------- 1 | // +build amd64,!generic arm64,!generic 2 | 3 | package bn256 4 | 5 | // This file contains forward declarations for the architecture-specific 6 | // assembly implementations of these functions, provided that they exist. 7 | 8 | // go:noescape 9 | func gfpNeg(c, a *gfP) 10 | 11 | //go:noescape 12 | func gfpAdd(c, a, b *gfP) 13 | 14 | //go:noescape 15 | func gfpSub(c, a, b *gfP) 16 | 17 | //go:noescape 18 | func gfpMul(c, a, b *gfP) 19 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/sha3/xor.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !amd64,!386,!ppc64le appengine 6 | 7 | package sha3 8 | 9 | var ( 10 | xorIn = xorInGeneric 11 | copyOut = copyOutGeneric 12 | xorInUnaligned = xorInGeneric 13 | copyOutUnaligned = copyOutGeneric 14 | ) 15 | 16 | const xorImplementationUnaligned = "generic" 17 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/sha3/register.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build go1.4 6 | 7 | package sha3 8 | 9 | import ( 10 | "crypto" 11 | ) 12 | 13 | func init() { 14 | crypto.RegisterHash(crypto.SHA3_224, New224) 15 | crypto.RegisterHash(crypto.SHA3_256, New256) 16 | crypto.RegisterHash(crypto.SHA3_384, New384) 17 | crypto.RegisterHash(crypto.SHA3_512, New512) 18 | } 19 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/rcrowley/go-metrics/metrics.go: -------------------------------------------------------------------------------- 1 | // Go port of Coda Hale's Metrics library 2 | // 3 | // 4 | // 5 | // Coda Hale's original work: 6 | package metrics 7 | 8 | // UseNilMetrics is checked by the constructor functions for all of the 9 | // standard metrics. If it is true, the metric returned is a stub. 10 | // 11 | // This global kill-switch helps quantify the observer effect and makes 12 | // for less cluttered pprof profiles. 13 | var UseNilMetrics bool = false 14 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/src/java/org_bitcoin_Secp256k1Context.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "org_bitcoin_Secp256k1Context.h" 4 | #include "include/secp256k1.h" 5 | 6 | SECP256K1_API jlong JNICALL Java_org_bitcoin_Secp256k1Context_secp256k1_1init_1context 7 | (JNIEnv* env, jclass classObject) 8 | { 9 | secp256k1_context *ctx = secp256k1_context_create(SECP256K1_CONTEXT_SIGN | SECP256K1_CONTEXT_VERIFY); 10 | 11 | (void)classObject;(void)env; 12 | 13 | return (uintptr_t)ctx; 14 | } 15 | 16 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/golang/snappy/AUTHORS: -------------------------------------------------------------------------------- 1 | # This is the official list of Snappy-Go authors for copyright purposes. 2 | # This file is distinct from the CONTRIBUTORS files. 3 | # See the latter for an explanation. 4 | 5 | # Names should be added to this file as 6 | # Name or Organization 7 | # The email address is not required for organizations. 8 | 9 | # Please keep the list sorted. 10 | 11 | Damian Gryski 12 | Google Inc. 13 | Jan Mercl <0xjnml@gmail.com> 14 | Rodolfo Carvalho 15 | Sebastien Binet 16 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/hashicorp/golang-lru/README.md: -------------------------------------------------------------------------------- 1 | golang-lru 2 | ========== 3 | 4 | This provides the `lru` package which implements a fixed-size 5 | thread safe LRU cache. It is based on the cache in Groupcache. 6 | 7 | Documentation 8 | ============= 9 | 10 | Full docs are available on [Godoc](http://godoc.org/github.com/hashicorp/golang-lru) 11 | 12 | Example 13 | ======= 14 | 15 | Using the LRU is very simple: 16 | 17 | ```go 18 | l, _ := New(128) 19 | for i := 0; i < 256; i++ { 20 | l.Add(i, nil) 21 | } 22 | if l.Len() != 128 { 23 | panic(fmt.Sprintf("bad len: %v", l.Len())) 24 | } 25 | ``` 26 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/log/handler_go14.go: -------------------------------------------------------------------------------- 1 | // +build go1.4 2 | 3 | package log 4 | 5 | import "sync/atomic" 6 | 7 | // swapHandler wraps another handler that may be swapped out 8 | // dynamically at runtime in a thread-safe fashion. 9 | type swapHandler struct { 10 | handler atomic.Value 11 | } 12 | 13 | func (h *swapHandler) Log(r *Record) error { 14 | return (*h.handler.Load().(*Handler)).Log(r) 15 | } 16 | 17 | func (h *swapHandler) Swap(newHandler Handler) { 18 | h.handler.Store(&newHandler) 19 | } 20 | 21 | func (h *swapHandler) Get() Handler { 22 | return *h.handler.Load().(*Handler) 23 | } 24 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/log/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2014 Alan Shreve 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/log/handler_go13.go: -------------------------------------------------------------------------------- 1 | // +build !go1.4 2 | 3 | package log 4 | 5 | import ( 6 | "sync/atomic" 7 | "unsafe" 8 | ) 9 | 10 | // swapHandler wraps another handler that may be swapped out 11 | // dynamically at runtime in a thread-safe fashion. 12 | type swapHandler struct { 13 | handler unsafe.Pointer 14 | } 15 | 16 | func (h *swapHandler) Log(r *Record) error { 17 | return h.Get().Log(r) 18 | } 19 | 20 | func (h *swapHandler) Get() Handler { 21 | return *(*Handler)(atomic.LoadPointer(&h.handler)) 22 | } 23 | 24 | func (h *swapHandler) Swap(newHandler Handler) { 25 | atomic.StorePointer(&h.handler, unsafe.Pointer(&newHandler)) 26 | } 27 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/src/scalar_low.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Copyright (c) 2015 Andrew Poelstra * 3 | * Distributed under the MIT software license, see the accompanying * 4 | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* 5 | **********************************************************************/ 6 | 7 | #ifndef _SECP256K1_SCALAR_REPR_ 8 | #define _SECP256K1_SCALAR_REPR_ 9 | 10 | #include 11 | 12 | /** A scalar modulo the group order of the secp256k1 curve. */ 13 | typedef uint32_t secp256k1_scalar; 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/errors.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014, Suryandaru Triandana 2 | // All rights reserved. 3 | // 4 | // Use of this source code is governed by a BSD-style license that can be 5 | // found in the LICENSE file. 6 | 7 | package leveldb 8 | 9 | import ( 10 | "github.com/syndtr/goleveldb/leveldb/errors" 11 | ) 12 | 13 | // Common errors. 14 | var ( 15 | ErrNotFound = errors.ErrNotFound 16 | ErrReadOnly = errors.New("leveldb: read-only mode") 17 | ErrSnapshotReleased = errors.New("leveldb: snapshot released") 18 | ErrIterReleased = errors.New("leveldb: iterator released") 19 | ErrClosed = errors.New("leveldb: closed") 20 | ) 21 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/src/ecmult_const.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Copyright (c) 2015 Andrew Poelstra * 3 | * Distributed under the MIT software license, see the accompanying * 4 | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* 5 | **********************************************************************/ 6 | 7 | #ifndef _SECP256K1_ECMULT_CONST_ 8 | #define _SECP256K1_ECMULT_CONST_ 9 | 10 | #include "scalar.h" 11 | #include "group.h" 12 | 13 | static void secp256k1_ecmult_const(secp256k1_gej *r, const secp256k1_ge *a, const secp256k1_scalar *q); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/src/java/org_bitcoin_Secp256k1Context.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | #include "include/secp256k1.h" 4 | /* Header for class org_bitcoin_Secp256k1Context */ 5 | 6 | #ifndef _Included_org_bitcoin_Secp256k1Context 7 | #define _Included_org_bitcoin_Secp256k1Context 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | /* 12 | * Class: org_bitcoin_Secp256k1Context 13 | * Method: secp256k1_init_context 14 | * Signature: ()J 15 | */ 16 | SECP256K1_API jlong JNICALL Java_org_bitcoin_Secp256k1Context_secp256k1_1init_1context 17 | (JNIEnv *, jclass); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | #endif 23 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/src/num_gmp.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Copyright (c) 2013, 2014 Pieter Wuille * 3 | * Distributed under the MIT software license, see the accompanying * 4 | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* 5 | **********************************************************************/ 6 | 7 | #ifndef _SECP256K1_NUM_REPR_ 8 | #define _SECP256K1_NUM_REPR_ 9 | 10 | #include 11 | 12 | #define NUM_LIMBS ((256+GMP_NUMB_BITS-1)/GMP_NUMB_BITS) 13 | 14 | typedef struct { 15 | mp_limb_t data[2*NUM_LIMBS]; 16 | int neg; 17 | int limbs; 18 | } secp256k1_num; 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/davecgh/go-spew/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012-2013 Dave Collins 2 | 3 | Permission to use, copy, modify, and distribute this software for any 4 | purpose with or without fee is hereby granted, provided that the above 5 | copyright notice and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/src/num_impl.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Copyright (c) 2013, 2014 Pieter Wuille * 3 | * Distributed under the MIT software license, see the accompanying * 4 | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* 5 | **********************************************************************/ 6 | 7 | #ifndef _SECP256K1_NUM_IMPL_H_ 8 | #define _SECP256K1_NUM_IMPL_H_ 9 | 10 | #if defined HAVE_CONFIG_H 11 | #include "libsecp256k1-config.h" 12 | #endif 13 | 14 | #include "num.h" 15 | 16 | #if defined(USE_NUM_GMP) 17 | #include "num_gmp_impl.h" 18 | #elif defined(USE_NUM_NONE) 19 | /* Nothing. */ 20 | #else 21 | #error "Please select num implementation" 22 | #endif 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/src/scalar_8x32.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Copyright (c) 2014 Pieter Wuille * 3 | * Distributed under the MIT software license, see the accompanying * 4 | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* 5 | **********************************************************************/ 6 | 7 | #ifndef _SECP256K1_SCALAR_REPR_ 8 | #define _SECP256K1_SCALAR_REPR_ 9 | 10 | #include 11 | 12 | /** A scalar modulo the group order of the secp256k1 curve. */ 13 | typedef struct { 14 | uint32_t d[8]; 15 | } secp256k1_scalar; 16 | 17 | #define SECP256K1_SCALAR_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {{(d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7)}} 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/file_storage_nacl.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012, Suryandaru Triandana 2 | // All rights reserved. 3 | // 4 | // Use of this source code is governed by a BSD-style license that can be 5 | // found in the LICENSE file. 6 | 7 | // +build nacl 8 | 9 | package storage 10 | 11 | import ( 12 | "os" 13 | "syscall" 14 | ) 15 | 16 | func newFileLock(path string, readOnly bool) (fl fileLock, err error) { 17 | return nil, syscall.ENOTSUP 18 | } 19 | 20 | func setFileLock(f *os.File, readOnly, lock bool) error { 21 | return syscall.ENOTSUP 22 | } 23 | 24 | func rename(oldpath, newpath string) error { 25 | return syscall.ENOTSUP 26 | } 27 | 28 | func isErrInvalid(err error) bool { 29 | return false 30 | } 31 | 32 | func syncDir(name string) error { 33 | return syscall.ENOTSUP 34 | } 35 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/sha3/xor_generic.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package sha3 6 | 7 | import "encoding/binary" 8 | 9 | // xorInGeneric xors the bytes in buf into the state; it 10 | // makes no non-portable assumptions about memory layout 11 | // or alignment. 12 | func xorInGeneric(d *state, buf []byte) { 13 | n := len(buf) / 8 14 | 15 | for i := 0; i < n; i++ { 16 | a := binary.LittleEndian.Uint64(buf) 17 | d.a[i] ^= a 18 | buf = buf[8:] 19 | } 20 | } 21 | 22 | // copyOutGeneric copies ulint64s to a byte buffer. 23 | func copyOutGeneric(d *state, b []byte) { 24 | for i := 0; len(b) >= 8; i++ { 25 | binary.LittleEndian.PutUint64(b, d.a[i]) 26 | b = b[8:] 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/filter.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012, Suryandaru Triandana 2 | // All rights reserved. 3 | // 4 | // Use of this source code is governed by a BSD-style license that can be 5 | // found in the LICENSE file. 6 | 7 | package leveldb 8 | 9 | import ( 10 | "github.com/syndtr/goleveldb/leveldb/filter" 11 | ) 12 | 13 | type iFilter struct { 14 | filter.Filter 15 | } 16 | 17 | func (f iFilter) Contains(filter, key []byte) bool { 18 | return f.Filter.Contains(filter, internalKey(key).ukey()) 19 | } 20 | 21 | func (f iFilter) NewGenerator() filter.FilterGenerator { 22 | return iFilterGenerator{f.Filter.NewGenerator()} 23 | } 24 | 25 | type iFilterGenerator struct { 26 | filter.FilterGenerator 27 | } 28 | 29 | func (g iFilterGenerator) Add(key []byte) { 30 | g.FilterGenerator.Add(internalKey(key).ukey()) 31 | } 32 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util/crc32.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The LevelDB-Go Authors. All rights reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | 6 | package util 7 | 8 | import ( 9 | "hash/crc32" 10 | ) 11 | 12 | var table = crc32.MakeTable(crc32.Castagnoli) 13 | 14 | // CRC is a CRC-32 checksum computed using Castagnoli's polynomial. 15 | type CRC uint32 16 | 17 | // NewCRC creates a new crc based on the given bytes. 18 | func NewCRC(b []byte) CRC { 19 | return CRC(0).Update(b) 20 | } 21 | 22 | // Update updates the crc with the given bytes. 23 | func (c CRC) Update(b []byte) CRC { 24 | return CRC(crc32.Update(uint32(c), table, b)) 25 | } 26 | 27 | // Value returns a masked crc. 28 | func (c CRC) Value() uint32 { 29 | return uint32(c>>15|c<<17) + 0xa282ead8 30 | } 31 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/golang/snappy/encode_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Snappy-Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !appengine 6 | // +build gc 7 | // +build !noasm 8 | 9 | package snappy 10 | 11 | // emitLiteral has the same semantics as in encode_other.go. 12 | // 13 | //go:noescape 14 | func emitLiteral(dst, lit []byte) int 15 | 16 | // emitCopy has the same semantics as in encode_other.go. 17 | // 18 | //go:noescape 19 | func emitCopy(dst []byte, offset, length int) int 20 | 21 | // extendMatch has the same semantics as in encode_other.go. 22 | // 23 | //go:noescape 24 | func extendMatch(src []byte, i, j int) int 25 | 26 | // encodeBlock has the same semantics as in encode_other.go. 27 | // 28 | //go:noescape 29 | func encodeBlock(dst, src []byte) (d int) 30 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/btcsuite/btcd/LICENSE: -------------------------------------------------------------------------------- 1 | ISC License 2 | 3 | Copyright (c) 2013-2017 The btcsuite developers 4 | Copyright (c) 2015-2016 The Decred developers 5 | 6 | Permission to use, copy, modify, and distribute this software for any 7 | purpose with or without fee is hereby granted, provided that the above 8 | copyright notice and this permission notice appear in all copies. 9 | 10 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/src/scalar_4x64.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Copyright (c) 2014 Pieter Wuille * 3 | * Distributed under the MIT software license, see the accompanying * 4 | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* 5 | **********************************************************************/ 6 | 7 | #ifndef _SECP256K1_SCALAR_REPR_ 8 | #define _SECP256K1_SCALAR_REPR_ 9 | 10 | #include 11 | 12 | /** A scalar modulo the group order of the secp256k1 curve. */ 13 | typedef struct { 14 | uint64_t d[4]; 15 | } secp256k1_scalar; 16 | 17 | #define SECP256K1_SCALAR_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {{((uint64_t)(d1)) << 32 | (d0), ((uint64_t)(d3)) << 32 | (d2), ((uint64_t)(d5)) << 32 | (d4), ((uint64_t)(d7)) << 32 | (d6)}} 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/rcrowley/go-metrics/json.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | import ( 4 | "encoding/json" 5 | "io" 6 | "time" 7 | ) 8 | 9 | // MarshalJSON returns a byte slice containing a JSON representation of all 10 | // the metrics in the Registry. 11 | func (r *StandardRegistry) MarshalJSON() ([]byte, error) { 12 | return json.Marshal(r.GetAll()) 13 | } 14 | 15 | // WriteJSON writes metrics from the given registry periodically to the 16 | // specified io.Writer as JSON. 17 | func WriteJSON(r Registry, d time.Duration, w io.Writer) { 18 | for _ = range time.Tick(d) { 19 | WriteJSONOnce(r, w) 20 | } 21 | } 22 | 23 | // WriteJSONOnce writes metrics from the given registry to the specified 24 | // io.Writer as JSON. 25 | func WriteJSONOnce(r Registry, w io.Writer) { 26 | json.NewEncoder(w).Encode(r) 27 | } 28 | 29 | func (p *PrefixedRegistry) MarshalJSON() ([]byte, error) { 30 | return json.Marshal(p.GetAll()) 31 | } 32 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/metrics/json.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | import ( 4 | "encoding/json" 5 | "io" 6 | "time" 7 | ) 8 | 9 | // MarshalJSON returns a byte slice containing a JSON representation of all 10 | // the metrics in the Registry. 11 | func (r *StandardRegistry) MarshalJSON() ([]byte, error) { 12 | return json.Marshal(r.GetAll()) 13 | } 14 | 15 | // WriteJSON writes metrics from the given registry periodically to the 16 | // specified io.Writer as JSON. 17 | func WriteJSON(r Registry, d time.Duration, w io.Writer) { 18 | for range time.Tick(d) { 19 | WriteJSONOnce(r, w) 20 | } 21 | } 22 | 23 | // WriteJSONOnce writes metrics from the given registry to the specified 24 | // io.Writer as JSON. 25 | func WriteJSONOnce(r Registry, w io.Writer) { 26 | json.NewEncoder(w).Encode(r) 27 | } 28 | 29 | func (p *PrefixedRegistry) MarshalJSON() ([]byte, error) { 30 | return json.Marshal(p.GetAll()) 31 | } 32 | -------------------------------------------------------------------------------- /vm/runtime/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | // Package runtime provides a basic execution model for executing EVM code. 18 | package runtime 19 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util/range.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014, Suryandaru Triandana 2 | // All rights reserved. 3 | // 4 | // Use of this source code is governed by a BSD-style license that can be 5 | // found in the LICENSE file. 6 | 7 | package util 8 | 9 | // Range is a key range. 10 | type Range struct { 11 | // Start of the key range, include in the range. 12 | Start []byte 13 | 14 | // Limit of the key range, not include in the range. 15 | Limit []byte 16 | } 17 | 18 | // BytesPrefix returns key range that satisfy the given prefix. 19 | // This only applicable for the standard 'bytes comparer'. 20 | func BytesPrefix(prefix []byte) *Range { 21 | var limit []byte 22 | for i := len(prefix) - 1; i >= 0; i-- { 23 | c := prefix[i] 24 | if c < 0xff { 25 | limit = make([]byte, i+1) 26 | copy(limit, prefix) 27 | limit[i] = c + 1 28 | break 29 | } 30 | } 31 | return &Range{prefix, limit} 32 | } 33 | -------------------------------------------------------------------------------- /examples/event/coin_sol_Coin.abi: -------------------------------------------------------------------------------- 1 | [{"constant":true,"inputs":[],"name":"minter","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"balances","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"receiver","type":"address"},{"name":"amount","type":"uint256"}],"name":"mint","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"receiver","type":"address"},{"name":"amount","type":"uint256"}],"name":"send","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"from","type":"address"},{"indexed":false,"name":"to","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"Sent","type":"event"}] -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/.gitignore: -------------------------------------------------------------------------------- 1 | bench_inv 2 | bench_ecdh 3 | bench_sign 4 | bench_verify 5 | bench_schnorr_verify 6 | bench_recover 7 | bench_internal 8 | tests 9 | exhaustive_tests 10 | gen_context 11 | *.exe 12 | *.so 13 | *.a 14 | !.gitignore 15 | 16 | Makefile 17 | configure 18 | .libs/ 19 | Makefile.in 20 | aclocal.m4 21 | autom4te.cache/ 22 | config.log 23 | config.status 24 | *.tar.gz 25 | *.la 26 | libtool 27 | .deps/ 28 | .dirstamp 29 | *.lo 30 | *.o 31 | *~ 32 | src/libsecp256k1-config.h 33 | src/libsecp256k1-config.h.in 34 | src/ecmult_static_context.h 35 | build-aux/config.guess 36 | build-aux/config.sub 37 | build-aux/depcomp 38 | build-aux/install-sh 39 | build-aux/ltmain.sh 40 | build-aux/m4/libtool.m4 41 | build-aux/m4/lt~obsolete.m4 42 | build-aux/m4/ltoptions.m4 43 | build-aux/m4/ltsugar.m4 44 | build-aux/m4/ltversion.m4 45 | build-aux/missing 46 | build-aux/compile 47 | build-aux/test-driver 48 | src/stamp-h1 49 | libsecp256k1.pc 50 | -------------------------------------------------------------------------------- /state/main_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | package state 18 | 19 | import ( 20 | "testing" 21 | 22 | checker "gopkg.in/check.v1" 23 | ) 24 | 25 | func Test(t *testing.T) { checker.TestingT(t) } 26 | -------------------------------------------------------------------------------- /vm/int_pool_verifier_empty.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | // +build !VERIFY_EVM_INTEGER_POOL 18 | 19 | package vm 20 | 21 | const verifyPool = false 22 | 23 | func verifyIntegerPool(ip *intPool) {} 24 | -------------------------------------------------------------------------------- /examples/event/coin.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.20; //The lowest compiler version 2 | 3 | contract Coin { 4 | // The keyword "public" makes those variables 5 | // readable from outside. 6 | address public minter; 7 | mapping (address => uint) public balances; 8 | 9 | // Events allow light clients to react on 10 | // changes efficiently. 11 | event Sent(address from, address to, uint amount); 12 | 13 | // This is the constructor whose code is 14 | // run only when the contract is created. 15 | function Coin() public { 16 | minter = msg.sender; 17 | } 18 | 19 | function mint(address receiver, uint amount) public { 20 | if (msg.sender != minter) return; 21 | balances[receiver] += amount; 22 | } 23 | 24 | function send(address receiver, uint amount) public { 25 | if (balances[msg.sender] < amount) return ; 26 | balances[msg.sender] -= amount; 27 | balances[receiver] += amount; 28 | emit Sent(msg.sender, receiver, amount); 29 | } 30 | } 31 | 32 | 33 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/btcsuite/btcd/btcec/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2014 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | /* 6 | Package btcec implements support for the elliptic curves needed for bitcoin. 7 | 8 | Bitcoin uses elliptic curve cryptography using koblitz curves 9 | (specifically secp256k1) for cryptographic functions. See 10 | http://www.secg.org/collateral/sec2_final.pdf for details on the 11 | standard. 12 | 13 | This package provides the data structures and functions implementing the 14 | crypto/elliptic Curve interface in order to permit using these curves 15 | with the standard crypto/ecdsa package provided with go. Helper 16 | functionality is provided to parse signatures and public keys from 17 | standard formats. It was designed for use with btcd, but should be 18 | general enough for other uses of elliptic curve crypto. It was originally based 19 | on some initial work by ThePiachu, but has significantly diverged since then. 20 | */ 21 | package btcec 22 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/hashicorp/golang-lru/doc.go: -------------------------------------------------------------------------------- 1 | // Package lru provides three different LRU caches of varying sophistication. 2 | // 3 | // Cache is a simple LRU cache. It is based on the 4 | // LRU implementation in groupcache: 5 | // https://github.com/golang/groupcache/tree/master/lru 6 | // 7 | // TwoQueueCache tracks frequently used and recently used entries separately. 8 | // This avoids a burst of accesses from taking out frequently used entries, 9 | // at the cost of about 2x computational overhead and some extra bookkeeping. 10 | // 11 | // ARCCache is an adaptive replacement cache. It tracks recent evictions as 12 | // well as recent usage in both the frequent and recent caches. Its 13 | // computational overhead is comparable to TwoQueueCache, but the memory 14 | // overhead is linear with the size of the cache. 15 | // 16 | // ARC has been patented by IBM, so do not use it if that is problematic for 17 | // your program. 18 | // 19 | // All caches in this package take locks while operating, and are therefore 20 | // thread-safe for consumers. 21 | package lru 22 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util/hash.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012, Suryandaru Triandana 2 | // All rights reserved. 3 | // 4 | // Use of this source code is governed by a BSD-style license that can be 5 | // found in the LICENSE file. 6 | 7 | package util 8 | 9 | import ( 10 | "encoding/binary" 11 | ) 12 | 13 | // Hash return hash of the given data. 14 | func Hash(data []byte, seed uint32) uint32 { 15 | // Similar to murmur hash 16 | const ( 17 | m = uint32(0xc6a4a793) 18 | r = uint32(24) 19 | ) 20 | var ( 21 | h = seed ^ (uint32(len(data)) * m) 22 | i int 23 | ) 24 | 25 | for n := len(data) - len(data)%4; i < n; i += 4 { 26 | h += binary.LittleEndian.Uint32(data[i:]) 27 | h *= m 28 | h ^= (h >> 16) 29 | } 30 | 31 | switch len(data) - i { 32 | default: 33 | panic("not reached") 34 | case 3: 35 | h += uint32(data[i+2]) << 16 36 | fallthrough 37 | case 2: 38 | h += uint32(data[i+1]) << 8 39 | fallthrough 40 | case 1: 41 | h += uint32(data[i]) 42 | h *= m 43 | h ^= (h >> r) 44 | case 0: 45 | } 46 | 47 | return h 48 | } 49 | -------------------------------------------------------------------------------- /vm/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | /* 18 | Package vm implements the Ethereum Virtual Machine. 19 | 20 | The vm package implements one EVM, a byte code VM. The BC (Byte Code) VM loops 21 | over a set of bytes and executes them according to the set of rules defined 22 | in the Ethereum yellow paper. 23 | */ 24 | package vm 25 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/src/basic-config.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Copyright (c) 2013, 2014 Pieter Wuille * 3 | * Distributed under the MIT software license, see the accompanying * 4 | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* 5 | **********************************************************************/ 6 | 7 | #ifndef _SECP256K1_BASIC_CONFIG_ 8 | #define _SECP256K1_BASIC_CONFIG_ 9 | 10 | #ifdef USE_BASIC_CONFIG 11 | 12 | #undef USE_ASM_X86_64 13 | #undef USE_ENDOMORPHISM 14 | #undef USE_FIELD_10X26 15 | #undef USE_FIELD_5X52 16 | #undef USE_FIELD_INV_BUILTIN 17 | #undef USE_FIELD_INV_NUM 18 | #undef USE_NUM_GMP 19 | #undef USE_NUM_NONE 20 | #undef USE_SCALAR_4X64 21 | #undef USE_SCALAR_8X32 22 | #undef USE_SCALAR_INV_BUILTIN 23 | #undef USE_SCALAR_INV_NUM 24 | 25 | #define USE_NUM_NONE 1 26 | #define USE_FIELD_INV_BUILTIN 1 27 | #define USE_SCALAR_INV_BUILTIN 1 28 | #define USE_FIELD_10X26 1 29 | #define USE_SCALAR_8X32 1 30 | 31 | #endif // USE_BASIC_CONFIG 32 | #endif // _SECP256K1_BASIC_CONFIG_ 33 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/metrics/disk_nop.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | // +build !linux 18 | 19 | package metrics 20 | 21 | import "errors" 22 | 23 | // ReadDiskStats retrieves the disk IO stats belonging to the current process. 24 | func ReadDiskStats(stats *DiskStats) error { 25 | return errors.New("Not implemented") 26 | } 27 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/go-stack/stack/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Chris Hines 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Pieter Wuille 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/common/big.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | package common 18 | 19 | import "math/big" 20 | 21 | // Common big integers often used 22 | var ( 23 | Big1 = big.NewInt(1) 24 | Big2 = big.NewInt(2) 25 | Big3 = big.NewInt(3) 26 | Big0 = big.NewInt(0) 27 | Big32 = big.NewInt(32) 28 | Big256 = big.NewInt(256) 29 | Big257 = big.NewInt(257) 30 | ) 31 | -------------------------------------------------------------------------------- /vm/int_pool_verifier.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | // +build VERIFY_EVM_INTEGER_POOL 18 | 19 | package vm 20 | 21 | import "fmt" 22 | 23 | const verifyPool = true 24 | 25 | func verifyIntegerPool(ip *intPool) { 26 | for i, item := range ip.pool.data { 27 | if item.Cmp(checkVal) != 0 { 28 | panic(fmt.Sprintf("%d'th item failed aggressive pool check. Value was modified", i)) 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/params/network_params.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | package params 18 | 19 | // These are network parameters that need to be constant between clients, but 20 | // aren't necesarilly consensus related. 21 | 22 | const ( 23 | // BloomBitsBlocks is the number of blocks a single bloom bit section vector 24 | // contains. 25 | BloomBitsBlocks uint64 = 4096 26 | ) 27 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/include/secp256k1_ecdh.h: -------------------------------------------------------------------------------- 1 | #ifndef _SECP256K1_ECDH_ 2 | # define _SECP256K1_ECDH_ 3 | 4 | # include "secp256k1.h" 5 | 6 | # ifdef __cplusplus 7 | extern "C" { 8 | # endif 9 | 10 | /** Compute an EC Diffie-Hellman secret in constant time 11 | * Returns: 1: exponentiation was successful 12 | * 0: scalar was invalid (zero or overflow) 13 | * Args: ctx: pointer to a context object (cannot be NULL) 14 | * Out: result: a 32-byte array which will be populated by an ECDH 15 | * secret computed from the point and scalar 16 | * In: pubkey: a pointer to a secp256k1_pubkey containing an 17 | * initialized public key 18 | * privkey: a 32-byte scalar with which to multiply the point 19 | */ 20 | SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ecdh( 21 | const secp256k1_context* ctx, 22 | unsigned char *result, 23 | const secp256k1_pubkey *pubkey, 24 | const unsigned char *privkey 25 | ) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4); 26 | 27 | # ifdef __cplusplus 28 | } 29 | # endif 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/metrics/disk.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | package metrics 18 | 19 | // DiskStats is the per process disk io stats. 20 | type DiskStats struct { 21 | ReadCount int64 // Number of read operations executed 22 | ReadBytes int64 // Total number of bytes read 23 | WriteCount int64 // Number of write operations executed 24 | WriteBytes int64 // Total number of byte written 25 | } 26 | -------------------------------------------------------------------------------- /examples/event/main_statedb.go: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * 3 | * Copyright (c) 2017 Baidu.com, Inc. All Rights Reserved 4 | * @author duanbing(duanbing@baidu.com) 5 | * 6 | **************************************************************************/ 7 | 8 | /** 9 | * @filename main_statedb.go 10 | * @desc 11 | * @create time 2018-05-07 09:40:41 12 | **/ 13 | package main 14 | 15 | import ( 16 | //"github.com/duanbing/go-evm/state" 17 | "fmt" 18 | "github.com/ethereum/go-ethereum/common" 19 | "github.com/ethereum/go-ethereum/ethdb" 20 | "github.com/ethereum/go-ethereum/trie" 21 | ) 22 | 23 | func must(err error) { 24 | if err != nil { 25 | panic(err) 26 | } 27 | } 28 | 29 | func main() { 30 | mdb, err := ethdb.NewMemDatabase() 31 | tr, err := trie.New(common.Hash{}, mdb) 32 | must(err) 33 | key := []byte("abc") 34 | value := []byte("123") 35 | must(tr.TryUpdate(key, value)) 36 | 37 | key = []byte("ab") 38 | value = []byte("abc") 39 | must(tr.TryUpdate(key, value)) 40 | 41 | fmt.Println("----------") 42 | root, err := tr.Commit() 43 | must(err) 44 | tr2, err := trie.New(root, mdb) 45 | must(err) 46 | key = []byte("abcd") 47 | value = []byte("你好") 48 | must(tr2.TryUpdate(key, value)) 49 | } 50 | -------------------------------------------------------------------------------- /vm/runtime/runtime_example_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | package runtime_test 18 | 19 | import ( 20 | "fmt" 21 | 22 | "github.com/duanbing/go-evm/vm/runtime" 23 | "github.com/ethereum/go-ethereum/common" 24 | ) 25 | 26 | func ExampleExecute() { 27 | ret, _, err := runtime.Execute(common.Hex2Bytes("6060604052600a8060106000396000f360606040526008565b00"), nil, nil) 28 | if err != nil { 29 | fmt.Println(err) 30 | } 31 | fmt.Println(ret) 32 | // Output: 33 | // [96 96 96 64 82 96 8 86 91 0] 34 | } 35 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/src/ecdsa.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Copyright (c) 2013, 2014 Pieter Wuille * 3 | * Distributed under the MIT software license, see the accompanying * 4 | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* 5 | **********************************************************************/ 6 | 7 | #ifndef _SECP256K1_ECDSA_ 8 | #define _SECP256K1_ECDSA_ 9 | 10 | #include 11 | 12 | #include "scalar.h" 13 | #include "group.h" 14 | #include "ecmult.h" 15 | 16 | static int secp256k1_ecdsa_sig_parse(secp256k1_scalar *r, secp256k1_scalar *s, const unsigned char *sig, size_t size); 17 | static int secp256k1_ecdsa_sig_serialize(unsigned char *sig, size_t *size, const secp256k1_scalar *r, const secp256k1_scalar *s); 18 | static int secp256k1_ecdsa_sig_verify(const secp256k1_ecmult_context *ctx, const secp256k1_scalar* r, const secp256k1_scalar* s, const secp256k1_ge *pubkey, const secp256k1_scalar *message); 19 | static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, secp256k1_scalar* r, secp256k1_scalar* s, const secp256k1_scalar *seckey, const secp256k1_scalar *message, const secp256k1_scalar *nonce, int *recid); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /vm/runtime/fuzz.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | // +build gofuzz 18 | 19 | package runtime 20 | 21 | // Fuzz is the basic entry point for the go-fuzz tool 22 | // 23 | // This returns 1 for valid parsable/runable code, 0 24 | // for invalid opcode. 25 | func Fuzz(input []byte) int { 26 | _, _, err := Execute(input, input, &Config{ 27 | GasLimit: 3000000, 28 | }) 29 | 30 | // invalid opcode 31 | if err != nil && len(err.Error()) > 6 && string(err.Error()[:7]) == "invalid" { 32 | return 0 33 | } 34 | 35 | return 1 36 | } 37 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/hashicorp/golang-lru/simplelru/lru_interface.go: -------------------------------------------------------------------------------- 1 | package simplelru 2 | 3 | 4 | // LRUCache is the interface for simple LRU cache. 5 | type LRUCache interface { 6 | // Adds a value to the cache, returns true if an eviction occurred and 7 | // updates the "recently used"-ness of the key. 8 | Add(key, value interface{}) bool 9 | 10 | // Returns key's value from the cache and 11 | // updates the "recently used"-ness of the key. #value, isFound 12 | Get(key interface{}) (value interface{}, ok bool) 13 | 14 | // Check if a key exsists in cache without updating the recent-ness. 15 | Contains(key interface{}) (ok bool) 16 | 17 | // Returns key's value without updating the "recently used"-ness of the key. 18 | Peek(key interface{}) (value interface{}, ok bool) 19 | 20 | // Removes a key from the cache. 21 | Remove(key interface{}) bool 22 | 23 | // Removes the oldest entry from cache. 24 | RemoveOldest() (interface{}, interface{}, bool) 25 | 26 | // Returns the oldest entry from the cache. #key, value, isFound 27 | GetOldest() (interface{}, interface{}, bool) 28 | 29 | // Returns a slice of the keys in the cache, from oldest to newest. 30 | Keys() []interface{} 31 | 32 | // Returns the number of items in the cache. 33 | Len() int 34 | 35 | // Clear all cache entries 36 | Purge() 37 | } 38 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/params/denomination.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | package params 18 | 19 | const ( 20 | // These are the multipliers for ether denominations. 21 | // Example: To get the wei value of an amount in 'douglas', use 22 | // 23 | // new(big.Int).Mul(value, big.NewInt(params.Douglas)) 24 | // 25 | Wei = 1 26 | Ada = 1e3 27 | Babbage = 1e6 28 | Shannon = 1e9 29 | Szabo = 1e12 30 | Finney = 1e15 31 | Ether = 1e18 32 | Einstein = 1e21 33 | Douglas = 1e42 34 | ) 35 | -------------------------------------------------------------------------------- /vm/gas_table_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | package vm 18 | 19 | import "testing" 20 | 21 | func TestMemoryGasCost(t *testing.T) { 22 | //size := uint64(math.MaxUint64 - 64) 23 | size := uint64(0xffffffffe0) 24 | v, err := memoryGasCost(&Memory{}, size) 25 | if err != nil { 26 | t.Error("didn't expect error:", err) 27 | } 28 | if v != 36028899963961341 { 29 | t.Errorf("Expected: 36028899963961341, got %d", v) 30 | } 31 | 32 | _, err = memoryGasCost(&Memory{}, size+1) 33 | if err == nil { 34 | t.Error("expected error") 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/accounts/abi/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | // Package abi implements the Ethereum ABI (Application Binary 18 | // Interface). 19 | // 20 | // The Ethereum ABI is strongly typed, known at compile time 21 | // and static. This ABI will handle basic type casting; unsigned 22 | // to signed and visa versa. It does not handle slice casting such 23 | // as unsigned slice to signed slice. Bit size type casting is also 24 | // handled. ints with a bit size of 32 will be properly cast to int256, 25 | // etc. 26 | package abi 27 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/src/eckey.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Copyright (c) 2013, 2014 Pieter Wuille * 3 | * Distributed under the MIT software license, see the accompanying * 4 | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* 5 | **********************************************************************/ 6 | 7 | #ifndef _SECP256K1_ECKEY_ 8 | #define _SECP256K1_ECKEY_ 9 | 10 | #include 11 | 12 | #include "group.h" 13 | #include "scalar.h" 14 | #include "ecmult.h" 15 | #include "ecmult_gen.h" 16 | 17 | static int secp256k1_eckey_pubkey_parse(secp256k1_ge *elem, const unsigned char *pub, size_t size); 18 | static int secp256k1_eckey_pubkey_serialize(secp256k1_ge *elem, unsigned char *pub, size_t *size, int compressed); 19 | 20 | static int secp256k1_eckey_privkey_tweak_add(secp256k1_scalar *key, const secp256k1_scalar *tweak); 21 | static int secp256k1_eckey_pubkey_tweak_add(const secp256k1_ecmult_context *ctx, secp256k1_ge *key, const secp256k1_scalar *tweak); 22 | static int secp256k1_eckey_privkey_tweak_mul(secp256k1_scalar *key, const secp256k1_scalar *tweak); 23 | static int secp256k1_eckey_pubkey_tweak_mul(const secp256k1_ecmult_context *ctx, secp256k1_ge *key, const secp256k1_scalar *tweak); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /vm/errors.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | package vm 18 | 19 | import "errors" 20 | 21 | var ( 22 | ErrOutOfGas = errors.New("out of gas") 23 | ErrCodeStoreOutOfGas = errors.New("contract creation code storage out of gas") 24 | ErrDepth = errors.New("max call depth exceeded") 25 | ErrTraceLimitReached = errors.New("the number of logs reached the specified limit") 26 | ErrInsufficientBalance = errors.New("insufficient balance for transfer") 27 | ErrContractAddressCollision = errors.New("contract address collision") 28 | ) 29 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/sha3/xor_unaligned.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64 386 ppc64le 6 | // +build !appengine 7 | 8 | package sha3 9 | 10 | import "unsafe" 11 | 12 | func xorInUnaligned(d *state, buf []byte) { 13 | bw := (*[maxRate / 8]uint64)(unsafe.Pointer(&buf[0])) 14 | n := len(buf) 15 | if n >= 72 { 16 | d.a[0] ^= bw[0] 17 | d.a[1] ^= bw[1] 18 | d.a[2] ^= bw[2] 19 | d.a[3] ^= bw[3] 20 | d.a[4] ^= bw[4] 21 | d.a[5] ^= bw[5] 22 | d.a[6] ^= bw[6] 23 | d.a[7] ^= bw[7] 24 | d.a[8] ^= bw[8] 25 | } 26 | if n >= 104 { 27 | d.a[9] ^= bw[9] 28 | d.a[10] ^= bw[10] 29 | d.a[11] ^= bw[11] 30 | d.a[12] ^= bw[12] 31 | } 32 | if n >= 136 { 33 | d.a[13] ^= bw[13] 34 | d.a[14] ^= bw[14] 35 | d.a[15] ^= bw[15] 36 | d.a[16] ^= bw[16] 37 | } 38 | if n >= 144 { 39 | d.a[17] ^= bw[17] 40 | } 41 | if n >= 168 { 42 | d.a[18] ^= bw[18] 43 | d.a[19] ^= bw[19] 44 | d.a[20] ^= bw[20] 45 | } 46 | } 47 | 48 | func copyOutUnaligned(d *state, buf []byte) { 49 | ab := (*[maxRate]uint8)(unsafe.Pointer(&d.a[0])) 50 | copy(buf, ab[:]) 51 | } 52 | 53 | var ( 54 | xorIn = xorInUnaligned 55 | copyOut = copyOutUnaligned 56 | ) 57 | 58 | const xorImplementationUnaligned = "unaligned" 59 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/comparer/bytes_comparer.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012, Suryandaru Triandana 2 | // All rights reserved. 3 | // 4 | // Use of this source code is governed by a BSD-style license that can be 5 | // found in the LICENSE file. 6 | 7 | package comparer 8 | 9 | import "bytes" 10 | 11 | type bytesComparer struct{} 12 | 13 | func (bytesComparer) Compare(a, b []byte) int { 14 | return bytes.Compare(a, b) 15 | } 16 | 17 | func (bytesComparer) Name() string { 18 | return "leveldb.BytewiseComparator" 19 | } 20 | 21 | func (bytesComparer) Separator(dst, a, b []byte) []byte { 22 | i, n := 0, len(a) 23 | if n > len(b) { 24 | n = len(b) 25 | } 26 | for ; i < n && a[i] == b[i]; i++ { 27 | } 28 | if i >= n { 29 | // Do not shorten if one string is a prefix of the other 30 | } else if c := a[i]; c < 0xff && c+1 < b[i] { 31 | dst = append(dst, a[:i+1]...) 32 | dst[i]++ 33 | return dst 34 | } 35 | return nil 36 | } 37 | 38 | func (bytesComparer) Successor(dst, b []byte) []byte { 39 | for i, c := range b { 40 | if c != 0xff { 41 | dst = append(dst, b[:i+1]...) 42 | dst[i]++ 43 | return dst 44 | } 45 | } 46 | return nil 47 | } 48 | 49 | // DefaultComparer are default implementation of the Comparer interface. 50 | // It uses the natural ordering, consistent with bytes.Compare. 51 | var DefaultComparer = bytesComparer{} 52 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/crypto/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/panic_cb.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | package secp256k1 18 | 19 | import "C" 20 | import "unsafe" 21 | 22 | // Callbacks for converting libsecp256k1 internal faults into 23 | // recoverable Go panics. 24 | 25 | //export secp256k1GoPanicIllegal 26 | func secp256k1GoPanicIllegal(msg *C.char, data unsafe.Pointer) { 27 | panic("illegal argument: " + C.GoString(msg)) 28 | } 29 | 30 | //export secp256k1GoPanicError 31 | func secp256k1GoPanicError(msg *C.char, data unsafe.Pointer) { 32 | panic("internal error: " + C.GoString(msg)) 33 | } 34 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/sha3/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/syndtr/goleveldb/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2012 Suryandaru Triandana 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 15 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 16 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 18 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 19 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 20 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /types/derive_sha.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | package types 18 | 19 | import ( 20 | "bytes" 21 | 22 | "github.com/ethereum/go-ethereum/common" 23 | "github.com/ethereum/go-ethereum/rlp" 24 | "github.com/ethereum/go-ethereum/trie" 25 | ) 26 | 27 | type DerivableList interface { 28 | Len() int 29 | GetRlp(i int) []byte 30 | } 31 | 32 | func DeriveSha(list DerivableList) common.Hash { 33 | keybuf := new(bytes.Buffer) 34 | trie := new(trie.Trie) 35 | for i := 0; i < list.Len(); i++ { 36 | keybuf.Reset() 37 | rlp.Encode(keybuf, uint(i)) 38 | trie.Update(keybuf.Bytes(), list.GetRlp(i)) 39 | } 40 | return trie.Hash() 41 | } 42 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/file_storage_plan9.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012, Suryandaru Triandana 2 | // All rights reserved. 3 | // 4 | // Use of this source code is governed by a BSD-style license that can be 5 | // found in the LICENSE file. 6 | 7 | package storage 8 | 9 | import ( 10 | "os" 11 | ) 12 | 13 | type plan9FileLock struct { 14 | f *os.File 15 | } 16 | 17 | func (fl *plan9FileLock) release() error { 18 | return fl.f.Close() 19 | } 20 | 21 | func newFileLock(path string, readOnly bool) (fl fileLock, err error) { 22 | var ( 23 | flag int 24 | perm os.FileMode 25 | ) 26 | if readOnly { 27 | flag = os.O_RDONLY 28 | } else { 29 | flag = os.O_RDWR 30 | perm = os.ModeExclusive 31 | } 32 | f, err := os.OpenFile(path, flag, perm) 33 | if os.IsNotExist(err) { 34 | f, err = os.OpenFile(path, flag|os.O_CREATE, perm|0644) 35 | } 36 | if err != nil { 37 | return 38 | } 39 | fl = &plan9FileLock{f: f} 40 | return 41 | } 42 | 43 | func rename(oldpath, newpath string) error { 44 | if _, err := os.Stat(newpath); err == nil { 45 | if err := os.Remove(newpath); err != nil { 46 | return err 47 | } 48 | } 49 | 50 | return os.Rename(oldpath, newpath) 51 | } 52 | 53 | func syncDir(name string) error { 54 | f, err := os.Open(name) 55 | if err != nil { 56 | return err 57 | } 58 | defer f.Close() 59 | if err := f.Sync(); err != nil { 60 | return err 61 | } 62 | return nil 63 | } 64 | -------------------------------------------------------------------------------- /vm/stack_table.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | package vm 18 | 19 | import ( 20 | "fmt" 21 | 22 | "github.com/ethereum/go-ethereum/params" 23 | ) 24 | 25 | func makeStackFunc(pop, push int) stackValidationFunc { 26 | return func(stack *Stack) error { 27 | if err := stack.require(pop); err != nil { 28 | return err 29 | } 30 | 31 | if stack.len()+push-pop > int(params.StackLimit) { 32 | return fmt.Errorf("stack limit reached %d (%d)", stack.len(), params.StackLimit) 33 | } 34 | return nil 35 | } 36 | } 37 | 38 | func makeDupStackFunc(n int) stackValidationFunc { 39 | return makeStackFunc(n, n+1) 40 | } 41 | 42 | func makeSwapStackFunc(n int) stackValidationFunc { 43 | return makeStackFunc(n, n) 44 | } 45 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/trie/errors.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | package trie 18 | 19 | import ( 20 | "fmt" 21 | 22 | "github.com/ethereum/go-ethereum/common" 23 | ) 24 | 25 | // MissingNodeError is returned by the trie functions (TryGet, TryUpdate, TryDelete) 26 | // in the case where a trie node is not present in the local database. It contains 27 | // information necessary for retrieving the missing node. 28 | type MissingNodeError struct { 29 | NodeHash common.Hash // hash of the missing node 30 | Path []byte // hex-encoded path to the missing node 31 | } 32 | 33 | func (err *MissingNodeError) Error() string { 34 | return fmt.Sprintf("missing trie node %x (path %x)", err.NodeHash, err.Path) 35 | } 36 | -------------------------------------------------------------------------------- /vm/runtime/env.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | package runtime 18 | 19 | import ( 20 | "github.com/duanbing/go-evm/core" 21 | "github.com/duanbing/go-evm/vm" 22 | "github.com/ethereum/go-ethereum/common" 23 | ) 24 | 25 | func NewEnv(cfg *Config) *vm.EVM { 26 | context := vm.Context{ 27 | CanTransfer: core.CanTransfer, 28 | Transfer: core.Transfer, 29 | GetHash: func(uint64) common.Hash { return common.Hash{} }, 30 | 31 | Origin: cfg.Origin, 32 | Coinbase: cfg.Coinbase, 33 | BlockNumber: cfg.BlockNumber, 34 | Time: cfg.Time, 35 | Difficulty: cfg.Difficulty, 36 | GasLimit: cfg.GasLimit, 37 | GasPrice: cfg.GasPrice, 38 | } 39 | 40 | return vm.NewEVM(context, cfg.State, cfg.ChainConfig, cfg.EVMConfig) 41 | } 42 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/golang/snappy/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This is the official list of people who can contribute 2 | # (and typically have contributed) code to the Snappy-Go repository. 3 | # The AUTHORS file lists the copyright holders; this file 4 | # lists people. For example, Google employees are listed here 5 | # but not in AUTHORS, because Google holds the copyright. 6 | # 7 | # The submission process automatically checks to make sure 8 | # that people submitting code are listed in this file (by email address). 9 | # 10 | # Names should be added to this file only after verifying that 11 | # the individual or the individual's organization has agreed to 12 | # the appropriate Contributor License Agreement, found here: 13 | # 14 | # http://code.google.com/legal/individual-cla-v1.0.html 15 | # http://code.google.com/legal/corporate-cla-v1.0.html 16 | # 17 | # The agreement for individuals can be filled out on the web. 18 | # 19 | # When adding J Random Contributor's name to this file, 20 | # either J's name or J's organization's name should be 21 | # added to the AUTHORS file, depending on whether the 22 | # individual or corporate CLA was used. 23 | 24 | # Names should be added to this file like so: 25 | # Name 26 | 27 | # Please keep the list sorted. 28 | 29 | Damian Gryski 30 | Jan Mercl <0xjnml@gmail.com> 31 | Kai Backman 32 | Marc-Antoine Ruel 33 | Nigel Tao 34 | Rob Pike 35 | Rodolfo Carvalho 36 | Russ Cox 37 | Sebastien Binet 38 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/crypto/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/gopkg.in/karalabe/cookiejar.v2/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Péter Szilágyi. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without modification, 4 | are permitted provided that the following conditions are met: 5 | 6 | * Redistributions of source code must retain the above copyright notice, 7 | this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright notice, 9 | this list of conditions and the following disclaimer in the documentation 10 | and/or other materials provided with the distribution. 11 | 12 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 13 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 14 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 15 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 16 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 17 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 18 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 19 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 20 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 21 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 | 23 | Alternatively, the CookieJar toolbox may be used in accordance with the terms 24 | and conditions contained in a signed written agreement between you and the 25 | author(s). 26 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/golang/snappy/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 The Snappy-Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/sha3/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/bn256/bn256_slow.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | // +build !amd64,!arm64 18 | 19 | // Package bn256 implements the Optimal Ate pairing over a 256-bit Barreto-Naehrig curve. 20 | package bn256 21 | 22 | import "github.com/ethereum/go-ethereum/crypto/bn256/google" 23 | 24 | // G1 is an abstract cyclic group. The zero value is suitable for use as the 25 | // output of an operation, but cannot be used as an input. 26 | type G1 = bn256.G1 27 | 28 | // G2 is an abstract cyclic group. The zero value is suitable for use as the 29 | // output of an operation, but cannot be used as an input. 30 | type G2 = bn256.G2 31 | 32 | // PairingCheck calculates the Optimal Ate pairing for a set of points. 33 | func PairingCheck(a []*G1, b []*G2) bool { 34 | return bn256.PairingCheck(a, b) 35 | } 36 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage.go: -------------------------------------------------------------------------------- 1 | package leveldb 2 | 3 | import ( 4 | "github.com/syndtr/goleveldb/leveldb/storage" 5 | "sync/atomic" 6 | ) 7 | 8 | type iStorage struct { 9 | storage.Storage 10 | read uint64 11 | write uint64 12 | } 13 | 14 | func (c *iStorage) Open(fd storage.FileDesc) (storage.Reader, error) { 15 | r, err := c.Storage.Open(fd) 16 | return &iStorageReader{r, c}, err 17 | } 18 | 19 | func (c *iStorage) Create(fd storage.FileDesc) (storage.Writer, error) { 20 | w, err := c.Storage.Create(fd) 21 | return &iStorageWriter{w, c}, err 22 | } 23 | 24 | func (c *iStorage) reads() uint64 { 25 | return atomic.LoadUint64(&c.read) 26 | } 27 | 28 | func (c *iStorage) writes() uint64 { 29 | return atomic.LoadUint64(&c.write) 30 | } 31 | 32 | // newIStorage returns the given storage wrapped by iStorage. 33 | func newIStorage(s storage.Storage) *iStorage { 34 | return &iStorage{s, 0, 0} 35 | } 36 | 37 | type iStorageReader struct { 38 | storage.Reader 39 | c *iStorage 40 | } 41 | 42 | func (r *iStorageReader) Read(p []byte) (n int, err error) { 43 | n, err = r.Reader.Read(p) 44 | atomic.AddUint64(&r.c.read, uint64(n)) 45 | return n, err 46 | } 47 | 48 | func (r *iStorageReader) ReadAt(p []byte, off int64) (n int, err error) { 49 | n, err = r.Reader.ReadAt(p, off) 50 | atomic.AddUint64(&r.c.read, uint64(n)) 51 | return n, err 52 | } 53 | 54 | type iStorageWriter struct { 55 | storage.Writer 56 | c *iStorage 57 | } 58 | 59 | func (w *iStorageWriter) Write(p []byte) (n int, err error) { 60 | n, err = w.Writer.Write(p) 61 | atomic.AddUint64(&w.c.write, uint64(n)) 62 | return n, err 63 | } 64 | -------------------------------------------------------------------------------- /state/sync.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | package state 18 | 19 | import ( 20 | "bytes" 21 | 22 | "github.com/ethereum/go-ethereum/common" 23 | "github.com/ethereum/go-ethereum/rlp" 24 | "github.com/ethereum/go-ethereum/trie" 25 | ) 26 | 27 | // NewStateSync create a new state trie download scheduler. 28 | func NewStateSync(root common.Hash, database trie.DatabaseReader) *trie.TrieSync { 29 | var syncer *trie.TrieSync 30 | callback := func(leaf []byte, parent common.Hash) error { 31 | var obj Account 32 | if err := rlp.Decode(bytes.NewReader(leaf), &obj); err != nil { 33 | return err 34 | } 35 | syncer.AddSubTrie(obj.Root, 64, parent, nil) 36 | syncer.AddRawEntry(common.BytesToHash(obj.CodeHash), 64, parent) 37 | return nil 38 | } 39 | syncer = trie.NewTrieSync(root, database, callback) 40 | return syncer 41 | } 42 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/bn256/bn256_fast.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | // +build amd64 arm64 18 | 19 | // Package bn256 implements the Optimal Ate pairing over a 256-bit Barreto-Naehrig curve. 20 | package bn256 21 | 22 | import "github.com/ethereum/go-ethereum/crypto/bn256/cloudflare" 23 | 24 | // G1 is an abstract cyclic group. The zero value is suitable for use as the 25 | // output of an operation, but cannot be used as an input. 26 | type G1 = bn256.G1 27 | 28 | // G2 is an abstract cyclic group. The zero value is suitable for use as the 29 | // output of an operation, but cannot be used as an input. 30 | type G2 = bn256.G2 31 | 32 | // PairingCheck calculates the Optimal Ate pairing for a set of points. 33 | func PairingCheck(a []*G1, b []*G2) bool { 34 | return bn256.PairingCheck(a, b) 35 | } 36 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/common/format.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | package common 18 | 19 | import ( 20 | "fmt" 21 | "regexp" 22 | "strings" 23 | "time" 24 | ) 25 | 26 | // PrettyDuration is a pretty printed version of a time.Duration value that cuts 27 | // the unnecessary precision off from the formatted textual representation. 28 | type PrettyDuration time.Duration 29 | 30 | var prettyDurationRe = regexp.MustCompile(`\.[0-9]+`) 31 | 32 | // String implements the Stringer interface, allowing pretty printing of duration 33 | // values rounded to three decimals. 34 | func (d PrettyDuration) String() string { 35 | label := fmt.Sprintf("%v", time.Duration(d)) 36 | if match := prettyDurationRe.FindString(label); len(match) > 4 { 37 | label = strings.Replace(label, match, match[:4], 1) 38 | } 39 | return label 40 | } 41 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/rcrowley/go-metrics/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2012 Richard Crowley. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | 1. Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following 12 | disclaimer in the documentation and/or other materials provided 13 | with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY RICHARD CROWLEY ``AS IS'' AND ANY EXPRESS 16 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL RICHARD CROWLEY OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 25 | THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | The views and conclusions contained in the software and documentation 28 | are those of the authors and should not be interpreted as representing 29 | official policies, either expressed or implied, of Richard Crowley. 30 | -------------------------------------------------------------------------------- /core/message.go: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * 3 | * Copyright (c) 2017 Baidu.com, Inc. All Rights Reserved 4 | * @author duanbing(duanbing@baidu.com) 5 | * 6 | **************************************************************************/ 7 | 8 | /** 9 | * @filename message.go 10 | * @desc 11 | * @create time 2018-04-19 16:08:39 12 | **/ 13 | package core 14 | 15 | import ( 16 | "github.com/ethereum/go-ethereum/common" 17 | "math/big" 18 | ) 19 | 20 | type Message struct { 21 | to *common.Address 22 | from common.Address 23 | nonce uint64 24 | amount, price, gasLimit *big.Int 25 | data []byte 26 | checkNonce bool 27 | } 28 | 29 | func NewMessage(from common.Address, to *common.Address, nonce uint64, amount, gasLimit, price *big.Int, data []byte, checkNonce bool) Message { 30 | return Message{ 31 | from: from, 32 | to: to, 33 | nonce: nonce, 34 | amount: amount, 35 | price: price, 36 | gasLimit: gasLimit, 37 | data: data, 38 | checkNonce: checkNonce, 39 | } 40 | } 41 | 42 | func (m Message) From() common.Address { return m.from } 43 | func (m Message) To() *common.Address { return m.to } 44 | func (m Message) GasPrice() *big.Int { return m.price } 45 | func (m Message) Value() *big.Int { return m.amount } 46 | func (m Message) Gas() *big.Int { return m.gasLimit } 47 | func (m Message) Nonce() uint64 { return m.nonce } 48 | func (m Message) Data() []byte { return m.data } 49 | func (m Message) CheckNonce() bool { return m.checkNonce } 50 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/src/ecmult.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Copyright (c) 2013, 2014 Pieter Wuille * 3 | * Distributed under the MIT software license, see the accompanying * 4 | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* 5 | **********************************************************************/ 6 | 7 | #ifndef _SECP256K1_ECMULT_ 8 | #define _SECP256K1_ECMULT_ 9 | 10 | #include "num.h" 11 | #include "group.h" 12 | 13 | typedef struct { 14 | /* For accelerating the computation of a*P + b*G: */ 15 | secp256k1_ge_storage (*pre_g)[]; /* odd multiples of the generator */ 16 | #ifdef USE_ENDOMORPHISM 17 | secp256k1_ge_storage (*pre_g_128)[]; /* odd multiples of 2^128*generator */ 18 | #endif 19 | } secp256k1_ecmult_context; 20 | 21 | static void secp256k1_ecmult_context_init(secp256k1_ecmult_context *ctx); 22 | static void secp256k1_ecmult_context_build(secp256k1_ecmult_context *ctx, const secp256k1_callback *cb); 23 | static void secp256k1_ecmult_context_clone(secp256k1_ecmult_context *dst, 24 | const secp256k1_ecmult_context *src, const secp256k1_callback *cb); 25 | static void secp256k1_ecmult_context_clear(secp256k1_ecmult_context *ctx); 26 | static int secp256k1_ecmult_context_is_built(const secp256k1_ecmult_context *ctx); 27 | 28 | /** Double multiply: R = na*A + ng*G */ 29 | static void secp256k1_ecmult(const secp256k1_ecmult_context *ctx, secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_scalar *na, const secp256k1_scalar *ng); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/metrics/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2012 Richard Crowley. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | 1. Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following 12 | disclaimer in the documentation and/or other materials provided 13 | with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY RICHARD CROWLEY ``AS IS'' AND ANY EXPRESS 16 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL RICHARD CROWLEY OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 25 | THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | The views and conclusions contained in the software and documentation 28 | are those of the authors and should not be interpreted as representing 29 | official policies, either expressed or implied, of Richard Crowley. 30 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/rlp/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | /* 18 | Package rlp implements the RLP serialization format. 19 | 20 | The purpose of RLP (Recursive Linear Prefix) is to encode arbitrarily 21 | nested arrays of binary data, and RLP is the main encoding method used 22 | to serialize objects in Ethereum. The only purpose of RLP is to encode 23 | structure; encoding specific atomic data types (eg. strings, ints, 24 | floats) is left up to higher-order protocols; in Ethereum integers 25 | must be represented in big endian binary form with no leading zeroes 26 | (thus making the integer value zero equivalent to the empty byte 27 | array). 28 | 29 | RLP values are distinguished by a type tag. The type tag precedes the 30 | value in the input stream and defines the size and kind of the bytes 31 | that follow. 32 | */ 33 | package rlp 34 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/common/path.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | package common 18 | 19 | import ( 20 | "fmt" 21 | "os" 22 | "path/filepath" 23 | "runtime" 24 | ) 25 | 26 | // MakeName creates a node name that follows the ethereum convention 27 | // for such names. It adds the operation system name and Go runtime version 28 | // the name. 29 | func MakeName(name, version string) string { 30 | return fmt.Sprintf("%s/v%s/%s/%s", name, version, runtime.GOOS, runtime.Version()) 31 | } 32 | 33 | func FileExist(filePath string) bool { 34 | _, err := os.Stat(filePath) 35 | if err != nil && os.IsNotExist(err) { 36 | return false 37 | } 38 | 39 | return true 40 | } 41 | 42 | func AbsolutePath(Datadir string, filename string) string { 43 | if filepath.IsAbs(filename) { 44 | return filename 45 | } 46 | return filepath.Join(Datadir, filename) 47 | } 48 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/src/testrand.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Copyright (c) 2013, 2014 Pieter Wuille * 3 | * Distributed under the MIT software license, see the accompanying * 4 | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* 5 | **********************************************************************/ 6 | 7 | #ifndef _SECP256K1_TESTRAND_H_ 8 | #define _SECP256K1_TESTRAND_H_ 9 | 10 | #if defined HAVE_CONFIG_H 11 | #include "libsecp256k1-config.h" 12 | #endif 13 | 14 | /* A non-cryptographic RNG used only for test infrastructure. */ 15 | 16 | /** Seed the pseudorandom number generator for testing. */ 17 | SECP256K1_INLINE static void secp256k1_rand_seed(const unsigned char *seed16); 18 | 19 | /** Generate a pseudorandom number in the range [0..2**32-1]. */ 20 | static uint32_t secp256k1_rand32(void); 21 | 22 | /** Generate a pseudorandom number in the range [0..2**bits-1]. Bits must be 1 or 23 | * more. */ 24 | static uint32_t secp256k1_rand_bits(int bits); 25 | 26 | /** Generate a pseudorandom number in the range [0..range-1]. */ 27 | static uint32_t secp256k1_rand_int(uint32_t range); 28 | 29 | /** Generate a pseudorandom 32-byte array. */ 30 | static void secp256k1_rand256(unsigned char *b32); 31 | 32 | /** Generate a pseudorandom 32-byte array with long sequences of zero and one bits. */ 33 | static void secp256k1_rand256_test(unsigned char *b32); 34 | 35 | /** Generate pseudorandom bytes with long sequences of zero and one bits. */ 36 | static void secp256k1_rand_bytes_test(unsigned char *bytes, size_t len); 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/params/version.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | package params 18 | 19 | import ( 20 | "fmt" 21 | ) 22 | 23 | const ( 24 | VersionMajor = 1 // Major version component of the current release 25 | VersionMinor = 8 // Minor version component of the current release 26 | VersionPatch = 3 // Patch version component of the current release 27 | VersionMeta = "stable" // Version metadata to append to the version string 28 | ) 29 | 30 | // Version holds the textual version string. 31 | var Version = func() string { 32 | v := fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch) 33 | if VersionMeta != "" { 34 | v += "-" + VersionMeta 35 | } 36 | return v 37 | }() 38 | 39 | func VersionWithCommit(gitCommit string) string { 40 | vsn := Version 41 | if len(gitCommit) >= 8 { 42 | vsn += "-" + gitCommit[:8] 43 | } 44 | return vsn 45 | } 46 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/go-stack/stack/README.md: -------------------------------------------------------------------------------- 1 | [![GoDoc](https://godoc.org/github.com/go-stack/stack?status.svg)](https://godoc.org/github.com/go-stack/stack) 2 | [![Go Report Card](https://goreportcard.com/badge/go-stack/stack)](https://goreportcard.com/report/go-stack/stack) 3 | [![TravisCI](https://travis-ci.org/go-stack/stack.svg?branch=master)](https://travis-ci.org/go-stack/stack) 4 | [![Coverage Status](https://coveralls.io/repos/github/go-stack/stack/badge.svg?branch=master)](https://coveralls.io/github/go-stack/stack?branch=master) 5 | 6 | # stack 7 | 8 | Package stack implements utilities to capture, manipulate, and format call 9 | stacks. It provides a simpler API than package runtime. 10 | 11 | The implementation takes care of the minutia and special cases of interpreting 12 | the program counter (pc) values returned by runtime.Callers. 13 | 14 | ## Versioning 15 | 16 | Package stack publishes releases via [semver](http://semver.org/) compatible Git 17 | tags prefixed with a single 'v'. The master branch always contains the latest 18 | release. The develop branch contains unreleased commits. 19 | 20 | ## Formatting 21 | 22 | Package stack's types implement fmt.Formatter, which provides a simple and 23 | flexible way to declaratively configure formatting when used with logging or 24 | error tracking packages. 25 | 26 | ```go 27 | func DoTheThing() { 28 | c := stack.Caller(0) 29 | log.Print(c) // "source.go:10" 30 | log.Printf("%+v", c) // "pkg/path/source.go:10" 31 | log.Printf("%n", c) // "DoTheThing" 32 | 33 | s := stack.Trace().TrimRuntime() 34 | log.Print(s) // "[source.go:15 caller.go:42 main.go:14]" 35 | } 36 | ``` 37 | 38 | See the docs for all of the supported formatting options. 39 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/common/size.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | package common 18 | 19 | import ( 20 | "fmt" 21 | ) 22 | 23 | // StorageSize is a wrapper around a float value that supports user friendly 24 | // formatting. 25 | type StorageSize float64 26 | 27 | // String implements the stringer interface. 28 | func (s StorageSize) String() string { 29 | if s > 1000000 { 30 | return fmt.Sprintf("%.2f mB", s/1000000) 31 | } else if s > 1000 { 32 | return fmt.Sprintf("%.2f kB", s/1000) 33 | } else { 34 | return fmt.Sprintf("%.2f B", s) 35 | } 36 | } 37 | 38 | // TerminalString implements log.TerminalStringer, formatting a string for console 39 | // output during logging. 40 | func (s StorageSize) TerminalString() string { 41 | if s > 1000000 { 42 | return fmt.Sprintf("%.2fmB", s/1000000) 43 | } else if s > 1000 { 44 | return fmt.Sprintf("%.2fkB", s/1000) 45 | } else { 46 | return fmt.Sprintf("%.2fB", s) 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/log/root.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | import ( 4 | "os" 5 | ) 6 | 7 | var ( 8 | root = &logger{[]interface{}{}, new(swapHandler)} 9 | StdoutHandler = StreamHandler(os.Stdout, LogfmtFormat()) 10 | StderrHandler = StreamHandler(os.Stderr, LogfmtFormat()) 11 | ) 12 | 13 | func init() { 14 | root.SetHandler(DiscardHandler()) 15 | } 16 | 17 | // New returns a new logger with the given context. 18 | // New is a convenient alias for Root().New 19 | func New(ctx ...interface{}) Logger { 20 | return root.New(ctx...) 21 | } 22 | 23 | // Root returns the root logger 24 | func Root() Logger { 25 | return root 26 | } 27 | 28 | // The following functions bypass the exported logger methods (logger.Debug, 29 | // etc.) to keep the call depth the same for all paths to logger.write so 30 | // runtime.Caller(2) always refers to the call site in client code. 31 | 32 | // Trace is a convenient alias for Root().Trace 33 | func Trace(msg string, ctx ...interface{}) { 34 | root.write(msg, LvlTrace, ctx) 35 | } 36 | 37 | // Debug is a convenient alias for Root().Debug 38 | func Debug(msg string, ctx ...interface{}) { 39 | root.write(msg, LvlDebug, ctx) 40 | } 41 | 42 | // Info is a convenient alias for Root().Info 43 | func Info(msg string, ctx ...interface{}) { 44 | root.write(msg, LvlInfo, ctx) 45 | } 46 | 47 | // Warn is a convenient alias for Root().Warn 48 | func Warn(msg string, ctx ...interface{}) { 49 | root.write(msg, LvlWarn, ctx) 50 | } 51 | 52 | // Error is a convenient alias for Root().Error 53 | func Error(msg string, ctx ...interface{}) { 54 | root.write(msg, LvlError, ctx) 55 | } 56 | 57 | // Crit is a convenient alias for Root().Crit 58 | func Crit(msg string, ctx ...interface{}) { 59 | root.write(msg, LvlCrit, ctx) 60 | os.Exit(1) 61 | } 62 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/rcrowley/go-metrics/healthcheck.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | // Healthchecks hold an error value describing an arbitrary up/down status. 4 | type Healthcheck interface { 5 | Check() 6 | Error() error 7 | Healthy() 8 | Unhealthy(error) 9 | } 10 | 11 | // NewHealthcheck constructs a new Healthcheck which will use the given 12 | // function to update its status. 13 | func NewHealthcheck(f func(Healthcheck)) Healthcheck { 14 | if UseNilMetrics { 15 | return NilHealthcheck{} 16 | } 17 | return &StandardHealthcheck{nil, f} 18 | } 19 | 20 | // NilHealthcheck is a no-op. 21 | type NilHealthcheck struct{} 22 | 23 | // Check is a no-op. 24 | func (NilHealthcheck) Check() {} 25 | 26 | // Error is a no-op. 27 | func (NilHealthcheck) Error() error { return nil } 28 | 29 | // Healthy is a no-op. 30 | func (NilHealthcheck) Healthy() {} 31 | 32 | // Unhealthy is a no-op. 33 | func (NilHealthcheck) Unhealthy(error) {} 34 | 35 | // StandardHealthcheck is the standard implementation of a Healthcheck and 36 | // stores the status and a function to call to update the status. 37 | type StandardHealthcheck struct { 38 | err error 39 | f func(Healthcheck) 40 | } 41 | 42 | // Check runs the healthcheck function to update the healthcheck's status. 43 | func (h *StandardHealthcheck) Check() { 44 | h.f(h) 45 | } 46 | 47 | // Error returns the healthcheck's status, which will be nil if it is healthy. 48 | func (h *StandardHealthcheck) Error() error { 49 | return h.err 50 | } 51 | 52 | // Healthy marks the healthcheck as healthy. 53 | func (h *StandardHealthcheck) Healthy() { 54 | h.err = nil 55 | } 56 | 57 | // Unhealthy marks the healthcheck as unhealthy. The error is stored and 58 | // may be retrieved by the Error method. 59 | func (h *StandardHealthcheck) Unhealthy(err error) { 60 | h.err = err 61 | } 62 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/metrics/healthcheck.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | // Healthchecks hold an error value describing an arbitrary up/down status. 4 | type Healthcheck interface { 5 | Check() 6 | Error() error 7 | Healthy() 8 | Unhealthy(error) 9 | } 10 | 11 | // NewHealthcheck constructs a new Healthcheck which will use the given 12 | // function to update its status. 13 | func NewHealthcheck(f func(Healthcheck)) Healthcheck { 14 | if !Enabled { 15 | return NilHealthcheck{} 16 | } 17 | return &StandardHealthcheck{nil, f} 18 | } 19 | 20 | // NilHealthcheck is a no-op. 21 | type NilHealthcheck struct{} 22 | 23 | // Check is a no-op. 24 | func (NilHealthcheck) Check() {} 25 | 26 | // Error is a no-op. 27 | func (NilHealthcheck) Error() error { return nil } 28 | 29 | // Healthy is a no-op. 30 | func (NilHealthcheck) Healthy() {} 31 | 32 | // Unhealthy is a no-op. 33 | func (NilHealthcheck) Unhealthy(error) {} 34 | 35 | // StandardHealthcheck is the standard implementation of a Healthcheck and 36 | // stores the status and a function to call to update the status. 37 | type StandardHealthcheck struct { 38 | err error 39 | f func(Healthcheck) 40 | } 41 | 42 | // Check runs the healthcheck function to update the healthcheck's status. 43 | func (h *StandardHealthcheck) Check() { 44 | h.f(h) 45 | } 46 | 47 | // Error returns the healthcheck's status, which will be nil if it is healthy. 48 | func (h *StandardHealthcheck) Error() error { 49 | return h.err 50 | } 51 | 52 | // Healthy marks the healthcheck as healthy. 53 | func (h *StandardHealthcheck) Healthy() { 54 | h.err = nil 55 | } 56 | 57 | // Unhealthy marks the healthcheck as unhealthy. The error is stored and 58 | // may be retrieved by the Error method. 59 | func (h *StandardHealthcheck) Unhealthy(err error) { 60 | h.err = err 61 | } 62 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/davecgh/go-spew/spew/bypasssafe.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 Dave Collins 2 | // 3 | // Permission to use, copy, modify, and distribute this software for any 4 | // purpose with or without fee is hereby granted, provided that the above 5 | // copyright notice and this permission notice appear in all copies. 6 | // 7 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | 15 | // NOTE: Due to the following build constraints, this file will only be compiled 16 | // when either the code is running on Google App Engine or "-tags disableunsafe" 17 | // is added to the go build command line. 18 | // +build appengine disableunsafe 19 | 20 | package spew 21 | 22 | import "reflect" 23 | 24 | const ( 25 | // UnsafeDisabled is a build-time constant which specifies whether or 26 | // not access to the unsafe package is available. 27 | UnsafeDisabled = true 28 | ) 29 | 30 | // unsafeReflectValue typically converts the passed reflect.Value into a one 31 | // that bypasses the typical safety restrictions preventing access to 32 | // unaddressable and unexported data. However, doing this relies on access to 33 | // the unsafe package. This is a stub version which simply returns the passed 34 | // reflect.Value when the unsafe package is not available. 35 | func unsafeReflectValue(v reflect.Value) reflect.Value { 36 | return v 37 | } 38 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/src/java/org/bitcoin/NativeSecp256k1Util.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 the libsecp256k1 contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitcoin; 18 | 19 | public class NativeSecp256k1Util{ 20 | 21 | public static void assertEquals( int val, int val2, String message ) throws AssertFailException{ 22 | if( val != val2 ) 23 | throw new AssertFailException("FAIL: " + message); 24 | } 25 | 26 | public static void assertEquals( boolean val, boolean val2, String message ) throws AssertFailException{ 27 | if( val != val2 ) 28 | throw new AssertFailException("FAIL: " + message); 29 | else 30 | System.out.println("PASS: " + message); 31 | } 32 | 33 | public static void assertEquals( String val, String val2, String message ) throws AssertFailException{ 34 | if( !val.equals(val2) ) 35 | throw new AssertFailException("FAIL: " + message); 36 | else 37 | System.out.println("PASS: " + message); 38 | } 39 | 40 | public static class AssertFailException extends Exception { 41 | public AssertFailException(String message) { 42 | super( message ); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/src/java/org/bitcoin/Secp256k1Context.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 the libsecp256k1 contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitcoin; 18 | 19 | /** 20 | * This class holds the context reference used in native methods 21 | * to handle ECDSA operations. 22 | */ 23 | public class Secp256k1Context { 24 | private static final boolean enabled; //true if the library is loaded 25 | private static final long context; //ref to pointer to context obj 26 | 27 | static { //static initializer 28 | boolean isEnabled = true; 29 | long contextRef = -1; 30 | try { 31 | System.loadLibrary("secp256k1"); 32 | contextRef = secp256k1_init_context(); 33 | } catch (UnsatisfiedLinkError e) { 34 | System.out.println("UnsatisfiedLinkError: " + e.toString()); 35 | isEnabled = false; 36 | } 37 | enabled = isEnabled; 38 | context = contextRef; 39 | } 40 | 41 | public static boolean isEnabled() { 42 | return enabled; 43 | } 44 | 45 | public static long getContext() { 46 | if(!enabled) return -1; //sanity check 47 | return context; 48 | } 49 | 50 | private static native long secp256k1_init_context(); 51 | } 52 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/ethdb/interface.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | package ethdb 18 | 19 | // Code using batches should try to add this much data to the batch. 20 | // The value was determined empirically. 21 | const IdealBatchSize = 100 * 1024 22 | 23 | // Putter wraps the database write operation supported by both batches and regular databases. 24 | type Putter interface { 25 | Put(key []byte, value []byte) error 26 | } 27 | 28 | // Database wraps all database operations. All methods are safe for concurrent use. 29 | type Database interface { 30 | Putter 31 | Get(key []byte) ([]byte, error) 32 | Has(key []byte) (bool, error) 33 | Delete(key []byte) error 34 | Close() 35 | NewBatch() Batch 36 | } 37 | 38 | // Batch is a write-only database that commits changes to its host database 39 | // when Write is called. Batch cannot be used concurrently. 40 | type Batch interface { 41 | Putter 42 | ValueSize() int // amount of data in the batch 43 | Write() error 44 | // Reset resets the batch for reuse 45 | Reset() 46 | } 47 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/file_storage_solaris.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012, Suryandaru Triandana 2 | // All rights reserved. 3 | // 4 | // Use of this source code is governed by a BSD-style license that can be 5 | // found in the LICENSE file. 6 | 7 | // +build solaris 8 | 9 | package storage 10 | 11 | import ( 12 | "os" 13 | "syscall" 14 | ) 15 | 16 | type unixFileLock struct { 17 | f *os.File 18 | } 19 | 20 | func (fl *unixFileLock) release() error { 21 | if err := setFileLock(fl.f, false, false); err != nil { 22 | return err 23 | } 24 | return fl.f.Close() 25 | } 26 | 27 | func newFileLock(path string, readOnly bool) (fl fileLock, err error) { 28 | var flag int 29 | if readOnly { 30 | flag = os.O_RDONLY 31 | } else { 32 | flag = os.O_RDWR 33 | } 34 | f, err := os.OpenFile(path, flag, 0) 35 | if os.IsNotExist(err) { 36 | f, err = os.OpenFile(path, flag|os.O_CREATE, 0644) 37 | } 38 | if err != nil { 39 | return 40 | } 41 | err = setFileLock(f, readOnly, true) 42 | if err != nil { 43 | f.Close() 44 | return 45 | } 46 | fl = &unixFileLock{f: f} 47 | return 48 | } 49 | 50 | func setFileLock(f *os.File, readOnly, lock bool) error { 51 | flock := syscall.Flock_t{ 52 | Type: syscall.F_UNLCK, 53 | Start: 0, 54 | Len: 0, 55 | Whence: 1, 56 | } 57 | if lock { 58 | if readOnly { 59 | flock.Type = syscall.F_RDLCK 60 | } else { 61 | flock.Type = syscall.F_WRLCK 62 | } 63 | } 64 | return syscall.FcntlFlock(f.Fd(), syscall.F_SETLK, &flock) 65 | } 66 | 67 | func rename(oldpath, newpath string) error { 68 | return os.Rename(oldpath, newpath) 69 | } 70 | 71 | func syncDir(name string) error { 72 | f, err := os.Open(name) 73 | if err != nil { 74 | return err 75 | } 76 | defer f.Close() 77 | if err := f.Sync(); err != nil { 78 | return err 79 | } 80 | return nil 81 | } 82 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/common/test_utils.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | package common 18 | 19 | import ( 20 | "encoding/json" 21 | "fmt" 22 | "io/ioutil" 23 | ) 24 | 25 | // LoadJSON reads the given file and unmarshals its content. 26 | func LoadJSON(file string, val interface{}) error { 27 | content, err := ioutil.ReadFile(file) 28 | if err != nil { 29 | return err 30 | } 31 | if err := json.Unmarshal(content, val); err != nil { 32 | if syntaxerr, ok := err.(*json.SyntaxError); ok { 33 | line := findLine(content, syntaxerr.Offset) 34 | return fmt.Errorf("JSON syntax error at %v:%v: %v", file, line, err) 35 | } 36 | return fmt.Errorf("JSON unmarshal error in %v: %v", file, err) 37 | } 38 | return nil 39 | } 40 | 41 | // findLine returns the line number for the given offset into data. 42 | func findLine(data []byte, offset int64) (line int) { 43 | line = 1 44 | for i, r := range string(data) { 45 | if int64(i) >= offset { 46 | return 47 | } 48 | if r == '\n' { 49 | line++ 50 | } 51 | } 52 | return 53 | } 54 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/src/bench_sign.c: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Copyright (c) 2014 Pieter Wuille * 3 | * Distributed under the MIT software license, see the accompanying * 4 | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* 5 | **********************************************************************/ 6 | 7 | #include "include/secp256k1.h" 8 | #include "util.h" 9 | #include "bench.h" 10 | 11 | typedef struct { 12 | secp256k1_context* ctx; 13 | unsigned char msg[32]; 14 | unsigned char key[32]; 15 | } bench_sign_t; 16 | 17 | static void bench_sign_setup(void* arg) { 18 | int i; 19 | bench_sign_t *data = (bench_sign_t*)arg; 20 | 21 | for (i = 0; i < 32; i++) { 22 | data->msg[i] = i + 1; 23 | } 24 | for (i = 0; i < 32; i++) { 25 | data->key[i] = i + 65; 26 | } 27 | } 28 | 29 | static void bench_sign(void* arg) { 30 | int i; 31 | bench_sign_t *data = (bench_sign_t*)arg; 32 | 33 | unsigned char sig[74]; 34 | for (i = 0; i < 20000; i++) { 35 | size_t siglen = 74; 36 | int j; 37 | secp256k1_ecdsa_signature signature; 38 | CHECK(secp256k1_ecdsa_sign(data->ctx, &signature, data->msg, data->key, NULL, NULL)); 39 | CHECK(secp256k1_ecdsa_signature_serialize_der(data->ctx, sig, &siglen, &signature)); 40 | for (j = 0; j < 32; j++) { 41 | data->msg[j] = sig[j]; 42 | data->key[j] = sig[j + 32]; 43 | } 44 | } 45 | } 46 | 47 | int main(void) { 48 | bench_sign_t data; 49 | 50 | data.ctx = secp256k1_context_create(SECP256K1_CONTEXT_SIGN); 51 | 52 | run_benchmark("ecdsa_sign", bench_sign, bench_sign_setup, NULL, &data, 10, 20000); 53 | 54 | secp256k1_context_destroy(data.ctx); 55 | return 0; 56 | } 57 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/common/debug.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | package common 18 | 19 | import ( 20 | "fmt" 21 | "os" 22 | "runtime" 23 | "runtime/debug" 24 | "strings" 25 | ) 26 | 27 | // Report gives off a warning requesting the user to submit an issue to the github tracker. 28 | func Report(extra ...interface{}) { 29 | 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") 30 | fmt.Fprintln(os.Stderr, extra...) 31 | 32 | _, file, line, _ := runtime.Caller(1) 33 | fmt.Fprintf(os.Stderr, "%v:%v\n", file, line) 34 | 35 | debug.PrintStack() 36 | 37 | fmt.Fprintln(os.Stderr, "#### BUG! PLEASE REPORT ####") 38 | } 39 | 40 | // PrintDepricationWarning prinst the given string in a box using fmt.Println. 41 | func PrintDepricationWarning(str string) { 42 | line := strings.Repeat("#", len(str)+4) 43 | emptyLine := strings.Repeat(" ", len(str)) 44 | fmt.Printf(` 45 | %s 46 | # %s # 47 | # %s # 48 | # %s # 49 | %s 50 | 51 | `, line, emptyLine, str, emptyLine, line) 52 | } 53 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/log/syslog.go: -------------------------------------------------------------------------------- 1 | // +build !windows,!plan9 2 | 3 | package log 4 | 5 | import ( 6 | "log/syslog" 7 | "strings" 8 | ) 9 | 10 | // SyslogHandler opens a connection to the system syslog daemon by calling 11 | // syslog.New and writes all records to it. 12 | func SyslogHandler(priority syslog.Priority, tag string, fmtr Format) (Handler, error) { 13 | wr, err := syslog.New(priority, tag) 14 | return sharedSyslog(fmtr, wr, err) 15 | } 16 | 17 | // SyslogNetHandler opens a connection to a log daemon over the network and writes 18 | // all log records to it. 19 | func SyslogNetHandler(net, addr string, priority syslog.Priority, tag string, fmtr Format) (Handler, error) { 20 | wr, err := syslog.Dial(net, addr, priority, tag) 21 | return sharedSyslog(fmtr, wr, err) 22 | } 23 | 24 | func sharedSyslog(fmtr Format, sysWr *syslog.Writer, err error) (Handler, error) { 25 | if err != nil { 26 | return nil, err 27 | } 28 | h := FuncHandler(func(r *Record) error { 29 | var syslogFn = sysWr.Info 30 | switch r.Lvl { 31 | case LvlCrit: 32 | syslogFn = sysWr.Crit 33 | case LvlError: 34 | syslogFn = sysWr.Err 35 | case LvlWarn: 36 | syslogFn = sysWr.Warning 37 | case LvlInfo: 38 | syslogFn = sysWr.Info 39 | case LvlDebug: 40 | syslogFn = sysWr.Debug 41 | case LvlTrace: 42 | syslogFn = func(m string) error { return nil } // There's no syslog level for trace 43 | } 44 | 45 | s := strings.TrimSpace(string(fmtr.Format(r))) 46 | return syslogFn(s) 47 | }) 48 | return LazyHandler(&closingHandler{sysWr, h}), nil 49 | } 50 | 51 | func (m muster) SyslogHandler(priority syslog.Priority, tag string, fmtr Format) Handler { 52 | return must(SyslogHandler(priority, tag, fmtr)) 53 | } 54 | 55 | func (m muster) SyslogNetHandler(net, addr string, priority syslog.Priority, tag string, fmtr Format) Handler { 56 | return must(SyslogNetHandler(net, addr, priority, tag, fmtr)) 57 | } 58 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/comparer.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012, Suryandaru Triandana 2 | // All rights reserved. 3 | // 4 | // Use of this source code is governed by a BSD-style license that can be 5 | // found in the LICENSE file. 6 | 7 | package leveldb 8 | 9 | import ( 10 | "github.com/syndtr/goleveldb/leveldb/comparer" 11 | ) 12 | 13 | type iComparer struct { 14 | ucmp comparer.Comparer 15 | } 16 | 17 | func (icmp *iComparer) uName() string { 18 | return icmp.ucmp.Name() 19 | } 20 | 21 | func (icmp *iComparer) uCompare(a, b []byte) int { 22 | return icmp.ucmp.Compare(a, b) 23 | } 24 | 25 | func (icmp *iComparer) uSeparator(dst, a, b []byte) []byte { 26 | return icmp.ucmp.Separator(dst, a, b) 27 | } 28 | 29 | func (icmp *iComparer) uSuccessor(dst, b []byte) []byte { 30 | return icmp.ucmp.Successor(dst, b) 31 | } 32 | 33 | func (icmp *iComparer) Name() string { 34 | return icmp.uName() 35 | } 36 | 37 | func (icmp *iComparer) Compare(a, b []byte) int { 38 | x := icmp.uCompare(internalKey(a).ukey(), internalKey(b).ukey()) 39 | if x == 0 { 40 | if m, n := internalKey(a).num(), internalKey(b).num(); m > n { 41 | return -1 42 | } else if m < n { 43 | return 1 44 | } 45 | } 46 | return x 47 | } 48 | 49 | func (icmp *iComparer) Separator(dst, a, b []byte) []byte { 50 | ua, ub := internalKey(a).ukey(), internalKey(b).ukey() 51 | dst = icmp.uSeparator(dst, ua, ub) 52 | if dst != nil && len(dst) < len(ua) && icmp.uCompare(ua, dst) < 0 { 53 | // Append earliest possible number. 54 | return append(dst, keyMaxNumBytes...) 55 | } 56 | return nil 57 | } 58 | 59 | func (icmp *iComparer) Successor(dst, b []byte) []byte { 60 | ub := internalKey(b).ukey() 61 | dst = icmp.uSuccessor(dst, ub) 62 | if dst != nil && len(dst) < len(ub) && icmp.uCompare(ub, dst) < 0 { 63 | // Append earliest possible number. 64 | return append(dst, keyMaxNumBytes...) 65 | } 66 | return nil 67 | } 68 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/src/hash.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Copyright (c) 2014 Pieter Wuille * 3 | * Distributed under the MIT software license, see the accompanying * 4 | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* 5 | **********************************************************************/ 6 | 7 | #ifndef _SECP256K1_HASH_ 8 | #define _SECP256K1_HASH_ 9 | 10 | #include 11 | #include 12 | 13 | typedef struct { 14 | uint32_t s[8]; 15 | uint32_t buf[16]; /* In big endian */ 16 | size_t bytes; 17 | } secp256k1_sha256_t; 18 | 19 | static void secp256k1_sha256_initialize(secp256k1_sha256_t *hash); 20 | static void secp256k1_sha256_write(secp256k1_sha256_t *hash, const unsigned char *data, size_t size); 21 | static void secp256k1_sha256_finalize(secp256k1_sha256_t *hash, unsigned char *out32); 22 | 23 | typedef struct { 24 | secp256k1_sha256_t inner, outer; 25 | } secp256k1_hmac_sha256_t; 26 | 27 | static void secp256k1_hmac_sha256_initialize(secp256k1_hmac_sha256_t *hash, const unsigned char *key, size_t size); 28 | static void secp256k1_hmac_sha256_write(secp256k1_hmac_sha256_t *hash, const unsigned char *data, size_t size); 29 | static void secp256k1_hmac_sha256_finalize(secp256k1_hmac_sha256_t *hash, unsigned char *out32); 30 | 31 | typedef struct { 32 | unsigned char v[32]; 33 | unsigned char k[32]; 34 | int retry; 35 | } secp256k1_rfc6979_hmac_sha256_t; 36 | 37 | static void secp256k1_rfc6979_hmac_sha256_initialize(secp256k1_rfc6979_hmac_sha256_t *rng, const unsigned char *key, size_t keylen); 38 | static void secp256k1_rfc6979_hmac_sha256_generate(secp256k1_rfc6979_hmac_sha256_t *rng, unsigned char *out, size_t outlen); 39 | static void secp256k1_rfc6979_hmac_sha256_finalize(secp256k1_rfc6979_hmac_sha256_t *rng); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/src/bench_ecdh.c: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Copyright (c) 2015 Pieter Wuille, Andrew Poelstra * 3 | * Distributed under the MIT software license, see the accompanying * 4 | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* 5 | **********************************************************************/ 6 | 7 | #include 8 | 9 | #include "include/secp256k1.h" 10 | #include "include/secp256k1_ecdh.h" 11 | #include "util.h" 12 | #include "bench.h" 13 | 14 | typedef struct { 15 | secp256k1_context *ctx; 16 | secp256k1_pubkey point; 17 | unsigned char scalar[32]; 18 | } bench_ecdh_t; 19 | 20 | static void bench_ecdh_setup(void* arg) { 21 | int i; 22 | bench_ecdh_t *data = (bench_ecdh_t*)arg; 23 | const unsigned char point[] = { 24 | 0x03, 25 | 0x54, 0x94, 0xc1, 0x5d, 0x32, 0x09, 0x97, 0x06, 26 | 0xc2, 0x39, 0x5f, 0x94, 0x34, 0x87, 0x45, 0xfd, 27 | 0x75, 0x7c, 0xe3, 0x0e, 0x4e, 0x8c, 0x90, 0xfb, 28 | 0xa2, 0xba, 0xd1, 0x84, 0xf8, 0x83, 0xc6, 0x9f 29 | }; 30 | 31 | /* create a context with no capabilities */ 32 | data->ctx = secp256k1_context_create(SECP256K1_FLAGS_TYPE_CONTEXT); 33 | for (i = 0; i < 32; i++) { 34 | data->scalar[i] = i + 1; 35 | } 36 | CHECK(secp256k1_ec_pubkey_parse(data->ctx, &data->point, point, sizeof(point)) == 1); 37 | } 38 | 39 | static void bench_ecdh(void* arg) { 40 | int i; 41 | unsigned char res[32]; 42 | bench_ecdh_t *data = (bench_ecdh_t*)arg; 43 | 44 | for (i = 0; i < 20000; i++) { 45 | CHECK(secp256k1_ecdh(data->ctx, res, &data->point, data->scalar) == 1); 46 | } 47 | } 48 | 49 | int main(void) { 50 | bench_ecdh_t data; 51 | 52 | run_benchmark("ecdh", bench_ecdh, bench_ecdh_setup, NULL, &data, 10, 20000); 53 | return 0; 54 | } 55 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/bn256/cloudflare/gfp.go: -------------------------------------------------------------------------------- 1 | package bn256 2 | 3 | import ( 4 | "errors" 5 | "fmt" 6 | ) 7 | 8 | type gfP [4]uint64 9 | 10 | func newGFp(x int64) (out *gfP) { 11 | if x >= 0 { 12 | out = &gfP{uint64(x)} 13 | } else { 14 | out = &gfP{uint64(-x)} 15 | gfpNeg(out, out) 16 | } 17 | 18 | montEncode(out, out) 19 | return out 20 | } 21 | 22 | func (e *gfP) String() string { 23 | return fmt.Sprintf("%16.16x%16.16x%16.16x%16.16x", e[3], e[2], e[1], e[0]) 24 | } 25 | 26 | func (e *gfP) Set(f *gfP) { 27 | e[0] = f[0] 28 | e[1] = f[1] 29 | e[2] = f[2] 30 | e[3] = f[3] 31 | } 32 | 33 | func (e *gfP) Invert(f *gfP) { 34 | bits := [4]uint64{0x3c208c16d87cfd45, 0x97816a916871ca8d, 0xb85045b68181585d, 0x30644e72e131a029} 35 | 36 | sum, power := &gfP{}, &gfP{} 37 | sum.Set(rN1) 38 | power.Set(f) 39 | 40 | for word := 0; word < 4; word++ { 41 | for bit := uint(0); bit < 64; bit++ { 42 | if (bits[word]>>bit)&1 == 1 { 43 | gfpMul(sum, sum, power) 44 | } 45 | gfpMul(power, power, power) 46 | } 47 | } 48 | 49 | gfpMul(sum, sum, r3) 50 | e.Set(sum) 51 | } 52 | 53 | func (e *gfP) Marshal(out []byte) { 54 | for w := uint(0); w < 4; w++ { 55 | for b := uint(0); b < 8; b++ { 56 | out[8*w+b] = byte(e[3-w] >> (56 - 8*b)) 57 | } 58 | } 59 | } 60 | 61 | func (e *gfP) Unmarshal(in []byte) error { 62 | // Unmarshal the bytes into little endian form 63 | for w := uint(0); w < 4; w++ { 64 | for b := uint(0); b < 8; b++ { 65 | e[3-w] += uint64(in[8*w+b]) << (56 - 8*b) 66 | } 67 | } 68 | // Ensure the point respects the curve modulus 69 | for i := 3; i >= 0; i-- { 70 | if e[i] < p2[i] { 71 | return nil 72 | } 73 | if e[i] > p2[i] { 74 | return errors.New("bn256: coordinate exceeds modulus") 75 | } 76 | } 77 | return errors.New("bn256: coordinate equals modulus") 78 | } 79 | 80 | func montEncode(c, a *gfP) { gfpMul(c, a, r2) } 81 | func montDecode(c, a *gfP) { gfpMul(c, a, &gfP{1}) } 82 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/src/field_5x52.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Copyright (c) 2013, 2014 Pieter Wuille * 3 | * Distributed under the MIT software license, see the accompanying * 4 | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* 5 | **********************************************************************/ 6 | 7 | #ifndef _SECP256K1_FIELD_REPR_ 8 | #define _SECP256K1_FIELD_REPR_ 9 | 10 | #include 11 | 12 | typedef struct { 13 | /* X = sum(i=0..4, elem[i]*2^52) mod n */ 14 | uint64_t n[5]; 15 | #ifdef VERIFY 16 | int magnitude; 17 | int normalized; 18 | #endif 19 | } secp256k1_fe; 20 | 21 | /* Unpacks a constant into a overlapping multi-limbed FE element. */ 22 | #define SECP256K1_FE_CONST_INNER(d7, d6, d5, d4, d3, d2, d1, d0) { \ 23 | (d0) | (((uint64_t)(d1) & 0xFFFFFUL) << 32), \ 24 | ((uint64_t)(d1) >> 20) | (((uint64_t)(d2)) << 12) | (((uint64_t)(d3) & 0xFFUL) << 44), \ 25 | ((uint64_t)(d3) >> 8) | (((uint64_t)(d4) & 0xFFFFFFFUL) << 24), \ 26 | ((uint64_t)(d4) >> 28) | (((uint64_t)(d5)) << 4) | (((uint64_t)(d6) & 0xFFFFUL) << 36), \ 27 | ((uint64_t)(d6) >> 16) | (((uint64_t)(d7)) << 16) \ 28 | } 29 | 30 | #ifdef VERIFY 31 | #define SECP256K1_FE_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {SECP256K1_FE_CONST_INNER((d7), (d6), (d5), (d4), (d3), (d2), (d1), (d0)), 1, 1} 32 | #else 33 | #define SECP256K1_FE_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {SECP256K1_FE_CONST_INNER((d7), (d6), (d5), (d4), (d3), (d2), (d1), (d0))} 34 | #endif 35 | 36 | typedef struct { 37 | uint64_t n[4]; 38 | } secp256k1_fe_storage; 39 | 40 | #define SECP256K1_FE_STORAGE_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {{ \ 41 | (d0) | (((uint64_t)(d1)) << 32), \ 42 | (d2) | (((uint64_t)(d3)) << 32), \ 43 | (d4) | (((uint64_t)(d5)) << 32), \ 44 | (d6) | (((uint64_t)(d7)) << 32) \ 45 | }} 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012, Suryandaru Triandana 2 | // All rights reserved. 3 | // 4 | // Use of this source code is governed by a BSD-style license that can be 5 | // found in the LICENSE file. 6 | 7 | package leveldb 8 | 9 | import ( 10 | "fmt" 11 | "sort" 12 | 13 | "github.com/syndtr/goleveldb/leveldb/storage" 14 | ) 15 | 16 | func shorten(str string) string { 17 | if len(str) <= 8 { 18 | return str 19 | } 20 | return str[:3] + ".." + str[len(str)-3:] 21 | } 22 | 23 | var bunits = [...]string{"", "Ki", "Mi", "Gi"} 24 | 25 | func shortenb(bytes int) string { 26 | i := 0 27 | for ; bytes > 1024 && i < 4; i++ { 28 | bytes /= 1024 29 | } 30 | return fmt.Sprintf("%d%sB", bytes, bunits[i]) 31 | } 32 | 33 | func sshortenb(bytes int) string { 34 | if bytes == 0 { 35 | return "~" 36 | } 37 | sign := "+" 38 | if bytes < 0 { 39 | sign = "-" 40 | bytes *= -1 41 | } 42 | i := 0 43 | for ; bytes > 1024 && i < 4; i++ { 44 | bytes /= 1024 45 | } 46 | return fmt.Sprintf("%s%d%sB", sign, bytes, bunits[i]) 47 | } 48 | 49 | func sint(x int) string { 50 | if x == 0 { 51 | return "~" 52 | } 53 | sign := "+" 54 | if x < 0 { 55 | sign = "-" 56 | x *= -1 57 | } 58 | return fmt.Sprintf("%s%d", sign, x) 59 | } 60 | 61 | func minInt(a, b int) int { 62 | if a < b { 63 | return a 64 | } 65 | return b 66 | } 67 | 68 | func maxInt(a, b int) int { 69 | if a > b { 70 | return a 71 | } 72 | return b 73 | } 74 | 75 | type fdSorter []storage.FileDesc 76 | 77 | func (p fdSorter) Len() int { 78 | return len(p) 79 | } 80 | 81 | func (p fdSorter) Less(i, j int) bool { 82 | return p[i].Num < p[j].Num 83 | } 84 | 85 | func (p fdSorter) Swap(i, j int) { 86 | p[i], p[j] = p[j], p[i] 87 | } 88 | 89 | func sortFds(fds []storage.FileDesc) { 90 | sort.Sort(fdSorter(fds)) 91 | } 92 | 93 | func ensureBuffer(b []byte, n int) []byte { 94 | if cap(b) < n { 95 | return make([]byte, n) 96 | } 97 | return b[:n] 98 | } 99 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/file_storage_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012, Suryandaru Triandana 2 | // All rights reserved. 3 | // 4 | // Use of this source code is governed by a BSD-style license that can be 5 | // found in the LICENSE file. 6 | 7 | // +build darwin dragonfly freebsd linux netbsd openbsd 8 | 9 | package storage 10 | 11 | import ( 12 | "os" 13 | "syscall" 14 | ) 15 | 16 | type unixFileLock struct { 17 | f *os.File 18 | } 19 | 20 | func (fl *unixFileLock) release() error { 21 | if err := setFileLock(fl.f, false, false); err != nil { 22 | return err 23 | } 24 | return fl.f.Close() 25 | } 26 | 27 | func newFileLock(path string, readOnly bool) (fl fileLock, err error) { 28 | var flag int 29 | if readOnly { 30 | flag = os.O_RDONLY 31 | } else { 32 | flag = os.O_RDWR 33 | } 34 | f, err := os.OpenFile(path, flag, 0) 35 | if os.IsNotExist(err) { 36 | f, err = os.OpenFile(path, flag|os.O_CREATE, 0644) 37 | } 38 | if err != nil { 39 | return 40 | } 41 | err = setFileLock(f, readOnly, true) 42 | if err != nil { 43 | f.Close() 44 | return 45 | } 46 | fl = &unixFileLock{f: f} 47 | return 48 | } 49 | 50 | func setFileLock(f *os.File, readOnly, lock bool) error { 51 | how := syscall.LOCK_UN 52 | if lock { 53 | if readOnly { 54 | how = syscall.LOCK_SH 55 | } else { 56 | how = syscall.LOCK_EX 57 | } 58 | } 59 | return syscall.Flock(int(f.Fd()), how|syscall.LOCK_NB) 60 | } 61 | 62 | func rename(oldpath, newpath string) error { 63 | return os.Rename(oldpath, newpath) 64 | } 65 | 66 | func isErrInvalid(err error) bool { 67 | if err == os.ErrInvalid { 68 | return true 69 | } 70 | if syserr, ok := err.(*os.SyscallError); ok && syserr.Err == syscall.EINVAL { 71 | return true 72 | } 73 | return false 74 | } 75 | 76 | func syncDir(name string) error { 77 | f, err := os.Open(name) 78 | if err != nil { 79 | return err 80 | } 81 | defer f.Close() 82 | if err := f.Sync(); err != nil && !isErrInvalid(err) { 83 | return err 84 | } 85 | return nil 86 | } 87 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/src/bench.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Copyright (c) 2014 Pieter Wuille * 3 | * Distributed under the MIT software license, see the accompanying * 4 | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* 5 | **********************************************************************/ 6 | 7 | #ifndef _SECP256K1_BENCH_H_ 8 | #define _SECP256K1_BENCH_H_ 9 | 10 | #include 11 | #include 12 | #include "sys/time.h" 13 | 14 | static double gettimedouble(void) { 15 | struct timeval tv; 16 | gettimeofday(&tv, NULL); 17 | return tv.tv_usec * 0.000001 + tv.tv_sec; 18 | } 19 | 20 | void print_number(double x) { 21 | double y = x; 22 | int c = 0; 23 | if (y < 0.0) { 24 | y = -y; 25 | } 26 | while (y < 100.0) { 27 | y *= 10.0; 28 | c++; 29 | } 30 | printf("%.*f", c, x); 31 | } 32 | 33 | void run_benchmark(char *name, void (*benchmark)(void*), void (*setup)(void*), void (*teardown)(void*), void* data, int count, int iter) { 34 | int i; 35 | double min = HUGE_VAL; 36 | double sum = 0.0; 37 | double max = 0.0; 38 | for (i = 0; i < count; i++) { 39 | double begin, total; 40 | if (setup != NULL) { 41 | setup(data); 42 | } 43 | begin = gettimedouble(); 44 | benchmark(data); 45 | total = gettimedouble() - begin; 46 | if (teardown != NULL) { 47 | teardown(data); 48 | } 49 | if (total < min) { 50 | min = total; 51 | } 52 | if (total > max) { 53 | max = total; 54 | } 55 | sum += total; 56 | } 57 | printf("%s: min ", name); 58 | print_number(min * 1000000.0 / iter); 59 | printf("us / avg "); 60 | print_number((sum / count) * 1000000.0 / iter); 61 | printf("us / max "); 62 | print_number(max * 1000000.0 / iter); 63 | printf("us\n"); 64 | } 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/btcsuite/btcd/btcec/genprecomps.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | // This file is ignored during the regular build due to the following build tag. 6 | // It is called by go generate and used to automatically generate pre-computed 7 | // tables used to accelerate operations. 8 | // +build ignore 9 | 10 | package main 11 | 12 | import ( 13 | "bytes" 14 | "compress/zlib" 15 | "encoding/base64" 16 | "fmt" 17 | "log" 18 | "os" 19 | 20 | "github.com/btcsuite/btcd/btcec" 21 | ) 22 | 23 | func main() { 24 | fi, err := os.Create("secp256k1.go") 25 | if err != nil { 26 | log.Fatal(err) 27 | } 28 | defer fi.Close() 29 | 30 | // Compress the serialized byte points. 31 | serialized := btcec.S256().SerializedBytePoints() 32 | var compressed bytes.Buffer 33 | w := zlib.NewWriter(&compressed) 34 | if _, err := w.Write(serialized); err != nil { 35 | fmt.Println(err) 36 | os.Exit(1) 37 | } 38 | w.Close() 39 | 40 | // Encode the compressed byte points with base64. 41 | encoded := make([]byte, base64.StdEncoding.EncodedLen(compressed.Len())) 42 | base64.StdEncoding.Encode(encoded, compressed.Bytes()) 43 | 44 | fmt.Fprintln(fi, "// Copyright (c) 2015 The btcsuite developers") 45 | fmt.Fprintln(fi, "// Use of this source code is governed by an ISC") 46 | fmt.Fprintln(fi, "// license that can be found in the LICENSE file.") 47 | fmt.Fprintln(fi) 48 | fmt.Fprintln(fi, "package btcec") 49 | fmt.Fprintln(fi) 50 | fmt.Fprintln(fi, "// Auto-generated file (see genprecomps.go)") 51 | fmt.Fprintln(fi, "// DO NOT EDIT") 52 | fmt.Fprintln(fi) 53 | fmt.Fprintf(fi, "var secp256k1BytePoints = %q\n", string(encoded)) 54 | 55 | a1, b1, a2, b2 := btcec.S256().EndomorphismVectors() 56 | fmt.Println("The following values are the computed linearly " + 57 | "independent vectors needed to make use of the secp256k1 " + 58 | "endomorphism:") 59 | fmt.Printf("a1: %x\n", a1) 60 | fmt.Printf("b1: %x\n", b1) 61 | fmt.Printf("a2: %x\n", a2) 62 | fmt.Printf("b2: %x\n", b2) 63 | } 64 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/sha3/shake.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package sha3 6 | 7 | // This file defines the ShakeHash interface, and provides 8 | // functions for creating SHAKE instances, as well as utility 9 | // functions for hashing bytes to arbitrary-length output. 10 | 11 | import ( 12 | "io" 13 | ) 14 | 15 | // ShakeHash defines the interface to hash functions that 16 | // support arbitrary-length output. 17 | type ShakeHash interface { 18 | // Write absorbs more data into the hash's state. It panics if input is 19 | // written to it after output has been read from it. 20 | io.Writer 21 | 22 | // Read reads more output from the hash; reading affects the hash's 23 | // state. (ShakeHash.Read is thus very different from Hash.Sum) 24 | // It never returns an error. 25 | io.Reader 26 | 27 | // Clone returns a copy of the ShakeHash in its current state. 28 | Clone() ShakeHash 29 | 30 | // Reset resets the ShakeHash to its initial state. 31 | Reset() 32 | } 33 | 34 | func (d *state) Clone() ShakeHash { 35 | return d.clone() 36 | } 37 | 38 | // NewShake128 creates a new SHAKE128 variable-output-length ShakeHash. 39 | // Its generic security strength is 128 bits against all attacks if at 40 | // least 32 bytes of its output are used. 41 | func NewShake128() ShakeHash { return &state{rate: 168, dsbyte: 0x1f} } 42 | 43 | // NewShake256 creates a new SHAKE128 variable-output-length ShakeHash. 44 | // Its generic security strength is 256 bits against all attacks if 45 | // at least 64 bytes of its output are used. 46 | func NewShake256() ShakeHash { return &state{rate: 136, dsbyte: 0x1f} } 47 | 48 | // ShakeSum128 writes an arbitrary-length digest of data into hash. 49 | func ShakeSum128(hash, data []byte) { 50 | h := NewShake128() 51 | h.Write(data) 52 | h.Read(hash) 53 | } 54 | 55 | // ShakeSum256 writes an arbitrary-length digest of data into hash. 56 | func ShakeSum256(hash, data []byte) { 57 | h := NewShake256() 58 | h.Write(data) 59 | h.Read(hash) 60 | } 61 | -------------------------------------------------------------------------------- /vm/gas.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | package vm 18 | 19 | import ( 20 | "math/big" 21 | 22 | "github.com/ethereum/go-ethereum/params" 23 | ) 24 | 25 | const ( 26 | GasQuickStep uint64 = 2 27 | GasFastestStep uint64 = 3 28 | GasFastStep uint64 = 5 29 | GasMidStep uint64 = 8 30 | GasSlowStep uint64 = 10 31 | GasExtStep uint64 = 20 32 | 33 | GasReturn uint64 = 0 34 | GasStop uint64 = 0 35 | GasContractByte uint64 = 200 36 | ) 37 | 38 | // calcGas returns the actual gas cost of the call. 39 | // 40 | // The cost of gas was changed during the homestead price change HF. To allow for EIP150 41 | // to be implemented. The returned gas is gas - base * 63 / 64. 42 | func callGas(gasTable params.GasTable, availableGas, base uint64, callCost *big.Int) (uint64, error) { 43 | if gasTable.CreateBySuicide > 0 { 44 | availableGas = availableGas - base 45 | gas := availableGas - availableGas/64 46 | // If the bit length exceeds 64 bit we know that the newly calculated "gas" for EIP150 47 | // is smaller than the requested amount. Therefor we return the new gas instead 48 | // of returning an error. 49 | if callCost.BitLen() > 64 || gas < callCost.Uint64() { 50 | return gas, nil 51 | } 52 | } 53 | if callCost.BitLen() > 64 { 54 | return 0, errGasUintOverflow 55 | } 56 | 57 | return callCost.Uint64(), nil 58 | } 59 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/src/field_10x26.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Copyright (c) 2013, 2014 Pieter Wuille * 3 | * Distributed under the MIT software license, see the accompanying * 4 | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* 5 | **********************************************************************/ 6 | 7 | #ifndef _SECP256K1_FIELD_REPR_ 8 | #define _SECP256K1_FIELD_REPR_ 9 | 10 | #include 11 | 12 | typedef struct { 13 | /* X = sum(i=0..9, elem[i]*2^26) mod n */ 14 | uint32_t n[10]; 15 | #ifdef VERIFY 16 | int magnitude; 17 | int normalized; 18 | #endif 19 | } secp256k1_fe; 20 | 21 | /* Unpacks a constant into a overlapping multi-limbed FE element. */ 22 | #define SECP256K1_FE_CONST_INNER(d7, d6, d5, d4, d3, d2, d1, d0) { \ 23 | (d0) & 0x3FFFFFFUL, \ 24 | (((uint32_t)d0) >> 26) | (((uint32_t)(d1) & 0xFFFFFUL) << 6), \ 25 | (((uint32_t)d1) >> 20) | (((uint32_t)(d2) & 0x3FFFUL) << 12), \ 26 | (((uint32_t)d2) >> 14) | (((uint32_t)(d3) & 0xFFUL) << 18), \ 27 | (((uint32_t)d3) >> 8) | (((uint32_t)(d4) & 0x3UL) << 24), \ 28 | (((uint32_t)d4) >> 2) & 0x3FFFFFFUL, \ 29 | (((uint32_t)d4) >> 28) | (((uint32_t)(d5) & 0x3FFFFFUL) << 4), \ 30 | (((uint32_t)d5) >> 22) | (((uint32_t)(d6) & 0xFFFFUL) << 10), \ 31 | (((uint32_t)d6) >> 16) | (((uint32_t)(d7) & 0x3FFUL) << 16), \ 32 | (((uint32_t)d7) >> 10) \ 33 | } 34 | 35 | #ifdef VERIFY 36 | #define SECP256K1_FE_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {SECP256K1_FE_CONST_INNER((d7), (d6), (d5), (d4), (d3), (d2), (d1), (d0)), 1, 1} 37 | #else 38 | #define SECP256K1_FE_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {SECP256K1_FE_CONST_INNER((d7), (d6), (d5), (d4), (d3), (d2), (d1), (d0))} 39 | #endif 40 | 41 | typedef struct { 42 | uint32_t n[8]; 43 | } secp256k1_fe_storage; 44 | 45 | #define SECP256K1_FE_STORAGE_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {{ (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }} 46 | #define SECP256K1_FE_STORAGE_CONST_GET(d) d.n[7], d.n[6], d.n[5], d.n[4],d.n[3], d.n[2], d.n[1], d.n[0] 47 | #endif 48 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/src/modules/ecdh/main_impl.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Copyright (c) 2015 Andrew Poelstra * 3 | * Distributed under the MIT software license, see the accompanying * 4 | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* 5 | **********************************************************************/ 6 | 7 | #ifndef _SECP256K1_MODULE_ECDH_MAIN_ 8 | #define _SECP256K1_MODULE_ECDH_MAIN_ 9 | 10 | #include "include/secp256k1_ecdh.h" 11 | #include "ecmult_const_impl.h" 12 | 13 | int secp256k1_ecdh(const secp256k1_context* ctx, unsigned char *result, const secp256k1_pubkey *point, const unsigned char *scalar) { 14 | int ret = 0; 15 | int overflow = 0; 16 | secp256k1_gej res; 17 | secp256k1_ge pt; 18 | secp256k1_scalar s; 19 | VERIFY_CHECK(ctx != NULL); 20 | ARG_CHECK(result != NULL); 21 | ARG_CHECK(point != NULL); 22 | ARG_CHECK(scalar != NULL); 23 | 24 | secp256k1_pubkey_load(ctx, &pt, point); 25 | secp256k1_scalar_set_b32(&s, scalar, &overflow); 26 | if (overflow || secp256k1_scalar_is_zero(&s)) { 27 | ret = 0; 28 | } else { 29 | unsigned char x[32]; 30 | unsigned char y[1]; 31 | secp256k1_sha256_t sha; 32 | 33 | secp256k1_ecmult_const(&res, &pt, &s); 34 | secp256k1_ge_set_gej(&pt, &res); 35 | /* Compute a hash of the point in compressed form 36 | * Note we cannot use secp256k1_eckey_pubkey_serialize here since it does not 37 | * expect its output to be secret and has a timing sidechannel. */ 38 | secp256k1_fe_normalize(&pt.x); 39 | secp256k1_fe_normalize(&pt.y); 40 | secp256k1_fe_get_b32(x, &pt.x); 41 | y[0] = 0x02 | secp256k1_fe_is_odd(&pt.y); 42 | 43 | secp256k1_sha256_initialize(&sha); 44 | secp256k1_sha256_write(&sha, y, sizeof(y)); 45 | secp256k1_sha256_write(&sha, x, sizeof(x)); 46 | secp256k1_sha256_finalize(&sha, result); 47 | ret = 1; 48 | } 49 | 50 | secp256k1_scalar_clear(&s); 51 | return ret; 52 | } 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/file_storage_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013, Suryandaru Triandana 2 | // All rights reserved. 3 | // 4 | // Use of this source code is governed by a BSD-style license that can be 5 | // found in the LICENSE file. 6 | 7 | package storage 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | var ( 15 | modkernel32 = syscall.NewLazyDLL("kernel32.dll") 16 | 17 | procMoveFileExW = modkernel32.NewProc("MoveFileExW") 18 | ) 19 | 20 | const ( 21 | _MOVEFILE_REPLACE_EXISTING = 1 22 | ) 23 | 24 | type windowsFileLock struct { 25 | fd syscall.Handle 26 | } 27 | 28 | func (fl *windowsFileLock) release() error { 29 | return syscall.Close(fl.fd) 30 | } 31 | 32 | func newFileLock(path string, readOnly bool) (fl fileLock, err error) { 33 | pathp, err := syscall.UTF16PtrFromString(path) 34 | if err != nil { 35 | return 36 | } 37 | var access, shareMode uint32 38 | if readOnly { 39 | access = syscall.GENERIC_READ 40 | shareMode = syscall.FILE_SHARE_READ 41 | } else { 42 | access = syscall.GENERIC_READ | syscall.GENERIC_WRITE 43 | } 44 | fd, err := syscall.CreateFile(pathp, access, shareMode, nil, syscall.OPEN_EXISTING, syscall.FILE_ATTRIBUTE_NORMAL, 0) 45 | if err == syscall.ERROR_FILE_NOT_FOUND { 46 | fd, err = syscall.CreateFile(pathp, access, shareMode, nil, syscall.OPEN_ALWAYS, syscall.FILE_ATTRIBUTE_NORMAL, 0) 47 | } 48 | if err != nil { 49 | return 50 | } 51 | fl = &windowsFileLock{fd: fd} 52 | return 53 | } 54 | 55 | func moveFileEx(from *uint16, to *uint16, flags uint32) error { 56 | r1, _, e1 := syscall.Syscall(procMoveFileExW.Addr(), 3, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), uintptr(flags)) 57 | if r1 == 0 { 58 | if e1 != 0 { 59 | return error(e1) 60 | } 61 | return syscall.EINVAL 62 | } 63 | return nil 64 | } 65 | 66 | func rename(oldpath, newpath string) error { 67 | from, err := syscall.UTF16PtrFromString(oldpath) 68 | if err != nil { 69 | return err 70 | } 71 | to, err := syscall.UTF16PtrFromString(newpath) 72 | if err != nil { 73 | return err 74 | } 75 | return moveFileEx(from, to, _MOVEFILE_REPLACE_EXISTING) 76 | } 77 | 78 | func syncDir(name string) error { return nil } 79 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/params/gas_table.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | package params 18 | 19 | type GasTable struct { 20 | ExtcodeSize uint64 21 | ExtcodeCopy uint64 22 | Balance uint64 23 | SLoad uint64 24 | Calls uint64 25 | Suicide uint64 26 | 27 | ExpByte uint64 28 | 29 | // CreateBySuicide occurs when the 30 | // refunded account is one that does 31 | // not exist. This logic is similar 32 | // to call. May be left nil. Nil means 33 | // not charged. 34 | CreateBySuicide uint64 35 | } 36 | 37 | var ( 38 | // GasTableHomestead contain the gas prices for 39 | // the homestead phase. 40 | GasTableHomestead = GasTable{ 41 | ExtcodeSize: 20, 42 | ExtcodeCopy: 20, 43 | Balance: 20, 44 | SLoad: 50, 45 | Calls: 40, 46 | Suicide: 0, 47 | ExpByte: 10, 48 | } 49 | 50 | // GasTableHomestead contain the gas re-prices for 51 | // the homestead phase. 52 | GasTableEIP150 = GasTable{ 53 | ExtcodeSize: 700, 54 | ExtcodeCopy: 700, 55 | Balance: 400, 56 | SLoad: 200, 57 | Calls: 700, 58 | Suicide: 5000, 59 | ExpByte: 10, 60 | 61 | CreateBySuicide: 25000, 62 | } 63 | 64 | GasTableEIP158 = GasTable{ 65 | ExtcodeSize: 700, 66 | ExtcodeCopy: 700, 67 | Balance: 400, 68 | SLoad: 200, 69 | Calls: 700, 70 | Suicide: 5000, 71 | ExpByte: 50, 72 | 73 | CreateBySuicide: 25000, 74 | } 75 | ) 76 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/errors/errors.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014, Suryandaru Triandana 2 | // All rights reserved. 3 | // 4 | // Use of this source code is governed by a BSD-style license that can be 5 | // found in the LICENSE file. 6 | 7 | // Package errors provides common error types used throughout leveldb. 8 | package errors 9 | 10 | import ( 11 | "errors" 12 | "fmt" 13 | 14 | "github.com/syndtr/goleveldb/leveldb/storage" 15 | "github.com/syndtr/goleveldb/leveldb/util" 16 | ) 17 | 18 | // Common errors. 19 | var ( 20 | ErrNotFound = New("leveldb: not found") 21 | ErrReleased = util.ErrReleased 22 | ErrHasReleaser = util.ErrHasReleaser 23 | ) 24 | 25 | // New returns an error that formats as the given text. 26 | func New(text string) error { 27 | return errors.New(text) 28 | } 29 | 30 | // ErrCorrupted is the type that wraps errors that indicate corruption in 31 | // the database. 32 | type ErrCorrupted struct { 33 | Fd storage.FileDesc 34 | Err error 35 | } 36 | 37 | func (e *ErrCorrupted) Error() string { 38 | if !e.Fd.Zero() { 39 | return fmt.Sprintf("%v [file=%v]", e.Err, e.Fd) 40 | } 41 | return e.Err.Error() 42 | } 43 | 44 | // NewErrCorrupted creates new ErrCorrupted error. 45 | func NewErrCorrupted(fd storage.FileDesc, err error) error { 46 | return &ErrCorrupted{fd, err} 47 | } 48 | 49 | // IsCorrupted returns a boolean indicating whether the error is indicating 50 | // a corruption. 51 | func IsCorrupted(err error) bool { 52 | switch err.(type) { 53 | case *ErrCorrupted: 54 | return true 55 | case *storage.ErrCorrupted: 56 | return true 57 | } 58 | return false 59 | } 60 | 61 | // ErrMissingFiles is the type that indicating a corruption due to missing 62 | // files. ErrMissingFiles always wrapped with ErrCorrupted. 63 | type ErrMissingFiles struct { 64 | Fds []storage.FileDesc 65 | } 66 | 67 | func (e *ErrMissingFiles) Error() string { return "file missing" } 68 | 69 | // SetFd sets 'file info' of the given error with the given file. 70 | // Currently only ErrCorrupted is supported, otherwise will do nothing. 71 | func SetFd(err error, fd storage.FileDesc) error { 72 | switch x := err.(type) { 73 | case *ErrCorrupted: 74 | x.Fd = fd 75 | return x 76 | } 77 | return err 78 | } 79 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/accounts/abi/event.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | package abi 18 | 19 | import ( 20 | "fmt" 21 | "strings" 22 | 23 | "github.com/ethereum/go-ethereum/common" 24 | "github.com/ethereum/go-ethereum/crypto" 25 | ) 26 | 27 | // Event is an event potentially triggered by the EVM's LOG mechanism. The Event 28 | // holds type information (inputs) about the yielded output. Anonymous events 29 | // don't get the signature canonical representation as the first LOG topic. 30 | type Event struct { 31 | Name string 32 | Anonymous bool 33 | Inputs Arguments 34 | } 35 | 36 | func (event Event) String() string { 37 | inputs := make([]string, len(event.Inputs)) 38 | for i, input := range event.Inputs { 39 | inputs[i] = fmt.Sprintf("%v %v", input.Name, input.Type) 40 | if input.Indexed { 41 | inputs[i] = fmt.Sprintf("%v indexed %v", input.Name, input.Type) 42 | } 43 | } 44 | return fmt.Sprintf("event %v(%v)", event.Name, strings.Join(inputs, ", ")) 45 | } 46 | 47 | // Id returns the canonical representation of the event's signature used by the 48 | // abi definition to identify event names and types. 49 | func (e Event) Id() common.Hash { 50 | types := make([]string, len(e.Inputs)) 51 | i := 0 52 | for _, input := range e.Inputs { 53 | types[i] = input.Type.String() 54 | i++ 55 | } 56 | return common.BytesToHash(crypto.Keccak256([]byte(fmt.Sprintf("%v(%v)", e.Name, strings.Join(types, ","))))) 57 | } 58 | -------------------------------------------------------------------------------- /examples/event/coin_sol_Coin.bin: -------------------------------------------------------------------------------- 1 | 6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061042d8061005e6000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063075461721461006757806327e235e3146100bc57806340c10f1914610109578063d0679d341461014b575b600080fd5b341561007257600080fd5b61007a61018d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100c757600080fd5b6100f3600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506101b2565b6040518082815260200191505060405180910390f35b341561011457600080fd5b610149600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506101ca565b005b341561015657600080fd5b61018b600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610277565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60016020528060005260406000206000915090505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561022557610273565b80600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055505b5050565b80600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156102c3576103fd565b80600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555080600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055507f3990db2d31862302a685e8086b5755072a6e2b5b780af1ee81ece35ee3cd3345338383604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a15b50505600a165627a7a723058209eaab178ae43b547018b5779b63a069c377d961e5972614c00351dda4c5c20820029 -------------------------------------------------------------------------------- /types/bloom9_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | package types 18 | 19 | import ( 20 | "math/big" 21 | "testing" 22 | ) 23 | 24 | func TestBloom(t *testing.T) { 25 | positive := []string{ 26 | "testtest", 27 | "test", 28 | "hallo", 29 | "other", 30 | } 31 | negative := []string{ 32 | "tes", 33 | "lo", 34 | } 35 | 36 | var bloom Bloom 37 | for _, data := range positive { 38 | bloom.Add(new(big.Int).SetBytes([]byte(data))) 39 | } 40 | 41 | for _, data := range positive { 42 | if !bloom.TestBytes([]byte(data)) { 43 | t.Error("expected", data, "to test true") 44 | } 45 | } 46 | for _, data := range negative { 47 | if bloom.TestBytes([]byte(data)) { 48 | t.Error("did not expect", data, "to test true") 49 | } 50 | } 51 | } 52 | 53 | /* 54 | import ( 55 | "testing" 56 | 57 | "github.com/duanbing/go-evm/state" 58 | ) 59 | 60 | func TestBloom9(t *testing.T) { 61 | testCase := []byte("testtest") 62 | bin := LogsBloom([]state.Log{ 63 | {testCase, [][]byte{[]byte("hellohello")}, nil}, 64 | }).Bytes() 65 | res := BloomLookup(bin, testCase) 66 | 67 | if !res { 68 | t.Errorf("Bloom lookup failed") 69 | } 70 | } 71 | 72 | 73 | func TestAddress(t *testing.T) { 74 | block := &Block{} 75 | block.Coinbase = common.Hex2Bytes("22341ae42d6dd7384bc8584e50419ea3ac75b83f") 76 | fmt.Printf("%x\n", crypto.Keccak256(block.Coinbase)) 77 | 78 | bin := CreateBloom(block) 79 | fmt.Printf("bin = %x\n", common.LeftPadBytes(bin, 64)) 80 | } 81 | */ 82 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/btcsuite/btcd/btcec/precompute.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | package btcec 6 | 7 | import ( 8 | "compress/zlib" 9 | "encoding/base64" 10 | "encoding/binary" 11 | "io/ioutil" 12 | "strings" 13 | ) 14 | 15 | //go:generate go run -tags gensecp256k1 genprecomps.go 16 | 17 | // loadS256BytePoints decompresses and deserializes the pre-computed byte points 18 | // used to accelerate scalar base multiplication for the secp256k1 curve. This 19 | // approach is used since it allows the compile to use significantly less ram 20 | // and be performed much faster than it is with hard-coding the final in-memory 21 | // data structure. At the same time, it is quite fast to generate the in-memory 22 | // data structure at init time with this approach versus computing the table. 23 | func loadS256BytePoints() error { 24 | // There will be no byte points to load when generating them. 25 | bp := secp256k1BytePoints 26 | if len(bp) == 0 { 27 | return nil 28 | } 29 | 30 | // Decompress the pre-computed table used to accelerate scalar base 31 | // multiplication. 32 | decoder := base64.NewDecoder(base64.StdEncoding, strings.NewReader(bp)) 33 | r, err := zlib.NewReader(decoder) 34 | if err != nil { 35 | return err 36 | } 37 | serialized, err := ioutil.ReadAll(r) 38 | if err != nil { 39 | return err 40 | } 41 | 42 | // Deserialize the precomputed byte points and set the curve to them. 43 | offset := 0 44 | var bytePoints [32][256][3]fieldVal 45 | for byteNum := 0; byteNum < 32; byteNum++ { 46 | // All points in this window. 47 | for i := 0; i < 256; i++ { 48 | px := &bytePoints[byteNum][i][0] 49 | py := &bytePoints[byteNum][i][1] 50 | pz := &bytePoints[byteNum][i][2] 51 | for i := 0; i < 10; i++ { 52 | px.n[i] = binary.LittleEndian.Uint32(serialized[offset:]) 53 | offset += 4 54 | } 55 | for i := 0; i < 10; i++ { 56 | py.n[i] = binary.LittleEndian.Uint32(serialized[offset:]) 57 | offset += 4 58 | } 59 | for i := 0; i < 10; i++ { 60 | pz.n[i] = binary.LittleEndian.Uint32(serialized[offset:]) 61 | offset += 4 62 | } 63 | } 64 | } 65 | secp256k1.bytePoints = &bytePoints 66 | return nil 67 | } 68 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util/util.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013, Suryandaru Triandana 2 | // All rights reserved. 3 | // 4 | // Use of this source code is governed by a BSD-style license that can be 5 | // found in the LICENSE file. 6 | 7 | // Package util provides utilities used throughout leveldb. 8 | package util 9 | 10 | import ( 11 | "errors" 12 | ) 13 | 14 | var ( 15 | ErrReleased = errors.New("leveldb: resource already relesed") 16 | ErrHasReleaser = errors.New("leveldb: releaser already defined") 17 | ) 18 | 19 | // Releaser is the interface that wraps the basic Release method. 20 | type Releaser interface { 21 | // Release releases associated resources. Release should always success 22 | // and can be called multiple times without causing error. 23 | Release() 24 | } 25 | 26 | // ReleaseSetter is the interface that wraps the basic SetReleaser method. 27 | type ReleaseSetter interface { 28 | // SetReleaser associates the given releaser to the resources. The 29 | // releaser will be called once coresponding resources released. 30 | // Calling SetReleaser with nil will clear the releaser. 31 | // 32 | // This will panic if a releaser already present or coresponding 33 | // resource is already released. Releaser should be cleared first 34 | // before assigned a new one. 35 | SetReleaser(releaser Releaser) 36 | } 37 | 38 | // BasicReleaser provides basic implementation of Releaser and ReleaseSetter. 39 | type BasicReleaser struct { 40 | releaser Releaser 41 | released bool 42 | } 43 | 44 | // Released returns whether Release method already called. 45 | func (r *BasicReleaser) Released() bool { 46 | return r.released 47 | } 48 | 49 | // Release implements Releaser.Release. 50 | func (r *BasicReleaser) Release() { 51 | if !r.released { 52 | if r.releaser != nil { 53 | r.releaser.Release() 54 | r.releaser = nil 55 | } 56 | r.released = true 57 | } 58 | } 59 | 60 | // SetReleaser implements ReleaseSetter.SetReleaser. 61 | func (r *BasicReleaser) SetReleaser(releaser Releaser) { 62 | if r.released { 63 | panic(ErrReleased) 64 | } 65 | if r.releaser != nil && releaser != nil { 66 | panic(ErrHasReleaser) 67 | } 68 | r.releaser = releaser 69 | } 70 | 71 | type NoopReleaser struct{} 72 | 73 | func (NoopReleaser) Release() {} 74 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/metrics/disk_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | // Contains the Linux implementation of process disk IO counter retrieval. 18 | 19 | package metrics 20 | 21 | import ( 22 | "bufio" 23 | "fmt" 24 | "io" 25 | "os" 26 | "strconv" 27 | "strings" 28 | ) 29 | 30 | // ReadDiskStats retrieves the disk IO stats belonging to the current process. 31 | func ReadDiskStats(stats *DiskStats) error { 32 | // Open the process disk IO counter file 33 | inf, err := os.Open(fmt.Sprintf("/proc/%d/io", os.Getpid())) 34 | if err != nil { 35 | return err 36 | } 37 | defer inf.Close() 38 | in := bufio.NewReader(inf) 39 | 40 | // Iterate over the IO counter, and extract what we need 41 | for { 42 | // Read the next line and split to key and value 43 | line, err := in.ReadString('\n') 44 | if err != nil { 45 | if err == io.EOF { 46 | return nil 47 | } 48 | return err 49 | } 50 | parts := strings.Split(line, ":") 51 | if len(parts) != 2 { 52 | continue 53 | } 54 | key := strings.TrimSpace(parts[0]) 55 | value, err := strconv.ParseInt(strings.TrimSpace(parts[1]), 10, 64) 56 | if err != nil { 57 | return err 58 | } 59 | 60 | // Update the counter based on the key 61 | switch key { 62 | case "syscr": 63 | stats.ReadCount = value 64 | case "syscw": 65 | stats.WriteCount = value 66 | case "rchar": 67 | stats.ReadBytes = value 68 | case "wchar": 69 | stats.WriteBytes = value 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/rcrowley/go-metrics/syslog.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package metrics 4 | 5 | import ( 6 | "fmt" 7 | "log/syslog" 8 | "time" 9 | ) 10 | 11 | // Output each metric in the given registry to syslog periodically using 12 | // the given syslogger. 13 | func Syslog(r Registry, d time.Duration, w *syslog.Writer) { 14 | for _ = range time.Tick(d) { 15 | r.Each(func(name string, i interface{}) { 16 | switch metric := i.(type) { 17 | case Counter: 18 | w.Info(fmt.Sprintf("counter %s: count: %d", name, metric.Count())) 19 | case Gauge: 20 | w.Info(fmt.Sprintf("gauge %s: value: %d", name, metric.Value())) 21 | case GaugeFloat64: 22 | w.Info(fmt.Sprintf("gauge %s: value: %f", name, metric.Value())) 23 | case Healthcheck: 24 | metric.Check() 25 | w.Info(fmt.Sprintf("healthcheck %s: error: %v", name, metric.Error())) 26 | case Histogram: 27 | h := metric.Snapshot() 28 | ps := h.Percentiles([]float64{0.5, 0.75, 0.95, 0.99, 0.999}) 29 | w.Info(fmt.Sprintf( 30 | "histogram %s: count: %d min: %d max: %d mean: %.2f stddev: %.2f median: %.2f 75%%: %.2f 95%%: %.2f 99%%: %.2f 99.9%%: %.2f", 31 | name, 32 | h.Count(), 33 | h.Min(), 34 | h.Max(), 35 | h.Mean(), 36 | h.StdDev(), 37 | ps[0], 38 | ps[1], 39 | ps[2], 40 | ps[3], 41 | ps[4], 42 | )) 43 | case Meter: 44 | m := metric.Snapshot() 45 | w.Info(fmt.Sprintf( 46 | "meter %s: count: %d 1-min: %.2f 5-min: %.2f 15-min: %.2f mean: %.2f", 47 | name, 48 | m.Count(), 49 | m.Rate1(), 50 | m.Rate5(), 51 | m.Rate15(), 52 | m.RateMean(), 53 | )) 54 | case Timer: 55 | t := metric.Snapshot() 56 | ps := t.Percentiles([]float64{0.5, 0.75, 0.95, 0.99, 0.999}) 57 | w.Info(fmt.Sprintf( 58 | "timer %s: count: %d min: %d max: %d mean: %.2f stddev: %.2f median: %.2f 75%%: %.2f 95%%: %.2f 99%%: %.2f 99.9%%: %.2f 1-min: %.2f 5-min: %.2f 15-min: %.2f mean-rate: %.2f", 59 | name, 60 | t.Count(), 61 | t.Min(), 62 | t.Max(), 63 | t.Mean(), 64 | t.StdDev(), 65 | ps[0], 66 | ps[1], 67 | ps[2], 68 | ps[3], 69 | ps[4], 70 | t.Rate1(), 71 | t.Rate5(), 72 | t.Rate15(), 73 | t.RateMean(), 74 | )) 75 | } 76 | }) 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/gopkg.in/karalabe/cookiejar.v2/collections/prque/prque.go: -------------------------------------------------------------------------------- 1 | // CookieJar - A contestant's algorithm toolbox 2 | // Copyright (c) 2013 Peter Szilagyi. All rights reserved. 3 | // 4 | // CookieJar is dual licensed: use of this source code is governed by a BSD 5 | // license that can be found in the LICENSE file. Alternatively, the CookieJar 6 | // toolbox may be used in accordance with the terms and conditions contained 7 | // in a signed written agreement between you and the author(s). 8 | 9 | // Package prque implements a priority queue data structure supporting arbitrary 10 | // value types and float priorities. 11 | // 12 | // The reasoning behind using floats for the priorities vs. ints or interfaces 13 | // was larger flexibility without sacrificing too much performance or code 14 | // complexity. 15 | // 16 | // If you would like to use a min-priority queue, simply negate the priorities. 17 | // 18 | // Internally the queue is based on the standard heap package working on a 19 | // sortable version of the block based stack. 20 | package prque 21 | 22 | import ( 23 | "container/heap" 24 | ) 25 | 26 | // Priority queue data structure. 27 | type Prque struct { 28 | cont *sstack 29 | } 30 | 31 | // Creates a new priority queue. 32 | func New() *Prque { 33 | return &Prque{newSstack()} 34 | } 35 | 36 | // Pushes a value with a given priority into the queue, expanding if necessary. 37 | func (p *Prque) Push(data interface{}, priority float32) { 38 | heap.Push(p.cont, &item{data, priority}) 39 | } 40 | 41 | // Pops the value with the greates priority off the stack and returns it. 42 | // Currently no shrinking is done. 43 | func (p *Prque) Pop() (interface{}, float32) { 44 | item := heap.Pop(p.cont).(*item) 45 | return item.value, item.priority 46 | } 47 | 48 | // Pops only the item from the queue, dropping the associated priority value. 49 | func (p *Prque) PopItem() interface{} { 50 | return heap.Pop(p.cont).(*item).value 51 | } 52 | 53 | // Checks whether the priority queue is empty. 54 | func (p *Prque) Empty() bool { 55 | return p.cont.Len() == 0 56 | } 57 | 58 | // Returns the number of element in the priority queue. 59 | func (p *Prque) Size() int { 60 | return p.cont.Len() 61 | } 62 | 63 | // Clears the contents of the priority queue. 64 | func (p *Prque) Reset() { 65 | *p = *New() 66 | } 67 | -------------------------------------------------------------------------------- /vm/intpool.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | package vm 18 | 19 | import "math/big" 20 | 21 | var checkVal = big.NewInt(-42) 22 | 23 | const poolLimit = 256 24 | 25 | // intPool is a pool of big integers that 26 | // can be reused for all big.Int operations. 27 | type intPool struct { 28 | pool *Stack 29 | } 30 | 31 | func newIntPool() *intPool { 32 | return &intPool{pool: newstack()} 33 | } 34 | 35 | // get retrieves a big int from the pool, allocating one if the pool is empty. 36 | // Note, the returned int's value is arbitrary and will not be zeroed! 37 | func (p *intPool) get() *big.Int { 38 | if p.pool.len() > 0 { 39 | return p.pool.pop() 40 | } 41 | return new(big.Int) 42 | } 43 | 44 | // getZero retrieves a big int from the pool, setting it to zero or allocating 45 | // a new one if the pool is empty. 46 | func (p *intPool) getZero() *big.Int { 47 | if p.pool.len() > 0 { 48 | return p.pool.pop().SetUint64(0) 49 | } 50 | return new(big.Int) 51 | } 52 | 53 | // put returns an allocated big int to the pool to be later reused by get calls. 54 | // Note, the values as saved as is; neither put nor get zeroes the ints out! 55 | func (p *intPool) put(is ...*big.Int) { 56 | if len(p.pool.data) > poolLimit { 57 | return 58 | } 59 | for _, i := range is { 60 | // verifyPool is a build flag. Pool verification makes sure the integrity 61 | // of the integer pool by comparing values to a default value. 62 | if verifyPool { 63 | i.Set(checkVal) 64 | } 65 | p.pool.push(i) 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/metrics/syslog.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package metrics 4 | 5 | import ( 6 | "fmt" 7 | "log/syslog" 8 | "time" 9 | ) 10 | 11 | // Output each metric in the given registry to syslog periodically using 12 | // the given syslogger. 13 | func Syslog(r Registry, d time.Duration, w *syslog.Writer) { 14 | for range time.Tick(d) { 15 | r.Each(func(name string, i interface{}) { 16 | switch metric := i.(type) { 17 | case Counter: 18 | w.Info(fmt.Sprintf("counter %s: count: %d", name, metric.Count())) 19 | case Gauge: 20 | w.Info(fmt.Sprintf("gauge %s: value: %d", name, metric.Value())) 21 | case GaugeFloat64: 22 | w.Info(fmt.Sprintf("gauge %s: value: %f", name, metric.Value())) 23 | case Healthcheck: 24 | metric.Check() 25 | w.Info(fmt.Sprintf("healthcheck %s: error: %v", name, metric.Error())) 26 | case Histogram: 27 | h := metric.Snapshot() 28 | ps := h.Percentiles([]float64{0.5, 0.75, 0.95, 0.99, 0.999}) 29 | w.Info(fmt.Sprintf( 30 | "histogram %s: count: %d min: %d max: %d mean: %.2f stddev: %.2f median: %.2f 75%%: %.2f 95%%: %.2f 99%%: %.2f 99.9%%: %.2f", 31 | name, 32 | h.Count(), 33 | h.Min(), 34 | h.Max(), 35 | h.Mean(), 36 | h.StdDev(), 37 | ps[0], 38 | ps[1], 39 | ps[2], 40 | ps[3], 41 | ps[4], 42 | )) 43 | case Meter: 44 | m := metric.Snapshot() 45 | w.Info(fmt.Sprintf( 46 | "meter %s: count: %d 1-min: %.2f 5-min: %.2f 15-min: %.2f mean: %.2f", 47 | name, 48 | m.Count(), 49 | m.Rate1(), 50 | m.Rate5(), 51 | m.Rate15(), 52 | m.RateMean(), 53 | )) 54 | case Timer: 55 | t := metric.Snapshot() 56 | ps := t.Percentiles([]float64{0.5, 0.75, 0.95, 0.99, 0.999}) 57 | w.Info(fmt.Sprintf( 58 | "timer %s: count: %d min: %d max: %d mean: %.2f stddev: %.2f median: %.2f 75%%: %.2f 95%%: %.2f 99%%: %.2f 99.9%%: %.2f 1-min: %.2f 5-min: %.2f 15-min: %.2f mean-rate: %.2f", 59 | name, 60 | t.Count(), 61 | t.Min(), 62 | t.Max(), 63 | t.Mean(), 64 | t.StdDev(), 65 | ps[0], 66 | ps[1], 67 | ps[2], 68 | ps[3], 69 | ps[4], 70 | t.Rate1(), 71 | t.Rate5(), 72 | t.Rate15(), 73 | t.RateMean(), 74 | )) 75 | } 76 | }) 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /state/iterator_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | package state 18 | 19 | import ( 20 | "bytes" 21 | "testing" 22 | 23 | "github.com/ethereum/go-ethereum/common" 24 | "github.com/ethereum/go-ethereum/ethdb" 25 | ) 26 | 27 | // Tests that the node iterator indeed walks over the entire database contents. 28 | func TestNodeIteratorCoverage(t *testing.T) { 29 | // Create some arbitrary test state to iterate 30 | db, root, _ := makeTestState() 31 | 32 | state, err := New(root, db) 33 | if err != nil { 34 | t.Fatalf("failed to create state trie at %x: %v", root, err) 35 | } 36 | // Gather all the node hashes found by the iterator 37 | hashes := make(map[common.Hash]struct{}) 38 | for it := NewNodeIterator(state); it.Next(); { 39 | if it.Hash != (common.Hash{}) { 40 | hashes[it.Hash] = struct{}{} 41 | } 42 | } 43 | // Cross check the iterated hashes and the database/nodepool content 44 | for hash := range hashes { 45 | if _, err := db.TrieDB().Node(hash); err != nil { 46 | t.Errorf("failed to retrieve reported node %x", hash) 47 | } 48 | } 49 | for _, hash := range db.TrieDB().Nodes() { 50 | if _, ok := hashes[hash]; !ok { 51 | t.Errorf("state entry not reported %x", hash) 52 | } 53 | } 54 | for _, key := range db.TrieDB().DiskDB().(*ethdb.MemDatabase).Keys() { 55 | if bytes.HasPrefix(key, []byte("secure-key-")) { 56 | continue 57 | } 58 | if _, ok := hashes[common.BytesToHash(key)]; !ok { 59 | t.Errorf("state entry not reported %x", key) 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/accounts/abi/numbers.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | package abi 18 | 19 | import ( 20 | "math/big" 21 | "reflect" 22 | 23 | "github.com/ethereum/go-ethereum/common" 24 | "github.com/ethereum/go-ethereum/common/math" 25 | ) 26 | 27 | var ( 28 | big_t = reflect.TypeOf(&big.Int{}) 29 | derefbig_t = reflect.TypeOf(big.Int{}) 30 | uint8_t = reflect.TypeOf(uint8(0)) 31 | uint16_t = reflect.TypeOf(uint16(0)) 32 | uint32_t = reflect.TypeOf(uint32(0)) 33 | uint64_t = reflect.TypeOf(uint64(0)) 34 | int_t = reflect.TypeOf(int(0)) 35 | int8_t = reflect.TypeOf(int8(0)) 36 | int16_t = reflect.TypeOf(int16(0)) 37 | int32_t = reflect.TypeOf(int32(0)) 38 | int64_t = reflect.TypeOf(int64(0)) 39 | address_t = reflect.TypeOf(common.Address{}) 40 | int_ts = reflect.TypeOf([]int(nil)) 41 | int8_ts = reflect.TypeOf([]int8(nil)) 42 | int16_ts = reflect.TypeOf([]int16(nil)) 43 | int32_ts = reflect.TypeOf([]int32(nil)) 44 | int64_ts = reflect.TypeOf([]int64(nil)) 45 | ) 46 | 47 | // U256 converts a big Int into a 256bit EVM number. 48 | func U256(n *big.Int) []byte { 49 | return math.PaddedBigBytes(math.U256(n), 32) 50 | } 51 | 52 | // checks whether the given reflect value is signed. This also works for slices with a number type 53 | func isSigned(v reflect.Value) bool { 54 | switch v.Type() { 55 | case int_ts, int8_ts, int16_ts, int32_ts, int64_ts, int_t, int8_t, int16_t, int32_t, int64_t: 56 | return true 57 | } 58 | return false 59 | } 60 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/src/bench_recover.c: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Copyright (c) 2014-2015 Pieter Wuille * 3 | * Distributed under the MIT software license, see the accompanying * 4 | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* 5 | **********************************************************************/ 6 | 7 | #include "include/secp256k1.h" 8 | #include "include/secp256k1_recovery.h" 9 | #include "util.h" 10 | #include "bench.h" 11 | 12 | typedef struct { 13 | secp256k1_context *ctx; 14 | unsigned char msg[32]; 15 | unsigned char sig[64]; 16 | } bench_recover_t; 17 | 18 | void bench_recover(void* arg) { 19 | int i; 20 | bench_recover_t *data = (bench_recover_t*)arg; 21 | secp256k1_pubkey pubkey; 22 | unsigned char pubkeyc[33]; 23 | 24 | for (i = 0; i < 20000; i++) { 25 | int j; 26 | size_t pubkeylen = 33; 27 | secp256k1_ecdsa_recoverable_signature sig; 28 | CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(data->ctx, &sig, data->sig, i % 2)); 29 | CHECK(secp256k1_ecdsa_recover(data->ctx, &pubkey, &sig, data->msg)); 30 | CHECK(secp256k1_ec_pubkey_serialize(data->ctx, pubkeyc, &pubkeylen, &pubkey, SECP256K1_EC_COMPRESSED)); 31 | for (j = 0; j < 32; j++) { 32 | data->sig[j + 32] = data->msg[j]; /* Move former message to S. */ 33 | data->msg[j] = data->sig[j]; /* Move former R to message. */ 34 | data->sig[j] = pubkeyc[j + 1]; /* Move recovered pubkey X coordinate to R (which must be a valid X coordinate). */ 35 | } 36 | } 37 | } 38 | 39 | void bench_recover_setup(void* arg) { 40 | int i; 41 | bench_recover_t *data = (bench_recover_t*)arg; 42 | 43 | for (i = 0; i < 32; i++) { 44 | data->msg[i] = 1 + i; 45 | } 46 | for (i = 0; i < 64; i++) { 47 | data->sig[i] = 65 + i; 48 | } 49 | } 50 | 51 | int main(void) { 52 | bench_recover_t data; 53 | 54 | data.ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY); 55 | 56 | run_benchmark("ecdsa_recover", bench_recover, bench_recover_setup, NULL, &data, 10, 20000); 57 | 58 | secp256k1_context_destroy(data.ctx); 59 | return 0; 60 | } 61 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/filter/filter.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012, Suryandaru Triandana 2 | // All rights reserved. 3 | // 4 | // Use of this source code is governed by a BSD-style license that can be 5 | // found in the LICENSE file. 6 | 7 | // Package filter provides interface and implementation of probabilistic 8 | // data structure. 9 | // 10 | // The filter is resposible for creating small filter from a set of keys. 11 | // These filter will then used to test whether a key is a member of the set. 12 | // In many cases, a filter can cut down the number of disk seeks from a 13 | // handful to a single disk seek per DB.Get call. 14 | package filter 15 | 16 | // Buffer is the interface that wraps basic Alloc, Write and WriteByte methods. 17 | type Buffer interface { 18 | // Alloc allocs n bytes of slice from the buffer. This also advancing 19 | // write offset. 20 | Alloc(n int) []byte 21 | 22 | // Write appends the contents of p to the buffer. 23 | Write(p []byte) (n int, err error) 24 | 25 | // WriteByte appends the byte c to the buffer. 26 | WriteByte(c byte) error 27 | } 28 | 29 | // Filter is the filter. 30 | type Filter interface { 31 | // Name returns the name of this policy. 32 | // 33 | // Note that if the filter encoding changes in an incompatible way, 34 | // the name returned by this method must be changed. Otherwise, old 35 | // incompatible filters may be passed to methods of this type. 36 | Name() string 37 | 38 | // NewGenerator creates a new filter generator. 39 | NewGenerator() FilterGenerator 40 | 41 | // Contains returns true if the filter contains the given key. 42 | // 43 | // The filter are filters generated by the filter generator. 44 | Contains(filter, key []byte) bool 45 | } 46 | 47 | // FilterGenerator is the filter generator. 48 | type FilterGenerator interface { 49 | // Add adds a key to the filter generator. 50 | // 51 | // The key may become invalid after call to this method end, therefor 52 | // key must be copied if implementation require keeping key for later 53 | // use. The key should not modified directly, doing so may cause 54 | // undefined results. 55 | Add(key []byte) 56 | 57 | // Generate generates filters based on keys passed so far. After call 58 | // to Generate the filter generator maybe resetted, depends on implementation. 59 | Generate(b Buffer) 60 | } 61 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/common/types_template.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The go-ethereum Authors 2 | // This file is part of the go-ethereum library. 3 | // 4 | // The go-ethereum library is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // The go-ethereum library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with the go-ethereum library. If not, see . 16 | 17 | // +build none 18 | //sed -e 's/_N_/Hash/g' -e 's/_S_/32/g' -e '1d' types_template.go | gofmt -w hash.go 19 | 20 | package common 21 | 22 | import "math/big" 23 | 24 | type _N_ [_S_]byte 25 | 26 | func BytesTo_N_(b []byte) _N_ { 27 | var h _N_ 28 | h.SetBytes(b) 29 | return h 30 | } 31 | func StringTo_N_(s string) _N_ { return BytesTo_N_([]byte(s)) } 32 | func BigTo_N_(b *big.Int) _N_ { return BytesTo_N_(b.Bytes()) } 33 | func HexTo_N_(s string) _N_ { return BytesTo_N_(FromHex(s)) } 34 | 35 | // Don't use the default 'String' method in case we want to overwrite 36 | 37 | // Get the string representation of the underlying hash 38 | func (h _N_) Str() string { return string(h[:]) } 39 | func (h _N_) Bytes() []byte { return h[:] } 40 | func (h _N_) Big() *big.Int { return new(big.Int).SetBytes(h[:]) } 41 | func (h _N_) Hex() string { return "0x" + Bytes2Hex(h[:]) } 42 | 43 | // Sets the hash to the value of b. If b is larger than len(h) it will panic 44 | func (h *_N_) SetBytes(b []byte) { 45 | // Use the right most bytes 46 | if len(b) > len(h) { 47 | b = b[len(b)-_S_:] 48 | } 49 | 50 | // Reverse the loop 51 | for i := len(b) - 1; i >= 0; i-- { 52 | h[_S_-len(b)+i] = b[i] 53 | } 54 | } 55 | 56 | // Set string `s` to h. If s is larger than len(h) it will panic 57 | func (h *_N_) SetString(s string) { h.SetBytes([]byte(s)) } 58 | 59 | // Sets h to other 60 | func (h *_N_) Set(other _N_) { 61 | for i, v := range other { 62 | h[i] = v 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/comparer/comparer.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012, Suryandaru Triandana 2 | // All rights reserved. 3 | // 4 | // Use of this source code is governed by a BSD-style license that can be 5 | // found in the LICENSE file. 6 | 7 | // Package comparer provides interface and implementation for ordering 8 | // sets of data. 9 | package comparer 10 | 11 | // BasicComparer is the interface that wraps the basic Compare method. 12 | type BasicComparer interface { 13 | // Compare returns -1, 0, or +1 depending on whether a is 'less than', 14 | // 'equal to' or 'greater than' b. The two arguments can only be 'equal' 15 | // if their contents are exactly equal. Furthermore, the empty slice 16 | // must be 'less than' any non-empty slice. 17 | Compare(a, b []byte) int 18 | } 19 | 20 | // Comparer defines a total ordering over the space of []byte keys: a 'less 21 | // than' relationship. 22 | type Comparer interface { 23 | BasicComparer 24 | 25 | // Name returns name of the comparer. 26 | // 27 | // The Level-DB on-disk format stores the comparer name, and opening a 28 | // database with a different comparer from the one it was created with 29 | // will result in an error. 30 | // 31 | // An implementation to a new name whenever the comparer implementation 32 | // changes in a way that will cause the relative ordering of any two keys 33 | // to change. 34 | // 35 | // Names starting with "leveldb." are reserved and should not be used 36 | // by any users of this package. 37 | Name() string 38 | 39 | // Bellow are advanced functions used used to reduce the space requirements 40 | // for internal data structures such as index blocks. 41 | 42 | // Separator appends a sequence of bytes x to dst such that a <= x && x < b, 43 | // where 'less than' is consistent with Compare. An implementation should 44 | // return nil if x equal to a. 45 | // 46 | // Either contents of a or b should not by any means modified. Doing so 47 | // may cause corruption on the internal state. 48 | Separator(dst, a, b []byte) []byte 49 | 50 | // Successor appends a sequence of bytes x to dst such that x >= b, where 51 | // 'less than' is consistent with Compare. An implementation should return 52 | // nil if x equal to b. 53 | // 54 | // Contents of b should not by any means modified. Doing so may cause 55 | // corruption on the internal state. 56 | Successor(dst, b []byte) []byte 57 | } 58 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/src/ecmult_gen.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Copyright (c) 2013, 2014 Pieter Wuille * 3 | * Distributed under the MIT software license, see the accompanying * 4 | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* 5 | **********************************************************************/ 6 | 7 | #ifndef _SECP256K1_ECMULT_GEN_ 8 | #define _SECP256K1_ECMULT_GEN_ 9 | 10 | #include "scalar.h" 11 | #include "group.h" 12 | 13 | typedef struct { 14 | /* For accelerating the computation of a*G: 15 | * To harden against timing attacks, use the following mechanism: 16 | * * Break up the multiplicand into groups of 4 bits, called n_0, n_1, n_2, ..., n_63. 17 | * * Compute sum(n_i * 16^i * G + U_i, i=0..63), where: 18 | * * U_i = U * 2^i (for i=0..62) 19 | * * U_i = U * (1-2^63) (for i=63) 20 | * where U is a point with no known corresponding scalar. Note that sum(U_i, i=0..63) = 0. 21 | * For each i, and each of the 16 possible values of n_i, (n_i * 16^i * G + U_i) is 22 | * precomputed (call it prec(i, n_i)). The formula now becomes sum(prec(i, n_i), i=0..63). 23 | * None of the resulting prec group elements have a known scalar, and neither do any of 24 | * the intermediate sums while computing a*G. 25 | */ 26 | secp256k1_ge_storage (*prec)[64][16]; /* prec[j][i] = 16^j * i * G + U_i */ 27 | secp256k1_scalar blind; 28 | secp256k1_gej initial; 29 | } secp256k1_ecmult_gen_context; 30 | 31 | static void secp256k1_ecmult_gen_context_init(secp256k1_ecmult_gen_context* ctx); 32 | static void secp256k1_ecmult_gen_context_build(secp256k1_ecmult_gen_context* ctx, const secp256k1_callback* cb); 33 | static void secp256k1_ecmult_gen_context_clone(secp256k1_ecmult_gen_context *dst, 34 | const secp256k1_ecmult_gen_context* src, const secp256k1_callback* cb); 35 | static void secp256k1_ecmult_gen_context_clear(secp256k1_ecmult_gen_context* ctx); 36 | static int secp256k1_ecmult_gen_context_is_built(const secp256k1_ecmult_gen_context* ctx); 37 | 38 | /** Multiply with the generator: R = a*G */ 39 | static void secp256k1_ecmult_gen(const secp256k1_ecmult_gen_context* ctx, secp256k1_gej *r, const secp256k1_scalar *a); 40 | 41 | static void secp256k1_ecmult_gen_blind(secp256k1_ecmult_gen_context *ctx, const unsigned char *seed32); 42 | 43 | #endif 44 | --------------------------------------------------------------------------------