Commit Graph

8231 Commits

Author SHA1 Message Date
Felix Lange 5c8fe28b72 common: move big integer math to common/math (#3699)
* common: remove CurrencyToString

Move denomination values to params instead.

* common: delete dead code

* common: move big integer operations to common/math

This commit consolidates all big integer operations into common/math and
adds tests and documentation.

There should be no change in semantics for BigPow, BigMin, BigMax, S256,
U256, Exp and their behaviour is now locked in by tests.

The BigD, BytesToBig and Bytes2Big functions don't provide additional
value, all uses are replaced by new(big.Int).SetBytes().

BigToBytes is now called PaddedBigBytes, its minimum output size
parameter is now specified as the number of bytes instead of bits. The
single use of this function is in the EVM's MSTORE instruction.

Big and String2Big are replaced by ParseBig, which is slightly stricter.
It previously accepted leading zeros for hexadecimal inputs but treated
decimal inputs as octal if a leading zero digit was present.

ParseUint64 is used in places where String2Big was used to decode a
uint64.

The new functions MustParseBig and MustParseUint64 are now used in many
places where parsing errors were previously ignored.

* common: delete unused big integer variables

* accounts/abi: replace uses of BytesToBig with use of encoding/binary

* common: remove BytesToBig

* common: remove Bytes2Big

* common: remove BigTrue

* cmd/utils: add BigFlag and use it for error-checked integer flags

While here, remove environment variable processing for DirectoryFlag
because we don't use it.

* core: add missing error checks in genesis block parser

* common: remove String2Big

* cmd/evm: use utils.BigFlag

* common/math: check for 256 bit overflow in ParseBig

This is supposed to prevent silent overflow/truncation of values in the
genesis block JSON. Without this check, a genesis block that set a
balance larger than 256 bits would lead to weird behaviour in the VM.

* cmd/utils: fixup import
2017-02-26 22:21:51 +01:00
Péter Szilágyi 50ee279f25 Merge pull request #3705 from karalabe/drop-legacy-commands
Drop legacy commands
2017-02-24 13:59:56 +02:00
gluk256 562ccff822 whisper: fixed temporary directory for tests (#3707) 2017-02-24 09:21:01 +01:00
gluk256 11539030cd whisper: expiry refactoring (#3706) 2017-02-23 18:46:32 +01:00
Péter Szilágyi aca066f337
cmd/geth: drop upgradedb subcommand since it's unfeasible
This command was meant as a hackish way to upgrade our chain database way back
when nobody cared for live updates and the size of the database along with its
import times was small. With the current database weighing hundreds of GBs and
processing times of many days, this command is just ludicrous.
2017-02-23 16:49:50 +02:00
Péter Szilágyi 5ee00209d2
cmd/ethtest: drop the manual test tool in favor of hive
All the state and block tests are ran as part of our CU builds internally, as
well as have been added to hive black-box tests. As such, there is no reason for
maintaining an extra standalone tool.
2017-02-23 16:49:50 +02:00
Péter Szilágyi e7bdb00700
cmd/gethrpctest: ethereum/rpc-tests is deprecated
Only ethereum/rpc-tests used this command, which hasn't been maintained for over
a year now, a lot of tests failing. What's left of it was moved underneath hive,
which can run the entire test against a black-box geth without special commands.

Also a new RPC test suite is being added which is also based on black box tests,
not needing special commands any more.
2017-02-23 16:49:49 +02:00
Péter Szilágyi 357732a840 Merge pull request #3696 from karalabe/contextual-logger
Contextual logger
2017-02-23 16:49:05 +02:00
Péter Szilágyi f89dd62776
internal, log: support debug log prints, displaying log origins 2017-02-23 12:16:47 +02:00
Péter Szilágyi 1ca20a2697
cmd, whisper/mailserver: revert to utils.Fatalf 2017-02-23 12:16:46 +02:00
Péter Szilágyi 23a5d64fd0
accounts, cmd: port packages over to the new logging system 2017-02-23 12:16:46 +02:00
Péter Szilágyi 61e6bb1247
eth, les, swarm: fix go vet issues sufraced by log15 2017-02-23 12:16:45 +02:00
Péter Szilágyi d4fd06c3dc
all: blidly swap out glog to our log15, logs need rework 2017-02-23 12:16:44 +02:00
Péter Szilágyi 47af53f9aa
log: implement a glog style pattern matching handler 2017-02-23 12:00:05 +02:00
Péter Szilágyi 3f923f3902
swarm: remove superfluous line break in log statements 2017-02-23 12:00:04 +02:00
Péter Szilágyi 189dee26c6
p2p: remove trailing newlines from log messages 2017-02-23 12:00:04 +02:00
Péter Szilágyi b9d48b4a93
log: add support for trace level, exit on critical 2017-02-23 12:00:03 +02:00
Péter Szilágyi ec7f81f4bc
log, vendor: vendor in log15 inline into our codebase 2017-02-23 12:00:02 +02:00
gluk256 29fac7de44 Whisper API fixed (#3687)
* whisper: wnode updated for tests with geth

* whisper: updated processing of incoming messages

* whisper: symmetric encryption updated

* whisper: filter id type changed to enhance security

* whisper: allow filter without topic for asymmetric encryption

* whisper: POW updated

* whisper: logging updated

* whisper: spellchecker update

* whisper: error handling changed

* whisper: JSON field names fixed
2017-02-23 09:41:47 +01:00
Nick Johnson 555273495b trie: add difference iterator (#3637)
This PR implements a differenceIterator, which allows iterating over trie nodes
that exist in one trie but not in another. This is a prerequisite for most GC
strategies, in order to find obsolete nodes.
2017-02-22 23:49:34 +01:00
Jeffrey Wilcke 024d41d0c2 core, core/state, core/vm: remove exported account getters (#3618)
Removed exported statedb object accessors, reducing the chance for nasty
bugs to creep in. It's also ugly and unnecessary to have these methods.
2017-02-22 23:29:59 +01:00
Péter Szilágyi 46ec4357e7 Merge pull request #3698 from karalabe/govet-latest-only
travis: only run go vet and misspell on latest Go
2017-02-22 17:08:00 +02:00
Péter Szilágyi c6e716eb31
travis: only run go vet and misspell on latest Go 2017-02-22 15:40:28 +02:00
Péter Szilágyi 388803b139 Merge pull request #3682 from karalabe/update-go1.8
travis, appveyor: update builders to Go 1.8
2017-02-22 14:55:47 +02:00
Jeffrey Wilcke 4ac481b45f core/vm, crypto: support for go-fuzz (#3672) 2017-02-21 10:24:07 +01:00
Jeffrey Wilcke 94334c233e cmd/geth: added 'geth bug' command (#3684)
* cmd/geth: added 'geth bug' command

Added bug command to geth, which will open a browser window
with an issue template and some additional system information.

* cmd/geth: update bug with better infos

* cmd/geth: added browser fallback

* cmd/geth: govet yo momma
2017-02-20 15:26:21 +02:00
Péter Szilágyi b7f010de52 tests: cleanup tester blockchain after test run (#3692) 2017-02-20 11:54:23 +01:00
Péter Szilágyi a0c011f1a8
travis: fallback ARM64 builds to Go 1.7.5 due to compiler bug 2017-02-20 11:28:55 +02:00
Péter Szilágyi 449a850023
travis, appveyor: update builders to Go 1.8 2017-02-20 11:22:56 +02:00
Nick Johnson e51f65af1f Merge pull request #3681 from karalabe/usb-hidapi
accounts/usbwallet: swap karalabe/gousb to karalabe/hid
2017-02-19 17:19:40 +01:00
Jeffrey Wilcke 037c8b9ae9 VERSION, params: bumped unstable version to 1.6 (#3685) 2017-02-18 09:28:15 +01:00
Martin Holst Swende b19e5885fe core/blockchain: Change iterator in procFutureBlocks to use lru.Peek instead of Get (#3655) 2017-02-18 09:27:21 +01:00
Felix Lange 9b0af51386 crypto: add btcec fallback for sign/recover without cgo (#3680)
* vendor: add github.com/btcsuite/btcd/btcec

* crypto: add btcec fallback for sign/recover without cgo

This commit adds a non-cgo fallback implementation of secp256k1
operations.

* crypto, core/vm: remove wrappers for sha256, ripemd160
2017-02-18 09:24:12 +01:00
Jeffrey Wilcke bf21549faa common/math: "optimised" SafeMul and added comment on Exp (#3675) 2017-02-17 18:39:43 +01:00
Péter Szilágyi 6f74fb962e Merge pull request #3683 from karalabe/swarm-go1.8-vet-fix
swarm/api/http: fix go vet issue on Go 1.8
2017-02-17 12:08:31 +02:00
Péter Szilágyi 6ec8135256
accounts/usbwallet, vendor: use hidapi instead of libusb directly 2017-02-17 12:04:21 +02:00
Péter Szilágyi e94dfb78f8
swarm/api/http: fix go vet issue on Go 1.8 2017-02-17 11:48:26 +02:00
Péter Szilágyi bdef758d5c Merge pull request #3679 from fjl/vendor-govendor
vendor: update dependencies with github.com/kardianos/govendor
2017-02-16 18:23:58 +02:00
Felix Lange 2c4455b12a vendor: update dependencies with github.com/kardianos/govendor 2017-02-16 13:44:09 +01:00
Felix Lange c8695fae35 logger: remove Core verbosity level (#3659) 2017-02-15 10:14:44 +01:00
Péter Szilágyi a973d1d523 Merge pull request #3674 from obscuren/gaz64
params: core, core/vm, miner: 64bit gas instructions
2017-02-14 18:59:00 +02:00
gluk256 15a609d5d6 whisper: interface changed to simplify the transition to v5
* whisper: mailserver test introduced, refactoring

* whisper: validation test updated

* whisper: max number of peers fixed

* whisper: verification bug fixed

* whisper: esthetic fix

* whisper: interface changed to simplify the transition to v5

* whisper: preparation for version switch
2017-02-14 16:44:47 +02:00
Jeffrey Wilcke c12f4df910 params: core, core/vm, miner: 64bit gas instructions
Reworked the EVM gas instructions to use 64bit integers rather than
arbitrary size big ints. All gas operations, be it additions,
multiplications or divisions, are checked and guarded against 64 bit
integer overflows.

In additon, most of the protocol paramaters in the params package have
been converted to uint64 and are now constants rather than variables.

* common/math: added overflow check ops
* core: vmenv, env renamed to evm
* eth, internal/ethapi, les: unmetered eth_call and cancel methods
* core/vm: implemented big.Int pool for evm instructions
* core/vm: unexported intPool methods & verification methods
* core/vm: added memoryGasCost overflow check and test
2017-02-13 21:44:25 +01:00
Martin Holst Swende 72dcd3c58b core, eth, internal: Added `debug_getBadBlocks()` method (#3654)
* core,eth,internal: Added `debug_getBadBlocks()` method

When bad blocks are discovered, these are stored within geth.
An RPC-endpoint makes them availablewithin the `debug`
namespace. This feature makes it easier to discover network forks.

```

* core, api: go format + docs

* core/blockchain: Documentation, fix minor nitpick

* core: fix failing blockchain test
2017-02-13 21:44:06 +01:00
Péter Szilágyi 4ece9c6cb0
VERSION, params: start 1.5.10 development cycle 2017-02-13 19:02:57 +02:00
Péter Szilágyi a07539fb88 Merge pull request #3671 from karalabe/1.5.9-stable
params: 1.5.9 stable
2017-02-13 18:54:59 +02:00
Péter Szilágyi 6988e5f074 Merge pull request #3670 from karalabe/docker-usb-fix
Dockerfile: support building USB on Alpine, ignore temp files
2017-02-13 18:47:27 +02:00
Péter Szilágyi aba016da72
params: 1.5.9 stable 2017-02-13 18:38:21 +02:00
Péter Szilágyi 09aef5c0ae
Dockerfile: support building USB on Alpine, ignore temp files 2017-02-13 18:31:09 +02:00
Péter Szilágyi 9b161187ec Merge pull request #3649 from ethersphere/swarm-sigterm-fix
cmd/swarm: handle SIGTERM unix signal for clean exit
2017-02-13 18:22:15 +02:00