Commit graph

34 commits

Author SHA1 Message Date
Daniel Liu
50210d90e3
refactor(all): remove term whitelist and blacklist (#1994) 2026-02-10 17:09:21 +05:30
Daniel Liu
ec08863ba0
all: use WaigGroup.Go() to simplify code (#1699) 2025-11-29 17:17:08 +05:30
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
fd42d8b292
rpc: implement Unwrap() for wsHandshakeError #29522 (#1015)
Co-authored-by: Marcus Baldassarre <baldassarremarcus@gmail.com>
2025-04-29 17:12:33 +08:00
Daniel Liu
c16b1b5217
eth, rpc: add configurable option for wsMessageSizeLimit #27801 (#1003)
This change adds a configurable limit to websocket message.
---------

Co-authored-by: tylerni7 <tylerni7@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
2025-04-28 18:02:12 +08:00
Daniel Liu
027b69a372
rpc: attempt to fix ping/pong logic race #27733 (#1001)
This should fix #27726. With enough load, it might happen that the SetPongHandler
callback gets invoked before the call to SetReadDeadline is made in pingLoop. When
this occurs, the socket will end up with a 30s read deadline even though it got the pong,
which will lead to a timeout.

The fix here is processing the pong on pingLoop, synchronizing with the code that
sends the ping.

Co-authored-by: Felix Lange <fjl@twurst.com>
2025-04-28 17:49:37 +08:00
Daniel Liu
c75623ace7
rpc: add limit for batch request and response size #26681 (#998) 2025-04-28 17:00:30 +08:00
Daniel Liu
e6b7ae906b
rpc: websocket should respect the HTTP_PROXY by default #27264 (#989) 2025-04-28 10:44:31 +08:00
JukLee0ira
0e84001c0b node, rpc: add JWT auth support in client #24911 2025-04-28 10:25:07 +08:00
Daniel Liu
051938ba7e
rpc: increase websocket frame size #26883 (#986)
This increases the maximum allowed message size to 32MB.

Originally submitted at https://github.com/ledgerwatch/erigon/pull/2739

example block failure: https://etherscan.io/tx/0x1317d973a55cedf9b0f2df6ea48e8077dd176f5444a3423368a46d6e4db89982#internal

Co-authored-by: Jonathan Otto <jonathan.otto@gmail.com>
2025-04-28 09:11:52 +08:00
Daniel Liu
58e9b8c8f6
node, rpc: improve HTTP write timeout handling #25457 (#982)
Here we add special handling for sending an error response when the write timeout of the
HTTP server is just about to expire. This is surprisingly difficult to get right, since is
must be ensured that all output is fully flushed in time, which needs support from
multiple levels of the RPC handler stack:

The timeout response can't use chunked transfer-encoding because there is no way to write
the final terminating chunk. net/http writes it when the topmost handler returns, but the
timeout will already be over by the time that happens. We decided to disable chunked
encoding by setting content-length explicitly.

Gzip compression must also be disabled for timeout responses because we don't know the
true content-length before compressing all output, i.e. compression would reintroduce
chunked transfer-encoding.

Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
2025-04-25 08:01:44 +08:00
Daniel Liu
149beccd14
rpc: decrease websocket ping interval #26253 (#979)
This is to cater for more node providers.

Co-authored-by: Wihan de Beer <debeerwihan@gmail.com>
2025-04-24 19:09:42 +08:00
Daniel Liu
fae15a51b5
rpc: set pong read deadline #23556 (#959) 2025-04-24 18:22:33 +08:00
Daniel Liu
4e951ed8fe all: use github.com/deckarep/golang-set/v2 (generic set) (#26159) 2025-01-24 16:54:11 +08:00
Daniel Liu
b76438aafe node: allow WebSocket and HTTP work on same port (#20810) 2024-11-13 09:35:41 +08:00
Daniel Liu
206175fb43 all: remove term whitelist in comments and log messages (#23294) 2024-11-01 11:36:52 +08:00
Daniel Liu
2844dbc5a9 rpc: fix staticcheck warning SA1029 by add PeerInfo (#24255) 2024-10-25 12:32:13 +08:00
Banana-J
39f6e6ee56
upgrade the websocket in xdpos (#349) 2023-11-06 15:37:14 +11:00
olumuyiwadad
b5abbfed79 new EVM Upgrade
- Solidity Upgraded up to v0.8.0
-  Fixed and Added eth_chainId
- Fix error in TransactionRecipet
- Reward halving issue fixed
2021-09-21 16:53:46 +05:30
olumuyiwadad
571c41f891 FIx Bad block error. 2021-09-17 17:59:06 +05:30
Peter Broadhurst
c35659c6a0 rpc: enable basic auth for websocket client (#17699) 2018-09-19 18:09:03 +02:00
Ralph Caraveo III
5d30be412b all: switch out defunct set library to different one (#16873)
* keystore, ethash, eth, miner, rpc, whisperv6: tech debt with now defunct set.

* whisperv5: swap out gopkg.in/fatih/set.v0 with supported set
2018-07-16 10:54:19 +03:00
Péter Szilágyi
555f42cfd8
rpc: enforce the 128KB request limits on websockets too 2018-03-13 13:55:26 +02:00
Benoit Verkindt
3ee86a57f3 rpc: warn on WebSocket origin mismatch (#15451)
Fixes #15373
2017-11-10 10:22:06 +01:00
bas-vk
5e29f4be93 cmd/utils, node: remove unused solc references and improve RPC config (#14324)
Currently http cors and websocket origins are a comma separated string in the
config object. These are replaced with string arrays that are more expressive in
case of a config file.
2017-04-12 23:04:14 +02:00
Felix Lange
c213fd1fd8 all: import "context" instead of "golang.org/x/net/context"
There is no need to depend on the old context package now that the
minimum Go version is 1.7. The move to "context" eliminates our weird
vendoring setup. Some vendored code still uses golang.org/x/net/context
and it is now vendored in the normal way.

This change triggered new vet checks around context.WithTimeout which
didn't fire with golang.org/x/net/context.
2017-03-22 20:49:15 +01:00
Péter Szilágyi
d4fd06c3dc
all: blidly swap out glog to our log15, logs need rework 2017-02-23 12:16:44 +02:00
Felix Lange
91b7690428 rpc: add new client, use it everywhere
The new client implementation supports concurrent requests,
subscriptions and replaces the various ad hoc RPC clients
throughout go-ethereum.
2016-07-22 23:21:27 +02:00
Bas van Kervel
5479097790 rpc: HTTP origin case insensitive 2016-05-10 18:01:58 +02:00
Bas van Kervel
aa9fff3e68 rpc: various fixes/enhancements
rpc: be less restrictive on the request id
rpc: improved documentation
console: upgrade web3.js to version 0.16.0
rpc: cache http connections
rpc: rename wsDomains parameter to wsOrigins
2016-04-12 11:02:39 +02:00
Bas van Kervel
f7328c5ecb rpc: add pub/sub support 2016-04-01 18:26:35 +02:00
Péter Szilágyi
df75dbfd68 cmd, node, rpc: readd inproc RPC client, expose via node 2016-02-09 14:10:40 +02:00
Péter Szilágyi
7486904b92 cmd, node, rpc: move websockets into node, break singleton 2016-02-05 16:53:47 +02:00
Bas van Kervel
19b2640e89 rpc: migrated the RPC insterface to a new reflection based RPC layer 2016-01-26 13:51:50 +01:00