Skip to content

block proposal extra checks#7882

Merged
AdoAdoAdo merged 10 commits into
feat/testnet-fixesfrom
extra-check-block-proposal
Jun 19, 2026
Merged

block proposal extra checks#7882
AdoAdoAdo merged 10 commits into
feat/testnet-fixesfrom
extra-check-block-proposal

Conversation

@miiu96

@miiu96 miiu96 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Reasoning behind the pull request

  • Added extra check for duplicated transactions in proposed block body

Pre-requisites

Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:

  • was the PR targeted to the correct branch?
  • if this is a larger feature that probably needs more than one PR, is there a feat branch created?
  • if this is a feat branch merging, do all satellite projects have a proper tag inside go.mod?

@miiu96 miiu96 self-assigned this Jun 17, 2026
@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.62%. Comparing base (850ffe1) to head (9236e3f).

Files with missing lines Patch % Lines
process/block/baseProcess.go 85.71% 1 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 TestCheckHeaderBodyCorrelationProposal with 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.

Comment on lines +1309 to +1324
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
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this check is already done in another function

Comment thread process/errors.go Outdated
@AdoAdoAdo AdoAdoAdo merged commit 36c6953 into feat/testnet-fixes Jun 19, 2026
11 of 12 checks passed
@AdoAdoAdo AdoAdoAdo deleted the extra-check-block-proposal branch June 19, 2026 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants