[wip] rpc/jsonrpc: fix TestEthCallToPrunedBlock to prune via mode, not deprecated tables#21359
Open
AskAlexSharov wants to merge 1 commit into
Open
[wip] rpc/jsonrpc: fix TestEthCallToPrunedBlock to prune via mode, not deprecated tables#21359AskAlexSharov wants to merge 1 commit into
AskAlexSharov wants to merge 1 commit into
Conversation
…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.
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.
Fixes
TestEthCallToPrunedBlockwhich was a false-green test.The original
doPrunecalledPruneTableDupSorton two tables that have no effect:TblAccountVals— domain values table keyed by address, not block number; the prune had no observable effectStorageChangeSetDeprecated— legacy table no longer populated by the domain-based storage systemAs a result the test asserted
require.NoErroron a call that always succeeded regardless of pruning, making the test a tautology (removingdoPrune()left it green).The fix writes a real prune mode flag via
prune.EnsureNotChangedso thatcheckPruneHistory(ineth_api.go) detects the block as pruned and returnsstate.PrunedError. The assertion is updated torequire.ErrorIs(t, err, state.PrunedError). The test is now load-bearing: removingdoPrune()leaves no prune mode in DB,checkPruneHistoryseesArchiveMode(HistoryEnabled()==false),api.Callreturns no error, and the assertion fails.