erigontech / erigontech/erigon

db: fall back when overlay in-memory history is disabled

Open
#23,500 1 comment 0 reactions 2 assignees Claimed by @lupin012 View on GitHub
RPC
Dominant language
Go
Stars
3.6k
Forks
1.5k
Avg merge
1d 16h
Merged PRs (30d)
455

Description

## Problem

When execution runs with `ERIGON_IN_MEM_HISTORY=false`, `TemporalMemBatch.GetAsOf` returns an error for non-receipt domains because the in-memory batch cannot answer historical reads. `HistorySeek` forwards the same result.

Overlay read views consult this `DomainReader` before their backing temporal transaction. Both `MemoryMutation.GetAsOf` / `HistorySeek` and `OverlayTemporalReadView.GetAsOf` / `HistorySeek` currently propagate every reader error, so they never fall through to the backing transaction even though it holds the committed history. RPC requests using a temporal overlay view can therefore fail only while an overlay is published.

The existing error-propagation behavior is otherwise important: a real `DomainReader` failure must not be converted into a miss and answered with stale committed data.

This is separate from #22118, which was fixed by #22460. That issue concerned a commitment state reader leaking between execution batches; this issue concerns the intended fallback behavior of an RPC overlay read view.

## Proposed direction

- Represent disabled in-memory history with a typed error or an explicit capability. Do not match the current error text.
- Fall through to the backing temporal transaction only when the in-memory reader explicitly reports that history is unavailable.
- Continue propagating every other `DomainReader` error.
- Apply the same rule to `GetAsOf` and `HistorySeek` on both overlay read-view implementations.

## Acceptance criteria

- [ ] With in-memory history disabled, an overlay read view returns historical account, storage, and code values from its backing temporal transaction.
- [ ] Receipt-domain reads keep using the in-memory data when available.
- [ ] Genuine `DomainReader` errors still reach the caller.
- [ ] Tests cover `MemoryMutation` and `OverlayTemporalReadView`, and fail before the fix.
- [ ] The implementation does not use string matching to classify the unavailable-history condition.

## Related

- #22533
- #22961
- #22118
- #22460

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.