Skip to content

MX-17306 Tooling for incorrect cross shard execution#7419

Merged
AdoAdoAdo merged 33 commits into
feat/testnet-fixesfrom
cross-shard-execution-analysis
Jul 8, 2026
Merged

MX-17306 Tooling for incorrect cross shard execution#7419
AdoAdoAdo merged 33 commits into
feat/testnet-fixesfrom
cross-shard-execution-analysis

Conversation

@mradian1

@mradian1 mradian1 commented Nov 11, 2025

Copy link
Copy Markdown

Reasoning behind the pull request

Using the prettify block logging, improve the logs analysis tool to validate that cross shard miniblocks are executed (and proposed) in strict order, without gaps or duplications.

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 Nov 11, 2025
@codecov

codecov Bot commented Nov 11, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 47.36842% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.68%. Comparing base (4247666) to head (84dd00a).

Files with missing lines Patch % Lines
node/nodeRunner.go 0.00% 11 Missing ⚠️
common/common.go 0.00% 9 Missing ⚠️
cmd/node/flags.go 0.00% 2 Missing ⚠️
common/configs/commonConfigs.go 33.33% 2 Missing ⚠️
consensus/spos/consensusCore.go 60.00% 2 Missing ⚠️
consensus/spos/consensusCoreValidator.go 0.00% 1 Missing and 1 partial ⚠️
...hainSimulator/components/testOnlyProcessingNode.go 0.00% 1 Missing ⚠️
node/chainSimulator/process/processor.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@                 Coverage Diff                 @@
##           feat/testnet-fixes    #7419   +/-   ##
===================================================
  Coverage               77.68%   77.68%           
===================================================
  Files                     885      885           
  Lines                  125904   125916   +12     
===================================================
+ Hits                    97809    97822   +13     
  Misses                  21613    21613           
+ Partials                 6482     6481    -1     

☔ 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.

@mradian1 mradian1 changed the title MX-17306 Added header logs on commit MX-17306 Tooling for incorrect cross shard execution Nov 11, 2025

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 PR adds enhanced logging capabilities for debugging cross-shard miniblock execution by logging header details at key consensus stages using the PrettifyStruct utility.

Key changes:

  • Added debug logging for headers when they are proposed, received, and committed across BLS consensus versions (v1 and v2)
  • Added comprehensive test coverage for PrettifyStruct with HeaderV3 and MetaBlockV3 types
  • Created mock helper functions to support the new tests

Reviewed Changes

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

File Description
consensus/spos/bls/v2/subroundEndRound.go Logs header details when a block is finalized and committed
consensus/spos/bls/v1/subroundEndRound.go Logs header details when blocks are committed by both leader and participant nodes
consensus/spos/bls/v1/subroundBlock.go Logs header details when blocks are sent and received during consensus
common/common_test.go Adds test cases for HeaderV3/MetaBlockV3 and helper functions to create mock headers

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

Comment thread common/common_test.go Outdated
NotarizedInRound: hdrRound - 1,
},
ExecutionResults: []*block.ExecutionResult{
&block.ExecutionResult{

Copilot AI Nov 12, 2025

Copy link

Choose a reason for hiding this comment

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

The code uses the unidiomatic composite literal syntax &block.ExecutionResult{...} instead of {...}. When the slice element type is already a pointer ([]*block.ExecutionResult), you should omit the & operator. This applies to all three entries in the slice (lines 848, 857, 866).

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 thread common/common_test.go

meta := createMockMetaHeaderV3()
hdr = meta
prettified, err = common.PrettifyStruct(meta)

Copilot AI Nov 12, 2025

Copy link

Choose a reason for hiding this comment

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

Inconsistency in the variable passed to PrettifyStruct. Line 510 assigns meta to hdr, but line 511 passes meta directly instead of using hdr. For consistency with the pattern used for the shard header (lines 504-505), this should be common.PrettifyStruct(hdr).

Suggested change
prettified, err = common.PrettifyStruct(meta)
prettified, err = common.PrettifyStruct(hdr)

Copilot uses AI. Check for mistakes.

@axenteoctavian axenteoctavian 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.

  • Copilot suggestions

Comment thread consensus/spos/bls/v1/subroundBlock.go Outdated
@mariusmihaic mariusmihaic self-requested a review January 12, 2026 13:05

@mariusmihaic mariusmihaic 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.

Is this extra log intended/expected to be here forever?
All this extra data will increase the log size pretty much

Comment thread common/common_test.go Outdated
PrevHash: []byte("prev hash"),
PrevRandSeed: []byte("prev rand seed"),
RandSeed: []byte("rand seed"),
ShardID: hdrShardId,

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.

You could use "1" here directly, without extra variable declaration

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 thread consensus/spos/bls/v1/subroundBlock.go Outdated
Comment on lines +233 to +238
headerOutput, err := common.PrettifyStruct(headerHandler)
if err != nil {
log.Error("Proposed header sent v1", "error", err)
} else {
log.Debug("Proposed header sent v1", "header", headerOutput)
}

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.

  1. Perhaps we should make a func here with input param being the message string
  2. This should not be logged with log.Error, since it is not critical for debugging. Debug level should work too

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, added a new method in common to log a header

mariusmihaic
mariusmihaic previously approved these changes Jan 20, 2026
AdoAdoAdo
AdoAdoAdo previously approved these changes Feb 20, 2026
Comment on lines +365 to +366
// log the header output for debugging purposes
common.LogPrettifiedHeader(sr.GetHeader(), "committed", "v2")

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.

this will print the same header info as in subroundBlock

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.

or this was intended for some extra tool?

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.

this will be used by our logs checker for alarms trigger for issues on committed blocks during consensus, not on the failed consensuses (can generate false positives otherwise).

Base automatically changed from feat/supernova-async-exec to rc/supernova April 6, 2026 07:58
@AdoAdoAdo AdoAdoAdo dismissed their stale review April 6, 2026 07:58

The base branch was changed.

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

Integration Tests passed successfully!

📊 MultiversX Automated Test Report: View Report

🔄 Build Details:

  • mx-chain-go Commit Hash: ab13f3ad1809253678b229896b8e9fb0bc466748
  • Current Branch: cross-shard-execution-analysis
  • mx-chain-go Target Branch: rc/supernova
  • mx-chain-simulator-go Target Branch: rc/supernova
  • mx-chain-simulator-go Commit Hash: 5c07dc8eaf7dd725f3504192bae764fe0e10c4d2
  • mx-chain-testing-suite Target Branch: rc/supernova
  • mx-chain-testing-suite Commit Hash: 1c160a41280af67bffed6fbd13ff2e150c5e1af8

🚀 Environment Variables:

  • TIMESTAMP: 2026_JULY_03__07_12_37
  • PYTEST_EXIT_CODE: 0

@miiu96 miiu96 changed the base branch from rc/supernova to feat/testnet-fixes July 3, 2026 07:43
@miiu96 miiu96 self-assigned this Jul 3, 2026

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 33 out of 33 changed files in this pull request and generated 1 comment.

Comment thread common/common.go
Comment on lines +305 to +318
// LogPrettifiedHeader logs the prettified representation of the provided header or an error if prettification fails
func LogPrettifiedHeader(header data.HeaderHandler, sentOrReceived string, version string, configsHandler CommonConfigsHandler) {
if !configsHandler.PrintPrettifiedHeader() {
return
}

headerOutput, err := PrettifyStruct(header)
message := fmt.Sprintf("Proposed header %s %s", sentOrReceived, version)
if err != nil {
log.Debug(message, "error", err)
} else {
log.Debug(message, "header", headerOutput)
}
}
@AdoAdoAdo AdoAdoAdo merged commit 6ea7662 into feat/testnet-fixes Jul 8, 2026
11 of 12 checks passed
@AdoAdoAdo AdoAdoAdo deleted the cross-shard-execution-analysis branch July 8, 2026 07:43
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.

8 participants