Skip to content

Conversation

@pauldelucia
Copy link
Member

@pauldelucia pauldelucia commented Feb 19, 2025

Issue being fixed or feature implemented

Proofs were not working for Pause, Resume, and Unfreeze token transitions if the tokens kept historical documents because the Token History contract was not configured properly.

What was done?

  1. Change emergency_action action field to enum so that the action integer is converted to u8 instead of u64
  2. Set frozenIdentityId to Identifier rather than a byte array

How Has This Been Tested?

DET

Breaking Changes

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
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

  • New Features

    • Introduced additional metadata for token operations, improving identifier handling.
    • Added new content media types for enhanced compatibility with token operations.
    • Updated action definitions for emergency actions to clarify functionality.
    • Enhanced error handling with new variants for token distribution errors, improving robustness.
    • Added new methods for managing timestamps and block heights in data contracts, improving auditability.
  • Documentation

    • Updated descriptions in token creation and configuration processes for enhanced clarity.
    • Reordered input fields for improved logical grouping and better user understanding.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 19, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This pull request updates the JSON schema in the token history contract. The modifications include updates in the "mint" object (updating the description of the "amount" property and reordering "note"), additions of a "contentMediaType" attribute in both "unfreeze" and "destroyFrozenFunds" objects for the "tokenId" and "frozenIdentityId" properties, an updated "action" property in the "emergencyAction" object with an enum, and a revised description for the "changeItemType" property in the "configUpdate" object.

Changes

File Change Summary
packages/token-history-contract/.../token-history-contract-documents.json - Mint Object: Updated "amount" description from "The amount that was burned" to "The amount that was minted"; moved "note" to position 3.
- Unfreeze & DestroyFrozenFunds Objects: Added "contentMediaType" ("application/x.dash.dpp.identifier") to "tokenId" and "frozenIdentityId".
- EmergencyAction: Updated "action" property to include enum values [0, 1] and modified description.
- ConfigUpdate: Updated "changeItemType" description to "The action we are performing".

Possibly Related PRs

  • fix(dpp): invalid feature flag usage #2477: The changes in the main PR, which involve updates to the JSON schema for various token-related objects, are related to the retrieved PR, which modifies the import paths for PrivateEncryptedNote and SharedEncryptedNote to a centralized tokens module, affecting how these types are utilized in token transitions. Both PRs focus on token management and involve modifications to the same types.
  • feat: add token transitions to SDK and DAPI #2434: The changes in the main PR, which involve updates to the JSON schema for various token-related objects, are related to the retrieved PR, which adds token transitions and modifies the handling of token-related data in the SDK and DAPI. Both PRs focus on enhancing the functionality and structure of token management within the system.
  • fix: destroy frozen funds used wrong identity and proof verification #2467: The changes in the main PR, which involve updates to the JSON schema for various token-related objects, are related to the retrieved PR, which modifies the handling of token destruction and identity verification in the context of frozen funds. Both PRs focus on token management and involve changes to how identities and token amounts are processed, indicating a direct connection at the code level.

Suggested Reviewers

  • pauldelucia

Poem

I'm a little rabbit with a coder's delight,
Hopping 'round schema fields, coding day and night.
Mint now sings with a refreshed amount gleam,
Unfreeze and destroy get a media type dream.
With emergency hops and config tunes so bright,
I celebrate these changes – coding magic in flight! 🐇

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 for 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 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 for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/token-history-contract/schema/v1/token-history-contract-documents.json (1)

654-654: Verify closing brace formatting.

The closing brace on line 654 is marked as changed. Please confirm that this alteration, possibly related to formatting or whitespace adjustments, is intentional and consistent with the project's style guidelines.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 04276d5 and 80e6423.

📒 Files selected for processing (1)
  • packages/token-history-contract/schema/v1/token-history-contract-documents.json (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: Rust packages (drive-abci) / Tests
  • GitHub Check: Rust packages (drive-abci) / Linting
  • GitHub Check: Rust packages (drive) / Tests
  • GitHub Check: Build Docker images (Dashmate helper, dashmate-helper, dashmate-helper) / Build Dashmate helper image
  • GitHub Check: Build JS packages / Build JS
🔇 Additional comments (4)
packages/token-history-contract/schema/v1/token-history-contract-documents.json (4)

155-156: Update mint.amount description.

The description for the amount property in the mint object has been changed from "The amount that was burned" to "The amount that was minted". This update aligns the schema with the intended behavior for mint operations. Please ensure that any dependent documentation or client validations are also updated accordingly.


417-418: Add contentMediaType to unfreeze.tokenId.

The tokenId property in the unfreeze object now explicitly includes a contentMediaType with the value "application/x.dash.dpp.identifier". This addition brings consistency with other schema properties that require explicit media type definitions.


426-427: Add contentMediaType to unfreeze.frozenIdentityId.

Similarly, the frozenIdentityId property in the unfreeze object now has an added contentMediaType attribute. This change standardizes the documentation of identifier properties, reinforcing clarity for consumers of the schema.


568-573: Define maximum value for emergencyAction.action.

The new "maximum": 255 constraint for the action property within the emergencyAction object now ensures that the action value fits within an 8-bit unsigned integer (u8). This modification meets the PR objective for handling token transition proofs and enhances data validation.

"action": {
"type": "integer",
"minimum": 0,
"maximum": 255,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we use enum?

@pauldelucia pauldelucia requested a review from shumkov February 24, 2025 07:41
@QuantumExplorer QuantumExplorer merged commit 379e4a6 into v2.0-dev Mar 11, 2025
21 of 22 checks passed
@QuantumExplorer QuantumExplorer deleted the fix/token-history-contract branch March 11, 2025 09:32
lklimek added a commit that referenced this pull request Mar 17, 2025
chore: update to latest dash core 37 (#2483)

feat(platform)!: token advanced distribution and updates (#2471)

fix: token history contract (#2474)

Co-authored-by: Ivan Shumkov <ivan@shumkov.ru>
Co-authored-by: QuantumExplorer <quantum@dash.org>

fix(drive): using new rust dash core methods for reversed quorum hash to maintain backwards compatibility (#2489)

feat: more granular integer document property types (#2455)

Co-authored-by: Quantum Explorer <quantum@dash.org>

docs: update comment for data contract code range (#2476)

feat: validate token name localizations (#2468)

feat(sdk): get identity by non-unique keys

build(deps): update grovedb to current develop

test: test identity by non-unique pubkey hashes

fix(sdk): dash core client fails to get quorum

chore: minor fixes

test(drive-abci): identity by non-unique pubkey start after

chore: minor changes to verify

feat(sdk): token and group queries (#2449)

chore: revert limit 1 => limit none

chore: add non-unique key to test identities

test(sdk): test vectors for test_fetch_identity_by_non_unique_public_keys

fix(platform)!: token distribution fixes and tests (#2494)

chore(platform): bump to version 2.0.0-dev.1 (#2495)

test: update assertion

fix(sdk): make some things public (#2496)

feat(platform): require token for document actions (#2498)

fix: data contract proof doesn't work  with new auto fields (#2501)
lklimek added a commit that referenced this pull request Mar 18, 2025
chore: update to latest dash core 37 (#2483)

feat(platform)!: token advanced distribution and updates (#2471)

fix: token history contract (#2474)

Co-authored-by: Ivan Shumkov <ivan@shumkov.ru>
Co-authored-by: QuantumExplorer <quantum@dash.org>

fix(drive): using new rust dash core methods for reversed quorum hash to maintain backwards compatibility (#2489)

feat: more granular integer document property types (#2455)

Co-authored-by: Quantum Explorer <quantum@dash.org>

docs: update comment for data contract code range (#2476)

feat: validate token name localizations (#2468)

feat(sdk): get identity by non-unique keys

build(deps): update grovedb to current develop

test: test identity by non-unique pubkey hashes

fix(sdk): dash core client fails to get quorum

chore: minor fixes

test(drive-abci): identity by non-unique pubkey start after

chore: minor changes to verify

feat(sdk): token and group queries (#2449)

chore: revert limit 1 => limit none

chore: add non-unique key to test identities

test(sdk): test vectors for test_fetch_identity_by_non_unique_public_keys

fix(platform)!: token distribution fixes and tests (#2494)

chore(platform): bump to version 2.0.0-dev.1 (#2495)

test: update assertion

fix(sdk): make some things public (#2496)

feat(platform): require token for document actions (#2498)

fix: data contract proof doesn't work  with new auto fields (#2501)
@thephez thephez added this to the v2.0.0 milestone Apr 14, 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.

5 participants