feat(dpp)!: disable changes to perpetual distribution in token configuration#2627
Merged
QuantumExplorer merged 2 commits intoMay 22, 2025
Merged
Conversation
Contributor
## Walkthrough
The changes update error message text in the `UnsupportedFeatureError` struct for clarity and enhance the `validate_structure_v0` method to include protocol version context during validation. Additionally, a new check is introduced to reject unsupported "PerpetualDistribution" updates, returning a specific error if encountered.
## Changes
| File(s) | Change Summary |
|------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|
| `packages/rs-dpp/src/errors/consensus/basic/unsupported_feature_error.rs` | Updated the error message in `UnsupportedFeatureError` to clarify the context of protocol version during validation. |
| `.../token_config_update_transition/validate_structure/v0/mod.rs` | Modified `validate_structure_v0` method to accept a `platform_version` parameter and added a check for unsupported features.|
| `.../token_config_update_transition/validate_structure/mod.rs` | Updated call to `validate_structure_v0` to pass `platform_version` argument in `validate_structure` implementation. |
## Sequence Diagram(s)
```mermaid
sequenceDiagram
participant Caller
participant TokenConfigUpdateTransition
participant PlatformVersion
Caller->>TokenConfigUpdateTransition: validate_structure_v0(platform_version)
TokenConfigUpdateTransition->>TokenConfigUpdateTransition: Check for PerpetualDistribution variant
alt PerpetualDistribution found
TokenConfigUpdateTransition->>Caller: Return UnsupportedFeatureError (with protocol version)
else
TokenConfigUpdateTransition->>TokenConfigUpdateTransition: Perform other validations
TokenConfigUpdateTransition->>Caller: Return validation result
endSuggested reviewers
Poem
Learnt from: QuantumExplorer |
Member
Author
|
Self Reviewed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue being fixed or feature implemented
This PR disables changes to the perpetual distribution by doing config updates. We might reenable this in a future version but changes to perpetual distribution are very tricky and not very common.
What was done?
validate_structure_v0method to include a check that returns anUnsupportedFeatureErrorwhen an attempt is made to change the perpetual distribution in the token configuration.UnsupportedFeatureErrorfor clarity.How Has This Been Tested?
The changes have been tested through existing unit tests that cover the validation logic for token configuration updates.
Breaking Changes
None
Checklist
For repository code-owners and collaborators only
Summary by CodeRabbit
New Features
Bug Fixes