Commit graph

14310 commits

Author SHA1 Message Date
jwasinger
7818ec3799 cmd/geth: implement dev mode for post-merge (#27327)
This change adds back the 'geth --dev' mode of operation, using a cl-mocker. 

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
Co-authored-by: lightclient <14004106+lightclient@users.noreply.github.com>
2023-11-10 11:09:46 -06:00
John Chase
2a99cd8fd0 signer/core: show helptext when clef rejects signing (#27538)
Co-authored-by: Martin Holst Swende <martin@swende.se>
2023-11-10 11:09:46 -06:00
Darioush Jalali
625e847b5b core: stop chain when tests are finished (#27660)
core (blockchain_test): add chain.Stop() to tests
2023-11-10 11:09:46 -06:00
Exca-DK
a50eaa85c6 ethdb/leveldb: update leveldb metrics collection (#27643)
This removes text parsing in leveldb metrics collection code. All metrics
can now be accessed through the stats API provided by leveldb.

We also add new gauge-typed metrics that count the number of tables at each level.

---------

Co-authored-by: Exca-DK <Exca-DK@users.noreply.github.com>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
2023-11-10 11:09:46 -06:00
rjl493456442
2c0c010df5 cmd, core, eth, graphql, trie: no persisted clean trie cache file (#27525)
The clean trie cache is persisted periodically, therefore Geth can
quickly warmup the cache in next restart.

However it will reduce the robustness of system. The assumption is
held in Geth that if the parent trie node is present, then the entire
sub-trie associated with the parent are all prensent.

Imagine the scenario that Geth rewinds itself to a past block and
restart, but Geth finds the root node of "future state" in clean
cache then regard this state is present in disk, while is not in fact.

Another example is offline pruning tool. Whenever an offline pruning
is performed, the clean cache file has to be removed to aviod hitting
the root node of "deleted states" in clean cache.

All in all, compare with the minor performance gain, system robustness
is something we care more.
2023-11-10 11:09:46 -06:00
Curith
ebfb635126 node: fix listening on IPv6 address (#27628) (#27635) 2023-11-10 11:09:46 -06:00
Guillaume Ballet
bbee22809d core/state, light, les: make signature of ContractCode hash-independent (#27209)
* core/state, light, les: make signature of ContractCode hash-independent

* push current state for feedback

* les: fix unit test

* core, les, light: fix les unittests

* core/state, trie, les, light: fix state iterator

* core, les: address comments

* les: fix lint

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2023-11-10 11:09:46 -06:00
Guillaume Ballet
59c73c0b23 params, trie: add verkle fork management + upgrade go-verkle (#27464)
* params, trie: add verkle fork management + upgrade go-verkle

* remove the two verkle files

* core, eth, params: add missing function

* Gary's feedback

* remove trie/utils/verkle.go

* add verkle block override

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2023-11-10 11:09:46 -06:00
Marius van der Wijden
60f192793e eth: send big transactions by announce/retrieve only (#27618)
* eth: send big transactions by announce/retrieve only

* Update eth/handler.go

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

* eth: remove superfluous bracket

* eth: add whitespace

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
2023-11-10 11:09:46 -06:00
hero5512
585ea7ea34 core/txpool/legacypool: fix typo (#27620) 2023-11-10 11:09:46 -06:00
Guillaume Ballet
fd024dc846 trie, core/state: revert error removal in (*state.Trie).Commit (#27544)
* trie, core/state: revert error removal in (*state.Trie).Commit

* Gary's nitpick :)

Co-Authored-By:  rjl493456442 <garyrong0905@gmail.com>

---------

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2023-11-10 11:09:46 -06:00
aaronbuchwald
d6e108dc67 core: log message if DeriveFields returns error (#27530)
This error will never happen, but if it ever does happen, we will at least see it.
2023-11-10 11:09:46 -06:00
Sanghee Choi
1fb3aa642e common/lru: add test case for BasicLRU.Peek (#27559) 2023-11-10 11:09:46 -06:00
Marius van der Wijden
81806c217c core/vm: move TSTORE,TLOAD to correct opcode nums (#27613)
* core/vm: move TSTORE,TLOAD to correct opcode nums

* core/vm: cleanup
2023-11-10 11:09:46 -06:00
rjl493456442
e1e0b1c2e3 ethdb/pebble: use sync mode for pebble writes (#27615) 2023-11-10 11:09:46 -06:00
puhtaytow
42c754046b cmd/geth: error message should not be capitalised (#27549)
error message should not be capitalized / consistency
2023-11-10 11:09:46 -06:00
Delweng
e2e76de852 eth/protocols: put protocols in order (#27543)
Signed-off-by: jsvisa <delweng@gmail.com>
2023-11-10 11:09:46 -06:00
Sanghee Choi
00e87a7fdf common/math: fix typo in comment (#27561) 2023-11-10 11:09:46 -06:00
Francisco de Borja Aranda Castillejo
7513a76e80 crypto/secp256k1: define NDEBUG only if not defined (#27550) 2023-11-10 11:09:46 -06:00
Guillaume Ballet
7e3ba8b727 core/state, light, trie: add UpdateContractCode to the Trie interface (#27476)
Verkle trees store the code inside the trie. This PR changes the interface to pass the code, as well as the dirty flag to tell the trie package if the code is dirty and needs to be updated. This is a no-op for the MPT and the odr trie.
2023-11-10 11:09:46 -06:00
Exca-DK
66d41a44f8 p2p/discover: swap verification order in discv4 ping handler (#27532)
In all other UDPv4 methods, the deadline is checked first. It seems weird to me that ping is an exception. Deadline comparison is also less resource intensive.

Co-authored-by: Exca-DK <Exca-DK@users.noreply.github.com>
2023-11-10 11:09:46 -06:00
James Prestwich
ff8659c6aa internal/ethapi: quantity-encode storage keys in eth_getProof response (#27309)
This changes the eth_getProof method implementation to re-encode the requested
storage keys, canonicalizing them in the response. For backwards-compatibility reasons,
go-ethereum accepts non-canonical hex keys. Accepting them is fine, but we should
not mirror invalid inputs into the output.

Closes #27306

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Felix Lange <fjl@twurst.com>
2023-11-10 11:09:46 -06:00
Martin Holst Swende
c42afc41c9 ethdb/pebble: fsync for batch writes (#27522)
This is likely the culprit behind several data corruption issues, e.g. where data has been
written to the freezer, but the deletion from pebble does not go through due to process
crash.
2023-11-10 11:09:46 -06:00
rjl493456442
fc0431059f cmd, core/state, eth, tests, trie: improve state reader (#27428)
The state availability is checked during the creation of a state reader.

-    In hash-based database, if the specified root node does not exist on disk disk, then
    the state reader won't be created and an error will be returned.

-    In path-based database, if the specified state layer is not available, then the
    state reader won't be created and an error will be returned.

This change also contains a stricter semantics regarding the `Commit` operation: once it has been performed, the trie is no longer usable, and certain operations will return an error.
2023-11-10 11:09:46 -06:00
jwasinger
7394908df1 internal/ethapi: use same state for each invocation within EstimateGas (#27505)
EstimateGas repeatedly executes a transaction, performing a binary search with multiple gas prices to determine proper pricing. Each call retrieves a new copy of the state (https://github.com/ethereum/go-ethereum/blob/master/internal/ethapi/api.go#L1017) . Because the pending/latest state can change during the execution of EstimateGas, this can potentially cause strange behavior (as noted here: https://github.com/ethereum/go-ethereum/pull/27502#issue-1761957009).

This PR modifies EstimateGas to retrieve the state once and use a copy of it for every call invocation it does.
2023-11-10 11:09:46 -06:00
Felix Lange
f4ea07641a core/txpool: remove use of errors.Join function (#27523)
his function was added in Go 1.20, but our compatibility target
is Go 1.19.
2023-11-10 11:09:46 -06:00
Dan Laine
d7a94d9832 core: use slices package for sorting (#27489)
Co-authored-by: Felix Lange <fjl@twurst.com>
2023-11-10 11:09:46 -06:00
Delweng
5bed0f5183 internal/build: ignore some files in FindMainPackages (#27521) 2023-11-10 11:09:46 -06:00
Dan Laine
53e07ce2e6 eth: use slices package for sorting (#27490)
Also adds Hash.Less method for sorting purposes.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2023-11-10 11:09:46 -06:00
hero5512
8a351f6e70 core/txpool/legacypool: narrow down the scope of the variable (#27471)
Variables discarded, included can be defined closer to their usage.

Co-authored-by: Martin Holst Swende <martin@swende.se>
2023-11-10 11:09:46 -06:00
rjl493456442
cee45268f8 trie: remove parameter 'fromLevel' in Prove (#27512)
This removes the feature where top nodes of the proof can be elided.
It was intended to be used by the LES server, to save bandwidth 
when the client had already fetched parts of the state and only needed
some extra nodes to complete the proof. Alas, it never got implemented
in the client.
2023-11-10 11:09:46 -06:00
Marius van der Wijden
143c5214c9 go.mod: update kzg libraries to use big-endian (#27510)
* go.mod: update kzg libraries to use big-endian

* go.sum: ran go mod tidy

* core/testdata/precompiles: fix blob verification test

* core/testdata/precompiles: fix blob verification test
2023-11-10 11:09:46 -06:00
Dan Laine
ad4c89228c tests, trie: use slices package for sorting (#27496)
Co-authored-by: Felix Lange <fjl@twurst.com>
2023-11-10 11:09:46 -06:00
Dan Laine
051b1a1fd9 internal/ethapi, les: use slices package for sorting (#27492)
Co-authored-by: Felix Lange <fjl@twurst.com>
2023-11-10 11:09:46 -06:00
Dan Laine
cd00ee32ba consensus/clique: use slices package for sorting (#27488)
Also adds Address.Less for sorting use in other packages.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2023-11-10 11:09:46 -06:00
Dan Laine
e39f48953a metrics: use slices package for sorting (#27493)
Co-authored-by: Felix Lange <fjl@twurst.com>
2023-11-10 11:09:46 -06:00
Sanghee Choi
1b46eaa4bc consensus/clique: fix typo in comment (#27503) 2023-11-10 11:09:46 -06:00
John Chase
d27401046d cmd/evm: fix typos in documentation (#27501) 2023-11-10 11:09:46 -06:00
Dan Laine
90b87be3c1 cmd/devp2p: use slices package for sorting (#27487) 2023-11-10 11:09:46 -06:00
Dan Laine
8f278728b1 accounts/keystore: use slices package for sorting (#27485)
Co-authored-by: Felix Lange <fjl@twurst.com>
2023-11-10 11:09:46 -06:00
Koichi Shiraishi
63eb2e901c rpc: avoid use of cgo by hard-coding maxPathSize (#27447)
Package rpc uses cgo to find the maximum UNIX domain socket path 
length. If exceeded, a warning is printed. This is the only use of cgo in this
package. It seems excessive to depend on cgo just for this warning, so
we now hard-code the usual limit for Linux instead.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2023-11-10 11:09:46 -06:00
Martin Holst Swende
e9686cee73 core/txpool/legacypool: handle missing head in reset (#27479)
Fixes #27301, a crash that could occur during txpool reorg handling.
2023-11-10 11:09:46 -06:00
hero5512
d97bfa6e6c core/txpool/legacypool: remove redundant check for floatingRatio == 0 (#27477)
floatingRatio is a constant and always non-zero. So there is no need to
check for == 0.
2023-11-10 11:09:46 -06:00
John Chase
082ff5369b internal/jsre/deps: fix typos in web3.js (#27500) 2023-11-10 11:09:46 -06:00
Dan Laine
42aebf3965 ethdb/dbtest: use slices package for sorting (#27491) 2023-11-10 11:09:46 -06:00
Dan Laine
9bcadfbf2f p2p: use slices package for sorting (#27494)
Co-authored-by: Felix Lange <fjl@twurst.com>
2023-11-10 11:09:46 -06:00
jin
0a44648415 core/txpool/legacypool: reheap the tx list if london fork not enabled (#27481)
This change ensures Reheap will be called even before the London fork activates.
Since Reheap would otherwise only be called through `SetBaseFee` after London,
the list would just keep growing if the fork was not enabled or not reached yet.
2023-11-10 11:09:46 -06:00
Dan Laine
3ecc4c4b2d build: use slices package for sorting (#27486) 2023-11-10 11:09:46 -06:00
Péter Szilágyi
3c12101056 all: move main transaction pool into a subpool (#27463)
* all: move main transaction pool into a subpool

* go.mod: remove superfluous updates

* core/txpool: review fixes, handle txs rejected by all subpools

* core/txpool: typos
2023-11-10 11:09:46 -06:00
John Chase
f0672a7df0 rlp: fix typos (#27484)
fix typos

Co-authored-by: john <yejiarui@123.com>
2023-11-10 11:09:46 -06:00