Skip to content

Commit 0537dc9

Browse files
authored
Merge pull request #2079 from mintlayer/consensus_tightening
Consensus tightening
2 parents 5a4d55f + f0cd586 commit 0537dc9

29 files changed

Lines changed: 1544 additions & 283 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ The format is loosely based on [Keep a Changelog](https://keepachangelog.com/en/
4545
of a cluster that exceeds the limits. The default cluster limits are: max 64 transactions, max 100'000 bytes
4646
in total.
4747

48+
- Consensus:
49+
- Tightening of certain consensus rules have been implemented, in particular:
50+
- When changing token metadata URI, the URI can no longer contain arbitrary characters (the restrictions are
51+
the same as when a token is created).
52+
- Transferring or burning zero amount of a token is no longer allowed.
53+
54+
(The actual consensus tightening will happen after a fork, the height is yet to be decided.)
55+
4856
## [1.3.1] - 2026-06-03
4957

5058
### Fixed

chainstate/src/detail/ban_score.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ impl BanScore for ConnectTransactionError {
144144
ConnectTransactionError::ConcludeInputAmountsDontMatch(_, _) => 100,
145145
ConnectTransactionError::ProduceBlockFromStakeChangesStakerDestination(_, _) => 100,
146146
ConnectTransactionError::IdCreationError(err) => err.ban_score(),
147+
ConnectTransactionError::ZeroTokenTransfer(_) => 100,
147148
}
148149
}
149150
}
@@ -358,6 +359,7 @@ impl BanScore for TokensError {
358359
TokensError::InvariantBrokenUndoIssuanceOnNonexistentToken(_) => 100,
359360
TokensError::InvariantBrokenRegisterIssuanceWithDuplicateId(_) => 100,
360361
TokensError::TokenMetadataUriTooLarge(_) => 100,
362+
TokensError::IncorrectMetadataUri(_) => 100,
361363
}
362364
}
363365
}
@@ -476,6 +478,7 @@ impl BanScore for ConsensusPoSError {
476478
ConsensusPoSError::EmptyTimespan => 100,
477479
ConsensusPoSError::FailedToCalculateCappedBalance => 100,
478480
ConsensusPoSError::InvalidOutputTypeInStakeKernel(_) => 100,
481+
ConsensusPoSError::PoolIdsInKernelUtxoAndPoSDataMismatch { .. } => 100,
479482
}
480483
}
481484
}

chainstate/src/detail/error_classification.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,8 @@ impl BlockProcessingErrorClassification for ConnectTransactionError {
304304
| ConnectTransactionError::InsufficientCoinsFee(_, _)
305305
| ConnectTransactionError::AttemptToSpendFrozenToken(_)
306306
| ConnectTransactionError::ConcludeInputAmountsDontMatch(_, _)
307-
| ConnectTransactionError::ProduceBlockFromStakeChangesStakerDestination(_, _) => {
308-
BlockProcessingErrorClass::BadBlock
309-
}
307+
| ConnectTransactionError::ProduceBlockFromStakeChangesStakerDestination(_, _)
308+
| ConnectTransactionError::ZeroTokenTransfer(_) => BlockProcessingErrorClass::BadBlock,
310309

311310
ConnectTransactionError::StorageError(err) => err.classify(),
312311
ConnectTransactionError::UtxoError(err) => err.classify(),
@@ -494,6 +493,7 @@ impl BlockProcessingErrorClassification for TokensError {
494493
| TokensError::CoinOrTokenOverflow(_)
495494
| TokensError::InsufficientTokenFees(_)
496495
| TokensError::TokenMetadataUriTooLarge(_)
496+
| TokensError::IncorrectMetadataUri(_)
497497
| TokensError::InvariantBrokenUndoIssuanceOnNonexistentToken(_)
498498
| TokensError::InvariantBrokenRegisterIssuanceWithDuplicateId(_) => {
499499
BlockProcessingErrorClass::BadBlock
@@ -663,7 +663,8 @@ impl BlockProcessingErrorClassification for ConsensusPoSError {
663663
| ConsensusPoSError::FiniteTotalSupplyIsRequired
664664
| ConsensusPoSError::UnsupportedConsensusVersion
665665
| ConsensusPoSError::FailedToCalculateCappedBalance
666-
| ConsensusPoSError::InvalidOutputTypeInStakeKernel(_) => {
666+
| ConsensusPoSError::InvalidOutputTypeInStakeKernel(_)
667+
| ConsensusPoSError::PoolIdsInKernelUtxoAndPoSDataMismatch { .. } => {
667668
BlockProcessingErrorClass::BadBlock
668669
}
669670

chainstate/src/detail/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ pub use self::{
8686
median_time::calculate_median_time_past_from_blocktimestamps,
8787
};
8888
pub use chainstate_types::Locator;
89-
pub use chainstateref::NonZeroPoolBalances;
89+
pub use chainstateref::{EpochSealError, NonZeroPoolBalances};
9090
pub use error::{
9191
BlockError, CheckBlockError, CheckBlockTransactionsError, DbCommittingContext,
9292
InitializationError, OrphanCheckError, StorageCompatibilityCheckError,

chainstate/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ pub use crate::{
3939
detail::{
4040
BlockError, BlockProcessingErrorClass, BlockProcessingErrorClassification, BlockSource,
4141
ChainInfo, CheckBlockError, CheckBlockTransactionsError, ConnectTransactionError,
42-
IOPolicyError, InitializationError, Locator, MEDIAN_TIME_SPAN, NonZeroPoolBalances,
43-
OrphanCheckError, SpendStakeError, StorageCompatibilityCheckError, TokenIssuanceError,
44-
TokensError, TransactionVerifierStorageError, ban_score,
42+
EpochSealError, IOPolicyError, InitializationError, Locator, MEDIAN_TIME_SPAN,
43+
NonZeroPoolBalances, OrphanCheckError, SpendStakeError, StorageCompatibilityCheckError,
44+
TokenIssuanceError, TokensError, TransactionVerifierStorageError, ban_score,
4545
block_invalidation::BlockInvalidatorError, bootstrap::BootstrapError,
4646
calculate_median_time_past, calculate_median_time_past_from_blocktimestamps,
4747
},

0 commit comments

Comments
 (0)