aboutsummaryrefslogtreecommitdiffstats
path: root/tests/state_test_util.go
Commit message (Collapse)AuthorAgeFilesLines
* common: move big integer math to common/math (#3699)Felix Lange2017-02-271-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* all: blidly swap out glog to our log15, logs need reworkPéter Szilágyi2017-02-231-3/+3
|
* core, core/state, core/vm: remove exported account getters (#3618)Jeffrey Wilcke2017-02-231-8/+8
| | | | Removed exported statedb object accessors, reducing the chance for nasty bugs to creep in. It's also ugly and unnecessary to have these methods.
* params: core, core/vm, miner: 64bit gas instructionsJeffrey Wilcke2017-02-141-1/+1
| | | | | | | | | | | | | | | | | 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
* Revert "params: core, core/vm, miner: 64bit gas instructions (#3514)"Jeffrey Wilcke2017-02-131-1/+1
| | | | This reverts commit 8b57c494908637a5c0e74f8f7a13b3218e026757.
* params: core, core/vm, miner: 64bit gas instructions (#3514)Jeffrey Wilcke2017-02-021-1/+1
| | | | | | | | | | | | | | | | 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
* tests: unskip testJeffrey Wilcke2017-01-121-1/+1
|
* all: fix issues reported by honnef.co/go/simple/cmd/gosimpleFelix Lange2017-01-071-1/+1
|
* core/vm: move Log to core/typesFelix Lange2017-01-061-3/+3
| | | | | | | | This significantly reduces the dependency closure of ethclient, which no longer depends on core/vm as of this change. All uses of vm.Logs are replaced by []*types.Log. NewLog is gone too, the constructor simply returned a literal.
* core/vm: improved EVM run loop & instruction calling (#3378)Jeffrey Wilcke2017-01-051-3/+1
| | | | | | | | | | | | | | | The run loop, which previously contained custom opcode executes have been removed and has been simplified to a few checks. Each operation consists of 4 elements: execution function, gas cost function, stack validation function and memory size function. The execution function implements the operation's runtime behaviour, the gas cost function implements the operation gas costs function and greatly depends on the memory and stack, the stack validation function validates the stack and makes sure that enough items can be popped off and pushed on and the memory size function calculates the memory required for the operation and returns it. This commit also allows the EVM to go unmetered. This is helpful for offline operations such as contract calls.
* core, core/vm: implemented a generic environment (#3348)Jeffrey Wilcke2016-12-061-25/+4
| | | | | | | | Environment is now a struct (not an interface). This reduces a lot of tech-debt throughout the codebase where a virtual machine environment had to be implemented in order to test or run it. The new environment is suitable to be used en the json tests, core consensus and light client.
* core, core/state: fixed consensus issue added touch revertJeffrey Wilcke2016-11-251-1/+1
| | | | | Implemented proper touch revert journal entries and copied a Parity consensus bug in order to remain in sync with the current longest chain.
* core/types: turn off nonce checking for Call messagesZsolt Felfoldi2016-11-141-1/+1
|
* core/types, params: EIP#155Jeffrey Wilcke2016-11-131-1/+2
|
* tests: added new EIP158 testsJeffrey Wilcke2016-11-131-2/+7
|
* core, core/state, trie: EIP158, reprice & skip empty account writeJeffrey Wilcke2016-11-131-16/+17
| | | | | | | | | | | | | | | This commit implements EIP158 part 1, 2, 3 & 4 1. If an account is empty it's no longer written to the trie. An empty account is defined as (balance=0, nonce=0, storage=0, code=0). 2. Delete an empty account if it's touched 3. An empty account is redefined as either non-existent or empty. 4. Zero value calls and zero value suicides no longer consume the 25k reation costs. params: moved core/config to params Signed-off-by: Jeffrey Wilcke <jeffrey@ethereum.org>
* Merge pull request #3094 from fjl/tests-updateFelix Lange2016-10-061-1/+8
|\ | | | | tests: update test files from github.com/ethereum/tests @ 45bc1d21d3c1
| * tests: update test files from github.com/ethereum/tests @ 45bc1d21d3c1Felix Lange2016-10-061-1/+8
| | | | | | | | | | | | Two new tests are skipped because they're buggy. Making some newer random state tests work required implementing the 'compressed return value encoding'.
* | core/state: implement reverts by journaling all changesFelix Lange2016-10-061-18/+4
|/ | | | | | | | | | This commit replaces the deep-copy based state revert mechanism with a linear complexity journal. This commit also hides several internal StateDB methods to limit the number of ways in which calling code can use the journal incorrectly. As usual consultation and bug fixes to the initial implementation were provided by @karalabe, @obscuren and @Arachnid. Thank you!
* core/state: track all accounts in canon stateFelix Lange2016-09-261-3/+3
| | | | | This change introduces a global, per-state cache that keeps account data in the canon state. Thanks to @karalabe for lots of fixes.
* all: update license informationFelix Lange2016-04-151-1/+1
|
* core: added basic chain configurationJeffrey Wilcke2016-04-011-22/+14
| | | | | | | | | Added chain configuration options and write out during genesis database insertion. If no "config" was found, nothing is written to the database. Configurations are written on a per genesis base. This means that any chain (which is identified by it's genesis hash) can have their own chain settings.
* core: Added EVM configuration optionsJeffrey Wilcke2016-03-241-1/+0
| | | | | The EVM is now initialised with an additional configured object that allows you to turn on debugging options.
* tests: updated homestead testsJeffrey Wilcke2016-02-181-3/+3
|
* parmas, crypto, core, core/vm: homestead consensus protocol changesGustav Simonsson2016-02-181-7/+10
| | | | | | | | * change gas cost for contract creating txs * invalidate signature with s value greater than secp256k1 N / 2 * OOG contract creation if not enough gas to store code * new difficulty adjustment algorithm * new DELEGATECALL op code
* core, core/state: move gas tracking out of core/stateFelix Lange2015-10-171-5/+3
| | | | | | | The amount of gas available for tx execution was tracked in the StateObject representing the coinbase account. This commit makes the gas counter a separate type in package core, which avoids unintended consequences of intertwining the counter with state logic.
* core/state, core, miner: handle missing root error from state.NewGustav Simonsson2015-10-161-2/+2
|
* cmd/evm, core/vm, test: refactored VM and coreJeffrey Wilcke2015-10-041-2/+2
| | | | | | | | | | | | | | | | | * Moved `vm.Transfer` to `core` package and changed execution to call `env.Transfer` instead of `core.Transfer` directly. * core/vm: byte code VM moved to jump table instead of switch * Moved `vm.Transfer` to `core` package and changed execution to call `env.Transfer` instead of `core.Transfer` directly. * Byte code VM now shares the same code as the JITVM * Renamed Context to Contract * Changed initialiser of state transition & unexported methods * Removed the Execution object and refactor `Call`, `CallCode` & `Create` in to their own functions instead of being methods. * Removed the hard dep on the state for the VM. The VM now depends on a Database interface returned by the environment. In the process the core now depends less on the statedb by usage of the env * Moved `Log` from package `core/state` to package `core/vm`.
* Merge pull request #1405 from fjl/lean-trieJeffrey Wilcke2015-10-011-4/+4
|\ | | | | core, trie: new trie
| * core, core/state: batch-based state syncFelix Lange2015-09-231-4/+4
| |
* | tests: add test for StateTests/stCallCodes.jsonGustav Simonsson2015-09-211-1/+2
|/
* tests: update common test wrappers and test filesGustav Simonsson2015-09-181-3/+0
|
* cmd/evm, core/vm, tests: changed DisableVm to EnableVmJeffrey Wilcke2015-08-121-3/+3
|
* core/vm, tests: implemented semi-jit vmJeffrey Wilcke2015-08-071-0/+56
| | | | * changed stack and removed stack ptr. Let go decide on slice reuse.
* all: fix license headers one more timeFelix Lange2015-07-241-1/+1
| | | | I forgot to update one instance of "go-ethereum" in commit 3f047be5a.
* all: update license headers to distiguish GPL/LGPLFelix Lange2015-07-231-4/+4
| | | | | All code outside of cmd/ is licensed as LGPL. The headers now reflect this by calling the whole work "the go-ethereum library".
* all: update license informationFelix Lange2015-07-071-0/+16
|
* cmd,eth,rpc,tests: default coinbaseJeffrey Wilcke2015-07-071-9/+11
|
* core, miner, tests: renamed state methodsJeffrey Wilcke2015-07-041-1/+1
| | | | | | | | | | | | * Update => SyncIntermediate * Added SyncObjects SyncIntermediate only updates whatever has changed, but, as a side effect, requires much more disk space. SyncObjects will only sync whatever is required for a block and will not save intermediate state to disk. As drawback this requires more time when more txs come in.
* tests: SetGasLimitobscuren2015-06-211-1/+1
|
* Add --skip option to CLITaylor Gerring2015-06-191-7/+7
| | | | | Disassociates hardcoded tests to skip when running via CLI. Tests still skipped when running `go test`
* recover test logicTaylor Gerring2015-06-191-1/+1
|
* Build error fixesTaylor Gerring2015-06-191-5/+4
|
* Add stdin optionTaylor Gerring2015-06-191-66/+100
|
* Cleanup loggingTaylor Gerring2015-06-191-2/+3
|
* DRY file loadingTaylor Gerring2015-06-191-7/+1
|
* More consistent test interfaces + test skippingTaylor Gerring2015-06-191-18/+18
|
* Cleanup/reorgTaylor Gerring2015-06-191-38/+1
|
* Return error up stack instead of passing testing var downTaylor Gerring2015-06-191-11/+12
|
* DRY log checkTaylor Gerring2015-06-191-32/+40
|
* Separate and identify tests runnersTaylor Gerring2015-06-191-0/+181