Skip to content

eth/filters: add transactionReceipts subscription#32697

Merged
s1na merged 6 commits intoethereum:masterfrom
10gic:subscribe-receipt
Oct 9, 2025
Merged

eth/filters: add transactionReceipts subscription#32697
s1na merged 6 commits intoethereum:masterfrom
10gic:subscribe-receipt

Conversation

@10gic
Copy link
Contributor

@10gic 10gic commented Sep 21, 2025

Currently, we can get transaction receipts from the HTTP API eth_getTransactionReceipt. In this PR, I add support for getting transaction receipts from the WebSocket API: Add a new subscription_name: transactionReceipts, which accepts an optional transaction hashes filter.

Why is this PR valuable?

  1. It provides users with faster access to transaction receipts than the HTTP API.
  2. It saves many HTTP RPC calls. Some libraries, for example waitForTransactionReceipt, need to monitor transaction and must use polling, which wastes a lot of RPC calls.

Usage:
Subscribe to a transaction receipt by transaction hash (multiple transaction hashes are also supported):

# Subscribe (WebSocket client --> WebSocket server):
{
	"jsonrpc": "2.0",
	"id": 1,
	"method": "eth_subscribe",
	"params": ["transactionReceipts", {
		"transactionHashes": [
			"0xffc4978dfe7ab496f0158ae8916adae6ffd0c1fca4f09f7a7134556011357424"
		]
	}]
}

# Notification (WebSocket server --> WebSocket client):
# Data format is the same as eth_getTransactionReceipt
{
    "jsonrpc": "2.0",
    "method": "eth_subscription",
    "params": {
        "subscription": "0xf9a92ce3f834c5f23100f4a9f6b8ddaf",
        "result": [
            {
                "blockHash": "0x53a6208ec0efcc8de6380eedc8c34f8dda0fc8156de94281f5539576e929b1be",
                "blockNumber": "0x2",
                "contractAddress": null,
                "cumulativeGasUsed": "0x5208",
                "effectiveGasPrice": "0x3b9aca00",
                "from": "0x71562b71999873db5b286df957af199ec94617f7",
                "gasUsed": "0x5208",
                "logs": [],
                "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
                "status": "0x1",
                "to": "0x71562b71999873db5b286df957af199ec94617f7",
                "transactionHash": "0xffc4978dfe7ab496f0158ae8916adae6ffd0c1fca4f09f7a7134556011357424",
                "transactionIndex": "0x0",
                "type": "0x0"
            }
        ]
    }
}

Subscribe to all transaction receipts:

# Subscribe (WebSocket client --> WebSocket server):
{
	"jsonrpc": "2.0",
	"id": 1,
	"method": "eth_subscribe",
	"params": ["transactionReceipts"]
}

# Notification (WebSocket server --> WebSocket client):
# Data format is the same as eth_getTransactionReceipt
{
    "jsonrpc": "2.0",
    "method": "eth_subscription",
    "params": {
        "subscription": "0x9374a0f623d50dd1477b4a3e25fc3b76",
        "result": [
            {
                "blockHash": "0x9fd9d918653b8b40406df7d230e3a3ab80bcc24da2bb5411c1f64aaa0d3546af",
                "blockNumber": "0x4",
                "contractAddress": null,
                "cumulativeGasUsed": "0x5208",
                "effectiveGasPrice": "0x3b9aca00",
                "from": "0x71562b71999873db5b286df957af199ec94617f7",
                "gasUsed": "0x5208",
                "logs": [],
                "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
                "status": "0x1",
                "to": "0x71562b71999873db5b286df957af199ec94617f7",
                "transactionHash": "0x9687a6a6805ada78575b8485d9ce2afdf4483ce51745f352fabeaf723c1e5e08",
                "transactionIndex": "0x0",
                "type": "0x0"
            },
            ......
        ]
    }
}

As mentioned in the above example, filtering is not performed when no second parameter is provided. The following describes three additional special cases where no filtering is performed:

  1. The transactionHashes field in the second parameter is set to null;
  2. The transactionHashes field in the second parameter is set to [] (empty array);
  3. The second parameter is {} (empty object).

All of the above are treated as subscribing to all transaction receipts:

# Setting `transactionHashes` field to `null` also means no filter
{
	"jsonrpc": "2.0",
	"id": 1,
	"method": "eth_subscribe",
	"params": ["transactionReceipts", {
		"transactionHashes": null
	}]
}

# Setting `transactionHashes` field to `[]` also means no filter
{
	"jsonrpc": "2.0",
	"id": 1,
	"method": "eth_subscribe",
	"params": ["transactionReceipts", {
		"transactionHashes": []
	}]
}

# Setting the second parameter to `{}` also means no filter
{
	"jsonrpc": "2.0",
	"id": 1,
	"method": "eth_subscribe",
	"params": ["transactionReceipts", {}]
}

I noticed that all HTTP APIs have been standardized in the execution-apis project, but WebSocket APIs are not included in that project. In this PR, I only enhance the WebSocket API - no HTTP APIs are changed.

@s1na
Copy link
Contributor

s1na commented Sep 23, 2025

Hey thanks for this, I think it's a fair request. I will have a look

@10gic
Copy link
Contributor Author

10gic commented Sep 29, 2025

Hi @s1na, hope you're doing well. When you have a chance, could you take a look at this PR? Any feedback would be great. Thanks!

@s1na
Copy link
Contributor

s1na commented Sep 29, 2025

Pushed a commit to avoid an extra db read of the receipts in SetCanonical

@10gic
Copy link
Contributor Author

10gic commented Sep 30, 2025

Pushed a commit to avoid an extra db read of the receipts in SetCanonical

You're very thorough, thank you for the commit.

@10gic
Copy link
Contributor Author

10gic commented Oct 1, 2025

Hi @s1na, just following up to see if you have any additional feedback on this PR? Happy to make any other changes if needed.

@10gic
Copy link
Contributor Author

10gic commented Oct 8, 2025

Hi @s1na, I noticed a PR for EIP-7966 (eth_sendRawTransactionSync Method) is ready. I found that its implementation could be optimized after this PR is merged:
Once this PR is merged, we can implement eth_sendRawTransactionSync by simply calling SubscribeChainEvent (because we extended the chain event to include transaction receipt), rather than calling SubscribeChainHeadEvent and GetTransactionReceipt multiple times.
Could you continue reviewing this when you get a chance? I'd appreciate your feedback.

// TransactionReceiptsFilter defines criteria for transaction receipts subscription.
// If TransactionHashes is nil or empty, receipts for all transactions included in new blocks will be delivered.
// Otherwise, only receipts for the specified transactions will be delivered.
type TransactionReceiptsFilter struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why you made this a structure instead of taking []common.Hash as the parameter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @s1na, thanks for asking! I used a struct mainly for two reasons:

  1. Self-documenting API
    Having named fields like {"transactionHashes": [...]} makes the API more readable and self-explanatory compared to a bare array.
  2. Future extensibility
    A struct makes it easier to add new filter options in the future (e.g., from, to, or other filters) without breaking backward compatibility.

@s1na
Copy link
Contributor

s1na commented Oct 8, 2025

Once this PR is merged, we can implement eth_sendRawTransactionSync by simply calling SubscribeChainEvent (because we extended the chain event to include transaction receipt), rather than calling SubscribeChainHeadEvent and GetTransactionReceipt multiple times.

Yes that's a good point!

Copy link
Contributor

@s1na s1na left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good PR, thanks!

@s1na s1na added this to the 1.16.5 milestone Oct 9, 2025
@s1na s1na changed the title websocket: add transactionReceipts for receipts notification eth/filters: add transactionReceipts subscription Oct 9, 2025
@s1na s1na merged commit 1120855 into ethereum:master Oct 9, 2025
9 of 10 checks passed
@s1na
Copy link
Contributor

s1na commented Oct 9, 2025

I just realized, we didn't add this to ethclient. Let me know if you'd like to open a PR for that.

@10gic
Copy link
Contributor Author

10gic commented Oct 9, 2025

I just realized, we didn't add this to ethclient. Let me know if you'd like to open a PR for that.

Thanks for pointing that out. The PR is ready: #32869.

s1na pushed a commit that referenced this pull request Oct 10, 2025
Add `SubscribeTransactionReceipts` for ethclient. This is a complement
to #32697.
Sahil-4555 pushed a commit to Sahil-4555/go-ethereum that referenced this pull request Oct 12, 2025
- Introduce a new subscription kind `transactionReceipts` to allow clients to
  receive transaction receipts over WebSocket as soon as they are available.
- Accept optional `transactionHashes` filter to subscribe to receipts for specific
  transactions; an empty or omitted filter subscribes to all receipts.
- Preserve the same receipt format as returned by `eth_getTransactionReceipt`.
- Avoid additional HTTP polling, reducing RPC load and latency.

---------

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
Sahil-4555 pushed a commit to Sahil-4555/go-ethereum that referenced this pull request Oct 12, 2025
Add `SubscribeTransactionReceipts` for ethclient. This is a complement
to ethereum#32697.
atkinsonholly pushed a commit to atkinsonholly/ephemery-geth that referenced this pull request Nov 24, 2025
- Introduce a new subscription kind `transactionReceipts` to allow clients to
  receive transaction receipts over WebSocket as soon as they are available.
- Accept optional `transactionHashes` filter to subscribe to receipts for specific
  transactions; an empty or omitted filter subscribes to all receipts.
- Preserve the same receipt format as returned by `eth_getTransactionReceipt`.
- Avoid additional HTTP polling, reducing RPC load and latency.

---------

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
atkinsonholly pushed a commit to atkinsonholly/ephemery-geth that referenced this pull request Nov 24, 2025
Add `SubscribeTransactionReceipts` for ethclient. This is a complement
to ethereum#32697.
manav2401 pushed a commit to 0xPolygon/bor that referenced this pull request Nov 26, 2025
Add `SubscribeTransactionReceipts` for ethclient. This is a complement
to ethereum/go-ethereum#32697.
prestoalvarez pushed a commit to prestoalvarez/go-ethereum that referenced this pull request Nov 27, 2025
- Introduce a new subscription kind `transactionReceipts` to allow clients to
  receive transaction receipts over WebSocket as soon as they are available.
- Accept optional `transactionHashes` filter to subscribe to receipts for specific
  transactions; an empty or omitted filter subscribes to all receipts.
- Preserve the same receipt format as returned by `eth_getTransactionReceipt`.
- Avoid additional HTTP polling, reducing RPC load and latency.

---------

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
prestoalvarez pushed a commit to prestoalvarez/go-ethereum that referenced this pull request Nov 27, 2025
Add `SubscribeTransactionReceipts` for ethclient. This is a complement
to ethereum#32697.
canepat added a commit to erigontech/erigon that referenced this pull request Dec 16, 2025
This PR implements real-time transaction receipt subscriptions via
WebSocket (`eth_subscribe("transactionReceipt")`), inspired by
ethereum/go-ethereum#32697.
Clients can now receive receipts immediately as blocks are processed,
without polling.

resolve #17596

## Implementation

- Added new subscribe type `transactionReceipts`

- (Core -> RPC module) Extended gRPC protocol with structured receipt
data
- Instead of RLP-encoded bytes, receipts are sent as structured protobuf
messages

- Replaced `RecentLogs` with `RecentReceipts` structure that handles
both receipts and logs:
- Receipts contain logs, so we extract logs from receipts for existing
log subscriptions
  - Single source of truth for both receipt and log data
  - Maintains backward compatibility with existing log subscriptions

- Implemented filtering at both core (execution node) and RPC daemon
levels, similar to existing log subscription architecture

## Filter Example

Both levels support:

### No filter (subscribe to all receipts):
```json
{
  "jsonrpc":"2.0",
  "id":1,
  "method":"eth_subscribe",
  "params":[
    "transactionReceipts",  {}
  ]
}
or
{
  "jsonrpc":"2.0",
  "id":1,
  "method":"eth_subscribe",
  "params":[
    "transactionReceipts",  {"transactionHashes": []}
  ]
}
```

### Transaction hash filter:
```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_subscribe",
  "params": [
    "transactionReceipts", {"transactionHashes": ["0x123...","0x456..."]}
  ]
}
```

## Response Example

```json
{
  "jsonrpc": "2.0",
  "method": "eth_subscription",
  "params": {
    "subscription": "0x5465f633defb53ab2b63275bef29b6f7",
    "result": {
      "blockHash": "0xe1699970061c7bb45e54bf6235ebf66c467f7292ece610955fd818075fc20360",
      "blockNumber": "0x11cffe7",
      "contractAddress": null,
      "cumulativeGasUsed": "0x1c65c",
      "effectiveGasPrice": "0x7",
      "from": "0x62669a879f5c90d9f8aec826882b2da6cc28b352",
      "gasUsed": "0x1c65c",
      "logs": [
        {
          "address": "0xf4ebcc2c077d3939434c7ab0572660c5a45e4df5",
          "data": "0x000000000000000000000000000000000000000000000000000000012a153440000000000000000000000000000000000000000000000000000000006910841b",
          "topics": [
            "0xdd84a3fa9ef9409f550d54d6affec7e9c480c878c6ab27b78912a03e1b371c6e",
            "0x000000000000000000000000000000000000000000000000370e65a434afcdd5"
          ]
        }
      ],
      "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000020000200000000000000000000000000000000000000000800000000200201000000000100000000020000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001800000000000000000000010000000200000008000008000004000000000000000000002000000000000040000000000000000000000000000000000000020000000000800000000000000000000000000000000000000000000000000000000",
      "status": "0x1",
      "to": "0x4d8193f845eb3540e0bda9451296600362e22b15",
      "transactionHash": "0x320e1f62b23fb374938c32c910fa1e6c00c3cace6ba39f052f860c3520a21380",
      "transactionIndex": "0x0",
      "type": "0x2"
    }
  }
}
```

---------

Co-authored-by: canepat <16927169+canepat@users.noreply.github.com>
louisliu2048 added a commit to okx/op-geth that referenced this pull request Jan 15, 2026
* version: begin v1.16.5 release cycle

* internal/ethapi: fix outdated comments (#32751)

Fix outdated comments

* ethapi: reject oversize storage keys before hex decode (#32750)

Bail out of decodeHash when the raw hex string is longer than 32 byte before actually decoding.
---------

Co-authored-by: lightclient <lightclient@protonmail.com>

* signer/core: fix TestSignTx to decode res2 (#32749)

Decode the modified transaction and verify the value differs from original.

---------

Co-authored-by: lightclient <lightclient@protonmail.com>

* trie: correct error messages for UpdateStorage operations (#32746)

Fix incorrect error messages in TestVerkleTreeReadWrite and TestVerkleRollBack functions.

* eth/tracers/native: add keccak256preimage tracer (#32569)

Introduces a new tracer which returns the preimages
of evm KECCAK256 hashes.

See #32570.

---------

Co-authored-by: Sina M <1591639+s1na@users.noreply.github.com>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>

* params: add amsterdam fork config (#32687)

Adds Amsterdam as fork config option.

Co-authored-by: lightclient <lightclient@protonmail.com>

* build: remove duplicated func FileExist (#32768)

* eth/catalyst: check osaka in engine_getBlobsV1 (#32731)

ref
https://github.com/ethereum/execution-apis/blob/main/src/engine/osaka.md#cancun-api

> Client software MUST return -38005: Unsupported fork error if the
Osaka fork has been activated.

---------

Signed-off-by: Delweng <delweng@gmail.com>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>

* trie: fix error message in test (#32772)

Fixes an error message in TestReplication

* internal/ethapi: remove redundant check in test (#32760)

Removes a redundant check in TestCreateAccessListWithStateOverrides

* cmd/evm/internal/t8ntool: panic on database corruption (#32776)

These functions were previously ignoring the error returned by both
`statedb.Commit()` and the subsequent `state.New()`,
which could silently fail and cause panics later when the `statedb` is
used.
This change adds proper error checking and panics with a descriptive
error
message if state creation fails.

While unlikely in normal operation, this can occur if there are database
corruption issues or if invalid root hashes are provided, making
debugging
significantly easier when such issues do occur.

This issue was encountered and fixed in
gballet/go-ethereum#552
where the error handling proved essential for debugging

cc: @gballet as this was discussed in a call already.

* params: fix bpo config comments (#32755)

Looks like we forgot to update names when copying.

* core/rawdb: update comments (#32668)

- Replace outdated NewFreezer doc that referenced map[string]bool/snappy
toggle with accurate description of -map[string]freezerTableConfig
(noSnappy, prunable).
- Fix misleading field comment on freezerTable.config that spoke as if
it were a boolean (“if true”), clarifying it’s a struct and noting
compression is non-retroactive.

* params: implement String() method for ChainConfig (#32766)

Fixes issue #32762 where ChainConfig logging displays pointer addresses
instead of actual timestamp values for fork activation times.

Before: ShanghaiTime:(*uint64)(0xc000373fb0),
CancunTime:(*uint64)(0xc000373fb8)
After: ShanghaiTime: 1681338455, CancunTime: 1710338135, VerkleTime: nil

The String() method properly dereferences timestamp pointers and handles
nil values for unset fork times, making logs more readable and useful
for debugging chain configuration issues.

---------

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>

* params: add blob config information in the banner (#32771)

Extend the chain banner with blob config information.

Co-authored-by: Felix Lange <fjl@twurst.com>

* core/txpool: remove unused signer field from TxPool (#32787)

The TxPool.signer field was never read and each subpool (legacy/blob)
maintains its own signer instance. This field remained after txpool
refactoring into subpools and is dead code. Removing it reduces
confusion and simplifies the constructor.

* core/state: correct expected value in TestMessageCallGas (#32780)

* go.mod, cmd/keeper/go.mod: upgrade victoria metrics dependency (#32720)

This is required for geth to compile to WASM.

* eth/catalyst: extend payloadVersion support to osaka/post-osaka forks (#32800)

This PR updates the `payloadVersion` function in `simulated_beacon.go`
to handle additional following forks used during development and testing
phases after Osaka.

This change ensures that the simulated beacon correctly resolves the
payload version for these forks, enabling consistent and valid execution
payload handling during local testing or simulation.

* p2p: fix error message in test (#32804)

* signer/core: fix error message in test (#32807)

* params: fix banner message (#32796)

* core/types, trie: reduce allocations in derivesha (#30747)

Alternative to #30746, potential follow-up to #30743 . This PR makes the
stacktrie always copy incoming value buffers, and reuse them internally.

Improvement in #30743:
```
goos: linux
goarch: amd64
pkg: github.com/ethereum/go-ethereum/core/types
cpu: 12th Gen Intel(R) Core(TM) i7-1270P
                          │ derivesha.1 │             derivesha.2              │
                          │   sec/op    │    sec/op     vs base                │
DeriveSha200/stack_trie-8   477.8µ ± 2%   430.0µ ± 12%  -10.00% (p=0.000 n=10)

                          │ derivesha.1  │             derivesha.2              │
                          │     B/op     │     B/op      vs base                │
DeriveSha200/stack_trie-8   45.17Ki ± 0%   25.65Ki ± 0%  -43.21% (p=0.000 n=10)

                          │ derivesha.1 │            derivesha.2             │
                          │  allocs/op  │ allocs/op   vs base                │
DeriveSha200/stack_trie-8   1259.0 ± 0%   232.0 ± 0%  -81.57% (p=0.000 n=10)

```
This PR further enhances that: 

```
goos: linux
goarch: amd64
pkg: github.com/ethereum/go-ethereum/core/types
cpu: 12th Gen Intel(R) Core(TM) i7-1270P
                          │ derivesha.2  │          derivesha.3           │
                          │    sec/op    │    sec/op     vs base          │
DeriveSha200/stack_trie-8   430.0µ ± 12%   423.6µ ± 13%  ~ (p=0.739 n=10)

                          │  derivesha.2  │             derivesha.3              │
                          │     B/op      │     B/op      vs base                │
DeriveSha200/stack_trie-8   25.654Ki ± 0%   4.960Ki ± 0%  -80.67% (p=0.000 n=10)

                          │ derivesha.2 │            derivesha.3             │
                          │  allocs/op  │ allocs/op   vs base                │
DeriveSha200/stack_trie-8   232.00 ± 0%   37.00 ± 0%  -84.05% (p=0.000 n=10)
```
So the total derivesha-improvement over *both PRS* is: 
```
goos: linux
goarch: amd64
pkg: github.com/ethereum/go-ethereum/core/types
cpu: 12th Gen Intel(R) Core(TM) i7-1270P
                          │ derivesha.1 │             derivesha.3              │
                          │   sec/op    │    sec/op     vs base                │
DeriveSha200/stack_trie-8   477.8µ ± 2%   423.6µ ± 13%  -11.33% (p=0.015 n=10)

                          │  derivesha.1  │             derivesha.3              │
                          │     B/op      │     B/op      vs base                │
DeriveSha200/stack_trie-8   45.171Ki ± 0%   4.960Ki ± 0%  -89.02% (p=0.000 n=10)

                          │ derivesha.1  │            derivesha.3             │
                          │  allocs/op   │ allocs/op   vs base                │
DeriveSha200/stack_trie-8   1259.00 ± 0%   37.00 ± 0%  -97.06% (p=0.000 n=10)
```

Since this PR always copies the incoming value, it adds a little bit of
a penalty on the previous insert-benchmark, which copied nothing (always
passed the same empty slice as input) :

```
goos: linux
goarch: amd64
pkg: github.com/ethereum/go-ethereum/trie
cpu: 12th Gen Intel(R) Core(TM) i7-1270P
             │ stacktrie.7  │          stacktrie.10          │
             │    sec/op    │    sec/op     vs base          │
Insert100K-8   88.21m ± 34%   92.37m ± 31%  ~ (p=0.280 n=10)

             │ stacktrie.7  │             stacktrie.10             │
             │     B/op     │     B/op      vs base                │
Insert100K-8   3.424Ki ± 3%   4.581Ki ± 3%  +33.80% (p=0.000 n=10)

             │ stacktrie.7 │            stacktrie.10            │
             │  allocs/op  │ allocs/op   vs base                │
Insert100K-8    22.00 ± 5%   26.00 ± 4%  +18.18% (p=0.000 n=10)
```

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>

* p2p/enode: fix discovery AyncFilter deadlock on shutdown (#32572)

Description:
We found a occasionally node hang issue on BSC, I think Geth may
also have the issue, so pick the fix patch here.
The fix on BSC repo: bnb-chain/bsc#3347

When the hang occurs, there are two routines stuck.
- routine 1: AsyncFilter(...)
On node start, it will run part of the DiscoveryV4 protocol, which could
take considerable time, here is its hang callstack:
```
goroutine 9711 [chan receive]:  // this routine was stuck on read channel: `<-f.slots`
github.com/ethereum/go-ethereum/p2p/enode.AsyncFilter.func1()
	github.com/ethereum/go-ethereum/p2p/enode/iter.go:206 +0x125
created by github.com/ethereum/go-ethereum/p2p/enode.AsyncFilter in goroutine 1
	github.com/ethereum/go-ethereum/p2p/enode/iter.go:192 +0x205

```

- Routine 2: Node Stop
It is the main routine to shutdown the process, but it got stuck when it
tries to shutdown the discovery components, as it tries to drain the
channel of `<-f.slots`, but the extra 1 slot will never have chance to
be resumed.
```
goroutine 11796 [chan receive]: 
github.com/ethereum/go-ethereum/p2p/enode.(*asyncFilterIter).Close.func1()
	github.com/ethereum/go-ethereum/p2p/enode/iter.go:248 +0x5c
sync.(*Once).doSlow(0xc032a97cb8?, 0xc032a97d18?)
	sync/once.go:78 +0xab
sync.(*Once).Do(...)
	sync/once.go:69
github.com/ethereum/go-ethereum/p2p/enode.(*asyncFilterIter).Close(0xc092ff8d00?)
	github.com/ethereum/go-ethereum/p2p/enode/iter.go:244 +0x36
github.com/ethereum/go-ethereum/p2p/enode.(*bufferIter).Close.func1()
	github.com/ethereum/go-ethereum/p2p/enode/iter.go:299 +0x24
sync.(*Once).doSlow(0x11a175f?, 0x2bfe63e?)
	sync/once.go:78 +0xab
sync.(*Once).Do(...)
	sync/once.go:69
github.com/ethereum/go-ethereum/p2p/enode.(*bufferIter).Close(0x30?)
	github.com/ethereum/go-ethereum/p2p/enode/iter.go:298 +0x36
github.com/ethereum/go-ethereum/p2p/enode.(*FairMix).Close(0xc0004bfea0)
	github.com/ethereum/go-ethereum/p2p/enode/iter.go:379 +0xb7
github.com/ethereum/go-ethereum/eth.(*Ethereum).Stop(0xc000997b00)
	github.com/ethereum/go-ethereum/eth/backend.go:960 +0x4a
github.com/ethereum/go-ethereum/node.(*Node).stopServices(0xc0001362a0, {0xc012e16330, 0x1, 0xc000111410?})
	github.com/ethereum/go-ethereum/node/node.go:333 +0xb3
github.com/ethereum/go-ethereum/node.(*Node).Close(0xc0001362a0)
	github.com/ethereum/go-ethereum/node/node.go:263 +0x167
created by github.com/ethereum/go-ethereum/cmd/utils.StartNode.func1.1 in goroutine 9729
	github.com/ethereum/go-ethereum/cmd/utils/cmd.go:101 +0x78
```

The rootcause of the hang is caused by the extra 1 slot, which was
designed to make sure the routines in `AsyncFilter(...)` can be
finished. This PR fixes it by making sure the extra 1 shot can always be
resumed when node shutdown.

* core: refactor StateProcessor to accept ChainContext interface (#32739)

This pr implements ethereum/go-ethereum#32733
to make StateProcessor more customisable.

## Compatibility notes

This introduces a breaking change to users using geth EVM as a library.
The `NewStateProcessor` function now takes one parameter which has the
chainConfig embedded instead of 2 parameters.

* p2p/enode: fix asyncfilter comment (#32823)

just finisher the sentence

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>

* trie: cleaner array concatenation (#32756)

It uses the slices.Concat and slices.Clone methods available now in Go.

* internal/ethapi: add timestamp to logs in eth_simulate (#32831)

Adds blockTimestamp to the logs in response of eth_simulateV1.

---------

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>

* build: faster gh actions workflow, no ubuntu on appveyor (#32829)

This PR does a few things:

- Sets the gh actions runner sizes for lint (s) and test (l) workflows
- Runs the tests on gh actions in parallel
- Skips fetching the spec tests when unnecessary (on windows in
appveyor)
- Removes ubuntu appveyor runner since it's essentially duplicate of the
gh action workflow now

The gh test seems to go down from ~35min to ~13min.

* cmd/devp2p/internal/ethtest: update to PoS-only test chain (#32850)

* core/rawdb: remove duplicated type storedReceiptRLP (#32820)


Co-authored-by: Felix Lange <fjl@twurst.com>

* eth/protocols/eth: use BlockChain interface in Handshake (#32847)

* cmd/devp2p/internal/ethtest: accept responses in any order (#32834)

In both `TestSimultaneousRequests` and `TestSameRequestID`, we send two
concurrent requests. The client under test is free to respond in either
order, so we need to handle responses both ways.

Also fixes an issue where some generated blob transactions didn't have
any blobs.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>

* core/rawdb: correct misleading comments for state history accessors (#32783)

* eth/filters: terminate pending tx subscription on error (#32794)

Fixes issue #32793. When the pending tx subscription ends, the filter
is removed from `api.filters`, but it is not terminated. There is no other 
way to terminate it, so the subscription will leak, and potentially block
the producer side.

* eth/filters: add `transactionReceipts` subscription (#32697)

- Introduce a new subscription kind `transactionReceipts` to allow clients to
  receive transaction receipts over WebSocket as soon as they are available.
- Accept optional `transactionHashes` filter to subscribe to receipts for specific
  transactions; an empty or omitted filter subscribes to all receipts.
- Preserve the same receipt format as returned by `eth_getTransactionReceipt`.
- Avoid additional HTTP polling, reducing RPC load and latency.

---------

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>

* core/txpool/legacypool: fix validTxMeter to count transactions (#32845)

invalidTxMeter was counting txs, while validTxMeter was counting
accounts. Better make the two comparable.

---------

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>

* eth/protocols/snap: optimize incHash (#32748)

* core/rawdb, triedb/pathdb: introduce trienode history (#32596)

It's a pull request based on the #32523 , implementing the structure of
trienode history.

* ethclient: add SubscribeTransactionReceipts (#32869)

Add `SubscribeTransactionReceipts` for ethclient. This is a complement
to ethereum/go-ethereum#32697.

* node: fix error condition in gzipResponseWriter.init() (#32896)

* core/types: optimize MergeBloom by using bitutil (#32882)

```
goos: darwin
goarch: amd64
pkg: github.com/ethereum/go-ethereum/core/types
cpu: VirtualApple @ 2.50GHz
                                 │   old.txt    │               new.txt               │
                                 │    sec/op    │   sec/op     vs base                │
CreateBloom/small-createbloom-10    1.676µ ± 4%   1.646µ ± 1%   -1.76% (p=0.000 n=10)
CreateBloom/large-createbloom-10    164.8µ ± 3%   164.3µ ± 0%        ~ (p=0.247 n=10)
CreateBloom/small-mergebloom-10    231.60n ± 0%   68.00n ± 0%  -70.64% (p=0.000 n=10)
CreateBloom/large-mergebloom-10    21.803µ ± 3%   5.107µ ± 1%  -76.58% (p=0.000 n=10)
geomean                             6.111µ        3.113µ       -49.06%

                                 │    old.txt     │                new.txt                │
                                 │      B/op      │     B/op      vs base                 │
CreateBloom/small-createbloom-10     112.0 ± 0%       112.0 ± 0%       ~ (p=1.000 n=10) ¹
CreateBloom/large-createbloom-10   10.94Ki ± 0%     10.94Ki ± 0%       ~ (p=0.474 n=10)
CreateBloom/small-mergebloom-10      0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
CreateBloom/large-mergebloom-10      0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
geomean                                         ²                 +0.00%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                                 │   old.txt    │               new.txt               │
                                 │  allocs/op   │ allocs/op   vs base                 │
CreateBloom/small-createbloom-10   6.000 ± 0%     6.000 ± 0%       ~ (p=1.000 n=10) ¹
CreateBloom/large-createbloom-10   600.0 ± 0%     600.0 ± 0%       ~ (p=1.000 n=10) ¹
CreateBloom/small-mergebloom-10    0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
CreateBloom/large-mergebloom-10    0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
geomean                                       ²               +0.00%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean
```

* p2p: rm unused var seedMinTableTime (#32876)

* eth/filters: uninstall subscription in filter apis on error (#32894)

Fix ethereum/go-ethereum#32893.

In the previous ethereum/go-ethereum#32794, it
only handles the pending tx filter, while there are also head and log
filters. This PR applies the patch to all filter APIs and uses `defer`
to maintain code consistency.

* triedb, core/rawdb: implement the partial read in freezer (#32132)

This PR implements the partial read functionalities in the freezer, optimizing
the state history reader by resolving less data from freezer.

---------

Signed-off-by: jsvisa <delweng@gmail.com>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>

* p2p/enode: optimize LogDist (#32887)

This speeds up LogDist by 75% using 64-bit operations instead
of byte-wise XOR.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>

* p2p/enode: optimize DistCmp (#32888)

This speeds up DistCmp by 75% through using 64-bit operations instead of
byte-wise XOR.

* core/txpool/legacypool: move queue out of main txpool (#32270)

This PR move the queue out of the main transaction pool.
For now there should be no functional changes.
I see this as a first step to refactor the legacypool and make the queue
a fully separate concept from the main pending pool.

---------

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
Co-authored-by: Csaba Kiraly <csaba.kiraly@gmail.com>

* cmd/workload: filter fuzzer test (#31613)

This PR adds a `filterfuzz` subcommand to the workload tester that
generates requests similarly to `filtergen` (though with a much smaller
block length limit) and also verifies the results by retrieving all
block receipts in the range and locally filtering out relevant results.
Unlike `filtergen` that operates on the finalized chain range only,
`filterfuzz` does check the head region, actually it seeds a new query
at every new chain head.

* p2p/discover: wait for bootstrap to be done (#32881)

This ensures the node is ready to accept other nodes into the
table before it is used in a test.

Closes #32863

* triedb/pathdb: catch int conversion overflow in 32-bit (#32899)

The limit check for `MaxUint32` is done after the cast to `int`. On 64
bits machines, that will work without a problem. On 32 bits machines,
that will always fail. The compiler catches it and refuses to build.

Note that this only fixes the compiler build. ~~If the limit is above
`MaxInt32` but strictly below `MaxUint32` then this will fail at runtime
and we have another issue.~~ I checked and this should not happen during
regular execution, although it might happen in tests.

* eth/catalyst: remove useless log on enabling Engine API (#32901)

* eth: do not warn on switching from snap sync to full sync (#32900)

This happens normally after a restart, so it is better to use Info level
here.

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>

* core/txpool/legacypool: fix pricedList updates (#32906)

This pr addresses a few issues brought by the #32270 

- Add updates to pricedList after dropping transactions.
- Remove redundant deletions in queue.evictList, since
pool.removeTx(hash, true, true) already performs the removal.
- Prevent duplicate addresses during promotion when Reset is not nil.

* accounts/abi: check presence of payable fallback or receive before proceeding with transfer (#32374)

remove todo

* internal/ethapi: convert legacy blobtx proofs in sendRawTransaction (#32849)

This adds a temporary conversion path for blob transactions with legacy
proof sidecar. This feature will activate after Fusaka. We will phase
this out when the fork has sufficiently settled and client side
libraries have been upgraded to send the new proofs.

* rpc: fix flaky test TestServerWebsocketReadLimit (#32889)

* 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 ethereum/go-ethereum#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>

* p2p/discover: remove hot-spin in table refresh trigger (#32912)

This fixes a regression introduced in #32518. In that PR, we removed the
slowdown logic that would throttle lookups when the table runs empty.
Said logic was originally added in #20389.

Usually it's fine, but there exist pathological cases, such as hive
tests, where the node can only discover one other node, so it can only
ever query that node and won't get any results. In cases like these, we
need to throttle the creation of lookups to avoid crazy CPU usage.

* version: release go-ethereum v1.16.5 stable

* params: Set JovianTime to zero in OptimismTestConfig (ethereum-optimism#742)

* params: Set JovianTime to zero and remove Osaka in OptimismTestConfig

* Unset OsakaTime in OptimismTestConfig

* Fix `eth_simulateV1` after Jovian fork (ethereum-optimism#732)

* fix(eth_simulatev1): Create synthetic Jovian Deposit TX, to not fail in the CalcDAFootprint() function.

* fix(eth_simulatev1): Return block without synthetic Jovian deposit tx.

* fix(eth_simulatev1): Extract JovianDepositTx() from tests, activate Jovian fork based on parent.Time.

* Inject L1 attributes tx in Optimism simulation

* Unexport JovianDepositTx and move to tests

Remove exported JovianDepositTx from core/types and add a local
jovianDepositTx helper in miner tests. Also remove the unused
encoding/binary import from the core/types file and add it to the test
files where needed.

* Pass nil options to sim.execute in test

* Pass nil as second argument in simulation test

* Embed L1 attributes tx in simulator

* Handle Optimism genesis without L1 tx

* Rename finalTxes to prependedTxes

* Remove nil argument from sim.execute calls

* Update internal/ethapi/api.go

Co-authored-by: kustrun <9192608+kustrun@users.noreply.github.com>

---------

Co-authored-by: geoknee <georgeknee@googlemail.com>

* Run go run build/ci.go check_generate (ethereum-optimism#741)

* Run go run build/ci.go check_generate

Unfortunately, the check_generate script doesn't consider eth/ethconfig,
so ci can't catch this.

* Fix check_generate script and add it to ci

* consensus/misc/eip1559: Improve Holocene EIP-1559 params checks (ethereum-optimism#743)

* all: reduce diff to upstream (ethereum-optimism#748)

---------

Signed-off-by: Delweng <delweng@gmail.com>
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
Signed-off-by: jsvisa <delweng@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: wit liu <765765346@qq.com>
Co-authored-by: Matus Kysel <MatusKysel@users.noreply.github.com>
Co-authored-by: lightclient <lightclient@protonmail.com>
Co-authored-by: VolodymyrBg <aqdrgg19@gmail.com>
Co-authored-by: MozirDmitriy <dmitriymozir@gmail.com>
Co-authored-by: Dragan Milic <dragan@netice9.com>
Co-authored-by: Sina M <1591639+s1na@users.noreply.github.com>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: cui <cuiweixie@gmail.com>
Co-authored-by: Delweng <delweng@gmail.com>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
Co-authored-by: GarmashAlex <garmasholeksii@gmail.com>
Co-authored-by: CPerezz <37264926+CPerezz@users.noreply.github.com>
Co-authored-by: lightclient <14004106+lightclient@users.noreply.github.com>
Co-authored-by: futreall <86553580+futreall@users.noreply.github.com>
Co-authored-by: Galoretka <galoretochka@gmail.com>
Co-authored-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Co-authored-by: Yuan-Yao Sung <sungyuanyao@gmail.com>
Co-authored-by: Zach Brown <zach871@proton.me>
Co-authored-by: Martin HS <martin@swende.se>
Co-authored-by: zzzckck <152148891+zzzckck@users.noreply.github.com>
Co-authored-by: hero5512 <lvshuaino@gmail.com>
Co-authored-by: Csaba Kiraly <cskiraly@users.noreply.github.com>
Co-authored-by: Nikita Mescheryakov <root@nikitam.io>
Co-authored-by: sashass1315 <sashass1315@gmail.com>
Co-authored-by: Nicolas Gotchac <ngotchac@gmail.com>
Co-authored-by: Alexey Osipov <me@flcl.me>
Co-authored-by: phrwlk <phrwlk7@gmail.com>
Co-authored-by: CertiK <138698582+CertiK-Geth@users.noreply.github.com>
Co-authored-by: 10gic <github10gic@proton.me>
Co-authored-by: Luke Ma <lukema95@gmail.com>
Co-authored-by: Lewis <lewis.kim@kaia.io>
Co-authored-by: Csaba Kiraly <csaba.kiraly@gmail.com>
Co-authored-by: Felföldi Zsolt <zsfelfoldi@gmail.com>
Co-authored-by: mishraa-G <divyansh.mishra.mec23@itbhu.ac.in>
Co-authored-by: George Knee <georgeknee@googlemail.com>
Co-authored-by: kustrun <9192608+kustrun@users.noreply.github.com>
Co-authored-by: Josh Klopfenstein <git@joshklop.com>
Co-authored-by: Sebastian Stammler <seb@oplabs.co>
Co-authored-by: Josh Klopfenstein <joshklop@oplabs.co>
Co-authored-by: louis.liu <louis.liu@okg.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants