Commit Graph

15199 Commits

Author SHA1 Message Date
SuiYuan
2262bf3415
crypto/secp256k1: change receiver variable name to lowercase (#29889) 2024-05-30 16:24:16 +02:00
SuiYuan
e015c1116f
ethdb: remove unnecessary function wrapper (#29888) 2024-05-30 21:23:04 +08:00
Felix Lange
6bb13e8e2b
eth/catalyst: ensure TxPool is synced in Fork (#29876)
This should fix an occasional test failure in ethclient/simulated.TestForkResendTx.
Inspection of logs revealed the cause of the failure to be that the txpool was not done
reorganizing by the time Fork is called.
2024-05-29 15:56:52 +02:00
hattizai
2f06c1e854
cmd/devp2p: fix node.TCP -> node.UDP (#29879) 2024-05-29 15:55:51 +02:00
Felix Lange
3fef53447f
build: upgrade to golangci-lint v1.59.0 (#29875) 2024-05-29 16:31:27 +03:00
Felix Lange
94a8b296e4
p2p/discover: refactor node and endpoint representation (#29844)
Here we clean up internal uses of type discover.node, converting most code to use
enode.Node instead. The discover.node type used to be the canonical representation of
network hosts before ENR was introduced. Most code worked with *node to avoid conversions
when interacting with Table methods. Since *node also contains internal state of Table and
is a mutable type, using *node outside of Table code is prone to data races. It's also
cleaner not having to wrap/unwrap *enode.Node all the time.

discover.node has been renamed to tableNode to clarify its purpose.

While here, we also change most uses of net.UDPAddr into netip.AddrPort. While this is
technically a separate refactoring from the *node -> *enode.Node change, it is more
convenient because *enode.Node handles IP addresses as netip.Addr. The switch to package
netip in discovery would've happened very soon anyway.

The change to netip.AddrPort stops at certain interface points. For example, since package
p2p/netutil has not been converted to use netip.Addr yet, we still have to convert to
net.IP/net.UDPAddr in a few places.
2024-05-29 15:02:26 +02:00
牛晓婕
e26fa9e40e
core/state: fix typo in comment (#29639) 2024-05-29 14:44:14 +02:00
trillo
2f0e63e5ac
eth/downloader, eth/tracer: fix typos in comments (#29707) 2024-05-29 14:43:07 +02:00
PolyMa
06263b1b35
all: fix typos in comments (#29873)
fix using `a` & `the` simutaneously
2024-05-29 12:24:10 +02:00
Steven Wang
b8cf1636d4
accounts: fix TestUpdateKeyfileContents (#29867)
Create the directory before NewKeyStore. This ensures the watcher successfully starts on
the first attempt, and waitWatcherStart functions as intended.
2024-05-29 12:12:57 +02:00
lilasxie
153f8da887
p2p/nodestate: remove unused package (#29872) 2024-05-29 12:11:18 +02:00
bugmaker9371
daf4f72077
p2p/simulations: remove stale information about docker adapter (#29874) 2024-05-29 12:09:58 +02:00
Martin HS
5534c849b6
go.mod: update a number of dependencies (#29763)
* deps: update go-winio

* deps: update fastcache

* deps: update golang-set

* update fatih/color

* update natefinch/lumberjack.v2
2024-05-29 11:30:25 +03:00
lightclient
cc22e0cdf0
p2p/discover: fix update logic in handleAddNode (#29836)
It seems the semantic differences between addFoundNode and addInboundNode were lost in
#29572. My understanding is addFoundNode is for a node you have not contacted directly
(and are unsure if is available) whereas addInboundNode is for adding nodes that have
contacted the local node and we can verify they are active.

handleAddNode seems to be the consolidation of those two methods, yet it bumps the node in
the bucket (updating it's IP addr) even if the node was not an inbound. This PR fixes
this. It wasn't originally caught in tests like TestTable_addSeenNode because the
manipulation of the node object actually modified the node value used by the test.

New logic is added to reject non-inbound updates unless the sequence number of the
(signed) ENR increases. Inbound updates, which are published by the updated node itself,
are always accepted. If an inbound update changes the endpoint, the node will be
revalidated on an expedited schedule.

Co-authored-by: Felix Lange <fjl@twurst.com>
2024-05-28 21:30:17 +02:00
jwasinger
171430c3f5
core/state: remove unused error from prefetcher trie method (#29768)
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
2024-05-28 19:54:55 +02:00
jwasinger
e517183719
eth, eth/downloader: remove references to LightChain, LightSync (#29711)
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2024-05-28 19:52:08 +02:00
Felix Lange
af0a3274be
p2p/discover: fix crash when revalidated node is removed (#29864)
In #29572, I assumed the revalidation list that the node is contained in could only ever
be changed by the outcome of a revalidation request. But turns out that's not true: if the
node gets removed due to FINDNODE failure, it will also be removed from the list it is in.
This causes a crash.

The invariant is: while node is in table, it is always in exactly one of the two lists. So
it seems best to store a pointer to the current list within the node itself.
2024-05-28 18:13:03 +02:00
rjl493456442
b88051ec83
core/rawdb, triedb/pathdb: fix freezer read-only option (#29823) 2024-05-28 14:41:11 +02:00
Martin HS
61932e4710
cmd/geth: update testdata (vulncheck) (#29714) 2024-05-28 14:16:45 +02:00
gitglorythegreat
871e55d93e
core/state: fix typos in comments (#29767) 2024-05-28 14:10:27 +02:00
Martin HS
42471d7a3e
core/vm/runtime: set random to enable merge-opcodes (#29799) 2024-05-28 13:45:16 +02:00
trillo
caafa93598
all: improve some error strings (#29842) 2024-05-28 13:44:40 +02:00
Sina M
ea6c16007c
eth/tracers: clear error for non-reverting pre-homestead fail (#29824) 2024-05-28 13:12:46 +02:00
rjl493456442
513276864b
eth/downloader: fix flaky test (#29852)
This pull request fixes the flay test TestSkeletonSyncRetrievals. In this test, we first
trigger a sync cycle and wait for it to meet certain expectations. We then inject a new
head and potentially also a new peer, then perform another final sync. The test now
performs the newPeer addition before launching the final sync, and waits a bit for that
peer to get registered. This fixes the logic race that made the test fail sometimes.

Co-authored-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
2024-05-27 16:26:55 +02:00
Steven Wang
1a4e4a4fe1
miner: fix TestBuildPayload sporadic failure (#29853)
miner: fix TestBuildPayload sporadic failure

Co-authored-by: steven <steven@stevendeMacBook-Pro.local>
2024-05-27 19:42:07 +08:00
Mobin Mohanan
7224576fba
core, eth/protocols/snap, internal/ethapi: remove redundant types (#29841) 2024-05-27 14:39:39 +08:00
Wukingbow
7f5cc02a99
metrics: fix function comment (#29843) 2024-05-27 14:34:53 +08:00
winterjihwan
d1d9f34e51
core/types: clarify set inclusion in comments (#29839) 2024-05-26 11:54:37 +02:00
levisyin
b6474e9f90
metrics: add test for SampleSnapshot.Sum (#29831) 2024-05-24 11:34:30 +02:00
gitglorythegreat
64b1cd8aaf
p2p: fix typos (#29828) 2024-05-24 11:33:19 +02:00
Halimao
08fe6a8614
metrics: fix flaky testTestExpDecaySampleNanosecondRegression (#29832) 2024-05-24 15:20:05 +08:00
Aaron Chen
61b3d93bb0
p2p/enode: fix TCPEndpoint (#29827) 2024-05-23 23:17:51 +02:00
Felix Lange
cc9e2bd9dd
p2p/enode: fix endpoint determination for IPv6 (#29801)
enode.Node has separate accessor functions for getting the IP, UDP port and TCP port.
These methods performed separate checks for attributes set in the ENR.

With this PR, the accessor methods will now return cached information, and the endpoint is
determined when the node is created. The logic to determine the preferred endpoint is now
more correct, and considers how 'global' each address is when both IPv4 and IPv6 addresses
are present in the ENR.
2024-05-23 14:27:03 +02:00
Felix Lange
6a9158bb1b
p2p/discover: improved node revalidation (#29572)
Node discovery periodically revalidates the nodes in its table by sending PING, checking
if they are still alive. I recently noticed some issues with the implementation of this
process, which can cause strange results such as nodes dropping unexpectedly, certain
nodes not getting revalidated often enough, and bad results being returned to incoming
FINDNODE queries.

In this change, the revalidation process is improved with the following logic:

- We maintain two 'revalidation lists' containing the table nodes, named 'fast' and 'slow'.
- The process chooses random nodes from each list on a randomized interval, the interval being
  faster for the 'fast' list, and performs revalidation for the chosen node.
- Whenever a node is newly inserted into the table, it goes into the 'fast' list.
  Once validation passes, it transfers to the 'slow' list. If a request fails, or the
  node changes endpoint, it transfers back into 'fast'.
- livenessChecks is incremented by one for successful checks. Unlike the old implementation,
  we will not drop the node on the first failing check. We instead quickly decay the
  livenessChecks give it another chance.
- Order of nodes in bucket doesn't matter anymore.

I am also adding a debug API endpoint to dump the node table content.

Co-authored-by: Martin HS <martin@swende.se>
2024-05-23 14:26:09 +02:00
Halimao
70bee977d6
metrics: fix out of range error message (#29821) 2024-05-23 12:34:34 +02:00
Mobin Mohanan
b779e469da
Makefile: add fmt, update help (#29777) 2024-05-23 11:56:32 +02:00
Sina M
fa581766f5
eth/tracers: fix json logger for evm blocktest (#29795) 2024-05-23 10:55:54 +02:00
Karl Bartel
0d4cdb3dbe
internal/ethapi: fix typos (#29784)
Fix typos in api.go
2024-05-23 10:41:51 +02:00
Martin HS
7fd7c1f7dd
eth/tracers: fix basefee context for traceBlock (#29811)
This fixes an issue for `debug_traceBlock*` methods where the BASEFEE opcode was returning always 0. This caused the method return invalid results.

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2024-05-21 18:27:36 +02:00
cocoyeal
be5df74ed5
trie: update the valid function comments (#29809) 2024-05-21 19:53:34 +08:00
rjl493456442
473ee8fc07
trie, eth/protocols/snap: sanitize the committed node data (#29485) 2024-05-16 17:58:35 +08:00
zhiqiangxu
7ed52c949e
core: move balanceCheck addition in buyGas (#29762)
It's a bit confusing to add msg.value into the balanceCheck within the conditional.
No impact on block validation since GasFeeCap is always set when processing transactions.
2024-05-15 14:23:24 +02:00
cario-dev
d2f00cb54e
.github: upgrade to action versions with node20 (#29776)
* github: upgrade checkout action to version with node20

* Update go.yml

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2024-05-14 15:46:11 +02:00
0xbeny
8919c5c0fc
core: deploy EIP-4788 contract in dev mode genesis (#29655)
Co-authored-by: Felix Lange <fjl@twurst.com>
2024-05-14 15:04:32 +02:00
rjl493456442
be3284373f
core/state: remove useless operation (#29769) 2024-05-14 14:54:49 +02:00
rjl493456442
5b3e3cd2be
tests: update tests (#29730) 2024-05-13 21:34:29 +08:00
Péter Szilágyi
2ac83e197b
core/state: blocking prefetcher on term signal, parallel updates (#29519)
* core/state: trie prefetcher change: calling trie() doesn't stop the associated subfetcher

Co-authored-by: Martin HS <martin@swende.se>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>

* core/state: improve prefetcher

* core/state: restore async prefetcher stask scheduling

* core/state: finish prefetching async and process storage updates async

* core/state: don't use the prefetcher for missing snapshot items

* core/state: remove update concurrency for Verkle tries

* core/state: add some termination checks to prefetcher async shutdowns

* core/state: differentiate db tries and prefetched tries

* core/state: teh teh teh

---------

Co-authored-by: Jared Wasinger <j-wasinger@hotmail.com>
Co-authored-by: Martin HS <martin@swende.se>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2024-05-13 15:47:45 +03:00
Guillaume Ballet
44a50c9f96
cmd, core, params, trie: add verkle access witness gas charging (#29338)
Implements some of the changes required to charge and do gas accounting in verkle testnet.
2024-05-10 20:13:11 +02:00
Hteev Oli
47af69c2bc
core, beacon, ethdb: fix typos (#29748)
* core, beacon, ethdb: fix typos

* revert file that can't be changed
2024-05-10 19:48:14 +02:00
cocoyeal
603fd898d4
event: fix typo (#29749)
typo: of -> or
2024-05-10 19:44:07 +02:00