block proposal extra checks#7882
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feat/testnet-fixes #7882 +/- ##
======================================================
+ Coverage 77.56% 77.62% +0.06%
======================================================
Files 885 885
Lines 125400 125414 +14
======================================================
+ Hits 97264 97356 +92
+ Misses 21673 21578 -95
- Partials 6463 6480 +17 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds an extra validation step for proposed blocks (proposal flow) to detect duplicated transaction hashes in the block body, preventing a single tx hash from appearing multiple times across miniblocks (or within a miniblock) during proposal verification.
Changes:
- Introduces a new process-level error for duplicated transaction hashes in a block body.
- Adds proposal-only duplicate tx-hash detection inside
checkHeaderBodyCorrelation. - Extends
TestCheckHeaderBodyCorrelationProposalwith scenarios covering duplicated tx hashes (proposal vs non-proposal paths).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
process/errors.go |
Adds a new exported error for duplicated tx hashes in block body. |
process/block/baseProcess.go |
Adds proposal-only duplicate tx-hash scan over miniblocks in the body. |
process/block/baseProcess_test.go |
Adds tests asserting the new behavior for proposal vs non-proposal correlation checks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| func checkForDuplicatedTxHashes(body *block.Body) error { | ||
| txHashesSeen := make(map[string]struct{}) | ||
| for _, miniBlock := range body.MiniBlocks { | ||
| if miniBlock == nil { | ||
| continue | ||
| } | ||
| for _, txHash := range miniBlock.TxHashes { | ||
| txHashStr := string(txHash) | ||
| if _, ok := txHashesSeen[txHashStr]; ok { | ||
| return process.ErrDuplicatedTransactionInBlockBody | ||
| } | ||
| txHashesSeen[txHashStr] = struct{}{} | ||
| } | ||
| } | ||
| return nil | ||
| } |
There was a problem hiding this comment.
this check is already done in another function
… extra-check-block-proposal
Reasoning behind the pull request
Pre-requisites
Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:
featbranch created?featbranch merging, do all satellite projects have a proper tag insidego.mod?