Skip to content

MX-17193 Unique chunks processor integration test#7323

Open
mradian1 wants to merge 13 commits into
rc/supernovafrom
unique-chunks-integration-tests
Open

MX-17193 Unique chunks processor integration test#7323
mradian1 wants to merge 13 commits into
rc/supernovafrom
unique-chunks-integration-tests

Conversation

@mradian1

@mradian1 mradian1 commented Oct 9, 2025

Copy link
Copy Markdown

Reasoning behind the pull request

Proposed changes

Testing procedure

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?

@mradian1 mradian1 self-assigned this Oct 9, 2025
@mradian1 mradian1 marked this pull request as draft October 9, 2025 12:56
Base automatically changed from unique-chunks-processor to rc/supernova October 13, 2025 08:32
@mradian1 mradian1 changed the title MX-17193 Initial implementation MX-17193 Unique chunks processor integration test Oct 16, 2025
@github-actions

Copy link
Copy Markdown

Integration Tests completed with failures or errors.

📊 MultiversX Automated Test Report: View Report

🔄 Build Details:

  • mx-chain-go Commit Hash: c61ad151e46f76e31ff4c4be9065bf4835925f1c
  • Current Branch: unique-chunks-integration-tests
  • mx-chain-go Target Branch: rc/supernova
  • mx-chain-simulator-go Target Branch: rc/supernova
  • mx-chain-testing-suite Target Branch: rc/supernova
  • mx-chain-simulator-go Commit Hash: 7eb0e778a2d1a9d7dd6e49e005ad1fc7e0aea307

🚀 Environment Variables:

  • TIMESTAMP: 2025_OCTOBER_16__10_08_52
  • PYTEST_EXIT_CODE: 1

@github-actions

Copy link
Copy Markdown

Integration Tests completed with failures or errors.

📊 MultiversX Automated Test Report: View Report

🔄 Build Details:

  • mx-chain-go Commit Hash: dfa5c92db50fd00663a7afd338b232a84357a46a
  • Current Branch: unique-chunks-integration-tests
  • mx-chain-go Target Branch: rc/supernova
  • mx-chain-simulator-go Target Branch: rc/supernova
  • mx-chain-testing-suite Target Branch: rc/supernova
  • mx-chain-simulator-go Commit Hash: 7eb0e778a2d1a9d7dd6e49e005ad1fc7e0aea307

🚀 Environment Variables:

  • TIMESTAMP: 2025_OCTOBER_16__12_44_05
  • PYTEST_EXIT_CODE: 1

@github-actions

Copy link
Copy Markdown

Integration Tests completed with failures or errors.

📊 MultiversX Automated Test Report: View Report

🔄 Build Details:

  • mx-chain-go Commit Hash: dfa5c92db50fd00663a7afd338b232a84357a46a
  • Current Branch: unique-chunks-integration-tests
  • mx-chain-go Target Branch: rc/supernova
  • mx-chain-simulator-go Target Branch: rc/supernova
  • mx-chain-testing-suite Target Branch: rc/supernova
  • mx-chain-simulator-go Commit Hash: 7eb0e778a2d1a9d7dd6e49e005ad1fc7e0aea307

🚀 Environment Variables:

  • TIMESTAMP: 2025_OCTOBER_16__13_40_29
  • PYTEST_EXIT_CODE: 1

@codecov

codecov Bot commented Oct 16, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 65 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.49%. Comparing base (3ce7096) to head (4c9ee43).
⚠️ Report is 618 commits behind head on feat/supernova-async-exec.

Files with missing lines Patch % Lines
node/nodeTesting.go 0.00% 65 Missing ⚠️
Additional details and impacted files
@@                      Coverage Diff                      @@
##           feat/supernova-async-exec    #7323      +/-   ##
=============================================================
- Coverage                      77.53%   77.49%   -0.05%     
=============================================================
  Files                            878      878              
  Lines                         122173   122238      +65     
=============================================================
- Hits                           94728    94725       -3     
- Misses                         21135    21202      +67     
- Partials                        6310     6311       +1     

☔ View full report in Codecov by Sentry.
📢 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

This pull request adds an integration test for the unique chunks processor/deduplication functionality. The test verifies that the system correctly deduplicates messages when the same transaction packets are broadcast multiple times across shards.

  • Added GenerateAndSendDuplicatedBulkTransactions method to support sending duplicated transaction batches for testing
  • Created integration test to validate message deduplication across shard boundaries
  • Implemented countingMessageProcessor helper to track message counts during deduplication testing

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 11 comments.

File Description
node/nodeTesting.go Added new GenerateAndSendDuplicatedBulkTransactions function to generate and broadcast duplicated transaction batches for testing deduplication logic
integrationTests/deduplication/single_deduplication_test.go Implemented integration test that verifies deduplication by sending duplicate packets and validating that interceptors properly deduplicate them
integrationTests/deduplication/countingMessageProcessor.go Created helper processor to count received messages for validation in deduplication tests

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +29 to +30
num := atomic.LoadUint32(&mp.numMessagesReceived) + 1
atomic.AddUint32(&mp.numMessagesReceived, 1)

Copilot AI Nov 19, 2025

Copy link

Choose a reason for hiding this comment

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

Inefficient atomic operation: loading the value with atomic.LoadUint32(&mp.numMessagesReceived) and then incrementing with atomic.AddUint32(&mp.numMessagesReceived, 1) is redundant. The return value of atomic.AddUint32 already gives the new value. Consider using: num := atomic.AddUint32(&mp.numMessagesReceived, 1).

Suggested change
num := atomic.LoadUint32(&mp.numMessagesReceived) + 1
atomic.AddUint32(&mp.numMessagesReceived, 1)
num := atomic.AddUint32(&mp.numMessagesReceived, 1)

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done

Comment on lines +18 to +22
// TestNode_ShouldDeduplicateDuplicateMessages
// Scenario:
//
// messenger1 -> (duplicates) -> node0(interceptor) -> (cross-shard) -> messenger2
func TestNode_ShouldDeduplicateMessages(t *testing.T) {

Copilot AI Nov 19, 2025

Copy link

Choose a reason for hiding this comment

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

The function name in the comment TestNode_ShouldDeduplicateDuplicateMessages doesn't match the actual function name TestNode_ShouldDeduplicateMessages. Either update the comment to match the function name or vice versa.

Copilot uses AI. Check for mistakes.
integrationTests.WhiteListTxs(nodes, txs)
}

duplicatedTxCount := 5 // each batch sent 5 times

Copilot AI Nov 19, 2025

Copy link

Choose a reason for hiding this comment

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

The variable name duplicatedTxCount is misleading. It represents the number of times each batch/packet is duplicated, not the count of duplicated transactions. Consider renaming to numDuplicationsPerPacket or duplicationsPerBatch for clarity.

Copilot uses AI. Check for mistakes.
Comment thread node/nodeTesting.go

atomic.AddInt32(&currentSendingGoRoutines, int32(len(packets)))
for _, buff := range packets {
for i := 0; i < num_duplications; i++ {

Copilot AI Nov 19, 2025

Copy link

Choose a reason for hiding this comment

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

Variable name uses snake_case (num_duplications) instead of camelCase, which is inconsistent with Go naming conventions. Should be numDuplications.

Suggested change
for i := 0; i < num_duplications; i++ {
for i := 0; i < numDuplications; i++ {

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done

logger "github.com/multiversx/mx-chain-logger-go"
)

var log = logger.GetOrCreate("api/gin")

Copilot AI Nov 19, 2025

Copy link

Choose a reason for hiding this comment

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

Logger is initialized with incorrect package name "api/gin". This should reflect the actual package path, which is "deduplication" or "integrationTests/deduplication".

Suggested change
var log = logger.GetOrCreate("api/gin")
var log = logger.GetOrCreate("deduplication")

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done

for _, n := range nodes {
_ = logger.SetLogLevel("*:ERROR")
n.Close()
}

Copilot AI Nov 19, 2025

Copy link

Choose a reason for hiding this comment

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

The messenger2 messenger is created but not properly cleaned up in the defer block. Only node0 and messenger1 are cleaned up via the nodes slice, but messenger2 should also be closed to prevent resource leaks. Add _ = messenger2.Close() to the cleanup code.

Suggested change
}
}
_ = messenger2.Close()

Copilot uses AI. Check for mistakes.

// --- validate deduplication
txRecvNode0 := atomic.LoadInt32(&node0.CounterTxRecv)
msgsRecvNode0AfterDeduplication := node0Proc.NumMessagesReceived() //node0.MainMessenger.(*integrationTests.CountingMessenger).MsgCount

Copilot AI Nov 19, 2025

Copy link

Choose a reason for hiding this comment

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

Remove commented-out code //node0.MainMessenger.(*integrationTests.CountingMessenger).MsgCount. If this was for debugging or reference, it should be deleted in the final version.

Suggested change
msgsRecvNode0AfterDeduplication := node0Proc.NumMessagesReceived() //node0.MainMessenger.(*integrationTests.CountingMessenger).MsgCount
msgsRecvNode0AfterDeduplication := node0Proc.NumMessagesReceived()

Copilot uses AI. Check for mistakes.
Comment thread node/nodeTesting.go
Comment on lines +237 to +247
atomic.AddInt32(&currentSendingGoRoutines, int32(len(packets)))
for _, buff := range packets {
for i := 0; i < num_duplications; i++ {
n.networkComponents.NetworkMessenger().BroadcastOnChannel(
txsSender.SendTransactionsPipe,
identifier,
buff,
)
}

atomic.AddInt32(&currentSendingGoRoutines, -1)

Copilot AI Nov 19, 2025

Copy link

Choose a reason for hiding this comment

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

Incorrect atomic counter management. The code increments currentSendingGoRoutines by len(packets) (line 237) but then broadcasts each packet num_duplications times before decrementing once per packet (line 247). This doesn't accurately reflect the actual workload. The counter should account for the total number of broadcasts (len(packets) * num_duplications) or be restructured to properly track concurrent sending operations.

Copilot uses AI. Check for mistakes.
fmt.Println("messenger2 received total messages:", msgsRecvMessenger2)
assert.Equal(t, int32(numPackets), int32(msgsRecvNode0AfterDeduplication), "interceptor should have deduplicated messages")
assert.Equal(t, int32(numPackets), int32(msgsRecvMessenger2), "messenger2 should have received deduplicated messages")
assert.Equal(t, int32(numPackets*duplicatedTxCount), int32(msgsRecvMessenger1), "messenger1 should have received all messages it sent")

Copilot AI Nov 19, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] The assertion logic appears questionable. The test expects messenger1 to receive numPackets * duplicatedTxCount messages, suggesting it receives all the duplicates it sent. However, this is testing whether messenger1 echoes back its own messages, which may not be the intended test behavior. Consider clarifying the test's intent: if messenger1 should only send (not receive), this assertion should be removed or the message processor registration on line 47-48 should be removed. If self-receiving is intentional, add a comment explaining why.

Suggested change
assert.Equal(t, int32(numPackets*duplicatedTxCount), int32(msgsRecvMessenger1), "messenger1 should have received all messages it sent")

Copilot uses AI. Check for mistakes.
Comment thread node/nodeTesting.go
}

func (n *Node) GenerateAndSendDuplicatedBulkTransactions(
num_duplications int,

Copilot AI Nov 19, 2025

Copy link

Choose a reason for hiding this comment

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

Variable name uses snake_case (num_duplications) instead of camelCase, which is inconsistent with Go naming conventions. Should be numDuplications.

Suggested change
num_duplications int,
numDuplications int,

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done

@github-actions

Copy link
Copy Markdown

Integration Tests completed with failures or errors.

📊 MultiversX Automated Test Report: View Report

🔄 Build Details:

  • mx-chain-go Commit Hash: 944e123c19e6823ab8993b538d3f271d8200adf3
  • Current Branch: unique-chunks-integration-tests
  • mx-chain-go Target Branch: rc/supernova
  • mx-chain-simulator-go Target Branch: rc/supernova
  • mx-chain-testing-suite Target Branch: rc/supernova
  • mx-chain-simulator-go Commit Hash: f34782597c2b84fd11d91a937138749429b794e4

🚀 Environment Variables:

  • TIMESTAMP: 2025_NOVEMBER_19__08_11_53
  • PYTEST_EXIT_CODE: 1

@mradian1 mradian1 marked this pull request as ready for review November 20, 2025 07:32
@github-actions

Copy link
Copy Markdown

Integration Tests completed with failures or errors.

📊 MultiversX Automated Test Report: View Report

🔄 Build Details:

  • mx-chain-go Commit Hash: f81f74846268b1a09cf999448e898d1c0fb01faf
  • Current Branch: unique-chunks-integration-tests
  • mx-chain-go Target Branch: rc/supernova
  • mx-chain-simulator-go Target Branch: rc/supernova
  • mx-chain-testing-suite Target Branch: rc/supernova
  • mx-chain-simulator-go Commit Hash: f34782597c2b84fd11d91a937138749429b794e4

🚀 Environment Variables:

  • TIMESTAMP: 2025_NOVEMBER_24__07_46_38
  • PYTEST_EXIT_CODE: 1

@github-actions

Copy link
Copy Markdown

Integration Tests completed with failures or errors.

📊 MultiversX Automated Test Report: View Report

🔄 Build Details:

  • mx-chain-go Commit Hash: 2ac58e0dea70ed8ed47c6dd167405dcb01ecbbb2
  • Current Branch: unique-chunks-integration-tests
  • mx-chain-go Target Branch: rc/supernova
  • mx-chain-simulator-go Target Branch: rc/supernova
  • mx-chain-testing-suite Target Branch: rc/supernova
  • mx-chain-simulator-go Commit Hash: c28e818824f15403ae81910e0de78a919b4e15bb

🚀 Environment Variables:

  • TIMESTAMP: 2025_NOVEMBER_28__12_01_50
  • PYTEST_EXIT_CODE: 1

@github-actions

Copy link
Copy Markdown

Integration Tests completed with failures or errors.

📊 MultiversX Automated Test Report: View Report

🔄 Build Details:

  • mx-chain-go Commit Hash: 4930bcdc03ecde3c6468e90fea7a76e7d0404af3
  • Current Branch: unique-chunks-integration-tests
  • mx-chain-go Target Branch: rc/supernova
  • mx-chain-simulator-go Target Branch: rc/supernova
  • mx-chain-simulator-go Commit Hash: 6d12db1fee8d6bbd7a24f422a215b554a93450a7
  • mx-chain-testing-suite Target Branch: rc/supernova
  • mx-chain-testing-suite Commit Hash: 171a49d4a8d9b0a35c8a4a4c146fc34933c5a416

🚀 Environment Variables:

  • TIMESTAMP: 2025_DECEMBER_16__09_15_14
  • PYTEST_EXIT_CODE: 1

@AdoAdoAdo AdoAdoAdo changed the base branch from rc/supernova to feat/supernova-async-exec February 3, 2026 08:03
@github-actions

github-actions Bot commented Feb 3, 2026

Copy link
Copy Markdown

Integration Tests passed successfully!

📊 MultiversX Automated Test Report: View Report

🔄 Build Details:

  • mx-chain-go Commit Hash: bdac799ed85251d17ac9eed6fbb58cc9872d91d2
  • Current Branch: unique-chunks-integration-tests
  • mx-chain-go Target Branch: rc/supernova
  • mx-chain-simulator-go Target Branch: rc/supernova
  • mx-chain-simulator-go Commit Hash: 6a11acd1889b33f9041a604b87d0e18124e5d276
  • mx-chain-testing-suite Target Branch: rc/supernova
  • mx-chain-testing-suite Commit Hash: 7ab08ef87cea1241375cfb8395a7315d904836a1

🚀 Environment Variables:

  • TIMESTAMP: 2026_FEBRUARY_03__08_04_33
  • PYTEST_EXIT_CODE: 0

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

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread node/nodeTesting.go
}

func (n *Node) GenerateAndSendDuplicatedBulkTransactions(
num_duplications int,

Copilot AI Feb 10, 2026

Copy link

Choose a reason for hiding this comment

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

Parameter num_duplications uses snake_case, which is inconsistent with Go naming conventions and the rest of this file. Rename it to numDuplications and update its uses accordingly.

Suggested change
num_duplications int,
numDuplications int,

Copilot uses AI. Check for mistakes.
Comment thread node/nodeTesting.go
Comment on lines +173 to +175
mutTransactions := sync.RWMutex{}
txsBuff := make([][]byte, 0)

Copilot AI Feb 10, 2026

Copy link

Choose a reason for hiding this comment

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

mutTransactions is declared as sync.RWMutex but is only ever used with Lock/Unlock (no RLock). Consider using sync.Mutex and pre-allocating txsBuff/txs with capacity numOfTxs to avoid repeated slice growth while goroutines append.

Copilot uses AI. Check for mistakes.
Comment thread node/nodeTesting.go
Comment on lines +238 to +249
atomic.AddInt32(&currentSendingGoRoutines, int32(len(packets)))
for _, buff := range packets {
for i := 0; i < num_duplications; i++ {
n.networkComponents.NetworkMessenger().BroadcastOnChannel(
txsSender.SendTransactionsPipe,
identifier,
buff,
)
}

atomic.AddInt32(&currentSendingGoRoutines, -1)
}

Copilot AI Feb 10, 2026

Copy link

Choose a reason for hiding this comment

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

currentSendingGoRoutines is incremented by len(packets) but this method broadcasts each packet num_duplications times. This makes the throttle counter inconsistent with the actual number of sends performed, potentially bypassing ErrSystemBusyGeneratingTransactions under load. Adjust the counter to reflect len(packets) * numDuplications (or document why duplicates shouldn’t be counted).

Copilot uses AI. Check for mistakes.
Comment thread node/nodeTesting.go
whiteList func([]*transaction.Transaction),
chainID []byte,
minTxVersion uint32,
) (numMessages int, err error) {

Copilot AI Feb 10, 2026

Copy link

Choose a reason for hiding this comment

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

The named return value numMessages is misleading: the function returns len(packets) (number of packed chunks), not the number of broadcasts performed (which would be len(packets) * numDuplications). Consider renaming the return value (e.g. numPackets) or adjusting what is returned to match the name.

Suggested change
) (numMessages int, err error) {
) (numPackets int, err error) {

Copilot uses AI. Check for mistakes.
Base automatically changed from feat/supernova-async-exec to rc/supernova April 6, 2026 07:58
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.

3 participants