Skip to content

[wip] rpc/jsonrpc: fix TestEthCallToPrunedBlock to prune via mode, not deprecated tables#21359

Open
AskAlexSharov wants to merge 1 commit into
mainfrom
worktree-happy-toasting-raccoon
Open

[wip] rpc/jsonrpc: fix TestEthCallToPrunedBlock to prune via mode, not deprecated tables#21359
AskAlexSharov wants to merge 1 commit into
mainfrom
worktree-happy-toasting-raccoon

Conversation

@AskAlexSharov
Copy link
Copy Markdown
Collaborator

Fixes TestEthCallToPrunedBlock which was a false-green test.

The original doPrune called PruneTableDupSort on two tables that have no effect:

  • TblAccountVals — domain values table keyed by address, not block number; the prune had no observable effect
  • StorageChangeSetDeprecated — legacy table no longer populated by the domain-based storage system

As a result the test asserted require.NoError on a call that always succeeded regardless of pruning, making the test a tautology (removing doPrune() left it green).

The fix writes a real prune mode flag via prune.EnsureNotChanged so that checkPruneHistory (in eth_api.go) detects the block as pruned and returns state.PrunedError. The assertion is updated to require.ErrorIs(t, err, state.PrunedError). The test is now load-bearing: removing doPrune() leaves no prune mode in DB, checkPruneHistory sees ArchiveMode (History Enabled()==false), api.Call returns no error, and the assertion fails.

…ecated tables

doPrune was pruning TblAccountVals (wrong key format for block-number scan) and
StorageChangeSetDeprecated (table not populated in the new domain-based storage
system). Neither had any effect, so removing doPrune() left the test green — a
test that proves nothing.

Replace with prune.EnsureNotChanged to write the prune mode into the DB so that
checkPruneHistory() can correctly detect that block 2 falls in the pruned range
(pruneTo=3, latest=6 → Distance(3) → prunedTo=3 → 2<3 → error). Change the
assertion from require.NoError to require.ErrorIs(state.PrunedError): now
removing doPrune() leaves prune mode unset (DefaultMode, History disabled),
checkPruneHistory returns nil, and the ErrorIs assertion fails — the test is
meaningful again.
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.

1 participant