core: Reject incomplete gRPC responses - #5170
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5170 +/- ##
==========================================
- Coverage 44.83% 37.71% -7.12%
==========================================
Files 265 307 +42
Lines 14620 21350 +6730
==========================================
+ Hits 6555 8053 +1498
- Misses 7313 12287 +4974
- Partials 752 1010 +258 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Summary
Core gRPC responses can omit optional protobuf fields even when the RPC succeeds.
BlockFetcher.IsSyncingcurrently dereferences a missingSyncInfo, and block reconstruction dereferences missingBlockPartvalues, causing the bridge to panic on incomplete responses.Return contextual errors for missing sync information and block parts. The shared
partsToBlockguard protects both block-by-height and block-by-hash streams without duplicate checks.Related to #3816.
Testing
go test ./core -count=1go test -race ./core -run '^(TestBlockFetcherRejectsMissingSyncInfo|TestPartsToBlockRejectsNilPart)$' -count=20go vet ./coregolangci-lint run --new-from-rev=upstream/main ./core/...make lint-importsgo mod tidy -diff./scripts/check-go-mod-parity.sh