Skip to content

Conversation

pauldelucia
Copy link
Member

@pauldelucia pauldelucia commented Apr 8, 2025

Issue being fixed or feature implemented

What was done?

How Has This Been Tested?

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 a new system search contract that enhances search functionality and metadata management.
    • Data contracts now support additional metadata fields for keywords and descriptions, improving searchability and documentation.
  • Enhancements

    • Strengthened validations on keywords and descriptions to ensure proper length, encoding, and uniqueness.
    • Updated workspace configurations and dependency management to integrate the new search module seamlessly.
    • Added new error handling capabilities related to keyword management and description validation.

@pauldelucia pauldelucia changed the base branch from v2.0-dev to feat/token-search-contract April 8, 2025 12:40
Copy link
Contributor

coderabbitai bot commented Apr 8, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This update integrates the new @dashevo/search-contract package into the workspace, updating dependency arrays and build configurations. It introduces new fields (keywords and description) into data contracts with added accessors, setters, serialization logic, and enhanced error handling for validation. In addition, the drive layer and state transition processes are extended to manage these metadata fields, and the protocol upgrade functions now handle both token history and search contracts. The changes also include various test updates and reorganizations in platform and SDK modules to support the new contract functionalities.

Changes

File(s) Change Summary
.pnp.cjs, root Cargo.toml, Dockerfile, package.json Added references to the new @dashevo/search-contract package in workspace configs, raw runtime state, dependency arrays, and build COPY commands.
packages/data-contracts/**, packages/rs-dpp/src/data_contract/** Introduced a new contract (search_contract), added keywords and description fields, updated enum variants, serialization methods, and accessors for enhanced data contract metadata.
packages/rs-dpp/src/errors/consensus/basic/**, packages/rs-dpp/src/errors/consensus/codes.rs Added multiple new error variants (e.g. TooManyKeywordsError, DuplicateKeywordsError, InvalidKeywordLengthError, InvalidKeywordEncodingError, InvalidDescriptionLengthError) for detailed contract validation.
packages/rs-drive-abci/**, packages/rs-drive/src/drive/contract/insert/**, packages/rs-drive/src/drive/group/prove/**, packages/rs-drive/src/drive/tokens/**, packages/rs-drive/tests/** Extended drive operations to include new contract description and keyword insertions; updated processing fees, protocol upgrade transitions, and test assertions (including application hash updates).
packages/rs-platform-version/src/version/system_data_contract_versions/** Added new version fields (token_history and search) to system data contract versions.
packages/rs-sdk/tests/vectors/** Updated test vectors by adding new quorum public key files and removing deprecated ones, with revised expected hash values.
packages/search-contract/** Updated contract description in Cargo.toml, revised contractId in lib/systemIds.js, restructured JSON schema keys and modules (renaming from “contract” to “contractKeywords”, “token” to “shortDescription”, and adding “fullDescription”).
packages/token-history-contract/src/lib.rs Modified load functions to reference token_history instead of wallet contracts, with updated error messages.

Possibly related PRs

  • feat: more granular integer document property types #2455: The changes in the main PR are related to the changes in the retrieved PR, as both focus on enhancing the handling of integer document property types within the data contract schema. The main PR introduces a new method DocumentPropertyType::try_from_value_map that incorporates validation rules to create more granular numeric types, while the retrieved PR deprecates the existing DocumentPropertyType::try_from_name method and replaces it with the new try_from_value_map method. Both PRs aim to address the issue of aligning the document type parser with the intended data contract schema that supports defining integer types with validation rules.

Suggested labels

dapi-endpoint, js-sdk

Poem

I hopped through code with cheerful delight,
Adding keywords and descriptions so bright,
New contracts sprout with metadata anew,
In tests and functions, the changes ring true,
My rabbit heart dances with every commit,
Celebrating these updates with a joyful hop and a bit of wit!


🪧 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 plan to trigger planning for file edits and PR creation.
  • @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.

@pauldelucia pauldelucia marked this pull request as ready for review April 9, 2025 11:33
@pauldelucia pauldelucia changed the base branch from feat/token-search-contract to v2.0-dev April 9, 2025 11:35
@pauldelucia pauldelucia marked this pull request as draft April 9, 2025 11:36
@pauldelucia pauldelucia marked this pull request as ready for review April 9, 2025 11:36
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: 3

🔭 Outside diff range comments (1)
packages/rs-dpp/src/data_contract/serialized_version/mod.rs (1)

116-145: ⚠️ Potential issue

Update needed in equality comparison.

The eq_without_auto_fields method doesn't include the new keywords and description fields in the comparison for V1 formats. This could lead to equality checks not accounting for differences in these fields.

Apply this update to the equality method:

v1_self.id == v1_other.id
    && v1_self.config == v1_other.config
    && v1_self.version == v1_other.version
    && v1_self.owner_id == v1_other.owner_id
    && v1_self.schema_defs == v1_other.schema_defs
    && v1_self.document_schemas == v1_other.document_schemas
    && v1_self.groups == v1_other.groups
    && v1_self.tokens == v1_other.tokens
+   && v1_self.keywords == v1_other.keywords
+   && v1_self.description == v1_other.description
🧹 Nitpick comments (12)
packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json (1)

1-1: Test Vector File – Intentional Format Without Trailing Newline

This file adds a hash value as a test vector for validating data contracts. Although it does not include a trailing newline and shows a static analysis error about string quoting, this format is consistent with similar test files used in our framework. If a trailing newline is desired based on style guidelines, consider adding one; otherwise, this is acceptable as-is.

🧰 Tools
🪛 Biome (1.9.4)

[error] 1-1: String values must be double quoted.

(parse)

packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/mod.rs (1)

135-155: The Display implementation needs updating.

The fmt implementation for TokenConfigurationV0 in the Display trait hasn't been updated to include the new description field. This could lead to incomplete debug information when the struct is displayed.

- write!(
-     f,
-     "TokenConfigurationV0 {{\n  conventions: {:?},\n  conventions_change_rules: {:?},\n  base_supply: {},\n  max_supply: {:?},\n  keeps_history: {},\n  start_as_paused: {},\n  max_supply_change_rules: {:?},\n  distribution_rules: {},\n  manual_minting_rules: {:?},\n  manual_burning_rules: {:?},\n  freeze_rules: {:?},\n  unfreeze_rules: {:?},\n  destroy_frozen_funds_rules: {:?},\n  emergency_action_rules: {:?},\n  main_control_group: {:?},\n  main_control_group_can_be_modified: {:?}\n}}",
-     self.conventions,
-     self.conventions_change_rules,
-     self.base_supply,
-     self.max_supply,
-     self.keeps_history,
-     self.start_as_paused,
-     self.max_supply_change_rules,
-     self.distribution_rules,
-     self.manual_minting_rules,
-     self.manual_burning_rules,
-     self.freeze_rules,
-     self.unfreeze_rules,
-     self.destroy_frozen_funds_rules,
-     self.emergency_action_rules,
-     self.main_control_group,
-     self.main_control_group_can_be_modified
+ write!(
+     f,
+     "TokenConfigurationV0 {{\n  conventions: {:?},\n  conventions_change_rules: {:?},\n  base_supply: {},\n  max_supply: {:?},\n  keeps_history: {},\n  start_as_paused: {},\n  max_supply_change_rules: {:?},\n  distribution_rules: {},\n  manual_minting_rules: {:?},\n  manual_burning_rules: {:?},\n  freeze_rules: {:?},\n  unfreeze_rules: {:?},\n  destroy_frozen_funds_rules: {:?},\n  emergency_action_rules: {:?},\n  main_control_group: {:?},\n  main_control_group_can_be_modified: {:?},\n  description: {:?}\n}}",
+     self.conventions,
+     self.conventions_change_rules,
+     self.base_supply,
+     self.max_supply,
+     self.keeps_history,
+     self.start_as_paused,
+     self.max_supply_change_rules,
+     self.distribution_rules,
+     self.manual_minting_rules,
+     self.manual_burning_rules,
+     self.freeze_rules,
+     self.unfreeze_rules,
+     self.destroy_frozen_funds_rules,
+     self.emergency_action_rules,
+     self.main_control_group,
+     self.main_control_group_can_be_modified,
+     self.description
packages/rs-drive-abci/tests/supporting_files/contract/keyword_test/keyword_base_contract.json (1)

1-40: New test contract with keywords field.

This test contract JSON file includes the new keywords array to support testing the contract descriptions feature. The structure is well-formed with all required fields and proper schema definition for the preorder document type.

Consider adding a test case with non-empty keywords to validate the full functionality of the feature.

packages/rs-dpp/src/data_contract/v1/data_contract.rs (1)

111-115: New fields for enhanced contract metadata

The addition of keywords and description fields enhances the contract's metadata capabilities. However, the description field lacks detailed documentation compared to the keywords field.

Consider adding documentation for the description field similar to the keywords field, explaining its purpose, constraints (if any), and expected format:

 /// The tokens on the contract.
 pub tokens: BTreeMap<TokenContractPosition, TokenConfiguration>,

 /// The contract's keywords for searching
 pub keywords: Vec<String>,

-/// The contract's description
+/// The contract's description - provides additional context about the purpose and functionality
+/// of the contract. This field is optional and can be left as None if no description is needed.
 pub description: Option<String>,
packages/rs-dpp/schema/meta_schemas/document/v0/document-meta.json (1)

587-597: Consider Adding a Pattern Property for ASCII Validation
The new "keywords" property correctly enforces length and uniqueness. If you'd like to ensure keywords are ASCII only at the schema level (to match code-level validations), consider adding a "pattern" field:

   "keywords": {
     "type": "array",
     "description": "List of up to 20 descriptive keywords for the contract, used in the Keyword Search contract",
     "items": {
       "type": "string",
       "minLength": 3,
       "maxLength": 50
+      "pattern": "^[\\u0000-\\u007F]+$"
     },
     "maxItems": 20,
     "uniqueItems": true
   },
packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/mod.rs (2)

2450-3008: Use a helper function to avoid repeated test patterns.

Within the mod keywords block, several tests follow the same workflow: load a base contract, mutate it, create a state transition, process it, and check the outcome. Consider extracting this workflow into a shared utility to reduce duplication, keep tests succinct, and enhance maintainability.


3009-3326: Add boundary checks for description length tests.

The tests in mod descriptions thoroughly verify short and long description handling. To prevent off-by-one issues, consider adding boundary-specific tests for exactly 3-character and exactly 100-character descriptions, ensuring the validation logic remains correct at limit edges.

packages/rs-drive/src/drive/contract/insert/add_new_keywords/mod.rs (1)

16-134: Plan for future versions in version checks.

The version checks for 0 and 1 are straightforward, but future versions (e.g., 2) may require additional logic. Proactively designing a clear fallback or extension mechanism for these match arms can simplify maintenance and reduce the risk of version mismatches.

packages/rs-drive/src/drive/contract/insert/add_description/v0/mod.rs (4)

50-85: Confirm function naming consistency.

Within this function, the call to self.add_new_contract_description_operations(...) references a function named without the _v0 suffix, while the actual method is declared as add_new_contract_description_operations_v0(...). Ensure this mismatch is intentional (e.g., a type alias or re-export) or adjust to maintain consistent naming conventions.


88-160: Centralize short vs. full description logic.

The code handles two description types ("shortDescription" and "fullDescription") in a largely repetitive manner. Consider extracting a helper that receives a boolean or an enum to handle both in a single pass, reducing code duplication and potential maintenance overhead.


177-182: Avoid needless late initialization.

Per the static analysis hint, the document_type_name variable can be declared directly. Here’s an example fix:

-        let document_type_name;
-        if full_description {
-            document_type_name = "fullDescription".to_string();
-        } else {
-            document_type_name = "shortDescription".to_string();
-        }
+        let document_type_name = if full_description {
+            "fullDescription".to_string()
+        } else {
+            "shortDescription".to_string()
+        };
🧰 Tools
🪛 GitHub Check: Rust packages (drive) / Linting

[failure] 177-177: unneeded late initialization
error: unneeded late initialization
--> packages/rs-drive/src/drive/contract/insert/add_description/v0/mod.rs:177:9
|
177 | let document_type_name;
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_late_init
= note: -D clippy::needless-late-init implied by -D warnings
= help: to override -D warnings add #[allow(clippy::needless_late_init)]
help: move the declaration document_type_name here and remove the assignments from the branches
|
177 ~
178 ~ let document_type_name = if full_description {
179 ~ "fullDescription".to_string()
180 | } else {
181 ~ "shortDescription".to_string()
182 ~ };
|


22-22: Use &str parameter type instead of &String.

Passing description: &String can be replaced with a more idiomatic &str. This avoids unnecessary binding to a String reference. Consider updating both parameters and internal usage if the code does not rely on String-specific methods.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d2ca233 and 6bb6653.

⛔ Files ignored due to path filters (2)
  • Cargo.lock is excluded by !**/*.lock
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (79)
  • .pnp.cjs (3 hunks)
  • Cargo.toml (1 hunks)
  • Dockerfile (13 hunks)
  • package.json (1 hunks)
  • packages/data-contracts/Cargo.toml (1 hunks)
  • packages/data-contracts/src/error.rs (1 hunks)
  • packages/data-contracts/src/lib.rs (4 hunks)
  • packages/rs-dpp/schema/meta_schemas/document/v0/document-meta.json (4 hunks)
  • packages/rs-dpp/src/data_contract/accessors/mod.rs (3 hunks)
  • packages/rs-dpp/src/data_contract/accessors/v1/mod.rs (2 hunks)
  • packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/mod.rs (2 hunks)
  • packages/rs-dpp/src/data_contract/mod.rs (1 hunks)
  • packages/rs-dpp/src/data_contract/serialized_version/mod.rs (2 hunks)
  • packages/rs-dpp/src/data_contract/serialized_version/v1/mod.rs (4 hunks)
  • packages/rs-dpp/src/data_contract/v1/accessors/mod.rs (2 hunks)
  • packages/rs-dpp/src/data_contract/v1/data_contract.rs (2 hunks)
  • packages/rs-dpp/src/data_contract/v1/serialization/mod.rs (3 hunks)
  • packages/rs-dpp/src/errors/consensus/basic/basic_error.rs (2 hunks)
  • packages/rs-dpp/src/errors/consensus/basic/data_contract/duplicate_keywords_error.rs (1 hunks)
  • packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_description_length_error.rs (1 hunks)
  • packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_keyword_encoding_error.rs (1 hunks)
  • packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_keyword_length_error.rs (1 hunks)
  • packages/rs-dpp/src/errors/consensus/basic/data_contract/keywords_over_limit.rs (1 hunks)
  • packages/rs-dpp/src/errors/consensus/basic/data_contract/mod.rs (3 hunks)
  • packages/rs-dpp/src/errors/consensus/codes.rs (1 hunks)
  • packages/rs-drive-abci/src/execution/check_tx/v0/mod.rs (5 hunks)
  • packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/test/tokens.rs (5 hunks)
  • packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/v1/mod.rs (1 hunks)
  • packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs (1 hunks)
  • packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/creation.rs (2 hunks)
  • packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/advanced_structure/v0/mod.rs (2 hunks)
  • packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/mod.rs (1 hunks)
  • packages/rs-drive-abci/tests/supporting_files/contract/keyword_test/keyword_base_contract.json (1 hunks)
  • packages/rs-drive/src/cache/system_contracts.rs (3 hunks)
  • packages/rs-drive/src/drive/contract/insert/add_description/mod.rs (1 hunks)
  • packages/rs-drive/src/drive/contract/insert/add_description/v0/mod.rs (1 hunks)
  • packages/rs-drive/src/drive/contract/insert/add_new_keywords/mod.rs (1 hunks)
  • packages/rs-drive/src/drive/contract/insert/add_new_keywords/v0/mod.rs (1 hunks)
  • packages/rs-drive/src/drive/contract/insert/insert_contract/v1/mod.rs (1 hunks)
  • packages/rs-drive/src/drive/contract/insert/mod.rs (1 hunks)
  • packages/rs-drive/src/drive/group/prove/prove_action_infos/v0/mod.rs (2 hunks)
  • packages/rs-drive/src/drive/group/prove/prove_action_signers/v0/mod.rs (3 hunks)
  • packages/rs-drive/src/drive/group/prove/prove_group_info/v0/mod.rs (2 hunks)
  • packages/rs-drive/src/drive/group/prove/prove_group_infos/v0/mod.rs (2 hunks)
  • packages/rs-drive/src/drive/tokens/balance/prove_identities_token_balances/v0/mod.rs (3 hunks)
  • packages/rs-drive/src/drive/tokens/balance/prove_identity_token_balances/v0/mod.rs (3 hunks)
  • packages/rs-drive/src/drive/tokens/info/prove_identities_token_infos/v0/mod.rs (3 hunks)
  • packages/rs-drive/src/drive/tokens/info/prove_identity_token_infos/v0/mod.rs (2 hunks)
  • packages/rs-drive/src/drive/tokens/status/prove_token_statuses/v0/mod.rs (1 hunks)
  • packages/rs-drive/src/drive/tokens/system/prove_token_total_supply_and_aggregated_identity_balances/v0/mod.rs (2 hunks)
  • packages/rs-drive/tests/deterministic_root_hash.rs (1 hunks)
  • packages/rs-drive/tests/query_tests.rs (15 hunks)
  • packages/rs-drive/tests/query_tests_history.rs (2 hunks)
  • packages/rs-platform-version/src/version/drive_versions/drive_contract_method_versions/v2.rs (1 hunks)
  • packages/rs-platform-version/src/version/system_data_contract_versions/mod.rs (1 hunks)
  • packages/rs-platform-version/src/version/system_data_contract_versions/v1.rs (1 hunks)
  • packages/rs-sdk/tests/vectors/document_list_document_query/quorum_pubkey-106-1f0a25d463a2912cd31dd4f91b899a143d6ae990bb9bc89cb34f7c5db8b1b705.json (0 hunks)
  • packages/rs-sdk/tests/vectors/document_list_document_query/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json (1 hunks)
  • packages/rs-sdk/tests/vectors/document_list_drive_query/quorum_pubkey-106-1f0a25d463a2912cd31dd4f91b899a143d6ae990bb9bc89cb34f7c5db8b1b705.json (0 hunks)
  • packages/rs-sdk/tests/vectors/document_list_drive_query/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json (1 hunks)
  • packages/rs-sdk/tests/vectors/document_read/quorum_pubkey-106-1f0a25d463a2912cd31dd4f91b899a143d6ae990bb9bc89cb34f7c5db8b1b705.json (0 hunks)
  • packages/rs-sdk/tests/vectors/document_read/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json (1 hunks)
  • packages/rs-sdk/tests/vectors/document_read_no_contract/quorum_pubkey-106-1f0a25d463a2912cd31dd4f91b899a143d6ae990bb9bc89cb34f7c5db8b1b705.json (0 hunks)
  • packages/rs-sdk/tests/vectors/document_read_no_contract/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json (1 hunks)
  • packages/rs-sdk/tests/vectors/document_read_no_document/quorum_pubkey-106-1f0a25d463a2912cd31dd4f91b899a143d6ae990bb9bc89cb34f7c5db8b1b705.json (0 hunks)
  • packages/rs-sdk/tests/vectors/document_read_no_document/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json (1 hunks)
  • packages/rs-sdk/tests/vectors/test_data_contract_read/quorum_pubkey-106-1f0a25d463a2912cd31dd4f91b899a143d6ae990bb9bc89cb34f7c5db8b1b705.json (0 hunks)
  • packages/rs-sdk/tests/vectors/test_data_contract_read/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json (1 hunks)
  • packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/quorum_pubkey-106-1f0a25d463a2912cd31dd4f91b899a143d6ae990bb9bc89cb34f7c5db8b1b705.json (0 hunks)
  • packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json (1 hunks)
  • packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/quorum_pubkey-106-1f0a25d463a2912cd31dd4f91b899a143d6ae990bb9bc89cb34f7c5db8b1b705.json (0 hunks)
  • packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json (1 hunks)
  • packages/search-contract/Cargo.toml (1 hunks)
  • packages/search-contract/lib/systemIds.js (1 hunks)
  • packages/search-contract/schema/v1/search-contract-documents.json (2 hunks)
  • packages/search-contract/src/lib.rs (2 hunks)
  • packages/search-contract/src/v1/mod.rs (1 hunks)
  • packages/token-history-contract/src/lib.rs (1 hunks)
  • packages/wasm-dpp/src/errors/consensus/consensus_error.rs (2 hunks)
💤 Files with no reviewable changes (8)
  • packages/rs-sdk/tests/vectors/document_list_document_query/quorum_pubkey-106-1f0a25d463a2912cd31dd4f91b899a143d6ae990bb9bc89cb34f7c5db8b1b705.json
  • packages/rs-sdk/tests/vectors/document_list_drive_query/quorum_pubkey-106-1f0a25d463a2912cd31dd4f91b899a143d6ae990bb9bc89cb34f7c5db8b1b705.json
  • packages/rs-sdk/tests/vectors/document_read_no_contract/quorum_pubkey-106-1f0a25d463a2912cd31dd4f91b899a143d6ae990bb9bc89cb34f7c5db8b1b705.json
  • packages/rs-sdk/tests/vectors/document_read_no_document/quorum_pubkey-106-1f0a25d463a2912cd31dd4f91b899a143d6ae990bb9bc89cb34f7c5db8b1b705.json
  • packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/quorum_pubkey-106-1f0a25d463a2912cd31dd4f91b899a143d6ae990bb9bc89cb34f7c5db8b1b705.json
  • packages/rs-sdk/tests/vectors/test_data_contract_read/quorum_pubkey-106-1f0a25d463a2912cd31dd4f91b899a143d6ae990bb9bc89cb34f7c5db8b1b705.json
  • packages/rs-sdk/tests/vectors/document_read/quorum_pubkey-106-1f0a25d463a2912cd31dd4f91b899a143d6ae990bb9bc89cb34f7c5db8b1b705.json
  • packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/quorum_pubkey-106-1f0a25d463a2912cd31dd4f91b899a143d6ae990bb9bc89cb34f7c5db8b1b705.json
🧰 Additional context used
🧠 Learnings (9)
packages/rs-sdk/tests/vectors/test_data_contract_read/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json (1)
Learnt from: lklimek
PR: dashpay/platform#2030
File: packages/rs-sdk/tests/vectors/test_asset_lock_proof/quorum_pubkey-100-4ce7fd81273c2b394c0f32367374fc5b09ba912e017aacb366d2171e9ca6f9d5.json:1-1
Timestamp: 2025-04-06T00:27:18.424Z
Learning: In the `packages/rs-sdk/tests/vectors/test_asset_lock_proof/` directory, files with the `.json` extension are mock data that may not follow standard JSON format; this is intentional and acceptable within the project's testing framework.
packages/rs-sdk/tests/vectors/document_list_document_query/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json (1)
Learnt from: lklimek
PR: dashpay/platform#2030
File: packages/rs-sdk/tests/vectors/test_asset_lock_proof/quorum_pubkey-100-4ce7fd81273c2b394c0f32367374fc5b09ba912e017aacb366d2171e9ca6f9d5.json:1-1
Timestamp: 2025-04-06T00:27:18.424Z
Learning: In the `packages/rs-sdk/tests/vectors/test_asset_lock_proof/` directory, files with the `.json` extension are mock data that may not follow standard JSON format; this is intentional and acceptable within the project's testing framework.
packages/rs-sdk/tests/vectors/document_read/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json (1)
Learnt from: lklimek
PR: dashpay/platform#2030
File: packages/rs-sdk/tests/vectors/test_asset_lock_proof/quorum_pubkey-100-4ce7fd81273c2b394c0f32367374fc5b09ba912e017aacb366d2171e9ca6f9d5.json:1-1
Timestamp: 2025-04-06T00:27:18.424Z
Learning: In the `packages/rs-sdk/tests/vectors/test_asset_lock_proof/` directory, files with the `.json` extension are mock data that may not follow standard JSON format; this is intentional and acceptable within the project's testing framework.
packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json (1)
Learnt from: lklimek
PR: dashpay/platform#2030
File: packages/rs-sdk/tests/vectors/test_asset_lock_proof/quorum_pubkey-100-4ce7fd81273c2b394c0f32367374fc5b09ba912e017aacb366d2171e9ca6f9d5.json:1-1
Timestamp: 2025-04-06T00:27:18.424Z
Learning: In the `packages/rs-sdk/tests/vectors/test_asset_lock_proof/` directory, files with the `.json` extension are mock data that may not follow standard JSON format; this is intentional and acceptable within the project's testing framework.
packages/rs-sdk/tests/vectors/document_list_drive_query/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json (1)
Learnt from: lklimek
PR: dashpay/platform#2030
File: packages/rs-sdk/tests/vectors/test_asset_lock_proof/quorum_pubkey-100-4ce7fd81273c2b394c0f32367374fc5b09ba912e017aacb366d2171e9ca6f9d5.json:1-1
Timestamp: 2025-04-06T00:27:18.424Z
Learning: In the `packages/rs-sdk/tests/vectors/test_asset_lock_proof/` directory, files with the `.json` extension are mock data that may not follow standard JSON format; this is intentional and acceptable within the project's testing framework.
packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json (1)
Learnt from: lklimek
PR: dashpay/platform#2030
File: packages/rs-sdk/tests/vectors/test_asset_lock_proof/quorum_pubkey-100-4ce7fd81273c2b394c0f32367374fc5b09ba912e017aacb366d2171e9ca6f9d5.json:1-1
Timestamp: 2025-04-06T00:27:18.424Z
Learning: In the `packages/rs-sdk/tests/vectors/test_asset_lock_proof/` directory, files with the `.json` extension are mock data that may not follow standard JSON format; this is intentional and acceptable within the project's testing framework.
packages/rs-sdk/tests/vectors/document_read_no_document/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json (1)
Learnt from: lklimek
PR: dashpay/platform#2030
File: packages/rs-sdk/tests/vectors/test_asset_lock_proof/quorum_pubkey-100-4ce7fd81273c2b394c0f32367374fc5b09ba912e017aacb366d2171e9ca6f9d5.json:1-1
Timestamp: 2025-04-06T00:27:18.424Z
Learning: In the `packages/rs-sdk/tests/vectors/test_asset_lock_proof/` directory, files with the `.json` extension are mock data that may not follow standard JSON format; this is intentional and acceptable within the project's testing framework.
packages/rs-sdk/tests/vectors/document_read_no_contract/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json (1)
Learnt from: lklimek
PR: dashpay/platform#2030
File: packages/rs-sdk/tests/vectors/test_asset_lock_proof/quorum_pubkey-100-4ce7fd81273c2b394c0f32367374fc5b09ba912e017aacb366d2171e9ca6f9d5.json:1-1
Timestamp: 2025-04-06T00:27:18.424Z
Learning: In the `packages/rs-sdk/tests/vectors/test_asset_lock_proof/` directory, files with the `.json` extension are mock data that may not follow standard JSON format; this is intentional and acceptable within the project's testing framework.
packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs (1)
Learnt from: shumkov
PR: dashpay/platform#2345
File: packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs:93-99
Timestamp: 2025-04-06T00:27:18.424Z
Learning: In `packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs`, the `insert_contract` method requires an owned `BlockInfo`, so cloning `block_info` is necessary when calling it.
🧬 Code Graph Analysis (18)
packages/data-contracts/src/error.rs (1)
packages/rs-dpp/src/data_contract/serialized_version/v1/mod.rs (1)
  • from (104-182)
packages/rs-dpp/src/data_contract/serialized_version/v1/mod.rs (3)
packages/rs-dpp/src/data_contract/accessors/mod.rs (2)
  • keywords (273-278)
  • description (287-292)
packages/rs-dpp/src/data_contract/accessors/v1/mod.rs (2)
  • keywords (68-68)
  • description (74-74)
packages/rs-dpp/src/data_contract/v1/accessors/mod.rs (2)
  • keywords (229-231)
  • description (239-241)
packages/rs-drive-abci/src/execution/check_tx/v0/mod.rs (1)
packages/rs-drive-abci/src/platform_types/state_transitions_processing_result/mod.rs (1)
  • aggregated_fees (99-101)
packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/advanced_structure/v0/mod.rs (5)
packages/rs-drive/src/state_transition_action/system/bump_identity_nonce_action/transformer.rs (1)
  • from_borrowed_data_contract_create_transition (62-70)
packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_description_length_error.rs (2)
  • new (24-29)
  • description (35-37)
packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_keyword_length_error.rs (2)
  • new (24-29)
  • keyword (35-37)
packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_keyword_encoding_error.rs (2)
  • new (24-29)
  • keyword (35-37)
packages/rs-dpp/src/data_contract/serialized_version/mod.rs (3)
  • id (53-58)
  • keywords (102-107)
  • description (109-114)
packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_description_length_error.rs (2)
packages/rs-dpp/src/data_contract/serialized_version/mod.rs (1)
  • description (109-114)
packages/rs-dpp/src/errors/consensus/basic/basic_error.rs (1)
  • from (540-542)
packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_keyword_length_error.rs (2)
packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_keyword_encoding_error.rs (4)
  • new (24-29)
  • contract_id (31-33)
  • keyword (35-37)
  • from (41-43)
packages/rs-dpp/src/errors/consensus/basic/basic_error.rs (1)
  • from (540-542)
packages/rs-dpp/src/errors/consensus/basic/data_contract/duplicate_keywords_error.rs (1)
packages/rs-dpp/src/errors/consensus/basic/data_contract/keywords_over_limit.rs (3)
  • new (24-29)
  • contract_id (31-33)
  • from (41-43)
packages/rs-drive/src/drive/contract/insert/add_new_keywords/mod.rs (4)
packages/rs-drive/src/state_transition_action/batch/batched_transition/document_transition/document_create_transition_action/v0/mod.rs (1)
  • block_info (53-53)
packages/rs-dpp/src/data_contract/accessors/mod.rs (3)
  • version (41-46)
  • owner_id (48-53)
  • keywords (273-278)
packages/rs-dpp/src/data_contract/v1/accessors/mod.rs (3)
  • version (33-35)
  • owner_id (37-39)
  • keywords (229-231)
packages/rs-dpp/src/data_contract/accessors/v1/mod.rs (1)
  • keywords (68-68)
packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/creation.rs (8)
packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/mod.rs (3)
  • None (937-937)
  • None (947-947)
  • None (1298-1298)
packages/rs-dpp/src/data_contract/document_type/accessors/v0/mod.rs (1)
  • creation_restriction_mode (74-74)
packages/rs-dpp/src/data_contract/document_type/v0/accessors.rs (1)
  • creation_restriction_mode (98-100)
packages/rs-dpp/src/data_contract/document_type/v1/accessors.rs (1)
  • creation_restriction_mode (100-102)
packages/rs-dpp/src/document/extended_document/accessors.rs (1)
  • entropy (192-196)
packages/rs-platform-value/src/types/identifier.rs (1)
  • random_with_rng (155-157)
packages/rs-dpp/src/state_transition/state_transitions/document/batch_transition/v1/v0_methods.rs (1)
  • new_document_creation_transition_from_document (131-171)
packages/rs-drive-abci/src/platform_types/state_transitions_processing_result/mod.rs (1)
  • invalid_paid_count (79-81)
packages/rs-dpp/src/data_contract/accessors/v1/mod.rs (2)
packages/rs-dpp/src/data_contract/accessors/mod.rs (6)
  • keywords (273-278)
  • keywords_mut (280-285)
  • description (287-292)
  • description_mut (294-299)
  • set_keywords (434-438)
  • set_description (441-445)
packages/rs-dpp/src/data_contract/v1/accessors/mod.rs (6)
  • keywords (229-231)
  • keywords_mut (234-236)
  • description (239-241)
  • description_mut (244-246)
  • set_keywords (297-299)
  • set_description (302-304)
packages/rs-dpp/src/data_contract/accessors/mod.rs (2)
packages/rs-dpp/src/data_contract/accessors/v1/mod.rs (6)
  • keywords (68-68)
  • keywords_mut (71-71)
  • description (74-74)
  • description_mut (77-77)
  • set_keywords (112-112)
  • set_description (115-115)
packages/rs-dpp/src/data_contract/v1/accessors/mod.rs (6)
  • keywords (229-231)
  • keywords_mut (234-236)
  • description (239-241)
  • description_mut (244-246)
  • set_keywords (297-299)
  • set_description (302-304)
packages/rs-dpp/src/data_contract/v1/accessors/mod.rs (2)
packages/rs-dpp/src/data_contract/accessors/mod.rs (6)
  • keywords (273-278)
  • keywords_mut (280-285)
  • description (287-292)
  • description_mut (294-299)
  • set_keywords (434-438)
  • set_description (441-445)
packages/rs-dpp/src/data_contract/accessors/v1/mod.rs (6)
  • keywords (68-68)
  • keywords_mut (71-71)
  • description (74-74)
  • description_mut (77-77)
  • set_keywords (112-112)
  • set_description (115-115)
packages/rs-drive/src/drive/contract/insert/add_description/v0/mod.rs (4)
packages/rs-drive/src/state_transition_action/batch/batched_transition/document_transition/document_create_transition_action/v0/mod.rs (1)
  • block_info (53-53)
packages/rs-dpp/src/data_contract/accessors/v1/mod.rs (1)
  • description (74-74)
packages/rs-drive/src/drive/contract/insert/add_new_keywords/v0/mod.rs (1)
  • None (63-63)
packages/rs-drive/src/drive/contract/insert/insert_contract/v1/mod.rs (1)
  • None (103-103)
packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_keyword_encoding_error.rs (2)
packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_keyword_length_error.rs (4)
  • new (24-29)
  • contract_id (31-33)
  • keyword (35-37)
  • from (41-43)
packages/rs-dpp/src/errors/consensus/basic/basic_error.rs (1)
  • from (540-542)
packages/rs-drive/src/drive/contract/insert/add_new_keywords/v0/mod.rs (4)
packages/rs-drive/src/state_transition_action/batch/batched_transition/document_transition/document_create_transition_action/v0/mod.rs (1)
  • block_info (53-53)
packages/rs-dpp/src/data_contract/accessors/v1/mod.rs (1)
  • keywords (68-68)
packages/rs-drive/src/drive/contract/insert/add_description/v0/mod.rs (1)
  • None (63-63)
packages/rs-drive/src/drive/contract/insert/insert_contract/v1/mod.rs (1)
  • None (103-103)
packages/rs-drive/src/drive/contract/insert/add_description/mod.rs (4)
packages/rs-drive/src/state_transition_action/batch/batched_transition/document_transition/document_create_transition_action/v0/mod.rs (1)
  • block_info (53-53)
packages/rs-dpp/src/data_contract/accessors/mod.rs (3)
  • version (41-46)
  • owner_id (48-53)
  • description (287-292)
packages/rs-dpp/src/data_contract/v1/accessors/mod.rs (3)
  • version (33-35)
  • owner_id (37-39)
  • description (239-241)
packages/rs-dpp/src/data_contract/accessors/v1/mod.rs (1)
  • description (74-74)
packages/rs-dpp/src/errors/consensus/basic/data_contract/keywords_over_limit.rs (1)
packages/rs-dpp/src/errors/consensus/basic/data_contract/duplicate_keywords_error.rs (3)
  • new (24-29)
  • contract_id (31-33)
  • from (41-43)
packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs (1)
packages/rs-drive/src/state_transition_action/batch/batched_transition/document_transition/document_create_transition_action/v0/mod.rs (1)
  • block_info (53-53)
🪛 Biome (1.9.4)
packages/rs-sdk/tests/vectors/test_data_contract_read/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json

[error] 1-1: String values must be double quoted.

(parse)

packages/rs-sdk/tests/vectors/document_list_document_query/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json

[error] 1-1: String values must be double quoted.

(parse)

packages/rs-sdk/tests/vectors/document_read/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json

[error] 1-1: String values must be double quoted.

(parse)

packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json

[error] 1-1: String values must be double quoted.

(parse)

packages/rs-sdk/tests/vectors/document_list_drive_query/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json

[error] 1-1: String values must be double quoted.

(parse)

packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json

[error] 1-1: String values must be double quoted.

(parse)

packages/rs-sdk/tests/vectors/document_read_no_document/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json

[error] 1-1: String values must be double quoted.

(parse)

packages/rs-sdk/tests/vectors/document_read_no_contract/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json

[error] 1-1: String values must be double quoted.

(parse)

🪛 GitHub Check: Rust packages (drive) / Linting
packages/rs-drive/src/drive/contract/insert/add_description/v0/mod.rs

[failure] 177-177: unneeded late initialization
error: unneeded late initialization
--> packages/rs-drive/src/drive/contract/insert/add_description/v0/mod.rs:177:9
|
177 | let document_type_name;
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_late_init
= note: -D clippy::needless-late-init implied by -D warnings
= help: to override -D warnings add #[allow(clippy::needless_late_init)]
help: move the declaration document_type_name here and remove the assignments from the branches
|
177 ~
178 ~ let document_type_name = if full_description {
179 ~ "fullDescription".to_string()
180 | } else {
181 ~ "shortDescription".to_string()
182 ~ };
|

⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: Rust packages (drive-abci) / Tests
  • GitHub Check: Rust packages (drive) / Tests
  • GitHub Check: Rust packages (dpp) / Check each feature
  • 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
🔇 Additional comments (130)
packages/rs-sdk/tests/vectors/document_read_no_document/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json (1)

1-1: Clarification on JSON formatting in test vector file

The file contains a raw hash string used as test vector data. Although the static analysis tool flags that string values "must be double quoted" (to comply with standard JSON), the project intentionally uses a non-standard format for these test vectors as noted in the retrieved learnings. This deviation is acceptable within this testing framework.

🧰 Tools
🪛 Biome (1.9.4)

[error] 1-1: String values must be double quoted.

(parse)

packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json (1)

1-1: Test vector file added for data contract read not found scenario.

This file contains a hash value that will be used as test data for scenarios where a data contract is not found. The format without quotes is intentional and acceptable within the project's testing framework, as confirmed by previous learnings.

🧰 Tools
🪛 Biome (1.9.4)

[error] 1-1: String values must be double quoted.

(parse)

packages/rs-sdk/tests/vectors/test_data_contract_read/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json (1)

1-1: Test vector file added for successful data contract read scenario.

This file contains the same hash value as the "not found" test vector but is placed in the "test_data_contract_read" directory, suggesting it's used to test the successful read path. The format without quotes is intentional within the project's testing framework.

🧰 Tools
🪛 Biome (1.9.4)

[error] 1-1: String values must be double quoted.

(parse)

packages/data-contracts/Cargo.toml (1)

21-21: Integration of the search-contract package.

This change adds the search-contract as a dependency of the data-contracts package, enabling the integration of contract description and keyword functionality.

package.json (1)

70-71: Addition of search-contract to workspace packages.

The search-contract package has been correctly added to the workspaces array, ensuring it's properly managed within the project's build and package system. This change is necessary for the integration of the new contract description functionality.

packages/rs-drive/tests/deterministic_root_hash.rs (1)

305-305: Updated expected application hash value.

The expected application hash for protocol versions > 8 has been updated to reflect the changes introduced by adding the search-contract functionality. This update is necessary to make the test pass with the new contract capabilities.

Cargo.toml (1)

32-33: Added new search-contract package to workspace members

The PR adds the new "packages/search-contract" to the workspace members list, allowing it to be managed as part of the project workspace. This aligns with the contract descriptions feature introduced in this PR.

packages/rs-drive-abci/src/execution/check_tx/v0/mod.rs (4)

633-633: Updated processing fee expectation for data contract creation

The expected processing fee has been increased from 2488410 to 2489210 to account for the additional cost of handling the new contract metadata fields (keywords and description).


1144-1144: Updated processing fee for data contract creation with fee multiplier

The expected processing fee has been increased from 4976820 to 4978420 to reflect the additional cost when creating contracts with the new metadata fields while using a fee multiplier.


1702-1702: Updated expected processing fee for contract update test

The expected processing fee for data contract updates has been adjusted from 2503110 to 2504030 to account for the additional processing required for contract metadata fields.


2072-2072: Updated processing fee for the latest protocol version test

Similar to the other test cases, the expected processing fee has been increased from 2488410 to 2489210 to accommodate the new contract metadata features.

Dockerfile (7)

383-383: New search-contract package integration is consistent.

The addition of packages/search-contract in the COPY instructions is properly aligned with other contract packages, maintaining the build structure.


459-459: Consistent integration of search-contract across multiple build stages.

The search-contract package has been correctly added to all relevant build stages, ensuring proper dependency handling throughout the Docker build process.

Also applies to: 556-556, 680-680, 757-757


71-89: Improved formatting consistency in RUN command.

The alignment of package names has been updated for better readability without changing functionality.


112-115: Improved formatting consistency in command parameters.

The command parameters for rustup toolchain installation are now properly aligned for better readability.


182-185: Improved formatting in curl command chain.

The continuation lines in the curl command chain have been properly aligned for better readability.


330-335: Improved formatting in architecture detection condition.

The architecture detection conditions have been properly aligned for better readability.


425-432: Improved indentation in conditional blocks.

The indentation in conditional blocks has been standardized for better code readability.

Also applies to: 487-496

packages/rs-drive/tests/query_tests_history.rs (2)

1668-1671: Updated expected root hash reflects search-contract integration.

The root hash value has been updated to reflect changes in the underlying data structure due to the integration of the search-contract package.


3034-3037: Updated second root hash value for consistency.

The final root hash assertion has been updated to match the new expected value after integrating the search-contract package, maintaining test consistency.

packages/rs-drive/tests/query_tests.rs (1)

2512-2513: The updated application hash values align with new contract metadata support.

These changes update the expected application hash values in multiple test cases to match the new state of the application after integrating the @dashevo/search-contract package, which adds support for metadata fields like keywords and descriptions in data contracts.

Also applies to: 3977-3978, 4547-4548, 5542-5543, 5638-5639, 6041-6042, 6251-6252, 6446-6447, 6645-6646

packages/rs-sdk/tests/vectors/document_read/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json (1)

1-1: Test Vector File – Intentional Non-Standard Formatting

This file adds a single hash value for use as a test vector. The absence of typical JSON quoting (i.e. double quotes) is intentional in our testing framework, as confirmed by prior examples and learning notes.

🧰 Tools
🪛 Biome (1.9.4)

[error] 1-1: String values must be double quoted.

(parse)

packages/rs-sdk/tests/vectors/document_list_drive_query/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json (1)

1-1: Test Vector File – Consistent Structure for Drive Query

This file similarly adds a hash value intended as a test vector for the document list drive query functionality. The non-standard JSON formatting (i.e. missing double quotes) should be ignored as it is an accepted practice within our project’s test vectors.

🧰 Tools
🪛 Biome (1.9.4)

[error] 1-1: String values must be double quoted.

(parse)

packages/rs-sdk/tests/vectors/document_list_document_query/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json (1)

1-1: Test Vector File – Consistent Structure for Document Query

This addition of a hash value as test data is consistent with other test vector files in the repository. The static analysis error regarding double-quoting is a false positive here – these files are meant to provide raw hash strings.

🧰 Tools
🪛 Biome (1.9.4)

[error] 1-1: String values must be double quoted.

(parse)

packages/search-contract/Cargo.toml (1)

3-3: Grammatical Improvement in Description

The description for the search-contract package has been updated to improve grammatical clarity ("Search contract is used to find other contracts and tokens"). This enhancement aids readability without affecting functionality.

packages/rs-sdk/tests/vectors/document_read_no_contract/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json (1)

1-1: File format appears correct for test vectors.

The file format follows the pattern used for other test vector files in the project, containing a hash value without JSON formatting. While the static analysis tool flags this as a formatting issue, this is intentional and acceptable within the project's testing framework as confirmed by previous learnings.

🧰 Tools
🪛 Biome (1.9.4)

[error] 1-1: String values must be double quoted.

(parse)

packages/rs-drive/src/drive/contract/insert/mod.rs (1)

2-5:

✅ Verification successful

New modules for contract description and keywords look good.

The addition of modules for contract descriptions and keywords with the #[allow(clippy::too_many_arguments)] attribute is appropriate. This suppresses warnings about functions with many parameters, which may be necessary for the implementation.

While this approach works, consider reviewing the implementations in these modules to see if the number of parameters could be reduced by using parameter objects or a builder pattern in the future:


🏁 Script executed:

#!/bin/bash
# Check implementations of the new modules to understand parameter counts
find packages/rs-drive/src/drive/contract/insert/add_description/ packages/rs-drive/src/drive/contract/insert/add_new_keywords/ -type f -name "*.rs" -exec cat {} \; | grep -A 2 "pub fn"

Length of output: 788


Module Implementation Review: Contract Description and Keywords

The new modules for contract descriptions and keywords are implemented cleanly. After reviewing the implementations, it appears that each function only accepts one primary parameter (contract_id), apart from the &self reference. This indicates that the current use of #[allow(clippy::too_many_arguments)] is precautionary rather than necessary at the moment.

Recommendations:

  • The functions in both modules currently exhibit minimal parameter usage.
  • While the current implementation is acceptable, if additional parameters are expected in the future, consider refactoring to use parameter objects or a builder pattern to manage complexity more effectively.
packages/rs-dpp/src/data_contract/mod.rs (1)

76-80: Addition of EMPTY_KEYWORDS static variable is appropriate.

The new EMPTY_KEYWORDS static variable follows the established pattern of the existing empty collections and is correctly reflected in the updated comment. This addition supports the new keyword functionality in data contracts.

packages/rs-platform-version/src/version/system_data_contract_versions/v1.rs (1)

11-12: Addition of token_history and search contract versions is appropriate.

The new fields for token history and search contracts are correctly initialized to version 1. This aligns with the broader changes in the PR to support search functionality, including the introduction of the @dashevo/search-contract package.

packages/search-contract/lib/systemIds.js (1)

3-3:

❓ Verification inconclusive

Contract ID has been updated

The contract ID has been changed to a new value. This appears to be part of the integration of the new @dashevo/search-contract package into the workspace.


🏁 Script executed:

#!/bin/bash
# Check for any other references to the old contract ID in the codebase
rg -l "8v8CoKCDdBcQu1Y7GDNJjR7a5vkMmgpXycJURkaUhfU9" --type js --type ts --type json

Length of output: 84


Contract ID Update Verification: Manual Confirmation Requested

  • File: packages/search-contract/lib/systemIds.js (Line 3)
    The contract ID has been updated to:

    contractId: '7CSFGeF4WNzgDmx94zwvHkYaG3Dx4XEe5LFsFgJswLbm',
    
  • Search Verification:
    A search for occurrences of the old contract ID
    "8v8CoKCDdBcQu1Y7GDNJjR7a5vkMmgpXycJURkaUhfU9"
    in JavaScript, TypeScript, and JSON files returned no results.
    However, since the initial search did not produce output and may be limited to specific file types, please manually verify that this old contract ID is not referenced elsewhere in the repository (including configuration or documentation files).

packages/rs-platform-version/src/version/drive_versions/drive_contract_method_versions/v2.rs (2)

20-20: Comment formatting improved

The comment now has better spacing but maintains the same meaning and the code value remains unchanged.


22-22: No functional change

This line contains a trailing comment that has been reformatted but doesn't change the functionality of the code.

packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/v1/mod.rs (1)

54-57:

✅ Verification successful

Added search contract to system data contracts

The Search system data contract has been added to the initialization process. This is part of integrating the new search contract functionality.


🏁 Script executed:

#!/bin/bash
# Verify that the load_search method exists in the system_data_contracts implementation
rg -A 5 "fn load_search" --type rust

Length of output: 325


Verified: Search Contract Integration Confirmed

The addition of the Search system data contract is correctly implemented. The verification shows that the load_search method exists (in packages/rs-drive/src/cache/system_contracts.rs) and is being called as expected in the initialization process.

  • File: packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/v1/mod.rs (Lines 54-57)
  • Verified Call: system_data_contracts.load_search() correctly retrieves the Search contract.
packages/rs-drive/src/drive/tokens/status/prove_token_statuses/v0/mod.rs (1)

97-98:

✅ Verification successful

Added new metadata fields to DataContractV1

Added keywords and description fields to the DataContractV1 structure used in tests, which is consistent with the changes to the actual DataContractV1 structure throughout the codebase. The test initializes these new fields with default values (empty vector and None).


🏁 Script executed:

#!/bin/bash
# Verify that these fields are added consistently in other DataContractV1 instances
ast-grep --pattern $'DataContractV1 {
  $$$
  keywords: $_,
  description: $_,
  $$$
}'

Length of output: 66063


Verified: Consistent Metadata Field Additions to DataContractV1

The new keywords and description fields are now consistently initialized with default values (empty vector and None) across all instances of DataContractV1 in both the test code and production serialization code. Verification using the AST search confirmed that these fields appear as expected in every instantiation across the codebase (including files in packages/rs-dpp, packages/rs-drive, etc.).

Key locations include:

  • packages/rs-drive/src/drive/tokens/status/prove_token_statuses/v0/mod.rs (Lines 97–98):
                keywords: Vec::new(),
                description: None,
    
  • Other instances in similar files (e.g., tokens system, token infos, balance, etc.) consistently add the same default initializations.

The changes align with the updated structure of DataContractV1 throughout the repository.

packages/rs-drive/src/drive/group/prove/prove_group_infos/v0/mod.rs (2)

137-138: Added new metadata fields to DataContractV1 structure

The new fields keywords and description extend the contract's metadata capabilities. They're initialized appropriately with an empty vector and None value respectively.


283-284: Consistent implementation of metadata fields

The same fields are consistently implemented in the second test case, maintaining structural consistency across test fixtures.

packages/rs-platform-version/src/version/system_data_contract_versions/mod.rs (1)

13-14: Added versioning support for new system contracts

The SystemDataContractVersions struct has been expanded to include versioning for two new features: token_history and search, which aligns with the PR's purpose of adding contract descriptions functionality.

packages/rs-drive/src/drive/tokens/info/prove_identity_token_infos/v0/mod.rs (2)

108-109: Added consistent metadata fields to token info tests

The keywords and description fields are properly added to the contract definition, maintaining consistency with the changes seen in other files.


257-258: Consistent implementation in non-existent identity test

The new metadata fields are consistently implemented in the second test case for non-existent identities, ensuring structural uniformity across test cases.

packages/search-contract/src/lib.rs (2)

19-19: Updated version checking to use search contract versioning

The function now correctly references platform_version.system_data_contracts.search rather than withdrawals, aligning with the new system contract structure added in this PR.


29-29: Consistent versioning reference for document schemas

The document schema loading function has been updated to also use the search contract versioning, maintaining consistency with the previous function.

packages/rs-drive/src/drive/tokens/balance/prove_identities_token_balances/v0/mod.rs (3)

100-101: New contract metadata fields added.

The keywords and description fields have been added to the DataContractV1 struct in test functions, which align with the contract description metadata capability being implemented across the codebase.


202-203: Consistent implementation of contract metadata fields.

Same fields added to another test case, maintaining consistency throughout the test suite.


295-296: Contract metadata fields properly implemented.

The consistency in implementation across all test cases in this file ensures that all test contract instances are correctly structured with the new metadata fields.

packages/data-contracts/src/error.rs (1)

140-155: Error handling for the new search_contract module.

This implementation maps search_contract-specific errors to the generic Error enum, ensuring consistent error handling across the platform. The approach follows the same pattern as other contract types, properly handling both UnknownVersionMismatch and InvalidSchemaJson error variants.

packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/mod.rs (2)

60-61: Added optional description field to TokenConfigurationV0.

The new description field has been added with #[serde(default)] annotation, making it properly handle cases where the field is not present in serialized data.


270-270: Default initialization for description field.

Properly initializes the new description field to None in the default_most_restrictive method, maintaining the expected default behavior.

packages/rs-drive/src/drive/group/prove/prove_action_signers/v0/mod.rs (3)

151-152: Added contract metadata fields.

The new keywords and description fields have been properly added to the DataContractV1 struct in the test cases.


321-322: Consistent metadata implementation across test cases.

The contract metadata fields are consistently implemented in all test instances, maintaining test integrity.


416-417: Complete implementation of contract metadata fields.

The changes maintain a consistent approach to the new metadata fields across all test cases, ensuring proper test coverage for the extended contract structure.

packages/rs-drive/src/drive/tokens/system/prove_token_total_supply_and_aggregated_identity_balances/v0/mod.rs (2)

91-92: New data contract fields added.

The addition of keywords and description fields to the DataContractV1 structure aligns with the contract descriptions feature being implemented. These fields are properly initialized with default values.


218-219: Same fields added consistently.

The keywords and description fields are consistently added to this test case as well, maintaining parity with the structure changes.

packages/rs-dpp/src/data_contract/serialized_version/mod.rs (3)

24-24: Added import for EMPTY_KEYWORDS constant.

Proper import of the EMPTY_KEYWORDS constant to be used in the serialization format.


102-107: New keywords accessor implementation.

The keywords() method is properly implemented to handle both V0 and V1 serialization formats, returning an empty vector for V0 and the actual keywords for V1.


109-114: New description accessor implementation.

The description() method is correctly implemented with version-specific handling, returning None for V0 format and the actual description for V1 format.

packages/rs-drive/src/drive/tokens/info/prove_identities_token_infos/v0/mod.rs (3)

100-101: New data contract fields added to first test case.

The keywords and description fields are properly initialized with default values in the first test case.


202-203: New data contract fields added to second test case.

Same fields are consistently added to the second test case.


293-294: New data contract fields added to third test case.

The fields are consistently applied across all test cases, maintaining code consistency.

packages/rs-dpp/src/data_contract/v1/serialization/mod.rs (2)

114-115: Initializing new fields with appropriate defaults

The additions of keywords and description with default values in the try_from_platform_versioned_v0 method ensure backward compatibility when deserializing from older contract formats.


142-143: Proper handling of new fields in V1 deserialization

The code correctly destructures the new keywords and description fields from the serialization format and properly assigns them when constructing the DataContractV1 instance.

Also applies to: 172-173

packages/rs-dpp/src/data_contract/v1/data_contract.rs (2)

64-68: Well-documented constraints for keywords field

The documentation clearly explains the purpose and constraints of the keywords field, including uniqueness requirements and the maximum limit of 20 keywords.


64-68:

✅ Verification successful

Verify validation logic for keywords constraints

The documentation mentions constraints for the keywords field (uniqueness, maximum count of 20), but I don't see the validation logic in the provided code segments.

Also applies to: 111-115


🏁 Script executed:

#!/bin/bash
# Search for validation logic related to keywords constraints
echo "Searching for keyword validation logic..."
rg -A 5 -B 5 "keywords.*validation|validation.*keywords" --type rust

# Look for error types related to keywords
echo "Looking for error types related to keywords..."
rg "keyword.*error|error.*keyword" --type rust

Length of output: 2322


Validation Logic Confirmed

The keywords constraints are indeed validated elsewhere in the codebase even though the doc comment in packages/rs-dpp/src/data_contract/v1/data_contract.rs (lines 64–68) doesn't explicitly show the validation code. Our search revealed that the following validations are in place:

  • Uniqueness: Duplicate keywords are checked and trigger an error defined in packages/rs-dpp/src/errors/consensus/basic/data_contract/duplicate_keywords_error.rs.
  • Maximum Count (20): An over-limit condition is enforced with an error in packages/rs-dpp/src/errors/consensus/basic/data_contract/keywords_over_limit.rs.
  • ASCII Encoding: Non-ASCII keywords trigger an error in packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_keyword_encoding_error.rs.
  • Length Restrictions (3–50 characters): Keyword length is validated via an error in packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_keyword_length_error.rs.

Additionally, validations are executed in the appropriate validation module (e.g., via calls to validate in packages/rs-dpp/src/validation/byte_array_keyword.rs).

It would be beneficial to reference or comment on this separation in documentation to clarify that the validation logic resides in the dedicated validation modules and error types.

.pnp.cjs (3)

68-71: New Package Entry in Dependency List

The new object for @dashevo/search-contract is added correctly with its name and reference properties. Please ensure that this configuration matches your workspace's expected format and that corresponding updates (e.g., in Cargo.toml and package.json) are synchronized.


108-108: Dependency Array Update

The dependency array now includes the @dashevo/search-contract entry. This addition is consistent with the structure of the other entries. Confirm that the ordering and syntax remain valid as per your dependency management requirements.


2887-2904: Detailed Package Configuration for @dashevo/search-contract

The new detailed configuration block for @dashevo/search-contract has been integrated properly. It specifies the package location, a comprehensive list of package dependencies, and sets the linkType to "SOFT". Verify that all version references (e.g., for dirty-chai, eslint, etc.) align with your workspace standards and that there are no conflicts with other packages.

packages/rs-drive/src/cache/system_contracts.rs (3)

20-21: Addition of search contract field looks good.

The new field is well-documented and follows the pattern established for other system contracts in the struct.


50-53: Proper initialization of search contract field.

The initialization follows the same pattern as other system contracts, using the load_system_data_contract function with the appropriate system data contract variant.


82-85: Good implementation of the accessor method for search contract.

The load_search method follows the same pattern as other accessor methods in the struct, maintaining code consistency.

packages/rs-drive/src/drive/group/prove/prove_action_infos/v0/mod.rs (2)

156-157: New contract fields added appropriately.

The addition of keywords and description fields to the data contract structure in the test is properly initialized with default values.


385-386: New contract fields added appropriately.

The addition of keywords and description fields to the data contract structure in the second test matches the implementation in the first test, ensuring consistency.

packages/rs-dpp/src/errors/consensus/codes.rs (1)

109-113: Well-structured error codes for new validation errors.

The new error codes for keyword and description validation follow the established pattern and use sequential numbering after existing error codes in the appropriate section (DataContract Errors: 10200-10349).

packages/rs-drive/src/drive/group/prove/prove_group_info/v0/mod.rs (2)

109-110: New contract fields added appropriately.

The addition of keywords and description fields to the data contract structure in the first test case is properly initialized with default values.


180-181: New contract fields added appropriately.

The addition of keywords and description fields to the data contract structure in the second test case maintains consistency with the first test case.

packages/rs-drive/src/drive/contract/insert/insert_contract/v1/mod.rs (2)

310-320: Keywords handling logic looks correct

The implementation correctly checks if keywords are present in the contract before extending the batch operations with keyword-specific operations. This follows the established pattern in the codebase.


322-332: Description handling logic looks correct

The implementation correctly handles the optional contract description by conditionally adding it to batch operations when present. The pattern matches how other conditional fields are processed in this file.

packages/token-history-contract/src/lib.rs (1)

19-29:

❓ Verification inconclusive

Updated contract reference from "withdrawals" to "token_history"

The code correctly changes the match statement source from platform_version.system_data_contracts.withdrawals to platform_version.system_data_contracts.token_history and updates the error messages to reference "token_history_contract" rather than "wallet_contract". These changes maintain consistency with the overall architectural changes in the PR.


🏁 Script executed:

#!/bin/bash
# Verify there are no remaining references to "wallet_contract" in error messages within this package

# Check if there are any remaining instances of "wallet_contract" in the token-history-contract package
rg "wallet_contract" packages/token-history-contract/ --type rust

Length of output: 65


Verified Update – Please Manually Confirm Remaining References

The changes in packages/token-history-contract/src/lib.rs (lines 19–29) correctly update the contract reference from withdrawals to token_history. The match block now uses platform_version.system_data_contracts.token_history and the error message is updated to reference "token_history_contract::load_definitions" instead of "wallet_contract". A grep search for any lingering "wallet_contract" strings in the package returned no matches; however, given the low signal from the output, please manually verify that no outdated references remain across the codebase.

  • Confirm that the match statement in the file is solely referencing token_history.
  • Ensure no residual "wallet_contract" strings exist elsewhere in the package or related modules.
packages/rs-dpp/src/data_contract/serialized_version/v1/mod.rs (3)

63-69: New fields for contract metadata properly defined

The additions of keywords and description fields to the DataContractInSerializationFormatV1 struct look good. Both fields have appropriate #[serde(default)] attributes to ensure backward compatibility during deserialization.


135-136: Default values for keywords and description set appropriately for V0 contracts

The implementation correctly initializes default values (empty vector for keywords, None for description) when converting from a V0 contract, ensuring backward compatibility.


155-156: V1 contract field mapping looks good

The implementation correctly maps the fields from the V1 contract struct to the serialization format, preserving the values for both keywords and description.

Also applies to: 177-178

packages/rs-drive/src/drive/tokens/balance/prove_identity_token_balances/v0/mod.rs (1)

105-106: Tests updated with new contract fields

The tests have been properly updated to include the new keywords and description fields in all test instances of DataContractV1. The fields are initialized with appropriate default values, which is good practice for test data.

Also applies to: 267-268, 356-357

packages/rs-dpp/schema/meta_schemas/document/v0/document-meta.json (2)

230-232: No Functional Difference
These lines only change the format of the required array for position without altering behavior.


425-427: No Functional Difference
These lines only change the format of the required array for resolution without altering behavior.

packages/wasm-dpp/src/errors/consensus/consensus_error.rs (2)

64-64: Newly Imported Error Types
These added imports for advanced keyword/description errors align well with the existing framework.


764-778: New Match Arms for Keyword and Description Errors
Mapping the additional BasicError variants (e.g., TooManyKeywordsError, InvalidKeywordLengthError) is handled consistently.

packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs (2)

478-488: Token History Contract Insertion
Loading and inserting the token history contract with *block_info and Some(transaction) follows the existing insertion pattern.


489-498: Search Contract Insertion
Similarly adding the search contract with consistent parameters ensures both system data contracts are registered properly.

packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/advanced_structure/v0/mod.rs (4)

1-2: New Imports for Extended Validation
These imports pull in the new error types and are consistent with the extended keyword/description validations.

Also applies to: 8-10, 15-15, 17-17


159-174: Checking Keyword Count
Limiting keywords to 20 ensures compliance with design constraints. Properly returns a TooManyKeywordsError if exceeded.


176-229: Keyword Length, Encoding, and Uniqueness Checks
These checks comprehensively validate each keyword. The staged returns with distinct errors are clear and consistent with best practices.


231-250: Description Length Enforcement
Enforcing a 3-100 length range for the description matches the new requirement. Returning InvalidDescriptionLengthError is clear and consistent.

packages/rs-dpp/src/errors/consensus/basic/basic_error.rs (2)

78-81: New imports for keyword and description error handling.

These imports indicate the addition of new error types for validating data contract metadata fields like keywords and descriptions. This is a good practice to organize error handling for the new features.


523-536: Added new error variants for metadata field validation.

These five new BasicError variants provide comprehensive error handling for the newly introduced keywords and description fields in data contracts. Each error is appropriately transparent, delegating the error message to the wrapped error type, which follows the established pattern in this file.

packages/data-contracts/src/lib.rs (4)

12-12: New search_contract module imported and exported.

This addition makes the search contract available to other parts of the system, which is necessary for the new contract functionality being implemented.


27-27: Added new Search variant to SystemDataContract enum.

The new Search variant is correctly added with ID 7, following the established pattern for system contracts.


48-48: Updated id() method to handle new Search contract.

This change properly maps the Search enum variant to its corresponding ID bytes, maintaining consistency with the existing pattern.


108-114: Added source() method implementation for Search contract.

This implementation provides the necessary source information for the new Search contract, following the established pattern for other system contracts.

packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/creation.rs (1)

2473-2606: Added comprehensive test for document creation restriction on search contract.

This test thoroughly verifies that document creation is properly restricted when attempting to create documents on the Search system contract with NoCreationAllowed mode. The test follows best practices:

  1. It verifies the restriction mode is set correctly
  2. It attempts to create a document and validates the failure
  3. It checks both the returned error count and specific error message
  4. It ensures the transaction is properly committed

This is a valuable test case that strengthens the test coverage for document creation restrictions.

packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/test/tokens.rs (2)

227-227: Added description field to TokenConfigurationV0.

This change adds support for token descriptions in the test setup, initializing it with a test value.


252-253: Added keywords and description fields to DataContractV1.

These new fields properly initialize the metadata for the test data contract with sample values.

packages/search-contract/src/v1/mod.rs (3)

5-6: Renamed module improves semantic clarity

The renaming from contract to contract_keywords and constant value from "contract" to "contractKeywords" provides better semantic meaning, clearly indicating that this module deals with contract keywords rather than the contract itself.


13-19: New module for short description looks good

The addition of the short_description module with its NAME and KEY_INDEX constants is well-structured. Using "byContractId" as the index makes sense for efficient retrieval of descriptions for specific contracts.


21-26: Well-structured full description module

The implementation of the full_description module follows the same pattern as short_description, maintaining consistency in the codebase. The indexing strategy by contract ID is appropriate for this use case.

packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_keyword_length_error.rs (3)

8-21: Clear and well-structured error definition

The error struct is well-defined with appropriate derive macros and a clear error message that provides specific information about the valid length constraints (3-50 characters). The comment about not changing field order without versioning is a good practice for maintaining backward compatibility.


23-38: Constructor and accessor methods are appropriately implemented

The implementation provides a clean constructor and accessor methods that follow Rust conventions with immutable references to the internal fields.


40-44: Proper error conversion implementation

The From trait implementation correctly converts this specific error type into the more general ConsensusError type, enabling proper error propagation throughout the system.

packages/rs-dpp/src/data_contract/accessors/v1/mod.rs (2)

67-77: Well-documented getter methods for new contract metadata

The addition of getter methods for keywords and descriptions with proper documentation is well-implemented. The method signatures follow the established pattern in the trait, with immutable and mutable variants, maintaining consistency with the existing codebase.


111-115: Consistent setter implementation for new contract metadata

The setter methods for keywords and descriptions follow the same pattern as other setters in the trait, maintaining consistency in the API design. The documentation is clear and concise.

packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_keyword_encoding_error.rs (3)

8-21: Clear error definition for keyword encoding validation

The error struct is well-designed with appropriate traits derived and a descriptive error message that clearly indicates the requirement for ASCII-only keywords. The warning comment about field ordering is important for maintaining serialization compatibility.


23-38: Standard accessor pattern is properly followed

The constructor and accessor methods follow a consistent pattern with the other error types in the codebase, promoting code uniformity and maintainability.


40-44: Proper error conversion for error propagation

The From trait implementation correctly wraps this error into a ConsensusError, enabling proper error propagation through the consensus validation pipeline.

packages/rs-dpp/src/errors/consensus/basic/data_contract/duplicate_keywords_error.rs (1)

1-44: New error type looks good for handling duplicate keywords

This new error type is well-structured and follows the established pattern for error types in the codebase. The implementation includes proper fields for contract_id and keyword, accessor methods, and conversion to ConsensusError.

packages/search-contract/schema/v1/search-contract-documents.json (5)

2-2: Updated schema structure to use "contractKeywords" instead of "contract"

The renaming from "contract" to "contractKeywords" makes the schema more descriptive and better reflects its purpose.


24-31: Added contractId field with appropriate constraints

The new contractId field has been properly defined with the correct type, constraints, and content media type for a Dash identifier.


34-35: Updated required fields to include contractId

The required fields have been updated to include "contractId" instead of the previously used "$contractId".


39-77: Added shortDescription document type with appropriate structure

The shortDescription document type has been well-defined with proper constraints. It's immutable and has a clear description of its purpose.


78-115: Added fullDescription document type with appropriate structure

The fullDescription document type is properly defined with a higher maxLength (10000) compared to shortDescription (100), and it's correctly marked as mutable to allow for contract owner updates.

packages/rs-dpp/src/errors/consensus/basic/data_contract/keywords_over_limit.rs (1)

1-44: New error type for handling keyword limit exceeded

This new error type is well-structured and follows the established pattern for error types in the codebase. It correctly includes the maximum limit of 20 in the error message and provides proper accessor methods.

packages/rs-dpp/src/data_contract/accessors/mod.rs (3)

21-21: Import for EMPTY_KEYWORDS constant

Added import for EMPTY_KEYWORDS constant to provide default values for V0 contracts.


273-299: Added accessor methods for keywords and description

The implementation properly handles both V0 and V1 variants of DataContract, providing appropriate defaults (EMPTY_KEYWORDS or None) for V0 contracts and the actual values for V1 contracts.


433-445: Added setter methods for keywords and description

The setter methods correctly handle both V0 and V1 variants, with no operation for V0 contracts and properly updating the fields for V1 contracts.

packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_description_length_error.rs (1)

1-44: Well-structured error type implementation

The InvalidDescriptionLengthError is well-implemented following Rust best practices:

  • Appropriate trait derivations including Error, Debug, and serialization traits
  • Clear error message specifying the valid length constraints (3-100 characters)
  • Proper implementation of accessor methods for the error's fields
  • Integration with the consensus error system through the From trait

The unversioned platform serialization attribute and warning comment about field ordering are particularly important for maintaining compatibility.

packages/rs-dpp/src/data_contract/v1/accessors/mod.rs (2)

228-246: Good implementation of accessor methods for keywords and description

The getter methods are well-implemented with appropriate return types:

  • keywords() returns a non-optional reference because keywords always exist (as an empty vector at minimum)
  • keywords_mut() returns Option<&mut Vec<String>> consistent with the pattern used for other mutable accessors
  • The description getters correctly handle the optional nature of the field

The documentation comments are clear and helpful for understanding each method's purpose.


296-304: Well-defined setter methods for keywords and description

The implementation of the setter methods is straightforward and follows the same pattern as other setters in this trait. The methods handle the appropriate types (Vec for keywords and Option for description) and include helpful documentation comments.

packages/rs-dpp/src/errors/consensus/basic/data_contract/mod.rs (1)

12-12: Module structure properly extended for new error types

The module declarations and public use statements for the new error types (related to keywords and descriptions) are correctly added following the established pattern in the file. The naming conventions are consistent with existing error types, making the code maintainable and predictable.

Also applies to: 25-25, 31-32, 38-38, 77-77, 85-88, 94-94

packages/rs-drive/src/drive/contract/insert/add_description/mod.rs (4)

1-16: Good module structure and imports

The imports are well-organized, including all necessary dependencies for handling identifiers, transactions, errors, and platform versioning. The module organization with a separate v0 implementation follows good software engineering practices for versioning.


17-53: Well-implemented version-aware method for adding contract descriptions

The add_new_contract_description method properly handles different platform versions:

  • It rejects requests for version 0 with a clear "not supported" error message
  • It delegates to a version-specific implementation for version 1
  • It handles unknown versions with appropriate error details

This approach ensures backward compatibility while providing clear feedback when features are not supported.


55-93: Consistent implementation of operation aggregation method

The add_new_contract_description_add_to_operations method follows the same versioning pattern as the main method, ensuring consistency across the API. It allows for efficient batching of operations by adding to an existing vector rather than creating a new one.


95-134:

❓ Verification inconclusive

Verify the version checking logic

The method follows the same pattern as the others for version handling, but there's a potential inconsistency:

  • The code returns errors for version 0 stating "Contract descriptions are not supported in this version"
  • Yet it calls add_new_contract_description_operations_v0 for version 1

Ensure that the v0-named implementation is actually handling version 1 functionality correctly, or consider renaming for clarity.


🏁 Script executed:

#!/bin/bash
# Look for the implementation of the v0 methods to confirm versioning logic
fd -t f "v0.rs" packages/rs-drive/src/drive/contract/insert/add_description/ --exec cat {}

Length of output: 92


Subject: Confirm Version Handling Consistency in Contract Description Operations

It appears that the version check for contract description creation is implemented as follows:

  • For platform version 0: an error is returned indicating that contract descriptions are not supported.
  • For platform version 1: the code delegates to the function add_new_contract_description_operations_v0.

However, our initial search for a separate implementation file (e.g., a v0.rs file) yielded no result, which suggests that the v0-named implementation is likely defined inline in the same module. Please verify the following:

  • Implementation Check: Confirm that the function add_new_contract_description_operations_v0 (located in packages/rs-drive/src/drive/contract/insert/add_description/mod.rs) is indeed implemented to handle the version 1 functionality as expected.
  • Naming Clarity: Ensure that naming the implementation as "v0" (while it services platform version 1) is intentional; if not, consider renaming the function or adding an inline comment to clarify why a v0 implementation handles version 1.

Please review the implementation directly or run additional verification to ensure that the version handling logic is consistent and clear.

packages/rs-drive/src/drive/contract/insert/add_description/v0/mod.rs (2)

16-48: Ensure unit tests cover fee calculation logic.

The add_new_contract_description_v0 method calculates and returns fees after constructing the requisite low-level operations. While the implementation appears consistent, please confirm that unit or integration tests adequately validate the correctness of these fee calculations and that no edge cases (e.g., zero-length descriptions, large fee scenarios) are overlooked.


162-175: Validate nonce fallback logic.

When fetch_identity_nonce returns None, the code defaults to a nonce of 1. Ensure this fallback aligns with your intended identity versioning or increment logic. If this default behavior is merely a placeholder, consider exposing or documenting it more explicitly to avoid accidental collisions or confusion.

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 (4)
packages/rs-drive/src/drive/contract/insert/add_description/v0/mod.rs (4)

16-17: Clarify the reference to the "Identities" subtree.
The doc comment mentions inserting a description subtree into "Identities," but the code loads the "search" data contract. It would be clearer to explain how the contract relates to the "Identities" subtree or update the comment if that reference is inaccurate.


68-68: Ensure consistent naming for the function.
Here you call self.add_new_contract_description_operations(...), but the actual function is declared as add_new_contract_description_operations_v0. Consider aligning these names for clarity and maintainability.

-        let batch_operations = self.add_new_contract_description_operations(
+        let batch_operations = self.add_new_contract_description_operations_v0(

162-166: Use &str instead of &String in function parameters.
For idiomatic Rust, prefer &str over &String to avoid unnecessary indirections and improve flexibility.

-        description: &String,
+        description: &str,

16-214: Add or update tests for new functionality.
This file introduces critical functionality for handling contract descriptions, but there is no test coverage here or in related files referencing these methods. Consider adding comprehensive tests to validate the logic for short and full descriptions, fee calculations, and error handling.

Do you want me to help generate test stubs or open a new issue to track this task?

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6bb6653 and 4f25cf4.

📒 Files selected for processing (1)
  • packages/rs-drive/src/drive/contract/insert/add_description/v0/mod.rs (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/rs-drive/src/drive/contract/insert/add_description/v0/mod.rs (5)
packages/rs-drive/src/state_transition_action/batch/batched_transition/document_transition/document_create_transition_action/v0/mod.rs (1)
  • block_info (53-53)
packages/rs-dpp/src/data_contract/v1/accessors/mod.rs (1)
  • description (239-241)
packages/rs-dpp/src/data_contract/accessors/v1/mod.rs (1)
  • description (74-74)
packages/rs-drive/src/drive/contract/insert/add_new_keywords/v0/mod.rs (1)
  • None (63-63)
packages/rs-drive/src/drive/contract/insert/insert_contract/v1/mod.rs (1)
  • None (103-103)
⏰ Context from checks skipped due to timeout of 90000ms (11)
  • GitHub Check: Rust packages (rs-dapi-client) / Unused dependencies
  • GitHub Check: Rust packages (rs-dapi-client) / Detect immutable structure changes
  • GitHub Check: Rust packages (rs-dapi-client) / Formatting
  • GitHub Check: Rust packages (drive-abci) / Tests
  • GitHub Check: Rust packages (drive-abci) / Linting
  • GitHub Check: Rust packages (drive-abci) / Check each feature
  • GitHub Check: Rust packages (dash-sdk) / Check each feature
  • GitHub Check: Rust packages (dash-sdk) / Linting
  • GitHub Check: Rust packages (dash-sdk) / Tests
  • GitHub Check: Build Docker images (Drive, drive, drive-abci) / Build Drive image
  • GitHub Check: Build JS packages / Build JS

@pauldelucia pauldelucia changed the base branch from v2.0-dev to feat/token-search-contract April 9, 2025 12:26
@pauldelucia pauldelucia merged commit 6e17051 into feat/token-search-contract Apr 9, 2025
3 checks passed
@pauldelucia pauldelucia deleted the feat/contract-descriptions branch April 9, 2025 14:47
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.

1 participant