Skip to content

Commit 696198d

Browse files
Dargon789wit765gzliudandavidjsonnGaloretka
authored
Dargon789/master (#87)
* Update config.yml (#51) Update the CircleCI configuration to use a custom Docker executor with secured Docker Hub credentials, remove the aws-cli orb, and rename the job and workflow to match the web3-defi-game project. CI: Define a custom executor using cimg/base:stable image authenticated via DOCKER_HUB_USER and DOCKER_HUB_PASSWORD Remove the aws-cli orb and its install step Rename the CI job to web3-defi-game-project- and the workflow to my-custom-workflow Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com> * eth/downloader: fix incorrect waitgroup in test `XTestDelivery` (#33047) (#52) Summary by Sourcery Fix a deadlock in the XTestDelivery test by correctly incrementing the WaitGroup before starting the goroutine. Bug Fixes: Correct WaitGroup synchronization in XTestDelivery test by adding the missing wg.Add(1) call. Tests: Add missing wg.Add(1) before launching the goroutine in XTestDelivery to ensure proper synchronization. Co-authored-by: wit liu <wit765765346@gmail.com> * core/state: make test output message readable (#33400) * crypto/signify: fix fuzz test compilation (#33402) The fuzz test file has been broken for a while - it doesn't compile with the `gofuzz` build tag. Two issues: - Line 59: called `SignifySignFile` which doesn't exist (should be `SignFile`) - Line 71: used `:=` instead of `=` for already declared `err` variable * core/overlay: fix incorrect debug log key/value in LoadTransitionState (#32637) * core/state: fix code existence not marked correctly (#33415) When iterating over a map with value types in Go, the loop variable is a copy. In `markCodeExistence`, assigning to `code.exists` modified only the local copy, not the actual map entry, causing the existence flag to always remain false. This resulted in overcounting contract codes in state size statistics, as codes that already existed in the database were incorrectly counted as new. Fix by changing `codes` from `map[common.Address]contractCode` to `map[common.Address]*contractCode`, so mutations apply directly to the struct. * cmd/workload, eth/tracers/native: introduce state proof tests (#32247) This pull request introduces a new workload command, providing the features for `eth_getProof` endpoint test generation and execution. * eth/catalyst: fix invalid timestamp log message (#33440) Fixes a typo in the NewPayload invalid timestamp warning where the parent timestamp was incorrectly logged as the block timestamp. * core: add code read statistics (#33442) * core/txpool/blobpool: remove legacy sidecar conversion (#33352) This PR removes the legacy sidecar conversion logic. After the Osaka fork, the blobpool will accept only blob sidecar version 1. Any remaining version 0 blob transactions, if they still exist, will no longer be eligible for inclusion. Note that conversion at the RPC layer is still supported, and version 0 blob transactions will be automatically converted to version 1 there. * tests/fuzzers: remove unused field from kv struct in rangeproof fuzzer (#33447) Removes the unused `t bool` field from the `kv` struct in the rangeproof fuzzer. * eth/catalyst: return empty response for GetBlobsV2 before Osaka (#33444) Fix #33420 * core, eth: add lock protection in snap sync (#33428) Fixes #33396, #33397, #33398 * graphql: add nil check in block resolver (#33225) Add nil checks for header and block in Block resolver methods to prevent panic when querying non-existent blocks. * core/txpool/blobpool: fix slotter size limit (#33474) Blobs are stored per transaction in the pool, so we need billy to handle up to the per-tx limit, not to the per-block limit. The per-block limit was larger than the per-tx limit, so it not a bug, we just created and handled a few billy files for no reason. Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com> * eth/downloader: fix stale beacon header deletion (#33481) In this PR, two things have been fixed: --- (a) truncate the stale beacon headers with latest snap block Originally, b.filled is used as the indicator for deleting stale beacon headers. This field is set only after synchronization has been scheduled, under the assumption that the skeleton chain is already linked to the local chain. However, the local chain can be mutated via `debug_setHead`, which may cause `b.filled` outdated. For instance, `b.filled` refers to the last head snap block in the last sync cycle while after `debug_setHead`, the head snap block has been rewounded to 1. As a result, Geth can enter an unintended loop: it repeatedly downloads the missing beacon headers for the skeleton chain and attempts to schedule the actual synchronization, but in the final step, all recently fetched headers are removed by `cleanStales` due to the stale `b.filled` value. This issue is addressed by always using the latest snap block as the indicator, without relying on any cached value. However, note that before the skeleton chain is linked to the local chain, the latest snap block will always be below skeleton.tail, and this condition should not be treated as an error. --- (b) merge the subchains once the skeleton chain links to local chain Once the skeleton chain links with local one, it will try to schedule the synchronization by fetching the missing blocks and import them then. It's possible the last subchain already overwrites the previous subchain and results in having two subchains leftover. As a result, an error log will printed https://github.com/ethereum/go-ethereum/blob/master/eth/downloader/skeleton.go#L1074 * console/prompt: use PromptInput in PromptConfirm method (#33445) * params: fix wrong comment (#33503) It seems that the comment for CopyGas was wrongly associated to SloadGas. * trie, go.mod: remove all references to go-verkle and go-ipa (#33461) In order to reduce the amount of code that is embedded into the keeper binary, I am removing all the verkle code that uses go-verkle and go-ipa. This will be followed by further PRs that are more like stubs to replace code when the keeper build is detected. I'm keeping the binary tree of course. This means that you will still see `isVerkle` variables all over the codebase, but they will be renamed when code is touched (i.e. this is not an invitation for 30+ AI slop PRs). --------- Co-authored-by: Gary Rong <garyrong0905@gmail.com> * .github/workflows: preventively close PRs that seem AI-generated (#33414) This is a new step in my crusade against the braindead fad of starting PR titles with a word that is completely redundant with github labels, thus wasting prime first-line real-estate for something that isn't necessary. I noticed that every single one of these PRs are low-quality AI-slop, so I think there is a strong case to be made for these PRs to be auto-closed. A message is added before closing the PR, redirecting to our contribution guidelines, so I expect quality first-time contributors to read them and reopen the PR. In the case of spam PRs, the author is unlikely to revisit a given PR, and so auto-closing might have a positive impact. That's an experiment worth trying, imo. * triedb/pathdb: optimize history indexing efficiency (#33303) This pull request optimizes history indexing by splitting a single large database batch into multiple smaller chunks. Originally, the indexer will resolve a batch of state histories and commit all corresponding index entries atomically together with the indexing marker. While indexing more state histories in a single batch improves efficiency, excessively large batches can cause significant memory issues. To mitigate this, the pull request splits the mega-batch into several smaller batches and flushes them independently during indexing. However, this introduces a potential inconsistency that some index entries may be flushed while the indexing marker is not, and an unclean shutdown may leave the database in a partially updated state. This can corrupt index data. To address this, head truncation is introduced. After a restart, any excessive index entries beyond the expected indexing marker are removed, ensuring the index remains consistent after an unclean shutdown. * beacon/light/sync: clear reqFinalityEpoch on server unregistration (#33483) HeadSync kept reqFinalityEpoch entries for servers after receiving EvUnregistered, while other per-server maps were cleared. This left stale request.Server keys reachable from HeadSync, which can lead to a slow memory leak in setups that dynamically register and unregister servers. The fix adds deletion of the reqFinalityEpoch entry in the EvUnregistered handler. This aligns HeadSync with the cleanup pattern used by other sync modules and keeps the finality request bookkeeping strictly limited to currently registered servers. * cmd/geth: remove deprecated vulnerability check command (#33498) This PR removes the version-check command and its associated logic as discussed in issue #31222. Removed versionCheckCommand from misccmd.go and main.go. Deleted version_check.go and its corresponding tests. Cleaned up testdata/vcheck directory (~800 lines of JSON/signatures removed). Verified build with make geth * core/state/snapshot: fix storageList memory accounting (#33505) * eth/catalyst: implement getBlobsV3 (#33404) This is used by cell-level dissemination (aka partial messages) to give the CL all blobs the EL knows about and let CL communicate efficiently about any other missing blobs. In other words, partial responses from the EL is useful now. See the related (closed) PR: https://github.com/ethereum/execution-apis/pull/674 and the new PR: https://github.com/ethereum/execution-apis/pull/719 * core/blockchain.go: cleanup finalized block on rewind in setHeadBeyondRoot (#33486) Fix #33390 `setHeadBeyondRoot` was failing to invalidate finalized blocks because it compared against the original head instead of the rewound root. This fix updates the comparison to use the post-rewind block number, preventing the node from reporting a finalized block that no longer exists. Also added relevant test cases for it. * eth/fetcher: improve the condition to stall peer in tx fetcher (#32725) Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com> Co-authored-by: Csaba Kiraly <csaba.kiraly@gmail.com> * core/rawdb: add trienode freezer support to InspectFreezerTable (#33515) Adds missing trienode freezer case to InspectFreezerTable, making it consistent with InspectFreezer which already supports it. Co-authored-by: m6xwzzz <maskk.weller@gmail.com> * ethstats: report newPayload processing time to stats server (#33395) Add NewPayloadEvent to track engine API newPayload block processing times and report them to ethstats. This enables monitoring of block processing performance. https://notes.ethereum.org/@savid/block-observability related: https://github.com/ethereum/go-ethereum/pull/33231 --------- Co-authored-by: MariusVanDerWijden <m.vanderwijden@live.de> * core: re-organize the stats category (#33525) Check out https://hackmd.io/dg7rizTyTXuCf2LSa2LsyQ for more details * eth: txs fetch/send log at trace level only (#33541) This logging was too intensive at debug level, it is better to have it at trace level only. Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com> * core/vm: avoid escape to heap (#33537) * core/state, core/tracing: new state update hook (#33490) ### Description Add a new `OnStateUpdate` hook which gets invoked after state is committed. ### Rationale For our particular use case, we need to obtain the state size metrics at every single block when fuly syncing from genesis. With the current state sizer, whenever the node is stopped, the background process must be freshly initialized. During this re-initialization, it can skip some blocks while the node continues executing blocks, causing gaps in the recorded metrics. Using this state update hook allows us to customize our own data persistence logic, and we would never skip blocks upon node restart. --------- Co-authored-by: Gary Rong <garyrong0905@gmail.com> * core/state: add cache statistics of contract code reader (#33532) * internal/flags: update copyright year to 2026 (#33550) * graphql: fix GasPrice for blob and setcode transactions (#33542) Adds BlobTxType and SetCodeTxType to GasPrice switch case, aligning with `MaxFeePerGas` and `MaxPriorityFeePerGas` handling. Co-authored-by: m6xwzzz <maskk.weller@gmail.com> * triedb/pathdb: introduce extension to history index structure (#33399) It's a PR based on #33303 and introduces an approach for trienode history indexing. --- In the current archive node design, resolving a historical trie node at a specific block involves the following steps: - Look up the corresponding trie node index and locate the first entry whose state ID is greater than the target state ID. - Resolve the trie node from the associated trienode history object. A naive approach would be to store mutation records for every trie node, similar to how flat state mutations are recorded. However, the total number of trie nodes is extremely large (approximately 2.4 billion), and the vast majority of them are rarely modified. Creating an index entry for each individual trie node would be very wasteful in both storage and indexing overhead. To address this, we aggregate multiple trie nodes into chunks and index mutations at the chunk level instead. --- For a storage trie, the trie is vertically partitioned into multiple sub tries, each spanning three consecutive levels. The top three levels (1 + 16 + 256 nodes) form the first chunk, and every subsequent three-level segment forms another chunk. ``` Original trie structure Level 0 [ ROOT ] 1 node Level 1 [0] [1] [2] ... [f] 16 nodes Level 2 [00] [01] ... [0f] [10] ... [ff] 256 nodes Level 3 [000] [001] ... [00f] [010] ... [fff] 4096 nodes Level 4 [0000] ... [000f] [0010] ... [001f] ... [ffff] 65536 nodes Vertical split into chunks (3 levels per chunk) Level0 [ ROOT ] 1 chunk Level3 [000] ... [fff] 4096 chunks Level6 [000000] ... [fffffff] 16777216 chunks ``` Within each chunk, there are 273 nodes in total, regardless of the chunk's depth in the trie. ``` Level 0 [ 0 ] 1 node Level 1 [ 1 ] … [ 16 ] 16 nodes Level 2 [ 17 ] … … [ 272 ] 256 nodes ``` Each chunk is uniquely identified by the path prefix of the root node of its corresponding sub-trie. Within a chunk, nodes are identified by a numeric index ranging from 0 to 272. For example, suppose that at block 100, the nodes with paths `[]`, `[0]`, `[f]`, `[00]`, and `[ff]` are modified. The mutation record for chunk 0 is then appended with the following entry: `[100 → [0, 1, 16, 17, 272]]`, `272` is the numeric ID of path `[ff]`. Furthermore, due to the structural properties of the Merkle Patricia Trie, if a child node is modified, all of its ancestors along the same path must also be updated. As a result, in the above example, recording mutations for nodes `00` and `ff` alone is sufficient, as this implicitly indicates that their ancestor nodes `[]`, `[0]` and `[f]` were also modified at block 100. --- Query processing is slightly more complicated. Since trie nodes are indexed at the chunk level, each individual trie node lookup requires an additional filtering step to ensure that a given mutation record actually corresponds to the target trie node. As mentioned earlier, mutation records store only the numeric identifiers of leaf nodes, while ancestor nodes are omitted for storage efficiency. Consequently, when querying an ancestor node, additional checks are required to determine whether the mutation record implicitly represents a modification to that ancestor. Moreover, since trie nodes are indexed at the chunk level, some trie nodes may be updated frequently, causing their mutation records to dominate the index. Queries targeting rarely modified trie nodes would then scan a large amount of irrelevant index data, significantly degrading performance. To address this issue, a bitmap is introduced for each index block and stored in the chunk's metadata. Before loading a specific index block, the bitmap is checked to determine whether the block contains mutation records relevant to the target trie node. If the bitmap indicates that the block does not contain such records, the block is skipped entirely. * ethclient: omit nil address/topics from filter args (#33464) Fixes #33369 This omits "topics" and "addresses" from the filter when they are unspecified. It is required for interoperability with some server implementations that cannot handle `null` for these fields. * rlp, trie, triedb/pathdb: compress trienode history (#32913) This pull request introduces a mechanism to compress trienode history by storing only the node diffs between consecutive versions. - For full nodes, only the modified children are recorded in the history; - For short nodes, only the modified value is stored; If the node type has changed, or if the node is newly created or deleted, the entire node value is stored instead. To mitigate the overhead of reassembling nodes from diffs during history reads, checkpoints are introduced by periodically storing full node values. The current checkpoint interval is set to every 16 mutations, though this parameter may be made configurable in the future. * core/txpool/blobpool: allow gaps in blobpool (#32717) Allow the blobpool to accept blobs out of nonce order Previously, we were dropping blobs that arrived out-of-order. However, since fetch decisions are done on receiver side, out-of-order delivery can happen, leading to inefficiencies. This PR: - adds an in-memory blob tx storage, similar to the queue in the legacypool - a limited number of received txs can be added to this per account - txs waiting in the gapped queue are not processed further and not propagated further until they are unblocked by adding the previos nonce to the blobpool The size of the in-memory storage is currently limited per account, following a slow-start logic. An overall size limit, and a TTL is also enforced for DoS protection. --------- Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com> Co-authored-by: MariusVanDerWijden <m.vanderwijden@live.de> * ethclient: restore BlockReceipts support for `BlockNumberOrHash` objects (#33242) - pass `rpc.BlockNumberOrHash` directly to `eth_getBlockReceipts` so `requireCanonical` and other fields survive - aligns `BlockReceipts` with other `ethclient` methods and re-enables canonical-only receipt queries * tests: check correct revert on invalid tests (#33543) This PR fixes an issue where `evm statetest` would not verify the post-state root hash if the test case expected an exception (e.g. invalid transaction). The fix involves: 1. Modifying `tests/state_test_util.go` in the `Run` method. 2. When an expected error occurs (`err != nil`), we now check if `post.Root` is defined. 3. If defined, we recalculate the intermediate root from the current state (which is reverted to the pre-transaction snapshot upon error). 4. We use `GetChainConfig` and `IsEIP158` to ensure the correct state clearing rules are applied when calculating the root, avoiding regressions on forks that require EIP-158 state clearing. 5. If the calculated root mismatches the expected root, the test now fails. This ensures that state tests are strictly verified against their expected post-state, even for failure scenarios. Fixes issue #33527 --------- Co-authored-by: MariusVanDerWijden <m.vanderwijden@live.de> * core: remove duplicate chainHeadFeed.Send code (#33563) The code was simply duplicate, so we can remove some code lines here. Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com> * core/rawdb: skip missing block bodies during tx unindexing (#33573) This PR fixes an issue where the tx indexer would repeatedly try to “unindex” a block with a missing body, causing a spike in CPU usage. This change skips these blocks and advances the index tail. The fix was verified both manually on a local development chain and with a new test. resolves #33371 * internal/ethapi: refactor RPC tx formatter (#33582) * tests: repair oss-fuzz coverage command (#33304) The coverage build path was generating go test commands with a bogus -tags flag that held the coverpkg value, so the run kept failing. I switched coverbuild to treat the optional argument as an override for -coverpkg and stopped passing coverpkg from the caller. Now the script emits a clean go test invocation that should actually succeed. * rpc: fix limitedBuffer.Write to properly enforce size limit (#33545) Updated the `avail` calculation to correctly compute remaining capacity: `buf.limit - len(buf.output)`, ensuring the buffer never exceeds its configured limit regardless of how many times `Write()` is called. * version: begin v1.17.0 release cycle * core/txpool: drop peers on invalid KZG proofs Co-authored-by: Gary Rong <garyrong0905@gmail.com> Co-authored-by: MariusVanDerWijden <m.vanderwijden@live.de>: * crypto/ecies: use aes blocksize Co-authored-by: Gary Rong <garyrong0905@gmail.com> * accounts/keystore: fix panic in decryptPreSaleKey (#33602) Validate ciphertext length in decryptPreSaleKey, preventing runtime panics on invalid input. * rpc, internal/telemetry: add OpenTelemetry tracing for JSON-RPC calls (#33452) Add Open Telemetry tracing inside the RPC server to help attribute runtime costs within `handler.handleCall()`. In particular, it allows us to distinguish time spent decoding arguments, invoking methods via reflection, and actually executing the method and constructing/encoding JSON responses. --------- Co-authored-by: lightclient <lightclient@protonmail.com> * rpc: extract OpenTelemetry trace context from request headers (#33599) This PR adds support for the extraction of OpenTelemetry trace context from incoming JSON-RPC request headers, allowing geth spans to be linked to upstream traces when present. --------- Co-authored-by: lightclient <lightclient@protonmail.com> * triedb/pathdb: change the bitmap to big endian (#33584) The bitmap is used in compact-encoded trie nodes to indicate which elements have been modified. The bitmap format has been updated to use big-endian encoding. Bit positions are numbered from 0 to 15, where position 0 corresponds to the most significant bit of b[0], and position 15 corresponds to the least significant bit of b[1]. * eth/fetcher: refactor test code (#33610) Remove a large amount of duplicate code from the tx_fetcher tests. --------- Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com> Co-authored-by: lightclient <lightclient@protonmail.com> * core/vm: check if read-only in gas handlers (#33281) This PR causes execution to terminate at the gas handler in the case of sstore/call if they are invoked in a static execution context. This aligns the behavior with EIP 7928 by ensuring that we don't record any state reads in the access list from an SSTORE/CALL in this circumstance. --------- Co-authored-by: lightclient <lightclient@protonmail.com> * core/vm: in selfdestruct gas calculation, return early if there isn't enough gas to cover cold account access costs (#33450) There's no need to perform the subsequent state access on the target if we already know that we are out of gas. This aligns the state access behavior of selfdestruct with EIP-7928 * core: invoke selfdestruct tracer hooks during finalisation (#32919) The core part of this PR that we need to adopt is to move the code and nonce change hook invocations to occur at tx finalization, instead of when the selfdestruct opcode is called. Additionally: * remove `SelfDestruct6780` now that it is essentially the same as `SelfDestruct` just gated by `is new contract` * don't duplicate `BalanceIncreaseSelfdestruct` (transfer to recipient of selfdestruct) in the hooked statedb and in the opcode handler for the selfdestruct opcode. * balance is burned immediately when the beneficiary of the selfdestruct is the sender, and the contract was created in the same transaction. Previously we emit two balance increases to the recipient (see above point), and a balance decrease from the sender. --------- Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com> Co-authored-by: Gary Rong <garyrong0905@gmail.com> Co-authored-by: lightclient <lightclient@protonmail.com> * triedb/pathdb: implement trienode history indexing scheme (#33551) This PR implements the indexing scheme for trie node history. Check https://github.com/ethereum/go-ethereum/pull/33399 for more details * triedb/pathdb: enable trienode history (#32621) It's the part-4 for trienode history. The trienode history persistence has been enabled with this PR by flag `history.trienode <non-negative-number>` * rpc: add a rpc.rangelimit flag (#33163) Adding an RPC flag to limit the block range size for eth_getLogs and eth_newFilter requests. closing https://github.com/ethereum/go-ethereum/issues/24508 --------- Co-authored-by: MariusVanDerWijden <m.vanderwijden@live.de> * accounts/abi/bind/v2: replace rng in test (#33612) Replace deprecated rand.Seed() with rand.New(rand.NewSource()) in dep_tree_test.go. * build: remove circleci config (#33616) This doesn't seem to be used anymore. * rlp: improve SplitListValues allocation efficiency (#33554) * core/vm: add read only protection for opcodes (#33637) This PR reverts a part of changes brought by https://github.com/ethereum/go-ethereum/pull/33281/changes Specifically, read-only protection should always be enforced at the opcode level, regardless of whether the check has already been performed during gas metering. It should act as a gatekeeper, otherwise, it is easy to introduce errors by adding new gas measurement logic without consistently applying the read-only protection. * triedb/pathdb: double check the list availability before regeneration (#33622) Co-authored-by: rjl493456442 <garyrong0905@gmail.com> * internal/debug: add integration with Grafana Pyroscope (#33623) This adds support for Grafana Pyroscope, a continuous profiling solution. The client is configured similarly to metrics, i.e. run geth --pyroscope --pyroscope.server=https://... This commit is a resubmit of #33261 with some changes. --------- Co-authored-by: Carlos Bermudez Porto <cbermudez.dev@gmail.com> * accounts/scwallet: fix panic in decryptAPDU (#33606) Validate ciphertext length in decryptAPDU, preventing runtime panics on invalid input. * core/state: ensure deterministic hook emission order in Finalise (#33644) Fixes #33630 Sort self-destructed addresses before emitting hooks in Finalise() to ensure deterministic ordering and fix flaky test TestHooks_OnCodeChangeV2. --------- Co-authored-by: jwasinger <j-wasinger@hotmail.com> * core/txpool/legacypool: add metric for accounts in txpool (#33646) This PR adds metrics that count the number of accounts having transactions in the txpool. Together with the transaction count this can be used as a simple indicator of the diversity of transactions in the pool. Note: as an alternative implementation, we could use a periodic or event driven update of these Gauges using len. I've preferred this implementation to match what we have for the pool sizes. --------- Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com> * core/types: fix panic on invalid signature length (#33647) Replace panic with error return in decodeSignature to prevent crashes on invalid inputs, and update callers to propagate the error. * core/txpool/legacypool: reset gauges on clear (#33654) Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com> Co-authored-by: rjl493456442 <garyrong0905@gmail.com> * core, eth, internal, triedb/pathdb: enable eth_getProofs for history (#32727) This PR enables the `eth_getProofs ` endpoint against the historical states. * core/vm: update EIP-8024 - Missing immediate byte is now treated as 0x00 (#33614) This PR updates the EIP-8024 implementation to match the latest spec clarification. --------- Co-authored-by: lightclient <lightclient@protonmail.com> * core/txpool/legacypool: fix stale counter (#33653) Calling `pool.priced.Removed` is needed to keep is sync with `pool.all.Remove`. It was called in other occurances, but not here. The counter is used for internal heap management. It was working even without this, just not calling reheap at the intended frequency. Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com> * core: extend the code reader statistics (#33659) This PR extends the statistics of contract code read by adding these fields: - **CacheHitBytes**: the total number of bytes served by cache - **CacheMissBytes**: the total number of bytes read on cache miss - **CodeReadBytes**: the total number of bytes for contract code read * trie: preallocate slice capacity (#33689) This PR optimizes memory allocation in StateTrie.PrefetchAccount() and StateTrie.PrefetchStorage() by preallocating slice capacity when the final size is known. * triedb/pathdb: improve trienode reader for searching (#33681) This PR optimizes the historical trie node reader by reworking how data is accessed and memory is managed, reducing allocation overhead significantly. Specifically: - Instead of decoding an entire history object to locate a specific trie node, the reader now searches directly within the history. - Besides, slice pre-allocation can avoid unnecessary deep-copy significantly. * cmd/keeper: export getInput in wasm builds (#33686) This is a tweak to the wasm build, that expects the `geth_io` namespace to expect a `geth_io` module, providing a `len` and `read` methods. This will be provided by the WASM interface in sp1. This forces an API change on the OpenVM side, but the interface on their side is still being designed, so we should proceed with this change, and we'll make a different tag for OpenVM if this can't work for them. Co-authored-by: wakabat <wakabat@protonmail.com> * core/rawdb: preallocate slice in iterateTransactions (#33690) Preallocate hashes slice with known length instead of using append in a loop. This avoids multiple reallocations during transaction indexing. * trie/bintrie: fix tree key hashing to match spec (#33694) Based on [EIP-7864](https://eips.ethereum.org/EIPS/eip-7864), the tree index should be 32 bytes instead of 31 bytes. ``` def get_tree_key(address: Address32, tree_index: int, sub_index: int): # Assumes STEM_SUBTREE_WIDTH = 256 return tree_hash(address + tree_index.to_bytes(32, "little"))[:31] + bytes( [sub_index] ) ``` * eth/tracers/native: add index to callTracer log (#33629) closes https://github.com/ethereum/go-ethereum/issues/33566 * core: standardize slow block JSON output for cross-client metrics (#33655) Implement standardized JSON format for slow block logging to enable cross-client performance analysis and protocol research. This change is part of the Cross-Client Execution Metrics initiative proposed by Gary Rong: https://hackmd.io/dg7rizTyTXuCf2LSa2LsyQ The standardized metrics enabled data-driven analysis like the EIP-7907 research: https://ethresear.ch/t/data-driven-analysis-on-eip-7907/23850 JSON format includes: - block: number, hash, gas_used, tx_count - timing: execution_ms, total_ms - throughput: mgas_per_sec - state_reads: accounts, storage_slots, bytecodes, code_bytes - state_writes: accounts, storage_slots, bytecodes - cache: account/storage/code hits, misses, hit_rate This should come after merging #33522 --------- Co-authored-by: Gary Rong <garyrong0905@gmail.com> * eth/gasprice: reduce allocations (#33698) Recent pprof from our validator shows ~6% of all allocations because of the gas price oracle. This PR reduces that. * crypto/kzg4844: preallocate proof slice in ComputeCellProofs (#33703) Preallocate the proof slice with the known size instead of growing it via append in a loop. The length is already known from the source slice. * trie: fix flaky test (#33711) * ethdb/pebble: disable seek compaction for Pebble (#33697) This PR restores the previous Pebble configuration, disabling seek compaction. This feature is still needed by hash mode archive node, mitigating the overhead of frequent compaction. * core/txpool/legacypool: clarify and fix non-executable tx heartbeat (#33704) Heartbeats are used to drop non-executable transactions from the queue. The timeout mechanism was not clearly documented, and it was updates also when not necessary. * crypto/ecies: fix ECIES invalid-curve handling (#33669) Fix ECIES invalid-curve handling in RLPx handshake (reject invalid ephemeral pubkeys early) - Add curve validation in crypto/ecies.GenerateShared to reject invalid public keys before ECDH. - Update RLPx PoC test to assert invalid curve points fail with ErrInvalidPublicKey. Motivation / Context RLPx handshake uses ECIES decryption on unauthenticated network input. Prior to this change, an invalid-curve ephemeral public key would proceed into ECDH and only fail at MAC verification, returning ErrInvalidMessage. This allows an oracle on decrypt success/failure and leaves the code path vulnerable to invalid-curve/small-subgroup attacks. The fix enforces IsOnCurve validation up front. * core/state: add bounds check in heap eviction loop (#33712) core/state: add bounds check in heap eviction loop Add len(h) > 0 check before accessing h[0] to prevent potential panic and align with existing heap access patterns in txpool, p2p, and mclock packages. * ethclient: fix timeout param for eth_sendRawTransactionSync (#33693) Fix timeout parameter in eth_sendRawTransactionSync to be an integer instead of hex. The spec has now been clarified on this point. * triedb/pathdb: preallocate slices in decodeRestartTrailer (#33715) Preallocate capacity for `keyOffsets` and `valOffsets` slices in `decodeRestartTrailer` since the exact size (`nRestarts`) is known upfront. --------- Co-authored-by: rjl493456442 <garyrong0905@gmail.com> * signer/core/apitypes: add cell proofs (#32910) Adds support for cell proofs in blob transactions in the signer --------- Co-authored-by: Gary Rong <garyrong0905@gmail.com> * triedb/pathdb: preallocate slices in encode methods (#33736) Preallocates slices with known capacity in `stateSet.encode()` and `StateSetWithOrigin.encode()` methods to eliminate redundant reallocations during serialization. * internal/ethapi: Add timestamp to eth_getTransactionByHash (#33709) Implements https://github.com/ethereum/execution-apis/issues/729 and fixes #33491. It adds blockTimestamp to transaction objects returned by the RPC. * core: miner: reduce allocations in block building (#33375) I recently went on a longer flight and started profiling the geth block production pipeline. This PR contains a bunch of individual fixes split into separate commits. I can drop some if necessary. Benchmarking is not super easy, the benchmark I wrote is a bit non-deterministic. I will try to write a better benchmark later ``` goos: linux goarch: amd64 pkg: github.com/ethereum/go-ethereum/miner cpu: Intel(R) Core(TM) Ultra 7 155U │ /tmp/old.txt │ /tmp/new.txt │ │ sec/op │ sec/op vs base │ BuildPayload-14 141.5µ ± 3% 146.0µ ± 6% ~ (p=0.346 n=200) │ /tmp/old.txt │ /tmp/new.txt │ │ B/op │ B/op vs base │ BuildPayload-14 188.2Ki ± 4% 177.4Ki ± 4% -5.71% (p=0.018 n=200) │ /tmp/old.txt │ /tmp/new.txt │ │ allocs/op │ allocs/op vs base │ BuildPayload-14 2.703k ± 4% 2.453k ± 5% -9.25% (p=0.000 n=200) ``` * trie/bintrie: fix debug_executionWitness for binary tree (#33739) The `Witness` method was not implemented for the binary tree, which caused `debug_excutionWitness` to panic. This PR fixes that. Note that the `TransitionTrie` version isn't implemented, and that's on purpose: more thought must be given to what should go in the global witness. * accounts/usbwallet: add support for Ledger Nano Gen5 (#33297) adds support for the 0x0008 / 0x8000 product ID (Ledger Apex | Nano Gen5). * core/types, internal/ethapi, signer/core/apitypes: avoid copying 128KB blobs in range loops (#33717) kzg4844.Blob is 131072 bytes. Using `for _, blob := range` copies the entire blob on each iteration. With up to 6 blobs per transaction, this wastes ~768KB of memory copies. Switch to index-based iteration and pass pointers directly. * crypto/keccak: vendor in golang.org/x/crypto/sha3 (#33323) The upstream libray has removed the assembly-based implementation of keccak. We need to maintain our own library to avoid a peformance regression. --------- Co-authored-by: lightclient <lightclient@protonmail.com> * core/txpool/legacypool: reduce unnecessary allocations during add (#33701) Not many allocs we save here, but it also cleans up the logic and should speed up the process a tiny bit * metrics: add missing GaugeInfo case in GetAll() (#33748) GetAll did not return GaugeInfo metrics, which affects "chain/info" and "geth/info". * rlp: add RawList for working with un-decoded lists (#33755) This adds a new type wrapper that decodes as a list, but does not actually decode the contents of the list. The type parameter exists as a marker, and enables decoding the elements lazily. RawList can also be used for building a list incrementally. * internal/ethapi: fix error code for revert in eth_simulateV1 (#33007) The error code for revert should be consistent with eth_call and be 3. * core/txpool/blobpool: reset counters and gapped on Clear (#33775) Clear was only used in tests, but it was missing some of the cleanup. Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com> * metrics: add missing ResettingTimer case in GetAll() (#33749) Follow-up to https://github.com/ethereum/go-ethereum/pull/33748 Same issue - ResettingTimer can be registered via loadOrRegister() but GetAll() silently drops it during JSON export. The prometheus exporter handles it fine (collector.go:70), so this is just an oversight in the JSON path. Note: ResettingTimer.Snapshot() resets the timer by design, which is consistent with how the prometheus exporter uses it. * core/rawdb: check pruning tail in HasBody and HasReceipts (#33747) ### Problem `HasBody` and `HasReceipts` returned `true` for pruned blocks because they only checked `isCanon()` which verifies the hash table — but hash/header tables have `prunable: false` while body/receipt tables have `prunable: true`. After `TruncateTail()`, hashes still exist but bodies/receipts are gone. This caused inconsistency: `HasBody()` returns `true`, but `ReadBody()` returns `nil`. ### Changes Both functions now check `db.Tail()` when the block is in ancient store. If `number < tail`, the data has been pruned and the function correctly returns `false`. This aligns `HasBody`/`HasReceipts` behavior with `ReadBody`/`ReadReceipts` and fixes potential issues in `skeleton.linked()` which relies on these checks during sync. * metrics: reduce allocations for metrics (#33699) * core/rawdb: close freezer table in InspectFreezerTable (#33776) * core/vm: add missing PUSH0 handler in EIP-8024 test mini-interpreter (#33785) * core/rawdb: fix incorrect tail value in unindexTransactions log output (#33796) * internal/era: New EraE implementation (#32157) Here is a draft for the New EraE implementation. The code follows along with the spec listed at https://hackmd.io/pIZlxnitSciV5wUgW6W20w. --------- Co-authored-by: shantichanal <158101918+shantichanal@users.noreply.github.com> Co-authored-by: lightclient <lightclient@protonmail.com> Co-authored-by: MariusVanDerWijden <m.vanderwijden@live.de> Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com> * cmd/geth: fix wrong flag names in influxdb metrics error messages (#33804) * core/rawdb: close directory fd on Readdirnames error in cleanup (#33798) * core/vm: 8024 tests should enforce explicit errors (#33787) This PR makes `TestEIP8024_Execution` verify explicit error types (e.g., `ErrStackUnderflow` vs `ErrInvalidOpCode`) rather than accepting any error. It also fails fast on unexpected opcodes in the mini-interpreter to avoid false positives from missing opcode handling. * eth: fix targetView==nil case (#33810) This PR fixes a panic in a corner case situation when a `ChainEvent` is received by `eth.Ethereum.updateFilterMapsHeads()` but the given chain section does not exist in `BlockChain` any more. This can happen during chain rewind because chain events are processed asynchronously. Ignoring the event in this case is ok, the final event will point to the final rewound head and the indexer will be updated. Note that similar issues will not happen once we transition to https://github.com/ethereum/go-ethereum/pull/32292 and the new indexer built on top of this. Until then, the current fix should be fine. * ethdb/pebble: fix CompactionDebtConcurrency comment (#33805) * trie: fix embedded node size validation (#33803) The `decodeRef` function used `size > hashLen` to reject oversized embedded nodes, but this incorrectly allowed nodes of exactly 32 bytes through. The encoding side (hasher.go, stacktrie.go) consistently uses `len(enc) < 32` to decide whether to embed a node inline, meaning nodes of 32+ bytes are always hash-referenced. The error message itself already stated `want size < 32`, confirming the intended threshold. Changed `size > hashLen` to `size >= hashLen` in `decodeRef` to align the decoding validation with the encoding logic, the Yellow Paper spec, and the surrounding comments. * ethclient/gethclient: callTracer methods (#31510) Added methods `TraceCallWithCallTracer` and `TraceTransactionWithCallTracer`. Fixes #28182 --------- Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com> * trie/bintrie: use correct key mapping in GetStorage and DeleteStorage (#33807) GetStorage and DeleteStorage used GetBinaryTreeKey to compute the tree key, while UpdateStorage used GetBinaryTreeKeyStorageSlot. The latter applies storage slot remapping (header offset for slots <64, main storage prefix for the rest), so reads and deletes were targeting different tree locations than writes. Replace GetBinaryTreeKey with GetBinaryTreeKeyStorageSlot in both GetStorage and DeleteStorage to match UpdateStorage. Add a regression test that verifies the write→read→delete→read round-trip for main storage slots. * rlp: return Iterator as non-pointer (#33818) Most uses of the iterator are like this: it, _ := rlp.NewListIterator(data) for it.Next() { do(it.Value()) } This doesn't require the iterator to be a pointer and it's better to have it stack-allocated. AFAIK the compiler cannot prove it is OK to stack-allocate when it is returned as a pointer because the methods of `Iterator` use pointer receiver and also mutate the object. The iterator type was not exported until very recently, so I think it is still OK to change this API. * cmd/evm/internal/t8ntool, core/rawdb: fix RLP iterator error handling (#33820) This fixes two cases where `Iterator.Err()` was misused. The method will only return an error after `Next()` has returned false, so it makes no sense to check for the error within the loop itself. * triedb/pathdb: return nodeLoc by value to avoid heap allocation (#33819) * eth/tracers: tests for bad block tracing (#33821) Fixes #30833 * internal/era: update eraE type IDs to match spec (#33827) Update to match the spec: https://github.com/eth-clients/e2store-format-specs/pull/16 --------- Co-authored-by: lightclient <lightclient@protonmail.com> * node: http2 for JSON-RPC API (#33812) The reasoning for using the cleartext format here is that the JSON-RPC API is internal only. Providers which expose it publicly already put it behind a proxy which handles also the encryption. * rlp: add AppendRaw method to RawList (#33834) This is helpful when building a list from already-encoded elements. * core/state: make test output message readable (ethereum#33400) (#82) * core/state: make test output message readable (#33400) * crypto/signify: fix fuzz test compilation (#33402) The fuzz test file has been broken for a while - it doesn't compile with the `gofuzz` build tag. Two issues: - Line 59: called `SignifySignFile` which doesn't exist (should be `SignFile`) - Line 71: used `:=` instead of `=` for already declared `err` variable * core/overlay: fix incorrect debug log key/value in LoadTransitionState (#32637) * core/state: fix code existence not marked correctly (#33415) When iterating over a map with value types in Go, the loop variable is a copy. In `markCodeExistence`, assigning to `code.exists` modified only the local copy, not the actual map entry, causing the existence flag to always remain false. This resulted in overcounting contract codes in state size statistics, as codes that already existed in the database were incorrectly counted as new. Fix by changing `codes` from `map[common.Address]contractCode` to `map[common.Address]*contractCode`, so mutations apply directly to the struct. * cmd/workload, eth/tracers/native: introduce state proof tests (#32247) This pull request introduces a new workload command, providing the features for `eth_getProof` endpoint test generation and execution. * eth/catalyst: fix invalid timestamp log message (#33440) Fixes a typo in the NewPayload invalid timestamp warning where the parent timestamp was incorrectly logged as the block timestamp. * core: add code read statistics (#33442) * core/txpool/blobpool: remove legacy sidecar conversion (#33352) This PR removes the legacy sidecar conversion logic. After the Osaka fork, the blobpool will accept only blob sidecar version 1. Any remaining version 0 blob transactions, if they still exist, will no longer be eligible for inclusion. Note that conversion at the RPC layer is still supported, and version 0 blob transactions will be automatically converted to version 1 there. * tests/fuzzers: remove unused field from kv struct in rangeproof fuzzer (#33447) Removes the unused `t bool` field from the `kv` struct in the rangeproof fuzzer. * eth/catalyst: return empty response for GetBlobsV2 before Osaka (#33444) Fix #33420 * core, eth: add lock protection in snap sync (#33428) Fixes #33396, #33397, #33398 * graphql: add nil check in block resolver (#33225) Add nil checks for header and block in Block resolver methods to prevent panic when querying non-existent blocks. * core/txpool/blobpool: fix slotter size limit (#33474) Blobs are stored per transaction in the pool, so we need billy to handle up to the per-tx limit, not to the per-block limit. The per-block limit was larger than the per-tx limit, so it not a bug, we just created and handled a few billy files for no reason. Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com> * eth/downloader: fix stale beacon header deletion (#33481) In this PR, two things have been fixed: --- (a) truncate the stale beacon headers with latest snap block Originally, b.filled is used as the indicator for deleting stale beacon headers. This field is set only after synchronization has been scheduled, under the assumption that the skeleton chain is already linked to the local chain. However, the local chain can be mutated via `debug_setHead`, which may cause `b.filled` outdated. For instance, `b.filled` refers to the last head snap block in the last sync cycle while after `debug_setHead`, the head snap block has been rewounded to 1. As a result, Geth can enter an unintended loop: it repeatedly downloads the missing beacon headers for the skeleton chain and attempts to schedule the actual synchronization, but in the final step, all recently fetched headers are removed by `cleanStales` due to the stale `b.filled` value. This issue is addressed by always using the latest snap block as the indicator, without relying on any cached value. However, note that before the skeleton chain is linked to the local chain, the latest snap block will always be below skeleton.tail, and this condition should not be treated as an error. --- (b) merge the subchains once the skeleton chain links to local chain Once the skeleton chain links with local one, it will try to schedule the synchronization by fetching the missing blocks and import them then. It's possible the last subchain already overwrites the previous subchain and results in having two subchains leftover. As a result, an error log will printed https://github.com/ethereum/go-ethereum/blob/master/eth/downloader/skeleton.go#L1074 * console/prompt: use PromptInput in PromptConfirm method (#33445) * params: fix wrong comment (#33503) It seems that the comment for CopyGas was wrongly associated to SloadGas. * trie, go.mod: remove all references to go-verkle and go-ipa (#33461) In order to reduce the amount of code that is embedded into the keeper binary, I am removing all the verkle code that uses go-verkle and go-ipa. This will be followed by further PRs that are more like stubs to replace code when the keeper build is detected. I'm keeping the binary tree of course. This means that you will still see `isVerkle` variables all over the codebase, but they will be renamed when code is touched (i.e. this is not an invitation for 30+ AI slop PRs). --------- Co-authored-by: Gary Rong <garyrong0905@gmail.com> * .github/workflows: preventively close PRs that seem AI-generated (#33414) This is a new step in my crusade against the braindead fad of starting PR titles with a word that is completely redundant with github labels, thus wasting prime first-line real-estate for something that isn't necessary. I noticed that every single one of these PRs are low-quality AI-slop, so I think there is a strong case to be made for these PRs to be auto-closed. A message is added before closing the PR, redirecting to our contribution guidelines, so I expect quality first-time contributors to read them and reopen the PR. In the case of spam PRs, the author is unlikely to revisit a given PR, and so auto-closing might have a positive impact. That's an experiment worth trying, imo. * triedb/pathdb: optimize history indexing efficiency (#33303) This pull request optimizes history indexing by splitting a single large database batch into multiple smaller chunks. Originally, the indexer will resolve a batch of state histories and commit all corresponding index entries atomically together with the indexing marker. While indexing more state histories in a single batch improves efficiency, excessively large batches can cause significant memory issues. To mitigate this, the pull request splits the mega-batch into several smaller batches and flushes them independently during indexing. However, this introduces a potential inconsistency that some index entries may be flushed while the indexing marker is not, and an unclean shutdown may leave the database in a partially updated state. This can corrupt index data. To address this, head truncation is introduced. After a restart, any excessive index entries beyond the expected indexing marker are removed, ensuring the index remains consistent after an unclean shutdown. * beacon/light/sync: clear reqFinalityEpoch on server unregistration (#33483) HeadSync kept reqFinalityEpoch entries for servers after receiving EvUnregistered, while other per-server maps were cleared. This left stale request.Server keys reachable from HeadSync, which can lead to a slow memory leak in setups that dynamically register and unregister servers. The fix adds deletion of the reqFinalityEpoch entry in the EvUnregistered handler. This aligns HeadSync with the cleanup pattern used by other sync modules and keeps the finality request bookkeeping strictly limited to currently registered servers. * cmd/geth: remove deprecated vulnerability check command (#33498) This PR removes the version-check command and its associated logic as discussed in issue #31222. Removed versionCheckCommand from misccmd.go and main.go. Deleted version_check.go and its corresponding tests. Cleaned up testdata/vcheck directory (~800 lines of JSON/signatures removed). Verified build with make geth * core/state/snapshot: fix storageList memory accounting (#33505) * eth/catalyst: implement getBlobsV3 (#33404) This is used by cell-level dissemination (aka partial messages) to give the CL all blobs the EL knows about and let CL communicate efficiently about any other missing blobs. In other words, partial responses from the EL is useful now. See the related (closed) PR: https://github.com/ethereum/execution-apis/pull/674 and the new PR: https://github.com/ethereum/execution-apis/pull/719 * core/blockchain.go: cleanup finalized block on rewind in setHeadBeyondRoot (#33486) Fix #33390 `setHeadBeyondRoot` was failing to invalidate finalized blocks because it compared against the original head instead of the rewound root. This fix updates the comparison to use the post-rewind block number, preventing the node from reporting a finalized block that no longer exists. Also added relevant test cases for it. * eth/fetcher: improve the condition to stall peer in tx fetcher (#32725) Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com> Co-authored-by: Csaba Kiraly <csaba.kiraly@gmail.com> * core/rawdb: add trienode freezer support to InspectFreezerTable (#33515) Adds missing trienode freezer case to InspectFreezerTable, making it consistent with InspectFreezer which already supports it. Co-authored-by: m6xwzzz <maskk.weller@gmail.com> * ethstats: report newPayload processing time to stats server (#33395) Add NewPayloadEvent to track engine API newPayload block processing times and report them to ethstats. This enables monitoring of block processing performance. https://notes.ethereum.org/@savid/block-observability related: https://github.com/ethereum/go-ethereum/pull/33231 --------- Co-authored-by: MariusVanDerWijden <m.vanderwijden@live.de> * core: re-organize the stats category (#33525) Check out https://hackmd.io/dg7rizTyTXuCf2LSa2LsyQ for more details * eth: txs fetch/send log at trace level only (#33541) This logging was too intensive at debug level, it is better to have it at trace level only. Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com> * core/vm: avoid escape to heap (#33537) * core/state, core/tracing: new state update hook (#33490) ### Description Add a new `OnStateUpdate` hook which gets invoked after state is committed. ### Rationale For our particular use case, we need to obtain the state size metrics at every single block when fuly syncing from genesis. With the current state sizer, whenever the node is stopped, the background process must be freshly initialized. During this re-initialization, it can skip some blocks while the node continues executing blocks, causing gaps in the recorded metrics. Using this state update hook allows us to customize our own data persistence logic, and we would never skip blocks upon node restart. --------- Co-authored-by: Gary Rong <garyrong0905@gmail.com> * core/state: add cache statistics of contract code reader (#33532) * internal/flags: update copyright year to 2026 (#33550) * graphql: fix GasPrice for blob and setcode transactions (#33542) Adds BlobTxType and SetCodeTxType to GasPrice switch case, aligning with `MaxFeePerGas` and `MaxPriorityFeePerGas` handling. Co-authored-by: m6xwzzz <maskk.weller@gmail.com> * triedb/pathdb: introduce extension to history index structure (#33399) It's a PR based on #33303 and introduces an approach for trienode history indexing. --- In the current archive node design, resolving a historical trie node at a specific block involves the following steps: - Look up the corresponding trie node index and locate the first entry whose state ID is greater than the target state ID. - Resolve the trie node from the associated trienode history object. A naive approach would be to store mutation records for every trie node, similar to how flat state mutations are recorded. However, the total number of trie nodes is extremely large (approximately 2.4 billion), and the vast majority of them are rarely modified. Creating an index entry for each individual trie node would be very wasteful in both storage and indexing overhead. To address this, we aggregate multiple trie nodes into chunks and index mutations at the chunk level instead. --- For a storage trie, the trie is vertically partitioned into multiple sub tries, each spanning three consecutive levels. The top three levels (1 + 16 + 256 nodes) form the first chunk, and every subsequent three-level segment forms another chunk. ``` Original trie structure Level 0 [ ROOT ] 1 node Level 1 [0] [1] [2] ... [f] 16 nodes Level 2 [00] [01] ... [0f] [10] ... [ff] 256 nodes Level 3 [000] [001] ... [00f] [010] ... [fff] 4096 nodes Level 4 [0000] ... [000f] [0010] ... [001f] ... [ffff] 65536 nodes Vertical split into chunks (3 levels per chunk) Level0 [ ROOT ] 1 chunk Level3 [000] ... [fff] 4096 chunks Level6 [000000] ... [fffffff] 16777216 chunks ``` Within each chunk, there are 273 nodes in total, regardless of the chunk's depth in the trie. ``` Level 0 [ 0 ] 1 node Level 1 [ 1 ] … [ 16 ] 16 nodes Level 2 [ 17 ] … … [ 272 ] 256 nodes ``` Each chunk is uniquely identified by the path prefix of the root node of its corresponding sub-trie. Within a chunk, nodes are identified by a numeric index ranging from 0 to 272. For example, suppose that at block 100, the nodes with paths `[]`, `[0]`, `[f]`, `[00]`, and `[ff]` are modified. The mutation record for chunk 0 is then appended with the following entry: `[100 → [0, 1, 16, 17, 272]]`, `272` is the numeric ID of path `[ff]`. Furthermore, due to the structural properties of the Merkle Patricia Trie, if a child node is modified, all of its ancestors along the same path must also be updated. As a result, in the above example, recording mutations for nodes `00` and `ff` alone is sufficient, as this implicitly indicates that their ancestor nodes `[]`, `[0]` and `[f]` were also modified at block 100. --- Query processing is slightly more complicated. Since trie nodes are indexed at the chunk level, each individual trie node lookup requires an additional filtering step to ensure that a given mutation record actually corresponds to the target trie node. As mentioned earlier, mutation records store only the numeric identifiers of leaf nodes, while ancestor nodes are omitted for storage efficiency. Consequently, when querying an ancestor node, additional checks are required to determine whether the mutation record implicitly represents a modification to that ancestor. Moreover, since trie nodes are indexed at the chunk level, some trie nodes may be updated frequently, causing their mutation records to dominate the index. Queries targeting rarely modified trie nodes would then scan a large amount of irrelevant index data, significantly degrading performance. To address this issue, a bitmap is introduced for each index block and stored in the chunk's metadata. Before loading a specific index block, the bitmap is checked to determine whether the block contains mutation records relevant to the target trie node. If the bitmap indicates that the block does not contain such records, the block is skipped entirely. * ethclient: omit nil address/topics from filter args (#33464) Fixes #33369 This omits "topics" and "addresses" from the filter when they are unspecified. It is required for interoperability with some server implementations that cannot handle `null` for these fields. * rlp, trie, triedb/pathdb: compress trienode history (#32913) This pull request introduces a mechanism to compress trienode history by storing only the node diffs between consecutive versions. - For full nodes, only the modified children are recorded in the history; - For short nodes, only the modified value is stored; If the node type has changed, or if the node is newly created or deleted, the entire node value is stored instead. To mitigate the overhead of reassembling nodes from diffs during history reads, checkpoints are introduced by periodically storing full node values. The current checkpoint interval is set to every 16 mutations, though this parameter may be made configurable in the future. * core/txpool/blobpool: allow gaps in blobpool (#32717) Allow the blobpool to accept blobs out of nonce order Previously, we were dropping blobs that arrived out-of-order. However, since fetch decisions are done on receiver side, out-of-order delivery can happen, leading to inefficiencies. This PR: - adds an in-memory blob tx storage, similar to the queue in the legacypool - a limited number of received txs can be added to this per account - txs waiting in the gapped queue are not processed further and not propagated further until they are unblocked by adding the previos nonce to the blobpool The size of the in-memory storage is currently limited per account, following a slow-start logic. An overall size limit, and a TTL is also enforced for DoS protection. --------- Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com> Co-authored-by: MariusVanDerWijden <m.vanderwijden@live.de> * ethclient: restore BlockReceipts support for `BlockNumberOrHash` objects (#33242) - pass `rpc.BlockNumberOrHash` directly to `eth_getBlockReceipts` so `requireCanonical` and other fields survive - aligns `BlockReceipts` with other `ethclient` methods and re-enables canonical-only receipt queries * tests: check correct revert on invalid tests (#33543) This PR fixes an issue where `evm statetest` would not verify the post-state root hash if the test case expected an exception (e.g. invalid transaction). The fix involves: 1. Modifying `tests/state_test_util.go` in the `Run` method. 2. When an expected error occurs (`err != nil`), we now check if `post.Root` is defined. 3. If defined, we recalculate the intermediate root from the current state (which is reverted to the pre-transaction snapshot upon error). 4. We use `GetChainConfig` and `IsEIP158` to ensure the correct state clearing rules are applied when calculating the root, avoiding regressions on forks that require EIP-158 state clearing. 5. If the calculated root mismatches the expected root, the test now fails. This ensures that state tests are strictly verified against their expected post-state, even for failure scenarios. Fixes issue #33527 --------- Co-authored-by: MariusVanDerWijden <m.vanderwijden@live.de> * core: remove duplicate chainHeadFeed.Send code (#33563) The code was simply duplicate, so we can remove some code lines here. Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com> * core/rawdb: skip missing block bodies during tx unindexing (#33573) This PR fixes an issue where the tx indexer would repeatedly try to “unindex” a block with a missing body, causing a spike in CPU usage. This change skips these blocks and advances the index tail. The fix was verified both manually on a local development chain and with a new test. resolves #33371 * internal/ethapi: refactor RPC tx formatter (#33582) * tests: repair oss-fuzz coverage command (#33304) The coverage build path was generating go test commands with a bogus -tags flag that held the coverpkg value, so the run kept failing. I switched coverbuild to treat the optional argument as an override for -coverpkg and stopped passing coverpkg from the caller. Now the script emits a clean go test invocation that should actually succeed. * rpc: fix limitedBuffer.Write to properly enforce size limit (#33545) Updated the `avail` calculation to correctly compute remaining capacity: `buf.limit - len(buf.output)`, ensuring the buffer never exceeds its configured limit regardless of how many times `Write()` is called. * version: begin v1.17.0 release cycle * core/txpool: drop peers on invalid KZG proofs Co-authored-by: Gary Rong <garyrong0905@gmail.com> Co-authored-by: MariusVanDerWijden <m.vanderwijden@live.de>: * crypto/ecies: use aes blocksize Co-authored-by: Gary Rong <garyrong0905@gmail.com> * accounts/keystore: fix panic in decryptPreSaleKey (#33602) Validate ciphertext length in decryptPreSaleKey, preventing runtime panics on invalid input. * rpc, internal/telemetry: add OpenTelemetry tracing for JSON-RPC calls (#33452) Add Open Telemetry tracing inside the RPC server to help attribute runtime costs within `handler.handleCall()`. In particular, it allows us to distinguish time spent decoding arguments, invoking methods via reflection, and actually executing the method and constructing/encoding JSON responses. --------- Co-authored-by: lightclient <lightclient@protonmail.com> * rpc: extract OpenTelemetry trace context from request headers (#33599) This PR adds support for the extraction of OpenTelemetry trace context from…
1 parent 6e735ca commit 696198d

0 file changed

File tree

    0 commit comments

    Comments
     (0)