Conversation
Rebuild historical SectionBloom indexes from retained transaction results with engine detection, persisted-head bounds, and failure reporting. Share bloom encoding with the node while preserving the database format. Validate engine handling, index compatibility, reruns, and error paths in the consolidated backfill suite; document operation and known limitations.
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.
What does this PR do?
Adds an offline Toolkit command to rebuild missing historical SectionBloom indexes from retained transaction results:
The command reads
transactionRetStoreand creates or updatessection-bloom. see this issue: #6958. It supports:latest_block_header_numberinproperties). Earlier starts are raised to the first available block; later ends are capped at the persisted header. Negative bounds and inverted ranges are rejected.section-bloom, or fromtransactionRetStorewhen creating it. Missing engine metadata retains the legacy LevelDB default. ARM64 rejects LevelDB before opening or creating databases.Usage and operational requirements are documented in
plugins/README.md.Bloom encoding is shared through
BloomUtilsin the existingcryptomodule. The node'sBloomclass delegates to this utility while retaining its public API. Toolkit decodesTransactionRetdirectly from Protobuf, so the command needs nochainbaseruntime dependency. Keccak hashing, bloom bit ordering, section keys, and the compressed database format remain compatible with the node.Why are these changes required?
Historical blocks processed before v4.8.1 with
isJsonRpcFilterEnableddisabled may lack SectionBloom indexes. Since v4.8.1, index generation is independent of this setting. This command rebuilds missing indexes from retained transaction results for address/topic filtering byeth_getLogs, without replaying the blockchain.This PR has been tested by:
DbBackfillBloomTestpassed, with no failures or skips. Coverage includes engine selection, ARM rejection, persisted-head bounds, explicit zero bounds, validation, progress reporting, and failure summaries, including workerErrorpropagation and original exception causes. Additional tests verify one read/write per changed index per section, zero writes on complete reruns, and recovery after partial section read/write failures.SectionBloomStore, covering the 2047/2048 boundary, concurrent sections, missing target creation, existing bits, repeated runs, empty/missing transaction results, empty bloom values, and malformed Protobuf.BloomUtilsTest,BloomTest,SectionBloomStoreTest,LogBlockQueryTest, andLogsFilterCapsuleTest. Shared encoder tests use an independent Keccak digest and integer-based bit representation.chainbaseand its excluded transitive dependencies are absent.checkstyleMain checkstyleTestandgit diff --checkpassed after the final changes. Encoder validation also includedjavac --release 8forBloomUtilsand the delegatingBloomclass.Automated local validation used macOS ARM64/JDK 17. The standalone command was also validated on Ubuntu x86 with real node data and
-c 16, including an initially emptysection-bloomdatabase. The full repository test suite was not run locally.Benchmark
Measured performance on Ubuntu x86 with 16 workers, using the same block range:
section-bloomdatabasesection-bloomindexesBoth runs processed 3,182 sections, found 6,508,186 blocks with logs, and completed with zero reported errors. The empty-database run wrote exactly
3,182 × 2,048 = 6,516,736index records. With existing indexes, all required bits were already present, so no records were rewritten. These are observed results; throughput depends on the workload, hardware, and cache state.Follow up
None.
Extra details
Stop the node and any other process accessing the database before running the command. The directory must contain
propertiesandtransactionRetStore, with at least one non-zero transaction-result block.storage.transHistory.switchmust have been enabled when the target blocks were processed, and those results must still be present; the tool cannot recover missing transaction results.The command can be rerun after interruption. Multiple backfill processes must not operate on the same database concurrently.
Known limitation: node checkpoint replay may overwrite backfilled bits in sections covered by retained checkpoints. Historical sections outside those checkpoints are unaffected. This edge case is not addressed in this PR.