fix: discovery AyncFilter deadlock on shutdown#3347
Merged
zzzckck merged 2 commits intobnb-chain:developfrom Sep 10, 2025
Merged
fix: discovery AyncFilter deadlock on shutdown#3347zzzckck merged 2 commits intobnb-chain:developfrom
zzzckck merged 2 commits intobnb-chain:developfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a deadlock issue during node shutdown by modifying the AsyncFilter function to properly handle context cancellation. The deadlock occurred when multiple goroutines were stuck trying to read from the f.slots channel during shutdown.
- Replaces blocking channel read with a select statement that respects context cancellation
- Allows goroutines to exit gracefully when the context is cancelled during shutdown
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
galaio
approved these changes
Sep 10, 2025
buddh0
approved these changes
Sep 10, 2025
This was referenced Sep 10, 2025
cskiraly
pushed a commit
to ethereum/go-ethereum
that referenced
this pull request
Oct 2, 2025
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.
constwz
pushed a commit
that referenced
this pull request
Oct 11, 2025
Sahil-4555
pushed a commit
to Sahil-4555/go-ethereum
that referenced
this pull request
Oct 12, 2025
…2572) 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.
atkinsonholly
pushed a commit
to atkinsonholly/ephemery-geth
that referenced
this pull request
Nov 24, 2025
…2572) 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.
prestoalvarez
pushed a commit
to prestoalvarez/go-ethereum
that referenced
this pull request
Nov 27, 2025
…2572) 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.
igor53627
pushed a commit
to igor53627/gethrelay
that referenced
this pull request
Nov 27, 2025
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.
clydemeng
added a commit
to sunny2022da/bsc
that referenced
this pull request
Dec 12, 2025
) * node: fix data race on httpConfig.prefix (#32047) This fixes a data race when accessing the `httpConfig.prefix` field. This field can be modified while the server is running through `enableRPC`. The fix is storing the prefix in the handler, which is accessed through the atomic pointer. alternative to #32035 fixes ethereum/go-ethereum#32019 * Revert "crypto/bn256: default to gnark (#32024)" This reverts commit e0cf89e. * fix: skip storage entries with missing preimage keys (#32051) When `GetKey` is called, a missing preimage can cause the function to return a `nil` key. This, in turn, makes `account.Storage` persist an incorrect value. * ethdb/pebble: lower the compaction debt (#31988) This pull request reduces the threshold for triggering compaction at level0, leading to less compaction debt. This change is helpful in the case of heavy write-load, mitigating the case of heavy write stalls caused by compaction. closes ethereum/go-ethereum#31830 * accounts: fix data race when closing manager (#31982) Fixes a data race on the `wallets` slice when closing account Manager. At the moment, there is a data race between a go-routine calling the Manager's `Close` function and the background go-routine handling most operations on the `Manager`. The `Manager`'s `wallets` field is accessed without proper synchronization. By moving the closing of wallets from the `Close()` function into the background thread, this issue can be resolved. * go.mod: bump golang.org/x/net from 0.36.0 to 0.38.0 (#31658) * crypto/bn256: fix gnark deserialisation (#32055) fixes the gnark deserialisation --------- Co-authored-by: Felix Lange <fjl@twurst.com> * tests/fuzzers: added bn marshaling fuzzers (#32053) Adds marshaling fuzzing for G1 and G2 to oss-fuzz. Also aligns the behavior of the google library to that of gnark and cloudflare, which only ever read the first 64 / 128 bytes of the input, regardless of how long the input is * build: upgrade -dlgo version to Go 1.24.4 (#31978) * eth/catalyst: fetch header on forkchoiceUpdated (#31928) closes ethereum/go-ethereum#31254 --------- Co-authored-by: Gary Rong <garyrong0905@gmail.com> * all: reuse the global hash buffer (#31839) As ethereum/go-ethereum#31769 defined a global hash pool, so we can reuse it, and also remove the unnecessary KeccakState buffering --------- Co-authored-by: Gary Rong <garyrong0905@gmail.com> * crypto/bn256/cloudflare: pull in upstream fix for R27 and R29 usage (#32057) Pulls in cloudflare/bn256#48 to remove usage of R27 and R29 [which are reserved](https://go.dev/doc/asm#arm64). * eth,core: terminate the downloader immediately when shutdown signal is received (#32062) Closes ethereum/go-ethereum#32058 * chore: fix some typos in comment (bnb-chain#3176) * core/rawdb: don't decode the full block body in ReadTransaction (#32027) Reading a single transaction out of a block shouldn't need decoding the entire body --------- Co-authored-by: Felix Lange <fjl@twurst.com> Co-authored-by: Gary Rong <garyrong0905@gmail.com> * chore: nancy and jsutils (bnb-chain#3179) * build: upgrade -dlgo version to Go 1.24.0 (#31159) Co-authored-by: Felix Lange <fjl@twurst.com> * build: filter out .git folder for go generate check (#31265) Fixes lint issue >>> /home/appveyor/.gvm/gos/go1.24.0/bin/go generate ./... ci.go:404: File changed: .git/index ci.go:407: One or more generated files were updated by running 'go generate ./...' exit status 1 * CI: all use go1.24 to build * all: use typed lru (bnb-chain#3175) * core: simplify effectiveTip calculation (#31771) Since we have the effective gas price in the message, we can compute tip by simply subtracting the basefee. No need to recompute the effective price. --------- Co-authored-by: Felix Lange <fjl@twurst.com> * core: consolidate BlockChain constructor options (#31925) In this pull request, the original `CacheConfig` has been renamed to `BlockChainConfig`. Over time, more fields have been added to `CacheConfig` to support blockchain configuration. Such as `ChainHistoryMode`, which clearly extends beyond just caching concerns. Additionally, adding new parameters to the blockchain constructor has become increasingly complicated, since it’s initialized across multiple places in the codebase. A natural solution is to consolidate these arguments into a dedicated configuration struct. As a result, the existing `CacheConfig` has been redefined as `BlockChainConfig`. Some parameters, such as `VmConfig`, `TxLookupLimit`, and `ChainOverrides` have been moved into `BlockChainConfig`. Besides, a few fields in `BlockChainConfig` were renamed, specifically: - `TrieCleanNoPrefetch` -> `NoPrefetch` - `TrieDirtyDisabled` -> `ArchiveMode` Notably, this change won't affect the command line flags or the toml configuration file. It's just an internal refactoring and fully backward-compatible. --------- Co-authored-by: Felix Lange <fjl@twurst.com> * deps: update prysm version to v5.3.2 (bnb-chain#3177) * .gitea: touch cron workflow files * trie: delete secKeyCacheOwner (#31785) The optimization tried to defer allocating the cache map until it was used for the first time. It's a relic from earlier times, when tries were copied often. This seems unnecessary now, so we can just create the map when the trie is created. --------- Co-authored-by: Felix Lange <fjl@twurst.com> * .gitea: show environment in release-ppa.yml * crypto/bn256/gnark: align marshaling behavior (#32065) Aligns the marshaling behavior of gnark to google and cloudflare Co-authored-by: kevaundray <kevtheappdev@gmail.com> * crypto/bn256: add documentation on subgroup checks for G2 (#32066) This PR improves the IsOnCurve methods for BN254 G2 points by: * Clarifying its behavior the docstring, making it explicit that it verifies both the point being on the curve and in the correct subgroup. * Adding an in-line comment explaining the subgroup membership check (c.Mul(Order)). * Minor wording adjustments for readability and consistency. * ethdb: Implement DeleteRange in batch (#31947) implement #31945 --------- Co-authored-by: prpeh <prpeh@proton.me> Co-authored-by: Gary Rong <garyrong0905@gmail.com> * core/state: expose the state reader stats (#31998) This pull request introduces a mechanism to expose statistics from the state reader, specifically related to cache utilization during state prefetching. To improve state access performance, a pair of state readers is constructed with a shared local cache. One reader to execute transactions ahead of time to warm up the cache. The other reader is used by the actual chain processing logic, which can benefit from the prefetched states. This PR adds visibility into how effective the cache is by exposing relevant usage statistics. --------- Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com> Co-authored-by: Csaba Kiraly <csaba.kiraly@gmail.com> * core/state: improve the prefetcher concurrency allowance (#32071) Improve the prefetcher concurrency allowance. * core/state: fix prefetch on single core CPU (#32075) We need at least one prefetch goroutine. SetLimit(0) would block prefetch. Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com> * triedb/pathdb, eth: use double-buffer mechanism in pathdb (#30464) Previously, PathDB used a single buffer to aggregate database writes, which needed to be flushed atomically. However, flushing large amounts of data (e.g., 256MB) caused significant overhead, often blocking the system for around 3 seconds during the flush. To mitigate this overhead and reduce performance spikes, a double-buffer mechanism is introduced. When the active buffer fills up, it is marked as frozen and a background flushing process is triggered. Meanwhile, a new buffer is allocated for incoming writes, allowing operations to continue uninterrupted. This approach reduces system blocking times and provides flexibility in adjusting buffer parameters for improved performance. * eth: quick canceling block inserting when debug_setHead is invoked (#32067) If Geth is engaged in a long-run block synchronization, such as a full syncing over a large number of blocks, invoking `debug_setHead` will cause `downloader.Cancel` to wait for all fetchers to stop first. This can be time-consuming, particularly for the block processing thread. To address this, we manually call `blockchain.StopInsert` to interrupt the blocking processing thread and allow it to exit immediately, and after that call `blockchain.ResumeInsert` to resume the block downloading process. Additionally, we add a sanity check for the input block number of `debug_setHead` to ensure its validity. --------- Signed-off-by: jsvisa <delweng@gmail.com> Co-authored-by: Gary Rong <garyrong0905@gmail.com> * cmd/clef: update readme (#32070) Replaced the outdated and broken link to the Web3 Secret Storage Definition with the current official URL from ethereum.org in the Clef README. This ensures users have access to up-to-date and accurate documentation for the keystore file format. * feat: blind bid serves the validator's best interest (bnb-chain#3158) * core: warm key TransactionIndexTail by writing (bnb-chain#3193) * eth/tracers: prestate lookup EIP7702 delegation account (#32080) Implement ethereum/go-ethereum#32078 Parse and lookup the delegation account if EIP7702 is enabled. --------- Signed-off-by: jsvisa <delweng@gmail.com> * cmd/geth: era-download logic fix (#32081) Downloading from a range was failing because it would return and error early with an error misinterpreting "start-end". --------- Co-authored-by: shantichanal <158101918+shantichanal@users.noreply.github.com> Co-authored-by: Gary Rong <garyrong0905@gmail.com> * miner: default gaslimit 45M (#32087) We believe it is safe to raise the gaslimit to 45M before the Fusaka fork. So this PR changes the default to 45M. * core/rawdb, triedb/pathdb: implement history indexer (#31156) This pull request is part-1 for shipping the core part of archive node in PBSS mode. * cmd/geth, triedb: add pathdb state verification (#32086) This pull request ports the snapshot iteration logic from the legacy implementation. * core, consensus/beacon: defer trie resolution (#31725) Previously, the account trie for a given state root was resolved immediately when the stateDB was created, implying that the trie was always required by the stateDB. However, this assumption no longer holds, especially for path archive nodes, where historical states can be accessed even if the corresponding trie data does not exist. * cmd/utils: fix formatting for beacon flag errors to fit Fatalf form (#32090) Noticed that the errors for the blsync flags were not formatted correctly for `Fatalf(..)`. * eth, triedb/pathdb: permit write buffer allowance in PBSS archive mode (#32091) This pull request fixes a flaw in PBSS archive mode that significantly degrades performance when the mode is enabled. Originally, in hash mode, the dirty trie cache is completely disabled when archive mode is active, in order to disable the in-memory garbage collection mechanism. However, the internal logic in path mode differs significantly, and the dirty trie node cache is essential for maintaining chain insertion performance. Therefore, the cache is now retained in path mode. * core, eth, triedb: serve historical states over RPC (#31161) This is the part-2 for archive node over path mode, which ultimately ships the functionality to serve the historical states * triedb/pathdb: fix journal resolution in pathdb (#32097) This pull request fixes a flaw in the PBSS state iterator, which could return empty account or storage data. In PBSS, multiple in-memory diff layers and a write buffer are maintained. These layers are persisted to the database and reloaded after node restarts. However, since the state data is encoded using RLP, the distinction between nil and an empty byte slice is lost during the encode/decode process. As a result, invalid state values such as `[]byte{}` can appear in PBSS and ultimately be returned by the state iterator. Checkout https://github.com/ethereum/go-ethereum/blob/master/triedb/pathdb/iterator_fast.go#L270 for more iterator details. It's a long-term existent issue and now be activated since the snapshot integration. The error `err="range contains deletion"` will occur when Geth tries to serve other peers with SNAP protocol request. --------- Co-authored-by: Felix Lange <fjl@twurst.com> * all: incorporate state history indexing status into eth_syncing response (#32099) This pull request tracks the state indexing progress in eth_syncing RPC response, i.e. we will return non-null syncing status until indexing has finished. * version: release go-ethereum v1.16.0 stable * version: begin v1.16.1 release cycle * .gitea: trigger PPA upload on tag * .travis.yml: remove travis configuration * hash: remove caching that was decreasing perf (bnb-chain#3146) * all: replace override.prague with osaka (#32093) replace `--override.prague` with `--override.osaka` Signed-off-by: jsvisa <delweng@gmail.com> * node: do not double-wrap KV stores (#32089) For no apparent reason, KV stores were getting wrapped in `nofreezedb` first and then in `freezerdb`. * eth: correct tracer initialization in BlockchainConfig (#32107) core.BlockChainConfig.VmConfig is not a pointer, so setting the Tracer on the `vmConfig` object after it was passed to options does *not* apply it to options.VmConfig This fixes the issue by setting the value directly inside the `options` object and removing the confusing `vmConfig` variable to prevent further mistakes. * miner: fix metric simulateSpeedGauge * .gitea: switch release builds to static linking (#32118) This is to avoid compatibility issues with mismatched glibc versions between the builder and deployment target. Fixes #32102 * .gitea: fix 386 upload * all: clear up `Verify Node` logic (bnb-chain#3199) * miner: change default mev config (bnb-chain#3143) * .gitea: disable cron schedule * triedb: reset state indexer after snap synced (#32104) Fix the issue after initial snap sync with `gcmode=archive` enabled. ``` NewPayload: inserting block failed error="history indexing is out of order, last: null, requested: 1" ``` --------- Signed-off-by: Delweng <delweng@gmail.com> Co-authored-by: Gary Rong <garyrong0905@gmail.com> * eth/filters: add address limit to filters (#31876) The address filter was never checked against a maximum limit, which can be somewhat abusive for API nodes. This PR adds a limit similar to topics ## Description (AI generated) This pull request introduces a new validation to enforce a maximum limit on the number of addresses allowed in filter criteria for Ethereum logs. It includes updates to the `FilterAPI` and `EventSystem` logic, as well as corresponding test cases to ensure the new constraint is properly enforced. ### Core functionality changes: * **Validation for maximum addresses in filter criteria**: - Added a new constant, `maxAddresses`, set to 100, to define the maximum allowable addresses in a filter. - Introduced a new error, `errExceedMaxAddresses`, to handle cases where the number of addresses exceeds the limit. - Updated the `GetLogs` method in `FilterAPI` to validate the number of addresses against `maxAddresses`. - Modified the `UnmarshalJSON` method to return an error if the number of addresses in the input JSON exceeds `maxAddresses`. - Added similar validation to the `SubscribeLogs` method in `EventSystem`. ### Test updates: * **New test cases for address limit validation**: - Added a test in `TestUnmarshalJSONNewFilterArgs` to verify that exceeding the maximum number of addresses triggers the `errExceedMaxAddresses` error. - Updated `TestInvalidLogFilterCreation` to include a test case for an invalid filter with more than `maxAddresses` addresses. - Updated `TestInvalidGetLogsRequest` to test for invalid log requests with excessive addresses. These changes ensure that the system enforces a reasonable limit on the number of addresses in filter criteria, improving robustness and preventing potential performance issues. --------- Co-authored-by: zsfelfoldi <zsfelfoldi@gmail.com> * miner: only recommit bids when no error happens (bnb-chain#3204) * chore: fix problematic comment (bnb-chain#3189) * chore: fix duplicated counter (bnb-chain#3187) * Fix log indexer noise after debug_setHead operations (#31934) ## Summary This PR resolves Issue #31929 by reducing log noise generated by the log indexer after `debug_setHead` operations. ## Problem Description When `debug_setHead` is called to rewind the blockchain, blocks are removed from the database. However, the log indexer's `ChainView` objects may still hold references to these deleted blocks. When `extendNonCanonical()` attempts to access these missing headers, it results in: 1. **Repeated ERROR logs**: `Header not found number=X hash=0x...` 2. **Log noise** that can mask other important errors 3. **User confusion** about whether this indicates a real problem ## Root Cause Analysis The issue occurs because: - `debug_setHead` removes blocks from the blockchain database - Log indexer's `ChainView` may still reference deleted block hashes - `extendNonCanonical()` in `core/filtermaps/chain_view.go` tries to fetch these missing headers - The existing `return false` logic properly handles the error, but logs at ERROR level ## Solution This is a **logging improvement only** - no functional logic changes: ### Changes Made 1. **Log level**: Changed from `ERROR` to `DEBUG` 2. **Log message**: Enhanced with descriptive context about chain view extension 3. **Comments**: Added explanation for when this situation occurs 4. **Behavior**: Maintains existing error handling (`return false` was already present) ### Code Changes ```go // Before log.Error("Header not found", "number", number, "hash", hash) return false // After // Header not found - this can happen after debug_setHead operations // where blocks have been deleted. Return false to indicate the chain view // is no longer valid rather than logging repeated errors. log.Debug("Header not found during chain view extension", "number", number, "hash", hash) return false ``` ## Testing ### Automated Tests - ✅ All existing filtermaps tests pass: `go test ./core/filtermaps -v` - ✅ No regressions in related functionality ### Manual Verification 1. **Before fix**: Started geth in dev mode, generated blocks, called `debug_setHead(3)` → **5 repeated ERROR logs** 2. **After fix**: Same scenario → **4 DEBUG logs, no ERROR noise** ### Test Environment ```bash # Setup test environment rm -rf ./dev-test-data ./build/bin/geth --dev --datadir ./dev-test-data --http --http.api debug,eth,net,web3 --verbosity 4 # Generate test blocks and trigger issue curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"debug_setHead","params":["0x3"],"id":1}' http://localhost:8545 ``` ## Related Issues - Fixes #31929 ## Additional Context This issue was reported as spurious error messages appearing after `debug_setHead` operations. The investigation revealed that while the error handling was functionally correct, the ERROR log level was inappropriate for this expected scenario in development/debugging workflows. The fix maintains full compatibility while significantly improving the debugging experience for developers using `debug_setHead`. --------- Co-authored-by: Sun Tae, Kim <38067691+humblefirm@users.noreply.github.com> Co-authored-by: zsfelfoldi <zsfelfoldi@gmail.com> * core/filtermaps: clean up log format of unindexing message (#32123) Sorry for not fully fixed in ethereum/go-ethereum#31761, now the log format of unindexing message is cleaned up, to make it consistent with the indexing message. * eth/catalyst: fix the log message in newPayloadV4 (#32125) It should be `newPayloadV4 must only be called for prague payloads` for the V4 payload error * refactor: replace []byte(fmt.Sprintf) with fmt.Appendf (bnb-chain#3136) * internal/ethapi: prealloc map for the txpool api (#32110) use `make(map, len(txpool))` to prealloc the map for the txpool content, to avoid the map growing in the loop. * ethapi: reduce some of the wasted effort in GetTransactionReceipt (#32021) Towards ethereum/go-ethereum#26974 --------- Co-authored-by: Gary Rong <garyrong0905@gmail.com> * ethdb: tuning pebble compaction parameter (bnb-chain#3205) * internal: remove unused shh and swarm modules from console (#32073) Similar to ethereum/go-ethereum#31856, remove the not availabe shh, swarm modules in the console. --------- Co-authored-by: Gary Rong <garyrong0905@gmail.com> * core/filtermaps: define APIs for map, epoch calculation (#31659) This pull request refines the filtermap implementation, defining key APIs for map and epoch calculations to improve readability. This pull request doesn't change any logic, it's a pure cleanup. --------- Co-authored-by: zsfelfoldi <zsfelfoldi@gmail.com> * core/types: blockTimestamp in logs is hex-encoded (#32129) closes #32120 * core/rawdb, triedb/pathdb: fix two inaccurate comments (#32130) * refactor: remove outdated prune-block/pruneancient tool, implement it by tail-deletion (bnb-chain#2809) * eth/catalyst: fix edge case in simulated backend (#31871) geth cmd: `geth --dev --dev.period 5` call: `debug.setHead` to rollback several blocks. If the `debug.setHead` call is delayed, it will trigger a panic with a small probability, due to using the null point of `fcResponse.PayloadID`. --------- Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de> * accounts/abi: generate TryPack* methods for abigen v2 bindings (#31692) 1. Fix the error return format. **todo**: ~~`bindtype` needs more complex logic to fix it.~~ ` if err != nil { return nil, err } if err == nil { return obj, nil } ` 2. ~~Return pointer type object to avoid copying the whole struct content.~~ 3. Give the panic decision to the user. 4. Fix empty line at the end of function. **TODO**: ~~fix some related test cases.~~ --------- Co-authored-by: Jared Wasinger <j-wasinger@hotmail.com> * version: release go-ethereum v1.16.1 stable * params: only enable sharedStorage on special blocks (bnb-chain#3209) * consensus/parlia: warn fast node to update to latest hard fork version * chore: make function comment match function names (bnb-chain#3142) * feat: enable shared storage pool (bnb-chain#3197) * chore: fix some minor issues in the comments (bnb-chain#3216) * ethdb : disable blockstore of multidatabase (bnb-chain#3208) * refactor: use the built-in max/min to simplify the code (bnb-chain#3217) * p2p: treat all EVN peer as trust node; (bnb-chain#3212) * chore: fix struct comment (bnb-chain#3207) * jsutils: some minor updates (bnb-chain#3222) * chore: fix some comments (bnb-chain#3220) * doc: update go version required (bnb-chain#3224) * refactor: use slices.Contains to simplify code (bnb-chain#3223) * state: extra check for nano address (bnb-chain#3225) * release: prepare for release v1.5.18 (bnb-chain#3230) * chore: fix some typos (bnb-chain#3231) * ethdb: fix disable freezer when enable multidb (bnb-chain#3233) * build(deps): bump golang.org/x/oauth2 from 0.24.0 to 0.27.0 (bnb-chain#3243) * refactor: use maps.Copy for cleaner map handling (bnb-chain#3235) * freezer: change freeze batch size; (bnb-chain#3251) * release: prepare for release v1.5.19 (bnb-chain#3252) * jsutils: get slash count with specific step size and counter (bnb-chain#3256) * prestate_tracer.js: clean-up (bnb-chain#3257) * jsutil: fix a getSlashCount issue (bnb-chain#3267) * upstream: fix CIs after geth-v1.16.1 merged (#4) * workflows: remove check_tidy * all: fix compile error in test cases * CI: fix the lint CI * CI: rm .gitea * tests: update version of testdata to v17.0 * UT: fix core dir * fix eth dir * fix cmd dir * fix ethclient_test dir * tests: update spec-tests version * accounts: skip TestWaitDeployedCornerCases * CI: fix integration CI * core: remove duplicate codes * p2p: opt enr filter in peer discovery; (bnb-chain#3237) * prefetch: lower prefetch threshold from 100 to 50 (bnb-chain#3274) 100 was for previous 3 seconds block interval, with shorter block interval it is better to be a smaller value, could be helpful for bid simulate and block import * chore: fix some function names in comment (bnb-chain#3272) * core/rawdb: set multiDatabase properly when create ChainFreezer * core/rawdb: remove useless option multiDatabase for chainFreezer * core/rawdb: define useFinalizedForFreeze * all: initial rough correction for code upstream cmd/geth: disable ChainHistoryFlag cmd/utils: remove flag cache.enablesharedpool all: remove disableFreeze eth: disable blockRangeLoop core/vm: remove EVMPool core: new snapshot explicitly only with HashScheme core/filtermaps: leave a todo for filtermaps/checkpoints core: more threads for state prefetch eth: supress the useless lint for blockRangeLoop * eth: don't send BlockRangeUpdateMsg * eth/downloader: fix ancient limit in snap sync (#32188) This pull request fixes an issue in disabling direct-ancient mode in snap sync. Specifically, if `origin >= frozen && origin != 0`, it implies a part of chain data has been written into the key-value store, all the following writes into ancient store scheduled by downloader will be rejected with error `ERROR[07-10|03:46:57.924] Error importing chain data to ancients err="can't add block 1166 hash: the append operation is out-order: have 1166 want 0"`. This issue is detected by the https://github.com/ethpandaops/kurtosis-sync-test, which initiates the first snap sync cycle without the finalized header and implicitly disables the direct-ancient mode. A few seconds later the second snap sync cycle is initiated with the finalized information and direct-ancient mode is enabled incorrectly. * eth/fetcher: fix announcement drop logic (#32210) This PR fixes an issue in the tx_fetcher DoS prevention logic where the code keeps the overflow amount (`want - maxTxAnnounces`) instead of the allowed amount (`maxTxAnnounces - used`). The specific changes are: - Correct slice indexing in the announcement drop logic - Extend the overflow test case to cover the inversion scenario * all: fix outdated ethereum wiki json-rpc json-rpc doc links (#32209) Replace outdated wiki reference with ethereum.org documentation links * core/types: fix CellProofsAt method (#32198) * account/abi/bind/v2: fix TestDeploymentWithOverrides (#32212) The root cause of the flaky test was a nonce conflict caused by async contract deployments. This solution defines a custom deployer with automatic nonce management. * eth/tracers: apply block header overrides correctly (#32183) Fixes #32175. This fixes the scenario where the blockhash opcode would return 0x0 during RPC simulations when using BlockOverrides with a future block number. The root cause was that BlockOverrides.Apply() only modified the vm.BlockContext, but GetHashFn() depends on the actual types.Header.Number to resolve valid historical block hashes. This caused a mismatch and resulted in incorrect behavior during trace and call simulations. --------- Co-authored-by: shantichanal <158101918+shantichanal@users.noreply.github.com> Co-authored-by: lightclient <lightclient@protonmail.com> * eth/protocols/snap: fix negative eta in state progress logging (#32225) * triedb/pathdb: fix incorrect address length in history searching (#32248) We should use account length to check address, else OOB maybe occured Signed-off-by: jsvisa <delweng@gmail.com> * eth/gasestimator: fix potential overflow (#32255) Improve binary search, preventing the potential overflow in certain L2 cases * triedb/pathdb: fix an deadlock in history indexer (#32260) Seems the `signal.result` was not sent back in shorten case, this will cause a deadlock. --------- Signed-off-by: jsvisa <delweng@gmail.com> Co-authored-by: Gary Rong <garyrong0905@gmail.com> * eth/catalyst: fix error message in ExecuteStatelessPayloadV4 (#32269) Correct the error message in the ExecuteStatelessPayloadV4 function to reference newPayloadV4 and the Prague fork, instead of incorrectly referencing newPayloadV3 and Cancun. This improves clarity during debugging and aligns the error message with the actual function and fork being validated. No logic is changed. --------- Co-authored-by: rjl493456442 <garyrong0905@gmail.com> * downloader: fix typos, grammar and formatting (#32288) * ethclient/simulated: Fix flaky rollback test (#32280) This PR addresses a flakiness in the rollback test discussed in ethereum/go-ethereum#32252 I found `nonce` collision caused transactions occasionally fail to send. I tried to change error message in the failed test like: ``` if err = client.SendTransaction(ctx, signedTx); err != nil { t.Fatalf("failed to send transaction: %v, nonce: %d", err, signedTx.Nonce()) } ``` and I occasionally got test failure with this message: ``` === CONT TestFlakyFunction/Run_#100 rollback_test.go:44: failed to send transaction: already known, nonce: 0 --- FAIL: TestFlakyFunction/Run_#100 (0.07s) ``` Although `nonces` are obtained via `PendingNonceAt`, we observed that, in rare cases (approximately 1 in 1000), two transactions from the same sender end up with the same nonce. This likely happens because `tx0` has not yet propagated to the transaction pool before `tx1` requests its nonce. When the test succeeds, `tx0` and `tx1` have nonces `0` and `1`, respectively. However, in rare failures, both transactions end up with nonce `0`. We modified the test to explicitly assign nonces to each transaction. By controlling the nonce values manually, we eliminated the race condition and ensured consistent behavior. After several thousand runs, the flakiness was no longer reproducible in my local environment. Reduced internal polling interval in `pendingStateHasTx()` to speed up test execution without impacting stability. It reduces test time for `TestTransactionRollbackBehavior` from about 7 seconds to 2 seconds. * eth: fix typos and outdated comments (#32324) * eth/filters: fix error when blockHash is used with fromBlock/toBlock (#31877) This introduces an error when the filter has both `blockHash` and `fromBlock`/`toBlock`, since these are mutually exclusive. Seems the tests were actually returning `not found` error, which went undetected since there was no check on the actual returned error in the test. * core/state: delete storagePool further * core: temporarily disable history pruning * core: clear up useless StopPrefetcher * ethdb: remove func HasAncient * core/rawdb: remove MultiDatabase in OpenOptions * core/rawdb: adapt the prune feature exsited in bsc * core: fix temporarily disable history pruning * core/state: not dump trie in fastnode * core/state: add a todo to refactor triePrefetcher * core/state: fix getting from cache when needBadSharedStorage * core: run repair for txIndex loop * core/vm: explict the configure of bigModExp precompile * triedb: align code more closely with geth * ethdb,trie: align code more closely with geth * params: define more forks * ethdb: add a todo to remove ItemAmountInAncient and AncientOffSet * core/types: disable EIP-7594 in BSC (bnb-chain#3291) * api.go: add retry for snapshots stale error (bnb-chain#3290) * fix: set all chain tables to be prunable (bnb-chain#3294) * core/fitermaps: fix final block logic * fix: only enable EVN feature after node get synced (bnb-chain#3309) to fix: bnb-chain#3303 the node will periodically failed to call stakehub before the node is synced * consensus/parlia: ignore client version warning when in history sync (bnb-chain#3308) * core/state: code clear up (bnb-chain#3313) * worker: fix a trie prefetch corner case (bnb-chain#3314) During mining phase, if a new block was just imported, TransferPrefetcher could transfer a TriePrefetcher of previous block to the new block, which would cause later error on OpenTrieStorage of the TriePrefetch routine. * docs: update readme for release types (bnb-chain#3315) * freezer: slow down freeze when live sync; (bnb-chain#3310) * core/filtermaps: stop indexing if target block is pruned * release: prepare for release v1.6.0-alpha (bnb-chain#3322) * ci: fix truffer error (bnb-chain#3326) solc-0.6.4 can not be downloaded from truffle solc-bin * ci: ignore nancy failre of rs/cors@v1.8.2 (bnb-chain#3327) It is an issue reported in rs/cors#170 and fixed by rs/cors#171, which was included in release v1.11.0(Apr 2024): https://github.com/rs/cors/releases/tag/v1.11.0 But v1.8.2 was released in Dec 2021, which may have a lot difference. And this vulnerability is limitted only to RPC nodes with maliciously configuration in config.tion: [Node] HTTPCors = ["<malicious cors>",...] So instead of upgrade to v1.11.0+, simply add it to nancy ignore for now * github: update issue template (bnb-chain#3328) * miner: avoid to commit a bid twice (bnb-chain#3336) * miner: avoid to commit a bid twice * core: wait db writing before setting head * miner: fix comment for tcount * miner: improve warn log for committed work * miner: add committed flag for environment * miner: improve func commit * eth/pebble: use NoSync as write mode (bnb-chain#3337) * FilterMap: update bsc checkpoint file (bnb-chain#3332) * eth/downloader: remove InsertHeaderChain to improve sync speed (bnb-chain#3324) * core/rawdb: remove func AncientOffSet and ItemAmountInAncient (bnb-chain#3319) * chore: fix some minor issues in comment (bnb-chain#3301) * cmd/geth: remove subcmd hbss2pbss and insecure-prune-all (bnb-chain#3346) * fix: discovery AyncFilter deadlock on shutdown (bnb-chain#3347) * core: rework fast node (bnb-chain#3340) * freezer: add debug log for out of bounds access (bnb-chain#3354) * core/rawdb: align more code with upstream (bnb-chain#3348) * log: lower the spam log level (bnb-chain#3357) * release: prepare for release v1.6.1-beta (bnb-chain#3355) * log: downgrade log level when header fetch failed (bnb-chain#3359) * chore: fix SnapSyncWithBlobs UT issues; (bnb-chain#3362) * cmd/utils: set journalfile default to true (bnb-chain#3361) * core/systemcontracts: define fermiUpgrade (bnb-chain#3372) * BEP-619: Short Block Interval Phase Three: 0.45 Seconds (bnb-chain#3367) * ethapi: reject oversize storage keys before hex decode (#32750) (bnb-chain#3373) Bail out of decodeHash when the raw hex string is longer than 32 byte before actually decoding. * Implement BEP-592: Non-Consensus Based Block-Level Access List (bnb-chain#3374) * BEP-590: Extended Voting Rules for Fast Finality Stability (bnb-chain#3368) * BEP-590: Extended Voting Rules for Fast Finality Stability * core/vote: update deadline for voting * websocket: add `transactionReceipts` for receipts notification (bnb-chain#3363) * miner/minerconfig: update config to adapt 100M gaslimit (bnb-chain#3388) * miner/minerconfig: update config to adapt 100M gaslimit * miner/minerconfig: update default GasCeil to 100M * miner/minerconfig: update comment * release: prepare for release v1.6.2 (bnb-chain#3386) * chore: cache receipts (bnb-chain#3391) * feat: implement incremental snapshot (bnb-chain#3390) * build(deps): bump github.com/quic-go/quic-go from 0.48.2 to 0.49.1 Bumps [github.com/quic-go/quic-go](https://github.com/quic-go/quic-go) from 0.48.2 to 0.49.1. - [Release notes](https://github.com/quic-go/quic-go/releases) - [Commits](quic-go/quic-go@v0.48.2...v0.49.1) --- updated-dependencies: - dependency-name: github.com/quic-go/quic-go dependency-version: 0.49.1 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> * feat: EVM execution opcode level optimization (bnb-chain#3395) * fix: add secrets config to nancy ci (bnb-chain#3398) * consensus/parlia: set kAncestorGenerationDepth to 3 in BEP-590 (bnb-chain#3400) * consensus/parlia: fix updateAttestation&improve assembleVoteAttestation (bnb-chain#3397) * core/rawdb: fix WriteBAL (bnb-chain#3403) * miner: validator not inturn backoff before mining (bnb-chain#3404) * fix: change lock to read lock in legacypool (bnb-chain#3407) * miner: add metrics for get pending txs (bnb-chain#3410) * json-rpc-api.md: typo (bnb-chain#3409) * eth: broadcast votes to evn peers regardless of deltaTdThreshold (bnb-chain#3415) * cmd/geth: improve config for sentry nodes when init network (bnb-chain#3416) * jsutil: update some parameter (bnb-chain#3414) * p2p: define ProxyedNodeIds in Config (bnb-chain#3417) * p2p: define ProxyedNodeIds in Config * eth: downgrade log level for setProxyedPeers * cmd/geth: sentry not send txs to validator * cmd/geth: use static nodes when deploy without sentry * cmd/geth: fix TestInitNetworkLocalhost * eth: not broadcast txs directly to proxyed nodes * miner: use latest block as pending block for simplicity (bnb-chain#3419) * miner: use latest block as pending block for simplicity * miner: delete pendingLogs * miner: log time in header (bnb-chain#3422) Co-authored-by: NathanBSC <122502194+NathanBSC@users.noreply.github.com> * eth: increase the delta td threshold to broadcast votes (bnb-chain#3426) * config: update BSC Testnet hardfork time: Ferimi (bnb-chain#3427) expected Testnet Fermi hard fork time: 2025-11-10 02:25:00 AM UTC * miner: improve prefetch mining by using cached reader (bnb-chain#3423) * miner: improve prefetch mining by using cached reader * core/state: handle err when create StateDB for prefetch * core/state: use the same prefetcher when create state for prefetch * core: check statedb --------- Co-authored-by: NathanBSC <122502194+NathanBSC@users.noreply.github.com> * revert: revert the nano check in parlia (bnb-chain#3436) * eth: fix stuck when handleBlockBroadcast (bnb-chain#3435) * build(deps): bump github.com/consensys/gnark-crypto (bnb-chain#3429) Bumps [github.com/consensys/gnark-crypto](https://github.com/consensys/gnark-crypto) from 0.18.0 to 0.18.1. - [Release notes](https://github.com/consensys/gnark-crypto/releases) - [Changelog](https://github.com/Consensys/gnark-crypto/blob/v0.18.1/CHANGELOG.md) - [Commits](Consensys/gnark-crypto@v0.18.0...v0.18.1) --- updated-dependencies: - dependency-name: github.com/consensys/gnark-crypto dependency-version: 0.18.1 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * internal/ethapi: fix eth_simulateV1 (bnb-chain#3433) * eth/tracers: fix crasher in TraceCall with BlockOverrides (bnb-chain#3431) * release: prepare for release v1.6.3 (bnb-chain#3437) * cmd/jsutils: adjust nodereal builders (bnb-chain#3447) * cmd/utils: define OverrideOsaka (bnb-chain#3446) * consensus/parlia: filter by source number when fetching votes (bnb-chain#3449) * TxPool: change lifetime back to 3 hours (bnb-chain#3448) rollback the lifetime change made in PR#3111 3 hours could be reasonable for non-validator nodes * cmd/geth: stop supporting multidatabase flag (bnb-chain#3457) * build(deps): bump golang.org/x/crypto from 0.36.0 to 0.45.0 (bnb-chain#3456) Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.36.0 to 0.45.0. - [Commits](golang/crypto@v0.36.0...v0.45.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-version: 0.45.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: lx <92799281+brilliant-lx@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * params: define MendelTime (bnb-chain#3458) * eth: support fetch commit id info from extra data (bnb-chain#3454) * eth: improve prefetch by using cached reader (bnb-chain#3445) * eth: fix stuck when starting up a new network (bnb-chain#3460) * eth: fix stuck when starting up a new network * eth: fix UT * eth: improve fixing UT * feat: transactionReceipts auto-unsubscribe implementation (bnb-chain#3459) * cmd/geth: config staticnodes for fullnode when init-network (bnb-chain#3462) * refactor: replace context.WithCancel with t.Context (bnb-chain#3285) Signed-off-by: hongmengning <hongmengning@outlook.com> * refactor: use slices.Contains to simplify code (bnb-chain#3245) Signed-off-by: stellrust <gohunter@foxmail.com> * refactor: replace Split in loops with more efficient SplitSeq (bnb-chain#3262) * refactor: replace Split in loops with more efficient SplitSeq Signed-off-by: pinglanlu <pinglanlu@outlook.com> * Update node/api.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Signed-off-by: pinglanlu <pinglanlu@outlook.com> Co-authored-by: buddho <7995985+buddh0@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * refactor: drop legacy // +build comment (bnb-chain#3464) Signed-off-by: rifeplight <rifeplight@outlook.com> * config: update BSC Mainnet hardfork time: Fermi (bnb-chain#3466) * metric: add metric for vote count (bnb-chain#3468) * metric: add metric for vote count * metric: add metric for vote count * .github/workflows: replace BLS for Windows (bnb-chain#3467) * release: prepare for release v1.6.4 (bnb-chain#3470) * release: prepare for release v1.6.4 * version: update version * fix: fix the flag docment (bnb-chain#3472) * feat: add enableMIR in config.toml * fix: fix compilation issue after merge from master --------- Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com> Signed-off-by: jsvisa <delweng@gmail.com> Signed-off-by: Delweng <delweng@gmail.com> Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: hongmengning <hongmengning@outlook.com> Signed-off-by: stellrust <gohunter@foxmail.com> Signed-off-by: pinglanlu <pinglanlu@outlook.com> Signed-off-by: rifeplight <rifeplight@outlook.com> Co-authored-by: Felix Lange <fjl@twurst.com> Co-authored-by: cz <wylbzc4928@gmail.com> Co-authored-by: rjl493456442 <garyrong0905@gmail.com> Co-authored-by: Herbert <herbert.jordan.jun@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: kevaundray <kevtheappdev@gmail.com> Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de> Co-authored-by: levisyin <lilassherl@gmail.com> Co-authored-by: nthumann <nthumanna@gmail.com> Co-authored-by: Stephen Buttolph <stephen@avalabs.org> Co-authored-by: Delweng <delweng@gmail.com> Co-authored-by: 曹家巧 <caojiaqiao@outlook.com> Co-authored-by: Ömer Faruk Irmak <omerfirmak@gmail.com> Co-authored-by: zzzckck <152148891+zzzckck@users.noreply.github.com> Co-authored-by: buddh0 <galaxystroller@gmail.com> Co-authored-by: zhiqiangxu <652732310@qq.com> Co-authored-by: maskpp <maskpp266@gmail.com> Co-authored-by: Antonio Sanso <antonio.sanso@gmail.com> Co-authored-by: Ha DANG <dvietha@gmail.com> Co-authored-by: prpeh <prpeh@proton.me> Co-authored-by: Csaba Kiraly <csaba.kiraly@gmail.com> Co-authored-by: Csaba Kiraly <cskiraly@users.noreply.github.com> Co-authored-by: GarmashAlex <garmasholeksii@gmail.com> Co-authored-by: Mars <zhaolei@pm.me> Co-authored-by: shazam8253 <54690736+shazam8253@users.noreply.github.com> Co-authored-by: shantichanal <158101918+shantichanal@users.noreply.github.com> Co-authored-by: lightclient <14004106+lightclient@users.noreply.github.com> Co-authored-by: Matus Kysel <MatusKysel@users.noreply.github.com> Co-authored-by: Stéphane Duchesneau <stephane.duchesneau@gmail.com> Co-authored-by: Ceyhun Onur <ceyhun.onur@avalabs.org> Co-authored-by: zsfelfoldi <zsfelfoldi@gmail.com> Co-authored-by: chengehe <hechenge@yeah.net> Co-authored-by: will-2012 <117156346+will-2012@users.noreply.github.com> Co-authored-by: Forrest Kim <38067691+ForrestKim42@users.noreply.github.com> Co-authored-by: Sun Tae, Kim <38067691+humblefirm@users.noreply.github.com> Co-authored-by: clonemycode <168618167+clonemycode@users.noreply.github.com> Co-authored-by: wayen <19421226+flywukong@users.noreply.github.com> Co-authored-by: Zhou <DanialZhouMAX@gmail.com> Co-authored-by: galaio <12880651+galaio@users.noreply.github.com> Co-authored-by: Jared Wasinger <j-wasinger@hotmail.com> Co-authored-by: findmyhappy <167661649+findmyhappy@users.noreply.github.com> Co-authored-by: shangchenglumetro <shuang.cui@live.com> Co-authored-by: rustfix <155627174+rustfix@users.noreply.github.com> Co-authored-by: ianlv <168640168+ianlv@users.noreply.github.com> Co-authored-by: Hanlu <liangmulu@outlook.com> Co-authored-by: formless <213398294+allformless@users.noreply.github.com> Co-authored-by: 荆长逯 <jingchanglu@outlook.com> Co-authored-by: kaifulee <52813034+kaifulee@users.noreply.github.com> Co-authored-by: Anna Smith <155628741+socialsister@users.noreply.github.com> Co-authored-by: Eric <45141191+zlacfzy@users.noreply.github.com> Co-authored-by: tanhuaan <tanhuaan@outlook.com> Co-authored-by: Bosul Mun <bsbs8645@snu.ac.kr> Co-authored-by: FT <140458077+zeevick10@users.noreply.github.com> Co-authored-by: steven <wangpeculiar@gmail.com> Co-authored-by: lightclient <lightclient@protonmail.com> Co-authored-by: gzeon <h@arry.io> Co-authored-by: Galoretka <galoretochka@gmail.com> Co-authored-by: Tomás Andróil <tomasandroil@gmail.com> Co-authored-by: kashitaka <takao.w9st.kashima@xica.net> Co-authored-by: VM <112189277+sysvm@users.noreply.github.com> Co-authored-by: alex-10072 <ttalex101@gmail.com> Co-authored-by: deepdring <deepdrink@icloud.com> Co-authored-by: lx <92799281+brilliant-lx@users.noreply.github.com> Co-authored-by: david-ppp <164000748+david-ppp@users.noreply.github.com> Co-authored-by: constwz <122766871+constwz@users.noreply.github.com> Co-authored-by: Roshan <48975233+pythonberg1997@users.noreply.github.com> Co-authored-by: NathanBSC <122502194+NathanBSC@users.noreply.github.com> Co-authored-by: hongmengning <hongmengning@outlook.com> Co-authored-by: stellrust <gohunter@foxmail.com> Co-authored-by: pinglanlu <pinglanlu@outlook.com> Co-authored-by: buddho <7995985+buddh0@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: rifeplight <rifeplight@outlook.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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
It fixes #3343, node hang on shutdown occasionally.
When the hang occurs, there are two routines stuck.
On node start, it will run part of the DiscoveryV4 protocol, which could take considerable time, here is its hang callstack:
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.The reason 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.Rationale
NA
Example
NA
Changes
NA