Commit graph

249 commits

Author SHA1 Message Date
Felix Lange
130470832f eth/protocols/eth: add comments in LogsSize 2026-03-19 11:43:08 +01:00
Felix Lange
59ca98ddbe eth/protocols/eth: remove ReceiptsRLPPacket70
Convert the handler to the style used by the eth/69 handler, where the
service* function returns a RawList.
2026-03-19 11:04:43 +01:00
Felix Lange
9d2b04de29 eth/protocols/eth: improving comments 2026-03-19 11:04:05 +01:00
healthykim
5bb2cf35ab remove receipt tests in peer_test.go 2026-03-19 03:10:51 +09:00
healthykim
155da48d55 add p.chainConfig != nil to fix test error 2026-03-19 02:46:00 +09:00
healthykim
65924d6884 remove tracker.fulfil from test 2026-03-19 02:45:09 +09:00
healthykim
9ba076e0b1 extract log size calculation to receipt.go 2026-03-19 02:40:14 +09:00
healthykim
7926650d0b pass block timestamp for fork aware validation 2026-03-19 02:26:29 +09:00
healthykim
bb449e5763 extract shared logic from handleReceipts 2026-03-19 02:00:03 +09:00
healthykim
5b72989dfd replace RWMutex with Mutex 2026-03-19 01:54:07 +09:00
healthykim
d7a26252b7 update comments 2026-03-19 01:50:13 +09:00
healthykim
9359a5f00f calculate exact log size, excluding rlp header 2026-03-05 23:13:56 +09:00
healthykim
53ce90d789 Merge branch 'master' into bs/eip7975-peer 2026-03-04 15:39:03 +09:00
Bosul Mun
723aae2b4e
eth/protocols/eth: drop protocol version eth/68 (#33511)
Some checks failed
/ Keeper Build (push) Has been cancelled
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
With this, we are dropping support for protocol version eth/68. The only supported
version is eth/69 now. The p2p receipt encoding logic can be simplified a lot, and
processing of receipts during sync gets a little faster because we now transform
the network encoding into the database encoding directly, without decoding the
receipts first.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2026-02-28 21:43:40 +01:00
healthykim
733892738c do not return error when there is no corresponding buffer entry 2026-02-27 15:54:53 +09:00
ANtutov
2a45272408
eth/protocols/eth: fix handshake timeout metrics classification (#33539)
Previously, handshake timeouts were recorded as generic peer errors
instead of timeout errors. waitForHandshake passed a raw
p2p.DiscReadTimeout into markError, but markError classified errors only
via errors.Unwrap(err), which returns nil for non-wrapped errors. As a
result, the timeoutError meter was never incremented and all such
failures fell into the peerError bucket.

This change makes markError switch on the base error, using
errors.Unwrap(err) when available and falling back to the original error
otherwise. With this adjustment, p2p.DiscReadTimeout is correctly mapped
to timeoutError, while existing behaviour for the other wrapped sentinel
errors remains unchanged

---------

Co-authored-by: lightclient <lightclient@protonmail.com>
2026-02-24 21:50:26 -07:00
healthykim
7609febf20 delete buffer when validation failed 2026-02-24 18:21:24 +09:00
healthykim
48da785c86 avoid decoding during validation 2026-02-24 18:19:04 +09:00
healthykim
be6aa56569 buffer gasUsed in receiptRequest 2026-02-24 17:34:46 +09:00
CPerezz
c2e1785a48
eth/protocols/snap: restore peers to idle pool on request revert (#33790)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
All five `revert*Request` functions (account, bytecode, storage,
trienode heal, bytecode heal) remove the request from the tracked set
but never restore the peer to its corresponding idle pool. When a
request times out and no response arrives, the peer is permanently lost
from the idle pool, preventing new work from being assigned to it.

In normal operation mode (snap-sync full state) this bug is masked by
pivot movement (which resets idle pools via new Sync() cycles every ~15
minutes) and peer churn (reconnections re-add peers via Register()).
However in scenarios like the one I have running my (partial-stateful
node)[https://github.com/ethereum/go-ethereum/pull/33764] with
long-running sync cycles and few peers, all peers can eventually leak
out of the idle pools, stalling sync entirely.

Fix: after deleting from the request map, restore the peer to its idle
pool if it is still registered (guards against the peer-drop path where
Unregister already removed the peer). This mirrors the pattern used in
all five On* response handlers.


This only seems to manifest in peer-thirstly scenarios as where I find
myself when testing snapsync for the partial-statefull node).
Still, thought was at least good to raise this point. Unsure if required
to discuss or not
2026-02-24 09:14:11 +08:00
healthykim
0f2e67e073 Merge branch 'master' into bs/eip7975-peer 2026-02-22 20:02:11 -07:00
Felix Lange
0cba803fba
eth/protocols/eth, eth/protocols/snap: delayed p2p message decoding (#33835)
Some checks failed
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
/ Keeper Build (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
This changes the p2p protocol handlers to delay message decoding. It's
the first part of a larger change that will delay decoding all the way
through message processing. For responses, we delay the decoding until
it is confirmed that the response matches an active request and does not
exceed its limits.

In order to make this work, all messages have been changed to use
rlp.RawList instead of a slice of the decoded item type. For block
bodies specifically, the decoding has been delayed all the way until
after verification of the response hash.

The role of p2p/tracker.Tracker changes significantly in this PR. The
Tracker's original purpose was to maintain metrics about requests and
responses in the peer-to-peer protocols. Each protocol maintained a
single global Tracker instance. As of this change, the Tracker is now
always active (regardless of metrics collection), and there is a
separate instance of it for each peer. Whenever a response arrives, it
is first verified that a request exists for it in the tracker. The
tracker is also the place where limits are kept.
2026-02-15 21:21:16 +08:00
Felix Lange
8e1de223ad
crypto/keccak: vendor in golang.org/x/crypto/sha3 (#33323)
The upstream libray has removed the assembly-based implementation of
keccak. We need to maintain our own library to avoid a peformance
regression.

---------

Co-authored-by: lightclient <lightclient@protonmail.com>
2026-02-03 14:55:27 -07:00
healthykim
afcbce9647 fix order of fields in GetReceipts/Receipts msg 2026-01-20 20:47:50 +09:00
Csaba Kiraly
710008450f
eth: txs fetch/send log at trace level only (#33541)
This logging was too intensive at debug level, it is better to have it
at trace level only.

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2026-01-07 09:52:50 +08:00
healthykim
abf7f7366e test: support ETH69 in suite test 2025-12-12 15:51:24 +09:00
Gary Rong
3e838dd1dd cmd, eth: fix typo 2025-12-09 14:25:37 +08:00
Gary Rong
f5c228576a eth/protocols/eth: prevent allocation if the response is complete 2025-12-09 13:58:38 +08:00
Gary Rong
fb1ce79543 eth/protocols/eth: remove useless checks in the eth protocol handler 2025-12-09 13:41:16 +08:00
Gary Rong
b2490e3f20 eth/protocols/eth: add lock protection 2025-12-09 13:19:20 +08:00
healthykim
74dd001911 fix: fix trimReceiptsRLP bug 2025-12-07 22:26:24 +09:00
healthykim
b35f62794f fix: fix dispatcher pending delete logic 2025-12-04 14:59:52 +09:00
healthykim
32de571acd fix: fix test error 2025-11-29 00:38:17 +09:00
healthykim
c961983210 chore: improve comments 2025-11-29 00:23:58 +09:00
healthykim
96891be7f9 fix: remove second validation 2025-11-29 00:05:46 +09:00
healthykim
52ede9739f fix: remove request buffer 2025-11-26 23:07:32 +09:00
healthykim
786f876959 fix: add logic for the buffer clean up 2025-11-26 16:37:06 +09:00
healthykim
22ab6697ac fix: fix validation logic and add tests 2025-11-26 16:21:53 +09:00
healthykim
6a0b36d86a chore: change the test name 2025-11-26 11:23:52 +09:00
healthykim
7d7ff429d2 fix: add reqeust id validation before the buffer allocation 2025-11-26 11:23:13 +09:00
healthykim
a62ec06a1d fix: remove partial sink 2025-11-23 17:59:03 -05:00
healthykim
1f32d8959a feat: clear buffers if the request is canceled 2025-11-14 22:33:48 +09:00
healthykim
bfc878ed36 chore: split validation and reconstruct logic 2025-11-13 23:22:39 +09:00
healthykim
65debe9317 fix: add tests and fix errors 2025-11-13 22:58:03 +09:00
healthykim
cf48bd57a5 chore: polish comments 2025-11-13 20:21:03 +09:00
healthykim
bf16cd59ec feat: add handleGetReceipts70 2025-11-12 00:39:38 +09:00
healthykim
429066f2d9 feat: add handleReceipts70 2025-11-08 17:28:43 +09:00
Delweng
40505a9bc0
eth/protocols/eth: reject message containing duplicated txs and drop peer (#32728)
Drop peer if sending the same transaction multiple times in a single message.

Fixes https://github.com/ethereum/go-ethereum/issues/32724


---------

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
Co-authored-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2025-10-15 10:24:48 +02:00
cui
ed264a1f19
eth/protocols/snap: optimize incHash (#32748) 2025-10-10 13:48:25 +08:00
Nicolas Gotchac
064ab701ea
eth/protocols/eth: use BlockChain interface in Handshake (#32847) 2025-10-08 12:50:03 +02:00