Commit Graph

1679 Commits

Author SHA1 Message Date
Péter Szilágyi
d754091a87
core/state/snapshot: unlink snapshots from blocks, quad->linear cleanup 2020-02-25 12:51:07 +02:00
Martin Holst Swende
cdf3f016df
snapshot: iteration and buffering optimizations 2020-02-25 12:51:06 +02:00
Péter Szilágyi
d7d81d7c12
core/state/snapshot: extract and split cap method, cover corners 2020-02-25 12:51:05 +02:00
Martin Holst Swende
e146fbe4e7
core/state: lazy sorting, snapshot invalidation 2020-02-25 12:51:05 +02:00
Péter Szilágyi
542df8898e
core: initial version of state snapshots 2020-02-25 12:51:04 +02:00
Gregory Markou
4be8840120
core/vm: use dedicated SLOAD gas constant for EIP-2200 (#20646) 2020-02-18 15:07:41 +01:00
Martin Holst Swende
855690523a
core: ensure state exists for prefetcher (#20627) 2020-02-14 10:54:02 +02:00
Péter Szilágyi
9938d954c8
eth: rework tx fetcher to use O(1) ops + manage network requests 2020-02-13 15:27:15 +02:00
rjl493456442
049e17116e
core, eth: implement eth/65 transaction fetcher 2020-02-11 13:56:36 +02:00
Martin Holst Swende
058a4ac5f1
core/evm: less iteration in blockhash (#20589)
* core/vm/runtime: add test for blockhash

* core/evm: less iteration in blockhash

* core/vm/runtime: nitpickfix

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2020-02-04 12:32:31 +02:00
Martin Holst Swende
5a9c96454e
trie: separate hashes and committer, collapse on commit
* trie:  make db insert use size instead of full data

* core/state: minor optimization in state onleaf allocation

* trie: implement dedicated committer and hasher

* trie: use dedicated committer/hasher

* trie: linter nitpicks

* core/state, trie: avoid unnecessary storage trie load+commit

* trie: review feedback, mainly docs + minor changes

* trie: start deprecating old hasher

* trie: fix misspell+lint

* trie: deprecate hasher.go, make proof framework use new hasher

* trie: rename pure_committer/hasher to committer/hasher

* trie, core/state: fix review concerns

* trie: more review concerns

* trie: make commit collapse into hashnode, don't touch dirtyness

* trie: goimports fixes

* trie: remove panics
2020-02-03 17:28:30 +02:00
Guillaume Ballet
24cab2d535
core/vm/runtime: fix typos in comment (#20608) 2020-01-30 11:21:10 +01:00
gary rong
b88b4632c2 core: fix chain indexer unit test (#20506) 2020-01-20 10:38:08 +02:00
gary rong
770316dc20 core, light: write chain data in atomic way (#20287)
* core: write chain data in atomic way

* core, light: address comments

* core, light: fix linter

* core, light: address comments
2020-01-17 12:49:32 +02:00
Martin Holst Swende
b2de0bd87b
core: set max tx size down to 2 slots (64KB) 2020-01-14 11:49:36 +01:00
MichaelRiabzev-StarkWare
8bd37a1d91 core: count tx size in slots, bump max size ot 4x32KB (#20352)
* tests for tx size

* alow multiple slots transactions

* tests for tx size limit (32 KB)

* change tx size tests to use addRemoteSync instead of validateTx (requested in pool request).

* core: minor tx slotting polishes, add slot tracking metric

Co-authored-by: Michael Riabzev <RiabzevMichael@gmail.com>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2020-01-10 11:40:03 +02:00
Martin Holst Swende
fc392395fb
core/state: add more verbosity to panic 2020-01-10 10:12:32 +01:00
Felix Lange
d90d1db609
eth/filters: remove use of event.TypeMux for pending logs (#20312) 2019-12-10 12:39:14 +01:00
Marius van der Wijden
f383eaa102
core: removed old invalid comment 2019-12-10 11:50:16 +01:00
Martin Holst Swende
bc01593afb consensus/ethash, params: eip-2384: bump difficulty bomb (#20347)
* consensus/ethash, params: implement eip-2384: bump difficulty bomb

* params: EIP 2384 compat checks

* consensus, params: add Muir Glacier block number (mainnet,ropsten) + official name

* core/forkid: forkid tests for muir glacier

* params/config: address review concerns

* params, core/forkid: review nitpicks

* cmd/geth,eth,les: add override option for muir glacier

* params: nit fix
2019-12-06 11:36:40 +02:00
gary rong
fc7e0fe6c7 core, miner: remove PostChainEvents (#19396)
This change:

- removes the PostChainEvents method on core.BlockChain.
- sorts 'removed log' events by block number.
- fire the NewChainHead event if we inject a canonical block into the chain
  even if the entire insertion is not successful.
- guarantees correct event ordering in all cases.
2019-11-29 14:22:08 +01:00
Péter Szilágyi
58e33d9e5a
Merge pull request #20403 from karalabe/fix-freezer-reinit
core/rawdb: fix reinit regression caused by the hash check PR
2019-11-27 15:05:58 +02:00
Péter Szilágyi
717f8a4e8f
core/rawdb: fix reinit regression caused by the hash check PR 2019-11-27 14:41:47 +02:00
Guillaume Ballet
7b189d6f1f
core: fix staticcheck warnings (#20384)
* core: fix staticcheck warnings

* fix goimports
2019-11-27 09:50:30 +01:00
Michael Forney
3a0480e07d core/asm: allow numbers in labels (#20362)
Numbers were already allowed when creating labels, just not when
referencing them.
2019-11-23 12:52:17 +01:00
Felix Lange
dd21f079e8
core/state: fix staticcheck warnings (#20357)
Also remove dependency on gopkg.in/check.v1 in tests.
2019-11-22 15:56:05 +01:00
Felix Lange
b6d4f6b66e core/types: remove BlockBy sorting code (#20355) 2019-11-21 16:35:22 +02:00
Felix Lange
f71e85b8e2 core: fix staticcheck warnings (#20323) 2019-11-20 10:53:01 +02:00
gary rong
b9c90c5581 core/rawdb: check hash before return data from ancient db (#20195)
* core/rawdb: check hash before return data from ancient db

* core/rawdb: fix lint

* core/rawdb: calculate the hash in the fly
2019-11-19 12:32:57 +02:00
meowsbits
57d697629d core: s/isEIP155/isHomestead/g (fix IntrinsicGas signature var name) (#20300)
* core: s/isEIP155/isEIP2/ (fix)

This signature variable name reflects a spec'd change
in gas cost for creating contracts as documented in EIP2 (Homestead HF).

https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2.md#specification

* core: s/isEIP2/sIsHomestead/g

Use isHomestead since Homestead is what the caller
and rest of the code uses.
2019-11-18 11:41:49 +02:00
Felix Lange
689486449d build: use golangci-lint (#20295)
* build: use golangci-lint

This changes build/ci.go to download and run golangci-lint instead
of gometalinter.

* core/state: fix unnecessary conversion

* p2p/simulations: fix lock copying (found by go vet)

* signer/core: fix unnecessary conversions

* crypto/ecies: remove unused function cmpPublic

* core/rawdb: remove unused function print

* core/state: remove unused function xTestFuzzCutter

* core/vm: disable TestWriteExpectedValues in a different way

* core/forkid: remove unused function checksum

* les: remove unused type proofsData

* cmd/utils: remove unused functions prefixedNames, prefixFor

* crypto/bn256: run goimports

* p2p/nat: fix goimports lint issue

* cmd/clef: avoid using unkeyed struct fields

* les: cancel context in testRequest

* rlp: delete unreachable code

* core: gofmt

* internal/build: simplify DownloadFile for Go 1.11 compatibility

* build: remove go test --short flag

* .travis.yml: disable build cache

* whisper/whisperv6: fix ineffectual assignment in TestWhisperIdentityManagement

* .golangci.yml: enable goconst and ineffassign linters

* build: print message when there are no lint issues

* internal/build: refactor download a bit
2019-11-18 10:49:17 +02:00
nebojsa94
738b51ae31 core/vm: fix tracer interface parameter name (#20294) 2019-11-15 10:52:33 +02:00
Martin Holst Swende
b566cfdffd core/evm: avoid copying memory for input in calls (#20177)
* core/evm, contracts: avoid copying memory for input in calls + make ecrecover not modify input buffer

* core/vm: optimize mstore a bit

* core/vm: change Get -> GetCopy in vm memory access
2019-11-04 11:31:09 +02:00
Martin Holst Swende
9278951a62 params, core/forkid: configure mainnet istanbul block 9069K (#20222)
* params: configure mainnet istanbul block 9069K

* core/forkid: add some more test items for mainnet istanbul
2019-10-31 11:04:26 +02:00
Péter Szilágyi
8927f7724a
cmd/devp2p, core/forkid: make forkid.Filter API uniform 2019-10-31 10:38:14 +02:00
Péter Szilágyi
93422e9d15
Merge pull request #20140 from karalabe/eth64-handshake-forkid
eth: eth/64 - extend handshake with with fork id
2019-10-30 13:21:25 +02:00
Péter Szilágyi
9641cacea8 core/forkid: add two clauses for more precise validation (#20220) 2019-10-30 12:05:31 +01:00
Péter Szilágyi
64571f9379
eth: eth/64 - extend handshake packet with fork id 2019-10-29 18:04:39 +02:00
Felix Lange
2c37142d2f cmd/devp2p, p2p: dial using node iterator, discovery crawler (#20132)
* p2p/enode: add Iterator and associated utilities

* p2p/discover: add RandomNodes iterator

* p2p: dial using iterator

* cmd/devp2p: add discv4 crawler

* cmd/devp2p: WIP nodeset filter

* cmd/devp2p: fixup lesFilter

* core/forkid: add NewStaticFilter

* cmd/devp2p: make -eth-network filter actually work

* cmd/devp2p: improve crawl timestamp handling

* cmd/devp2p: fix typo

* p2p/enode: fix comment typos

* p2p/discover: fix comment typos

* p2p/discover: rename lookup.next to 'advance'

* p2p: lower discovery mixer timeout

* p2p/enode: implement dynamic FairMix timeouts

* cmd/devp2p: add ropsten support in -eth-network filter

* cmd/devp2p: tweak crawler log message
2019-10-29 17:08:57 +02:00
Michael Forney
b0b277525c core/asm: assembly parser label fixes (#20210)
* core/asm: Fix encoding of pushed labels

EVM uses big-endian byte-order, so to pad a label value to 4 bytes,
zeros must be added to the front, not the end.

* core/asm: Fix PC calculations when a label is pushed

Incrementing PC by 5 is only correct if the label appears after a jump,
in which case there is an implicit push. When it appears after an explicit
push, PC should only be incremented by 4.

* core/asm: Allow JUMP with no argument

This way, a label can be pushed explicitly, or loaded from memory to
implement a jump table.
2019-10-29 13:47:18 +01:00
gary rong
ecdbb402ee trie: remove node ordering slice in sync batch (#19929)
When we flush a batch of trie nodes into database during the state
sync, we should guarantee that all children should be flushed before
parent.

Actually the trie nodes commit order is strict by: children -> parent.
But when we flush all ready nodes into db, we don't need the order
anymore since

    (1) they are all ready nodes (no more dependency)
    (2) underlying database provides write atomicity
2019-10-28 18:50:11 +01:00
Martin Holst Swende
c476460cb2
params: check fork ordering when initializing new genesis, fixes #20136 (#20169)
prevent users from misconfiguring their nodes so that fork ordering is not preserved.
2019-10-16 13:23:14 +02:00
Martin Holst Swende
ead711779d
core: initialize current block/fastblock atomics to nil, fix #19286 (#19352) 2019-09-26 11:10:35 +02:00
zcheng9
2133f18f15 core/state: fix database leak and copy tests (#19306) 2019-09-26 11:09:59 +02:00
ywzqwwt
1a6ef5ae58 core/blockchain: remove block from futureBlocks on error (#19763) 2019-09-26 10:57:51 +02:00
Ryan Schneider
ad03d9801c internal/ethapi: support block number or hash on state-related methods (#19491)
This change adds support for EIP-1898.
2019-09-26 10:47:31 +02:00
Péter Szilágyi
a308f012ba
core/state: fix copy-commit-copy (#20113)
* core/state: revert noop finalise, fix copy-commit-copy

* core/state: reintroduce net sstore tracking, extend tests for it
2019-09-24 10:49:59 +03:00
gary rong
05347b3d98 core/state: fix state object deep copy (#20100)
deepCopy didn't copy pending storage updates, leading to the
creation of blocks with invalid state root.
2019-09-20 11:55:44 +02:00
Péter Szilágyi
f9eb307216
core/forkid, params: fix tests, enable Istanbul on Rinkeby + testers 2019-09-19 10:13:11 +03:00
Péter Szilágyi
f40ff23b7b
core: fix tx dedup return error count 2019-09-18 11:42:47 +03:00
Felföldi Zsolt
0ac9bbba6c les: multiple server bugfixes (#20079)
* les: detailed relative cost metrics

* les: filter txpool relative request statistic

* les: initialize price factors

* les: increased connected bias to lower churn rate

* les: fixed clientPool.setLimits

* core: do not use mutex in GetAncestor

* les: bump factor db version again

* les: add metrics

* les, light: minor fixes
2019-09-17 16:28:41 +03:00
Péter Szilágyi
056183c056
core: dedup known transactions without global lock, track metrics 2019-09-17 15:55:06 +03:00
Martin Holst Swende
8d41e885e6 core: smaller txpool status locking (#20080)
* txpool: smaller lock portion

* core/tx_pool: fix data race
2019-09-17 10:34:28 +03:00
Martin Holst Swende
f49d6e5ec0
core: add blockchain test too for revert cornercase 2019-09-16 11:42:14 +03:00
Péter Szilágyi
223b950944
core/state: accumulate writes and only update tries when must 2019-09-16 11:05:57 +03:00
Rob Mulholand
3b6c9902f3 core: remove unused gas return in ApplyTransaction (#20065) 2019-09-12 22:22:22 +03:00
Péter Szilágyi
305ed955db
Merge pull request #20038 from holiman/minor_encodingfix
core/state: optimize some internals during encoding
2019-09-10 17:12:06 +03:00
Martin Holst Swende
72045dff4f
core/state: optimize some internals during encoding 2019-09-10 15:15:34 +02:00
Péter Szilágyi
72d5a27a39
core, metrics, p2p: switch some invalid counters to gauges 2019-09-10 14:39:07 +03:00
Péter Szilágyi
cc9eb91d30
Merge pull request #20004 from karalabe/istanbul-override
cmd, core, eth, les: support --override.istanbul
2019-08-23 12:38:05 +03:00
Péter Szilágyi
e39b2a2bde
acmd, core, eth, les: support --override.istanbul 2019-08-23 12:09:27 +03:00
Péter Szilágyi
c8a1c0a115
Merge pull request #19993 from karalabe/istanbul-eip-integration
core/vm: enable istanbul EIPs in the jump table
2019-08-23 11:55:43 +03:00
Felix Lange
54b271a86d
crypto: add SignatureLength constant and use it everywhere (#19996)
Original change by @jpeletier
2019-08-22 15:14:06 +02:00
Péter Szilágyi
060e33fb4c
core/vm: enable istanbul EIPs in the jump table 2019-08-22 13:41:55 +03:00
HackyMiner
7c229941ac core: log chain reorg/split metrics (#18950)
* core: log chain reorg/split metrics

* core: report 1-block reorgs on the metrics too
2019-08-22 12:28:23 +03:00
Péter Szilágyi
22fdbee8ed
Merge pull request #19972 from keep-network/istanbul-eip-152-blake2b-f-precompile
core/vm, crypto/blake2b: add BLAKE2b compression func at 0x09
2019-08-22 11:09:31 +03:00
Péter Szilágyi
1bccafe5ef
core/vm, crypto/blake2b: add SSE, AVX and AVX2 code 2019-08-21 13:09:15 +03:00
Piotr Dyraga
2890f060b7
core/vm, crypto/blake2b: add BLAKE2b compression func at 0x09
The precompile at 0x09 wraps the BLAKE2b F compression function:
https://tools.ietf.org/html/rfc7693#section-3.2

The precompile requires 6 inputs tightly encoded, taking exactly 213
bytes, as explained below.

- `rounds` - the number of rounds - 32-bit unsigned big-endian word
- `h` - the state vector - 8 unsigned 64-bit little-endian words
- `m` - the message block vector - 16 unsigned 64-bit little-endian words
- `t_0, t_1` - offset counters - 2 unsigned 64-bit little-endian words
- `f` - the final block indicator flag - 8-bit word

[4 bytes for rounds][64 bytes for h][128 bytes for m][8 bytes for t_0]
[8 bytes for t_1][1 byte for f]

The boolean `f` parameter is considered as `true` if set to `1`.
The boolean `f` parameter is considered as `false` if set to `0`.
All other values yield an invalid encoding of `f` error.

The precompile should compute the F function as specified in the RFC
(https://tools.ietf.org/html/rfc7693#section-3.2) and return the updated
state vector `h` with unchanged encoding (little-endian).

See EIP-152 for details.
2019-08-21 13:09:15 +03:00
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