go-pulse/core
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
..
state all: blidly swap out glog to our log15, logs need rework 2017-02-23 12:16:44 +02:00
types common: move big integer math to common/math (#3699) 2017-02-26 22:21:51 +01:00
vm common: move big integer math to common/math (#3699) 2017-02-26 22:21:51 +01:00
.gitignore Renamed chain => core 2014-12-04 10:28:02 +01:00
asm.go all: fix go vet warnings 2016-04-15 11:17:27 +02:00
bench_test.go common: move big integer math to common/math (#3699) 2017-02-26 22:21:51 +01:00
block_validator_test.go cmd/geth, core: add support for recording SHA3 preimages (#3543) 2017-01-17 12:19:50 +01:00
block_validator.go common: move big integer math to common/math (#3699) 2017-02-26 22:21:51 +01:00
blockchain_test.go params: core, core/vm, miner: 64bit gas instructions 2017-02-13 21:44:25 +01:00
blockchain.go all: blidly swap out glog to our log15, logs need rework 2017-02-23 12:16:44 +02:00
blocks.go core, core/state: fixed consensus issue added touch revert 2016-11-24 22:12:54 +01:00
chain_makers_test.go params: core, core/vm, miner: 64bit gas instructions 2017-02-13 21:44:25 +01:00
chain_makers.go cmd/geth, core: add support for recording SHA3 preimages (#3543) 2017-01-17 12:19:50 +01:00
chain_pow_test.go core, core/state, trie: EIP158, reprice & skip empty account write 2016-11-13 10:44:04 +01:00
chain_pow.go core: separate and contain POW verifier, extensive tests 2015-09-21 10:24:49 +03:00
dao_test.go cmd/geth, core: add support for recording SHA3 preimages (#3543) 2017-01-17 12:19:50 +01:00
dao.go core, core/state, core/vm: remove exported account getters (#3618) 2017-02-22 23:29:59 +01:00
database_util_test.go common: move big integer math to common/math (#3699) 2017-02-26 22:21:51 +01:00
database_util.go all: blidly swap out glog to our log15, logs need rework 2017-02-23 12:16:44 +02:00
default_genesis.go core: remove support for Olympic network 2017-01-12 09:50:54 +01:00
error.go Merge pull request #1889 from karalabe/fast-sync-rebase 2015-10-21 11:44:22 -07:00
events.go core/vm: move Log to core/types 2017-01-06 14:15:22 +01:00
evm.go core, core/vm: implemented a generic environment (#3348) 2016-12-06 02:16:03 +01:00
fees.go Merge pull request #1515 from fjl/license-fixes 2015-07-28 04:29:42 -07:00
filter_test.go all: fix license headers one more time 2015-07-23 18:35:11 +02:00
gaspool.go all: update license information 2016-04-15 09:48:05 +02:00
genesis.go common: move big integer math to common/math (#3699) 2017-02-26 22:21:51 +01:00
headerchain.go all: blidly swap out glog to our log15, logs need rework 2017-02-23 12:16:44 +02:00
helper_test.go cmd/geth, cmd/utils, core, rpc: renamed to blockchain 2015-10-04 01:13:56 +02:00
state_processor.go all: blidly swap out glog to our log15, logs need rework 2017-02-23 12:16:44 +02:00
state_transition.go common: move big integer math to common/math (#3699) 2017-02-26 22:21:51 +01:00
tx_list_test.go core: abstract out a sorted transaction hash map 2016-09-02 14:15:40 +03:00
tx_list.go all: fix spelling errors 2017-01-06 19:44:35 +02:00
tx_pool_test.go common: move big integer math to common/math (#3699) 2017-02-26 22:21:51 +01:00
tx_pool.go all: blidly swap out glog to our log15, logs need rework 2017-02-23 12:16:44 +02:00
types.go core/vm: move Log to core/types 2017-01-06 14:15:22 +01:00