From 02e741e99879742e0704c1b29d7867c293821258 Mon Sep 17 00:00:00 2001 From: BeniaminDrasovean Date: Mon, 8 Jun 2026 15:12:31 +0300 Subject: [PATCH] add a check on processing that no outgoing txs are added during supernova transition --- process/block/export_test.go | 5 ----- process/block/shardblock.go | 8 +------- process/block/shardblockProposal_test.go | 2 +- process/block/shardblock_test.go | 8 ++++---- process/common.go | 9 +++++++++ process/coordinator/process.go | 3 +++ process/errors.go | 3 +++ 7 files changed, 21 insertions(+), 17 deletions(-) diff --git a/process/block/export_test.go b/process/block/export_test.go index 4091e352393..90905785cb1 100644 --- a/process/block/export_test.go +++ b/process/block/export_test.go @@ -912,11 +912,6 @@ func (sp *shardProcessor) DataPool() dataRetriever.PoolsHolder { return sp.dataPool } -// ShouldDisableOutgoingTxs - -func ShouldDisableOutgoingTxs(enableEpochsHandler common.EnableEpochsHandler, enableRoundsHandler common.EnableRoundsHandler) bool { - return shouldDisableOutgoingTxs(enableEpochsHandler, enableRoundsHandler) -} - // ShouldEpochStartInfoBeAvailable - func (sp *shardProcessor) ShouldEpochStartInfoBeAvailable(header data.ShardHeaderHandler) bool { return sp.shouldEpochStartInfoBeAvailable(header) diff --git a/process/block/shardblock.go b/process/block/shardblock.go index 9e43d1140be..97ea2861ceb 100644 --- a/process/block/shardblock.go +++ b/process/block/shardblock.go @@ -2388,7 +2388,7 @@ func (sp *shardProcessor) createMiniBlocks(haveTime func() bool, randomness []by return &block.Body{MiniBlocks: miniBlocks}, processedMiniBlocksDestMeInfo, nil } - if shouldDisableOutgoingTxs(sp.enableEpochsHandler, sp.enableRoundsHandler) { + if process.ShouldDisableOutgoingTxs(sp.enableEpochsHandler, sp.enableRoundsHandler) { interMBs := sp.txCoordinator.CreatePostProcessMiniBlocks() miniBlocks = append(miniBlocks, interMBs...) @@ -2426,12 +2426,6 @@ func (sp *shardProcessor) createMiniBlocks(haveTime func() bool, randomness []by return &block.Body{MiniBlocks: miniBlocks}, processedMiniBlocksDestMeInfo, nil } -func shouldDisableOutgoingTxs(enableEpochsHandler common.EnableEpochsHandler, enableRoundsHandler common.EnableRoundsHandler) bool { - isSupernovaEnabled := enableEpochsHandler.IsFlagEnabled(common.SupernovaFlag) - supernovaRoundEnabled := enableRoundsHandler.IsFlagEnabled(common.SupernovaRoundFlag) - return isSupernovaEnabled && !supernovaRoundEnabled -} - // applyBodyToHeader creates a miniblock header list given a block body func (sp *shardProcessor) applyBodyToHeader( shardHeader data.ShardHeaderHandler, diff --git a/process/block/shardblockProposal_test.go b/process/block/shardblockProposal_test.go index d91f516f471..f84d8745ff9 100644 --- a/process/block/shardblockProposal_test.go +++ b/process/block/shardblockProposal_test.go @@ -3910,7 +3910,7 @@ func TestShouldDisableOutgoingTxs(t *testing.T) { enableEpochsHandler := coreComponents.EnableEpochsHandler() enableRoundsHandler := coreComponents.EnableRoundsHandler() - result := blproc.ShouldDisableOutgoingTxs(enableEpochsHandler, enableRoundsHandler) + result := process.ShouldDisableOutgoingTxs(enableEpochsHandler, enableRoundsHandler) // This tests that the function executes without error require.NotNil(t, result) // result can be true or false depending on configuration }) diff --git a/process/block/shardblock_test.go b/process/block/shardblock_test.go index e93ca3454e3..b86a9dd9c9f 100644 --- a/process/block/shardblock_test.go +++ b/process/block/shardblock_test.go @@ -6891,7 +6891,7 @@ func Test_ShouldDisableOutgoingTxs(t *testing.T) { t.Run("both flag not set, should return false", func(t *testing.T) { enableEpochsHandler := &enableEpochsHandlerMock.EnableEpochsHandlerStub{} enableRoundsHandler := &testscommon.EnableRoundsHandlerStub{} - require.False(t, blproc.ShouldDisableOutgoingTxs(enableEpochsHandler, enableRoundsHandler)) + require.False(t, process.ShouldDisableOutgoingTxs(enableEpochsHandler, enableRoundsHandler)) }) t.Run("epoch flag enabled, round flag disabled, should return true", func(t *testing.T) { enableEpochsHandler := &enableEpochsHandlerMock.EnableEpochsHandlerStub{ @@ -6904,7 +6904,7 @@ func Test_ShouldDisableOutgoingTxs(t *testing.T) { return false }, } - require.True(t, blproc.ShouldDisableOutgoingTxs(enableEpochsHandler, enableRoundsHandler)) + require.True(t, process.ShouldDisableOutgoingTxs(enableEpochsHandler, enableRoundsHandler)) }) t.Run("epoch flag disabled, round flag enabled, should return false", func(t *testing.T) { enableEpochsHandler := &enableEpochsHandlerMock.EnableEpochsHandlerStub{ @@ -6917,7 +6917,7 @@ func Test_ShouldDisableOutgoingTxs(t *testing.T) { return true }, } - require.False(t, blproc.ShouldDisableOutgoingTxs(enableEpochsHandler, enableRoundsHandler)) + require.False(t, process.ShouldDisableOutgoingTxs(enableEpochsHandler, enableRoundsHandler)) }) t.Run("both flag enabled, should return false", func(t *testing.T) { enableEpochsHandler := &enableEpochsHandlerMock.EnableEpochsHandlerStub{ @@ -6930,7 +6930,7 @@ func Test_ShouldDisableOutgoingTxs(t *testing.T) { return true }, } - require.False(t, blproc.ShouldDisableOutgoingTxs(enableEpochsHandler, enableRoundsHandler)) + require.False(t, process.ShouldDisableOutgoingTxs(enableEpochsHandler, enableRoundsHandler)) }) } diff --git a/process/common.go b/process/common.go index 4bc7d9038ae..3f4c0210d0c 100644 --- a/process/common.go +++ b/process/common.go @@ -1636,3 +1636,12 @@ func getExecutionResultToSetOnReplacedHeader( return executionResultToSet, nil } + +// ShouldDisableOutgoingTxs returns true when the Supernova feature flag is enabled +// but the Supernova round flag is still disabled, meaning outgoing transactions +// should remain blocked until the round-based activation is also in effect. +func ShouldDisableOutgoingTxs(enableEpochsHandler common.EnableEpochsHandler, enableRoundsHandler common.EnableRoundsHandler) bool { + isSupernovaEnabled := enableEpochsHandler.IsFlagEnabled(common.SupernovaFlag) + supernovaRoundEnabled := enableRoundsHandler.IsFlagEnabled(common.SupernovaRoundFlag) + return isSupernovaEnabled && !supernovaRoundEnabled +} \ No newline at end of file diff --git a/process/coordinator/process.go b/process/coordinator/process.go index 9d387d8f1da..1c61f4eb281 100644 --- a/process/coordinator/process.go +++ b/process/coordinator/process.go @@ -368,6 +368,9 @@ func (tc *transactionCoordinator) ProcessBlockTransaction( } miniBlocksFromMe := body.MiniBlocks[mbIndex:] + if process.ShouldDisableOutgoingTxs(tc.enableEpochsHandler, tc.enableRoundsHandler) && len(miniBlocksFromMe) > 0 { + return process.ErrOutgoingTxsDisabled + } startTime = time.Now() err = tc.processMiniBlocksFromMe(header, &block.Body{MiniBlocks: miniBlocksFromMe}, haveTime) elapsedTime = time.Since(startTime) diff --git a/process/errors.go b/process/errors.go index 914ee1f927e..6437b21b590 100644 --- a/process/errors.go +++ b/process/errors.go @@ -1508,3 +1508,6 @@ var ErrInvalidShardInfo = errors.New("invalid shard info") // ErrNilClosingNodeStartedFlag signals that the closing node started flag is nil var ErrNilClosingNodeStartedFlag = errors.New("closing node started flag is nil") + +// ErrOutgoingTxsDisabled signals that the outgoing transactions are disabled +var ErrOutgoingTxsDisabled = errors.New("outgoing transactions are disabled")