Commit graph

13421 commits

Author SHA1 Message Date
Daniel Liu
ca8d39b862
accounts/abi: improve unpack performance #31387 (#1415)
Slightly improves performance of abi.Unpack

```
Before
BenchmarkUnpack/0-14   5965714       210.9 ns/op     280 B/op       5 allocs/op
BenchmarkUnpack/1-14   2148283       569.7 ns/op     688 B/op      16 allocs/op

After:
BenchmarkUnpack/0-14  	 7693365	       151.2 ns/op	     136 B/op	       4 allocs/op
BenchmarkUnpack/1-14  	 2261294	       508.9 ns/op	     544 B/op	      15 allocs/op
```

replaces https://github.com/ethereum/go-ethereum/pull/31292 since I was
unable to push to your branch @Exca-DK

---------

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Exca-DK <dawidk.info@gmail.com>
2025-09-03 15:46:23 +08:00
Daniel Liu
47d17e1b97
accounts/usbwallet: fix ledger access for latest firmware and add Ledger Flex #31004 (#1414)
The latest firmware for Ledger Nano S Plus now returns `0x5000` for it's
product ID, which doesn't match any of the product IDs enumerated in
`hub.go`.

This PR removes the assumption about the interfaces exposed, and simply
checks the upper byte for a match.

Also adds support for the `0x0007` / `0x7000` product ID (Ledger Flex).

Co-authored-by: Michael de Hoog <michael.dehoog@coinbase.com>
2025-09-03 15:45:34 +08:00
Daniel Liu
2def2b955b
accounts: fix typo (#1413) 2025-09-03 15:44:49 +08:00
Daniel Liu
ce26c34c7b
rpc: refactor read limit test #32494 (#1412)
closes #32240 #32232

The main cause for the time out is the slow json encoding of large data.
In #32240 they tried to resolve the issue by reducing the size of the
test. However as Felix pointed out, the test is still kind of confusing.

I've refactored the test so it is more understandable and have reduced
the amount of data needed to be json encoded. I think it is still
important to ensure that the default read limit is not active, so I have
retained one large (~32 MB) test case, but it's at least smaller than
the existing ~64 MB test case.

Co-authored-by: lightclient <14004106+lightclient@users.noreply.github.com>
2025-09-03 15:44:04 +08:00
Daniel Liu
a6762110b5
rpc: add SetWebsocketReadLimit in Server #32279 (#1411)
Exposing the public method to setReadLimits for Websocket RPC to
prevent OOM.

Current, Geth Server is using a default 32MB max read limit (message
size) for websocket, which is prune to being attacked for OOM. Any one
can easily launch a client to send a bunch of concurrent large request
to cause the node to crash for OOM. One example of such script that can
easily crash a Geth node running websocket server is like this:

ec830979ac/poc.go

---------

Co-authored-by: Yiming Zang <50607998+yzang2019@users.noreply.github.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
2025-09-03 15:43:14 +08:00
Daniel Liu
33b40aef2c
rpc: use reflect.TypeFor #32316 (#1410)
Co-authored-by: cui <cuiweixie@gmail.com>
2025-09-03 15:42:31 +08:00
Daniel Liu
2d36f159c7
all: update dead wiki links #32215 (#1409)
---

**Description:**
- Replaced outdated GitHub wiki links with current, official
documentation URLs.
- Removed links that redirect or are no longer relevant.
- Ensured all references point to up-to-date and reliable sources.

---

Co-authored-by: Maxim Evtush <154841002+maximevtush@users.noreply.github.com>
2025-09-03 15:41:48 +08:00
Daniel Liu
e711a77747
internal: remove eth_{compile,getWork,submitWork} from console #31856 (#1408) 2025-09-03 15:41:09 +08:00
Daniel Liu
eb770486f2
internal: remove unused shh and swarm modules from console #32073 (#1407)
Similar to https://github.com/ethereum/go-ethereum/pull/31856, remove
the not availabe shh, swarm modules in the console.

---------

Co-authored-by: Zhou <DanialZhouMAX@gmail.com>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2025-09-03 15:40:28 +08:00
Daniel Liu
5081beee0e
rpc: add method name length limit #31711 (#1406)
This change adds a limit for RPC method names to prevent potential abuse
where large method names could lead to large response sizes.

The limit is enforced in:
- handleCall for regular RPC method calls
- handleSubscribe for subscription method calls

Added tests in websocket_test.go to verify the length limit
functionality for both regular method calls and subscriptions.

---------

Co-authored-by: Matus Kysel <MatusKysel@users.noreply.github.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
2025-09-03 15:39:40 +08:00
Daniel Liu
cfd81dd8c4
rlp: refactor to use maths.ReadBits #32432 (#1405)
Co-authored-by: cui <cuiweixie@gmail.com>
2025-09-03 15:38:55 +08:00
Daniel Liu
152609e7d0
rlp: remove workaround for Value.Bytes #32433 (#1404)
As of Go 1.19, it is permitted to call Bytes() on a reflect.Value
representing an adressable byte array. So we can remove our workaround,
undoing #22924.

https://go.dev/doc/go1.19#reflectpkgreflect

> The method [Value.Bytes](https://go.dev/pkg/reflect/#Value.Bytes) now
accepts addressable arrays in addition to slices.

Co-authored-by: Felix Lange <fjl@twurst.com>
2025-09-03 15:37:59 +08:00
Daniel Liu
ed1570c2d1
rlp: optimize intsize #32421 (#1403)
goos: darwin
goarch: arm64
pkg: github.com/ethereum/go-ethereum/rlp
cpu: Apple M4
        │   old.txt   │               new.txt               │
        │   sec/op    │   sec/op     vs base                │
Intsize   2.175n ± 5%   1.050n ± 4%  -51.76% (p=0.000 n=10)

Co-authored-by: cui <cuiweixie@gmail.com>
2025-09-03 15:37:14 +08:00
Daniel Liu
e2edc41b50
all: mv loggers to eth/tracers #23892 (#1269) 2025-09-03 15:35:28 +08:00
Daniel Liu
aca2149f12
core, eth, trie: use TryGetAccount to read what TryUpdateAccount has written #25458 (#1106)
* core: use TryGetAccount to read where TryUpdateAccount has been used to write

* Gary's review feedback

* implement Gary's suggestion

* fix bug + rename NewSecure into NewStateTrie

* trie: add backwards-compatibility aliases for SecureTrie

* Update database.go

* make the linter happy

Co-authored-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2025-09-03 15:34:11 +08:00
Daniel Liu
7d433a454a
eth/tracers: make native 4byte default, remove js version #23916 (#1268)
Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
2025-08-31 16:33:25 +08:00
Daniel Liu
1d1a88db5f
eth/tracers: add golang 4byte tracer #23882 (#1267)
* native 4byte tracer

* Update eth/tracers/native/4byte.go



* Update eth/tracers/native/4byte.go



* goimports

* eth/tracers: make 4byte tracer not care about create

Co-authored-by: Ward Bradt <wardbradt5@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
2025-08-31 16:05:54 +08:00
Daniel Liu
cab1c19cd2
core/state: mark account as dirty when resetObject occurs #27339 (#1224)
This changes the journal logic to mark the state object dirty immediately when it
is reset.

We're mostly adding this change to appease the fuzzer. Marking it dirty immediately
makes no difference in practice because accounts will always be modified by EVM
right after creation.

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2025-08-31 16:04:51 +08:00
Daniel Liu
6c5c8c13de
core, trie: rework trie committer #25320 (#1103)
* all: rework trie and trie committer

* all: get rid of internal cache in trie

* all: fixes

* trie: polish

* core, trie: address comments

* trie: fix imports

* core/state: address comments

* core/state/snapshot: polish

* trie: remove unused code

* trie: update tests

* trie: don't set db as nil

* trie: address comments

* trie: unskip test

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2025-08-31 15:58:48 +08:00
Daniel Liu
b856f98b47
ethclient/gethclient: use common.Hash to debug_traceTransaction #32404 (#1401) 2025-08-31 15:55:06 +08:00
Daniel Liu
5208d126e6
rlp/rlpgen: implement package renaming support #31148 (#1402)
This adds support for importing types from multiple identically-named
packages.

---------

Co-authored-by: VolodymyrBg <aqdrgg19@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
2025-08-31 15:51:51 +08:00
Daniel Liu
56b353bda6
rlp: no need to repeat called len method #29936 (#1400)
rlp: no need to repeat calling len

Co-authored-by: Marquis Shanahan <29431502+9547@users.noreply.github.com>
2025-08-31 15:50:51 +08:00
Daniel Liu
dc2a0c1b86
ethclient/gethclient: add method TraceBlock #32092 (#1399) 2025-08-31 15:48:35 +08:00
Daniel Liu
905cbd63df
ethclient/gethclient: add method TraceTransaction #31288 (#1398) 2025-08-31 15:43:31 +08:00
Daniel Liu
76dd02eed4
ethclient: fix retrieval of pending block #31504 (#1397) 2025-08-31 15:42:53 +08:00
Daniel Liu
773b513213
eth/filters: eth_getLogs fast exit for invalid block range #28386 (#1389) 2025-08-31 15:40:48 +08:00
Daniel Liu
59568b167f
eth/filters: retrieve logs in async #27135 (#1388) 2025-08-29 05:29:38 +08:00
Daniel Liu
031ea75eca
eth/tracers: package restructuring #23857 (#1266) 2025-08-29 05:26:36 +08:00
Daniel Liu
2dcec889e6
core/state: do not ignore null addr while iterative dump #27320 (#1223)
fixes bug which caused the zero-address to be ignored during an iterative state-dump.

---------

Co-authored-by: Park Changwan <pcw109550@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
2025-08-29 05:25:15 +08:00
Daniel Liu
bbc4612d9f
core/state: remove notion of fake storage #24916 (#1219) 2025-08-29 05:24:28 +08:00
Daniel Liu
3fed9ebeb8
core, eth, trie: rework preimage store #25287 (#1099)
* core, trie, eth, cmd: rework preimage store

* trie: address comment

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2025-08-29 05:22:44 +08:00
Daniel Liu
db50cdd311
ethclient: add EstimateGasAt[Hash] functions #27508 (#1396) 2025-08-28 19:00:44 +08:00
Daniel Liu
8679a9fc4f
ethclient: add BlobBaseFee method #31290 (#1395) 2025-08-28 19:00:09 +08:00
Daniel Liu
bd1d41d3bc
ethclient: enhance the description of using block number tags #30984 (#1394) 2025-08-28 18:59:31 +08:00
Daniel Liu
47520a1316
ethclient: add RevertErrorData function #30669 (#1393) 2025-08-28 18:58:46 +08:00
Daniel Liu
0662224c31
ethclient: support networkID in hex format #30263 (#1392)
Some chains’ network IDs use hexadecimal such as Optimism ("0xa" instead
of "10"), so when converting the string to big.Int, we cannot specify
base 10; otherwise, it will encounter errors with hexadecimal network
IDs.

Co-authored-by: Zhihao Lin <3955922+kkqy@users.noreply.github.com>
2025-08-28 18:58:05 +08:00
Daniel Liu
e1a407d2c0
eth/filters: reuse func handleLogs for Removed logs #27438 (#1390) 2025-08-28 18:57:27 +08:00
Daniel Liu
0be5580b98
all: use big.Sign to compare with zero #29490 (#1387) 2025-08-28 18:56:39 +08:00
Daniel Liu
f561e7664d
internal/ethapi: avoid using pending for defaults #28784 (#1386) 2025-08-28 18:56:00 +08:00
Daniel Liu
9fcb8f6a37
ethclient: replace noarg fmt.Errorf with errors.New #27334 (#1385) 2025-08-28 18:55:20 +08:00
Daniel Liu
f49d90eb69
ethclient: simplify error handling in TransactionReceipt #28748 (#1384) 2025-08-28 18:54:48 +08:00
Daniel Liu
d138eb22a3
eth/tracers: support for golang tracers + add golang callTracer #23708 (#1264) 2025-08-28 18:53:13 +08:00
Daniel Liu
9425af8b7c
eth: make traceChain avoid OOM on long-running tracing #23736 (#1263) 2025-08-28 18:52:32 +08:00
Daniel Liu
3926b08074
core/state: maintain destruction flag by default #26371 (#1218) 2025-08-28 18:51:36 +08:00
Daniel Liu
0b7b02b8e0
trie: lint whitespace #25312 (#1098) 2025-08-28 18:49:37 +08:00
Daniel Liu
67106daaa8
trie: fix gosimple lint issue #25309 (#1097)
Co-authored-by: Felix Lange <fjl@twurst.com>
2025-08-26 15:44:53 +08:00
Daniel Liu
152e3d9923
core/state: return error when storage trie can't be opened #26350 (#1216)
This changes the StorageTrie method to return an error when the trie
is not available. It used to return an 'empty trie' in this case, but that's
not possible anymore under PBSS.

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2025-08-26 15:31:00 +08:00
Daniel Liu
32ed739110
eth/tracers: avoid unsyncronized mutations on trie database #23632 (#1261) 2025-08-26 15:26:19 +08:00
Daniel Liu
98f6825514
eth/tracers: implement debug.intermediateRoots #23594 (#1260) 2025-08-26 15:25:30 +08:00
Daniel Liu
28550526ba
eth/tracers: improve test #23303 (#1258) 2025-08-26 15:24:49 +08:00