Commit Graph

12883 Commits

Author SHA1 Message Date
Sina Mahmoodi
783e97ef1f
core/rawdb: avoid unnecessary receipt processing for log filtering (#23147)
* core/types: rm extranous check in test

* core/rawdb: add lightweight types for block logs

* core/rawdb,eth: use lightweight accessor for log filtering

* core/rawdb: add bench for decoding into rlpLogs
2021-09-28 12:54:49 +02:00
Martin Holst Swende
ab2caaee11
eth/tracers: implement debug.intermediateRoots (#23594)
This PR implements a new debug method, which I've talked briefly about to some other client developers. It allows the caller to obtain the intermediate state roots for a block (which might be either a canon block or a 'bad' block).
2021-09-28 12:53:11 +02:00
Guillaume Ballet
443afc975c
core/state: move state account to core/types + abstracted "write account to trie" (#23567)
* core/state: abstracted "write account to trie" method

* fix appveyor build

* Apply suggestions from code review

Co-authored-by: Martin Holst Swende <martin@swende.se>

* review feedback

* core/state/accounts: move Account to core/types

* core/types: rename Account -> StateAccount

* core/state: restore EncodeRLP for stateObject

* core/types: add the missing file

* more review feedback

* more review feedback

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Felix Lange <fjl@twurst.com>
2021-09-28 10:48:07 +02:00
Sina Mahmoodi
ac7baeab57
eth/tracers: re-write of 4byte tracer using enter/exit (#23622)
* eth/tracers: add re-write of 4byte tracer using enter/exit

* eth/tracers: fix 4byte indent
2021-09-27 18:44:16 +02:00
Zachinquarantine
12674d493e
cmd/puppeth: remove shh from Dockerfile (#23634) 2021-09-27 18:42:48 +02:00
Jordan Krage
51ececb64e
rpc: set pong read deadline (#23556)
This PR adds a 30s timeout for the remote part to answer a ping message, thus detecting (silent) disconnnects
2021-09-27 16:31:45 +02:00
gary rong
57a3fab8a7
accounts/abi: fix resolving single struct argument (#23573) 2021-09-22 10:18:18 +02:00
Sina Mahmoodi
ca9bce9a45
rpc: set scheme for ws and ipc conns to the server (#23615)
* rpc: set scheme for ws and ipc conns to the server

* rpc: review fixes

* rpc: bugfix

* rpc: empty default scheme
2021-09-21 22:26:35 +02:00
Marius van der Wijden
b61ef24cce
consensus/clique: prevent 0 len extradata from panicing (#23538)
Closes #23522

Co-authored-by: Martin Holst Swende <martin@swende.se>
2021-09-21 10:46:08 +02:00
Thad Guidry
d8211c7ec7
console: add note about typing exit to exit (#23602)
* add explicit note about typing exit in console

* Add note about typing exit as alternative
2021-09-21 11:19:46 +03:00
Péter Szilágyi
b1a5e4afdd
Merge pull request #23610 from karalabe/gomod-tify
go.mod: fix module file to prevent go from updating it during build
2021-09-20 19:13:37 +03:00
Péter Szilágyi
5b246af54e
go.mod: fix module file to prevent go from updating it during build 2021-09-20 19:12:20 +03:00
Péter Szilágyi
86f3625455
Merge pull request #23609 from karalabe/regex-fix
internal/debug: make gosimple linter happy
2021-09-20 19:01:32 +03:00
Péter Szilágyi
9bf495bfc9
internal/debug: make gosimple linter happy 2021-09-20 18:55:35 +03:00
Péter Szilágyi
e28f713ada
internal: support optional filter expression for debug.stacks (#23605)
* internal: support optional filter expression for debug.stacks

* internal/debug: fix string regexp

* internal/debug: support searching for line numbers too
2021-09-20 16:29:07 +03:00
Pete
62e3b83af6
docs: fix spelling on 2021-08-22 postmortem (#23595)
Spelling update
2021-09-20 13:33:15 +02:00
Martin Holst Swende
1b34283810
ethclient, accounts/keystore: fix flaky tests (#23599)
* ethclient/gethclient: fix flaky test (due to map key ordering)

* accounts/keystore: fix test failing due to rand collision due to low time resolution on windows
2021-09-20 10:23:44 +02:00
Sina Mahmoodi
401354976b
core,eth: call frame tracing (#23087)
This change introduces 2 new optional methods; `enter()` and `exit()` for js tracers, and makes `step()` optiona. The two new methods are invoked when entering and exiting a call frame (but not invoked for the outermost scope, which has it's own methods). Currently these are the data fields passed to each of them:

    enter: type (opcode), from, to, input, gas, value
    exit: output, gasUsed, error

The PR also comes with a re-write of the callTracer. As a backup we keep the previous tracing script under the name `callTracerLegacy`. Behaviour of both tracers are equivalent for the most part, although there are some small differences (improvements), where the new tracer is more correct / has more information.
2021-09-17 09:31:22 +02:00
Martin Holst Swende
7ada89d4e6
eth/tracers: abort evm execution when trace is aborted (#23580) 2021-09-16 13:45:16 +02:00
Marius van der Wijden
84ff152de5
cmd/devp2p/internal/ethtest: only use eth66 if eth66 is negotiated (#23568)
* cmd/devp2p/internal/ethtest: only use eth66 if eth66 is negotiated

* cmd/devp2p/internal/ethtest: switch on concrete type not pointer

* cmd/devp2p/internal/ethtest: switch on concrete type not pointer
2021-09-15 10:52:48 +02:00
Marius van der Wijden
b8d7c662cd
core, rpc: disable memory output by default in traces (#23558)
* core: cmd: invert disableMemory

* core: fix missed inversion

* cmd/evm: preserve Flags but change default value

* Apply suggestions from code review

Co-authored-by: Martin Holst Swende <martin@swende.se>

Co-authored-by: Martin Holst Swende <martin@swende.se>
2021-09-13 18:59:52 +02:00
Martin Holst Swende
babe9b993e
cmd/evm: transaction validation tool (#23494)
* cmd/evm: transaction validation tool

* cmd/evm: add hash to t9n tool

* cmd/evm: lint nits

* cmd/evm: nitpicks
2021-09-13 13:57:40 +02:00
Jonathan Verhees
578bc8164d
README: add londonBlock to example genesis config (#23565)
Updated example genesis.json configuration section, added londonBlock within config.
2021-09-13 13:34:00 +03:00
Péter Szilágyi
9ada4a2e2c
Merge pull request #23561 from karalabe/temp-split-leseh
les: duplicate downloader and fetcher to allow progressive refactoring
2021-09-10 16:05:06 +03:00
Péter Szilágyi
9e17648d8c
les: duplicate downloader and fetcher to allow progressive refactoring 2021-09-10 11:11:59 +03:00
Felix Lange
90987db733
appveyor.yml: add linux/amd64 build job (#23548) 2021-09-08 14:21:59 +02:00
Felix Lange
5c1fc3bf54
core: 64bit alignment of testBlockChain.gasLimit (#23543)
This fixes crashes in txpool tests on 32bit platforms.
2021-09-07 18:54:15 +03:00
Felix Lange
51ed39c093
core: make txPricedList.stales the first field for 64bit alignment (#23542)
This fixes crashes on 32bit builds.
2021-09-07 17:15:11 +03:00
Péter Szilágyi
6ef3a16869
p2p/enode: use unix timestamp as base ENR sequence number (#19903)
This PR ensures that wiping all data associated with a node (apart from its nodekey)
will not generate already used sequence number for the ENRs, since all remote nodes
would reject them until they out-number the previously published largest one.

The big complication with this scheme is that every local update to the ENR can
potentially bump the sequence number by one. In order to ensure that local updates
do not outrun the clock, the sequence number is a millisecond-precision timestamp,
and updates are throttled to occur at most once per millisecond.

Co-authored-by: Felix Lange <fjl@twurst.com>
2021-09-07 12:36:48 +02:00
Martin Holst Swende
794c6133ef
core/rawdb: freezer batch write (#23462)
This change is a rewrite of the freezer code.

When writing ancient chain data to the freezer, the previous version first encoded each
individual item to a temporary buffer, then wrote the buffer. For small item sizes (for
example, in the block hash freezer table), this strategy causes a lot of system calls for
writing tiny chunks of data. It also allocated a lot of temporary []byte buffers.

In the new version, we instead encode multiple items into a re-useable batch buffer, which
is then written to the file all at once. This avoids performing a system call for every
inserted item.

To make the internal batching work, the ancient database API had to be changed. While
integrating this new API in BlockChain.InsertReceiptChain, additional optimizations were
also added there.

Co-authored-by: Felix Lange <fjl@twurst.com>
2021-09-07 12:31:17 +02:00
Zachinquarantine
9a0df80bbc
cmd/geth, cmd/utils: remove legacy rpc flags (#23358)
* remove rpc flags

* remove legacy rpc flags

* remove legacy rpc flags

* remove legacy rpc commands

* (hopefully) fix most of the build errors

* fix build errors

https://app.travis-ci.com/github/ethereum/go-ethereum/jobs/530318686

* cmd/utils: fix syntax error

* empty commit to unbreak travis ci

* fix syntax error

* syntax fixes

* syntax fixes

* fix

fixes "cmd/geth/usage.go:234:7: expected '(', found init (typecheck)"

* fix

* various fixes in usage.go

* various fixes in flags.go

* adds extra space

reverts the spacing to how it was before I resolved the merge conflict

* more fixes in usage.go

* fix

fix for cmd/geth/usage.go:243:17: expected operand, found ':=' (typecheck) in travis

* Update cmd/utils/flags.go

Co-authored-by: Martin Holst Swende <martin@swende.se>

* fix error

 fixes these errors:
cmd/utils/flags_legacy.go:21:2: "strings" imported but not used (typecheck)

	"strings"

	^

cmd/utils/flags_legacy.go:24:2: "github.com/ethereum/go-ethereum/node" imported but not used (typecheck)

	"github.com/ethereum/go-ethereum/node"

	^

* goimports

Co-authored-by: Martin Holst Swende <martin@swende.se>
2021-09-07 10:52:58 +02:00
Zachinquarantine
ca5bc676d1
internal/debug: remove deprecated flags (#23368)
* internal/debug: remove deprecated flags

The removed flags are removed in the main portion of geth, this removes it internally too.

* internal/debug: remove legacy --debug and legacy --backtrace flag

* Update flags.go

Co-authored-by: Martin Holst Swende <martin@swende.se>
2021-09-07 10:51:33 +02:00
Martin Holst Swende
7957530225
docs: add post-mortem (#23518)
* docs: add post-mortem

* Update docs/postmortems/2021-08-22-split-postmortem.md

Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>

* Update docs/postmortems/2021-08-22-split-postmortem.md

Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>

* Update docs/postmortems/2021-08-22-split-postmortem.md

Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>

* Update docs/postmortems/2021-08-22-split-postmortem.md

* Update 2021-08-22-split-postmortem.md

* Update docs/postmortems/2021-08-22-split-postmortem.md

Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>

Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
2021-09-07 09:22:40 +02:00
aaronbuchwald
de2c44ab5c
trie: add missing copyright header (#23530)
* Add missing copyright header

* Update stacktrie_test.go

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2021-09-07 07:25:54 +03:00
Martin Holst Swende
4d88974864
cmd/evm: add tests for evm t8n (#23507) 2021-09-02 09:22:43 +02:00
Marius van der Wijden
067084feda
core: fix race conditions in txpool (#23474)
* core: fix race conditions in txpool

* core: fixed races in the txpool

* core: rebased on master

* core: move reheap mutex

* core: renamed mutex

* core: revert Reheap changes
2021-08-31 10:33:39 +02:00
Alexander Yastrebov
d019e90162
common: fixes format verb (#23495) 2021-08-31 10:22:20 +02:00
Ikko Ashimine
31be5d41d9
core: fix typo in iterator.go (#23502)
strorage -> storage
2021-08-31 10:21:42 +02:00
Fredrik Svantes
f85cf722ff
docs: add links to more audits in SECURITY.md (#23482) 2021-08-31 09:02:04 +02:00
Paweł Bylica
3258211f68
core/vm: rework jumpdest analysis benchmarks (#23499)
* core/vm: rework jumpdest analysis benchmarks

For BenchmarkJumpdestOpAnalysis use fixed code size of ~1.2MB
and classic benchmark loop.

* core/vm: clear bitvec in jumpdest analysis benchmark
2021-08-30 14:13:06 +02:00
lightclient
ffae2043f0
internal/ethapi: support both input and data for personal_sendTransaction (#23476)
Currently, setDefaults overwrites the transaction input value if only input is provided. This causes personal_sendTransaction to estimate the gas based on a transaction with empty data. eth_estimateGas never calls setDefaults so it was unaffected by this.
2021-08-27 14:11:15 +02:00
Martin Holst Swende
62ad17fb00
Revert "eth, internal/ethapi: make RPC block miner field show block sealer correctly (#23312)" (#23466)
This reverts commit 57feabea66.
2021-08-26 08:35:37 +02:00
Sina Mahmoodi
108eec3fee
node: remove dependency on wallet backend packages (#23019)
* accounts: new AddBackends method in manager

* node,cmd/geth: mv accman backend init to cmd/geth

* node,cmd/geth: mv scrypt config downstreawm from node

* accounts: use static buffer size for accman sub chan

minor fix

* accounts,cmd/geth: update accman backends through its event loop

* accounts,node: add comments

* accounts: un-export newBackendEvent

* accounts: use chan instead of wg in newBlockEvent

* node: rename isKeyDirEphem

* accounts,cmd: AddBackends->AddBackend

* accounts: fix potential blocking when adding backend
2021-08-25 22:34:22 +02:00
Felix Lange
d584e39862
build: stop publishing deb packages for Ubuntu 20.10 Groovy Gorilla (#23470)
Support for this Ubuntu release has ended on July 22 2021 and
Launchpad no longer accepts uploads for it.
2021-08-25 21:57:31 +02:00
Dmitry Zenovich
7c4cad064c
rpc: add BlockNumber.MarshalText (#23324)
Currently rpc.BlockNumber is marshalled to JSON as a numeric value, which is
wrong because BlockNumber.UnmarshalJSON() wants it to either be hex-encoded
or string "earliest"/"latest"/"pending". As a result, the call chain

    rpc.BlockNumberOrHashWithNumber(123) -> json.Marshal() -> json.Unmarshal()

fails with error "cannot unmarshal object into Go value of type string".
2021-08-25 19:30:29 +02:00
baptiste-b-pegasys
154b525ce8
cmd/devp2p/internal/ethtest: remove WriteTo method (#23379)
WriteTo is unused, and go vet warns about it because it
doesn't match the usual signature of the io.WriterTo method.
2021-08-25 19:06:42 +02:00
Felix Lange
32c576bd3c
rlp: minor optimizations for slice/array encoding (#23467)
As per benchmark results below, these changes speed up encoding/decoding of
consensus objects a bit.

    name                             old time/op    new time/op    delta
    EncodeRLP/legacy-header-8           384ns ± 1%     331ns ± 3%  -13.83%  (p=0.000 n=7+8)
    EncodeRLP/london-header-8           411ns ± 1%     359ns ± 2%  -12.53%  (p=0.000 n=8+8)
    EncodeRLP/receipt-for-storage-8     251ns ± 0%     239ns ± 0%   -4.97%  (p=0.000 n=8+8)
    EncodeRLP/receipt-full-8            319ns ± 0%     300ns ± 0%   -5.89%  (p=0.000 n=8+7)
    EncodeRLP/legacy-transaction-8      389ns ± 1%     387ns ± 1%     ~     (p=0.099 n=8+8)
    EncodeRLP/access-transaction-8      607ns ± 0%     581ns ± 0%   -4.26%  (p=0.000 n=8+8)
    EncodeRLP/1559-transaction-8        627ns ± 0%     606ns ± 1%   -3.44%  (p=0.000 n=8+8)
    DecodeRLP/legacy-header-8           831ns ± 1%     813ns ± 1%   -2.20%  (p=0.000 n=8+8)
    DecodeRLP/london-header-8           824ns ± 0%     804ns ± 1%   -2.44%  (p=0.000 n=8+7)

* rlp: pass length to byteArrayBytes

This makes it possible to inline byteArrayBytes. For arrays, the length is known
at encoder construction time, so the call to v.Len() can be avoided.

* rlp: avoid IsNil for pointer encoding

It's actually cheaper to use Elem first, because it performs less checks
on the value. If the pointer was nil, the result of Elem is 'invalid'.

* rlp: minor optimizations for slice/array encoding

For empty slices/arrays, we can avoid storing a list header entry in the
encoder buffer. Also avoid doing the tail check at encoding time because
it is already known at encoder construction time.
2021-08-25 19:01:10 +02:00
Felix Lange
8a134014b4
all: add go:build lines (#23468)
Generated by go1.17 fmt ./...
2021-08-25 18:46:29 +02:00
Guillaume Ballet
887902ea4d
crypto/cloudflare/bn256: fix in-place addition and unmarshalling (#23419) 2021-08-25 17:33:09 +02:00
Felix Lange
d16214228f
Dockerfile: upgrade to Go 1.17 (#23465) 2021-08-25 15:18:31 +02:00