BlockValidation - regenerate missing subtreemeta#468
BlockValidation - regenerate missing subtreemeta#468freemans13 wants to merge 6 commits intobsv-blockchain:mainfrom
Conversation
|
🤖 Claude Code Review Status: Complete No issues found. All previously reported issues have been resolved: ✅ Fixed Issues:
Review Summary:
The changes follow project conventions and integrate cleanly with existing validation flows. |
- Reduce HTTP client timeout from 5 minutes to 30 seconds for faster fail - Differentiate HTTP errors: 404 returns NotFoundError, others return ServiceError Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
🤖 Claude Code Review Status: Complete Current Review: All previous issues have been addressed:
Minor Observation: One potential defensive programming improvement (not a blocker):
Summary: The implementation is solid. The regeneration logic is well-structured with local-first fallback to peers, comprehensive test coverage (7 test cases), and proper error handling. The design correctly uses warn-level logging for regeneration events since this is an exceptional but valid scenario. History:
|
getSubtreeMetaSlice just reads a file from blob store - no need to retry. If the file is missing, regeneration already handles recovery. Co-Authored-By: Claude Opus 4.5 <[email protected]>
…o stu/block-validation-re-generate-subtree-meta
|



Problem
When
getSubtreeMetaSlice()fails to find subtree meta files during block validation, blocks are incorrectly marked invalid even though the underlying subtree data exists to regenerate them. This occurs when:Solution
Add on-demand subtree meta regeneration that attempts to rebuild missing meta files from subtree data (local store first, then peer fallback).
Changes
Deleted
model/tx_fetcher.go(~200 lines removed)Simplified
model/subtree_meta_regenerator.goTxFetcherIinterface dependencyNewSubtreeMetaRegenerator(logger, subtreeStore, peerURLs, apiPrefix)Simplified
Block.Valid()signatureValidationOptions,ValidationOption,WithMetaRegenerator)metaRegenerator SubtreeMetaRegeneratorIas a regular nil-able parameternilwhen regeneration not needed (e.g., block assembly)Updated callers
BlockValidation.go/Server.go(blockvalidation): pass regeneratorServer.go(blockassembly): passnil(just created the subtrees, no regeneration needed)nilRegeneration Flow
Testing
go test ./model/... -run SubtreeMeta- regenerator unit testsgo test ./services/blockvalidation/...- integration testsmake lint- passes