Disable outgoing txs supernova transition#7873
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feat/testnet-fixes #7873 +/- ##
======================================================
- Coverage 77.58% 77.58% -0.01%
======================================================
Files 884 884
Lines 125259 125274 +15
======================================================
+ Hits 97182 97192 +10
- Misses 21627 21630 +3
- Partials 6450 6452 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR introduces a Supernova-transition guard in the transaction coordinator so that blocks containing outgoing transaction miniblocks are rejected while Supernova is epoch-enabled but round-enabled is still off (i.e., during the transition window). This aligns block processing/validation behavior with the existing block production behavior that already disables outgoing txs until Supernova round activation.
Changes:
- Added a new sentinel error (
process.ErrOutgoingTxsDisabled) to signal outgoing tx miniblocks are disallowed during the transition. - Added coordinator-side enforcement in
ProcessBlockTransaction()to reject forbidden outgoing transaction miniblocks during the transition (for non-v3 headers). - Added unit tests to ensure TxBlock miniblocks are rejected and post-process miniblocks (e.g. SCR) are still allowed in the transition.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
process/errors.go |
Adds ErrOutgoingTxsDisabled error used to signal forbidden outgoing tx miniblocks during transition. |
process/coordinator/process.go |
Enforces rejection of forbidden outgoing tx miniblocks during Supernova transition; adds helper predicates. |
process/coordinator/process_test.go |
Adds coverage for rejecting TxBlock outgoing miniblocks and allowing post-process miniblocks during transition. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| func TestTransactionCoordinator_ProcessBlockTransactionRejectsForbiddenOutgoingTxMiniBlocksDuringSupernovaTransition(t *testing.T) { | ||
| t.Parallel() | ||
|
|
||
| argsTransactionCoordinator := createMockTransactionCoordinatorArguments() | ||
| argsTransactionCoordinator.EnableEpochsHandler = &enableEpochsHandlerMock.EnableEpochsHandlerStub{ | ||
| IsFlagEnabledInEpochCalled: func(flag core.EnableEpochFlag, epoch uint32) bool { | ||
| return flag == common.SupernovaFlag && epoch == 7 | ||
| }, | ||
| } | ||
| argsTransactionCoordinator.EnableRoundsHandler = &testscommon.EnableRoundsHandlerStub{ | ||
| IsFlagEnabledInRoundCalled: func(flag common.EnableRoundFlag, round uint64) bool { | ||
| return false | ||
| }, | ||
| } | ||
|
|
||
| tc, err := NewTransactionCoordinator(argsTransactionCoordinator) | ||
| require.NoError(t, err) | ||
|
|
||
| haveTime := func() time.Duration { | ||
| return time.Second | ||
| } | ||
|
|
||
| selfShardID := tc.shardCoordinator.SelfId() | ||
| receiverShardID := (selfShardID + 1) % tc.shardCoordinator.NumberOfShards() | ||
| miniBlock := &block.MiniBlock{ | ||
| SenderShardID: selfShardID, | ||
| ReceiverShardID: receiverShardID, | ||
| Type: block.TxBlock, | ||
| TxHashes: [][]byte{txHash}, | ||
| } | ||
| miniBlockHash, err := core.CalculateHash(tc.marshalizer, tc.hasher, miniBlock) | ||
| require.NoError(t, err) | ||
|
|
||
| body := &block.Body{MiniBlocks: []*block.MiniBlock{miniBlock}} | ||
| header := &block.Header{ | ||
| Epoch: 7, | ||
| Round: 41, | ||
| MiniBlockHeaders: []block.MiniBlockHeader{ | ||
| {Hash: miniBlockHash, TxCount: 1, ReceiverShardID: receiverShardID}, | ||
| }, | ||
| } | ||
|
|
||
| err = tc.ProcessBlockTransaction(header, body, haveTime) | ||
| require.ErrorIs(t, err, process.ErrOutgoingTxsDisabled) | ||
| } |
| if mb.SenderShardID != selfShardID { | ||
| continue | ||
| } | ||
| if mb.Type == block.TxBlock { |
There was a problem hiding this comment.
A check should still be added for invalid block, to allow the entire bandwidth to be used to finalize floating miniblocks in that window.
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:
featbranch created?featbranch merging, do all satellite projects have a proper tag insidego.mod?