Skip to content

integration_test: debug_traceBlockByNumber(pending) now returns an error - #588

Merged
yperbasis merged 1 commit into
mainfrom
awskii/tracing-rejects-pending
Aug 19, 2026
Merged

integration_test: debug_traceBlockByNumber(pending) now returns an error#588
yperbasis merged 1 commit into
mainfrom
awskii/tracing-rejects-pending

Conversation

@awskii

@awskii awskii commented Aug 11, 2026

Copy link
Copy Markdown
Member

Erigon is changing the tracing methods to reject the pending block tag instead of silently answering for a different block.

Those methods resolve and replay on the committed view, which holds no pending block. Today pending falls through to the latest executed block, so debug_traceBlockByNumber("pending") returns a full trace of the head block while the caller asked for pending. go-ethereum either traces a real pending block or errors — it never substitutes another one.

This updates the one fixture that pins the old behaviour. Paired with erigontech/erigon#22533, which needs a release of this repo and an RPC_VERSION bump before its CI goes green.

Changes

  • debug_traceBlockByNumber/test_25.json — expect -32000 "tracing on top of pending is not supported" instead of result: null.

Erigon rejects the pending tag on the tracing methods: they resolve and
replay on the committed view, which holds no pending block, so answering
would trace the latest executed block and report it as pending.

Depends on erigontech/erigon#22533.
awskii added a commit to erigontech/erigon that referenced this pull request Aug 11, 2026
Completes the rejection started for the call methods. debug_traceBlockBy*,
trace_block and trace_replayBlockTransactions resolve tags on the committed
view, where "pending" falls through to the latest executed block, so they
answered for the head block and reported it as the pending request.
go-ethereum either traces a real pending block or errors; it never
substitutes a different one, so answering for latest matches neither branch.

Real pending-block tracing needs a pending state source and is left for
later; until then an explicit error beats a wrong block.

CI note: this changes debug_traceBlockByNumber/test_25 in the rpc-tests
suite, updated in erigontech/rpc-tests#588. mainnet-rpc-integ-tests stays
red until that merges and RPC_VERSION is bumped.
@awskii
awskii requested a review from lupin012 August 11, 2026 06:39
@yperbasis
yperbasis merged commit 840478c into main Aug 19, 2026
@yperbasis
yperbasis deleted the awskii/tracing-rejects-pending branch August 19, 2026 09:20
yperbasis added a commit that referenced this pull request Aug 19, 2026
Remove the stale result member left beside the JSON-RPC error in #588. The corrected fixture matches the pending-trace rejection returned by Erigon.
pull Bot pushed a commit to Dustin4444/erigon that referenced this pull request Aug 25, 2026
During forkchoice flush and commit, the published `BlockOverlay` can be
one block ahead of the MDBX snapshot held by an RPC request. Both are
valid views, but combining an overlay block or transaction with
committed temporal state or history can produce a response that never
existed on-chain.

This PR applies two explicit policies to the migrated handlers:

| Read kind | Selected view |
| --- | --- |
| Head-sensitive, block-table-only reads | One selected overlay
generation, when present |
| Replay, proof, witness, and history reads | One committed database
transaction |

## Behavior

- Overlay-backed helpers preserve an already selected overlay generation
across nested calls. Their non-owning read views can be closed without
closing the shared overlay or the caller's transaction.
- Migrated committed paths keep selector resolution and state or history
reads on one transaction. Immutable headers may use the block LRU after
their exact hash is resolved. Receipt regeneration is the remaining
exception described below.
- Migrated state-backed hash selectors reject non-canonical blocks, and
targets above execution progress fail before reading incomplete state or
history.
- Tracing, simulation, proof, witness, `eth_call`,
`eth_createAccessList`, and GraphQL `call` reject `pending` because they
cannot acquire state matching the requested pending block.
- The raw debug block family consistently returns `null` when it cannot
fully represent a published pending block.
- Migrated tracing, simulation, and Otterscan replay paths avoid state
caches that are not bound to the selected transaction. Request-scoped
proof and simulation domains also avoid the process-wide commitment
branch cache.

## Scope

This PR preserves an overlay generation after it has been selected.
Atomic acquisition of the database snapshot and overlay, including
pinning the absence of an overlay, remains in erigontech#22987. Until then, the
temporary `IsOverlayReadView` marker prevents nested helpers from
replacing an existing overlay view. Adoption by the remaining composite
and independently transacted RPC paths is tracked by erigontech#23416.

Receipt generation remains part of erigontech#23416: the generator can still
select the live overlay internally and use a process-wide state cache
instead of remaining bound to the transaction selected by its caller.

This PR does not change `eth_estimateGas`. Consistent EstimateGas view
selection and safe pending-template handling remain in stacked draft
erigontech#23485.

The generic embedded-daemon latest-state view remains tracked by erigontech#21314.
Remote block readers also require snapshot propagation or result
validation, tracked by erigontech#23416. `overlay_getLogs` selects its range from
committed progress, but its parallel workers still open independent
transactions under the same follow-up.

Related follow-ups cover witness branch-cache isolation (erigontech#22198),
selector and error-policy consolidation (erigontech#23424 and erigontech#23428), coherent
replay-cache reuse (erigontech#23425), transaction-index validation (erigontech#23431), and
call-many state-context validation (erigontech#23444). Overlay-history fallback
when in-memory history is disabled is tracked by erigontech#23500; the historical
state boundary for ad-hoc trace bundles is tracked by erigontech#23501.

## Review map

- View primitives: `db/kv/membatchwithdb/memory_mutation.go`,
`rpc/rpchelper/filters.go`, and `rpc/jsonrpc/eth_api.go`
- Overlay-backed migrations: selected handlers in the raw-debug,
block-count, transaction-lookup, receipt, uncle, Erigon, GraphQL,
Otterscan, and overlay families
- Committed migrations: tracing, logs, simulation, proof, witness, and
debug state endpoints
- Regression coverage: `rpc/jsonrpc/overlay_race_test.go` and
`rpc/jsonrpc/trace_view_consistency_test.go`

## Tests

Regression tests exercise overlay publication, replacement, and
unpublish windows; reorgs; execution progress; pending selectors;
missing data; cache isolation; and endpoint-compatible error behavior.

RPC integration coverage uses the pinned `rpc-tests` release, which
includes the corresponding test correction from
[erigontech/rpc-tests#588](erigontech/rpc-tests#588).

---------

Co-authored-by: awskii <artem.tsskiy@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants