Commit graph

24 commits

Author SHA1 Message Date
wit liu
d3b35cba42
rpc: fix a flaky test of the websocket #33002 (#1877) 2025-12-19 08:19:47 +04:00
Daniel Liu
ec08863ba0
all: use WaigGroup.Go() to simplify code (#1699) 2025-11-29 17:17:08 +05:30
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
d25c6f02a7
all: not copy loop var for golang v1.22 (#1020) 2025-04-29 17:27:36 +08:00
Daniel Liu
d955e17cd6
rpc: add timeout to rpc client Unsubscribe #30318 (#1019)
Fixes #30156

This adds a repro of the linked issue. I fixed it by adding a timeout
when issuing the call to unsubscribe.

Co-authored-by: lightclient <14004106+lightclient@users.noreply.github.com>
2025-04-29 17:26:34 +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
26a9ea539f
core, rpc: speed up tests #28461 (#1008) 2025-04-29 16:57:58 +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
18c9efa71d
rpc: handle wrong HTTP batch response length #26064 (#975)
Co-authored-by: Jordan Krage <jmank88@gmail.com>
2025-04-24 19:06:19 +08:00
Daniel Liu
02eb1d5375
rpc: improve error codes for internal server errors #25678 (#974)
This changes the error code returned by the RPC server in certain situations:

- handler panic: code -32603
- result marshaling error: code -32603
- attempt to subscribe via HTTP: code -32001

In all of the above cases, the server previously returned the default error
code -32000.

Co-authored-by: Nicholas <nicholas.zhaoyu@gmail.com>
Co-authored-by: Nicholas Zhao <nicholas.zhao@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
2025-04-24 19:03:29 +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
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
Jianrong
7f0215195b fix: update rpc module to include eth fix from #26064 and #26723 2024-01-20 12:21:48 +11: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
Felix Lange
2e98631c5e
rpc: fix client shutdown hang when Close races with Unsubscribe (#17894)
Fixes #17837
2018-10-15 10:56:04 +02:00
Lewis Marshall
9feec51e2d p2p: add network simulation framework (#14982)
This commit introduces a network simulation framework which
can be used to run simulated networks of devp2p nodes. The
intention is to use this for testing protocols, performing
benchmarks and visualising emergent network behaviour.
2017-09-25 10:08:07 +02: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
e32925397b rpc: add context argument to EthSubscribe
It's inconsistent not to pass it and most callers will
work with contexts anyway.
2016-08-05 20:48:33 +02:00
Felix Lange
f5f042ffdc rpc: ensure client doesn't block for slow subscribers
I initially made the client block if the 100-element buffer was
exceeded. It turns out that this is inconvenient for simple uses of the
client which subscribe and perform calls on the same goroutine, e.g.

    client, _ := rpc.Dial(...)
    ch := make(chan int) // note: no buffer
    sub, _ := client.EthSubscribe(ch, "something")
    for event := range ch {
        client.Call(...)
    }

This innocent looking code will lock up if the server suddenly decides
to send 2000 notifications. In this case, the client's main loop won't
accept the call because it is trying to deliver a notification to ch.

The issue is kind of hard to explain in the docs and few people will
actually read them. Buffering is the simple option and works with close
to no overhead for subscribers that always listen.
2016-08-05 20:48:33 +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