-
Notifications
You must be signed in to change notification settings - Fork 44
feat: contract descriptions #2533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: contract descriptions #2533
Conversation
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThis update integrates the new Changes
Possibly related PRs
Suggested labels
Poem
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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 issueUpdate needed in equality comparison.
The
eq_without_auto_fields
method doesn't include the newkeywords
anddescription
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 NewlineThis 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 forTokenConfigurationV0
in theDisplay
trait hasn't been updated to include the newdescription
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.descriptionpackages/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 metadataThe addition of
keywords
anddescription
fields enhances the contract's metadata capabilities. However, thedescription
field lacks detailed documentation compared to thekeywords
field.Consider adding documentation for the
description
field similar to thekeywords
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
and1
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 asadd_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 declarationdocument_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 aString
reference. Consider updating both parameters and internal usage if the code does not rely onString
-specific methods.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ 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 fileThe 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 membersThe 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 creationThe 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 multiplierThe 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 testThe 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 testSimilar 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 FormattingThis 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 QueryThis 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 QueryThis 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 DescriptionThe 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 jsonLength 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 improvedThe comment now has better spacing but maintains the same meaning and the code value remains unchanged.
22-22
: No functional changeThis 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 rustLength 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 (inpackages/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
anddescription
fields to theDataContractV1
structure used in tests, which is consistent with the changes to the actualDataContractV1
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
anddescription
fields are now consistently initialized with default values (empty vector andNone
) across all instances ofDataContractV1
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 structureThe new fields
keywords
anddescription
extend the contract's metadata capabilities. They're initialized appropriately with an empty vector and None value respectively.
283-284
: Consistent implementation of metadata fieldsThe 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 contractsThe
SystemDataContractVersions
struct has been expanded to include versioning for two new features:token_history
andsearch
, 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 testsThe
keywords
anddescription
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 testThe 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 versioningThe 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 schemasThe 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
anddescription
fields have been added to theDataContractV1
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 toNone
in thedefault_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
anddescription
fields have been properly added to theDataContractV1
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
anddescription
fields to theDataContractV1
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
anddescription
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, returningNone
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
anddescription
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 defaultsThe additions of
keywords
anddescription
with default values in thetry_from_platform_versioned_v0
method ensure backward compatibility when deserializing from older contract formats.
142-143
: Proper handling of new fields in V1 deserializationThe code correctly destructures the new
keywords
anddescription
fields from the serialization format and properly assigns them when constructing theDataContractV1
instance.Also applies to: 172-173
packages/rs-dpp/src/data_contract/v1/data_contract.rs (2)
64-68
: Well-documented constraints for keywords fieldThe 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 rustLength 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
inpackages/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 ListThe new object for
@dashevo/search-contract
is added correctly with itsname
andreference
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 UpdateThe 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-contractThe 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 thelinkType
to"SOFT"
. Verify that all version references (e.g., fordirty-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
anddescription
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
anddescription
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
anddescription
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
anddescription
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 correctThe 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 correctThe 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
toplatform_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 rustLength 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 usesplatform_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 definedThe additions of
keywords
anddescription
fields to theDataContractInSerializationFormatV1
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 contractsThe 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 goodThe 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 fieldsThe tests have been properly updated to include the new
keywords
anddescription
fields in all test instances ofDataContractV1
. 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 therequired
array forposition
without altering behavior.
425-427
: No Functional Difference
These lines only change the format of therequired
array forresolution
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 additionalBasicError
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
andSome(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 aTooManyKeywordsError
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. ReturningInvalidDescriptionLengthError
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:
- It verifies the restriction mode is set correctly
- It attempts to create a document and validates the failure
- It checks both the returned error count and specific error message
- 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 clarityThe renaming from
contract
tocontract_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 goodThe addition of the
short_description
module with itsNAME
andKEY_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 moduleThe implementation of the
full_description
module follows the same pattern asshort_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 definitionThe 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 implementedThe implementation provides a clean constructor and accessor methods that follow Rust conventions with immutable references to the internal fields.
40-44
: Proper error conversion implementationThe
From
trait implementation correctly converts this specific error type into the more generalConsensusError
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 metadataThe 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 metadataThe 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 validationThe 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 followedThe 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 propagationThe
From
trait implementation correctly wraps this error into aConsensusError
, 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 keywordsThis 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
andkeyword
, accessor methods, and conversion toConsensusError
.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 constraintsThe 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 contractIdThe required fields have been updated to include "contractId" instead of the previously used "$contractId".
39-77
: Added shortDescription document type with appropriate structureThe 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 structureThe 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 exceededThis 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 constantAdded import for EMPTY_KEYWORDS constant to provide default values for V0 contracts.
273-299
: Added accessor methods for keywords and descriptionThe 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 descriptionThe 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 implementationThe
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 descriptionThe 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()
returnsOption<&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 descriptionThe 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 typesThe 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 importsThe 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 descriptionsThe
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 methodThe
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 1Ensure 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 inpackages/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
returnsNone
, the code defaults to a nonce of1
. 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.
...-drive-abci/src/execution/platform_events/initialization/create_genesis_state/test/tokens.rs
Show resolved
Hide resolved
There was a problem hiding this 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 callself.add_new_contract_description_operations(...)
, but the actual function is declared asadd_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
📒 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
Issue being fixed or feature implemented
What was done?
How Has This Been Tested?
Breaking Changes
Checklist:
For repository code-owners and collaborators only
Summary by CodeRabbit
New Features
Enhancements