Commit Graph

294 Commits

Author SHA1 Message Date
Péter Szilágyi
e86e0ecdc8 core, eth, miner, xeth: clean up tx/receipt db accessors 2015-11-19 16:03:32 +02:00
Jeffrey Wilcke
a1d9ef48c5 core, eth, rpc: split out block validator and state processor
This removes the burden on a single object to take care of all
validation and state processing. Now instead the validation is done by
the `core.BlockValidator` (`types.Validator`) that takes care of both
header and uncle validation through the `ValidateBlock` method and state
validation through the `ValidateState` method. The state processing is
done by a new object `core.StateProcessor` (`types.Processor`) and
accepts a new state as input and uses that to process the given block's
transactions (and uncles for rewords) to calculate the state root for
the next block (P_n + 1).
2015-11-18 14:24:42 +01:00
Felix Lange
fbdb44dcc1 cmd/utils, rpc/comms: stop XEth when IPC connection ends
There are a bunch of changes required to make this work:

- in miner: allow unregistering agents, fix RemoteAgent.Stop
- in eth/filters: make FilterSystem.Stop not crash
- in rpc/comms: move listen loop to platform-independent code

Fixes #1930. I ran the shell loop there for a few minutes and didn't see
any changes in the memory profile.
2015-10-29 17:26:26 +01:00
Jeffrey Wilcke
0467a6ceec Merge pull request #1889 from karalabe/fast-sync-rebase
eth/63 fast synchronization algorithm
2015-10-21 11:44:22 -07:00
Péter Szilágyi
832b37c822 core, eth: receipt chain reconstruction 2015-10-19 10:03:09 +03: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
Jeffrey Wilcke
10ed107ba2 Merge pull request #1899 from obscuren/mipmap-bloom
core, eth/filters, miner, xeth: Optimised log filtering
2015-10-16 12:35:24 -07:00
Jeffrey Wilcke
6dc14788a2 core, eth/filters, miner, xeth: Optimised log filtering
Log filtering is now using a MIPmap like approach where addresses of
logs are added to a mapped bloom bin. The current levels for the MIP are
in ranges of 1.000.000, 500.000, 100.000, 50.000, 1.000. Logs are
therefor filtered in batches of 1.000.
2015-10-16 21:28:59 +02:00
Gustav Simonsson
1b1f293082 core/state, core, miner: handle missing root error from state.New 2015-10-16 02:22:06 +02:00
Péter Szilágyi
402fd6e8c6 core, eth, event, miner, xeth: fix event post / subscription race 2015-10-12 16:22:03 +03: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
Felix Lange
a2d5a60418 core, core/state: batch-based state sync 2015-09-22 22:57:37 +02:00
Jeffrey Wilcke
58fbcaa750 Merge pull request #1810 from karalabe/pure-header-verifications-2
core, eth, miner: use pure header validation
2015-09-16 14:21:12 -07:00
Péter Szilágyi
821619e1c3 core, eth, miner: use pure header validation 2015-09-16 10:46:28 +03: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
Christoph Jentzsch
0fda4c4e15 fix block time issue
currently, under normal circumstances, you always set the timestamp to previous.Time() + 1.
credits to https://www.reddit.com/r/ethereum/comments/3jcs5r/code_avg_block_time_vs_difficulty_adjustment/cuoi4op

style
2015-09-03 00:05:05 +02:00
Gustav Simonsson
7324176f70 Add tests for uncle timestamps and refactor timestamp type 2015-08-25 04:46:11 +02:00
Jeffrey Wilcke
b4369e1015 core, miner: write miner receipts 2015-08-18 21:46:26 +02: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
35f271b264 miner, core: sort txs by price, nonce 2015-08-05 17:44:19 +02:00
Jeffrey Wilcke
f12e0161ca Merge pull request #1588 from obscuren/diff-bomb
core, miner: added difficulty bomb
2015-08-05 04:26:57 -07:00
Jeffrey Wilcke
71d32f54f7 core, miner: added difficulty bomb 2015-08-05 13:09:09 +02:00
Jeffrey Wilcke
d8590d9790 miner: fixed worker race condition 2015-08-04 20:54:21 +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
Péter Szilágyi
3029349761 miner: fix current work data race 2015-07-20 14:37:43 +03:00
Jeffrey Wilcke
1b9ef0e52d miner: moved state sync
Moved the state sync so it only syncs the state when the block mining yield a possitive result
2015-07-16 14:19:27 +02:00
Jeffrey Wilcke
e870e61bc9 miner: smart mining
Work is now handled and carried over multiple sessions. Previously one
session only was assumed, potentially resulting in invalid (outdated)
work

* Larger work / result queue
* Full validation option
2015-07-15 20:37:12 +02:00
Jeffrey Wilcke
97d22be318 Merge pull request #1441 from obscuren/logs-return-fix
miner, xeth: fire log event during mining. Fix return raw tx
2015-07-09 07:24:35 -07:00
Jeffrey Wilcke
819ecd4508 miner, xeth: fire log event during mining. Fix return raw tx 2015-07-08 15:34:11 +02:00
Gustav Simonsson
5d6d40f329 Use uint64 on ts in chain_manager, block_processor 2015-07-08 13:21:06 +02:00
Felix Lange
ea54283b30 all: update license information 2015-07-07 14:12:44 +02:00
Jeffrey Wilcke
37c1a8f69d eth,miner,rpc: set coinbase 2015-07-07 10:58:47 +02:00
Jeffrey Wilcke
e6bb9c1cad core, miner: removed vm errors from consensus err checking
Removed VM errors from the consensus errors. They now used for output
only.
2015-07-06 12:43:05 +02:00
Jeffrey Wilcke
bcc1660abc core, miner, tests: added test, implemented bad block reporting 2015-07-05 15:14:31 +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
Jeffrey Wilcke
2feb23c1da core, eth, miner, xeth: receipt storage fix
* Added GetReceiptsFromBlock, GetReceipt, PutReceipts
* Added ContractAddress to receipt. See #1042
2015-07-04 02:32:10 +02:00
Jeffrey Wilcke
0e33fbdcb9 miner: ignore future errors 2015-07-03 17:21:23 +02:00
Jeffrey Wilcke
29e2fb38f8 core, miner: miner header validation, transaction & receipt writing
* Miners do now verify their own header, not their state.
* Changed old putTx and putReceipts to be exported
* Moved writing of transactions and receipts out of the block processer
  in to the chain manager. Closes #1386
* Miner post ChainHeadEvent & ChainEvent. Closes #1388
2015-07-03 13:56:50 +02:00
Gustav Simonsson
4c490db6af Use uint64 for block header timestamp 2015-06-30 10:52:11 +02:00
Jeffrey Wilcke
d8fe64acaa core, miner: added queued write to WriteBlock
This fixes an issue with the lru cache not being available when calling
WriteBlock. WriteBlock previously always assumed to be called from the
InsertChain where the lru cache was always created prior to calling
WriteBlock. When being called from the worker this could lead in to a
nil pointer exception being thrown and causing database corruption.
2015-06-30 11:14:43 +02:00
Jeffrey Wilcke
a8ebf756c7 Merge branch 'miner-broadcast' into core-optimisations-2
Conflicts:
	core/chain_manager.go
	miner/worker.go
2015-06-29 18:55:49 +02:00
Jeffrey Wilcke
ac80ec59dc miner: update root only when mining 2015-06-29 18:51:49 +02:00
Felix Lange
1d42888d30 core/types: make blocks immutable 2015-06-29 18:51:47 +02:00
Jeffrey Wilcke
b39042db56 core, miner: implemented canary 2015-06-29 13:31:49 +02:00
Jeffrey Wilcke
d1e93db3eb core, miner: added write block method & changed mining propagation 2015-06-29 13:31:49 +02:00
Jeffrey Wilcke
059a1e9e4e miner: broadcast block before insertion/validation 2015-06-29 13:31:49 +02:00
obscuren
07c3de3f75 core, miner, xeth: renamed gas methods
* BuyGas => SubGas
* RefundGas => AddGas
* SetGasPool => SetGasLimit
2015-06-21 17:09:19 +02:00
obscuren
6d817e16c1 core, miner: tx pool drops txs below ask price 2015-06-15 11:33:08 +02:00
obscuren
cf3aabb9d3 miner: update gas used after tx proc for pending block 2015-06-10 13:52:38 +02:00
Jason Carver
a9c058dfe0 crash fix: skip deep log if self.chain is not caught up
@see trace https://gist.github.com/eupraxic/87fdfefe702c51d5944d
2015-06-08 11:49:59 -07:00
obscuren
d09a6e5421 core, eth, miner: moved nonce management to tx pool.
Removed the managed tx state from the chain manager to the transaction
pool where it's much easier to keep track of nonces (and manage them).
The transaction pool now also uses the queue and pending txs differently
where queued txs are now moved over to the pending queue (i.e. txs ready
for processing and propagation).
2015-06-03 22:43:23 +02:00
obscuren
35806ccc1c build server fix 2015-05-28 17:18:13 +02:00
obscuren
912ae80350 miner: Added 5 blocks wait in prep for #1067 2015-05-27 13:33:52 +02:00
obscuren
12650e16d3 core, miner: fixed miner time issue and removed future blocks
* Miner should no longer generate blocks with a time stamp less or equal
than it's parent.
* Future blocks are no longer processed and queued directly.
  Closes #1118
2015-05-27 13:30:52 +02:00
Jason Carver
de12183d38 deep-mining-log: need ring buffer to be one bigger for all-blocks-mined case 2015-05-26 18:55:52 -07:00
Jason Carver
6019f1bb0a deep-mining-log: only track non-stale blocks
if you track stale blocks, then you quickly overflow your ring buffer in the local network case where you're mining every block and generating a lot of stales.
2015-05-26 18:54:56 -07:00
Jason Carver
f1ce5877ba do not export ring buffer struct 2015-05-23 12:09:59 -07:00
Jason Carver
8a7fb5fd34 do not export constant for when to log a deep block you mined 2015-05-23 12:09:52 -07:00
Jason Carver
ba295ec6fe Log locally mined blocks, after they are 5-deep in the chain
This helps determine which blocks are unlikely to end up as uncles

 * Store the 5 most recent locally mined block numbers
 * On every imported block, check if the 5-deep block num is in that store
 * Also confirm that the block is signed with miner's coinbase

Why not just check the coinbase? This log is useful if you're running
multiple miners and want to know if *this* miner is performing well.
2015-05-22 12:53:32 -07:00
zelig
f9abcee0f9 fix solc tests unskip 2015-05-20 02:47:13 +01:00
obscuren
bc5e60cd63 miner: stale block notification 2015-05-18 18:16:53 +02:00
Jeffrey Wilcke
c7a13c9be8 Merge pull request #969 from Gustav-Simonsson/ethash_improve_hashrate_update2
Make read of ethash hashrate atomic and update ethash godep
2015-05-14 04:05:27 -07:00
Vitalik Buterin
bdec8c3e41 Combined two loops 2015-05-14 05:02:15 -04:00
Gustav Simonsson
b24f16fa53 Make read of ethash hashrate atomic and update ethash godep 2015-05-14 04:05:49 +02:00
Vitalik Buterin
fca3333f7f Created separate family and ancestors environment objects 2015-05-13 20:46:23 -04:00
Gustav Simonsson
2c1b0ff17e Update key store to new spec but keep address field for now
* Also fix address types post-rebase
2015-05-12 17:22:17 +02:00
obscuren
97dd4551ef miner, cmd/geth: miner will not ignored owned account transactions
Miner does not ignore low gas txs from accounts that are owned.
2015-05-11 21:47:34 +02:00
obscuren
21e52efdfe cmd/geth, miner, backend, xeth: Fixed miner threads to be settable
Miner threads are now settable through the admin interface (closes #897)
and specify 0 CPU worker threads when eth_getWork is called (closes #916)
2015-05-11 17:21:22 +02:00
obscuren
3c6c891680 core: optimise pending transaction processing 2015-05-11 11:39:33 +02:00
obscuren
a2919b5e17 core, eth, miner: improved tx removal & fatal error on db sync err
* core: Added GasPriceChange event
* eth: When one of the DB flush methods error a fatal error log message
  is given. Hopefully this will prevent corrupted databases from
  occuring.
* miner: remove transactions with low gas price. Closes #906, #903
2015-05-11 11:39:33 +02:00
obscuren
e3a08875f6 miner: start/stop mutex locked. Closes #887 2015-05-09 12:32:36 +02:00
obscuren
a7705fc203 miner: moved gasprice to non-method 2015-05-09 12:13:46 +02:00
obscuren
13ddf20bd2 miner, cmd/geth: settable gas price from flags and console
* --gasprice "<num>" flag
* admin.miner.setGasPrice( <num> )
2015-05-09 12:04:00 +02:00
obscuren
735b029db9 core: return the index of the block that failed when inserting a chain 2015-04-29 14:00:24 +02:00
obscuren
145e02fc54 core, miner: added value check on tx validation
* Changed CalcGasLimit to no longer need current block
* Added a gas * price + value on tx validation
* Transactions in the pool are now re-validated once every X
2015-04-26 11:19:40 +02:00
obscuren
48135657c4 miner: show error message for gas limit per account 2015-04-23 11:50:12 +02:00
obscuren
4feb5f6f9c xeth, miner: updated some logging 2015-04-23 11:50:11 +02:00
Felix Lange
96e2b6bc07 miner: use 32bit atomic operations
64bit atomic operations are not available on all 32bit platforms.
2015-04-22 12:31:19 +02:00
obscuren
1d6d42919e miner: ignore a tx's transactor after a gas limit has been returned
When worker encounters a gas limit error, subsequent txs should be
ignored from that particular account. This will prevent:

1. Nonce errors been thrown all around
2. The "Known tx" error. Closes #719
3. Repeated contract address. Closes #731
2015-04-21 11:26:04 +02:00
obscuren
2c1a6a349b miner: removed default timer & update dag when threads > 0 2015-04-19 21:45:40 +02:00
Fabian Vogelsteller
576393550d add extra space to miner icon 2015-04-17 15:00:37 +02:00
obscuren
ec6cbb914b miner: start a newly registered agent if the miner is running. Closes #681 2015-04-15 17:04:22 +02:00
obscuren
eaf73b55bc miner: moved bad uncle logging to ridiculous log level. Closes #720 2015-04-15 12:12:20 +02:00
obscuren
4f3c169b4e miner: don't break loop when encountering gas limit reach err
Processing transactions should continue when a transaction throws a gas
limit reached error. Other transactions may actually succeed.
2015-04-13 22:58:53 +02:00
obscuren
6184781b49 Improved transaction pool
The transaction pool will now some easily be able to pre determine the
validity of a transaction by checking the following:

* Account existst
* gas limit higher than the instrinsic gas
* enough funds to pay upfront costs
* nonce check
2015-04-08 20:47:32 +02:00
obscuren
1c872ddf4b Changed how logs are being recorded
Logs are now recorded per transactions instead of tossing them out after
each transaction. This should also fix an issue with
`eth_getFilterLogs` (#629) Also now implemented are the `transactionHash,
blockHash, transactionIndex, logIndex` on logs. Closes #654.
2015-04-08 17:15:45 +02:00
obscuren
d09d2b96fc fixed stop of miner 2015-04-08 00:30:23 +02:00
obscuren
688d118c7e Updated logging 2015-04-07 14:57:04 +02:00
obscuren
7b6a8cc9ae Fixed pending states 2015-04-07 12:32:55 +02:00
obscuren
9c55576c7b Block header changed & console miner control
* miner control moved to `admin.miner`
* miner option to set extra data
* block extra now bytes
2015-04-05 18:59:18 +02:00
obscuren
50edd4243e removed hash rate from info log. Added hashrate js func 2015-04-05 13:05:10 +02:00
obscuren
053d5552ab Updated logging 2015-04-04 23:04:19 +02:00
obscuren
2683aac9b0 Make sure we're not mining on an invalid TS 2015-04-04 13:27:17 +02:00
obscuren
60da9a1289 Put the old hammer back in <3 2015-04-02 13:03:33 +02:00
obscuren
3f4c1aaf01 info => debug 2015-04-02 12:58:17 +02:00
obscuren
b8124ec791 Removed old (unused) argument 2015-04-01 23:58:26 +02:00
obscuren
344b3556eb Fixed uncle rewards in miner
The uncle rewards were changed in the block processor. This change will
reflect those changes in the miner as well.
2015-04-01 21:18:41 +02:00
obscuren
d36501a6e5 Fixed miner
* Miners could stall because the worker wasn't aware the miner was done
2015-03-26 17:45:03 +01:00
obscuren
950b4a68c8 Improved miner recovery
* In case of uncle mining (e.g. same TS) the miner would stop if all
  threads happened to mine a potential uncle
2015-03-25 13:51:12 +01:00
obscuren
eab8f7355d Event fixes for miner 2015-03-24 13:37:38 +01:00
obscuren
a59ea7ce29 Changed miner
* Instead of delivering `Work` to the `Worker`, push a complete Block to
  the `Worker` so that each agent can work on their own block.
2015-03-24 10:34:06 +01:00
obscuren
c8e9ca0483 fixed bad uncles 2015-03-23 18:27:05 +01:00
obscuren
0330077d76 moved state and vm to core 2015-03-23 16:59:09 +01:00
obscuren
9be7853e34 Fixed issues with stalled remote miner 2015-03-23 16:35:44 +01:00
obscuren
dc3a9379f5 logging for possible uncles 2015-03-23 16:14:33 +01:00
obscuren
0be6d34048 finally merged *the missing* 2015-03-23 12:12:49 +01:00
obscuren
ce862ee758 Removed some comments 2015-03-21 14:51:45 +01:00
obscuren
54dac59285 wip 2015-03-20 17:42:09 +01:00
obscuren
0a1eeca41e conversions. -compilable- 2015-03-18 13:00:01 +01:00
obscuren
b523441361 Moved ethutil => common 2015-03-16 11:27:38 +01:00
obscuren
387f6bba3e POW fixes 2015-03-14 16:37:57 +01:00
obscuren
532a74f50e Improved errors. Closes #475 2015-03-14 12:43:10 +01:00
obscuren
03403399fc Return proper error 2015-03-13 17:47:11 +01:00
obscuren
310ca62285 Removed some of that gas pre pay magic 2015-03-12 22:29:10 +01:00
obscuren
7add66c8bb Use the state to up the balance of the coinbase 2015-03-11 16:32:37 +01:00
obscuren
cd856cb213 Separated block db from state db. Partial fix for #416 2015-03-06 18:26:16 +01:00
obscuren
8d9be18b29 Queued approach to delivering chain events 2015-03-06 15:50:44 +01:00
obscuren
c47866d251 Miner fixes and updates (including miner) 2015-03-05 09:14:58 +01:00
obscuren
d4d505c868 Fixed genesis 2015-03-03 21:48:05 +01:00
obscuren
26de12d9bf Changed nonce to a uint64 2015-03-03 21:04:31 +01:00
obscuren
f0b2ea64fc Merge branch 'jsonlogs' of https://github.com/ethersphere/go-ethereum into ethersphere-jsonlogs
Conflicts:
	eth/block_pool.go
	eth/block_pool_test.go
	eth/protocol_test.go
	miner/worker.go
2015-03-03 20:30:05 +01:00
obscuren
8e995b97cc Fixes and debug added 2015-03-03 20:13:11 +01:00
obscuren
40ff3cac39 merge 2015-03-03 17:56:36 +01:00
obscuren
313fe3861b fixed pow stuff 2015-03-03 17:55:23 +01:00
zelig
34be795bc1 Merge remote-tracking branch 'tgerring/jsonlogs' into jsonlogs 2015-03-03 13:52:20 +07:00
Matthew Wampler-Doty
de9f79133f Introducing ethash 2015-03-02 22:29:34 -05:00
Taylor Gerring
60a2704b04 Implement eth.miner.new_block event 2015-03-01 16:09:59 +01:00
obscuren
65cad14f9b Report debug hash rate 2015-02-28 23:09:49 +01:00
obscuren
e235b57234 Fixed consensus issue for refunding
* Refund should _always_ go to the origin
2015-02-26 20:08:35 +01:00
obscuren
cc43ab9a81 Minor updates for release 2015-02-20 18:05:46 +01:00
obscuren
75625801f5 fixed merge 2015-02-20 15:18:07 +01:00
obscuren
fa4cbad315 Optimisations and fixed a couple of DDOS issues in the miner 2015-02-19 22:33:22 +01:00
obscuren
8135752a32 "centralised" mining to backend. Closes #323 2015-02-17 12:24:58 +01:00
obscuren
2c3a014f03 Resolved some bugs in the miner
* TODO nonce error sometimes persists
* Fixed mining on wrong blocks
* Fixed state error & receipt fail
2015-02-15 16:16:27 +01:00
obscuren
32c7ebc51d Fixed mining & limited hash power 2015-02-14 16:52:14 +01:00
obscuren
ce239333d5 Update balance label when mining 2015-02-13 18:15:23 +01:00
obscuren
0f3c25b265 Propagate blocks 2015-02-13 18:03:16 +01:00
obscuren
8a0f23915e Fixed a few issues in the miner and updated hash rate title
* Sometimes old nonces were set by "old" agents
* Added the hash rate to the miner
2015-02-13 17:23:09 +01:00
obscuren
da2fae0e43 Basic structure miner 2015-02-10 13:04:38 +01:00
obscuren
65158d39b0 Filtering 2015-02-04 15:05:47 -08:00
obscuren
b1870631a4 WIP miner 2015-02-04 05:53:22 -08:00