Commit Graph

1611 Commits

Author SHA1 Message Date
gary rong
2ed729d38e les: handler separation (#19639)
les: handler separation
2019-08-21 11:29:34 +02:00
Martin Holst Swende
4aee0d1994 core: fix crash in chain reimport (#19986)
* blockchain: fix flaw in block import

* core/blockchain: address review concerns

* core/blockchain: go format with 's'
2019-08-21 10:17:19 +03:00
Péter Szilágyi
3bb9b49afb
core/vm, params: implement EIP2200, SSTORE optimizations (#19964)
* core/vm, params: implement EIP2200, SSTORE optimizations

* core/vm, params: switch EIP2200 to Wei's version
2019-08-19 14:39:38 +03:00
gary rong
c2c4c9f1e5 core, light, params: implement eip2028 (#19931)
* core, light, params: implement eip2028

* core, light: address comments

* core: address comments

* tests: disable Istanbul tx tests (until updated)

* core: address comment
2019-08-14 15:53:21 +03:00
gary rong
df6c08a485 core, trie: decode the value for storage dump (#19943)
* core, trie: decode the value for storage dump

* core/state: address comment
2019-08-12 17:14:40 +03:00
gary rong
c9cdf144d5 graphql, internal/ethapi: support overriding accounts in eth_call (#19917)
* graphql, internal/ethapi: extend eth_call

This PR offers the third option parameter for eth_call API.
Caller can specify a batch of contracts for overriding the
original account metadata(nonce, balance, code, state).
It has a few advantages:

* It's friendly for debugging
* It's can make on-chain contract lighter for getting rid of
  state access functions

* core, internal: address comments
2019-08-08 16:44:11 +03:00
Martin Holst Swende
081642ed25 Eip 1344 (ChainID opcode) (#19921)
* core/vm: implement EIP 1344 (ChainID opcode)

* core/vm: formatting
2019-08-08 16:20:28 +03:00
Martin Holst Swende
3e993ff64a Eip 1884 v3 (#19743)
* core/vm, tests: implement EIP 1884, add support for feature-tests

* core/vm: 1884-changes to extcodehash, move selfbalance opcode

* tests: fix statetests

* core/vm: move constants, address review concerns

* core/vm: word formatting

Co-Authored-By: Péter Szilágyi <peterke@gmail.com>
2019-08-08 12:07:23 +03:00
Corey Lin
f891fd9875 core/vm: fix comment grammar (#19923)
* core/vm:modify comment errors

* modify its back to it's
2019-08-07 12:53:16 +03:00
Antonio Salazar Cardozo
beff5fa578 params, core/vm: Istanbul EIP-1108 bn256 gas cost reduction (#19904)
* params: add IsIstanbul to config + rules

IstanbulBlock, used to determine if the config IsIstanbul, is currently
left nil until an actual block is chosen.

* params, core/vm: implement EIP-1108

Old gas costs for elliptic curve operations are given the PreIstanbul
prefix, while current gas costs retain the unprefixed names. The actual
precompile implementations are the same, so they are factored out into
common functions that are called by the pre-Istanbul and current
precompile structs. Finally, an Istanbul precompile list is added that
references the new precompile structs, which in turn reference the new
gas costs.

* params: fix fork ordering, add missing chain compatibility check
2019-08-06 17:12:54 +03:00
Martin Holst Swende
aa6005b469 core/vm, params: refactor chain configuration (#19735)
* params, core/vm: deprecating gastable, part 1

* core/vm, params: deprecate gastable, use both constant and dynamic gas

* core/vm, params: remove gastable, remove copypaste

* core/vm: make use of the chainrules

* interpreter: make tracing count constant+dynamic gas

* core/vm: review concerns (param/method name changes)

* core/vm: make use of chainrules more
2019-08-05 11:01:02 +03:00
gary rong
b80c840af3 core, les: fix les unit tests (#19823) 2019-07-22 15:45:40 +03:00
Péter Szilágyi
1a83114c74
all: update author list and licenses 2019-07-22 12:17:27 +03:00
Christian Muehlhaeuser
57fc1d21e1 cmd/geth, core/rawdb: add missing error checks (#19871)
* Added missing error checks

Add error handling where we assign err a value, but don't check for it being nil.

* core/rawdb: tiny style nit
2019-07-22 10:51:13 +03:00
Christian Muehlhaeuser
5183483c53 core/state, p2p/discover, trie, whisper: avoid unnecessary conversions (#19870)
No need to convert these types.
2019-07-22 10:30:09 +03:00
Péter Szilágyi
61a20cb56d
core: check error before accessing potentially nil block 2019-07-18 15:26:22 +03:00
Felix Lange
f088c650a5 all: replace t.Log(); t.FailNow() with t.Fatal() (#19849) 2019-07-18 15:21:24 +03:00
大彬
4ac04ae0fe all: replace fmt.Print* calls with t.Log* in tests (#19670) 2019-07-17 13:20:24 +02:00
gary rong
8f80cafa10 core: fix write concurrency in txpool (#19835)
* core: fix write coucurrency in txpool

* core: add rlock for pendingState read access

* core: address comments
2019-07-17 13:39:41 +03:00
Sheldon
7527215a68 core/state: fix random test args (#19255) 2019-07-09 10:32:27 +02:00
Péter Szilágyi
a966425a1d
core: kill off managed state, use own tiny noncer for txpool 2019-07-09 10:42:09 +03:00
Péter Szilágyi
983f92368b
core/forkid: implement the forkid EIP, announce via ENR (#19738)
* eth: chain config (genesis + fork) ENR entry

* core/forkid, eth: protocol independent fork ID, update to CRC32 spec

* core/forkid, eth: make forkid a struct, next uint64, enr struct, RLP

* core/forkid: change forkhash rlp encoding from int to [4]byte

* eth: fixup eth entry a bit and update it every block

* eth: fix lint

* eth: fix crash in ethclient tests
2019-07-08 18:53:47 +03:00
Martin Holst Swende
cdfe9a3a2a eth, les: add sanity checks for unbounded block fields (#19573)
This PR adds some hardening in the lower levels of the protocol stack, to bail early on invalid data. Primarily, attacks that this PR protects against are on the "annoyance"-level, which would otherwise write a couple of megabytes of data into the log output, which is a bit resource intensive.
2019-07-08 11:42:22 +02:00
Martin Holst Swende
f2eb3b1c56 core: lessen mem-spike during 1.8->1.9 conversion (#19610)
* core/blockchain: lessen mem-spike during 1.8->1.9 conversion

* core/blockchain.go: make levedb->freezer conversion gradually

* core/blockchain: write the batch
2019-07-08 11:24:16 +03:00
gary rong
ca6c8c2af4 core: fix receipt insertion (#19764) 2019-07-03 11:19:15 +03:00
gary rong
802074cba9 core: fix chain indexer (#19786)
This PR fixes an issue in chain indexer. Currently chain indexer will
validate whether the stored data is canonical by comparing section head
and canonical hash. But the header of the checkpoint may not exist in
the database. We should skip validation for sections below the
checkpoint.
2019-07-03 11:18:48 +03:00
Felföldi Zsolt
32273df0ea core: fix chain indexer reorg bug (#19748)
* core: fix chain indexer reorg bug

* core: prevent reverting valid section when reorg happens
2019-07-02 15:30:32 +03:00
Péter Szilágyi
22411919da
cmd, eth, les, param: drop --override.constantinople 2019-07-02 14:14:59 +03:00
gary rong
f7cdea2bdc all: on-chain oracle checkpoint syncing (#19543)
* all: implement simple checkpoint syncing

cmd, les, node: remove callback mechanism

cmd, node: remove callback definition

les: simplify the registrar

les: expose checkpoint rpc services in the light client

les, light: don't store untrusted receipt

cmd, contracts, les: discard stale checkpoint

cmd, contracts/registrar: loose restriction of registeration

cmd, contracts: add replay-protection

all: off-chain multi-signature contract

params: deploy checkpoint contract for rinkeby

cmd/registrar: add raw signing mode for registrar

cmd/registrar, contracts/registrar, les: fixed messages

* cmd/registrar, contracts/registrar: fix lints

* accounts/abi/bind, les: address comments

* cmd, contracts, les, light, params: minor checkpoint sync cleanups

* cmd, eth, les, light: move checkpoint config to config file

* cmd, eth, les, params: address comments

* eth, les, params: address comments

* cmd: polish up the checkpoint admin CLI

* cmd, contracts, params: deploy new version contract

* cmd/checkpoint-admin: add another flag for clef mode signing

* cmd, contracts, les: rename and regen checkpoint oracle with abigen
2019-06-28 10:34:02 +03:00
Martin Holst Swende
1da5e0ebb0 core/state, cmd/geth: streaming json output for dump command (#15475)
* core/state, cmd/geth: streaming json output dump cmd + optional code+storage

* dump: add option to continue even if preimages are missing

* core, evm: lint nits

* cmd: use local flags for dump, omit empty code/storage

* core/state: fix state dump test
2019-06-24 17:16:44 +03:00
Martin Holst Swende
f578d41ee6 core/vm, internal/ethapi: fail on eth_call when it times out, fixes #19186 (#19737) 2019-06-24 11:54:06 +03:00
Felix Lange
60c062e17d core: move TxPool reorg and events to background goroutine (#19705)
* core: move TxPool reorg and events to background goroutine

This change moves internal queue re-shuffling work in TxPool to a
background goroutine, TxPool.runReorg. Requests to execute runReorg are
accumulated by the new scheduleReorgLoop. The new loop also accumulates
transaction events.

The motivation for this change is making sends to txFeed synchronous
instead of sending them in one-off goroutines launched by 'add' and
'promoteExecutables'. If a downstream consumer of txFeed is blocked for
a while, reorg requests and events will queue up.

* core: remove homestead check in TxPool

This change removes tracking of the homestead block number from TxPool.
The homestead field was used to enforce minimum gas of 53000 for
contract creations after the homestead fork, but not before it. Since
nobody would want configure a non-homestead chain nowadays and contract
creations usually take more than 53000 gas, the extra correctness is
redundant and can be removed.

* core: fixes for review comments

* core: remove BenchmarkPoolInsert

This is useless now because there is no separate code path for
individual transactions anymore.

* core: fix pending counter metric

* core: fix pool tests

* core: dedup txpool announced events, discard stales

* core: reorg tx promotion/demotion to avoid weird pending gaps
2019-06-21 11:29:14 +03:00
Felix Lange
50e3795eef core/types: document RawSignatureValues (#19695) 2019-06-12 10:22:33 +03:00
Péter Szilágyi
b02958b9c5
core, ethdb, metrics, p2p: expose various counter metrics for grafana 2019-06-11 09:49:13 +03:00
Frank Szendzielarz
f9c0e093ed core/rawdb: avoid O_APPEND (#19676)
* Fix file system access for Windows

* Encapsulate file accesses

* Style fixes
2019-06-10 12:45:12 +03:00
Felföldi Zsolt
58497f46bd
les, les/flowcontrol: implement LES/3 (#19329)
les, les/flowcontrol: implement LES/3
2019-05-30 20:51:13 +02:00
Péter Szilágyi
fc85777a21
core: concurrent database reinit from freezer dump
* core: reinit chain from freezer in batches

* core/rawdb: concurrent database reinit from freezer dump

* core/rawdb: reinit from freezer in sequential order
2019-05-27 15:48:30 +03:00
Péter Szilágyi
7392f59e7c
core/rawdb: keep genesis in key-value store for full sync too 2019-05-27 12:25:24 +03:00
gary rong
611113e967 core: never delete genesis block (#19617) 2019-05-27 12:05:45 +03:00
Mohanson
4b622b277e core/state: unified function receiver names (#19615) 2019-05-26 00:52:10 +03:00
Péter Szilágyi
f35975ea21
core/rawdb, eth/downloader: align 64bit atomic fields 2019-05-17 01:45:05 +03:00
Péter Szilágyi
9eba3a9fff
cmd/geth, core/rawdb: seamless freezer consistency, friendly removedb 2019-05-16 17:01:56 +03:00
Péter Szilágyi
536b3b416c
cosensus, core, eth, params, trie: fixes + clique history cap 2019-05-16 10:39:35 +03:00
gary rong
37d280da41
core, cmd, vendor: fixes and database inspection tool (#15)
* core, eth: some fixes for freezer

* vendor, core/rawdb, cmd/geth: add db inspector

* core, cmd/utils: check ancient store path forceily

* cmd/geth, common, core/rawdb: a few fixes

* cmd/geth: support windows file rename and fix rename error

* core: support ancient plugin

* core, cmd: streaming file copy

* cmd, consensus, core, tests: keep genesis in leveldb

* core: write txlookup during ancient init

* core: bump database version
2019-05-16 10:39:34 +03:00
Martin Holst Swende
42c746d6f4
freezer: disable compression on hashes and difficulties (#14)
* freezer: disable compression on hashes and difficulties

* core/rawdb: address review concerns

* core/rawdb: address review concerns
2019-05-16 10:39:33 +03:00
Martin Holst Swende
331de17e4d
core/rawdb: support starting offset for future deletion 2019-05-16 10:39:33 +03:00
gary rong
80469bea0c
all: integrate the freezer with fast sync
* all: freezer style syncing

core, eth, les, light: clean up freezer relative APIs

core, eth, les, trie, ethdb, light: clean a bit

core, eth, les, light: add unit tests

core, light: rewrite setHead function

core, eth: fix downloader unit tests

core: add receipt chain insertion test

core: use constant instead of hardcoding table name

core: fix rollback

core: fix setHead

core/rawdb: remove canonical block first and then iterate side chain

core/rawdb, ethdb: add hasAncient interface

eth/downloader: calculate ancient limit via cht first

core, eth, ethdb: lots of fixes

* eth/downloader: print ancient disable log only for fast sync
2019-05-16 10:39:32 +03:00
rjl493456442
b6cac42e9f
core/rawdb: add file lock for freezer 2019-05-16 10:39:31 +03:00
Martin Holst Swende
b69bdc2a4f
freezer: implement split files for data
* freezer: implement split files for data

* freezer: add tests

* freezer: close old head-file when opening next

* freezer: fix truncation

* freezer: more testing around close/open

* rawdb/freezer: address review concerns

* freezer: fix minor review concerns

* freezer: fix remaining concerns + testcases around truncation

* freezer: docs

* freezer: implement multithreading

* core/rawdb: fix freezer nitpicks + change offsets to uint32

* freezer: preopen files, simplify lock constructs

* freezer: delete files during truncation
2019-05-16 10:39:30 +03:00
Péter Szilágyi
006c21efc7
cmd, core, eth, les, node: chain freezer on top of db rework 2019-05-16 10:39:29 +03:00
Péter Szilágyi
9effd64290
core, eth, trie: bloom filter for trie node dedup during fast sync (#19489)
* core, eth, trie: bloom filter for trie node dedup during fast sync

* eth/downloader, trie: address review comments

* core, ethdb, trie: restart fast-sync bloom construction now and again

* eth/downloader: initialize fast sync bloom on startup

* eth: reenable eth/62 until we properly remove it
2019-05-13 15:28:01 +03:00
Péter Szilágyi
751effa35e
core: fix formatting error (trailing whitepace) 2019-05-13 14:07:55 +03:00
PilkyuJung
ec2131c8d3 core: move error variable to error.go (#19560)
* move error variable to error.go

* Update error.go

Edit "Genesis" to "genesis"
2019-05-13 13:23:32 +03:00
Péter Szilágyi
6ec6b29051
core: fix import errors on clique crashes + empty blocks (#19544)
* core: fix import errors on clique crashes + empty blocks

* cosensus/clique, core: add test for the mirrored state issue

* core: address todo question wrt log count

* core: raise a louder warning for non-clique known blocks
2019-05-10 17:04:10 +03:00
gary rong
c113723fdb core: handle importing known blocks more gracefully (#19417)
* core: import known blocks if they can be inserted as canonical blocks

* core: insert knowns blocks

* core: remove useless

* core: doesn't process head block in reorg function
2019-05-08 14:30:36 +03:00
Martin Holst Swende
c8cf360f29
core: fix canonicality confusion (#19514)
* core: add tests for canonicality confusion

* core: delete stale future canon number mappings during reorg to shorter+heavier chain
2019-05-07 14:26:00 +02:00
유용환
abeba0a1de core/rawdb: fix typo (#19526) 2019-05-04 12:17:47 +02:00
Martin Holst Swende
4c90efdf57 consensus,core,miner: avoid overhead of creating a new block (#19301)
* consensus,core,miner: avoid overhead of creating a new block

* consensus: nitpick dot

* consensus: fix some comment formatting nits
2019-04-30 16:42:36 +03:00
Hongbin Mao
504f88b65b core/rawdb: typo fix storea => stores (#19498)
* typo fix

* change to stores
2019-04-26 12:22:21 +03:00
Matthew Halpern
937417527c core: lookup txs by block number instead of block hash (#19431)
* core: lookup txs by block number instead of block hash

Transaction hashes now store a reference to their corresponding
block number as opposed to their hash. In benchmarks this was
shown to reduce storage by over 12 GB.

The main limitation of this approach is that transactions on
non-canonical blocks could never be looked up, however that is
currently not supported.

The database version has been upgraded to version 5 and the
transaction lookup process is backwards-compatible with the
prior two transaction lookup formats prexisting in the
database instance. Tests have been added to ensure this.

* core/rawdb: tiny review nit fixes
2019-04-25 17:24:55 +03:00
gary rong
ce9a289fa4
core/types: fix cummulative gas bug and legacy decoding tests 2019-04-16 09:50:11 +03:00
Péter Szilágyi
7221cb1434
core, eth, les, light: scope receipt functionality a bit cleaner 2019-04-15 13:42:26 +03:00
Matthew Halpern
6b0ddd141e
core, eth, les, light: store transaction receipts without txHash and gasCost 2019-04-15 13:15:39 +03:00
Martin Holst Swende
d763b49ae3
consensus,core: shortcut uncle validation 2019-04-08 10:57:15 +02:00
gary rong
36f81118f6 core/state: fix state iterator (#19127)
* core/state: fix state iterator

* core: fix state iterator more elegant
2019-04-05 09:44:02 +03:00
Péter Szilágyi
43631aa1d6
core: minor code polishes + rebase fixes 2019-04-04 16:29:25 +03:00
rjl493456442
690bd8a417
core: re-omit new log event when logs rebirth 2019-04-04 14:17:43 +03:00
hydai
9b3601cfce core/vm: fix typos in comments (#19391) 2019-04-04 12:30:10 +02:00
Martin Holst Swende
36b78abe61
core/vm: instruction tests (#16327)
This PR makes it easy to generate and execute testcases for VM arithmetic operations. By enabling and running the testcase TestWriteExpectedValues, a set of json files are created which contain input and output for each arith operation.
The test TestJsonTestcases executes all of those tests.

While meaningless as is, this PR makes it less risky to make changes (optimizations) to the vm operations, since there will be a larger body of testcases.
2019-04-04 11:19:38 +02:00
Martin Holst Swende
0b4fe8d192 all: simplify timestamps to uint64 (#19372)
* all: simplify timestamps to uint64

* tests: update definitions

* clef, faucet, mobile: leftover uint64 fixups

* ethash: fix tests

* graphql: update schema for timestamp

* ethash: remove unused variable
2019-04-02 23:28:48 +03:00
Péter Szilágyi
e14f8a408c
Merge pull request #19328 from karalabe/preload
core: prefetch next block state concurrently
2019-04-02 17:03:12 +03:00
Runchao Han
c4109d790f core: fix typo in insertChain method doc (#19371) 2019-04-02 13:01:02 +03:00
Péter Szilágyi
92faf1bf7a
Merge pull request #19348 from LiangMa/overflowPR
core/vm: Correct the Memory Gas Overflow condition
2019-04-01 17:12:13 +03:00
Péter Szilágyi
9294b8f10f
core/vm: polish gas PR, fix tests, make table driven 2019-04-01 17:10:42 +03:00
Péter Szilágyi
ed34a5e08a
cmd, core, eth: support disabling the concurrent state prefetcher 2019-04-01 11:52:11 +03:00
Péter Szilágyi
bb9631c399
core: prefetch next block state concurrently 2019-04-01 11:06:15 +03:00
贺鹏飞
fbe7caf136
core: cache tx signature before obtaining lock 2019-03-29 12:01:29 +02:00
Liang Ma
157f09e5b6 core/vm: Correct the Memory Gas Overflow condition
previous overflow condition is too big to use.
0x7FFFFFFFF squre operation is overflowed uint64.

0x7FFFFFFFF^2 = 0x3F FFFF FFF0 0000 0001
2019-03-28 21:04:31 +00:00
Brent
7fb89697fd core/types: add block location fields to receipt (#17662)
Solves #15210 without changing consensus, in a backwards compatible way,
by adding tx inclusion information to the Receipt struct.
2019-03-27 13:39:25 +01:00
Péter Szilágyi
a732c93309
core: 3rd try on splitting the trie metrics correctly 2019-03-27 13:02:04 +02:00
Martin Holst Swende
59e1953246 core, ethdb, trie: mode dirty data to clean cache on flush (#19307)
This PR is a more advanced form of the dirty-to-clean cacher (#18995),
where we reuse previous database write batches as datasets to uncache,
saving a dirty-trie-iteration and a dirty-trie-rlp-reencoding per block.
2019-03-26 15:48:31 +01:00
Péter Szilágyi
b8b4fb004c
Merge pull request #19308 from holiman/fix_reset_txpool
core: make txpool handle reorg due to setHead
2019-03-26 11:00:35 +02:00
Péter Szilágyi
435020f9b3
core: split trie op metrics from the correct chain metrics 2019-03-25 16:27:46 +02:00
Péter Szilágyi
86989e3fcd
core: split out detailed trie access metrics from insertion time (#19316)
* core: split out detailed trie access metrics from insertion time

* cmd, core, metrics: support expensive optional metrics
2019-03-25 10:01:18 +02:00
Martin Holst Swende
650ad19c2d
core: make txpool handle reorg due to setHead 2019-03-21 11:42:56 +01:00
Péter Szilágyi
91eec1251c
cmd, core, eth, trie: get rid of trie cache generations (#19262)
* cmd, core, eth, trie: get rid of trie cache generations

* core, trie: get rid of remainder of cache gen boilerplate
2019-03-14 15:25:12 +02:00
Corey Lin
768b4c2e6b asm: remove unused parameter for function Lex (#18058) 2019-03-14 10:35:55 +01:00
Péter Szilágyi
4f457859a2
core: use headers only where blocks are unnecessary 2019-03-13 12:32:47 +02:00
Martin Holst Swende
7504dbd6eb core/vm: 64 bit memory and gas calculations (#19210)
* core/vm: remove function call for stack validation from evm runloop

* core/vm: separate gas  calc into static + dynamic

* core/vm: optimize push1

* core/vm: reuse pooled bigints for ADDRESS, ORIGIN and CALLER

* core/vm: use generic error message for jump/jumpi, to avoid string interpolation

* testdata: fix tests for new error message

* core/vm: use 64-bit memory calculations

* core/vm: fix error in memory calculation

* core/vm: address review concerns

* core/vm: avoid unnecessary use of big.Int:BitLen()
2019-03-12 11:40:05 +02:00
Sheldon
da5de012c3 state: fix emptyStatet to emptyRoot (#19254) 2019-03-12 11:14:24 +02:00
Péter Szilágyi
054412e335
all: clean up and proerly abstract database access 2019-03-06 13:35:03 +02:00
Péter Szilágyi
1bc7f3f906
core/types: fix receipt legacy decoding 2019-02-28 14:16:36 +02:00
Samuel Marks
e43bc36226
travis, appveyor, Dockerfile: upgrade to Go 1.12 2019-02-27 14:21:02 +02:00
Felföldi Zsolt
c2003ed63b les, les/flowcontrol: improved request serving and flow control (#18230)
This change

- implements concurrent LES request serving even for a single peer.
- replaces the request cost estimation method with a cost table based on
  benchmarks which gives much more consistent results. Until now the
  allowed number of light peers was just a guess which probably contributed
  a lot to the fluctuating quality of available service. Everything related
  to request cost is implemented in a single object, the 'cost tracker'. It
  uses a fixed cost table with a global 'correction factor'. Benchmark code
  is included and can be run at any time to adapt costs to low-level
  implementation changes.
- reimplements flowcontrol.ClientManager in a cleaner and more efficient
  way, with added capabilities: There is now control over bandwidth, which
  allows using the flow control parameters for client prioritization.
  Target utilization over 100 percent is now supported to model concurrent
  request processing. Total serving bandwidth is reduced during block
  processing to prevent database contention.
- implements an RPC API for the LES servers allowing server operators to
  assign priority bandwidth to certain clients and change prioritized
  status even while the client is connected. The new API is meant for
  cases where server operators charge for LES using an off-protocol mechanism.
- adds a unit test for the new client manager.
- adds an end-to-end test using the network simulator that tests bandwidth
  control functions through the new API.
2019-02-26 12:32:48 +01:00
gary rong
7fd0ccaa68 core: remove unnecessary fields in logs, receipts and tx lookups (#17106)
* core: remove unnecessary fields in log

* core: bump blockchain database version

* core, les: remove unnecessary fields in txlookup

* eth: print db version explicitly

* core/rawdb: drop txlookup entry struct wrapper
2019-02-21 15:14:35 +02:00
Martin Holst Swende
8577b5b020 core: more tests for sidechain import, fixes #19105 (#19113)
* blockchain: more tests for sidechain import, fixes #19105

* core/blockchain: rework import of pruned canon blocks and canon-prepended sidechains

* core/blockchain: minor clarity change

* core/blockchain: remove unused method
2019-02-21 12:36:49 +02:00
Péter Szilágyi
2e8a5e5659
core/vm: remove unused constants (#19095) 2019-02-19 19:49:45 +02:00
Matthew Halpern
bf42535d31 core: remove redundant parentheses (#19106) 2019-02-19 13:25:42 +02:00
Matthew Halpern
c5eccaefb8 core/vm: remove unused constants 2019-02-18 07:48:19 -08:00
Matthew Halpern
3930f3795b core: remove unused function (#19097) 2019-02-18 13:27:31 +02:00
needkane
a1f366ecf6 core/vm: update annotation (#19050) 2019-02-18 12:14:49 +01:00
Matthew Halpern
2b75fa9d61 core: enforce camel case variable names (#19058) 2019-02-14 21:14:05 +02:00
Péter Szilágyi
940e317094
core: fix pruner panic when importing low-diff-large-sidechain 2019-02-08 11:56:25 +02:00
Martin Holst Swende
da1efdae0c
core: repro #18977 2019-02-08 10:29:51 +02:00
Péter Szilágyi
d6225ab846
cmd/utils, eth: relinquish GC cache to read cache in archive mode 2019-02-07 14:36:25 +02:00
atsushi-ishibashi
81801ccc2b core/state: more memory efficient preimage allocation (#16663) 2019-02-07 10:44:45 +01:00
Martin Holst Swende
a0fd4b7e57 core/vm: unshadow err to make it visible in tracers(#18504) 2019-02-04 15:26:21 +01:00
Péter Szilágyi
822dc1bfb1
Merge pull request #18121 from karalabe/goerli
cmd, core, params: add support for Goerli
2019-02-04 15:21:24 +02:00
Péter Szilágyi
b0ed083ead
cmd, core, params: add support for Goerli 2019-02-04 14:53:12 +02:00
Martin Holst Swende
ec3432bccb
core: fix error in block iterator (#18986) 2019-02-04 13:30:19 +01:00
Gus
4eee99aac5 core/types: remove use of package unsafe 2019-01-29 10:17:40 +01:00
b00ris
769657060e les: implement ultralight client (#16904)
For more information about this light client mode, read
https://hackmd.io/s/HJy7jjZpm
2019-01-24 12:18:26 +01:00
Nalin Bhardwaj
b8f9b3779f core/vm: fix typos and use ExpGas for EXP (#18400)
This replaces the GasSlowStep constant with params.ExpGas.
Both constants have value 10.
2019-01-24 12:14:02 +01:00
Martin Holst Swende
ecb781297b core, cmd/puppeth: implement constantinople fix, disable EIP-1283 (#18486)
This PR adds a new fork which disables EIP-1283. Internally it's called Petersburg,
but the genesis/config field is ConstantinopleFix.

The block numbers are:

    7280000 for Constantinople on Mainnet
    7280000 for ConstantinopleFix on Mainnet
    4939394 for ConstantinopleFix on Ropsten
    9999999 for ConstantinopleFix on Rinkeby (real number decided later)

This PR also defaults to using the same ConstantinopleFix number as whatever
Constantinople is set to. That is, it will default to mainnet behaviour if ConstantinopleFix
is not set.This means that for private networks which have already transitioned
to Constantinople, this PR will break the network unless ConstantinopleFix is
explicitly set!
2019-01-24 11:36:30 +01:00
silence
66f0c464cc core: only cache non-nil receipts from the database (#18447)
receipts may be null for very short time in some condition. For this case, we should not add the null value into cache. Because you will not get the right result if you keep requesting that receipt.
2019-01-17 17:49:12 +02:00
Péter Szilágyi
f25f776c9f
core, light: get rid of the dual mutexes, hard to reason with 2019-01-11 15:27:47 +02:00
gary rong
d5cad488be core, eth: fix database version (#18429)
* core, eth: fix database version

* eth: polish error message
2019-01-11 13:49:12 +02:00
Péter Szilágyi
c1c4301121
Merge pull request #18371 from jeremyschlatter/patch-1
core/types: update incorrect comment
2019-01-04 10:14:17 +02:00
Dave McGregor
33d233d3e1
vendor, crypto, swarm: switch over to upstream sha3 package 2019-01-04 09:26:07 +02:00
Jeremy Schlatter
6537ab5dd3
core/types: update incorrect comment 2018-12-28 17:58:03 -08:00
Jordan Krage
27ce4eb78b core: sanitize more TxPoolConfig fields (#17210)
* core: sanitize more TxPoolConfig fields

* core: fix TestTransactionPendingMinimumAllowance
2018-12-20 14:00:58 +01:00
Shuai Qi
fe26b2f366 core/state: rename 'new' variable (#18301) 2018-12-14 14:55:03 +01:00
qd-ethan
9940d93a43 Comment error (#18303) 2018-12-14 11:15:31 +01:00
Martin Holst Swende
83a9a73b89 cmd/geth, core, eth: implement Constantinople override flag (#18273)
* geth/core/eth: implement constantinople override flag

* les: implemnent constantinople override flag for les clients

* cmd/geth, eth, les: fix typo, move flag to experimentals
2018-12-11 14:19:03 +02:00
Martin Holst Swende
42a914a84f
cmd/evm, core/vm, eth: implement api methods to do stdjson dump to local filesystem 2018-12-10 12:33:50 +02:00
Paweł Bylica
de39513ced core, internal, eth, miner, les: Take VM config from BlockChain (#17955)
Until this commit, when sending an RPC request that called `NewEVM`, a blank `vm.Config`
would be taken so as to set some options, based on the default configuration. If some extra
configuration switches were passed to the blockchain, those would be ignored.

This PR adds a function to get the config from the blockchain, and this is what is now used
for RPC calls.

Some subsequent changes need to be made, see https://github.com/ethereum/go-ethereum/pull/17955#pullrequestreview-182237244
for the details of the discussion.
2018-12-06 14:34:49 +01:00
Martin Holst Swende
7c657fc789 tests, core: update tests and make STATICCALL cause touch-delete (#18187) 2018-11-29 10:51:57 +02:00
Martin Holst Swende
bfed28a421 core: more detailed metrics for block processing (#18119) 2018-11-28 10:29:05 +02:00
Jaynti Kanani
38592a13a3 fix mixHash/nonce for parity compatible network (#18166) 2018-11-26 09:59:04 +01:00
mr_franklin
2a113f6d72 core: return error if repair block failed (#18126)
* core: return error if repair block failed

* make error a bit shorter
2018-11-23 11:16:14 +02:00
Péter Szilágyi
3ba0418a9a
Merge pull request #17973 from holiman/splitter2
core: better side-chain importing
2018-11-22 15:01:10 +02:00
Martin Holst Swende
e0d091e090 core: better printout of receipts in bad block reports (#18156)
* core/blockchain: better printout of receipts in bad block reports

* fix splleing
2018-11-22 11:00:16 +02:00
Péter Szilágyi
333b5fb123
core: polish side chain importer a bit 2018-11-21 13:19:56 +02:00
mr_franklin
3fd87f2193 core: fix comment typo (#18144) 2018-11-21 12:52:02 +02:00
Martin Holst Swende
493903eede
core: better side-chain importing 2018-11-20 12:28:43 +02:00
Péter Szilágyi
accc0fab4f
core, eth/downloader: fix ancestor lookup for fast sync 2018-11-16 13:21:20 +02:00
Péter Szilágyi
434dd5bc00
cmd, core, eth, light, trie: add trie read caching layer 2018-11-15 12:22:13 +02:00
gary rong
1212c7b844 core: fix default trie cache limit (#17860) 2018-11-12 18:06:34 +02:00
Corey Lin
1ff152f3a4 rawdb: remove unused parameter for WritePreimages func (#18059)
* rawdb: remove unused parameter for WritePreimages func and modify a
spelling mistake

* rawdb: update the doc for function WritePreimages
2018-11-09 12:51:07 +02:00
Felix Lange
870efeef01
core/state: remove lock (#18065)
The lock in StateDB is useless. It's only held in Copy, but Copy is safe
for concurrent use because all it does is read.
2018-11-08 21:37:19 +01:00
Péter Szilágyi
d0675e9d9c
Merge pull request #17982 from holiman/polish_contantinople_extcodehash
core/vm: check empty in extcodehash
2018-11-08 14:26:04 +02:00
Corey Lin
a5dc087845 core/vm, eth/tracers: use pointer receiver for GetRefund (#18018) 2018-11-08 13:07:15 +01:00
Felix Lange
0bcff8f525
eth/downloader: speed up tests by generating chain only once (#17916)
* core: speed up GenerateChain

Use a mock implementation of ChainReader instead of creating
and destroying a BlockChain object for each generated block.

* eth/downloader: speed up tests by generating chain only once

This change reworks the downloader tests so they share a common test
blockchain instead of generating a chain in every test. The tests are
roughly twice as fast now.
2018-11-07 15:07:43 +01:00
Martin Holst Swende
eea3ae42a3 core, eth/downloader: fix validation flaw, fix downloader printout flaw (#17974) 2018-11-07 14:47:11 +02:00
Martin Holst Swende
1b6fd032e3
core/vm: check empty in extcodehash 2018-10-26 08:56:37 +02:00
Felix Lange
7f22b59f87 core/state: simplify proof methods (#17965)
This fixes the import cycle build error in core/vm tests.
There is no need to refer to core/vm for a type definition.
2018-10-23 21:51:41 +02:00
Martin Holst Swende
4c0883e20d core/vm: adds refund as part of the json standard trace (#17910)
This adds the global accumulated refund counter to the standard
json output as a numeric json value. Previously this was not very
interesting since it was not used much, but with the new sstore
gas changes the value is a lot more interesting from a consensus
investigation perspective.
2018-10-23 16:28:18 +02:00
Wuxiang
d98c45f70f core: fix a typo (#17941) 2018-10-19 16:33:27 +03:00
Simon Jentzsch
97fb08342d EIP-1186 eth_getProof (#17737)
* first impl of eth_getProof

* fixed docu

* added comments and refactored based on comments from holiman

* created structs

* handle errors correctly

* change Value to *hexutil.Big in order to have the same output as parity

* use ProofList as return type
2018-10-18 21:41:22 +02:00
Smilenator
2868acd80b core/types: fix comment for func SignatureValues (#17921) 2018-10-16 12:45:28 +02:00
Martin Holst Swende
a352de6a08 core/vm: add shortcuts for trivial exp cases (#16851) 2018-10-16 00:51:39 +02:00
Guillaume Ballet
97b2806686 core/asm: Use hexadecimal addresses in assembly dumps (#17870) 2018-10-09 10:27:07 +03:00
Wenbiao Zheng
31c4e3a118 core/types: Log.Index is the index in block, not receipt (#17866) 2018-10-08 13:15:19 +02:00
Péter Szilágyi
1d3d4a4d57 core/vm: reuse Keccak-256 hashes across opcode executions (#17863) 2018-10-08 13:14:29 +02:00
Martin Holst Swende
58e868b759
core/vm : fix failing testcase (#17852)
* core/vm : fix failing testcase

* core/vm: fix nitpick
2018-10-05 19:02:06 +02:00
Martin Holst Swende
092df3ab59 core/vm: SHA3 word cost for CREATE2 (#17812)
* core/vm: create2 address generation tests

* core/vm: per byte cost of CREATE2

* core/vm: fix linter issue in test
2018-10-05 10:32:35 +03:00
Martin Holst Swende
89a32451ae core/vm: faster create/create2 (#17806)
* core/vm/runtim: benchmark create/create2

* core/vm: do less hashing in CREATE2

* core/vm: avoid storing jumpdest analysis for initcode

* core/vm: avoid unneccesary lookups, remove unused fields

* core/vm: go formatting tests

* core/vm: save jumpdest analysis locally

* core/vm: use common.Hash instead of nil, fix review comments

* core/vm: removed type destinations

* core/vm: correct check for empty hash

* eth: more elegant api_tracer

* core/vm: address review concerns
2018-10-04 18:15:37 +03:00
Felföldi Zsolt
9d06b2c5f3 core: use ChainHeadEvent subscription in the chain indexer (#17826) 2018-10-03 17:25:25 +03:00
Péter Szilágyi
14bef9a2db
core: fix unnecessary ancestor lookup after a fast sync (#17825) 2018-10-03 13:42:19 +03:00
Ryan Schneider
b69942befe core, internal/ethapi: add and use LRU cache for receipts (#17610) 2018-09-29 22:53:31 +02:00
reinerRubin
86ec213076 core/types: make tx signature values optional in JSON (#17742) 2018-09-29 22:47:59 +02:00
thumb8432
ffca6dfe01 core/types: fix typos (#17762) 2018-09-29 22:11:56 +02:00
Liang ZOU
6663e5da10 all: fix various comment typos (#17748) 2018-09-25 12:26:35 +02:00
Péter Szilágyi
ee92bc537f
Merge pull request #17383 from holiman/eip1283
Eip1283
2018-09-21 14:16:18 +03:00
Wuxiang
81080bf8cb core: fix a typo (#17733) 2018-09-21 13:45:42 +03:00
gary rong
ba0a8b7887 core, eth: fix dependency cycle (#17720) 2018-09-20 20:02:15 +03:00
gary rong
d6254f827b all: protect self-mined block during reorg (#17656) 2018-09-20 15:09:30 +03:00
Péter Szilágyi
0f2ba07c41
common, core, light: add block age into info logs 2018-09-20 12:56:35 +03:00
Guillaume Ballet
da29332c5f core/vm: add switches to select evm+ewasm interpreters (#17687)
Interpreter initialization is left to the PRs implementing them.
Options for external interpreters are passed after a colon in the
`--vm.ewasm` and `--vm.evm` switches.
2018-09-20 10:44:35 +03:00
Péter Szilágyi
faa69bea1c
core, eth: fix goimports for Go 1.11 2018-09-19 11:47:09 +03:00
Péter Szilágyi
5d921fa3a0
core, params: polish net gas metering PR a bit 2018-09-18 16:29:51 +03:00
Martin Holst Swende
caa2c23a38
core,state: finish implementing Eip 1283 2018-09-18 13:08:32 +03:00
Martin Holst Swende
58374e28d9
core, state: initial implementation of Eip-1283 2018-09-18 13:08:28 +03:00
Péter Szilágyi
cc21928e12
Merge pull request #17622 from karalabe/chain-maker-seal
consensus/clique, core: chain maker clique + error tests
2018-09-17 11:35:42 +03:00
Emil
86a03f97d3 all: simplify s[:] to s where s is a slice (#17673) 2018-09-14 22:07:13 +02:00
Liang ZOU
72c820c49e core/vm: fix typo 'EVM EVM' ==> 'EVM' (#17654) 2018-09-13 12:48:15 +03:00
Péter Szilágyi
4bb25042eb
consensus/clique, core: chain maker clique + error tests 2018-09-11 16:40:00 +03:00
Paweł Bylica
ae992a5d73 core/vm: Hide read only flag from Interpreter interface (#17461)
Makes Interface interface a bit more stateless and abstract.

Obviously this change is dictated by EVMC design. The EVMC tries to keep the responsibility for EVM features totally inside the VMs, if feasible. This makes VM "stateless" because VM does not need to pass any information between executions, all information is included in parameters of the execute function.
2018-09-07 18:13:25 +02:00
Hyung-Kyu Hqueue Choi
cf33d8b83c core: fix typo in comment (#17586) 2018-09-05 10:29:51 +02:00
Martin Holst Swende
32f28a9360 core/vm, tests: update tests, enable constantinople statetests, fix SAR opcode (#17538)
This commit does a few things at once:

- Updates the tests to contain the latest data from ethereum/tests repo.
- Enables Constantinople state tests. This is needed to be able to
  fuzz-test the evm with constantinople rules.
- Fixes the error in opSAR that we've known about for some time. I was
  kind of saving it to see if we hit upon it with the random test
  generator, but it's difficult to both enable the tests and have the
  bug there -- we don't want to forget about it, so maybe it's better
  to just fix it.
2018-09-04 10:49:18 +02:00
Wenbiao Zheng
6a33954731 core, eth, trie: use common/prque (#17508) 2018-09-03 17:33:21 +02:00
Péter Szilágyi
e8f229b82e
cmd, core, eth, miner, params: configurable gas floor and ceil 2018-08-29 12:40:12 +03:00
Felföldi Zsolt
63352bf424 core: safe indexer operation when syncing starts before the checkpoint (#17511) 2018-08-28 10:31:34 +03:00
gary rong
b69476b372 all: make indexer configurable (#17188) 2018-08-28 10:08:16 +03:00
Sheldon
0bec85f2e2 core: fix typos in comment (#17531) 2018-08-28 10:04:33 +03:00
Wenbiao Zheng
d1aa605f1e all: remove the duplicate 'the' in annotations (#17509) 2018-08-27 11:49:29 +03:00
gary rong
40a71f28cf miner: fix state commit, track old work packages too (#17490)
* miner: commit state which is relative with sealing result

* consensus, core, miner, mobile: introduce sealHash interface

* miner: evict pending task with threshold

* miner: go fmt
2018-08-23 16:02:57 +03:00
gary rong
c3f7e3be3b core/statedb: deep copy logs (#17489) 2018-08-23 15:59:58 +03:00
Péter Szilágyi
e0d0e64ce2
cmd, core, miner: add --txpool.locals and priority mining 2018-08-22 09:43:57 +03:00
Aditya
c929030e28 core/types: fix docs about protected Vs (#17436) 2018-08-20 15:14:50 +03:00
gary rong
54216811a0 miner: regenerate mining work every 3 seconds (#17413)
* miner: regenerate mining work every 3 seconds

* miner: polish
2018-08-16 14:14:33 +03:00
Felföldi Zsolt
2cdf6ee7e0 light: CHT and bloom trie indexers working in light mode (#16534)
This PR enables the indexers to work in light client mode by
downloading a part of these tries (the Merkle proofs of the last
values of the last known section) in order to be able to add new
values and recalculate subsequent hashes. It also adds CHT data to
NodeInfo.
2018-08-15 22:25:46 +02:00
gary rong
a1783d1697 miner: move agent logic to worker (#17351)
* miner: move agent logic to worker

* miner: polish

* core: persist block before reorg
2018-08-14 18:34:33 +03:00
gary rong
e0e0e53401 crypto: change formula for create2 (#17393) 2018-08-14 18:30:42 +03:00
Mymskmkt
fb368723ac core: fix comment typo (#17376) 2018-08-13 11:40:52 +03:00
stormpang
6711f098d5 core/vm: fix comment typo (#17319)
antything --> anything
:P
2018-08-06 11:42:49 +03:00
Hyung-Kyu Hqueue Choi
0ab54de1a5 core/vm: update benchmarks for core/vm (#17308)
- Update benchmarks to use a pool of int pools.
  Unless benchmarks are aborted with segmentation fault.

Signed-off-by: Hyung-Kyu Choi <hqueue@users.noreply.github.com>
2018-08-03 08:15:33 +03:00
Ha ĐANG
702b8a7aec core/vm: fix typo in cryptographic hash function name (#17285) 2018-07-31 13:27:51 +03:00
Ha ĐANG
2cffd4ff3c core: fix some small typos on comment code (#17278) 2018-07-30 14:10:48 +03:00
Oleg Kovalov
d42ce0f2c1 all: simplify switches (#17267)
* all: simplify switches

* silly mistake
2018-07-30 12:30:09 +03:00