Skip to content

feat(dpp)!: disable changes to perpetual distribution in token configuration#2627

Merged
QuantumExplorer merged 2 commits into
v2.0-devfrom
featdisable-perpetual-distribution-changes
May 22, 2025
Merged

feat(dpp)!: disable changes to perpetual distribution in token configuration#2627
QuantumExplorer merged 2 commits into
v2.0-devfrom
featdisable-perpetual-distribution-changes

Conversation

@QuantumExplorer
Copy link
Copy Markdown
Member

@QuantumExplorer QuantumExplorer commented May 22, 2025

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?

  • Updated the validate_structure_v0 method to include a check that returns an UnsupportedFeatureError when an attempt is made to change the perpetual distribution in the token configuration.
  • Modified the error message in UnsupportedFeatureError for 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

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

  • New Features

    • Added validation to prevent updates involving perpetual distribution in token configuration, displaying a clear error message when such updates are attempted.
  • Bug Fixes

    • Improved error messages to clarify that feature validation was performed at a specific protocol version, enhancing transparency for users.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 22, 2025

## 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
    end

Suggested reviewers

  • shumkov

Poem

A rabbit hopped through code so neat,
Tweaked error words for clarity sweet.
With protocol wisdom now in hand,
Unsupported features firmly banned.
Hopping along, validation’s strong—
Bugs and confusion won’t last long!
🐇✨


<!-- walkthrough_end -->

<!-- announcements_start -->

> [!NOTE]
> <details>
> <summary>⚡️ AI Code Reviews for VS Code, Cursor, Windsurf</summary>
> 
> CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
> Learn more [here](http://coderabbit.ai/ide).
> 
> </details>

---

> [!NOTE]
> <details>
> <summary>⚡️ Faster reviews with caching</summary>
> 
> CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 30th. To opt out, configure `Review - Disable Cache` at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the `Data Retention` setting under your Organization Settings.
> Enjoy the performance boost—your workflow just got faster.
> 
> </details>

<!-- announcements_end -->

---

<details>
<summary>📜 Recent review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**


<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 1ce0ecf4c147a43c93520173e159d28860a3d4bd and 95609e08c1d99d4470148740d7a666f85c3b708e.

</details>

<details>
<summary>📒 Files selected for processing (1)</summary>

* `packages/rs-dpp/src/state_transition/state_transitions/document/batch_transition/batched_transition/token_config_update_transition/validate_structure/mod.rs` (1 hunks)

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>🧠 Learnings (1)</summary>

<details>
<summary>📓 Common learnings</summary>

Learnt from: QuantumExplorer
PR: #2257
File: packages/rs-drive-abci/src/mimic/test_quorum.rs:159-164
Timestamp: 2024-11-20T16:16:01.830Z
Learning: QuantumExplorer prefers not to receive auto-generated messages asking to post on social media.


</details>

</details>

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (20)</summary>

* GitHub Check: Rust packages (drive-abci) / Tests
* GitHub Check: Rust packages (dash-sdk) / Formatting
* GitHub Check: Rust packages (drive-abci) / Unused dependencies
* GitHub Check: Rust packages (drive-abci) / Linting
* GitHub Check: Rust packages (drive) / Tests
* GitHub Check: Rust packages (drive) / Linting
* GitHub Check: Rust packages (drive-abci) / Check each feature
* GitHub Check: Rust packages (drive) / Unused dependencies
* GitHub Check: Rust packages (dpp) / Linting
* GitHub Check: Rust packages (dpp) / Formatting
* GitHub Check: Rust packages (dpp) / Tests
* GitHub Check: Rust packages (dpp) / Unused dependencies
* GitHub Check: Rust packages (wasm-dpp) / Tests
* GitHub Check: Rust packages (wasm-dpp) / Formatting
* GitHub Check: Rust packages (wasm-dpp) / Linting
* GitHub Check: Rust packages (wasm-dpp) / Unused dependencies
* GitHub Check: Build Docker images (DAPI, dapi, dapi) / Build DAPI image
* GitHub Check: Build Docker images (Dashmate helper, dashmate-helper, dashmate-helper) / Build Dashmate helper image
* GitHub Check: Build Docker images (Drive, drive, drive-abci) / Build Drive image
* GitHub Check: Build JS packages / Build JS

</details>

<details>
<summary>🔇 Additional comments (1)</summary><blockquote>

<details>
<summary>packages/rs-dpp/src/state_transition/state_transitions/document/batch_transition/batched_transition/token_config_update_transition/validate_structure/mod.rs (1)</summary>

`27-27`: **Proper forwarding of platform_version parameter!**

The change correctly passes the platform_version parameter to the validate_structure_v0 method, enabling protocol version-aware validation. This is essential for implementing the restriction on perpetual distribution changes in token configurations.

</details>

</blockquote></details>

</details>
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKNxU3bABsvkCiQBHbGlcABpIcVwvOkgAIgAzEmoAClpubgBKEC5aJBVoxlhMUmQCHkpuElxsNF9cxFwKeAE8eHwseCwCAGsyBQx4+CJsKnF20NjIAHc0ZAcBZnUaejkI2BJIbERKSABFGoxq5gBRAA9uL3x/PlnrOwxHAR2AJgA2Z4B2fi71yAARWawbhoeQXajxK7MPwkbj4RDqK6yDQwX7MbRYTwUWHbfjxNYbWwoUr4SD1fIbTDyZiKeCDBjUNoYYn48pYqo1OpIRrNVrtexVcQYIjIKbqBA/DY9PpMAZDEYM8boBjdDD4KbRWhETpENbUezYBiwQrFaTofwKZgXEindAYejYDBMVjtDRuEnwS3RNiHNZIcK4X4AAwktXgtGoJAA+g0KAbqv5IxIAAyByBsAOKaa3bDccPLCLux1ebBKdCQENeMMKrCG0TdXW4aHxpm2yCBgCqTJzsIoywAYkl4yRjhQKFdU1N1lhMOhcDRLY3UGjS2VDSaWZU2dVaqSuU0WmMMMi4BtKGO+GxEIg0KRIBC+B2u+krv3ByNh6Px1nkLVECTqbkgwxGUHq8PgUiMF4zjqEibi/GuQqmkUEFPH0NANDEWzapA1pcthDrqBEISlEUjZMFIfABhsFZVoekCXFqDB3lcBa9DW7SDMMoyMpsuYRog4RkA4TRCiy5BTNCMbwGIPEeGOm5ePIZD3gwdDHr8hK0PgpqqouhxjrQBoUhg8gCP4aDdNhCElK6BgnjgGZ8EUyAyoMFBsPQTpWnR+B4lRhR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g52z5n8y0tXTKQzqCjNF5MmX6wZly92UslZSX1lQ9mT99oezNvI4s+cxQlz1bFOE3rQ2H10YxCeRbPEVs9F2SzQtxgtRfBlGDHrn5mcrPpp3bWiUnzPflf8DF11hwv6u0DGDiHyWocw/mRObMUOHU8Dqm7OrzAGtw7NMMTK4dI74GjrIcIHuAsHK9zt5Ivv8kEI1H7oFeBbSgnkZy5m4QDwDwkoRfwqlJDkehIkWuqlOoAax/V79kqV4uTefwpbVGXetVFKx2DwD8y6aHLJ0vpX9fe5TOESc0kjT+CCPAfw8+M+arbiDxHX9kPInA7Q/oHDfBcMHixUJiDaCVlEvb6YfC0zDyCYiK3KiYyYSamJSbyKHj2JybNrOI8BKZaIeLiDWyzaUIki/7gEbDr7vgwGOJpLwGuLKbaIoEij/4YbfDBL+SdASBXxfyvQziJKVq9zO4UrJ6dRPoljGToC0C5CHg7jOC57sBFJays5UxwzuIvR4hoAoz3JW6eQsCZTYxoC4yODmymRgyKAQxqBkwwyUwGASEZTqCRhhiICRiRwTQzLxy9gUziGPSQAACMqkSYog8QAALAwA4W4R8GgG4QAMwMAACcfhAArM8EmA4R8H4SQA4SEYEbQM8AAByJGvBJhoB+G0BuECD0Cwz2GBEhGpGBEkBJiJGeG0CBHxFuHeERFuGJEfBuFJi0A+GvAtHxCJEhEMB+ECAfAlEbD3QGH2FGG4AmEjzmEkDjS8IzLPS2FAA== -->

<!-- internal state end -->
<!-- finishing_touch_checkbox_start -->

<details open="true">
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=dashpay/platform&utm_content=2627):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Explain this complex logic.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai explain this code block.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and explain its main purpose.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

### Support

Need help? Create a ticket on our [support page](https://www.coderabbit.ai/contact-us/support) for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai generate sequence diagram` to generate a sequence diagram of the changes in this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### CodeRabbit Configuration File (`.coderabbit.yaml`)

- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->

@QuantumExplorer QuantumExplorer changed the title feat!: disable changes to perpetual distribution in token configuration feat(dpp)!: disable changes to perpetual distribution in token configuration May 22, 2025
@QuantumExplorer
Copy link
Copy Markdown
Member Author

Self Reviewed

@QuantumExplorer QuantumExplorer merged commit bbaea23 into v2.0-dev May 22, 2025
124 of 125 checks passed
@QuantumExplorer QuantumExplorer deleted the featdisable-perpetual-distribution-changes branch May 22, 2025 13:20
@thephez thephez added this to the v2.0.0 milestone May 29, 2025
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.

2 participants