Commit Graph

370 Commits

Author SHA1 Message Date
Felix Lange eeb2a1a6e3 Merge pull request #3094 from fjl/tests-update
tests: update test files from github.com/ethereum/tests @ 45bc1d21d3c1
2016-10-06 16:19:53 +02:00
Felix Lange 1b7b2ba216 tests: update test files from github.com/ethereum/tests @ 45bc1d21d3c1
Two new tests are skipped because they're buggy. Making some newer
random state tests work required implementing the 'compressed return
value encoding'.
2016-10-06 15:36:21 +02:00
Felix Lange 1f1ea18b54 core/state: implement reverts by journaling all changes
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!
2016-10-06 15:32:16 +02:00
Péter Szilágyi cb84e3f029 cmd, core, internal, light, tests: avoid hashing the code in the VM 2016-10-01 16:01:58 +03:00
Felix Lange a59a93f476 core/state: track all accounts in canon state
This change introduces a global, per-state cache that keeps account data
in the canon state. Thanks to @karalabe for lots of fixes.
2016-09-26 10:09:52 +02:00
Nick Johnson 781915f183 core/vm: Refactor tracing to make Tracer the main interface
This CL makes several refactors:
 - Define a Tracer interface, implementing the `CaptureState` method
 - Add the VM environment as the first argument of
   `Tracer.CaptureState`
 - Rename existing functionality `StructLogger` an make it an
   implementation of `Tracer`
 - Delete `StructLogCollector` and make `StructLogger` collect the logs
   directly
 - Change all callers to use the new `StructLogger` where necessary and
   extract logs from that.
 - Deletes the apparently obsolete and likely nonfunctional 'TraceCall'
   from the eth API.

Callers that only wish accumulated logs can use the `StructLogger`
implementation straightforwardly. Callers that wish to efficiently
capture VM traces and operate on them without excessive copying can now
implement the `Tracer` interface to receive VM state at each step and
do with it as they wish.

This CL also removes the accumulation of logs from the vm.Environment;
this was necessary as part of the refactor, but also simplifies it by
removing a responsibility that doesn't directly belong to the
Environment.
2016-08-22 09:26:15 +01:00
Péter Szilágyi 2c2e389b77 cmd, core, eth, miner, params, tests: finalize the DAO fork 2016-07-15 16:52:55 +03:00
Péter Szilágyi 461cdb593b core, params, tests: add DAO hard-fork balance moves 2016-07-15 16:52:55 +03:00
zsfelfoldi 00787fe781 core: added CheckNonce() to Message interface 2016-07-11 12:35:23 +02:00
Péter Szilágyi 6362a9d610 Revert "test, cmd/evm, core, core/vm: illegal code hash implementation"
This reverts commit 7a5b571c67.
2016-06-29 11:44:51 +03:00
Jeffrey Wilcke 7a5b571c67 test, cmd/evm, core, core/vm: illegal code hash implementation
This implements a generic approach to enabling soft forks by allowing
anyone to put in hashes of contracts that should not be interacted from.
This will help "The DAO" in their endevour to stop any whithdrawals from
any DAO contract by convincing the mining community to accept their code
hash.
2016-06-22 11:38:25 +03:00
zsfelfoldi f9917c8c7b core: improved chainDb using sequential keys 2016-06-07 16:38:56 +02:00
Felix Lange ca18202eb9 eth: enable bad block reports
We used to have reporting of bad blocks, but it was disabled
before the Frontier release. We need it back because users
are usually unable to provide the full RLP data of a bad
block when it occurs.

A shortcoming of this particular implementation is that the
origin peer is not tracked for blocks received during eth/63
sync. No origin peer info is still better than no report at
all though.
2016-05-25 02:02:51 +02:00
Felix Lange 6fdd0893c3 all: fix go vet warnings 2016-04-15 11:17:27 +02:00
Felix Lange d04a2e7557 all: update license information 2016-04-15 09:48:05 +02:00
Felix Lange 83877a0f9d tests: remove eth, node, accounts dependencies
Unlocking the accounts in the test doesn't help with anything.
2016-04-12 15:34:39 +02:00
Jeffrey Wilcke f0cbebb19f core: added basic chain configuration
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.
2016-04-01 01:01:10 +02:00
Jeffrey Wilcke 14013372ae core: Added EVM configuration options
The EVM is now initialised with an additional configured object that
allows you to turn on debugging options.
2016-03-23 23:02:42 +01:00
Jeffrey Wilcke 342ae7ce7d core, core/vm, tests: changed the initialisation behaviour of the EVM
The EVM was previously initialised and created for every CALL, CALLCODE,
DELEGATECALL and CREATE. This PR changes this behaviour so that the same
EVM can be used through the session and beyond as long as the
Environment sticks around.
2016-03-23 00:04:00 +01:00
Péter Szilágyi a6903ad6a5 Merge pull request #2260 from karalabe/ethash-cache-fixes
Godeps, eth, tests: update ethash, used shared for testing
2016-02-24 17:58:12 +02:00
Péter Szilágyi 0a5ee08e2b Godeps, eth, tests: update ethash, used shared for testing 2016-02-24 13:29:47 +02:00
Ricardo Catalinas Jiménez 436fc8d76a all: Rename crypto.Sha3{,Hash}() to crypto.Keccak256{,Hash}()
As we aren't really using the standarized SHA-3
2016-02-21 22:34:34 +00:00
Jeffrey Wilcke 5b283663b4 core: Added new TD strategy which mitigate the risk for selfish mining
Assuming the following scenario where a miner has 15% of all hashing
power and the ability to exert a moderate control over the network to
the point where if the attacker sees a message A, it can't stop A from
propagating, but what it **can** do is send a message B and ensure that
most nodes see B before A. The attacker can then selfish mine and
augment selfish mining strategy by giving his own blocks an advantage.

This change makes the time at which a block is received less relevant
and so the level of control an attacker has over the network no longer
makes a difference.

This change changes the current td algorithm `B_td > C_td` to the new
algorithm `B_td > C_td || B_td == C_td && rnd < 0.5`.
2016-02-18 10:12:13 +01:00
Jeffrey Wilcke b6d88a0e9f core, core/vm, crypto: fixes for homestead
* Removed some strange code that didn't apply state reverting properly
* Refactored code setting from vm & state transition to the executioner
* Updated tests
2016-02-18 10:11:48 +01:00
Jeffrey Wilcke 4f4d2b6474 tests: updated homestead tests 2016-02-18 10:08:18 +01:00
Gustav Simonsson 371871d685 parmas, crypto, core, core/vm: homestead consensus protocol changes
* 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
2016-02-18 10:08:11 +01:00
Péter Szilágyi 1e806c4c77 cmd, common, core, eth, node, rpc, tests, whisper, xeth: use protocol stacks 2015-11-27 11:06:12 +02:00
Gustav Simonsson 220b0bf6e5 Update common test files 2015-11-20 12:53:36 +01:00
Péter Szilágyi 9dc5de51a2 tests: fix data race in bad-block-report disabling during tests 2015-11-05 13:29:50 +02:00
Drake Burroughs 05ea8926c3 cmd/utils, crypto: add --lightkdf flag for lighter KDF 2015-10-28 18:46:39 +01:00
Gustav Simonsson 145366c07e tests: update JSON files, add new wrappers 2015-10-23 14:25:18 +02:00
Jeffrey Wilcke 80f26086ee core, tests: get_hash fix
Make sure that we're fetching the hash from the current chain and not
the canonical chain.
2015-10-21 02:31:46 +02:00
Felix Lange de8d5aaa92 core, core/state: move gas tracking out of core/state
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.
2015-10-17 10:24:34 +02:00
Gustav Simonsson 1b1f293082 core/state, core, miner: handle missing root error from state.New 2015-10-16 02:22:06 +02:00
Gustav Simonsson e1616f77c7 core, core/vm, cmd/evm: remove redundant balance check 2015-10-06 12:42:34 +02:00
Jeffrey Wilcke 7c7692933c cmd/geth, cmd/utils, core, rpc: renamed to blockchain
* Renamed ChainManager to BlockChain
* Checkpointing is no longer required and never really properly worked
when the state was corrupted.
2015-10-04 01:13:56 +02:00
Jeffrey Wilcke 361082ec4b cmd/evm, core/vm, test: refactored VM and core
* 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`.
2015-10-04 01:13:54 +02:00
Jeffrey Wilcke 49ae538506 Merge pull request #1405 from fjl/lean-trie
core, trie: new trie
2015-10-01 04:34:38 -07:00
Felix Lange a2d5a60418 core, core/state: batch-based state sync 2015-09-22 22:57:37 +02:00
Gustav Simonsson 5621308949 tests: add test for StateTests/stCallCodes.json 2015-09-21 11:34:02 +02:00
Gustav Simonsson 47ca6904b3 tests: use lastblockhash field to validate reorgs and block headers 2015-09-18 17:48:31 +02:00
Gustav Simonsson 075815e5ff tests: update common test wrappers and test files 2015-09-18 13:08:36 +02:00
Felix Lange 8c4dab77ba all: move common.Database to package ethdb 2015-09-14 23:36:30 +02:00
Péter Szilágyi cdc2662c40 core: split out TD from database and all internals 2015-09-11 17:42:25 +03:00
Gustav Simonsson fe8093b71f Add TestBcForkUncleTests and update JSON files 2015-08-31 16:45:00 +02:00
Gustav Simonsson 7324176f70 Add tests for uncle timestamps and refactor timestamp type 2015-08-25 04:46:11 +02:00
Jeffrey Wilcke 36f7fe61c3 core, tests: Double SUICIDE fix 2015-08-20 18:22:50 +02:00
Jeffrey Wilcke 9cacec70f9 cmd/evm, core/vm, tests: changed DisableVm to EnableVm 2015-08-11 18:43:22 +02:00
Jeffrey Wilcke 2fcf7f1241 Merge pull request #1604 from obscuren/db-merge
core, eth, trie, xeth: merged state, chain, extra databases in one
2015-08-09 05:16:37 -07:00
Jeffrey Wilcke a23478c0be core, eth, trie, xeth: merged state, chain, extra databases in one 2015-08-07 22:29:02 +02:00
Jeffrey Wilcke ac697326a6 core/vm: reduced big int allocations
Reduced big int allocation by making stack items modifiable. Instead of
adding items such as `common.Big0` to the stack, `new(big.Int)` is
added instead. One must expect that any item that is added to the stack
might change.
2015-08-07 12:52:23 +02:00
Jeffrey Wilcke 184e9ae9a8 core, tests: reduced state copy by N calls
Reduced the amount of state copied that are required by N calls by doing
a balance check prior to any state modifications.
2015-08-07 12:52:23 +02:00
Jeffrey Wilcke 846f34f78b core/vm, tests: implemented semi-jit vm
* changed stack and removed stack ptr. Let go decide on slice reuse.
2015-08-07 12:52:17 +02:00
Jeffrey Wilcke 71d32f54f7 core, miner: added difficulty bomb 2015-08-05 13:09:09 +02:00
Jeffrey Wilcke 03c39d4fc0 tests: updated 2015-07-29 15:01:42 +02:00
Jeffrey Wilcke 1fad8798ec Merge pull request #1515 from fjl/license-fixes
all: fix license headers one more time
2015-07-28 04:29:42 -07:00
Jeffrey Wilcke 9afda6ab8c core: 5 ether block reward 2015-07-25 17:47:20 +02:00
Felix Lange bfbcfbe4a9 all: fix license headers one more time
I forgot to update one instance of "go-ethereum" in commit 3f047be5a.
2015-07-23 18:35:11 +02:00
Felix Lange 3f047be5aa all: update license headers to distiguish GPL/LGPL
All code outside of cmd/ is licensed as LGPL. The headers
now reflect this by calling the whole work "the go-ethereum library".
2015-07-22 18:51:45 +02:00
Felix Lange 593b1b65e7 tests: document RLP tests 2015-07-17 15:42:23 +02:00
Felix Lange 5da82077d1 cmd/ethtest, tests: add support for RLP JSON tests 2015-07-17 15:13:24 +02:00
Jeffrey Wilcke a32c51effd cmd, core, eth, common: genesis preparation
Implemented the --genesis flag thru which we can set a custom genesis
block, including the official Ethereum genesis block.
2015-07-10 17:37:41 +02:00
Gustav Simonsson b08abe64e4 Unskip SimpleTx3, check err in pre/post state validations 2015-07-08 13:09:22 +02:00
Gustav Simonsson 0b53a5c673 Update Ethereum JSON test files and wrappers 2015-07-08 13:08:42 +02:00
Felix Lange bdae4fd573 all: add some godoc synopsis comments 2015-07-07 14:12:45 +02:00
Felix Lange ea54283b30 all: update license information 2015-07-07 14:12:44 +02:00
Jeffrey Wilcke 35cd355c14 cmd,eth,rpc,tests: default coinbase 2015-07-07 10:32:05 +02:00
Gustav Simonsson b7e8d954ef Add TestBcGasPricer, comments and unskip tests 2015-07-06 13:56:56 +02:00
Jeffrey Wilcke aa4502060b Merge pull request #1400 from obscuren/badblock-reporting
core, miner, tests: added test, implemented bad block reporting
2015-07-06 02:03:50 -07:00
Jeffrey Wilcke bcc1660abc core, miner, tests: added test, implemented bad block reporting 2015-07-05 15:14:31 +02:00
Gustav Simonsson 0f04af5916 Fix core error forwarding, unify OOG VM err 2015-07-04 09:27:42 +02:00
Jeffrey Wilcke ab16ce70fc core, miner, tests: renamed state methods
* 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.
2015-07-04 02:51:36 +02:00
Gustav Simonsson ff97059a99 Update Ethereum JSON tests, skip failing 2015-07-03 09:40:07 +02:00
Gustav Simonsson 4c490db6af Use uint64 for block header timestamp 2015-06-30 10:52:11 +02:00
Felix Lange 1d42888d30 core/types: make blocks immutable 2015-06-29 18:51:47 +02:00
Felix Lange 654564e164 core/types: make transactions immutable 2015-06-29 18:51:47 +02:00
obscuren 398d08a8dd tests: SetGasLimit 2015-06-21 17:09:19 +02:00
Taylor Gerring 0743243dce Add --skip option to CLI
Disassociates hardcoded tests to skip when running via CLI. Tests still
skipped when running `go test`
2015-06-19 11:38:23 +02:00
Taylor Gerring a9659e6dcf recover test logic 2015-06-18 23:46:42 +02:00
Taylor Gerring 8d3faf69d0 Build error fixes 2015-06-18 22:38:17 +02:00
Taylor Gerring baea8e87e5 Rebase cleanup 2015-06-18 22:27:44 +02:00
Taylor Gerring 01ec4dbb12 Add stdin option 2015-06-18 22:24:07 +02:00
Taylor Gerring 30444db020 Add lost rebase changes 2015-06-18 22:20:45 +02:00
Taylor Gerring c941a39b75 Cleanup logging 2015-06-18 22:20:45 +02:00
Taylor Gerring 8507c867b9 Fix geth blocktest command 2015-06-18 22:20:45 +02:00
Taylor Gerring 6ff956394a DRY file loading 2015-06-18 22:20:45 +02:00
Taylor Gerring ac0637c413 More consistent test interfaces + test skipping 2015-06-18 22:20:44 +02:00
Taylor Gerring b6d40a9312 Cleanup/reorg 2015-06-18 22:20:44 +02:00
Taylor Gerring c5d6fcbaba Return error up stack instead of passing testing var down 2015-06-18 22:20:44 +02:00
Taylor Gerring 24554629b1 DRY log check 2015-06-18 22:15:08 +02:00
Taylor Gerring 7c6ef0ddac Separate and identify tests runners 2015-06-18 22:15:07 +02:00
Taylor Gerring 1b26d4f220 Flatten helper directory 2015-06-18 22:15:07 +02:00
Taylor Gerring e82100367f Fix paths 2015-06-18 22:13:42 +02:00
Taylor Gerring a67a15528a Split tests from helper code 2015-06-18 22:13:42 +02:00
Taylor Gerring 7b9fbb088a Flatten vm directory 2015-06-18 22:13:41 +02:00
Jeffrey Wilcke 2cea410656 Merge pull request #1282 from obscuren/state-cleanup
core/state: cleanup & optimisations
2015-06-18 05:29:53 -07:00
obscuren a977f3c0dc xeth, tests: fixed api 2015-06-17 11:44:40 +02:00
obscuren 787a61bb27 core/state, core/vm: reworked storage get / set to use common.Hash 2015-06-17 11:24:40 +02:00
Gustav Simonsson 8f372c867d Update Ethereum JSON test files 2015-06-16 12:09:25 +02:00
Jeffrey Wilcke 6609d45ef4 Merge pull request #1228 from obscuren/vm-optimisations
core/vm: optimisations
2015-06-11 03:32:39 -07:00