Commit graph

16 commits

Author SHA1 Message Date
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
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
f19813e3ee
rpc: run tests in parallel #30384 (#1021)
Continuation of https://github.com/ethereum/go-ethereum/pull/30381

Co-authored-by: Håvard Anda Estensen <haavard.ae@gmail.com>
2025-05-06 09:41:42 +08:00
Daniel Liu
84b731fc23
rpc: close Clients in tests #29512 (#1016)
Co-authored-by: Darioush Jalali <darioush.jalali@avalabs.org>
2025-04-29 17:13:29 +08:00
Daniel Liu
35a202675d
node, rpc: add configurable HTTP request limit #28948 (#1010)
Adds a configurable HTTP request limit, and bumps the engine default

Co-authored-by: Felix Lange <fjl@twurst.com>
2025-04-29 17:06:06 +08:00
Daniel Liu
aa75ed2f6b
rpc: increase timeout in TestClientWebsocketPing #28371 (#1005)
Co-authored-by: Brandon Liu <lzqcn2000@126.com>
2025-04-28 18:05:48 +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
JukLee0ira
ef02abcf8f
rpc, internal/guide: speed up tests a bit #26193 (#981) 2025-04-24 22:08:58 +08:00
Daniel Liu
d751e88fa5
internal/jsre, node, rpc: fix goroutine leaks in tests #24211 (#964) 2025-04-24 18:36:10 +08:00
Daniel Liu
a997425b03
all: fix warning of DeepEqual on error #23624 (#960) 2025-04-24 18:31:47 +08:00
Daniel Liu
fae15a51b5
rpc: set pong read deadline #23556 (#959) 2025-04-24 18:22:33 +08:00
Daniel Liu
9f504a6243
rpc: tighter shutdown synchronization in client subscription #22597 (#955)
This fixes a rare issue where the client subscription forwarding loop
would attempt send on the subscription's channel after Unsubscribe has
returned, leading to a panic if the subscription channel was already
closed by the user. Example:

    sub, _ := client.Subscribe(..., channel, ...)
    sub.Unsubscribe()
    close(channel)

The race occurred because Unsubscribe called quitWithServer to tell the
forwarding loop to stop sending on sub.channel, but did not wait for the
loop to actually come down. This is fixed by adding an additional channel
to track the shutdown, on which Unsubscribe now waits.

Fixes #22322

Co-authored-by: Felix Lange <fjl@twurst.com>
2025-04-24 18:17:45 +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
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