-
Notifications
You must be signed in to change notification settings - Fork 44
feat(sdk): dpns sdk improvements #2692
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
Conversation
Warning Rate limit exceeded@QuantumExplorer has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 6 minutes and 58 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
WalkthroughThis update modularizes system data contracts across multiple Rust and WASM packages by introducing fine-grained feature flags and conditional compilation. It adds a comprehensive DPNS (Dash Platform Name Service) username utility module, extends WASM SDK queries to support cryptographic proofs and metadata, and enhances the web demo with DPNS registration, validation, and proof display. Build scripts and manifests are updated for dynamic feature selection. Changes
Sequence Diagram(s)sequenceDiagram
participant UI
participant WASM
participant SDK
participant Platform
UI->>WASM: dpns_register_name(label, identity, key, wif, cb)
WASM->>SDK: register_dpns_name(input)
SDK->>SDK: validate label, check availability
SDK->>Platform: fetch DPNS contract
SDK->>Platform: submit preorder document
SDK->>UI: (optional) preorder_callback
SDK->>Platform: submit domain document
SDK->>WASM: return RegisterDpnsNameResult
WASM->>UI: show registration result
sequenceDiagram
participant UI
participant WASM
participant SDK
participant Platform
UI->>WASM: get_dpns_username_by_name(label)
WASM->>SDK: resolve_dpns_name(label)
SDK->>Platform: query DPNS contract for label
Platform-->>SDK: return domain document
SDK-->>WASM: identity_id or None
WASM-->>UI: show resolved identity
sequenceDiagram
participant UI
participant WASM
participant SDK
participant Platform
UI->>WASM: get_documents_with_proof_info(...)
WASM->>SDK: fetch_with_metadata_and_proof(...)
SDK->>Platform: query with prove=true
Platform-->>SDK: data + metadata + proof
SDK-->>WASM: structured ProofMetadataResponse
WASM-->>UI: display data + proof/metadata
Possibly related PRs
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ gRPC Query Coverage Report
|
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: 9
🔭 Outside diff range comments (1)
packages/wasm-sdk/index.html (1)
3215-3238
: DuplicategetFinalizedEpochInfos
/getEvonodesProposedEpochBlocks*
branches – dead code & maintenance hazardThe
executeQuery
chain already handles bothgetFinalizedEpochInfos
and the twogetEvonodesProposedEpochBlocks*
queries earlier (3048-3083).
The second copy below is never executed and just bloats the file.- else if (queryType === 'getFinalizedEpochInfos') { - … - } else if (queryType === 'getEvonodesProposedEpochBlocksByIds') { - … - } else if (queryType === 'getEvonodesProposedEpochBlocksByRange') { - … - }Delete the redundant branch (or refactor into a switch-case) to keep logic single-sourced.
🧹 Nitpick comments (7)
packages/data-contracts/Cargo.toml (2)
9-22
: Defaulting toall-contracts
negates the benefit of fine-grained feature flagsWith
default = ["all-contracts"]
every consumer still compiles every contract unless they explicitly turn default features off. That largely defeats the compile-time & binary-size savings this modularisation is meant to give.Consider leaving the default feature list empty (or far narrower) and letting downstream crates opt-in:
-[features] -default = ["all-contracts"] +# All features are opt-in; downstream crates enable exactly what they need +[features] +default = []This keeps the public surface unchanged (
all-contracts
is still available) while delivering the intended ergonomics.
28-36
: Mark optional deps withdefault-features = false
Each contract crate is optional, but its own default features (if any) will still be pulled in. Tighten the dependency declaration to prevent unintended transitive features:
-withdrawals-contract = { path = "../withdrawals-contract", optional = true } +withdrawals-contract = { path = "../withdrawals-contract", optional = true, default-features = false }(Repeat for the other six contracts.)
packages/wasm-sdk/build.sh (1)
19-21
: Hard-coded feature list reduces script re-usability
export CARGO_BUILD_FEATURES="dpns-contract,dashpay-contract,wallet-utils-contract,keywords-contract"
:
- Forces every downstream invocation to those four contracts, even when callers want a different mix.
- Leaks into the parent shell if this script is sourced rather than executed.
Consider:
FEATURES=${CARGO_BUILD_FEATURES:-"dpns-contract,dashpay-contract,wallet-utils-contract,keywords-contract"} exec env CARGO_BUILD_FEATURES="$FEATURES" \ "$SCRIPT_DIR/../scripts/build-wasm.sh" --package wasm-sdk --opt-level "$OPT_LEVEL"This keeps the default while allowing callers to override and limits the variable’s scope to the
exec
d process.packages/rs-sdk/tests/fetch/config.rs (1)
235-240
: Avoid duplicating the DPNS contract IDHard-coding the byte array risks silent drift if the canonical constant changes.
- [ - 230, 104, … 49, 85, - ] - .into() + #[cfg(feature = "dpns-contract")] + { data_contracts::dpns_contract::ID_BYTES.into() } + #[cfg(not(feature = "dpns-contract"))] + { Identifier::from([230,104, … 49,85]) } // fallback for minimal buildsKeeps a single source of truth while still compiling without the feature.
packages/rs-sdk-trusted-context-provider/src/provider.rs (1)
499-595
: Implementation looks good, but consider reducing duplication.The system contract loading logic is correctly implemented with proper feature gating and error handling. However, there's significant code duplication in the pattern for each contract type.
Consider extracting a helper function to reduce duplication:
+ #[cfg(any( + feature = "dpns-contract", + feature = "dashpay-contract", + feature = "withdrawals-contract", + feature = "wallet-utils-contract", + feature = "token-history-contract", + feature = "keywords-contract", + feature = "all-system-contracts" + ))] + fn try_load_system_contract( + id: &Identifier, + contract_type: SystemDataContract, + platform_version: &PlatformVersion, + ) -> Option<Result<Option<Arc<DataContract>>, ContextProviderError>> { + if *id == contract_type.id() { + Some( + load_system_data_contract(contract_type, platform_version) + .map(|contract| Some(Arc::new(contract))) + .map_err(|e| { + ContextProviderError::Generic(format!( + "Failed to load {} contract: {}", + contract_type, + e + )) + }), + ) + } else { + None + } + } // Check if this is a system data contract and the corresponding feature is enabled #[cfg(any( feature = "dpns-contract", feature = "dashpay-contract", feature = "withdrawals-contract", feature = "wallet-utils-contract", feature = "token-history-contract", feature = "keywords-contract", feature = "all-system-contracts" ))] { // Check each system contract if its feature is enabled #[cfg(any(feature = "dpns-contract", feature = "all-system-contracts"))] - if *id == SystemDataContract::DPNS.id() { - return load_system_data_contract(SystemDataContract::DPNS, platform_version) - .map(|contract| Some(Arc::new(contract))) - .map_err(|e| { - ContextProviderError::Generic(format!( - "Failed to load DPNS contract: {}", - e - )) - }); - } + if let Some(result) = Self::try_load_system_contract(id, SystemDataContract::DPNS, platform_version) { + return result; + }packages/wasm-sdk/index.html (1)
1546-1580
: Debounce heavy DPNS validation to avoid blocking the UI
dpns_is_valid_username
,dpns_is_contested_username
, etc. are executed on every keystroke.
If the WASM calls are non-trivial this can cause noticeable lag when the user types quickly.Wrap the handler in a small debounce (e.g. 300 ms) so that validation runs only after the user pauses typing.
- input.addEventListener('input', (e) => { + const debouncedValidate = debounce((value) => { … - }); + }, 300); + + input.addEventListener('input', (e) => debouncedValidate(e.target.value));Create a generic
debounce
helper once near the top of the script.packages/rs-sdk/src/platform/dpns_usernames.rs (1)
444-540
: Excellent test coverage for validation functions.The tests comprehensively cover edge cases for username validation and normalization. Consider adding integration tests for the async methods in a separate test file.
Would you like me to help create integration tests for the async methods (
register_dpns_name
,is_dpns_name_available
,resolve_dpns_name
)?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lock
is excluded by!**/*.lock
📒 Files selected for processing (23)
packages/data-contracts/Cargo.toml
(1 hunks)packages/data-contracts/src/error.rs
(8 hunks)packages/data-contracts/src/lib.rs
(2 hunks)packages/rs-dpp/Cargo.toml
(4 hunks)packages/rs-dpp/src/lib.rs
(2 hunks)packages/rs-dpp/src/system_data_contracts.rs
(1 hunks)packages/rs-dpp/src/withdrawal/mod.rs
(1 hunks)packages/rs-drive/Cargo.toml
(3 hunks)packages/rs-sdk-trusted-context-provider/Cargo.toml
(1 hunks)packages/rs-sdk-trusted-context-provider/src/provider.rs
(3 hunks)packages/rs-sdk/Cargo.toml
(1 hunks)packages/rs-sdk/src/platform.rs
(1 hunks)packages/rs-sdk/src/platform/dpns_usernames.rs
(1 hunks)packages/rs-sdk/tests/fetch/config.rs
(1 hunks)packages/scripts/build-wasm.sh
(1 hunks)packages/wasm-dpp/Cargo.toml
(1 hunks)packages/wasm-drive-verify/Cargo.toml
(2 hunks)packages/wasm-sdk/Cargo.toml
(1 hunks)packages/wasm-sdk/build.sh
(1 hunks)packages/wasm-sdk/index.html
(11 hunks)packages/wasm-sdk/src/dpns.rs
(1 hunks)packages/wasm-sdk/src/lib.rs
(2 hunks)packages/wasm-sdk/src/queries/document.rs
(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.rs`: Rust code should be formatted using `cargo fmt --all` Rust code shoul...
**/*.rs
: Rust code should be formatted usingcargo fmt --all
Rust code should be linted usingcargo clippy --workspace
Check Rust code usingcargo check --workspace
Run Rust tests usingcargo test
📄 Source: CodeRabbit Inference Engine (CLAUDE.md)
List of files the instruction was applied to:
packages/rs-dpp/src/withdrawal/mod.rs
packages/rs-dpp/src/lib.rs
packages/rs-sdk/tests/fetch/config.rs
packages/rs-sdk/src/platform.rs
packages/wasm-sdk/src/lib.rs
packages/rs-sdk-trusted-context-provider/src/provider.rs
packages/rs-dpp/src/system_data_contracts.rs
packages/data-contracts/src/error.rs
packages/wasm-sdk/src/queries/document.rs
packages/wasm-sdk/src/dpns.rs
packages/rs-sdk/src/platform/dpns_usernames.rs
packages/data-contracts/src/lib.rs
🧠 Learnings (23)
📓 Common learnings
Learnt from: QuantumExplorer
PR: dashpay/platform#2690
File: packages/wasm-sdk/src/queries/document.rs:383-384
Timestamp: 2025-07-10T00:37:09.565Z
Learning: In the Dash platform, DPNS (Dash Platform Name Service) contracts have the same ID across all networks (mainnet, testnet, etc.), so hardcoding the DPNS contract ID is appropriate and doesn't need to be configurable.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
Learnt from: shumkov
PR: dashpay/platform#2270
File: packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js:69-125
Timestamp: 2024-10-24T05:07:35.892Z
Learning: Future development plans involve rewriting DAPI into Rust, as the rest of the project has already migrated.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts is already handled in the data contract validation process, specifically in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs.
Learnt from: shumkov
PR: dashpay/platform#2489
File: packages/rs-dpp/Cargo.toml:32-32
Timestamp: 2025-03-11T09:39:23.071Z
Learning: In the Dash Platform project, dependencies are currently managed using Git repository references with tags (repo+tag format in Cargo.toml) rather than published crates, as the team is not currently publishing crates to crates.io.
Learnt from: shumkov
PR: dashpay/platform#2206
File: packages/rs-platform-version/src/version/protocol_version.rs:155-157
Timestamp: 2024-10-04T09:08:48.470Z
Learning: In the dashmate default configurations, the default protocol version for local networks has been removed, and an update mechanism for the protocol version in the consensus parameters has been implemented.
Learnt from: shumkov
PR: dashpay/platform#2206
File: packages/rs-platform-version/src/version/protocol_version.rs:155-157
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the dashmate default configurations, the default protocol version for local networks has been removed, and an update mechanism for the protocol version in the consensus parameters has been implemented.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts (ensuring it's between 3 and 100 characters) is already handled at the data contract validation level in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs, making additional checks in the update operations redundant.
Learnt from: lklimek
PR: dashpay/platform#2254
File: packages/rs-sdk/src/sdk.rs:585-585
Timestamp: 2024-10-18T15:39:51.172Z
Learning: The 'platform' project uses Rust version 1.80, so code in 'packages/rs-sdk' can use features available in Rust 1.80, such as the `abs_diff()` method.
Learnt from: QuantumExplorer
PR: dashpay/platform#2644
File: packages/rs-drive/src/cache/system_contracts.rs:18-19
Timestamp: 2025-05-28T16:22:26.334Z
Learning: In packages/rs-drive/src/cache/system_contracts.rs, the `active_since_protocol_version` field in `ActiveSystemDataContract` struct is intentionally added for future use, not current implementation. QuantumExplorer confirmed this is "meant for later" when questioned about the `#[allow(unused)]` attribute.
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/src/mimic/test_quorum.rs:159-164
Timestamp: 2024-11-20T16:16:01.830Z
Learning: QuantumExplorer prefers not to receive auto-generated messages asking to post on social media.
Learnt from: QuantumExplorer
PR: dashpay/platform#2439
File: packages/rs-dpp/src/errors/consensus/state/token/mod.rs:4-22
Timestamp: 2025-01-23T02:10:08.979Z
Learning: The user QuantumExplorer prefers to handle documentation of breaking changes separately from the code changes, particularly for token-related error types and validation rules.
Learnt from: QuantumExplorer
PR: dashpay/platform#2673
File: packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs:1164-1197
Timestamp: 2025-06-18T03:44:14.385Z
Learning: QuantumExplorer determined that a CodeRabbit suggestion about fixing signable_bytes calculation in identity update tests with contract-bound keys was incorrect - the code flow is working as intended without the suggested changes.
packages/rs-dpp/src/withdrawal/mod.rs (13)
Learnt from: shumkov
PR: dashpay/platform#2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-03T11:51:06.980Z
Learning: In the `IdentityTransitionVersions` structure within `packages/rs-platform-version/src/version/v2.rs`, the field `credit_withdrawal` does not need the `identity_` prefix since it is already encompassed within identity state transitions.
Learnt from: shumkov
PR: dashpay/platform#2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the `IdentityTransitionVersions` structure within `packages/rs-platform-version/src/version/v2.rs`, the field `credit_withdrawal` does not need the `identity_` prefix since it is already encompassed within identity state transitions.
Learnt from: QuantumExplorer
PR: dashpay/platform#2644
File: packages/rs-drive/src/cache/system_contracts.rs:18-19
Timestamp: 2025-05-28T16:22:26.334Z
Learning: In packages/rs-drive/src/cache/system_contracts.rs, the `active_since_protocol_version` field in `ActiveSystemDataContract` struct is intentionally added for future use, not current implementation. QuantumExplorer confirmed this is "meant for later" when questioned about the `#[allow(unused)]` attribute.
Learnt from: shumkov
PR: dashpay/platform#2185
File: packages/rs-drive-abci/src/execution/platform_events/withdrawals/rebroadcast_expired_withdrawal_documents/v1/mod.rs:47-62
Timestamp: 2024-09-30T11:55:43.856Z
Learning: In `rebroadcast_expired_withdrawal_documents_v1`, the variable `expired_withdrawal_indices` needs to be a `Vec<WithdrawalTransactionIndex>` rather than a `BTreeSet<WithdrawalTransactionIndex>`, because a vector is necessary for subsequent processing.
Learnt from: shumkov
PR: dashpay/platform#2185
File: packages/rs-drive-abci/src/execution/platform_events/withdrawals/rebroadcast_expired_withdrawal_documents/v1/mod.rs:47-62
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In `rebroadcast_expired_withdrawal_documents_v1`, the variable `expired_withdrawal_indices` needs to be a `Vec<WithdrawalTransactionIndex>` rather than a `BTreeSet<WithdrawalTransactionIndex>`, because a vector is necessary for subsequent processing.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/src/executor.rs:38-38
Timestamp: 2024-10-29T14:44:01.184Z
Learning: In `packages/rs-dapi-client/src/executor.rs`, for the structs `ExecutionError<E>` and `ExecutionResponse<R>`, only the serde derives (`Serialize`, `Deserialize`) should be conditional based on the "mocks" feature; the other derives (`Debug`, `Clone`, `Eq`, `PartialEq`) should always be present.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/Cargo.toml:22-22
Timestamp: 2024-10-29T10:42:00.521Z
Learning: In `packages/rs-dapi-client/Cargo.toml`, `backon` will not work without the `tokio-sleep` feature in our setup, so it's unnecessary to declare `tokio-sleep` as a separate feature in the `[features]` section.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/src/core/transaction.rs:0-0
Timestamp: 2024-10-29T14:40:54.727Z
Learning: In `packages/rs-sdk/src/platform/document_query.rs` and `packages/rs-sdk/src/core/transaction.rs`, certain places don't implement `IntoInner`, so direct error mappings cannot be simplified using `IntoInner`. A TODO comment has been added to address this in a future PR.
Learnt from: QuantumExplorer
PR: dashpay/platform#2347
File: packages/rs-drive/tests/query_tests.rs:438-460
Timestamp: 2024-11-25T01:17:02.001Z
Learning: In Rust test files (`packages/rs-drive/tests/query_tests.rs`), when code is used only in tests, defining explicit enums for fields (like the `status` field in the `Withdrawal` struct) may not be necessary; using primitive types is acceptable.
Learnt from: shumkov
PR: dashpay/platform#2186
File: packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/mod.rs:48-54
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the identity credit withdrawal transition code, the field `platform_version.drive_abci.validation_and_processing.state_transitions.identity_credit_withdrawal_state_transition.transform_into_action` is not an `Option` type, so handling `None` cases is unnecessary.
Learnt from: shumkov
PR: dashpay/platform#2345
File: packages/wallet-utils-contract/src/lib.rs:14-17
Timestamp: 2024-11-25T07:48:09.831Z
Learning: In the `wallet-utils-contract` (file `packages/wallet-utils-contract/src/lib.rs`), the `OWNER_ID_BYTES` constant is intentionally initialized to all zeros.
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/src/platform_types/platform_state/v0/old_structures/mod.rs:94-94
Timestamp: 2024-11-20T10:01:50.837Z
Learning: In `packages/rs-drive-abci/src/platform_types/platform_state/v0/old_structures/mod.rs`, when converting with `PublicKey::try_from`, it's acceptable to use `.expect()` to handle potential conversion errors.
Learnt from: QuantumExplorer
PR: dashpay/platform#2432
File: packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/mod.rs:222-225
Timestamp: 2025-01-20T16:20:59.791Z
Learning: In the Dash Platform codebase, TokenAmount from crate::balances::credits is compatible with u64 when used for token base supply.
packages/wasm-dpp/Cargo.toml (10)
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/Cargo.toml:22-22
Timestamp: 2024-10-29T10:42:00.521Z
Learning: In `packages/rs-dapi-client/Cargo.toml`, `backon` will not work without the `tokio-sleep` feature in our setup, so it's unnecessary to declare `tokio-sleep` as a separate feature in the `[features]` section.
Learnt from: QuantumExplorer
PR: dashpay/platform#2644
File: packages/rs-drive/src/cache/system_contracts.rs:18-19
Timestamp: 2025-05-28T16:22:26.334Z
Learning: In packages/rs-drive/src/cache/system_contracts.rs, the `active_since_protocol_version` field in `ActiveSystemDataContract` struct is intentionally added for future use, not current implementation. QuantumExplorer confirmed this is "meant for later" when questioned about the `#[allow(unused)]` attribute.
Learnt from: lklimek
PR: dashpay/platform#2254
File: packages/rs-sdk/src/sdk.rs:585-585
Timestamp: 2024-10-18T15:39:51.172Z
Learning: The 'platform' project uses Rust version 1.80, so code in 'packages/rs-sdk' can use features available in Rust 1.80, such as the `abs_diff()` method.
Learnt from: shumkov
PR: dashpay/platform#2375
File: packages/rs-drive-abci/Cargo.toml:61-63
Timestamp: 2024-12-05T09:29:38.918Z
Learning: In the `drive-abci` package, avoid adding unused dependencies like `hashbrown` to `Cargo.toml`. The team relies on CI to detect dependency version issues.
Learnt from: shumkov
PR: dashpay/platform#2317
File: packages/rs-dapi-client/src/address_list.rs:175-180
Timestamp: 2024-11-28T13:49:17.301Z
Learning: In Rust code in `packages/rs-dapi-client/src/address_list.rs`, do not change the interface of deprecated methods like `add_uri`, even to fix potential panics.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts is already handled in the data contract validation process, specifically in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts (ensuring it's between 3 and 100 characters) is already handled at the data contract validation level in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs, making additional checks in the update operations redundant.
Learnt from: QuantumExplorer
PR: dashpay/platform#2431
File: packages/rs-drive/Cargo.toml:55-60
Timestamp: 2025-01-19T07:36:46.042Z
Learning: The grovedb dependencies in packages/rs-drive/Cargo.toml and related files are intentionally kept at specific revisions rather than using the latest stable version, with plans to update them at a later time.
Learnt from: lklimek
PR: dashpay/platform#2207
File: packages/rs-drive-proof-verifier/Cargo.toml:46-46
Timestamp: 2024-10-09T00:22:57.778Z
Learning: Usages of `BTreeMap` in crates that are out of scope of a change should not be flagged for replacement.
Learnt from: lklimek
PR: dashpay/platform#2207
File: packages/rs-drive-proof-verifier/Cargo.toml:46-46
Timestamp: 2024-10-04T10:07:23.863Z
Learning: Usages of `BTreeMap` in crates that are out of scope of a change should not be flagged for replacement.
packages/rs-dpp/src/lib.rs (18)
Learnt from: QuantumExplorer
PR: dashpay/platform#2644
File: packages/rs-drive/src/cache/system_contracts.rs:18-19
Timestamp: 2025-05-28T16:22:26.334Z
Learning: In packages/rs-drive/src/cache/system_contracts.rs, the `active_since_protocol_version` field in `ActiveSystemDataContract` struct is intentionally added for future use, not current implementation. QuantumExplorer confirmed this is "meant for later" when questioned about the `#[allow(unused)]` attribute.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/Cargo.toml:22-22
Timestamp: 2024-10-29T10:42:00.521Z
Learning: In `packages/rs-dapi-client/Cargo.toml`, `backon` will not work without the `tokio-sleep` feature in our setup, so it's unnecessary to declare `tokio-sleep` as a separate feature in the `[features]` section.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts is already handled in the data contract validation process, specifically in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/src/executor.rs:38-38
Timestamp: 2024-10-29T14:44:01.184Z
Learning: In `packages/rs-dapi-client/src/executor.rs`, for the structs `ExecutionError<E>` and `ExecutionResponse<R>`, only the serde derives (`Serialize`, `Deserialize`) should be conditional based on the "mocks" feature; the other derives (`Debug`, `Clone`, `Eq`, `PartialEq`) should always be present.
Learnt from: lklimek
PR: dashpay/platform#2254
File: packages/rs-sdk/src/sdk.rs:585-585
Timestamp: 2024-10-18T15:39:51.172Z
Learning: The 'platform' project uses Rust version 1.80, so code in 'packages/rs-sdk' can use features available in Rust 1.80, such as the `abs_diff()` method.
Learnt from: lklimek
PR: dashpay/platform#2207
File: packages/rs-drive-proof-verifier/Cargo.toml:46-46
Timestamp: 2024-10-09T00:22:57.778Z
Learning: Usages of `BTreeMap` in crates that are out of scope of a change should not be flagged for replacement.
Learnt from: lklimek
PR: dashpay/platform#2207
File: packages/rs-drive-proof-verifier/Cargo.toml:46-46
Timestamp: 2024-10-04T10:07:23.863Z
Learning: Usages of `BTreeMap` in crates that are out of scope of a change should not be flagged for replacement.
Learnt from: shumkov
PR: dashpay/platform#2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-03T11:51:06.980Z
Learning: In the `IdentityTransitionVersions` structure within `packages/rs-platform-version/src/version/v2.rs`, the field `credit_withdrawal` does not need the `identity_` prefix since it is already encompassed within identity state transitions.
Learnt from: shumkov
PR: dashpay/platform#2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the `IdentityTransitionVersions` structure within `packages/rs-platform-version/src/version/v2.rs`, the field `credit_withdrawal` does not need the `identity_` prefix since it is already encompassed within identity state transitions.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts (ensuring it's between 3 and 100 characters) is already handled at the data contract validation level in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs, making additional checks in the update operations redundant.
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs:148-151
Timestamp: 2024-11-20T16:05:40.200Z
Learning: In `packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs`, when converting public keys from `QuorumForSavingV0` to `VerificationQuorum`, it's acceptable to use `.expect()` for public key conversion, as the conversion has been verified and panics are acceptable in this context.
Learnt from: QuantumExplorer
PR: dashpay/platform#2235
File: packages/rs-dpp/src/identity/identity_public_key/v0/methods/mod.rs:8-9
Timestamp: 2024-10-10T05:10:50.059Z
Learning: In the codebase, importing `Secp256k1` from `dashcore::key::Secp256k1` is acceptable.
Learnt from: shumkov
PR: dashpay/platform#2489
File: packages/rs-dpp/Cargo.toml:32-32
Timestamp: 2025-03-11T09:39:23.071Z
Learning: In the Dash Platform project, dependencies are currently managed using Git repository references with tags (repo+tag format in Cargo.toml) rather than published crates, as the team is not currently publishing crates to crates.io.
Learnt from: QuantumExplorer
PR: dashpay/platform#2182
File: packages/rs-dpp/src/util/units.rs:57-57
Timestamp: 2024-10-09T00:22:57.778Z
Learning: The macro `dash_to_duffs` in `units.rs` is not used in production code.
Learnt from: QuantumExplorer
PR: dashpay/platform#2182
File: packages/rs-dpp/src/util/units.rs:57-57
Timestamp: 2024-09-29T09:35:11.094Z
Learning: The macro `dash_to_duffs` in `units.rs` is not used in production code.
Learnt from: QuantumExplorer
PR: dashpay/platform#2227
File: packages/rs-dpp/src/core_types/validator_set/v0/mod.rs:299-299
Timestamp: 2024-10-21T01:03:42.458Z
Learning: In the `test_serialize_deserialize_validator_set_v0` test within `packages/rs-dpp/src/core_types/validator_set/v0/mod.rs`, deterministic BLS keys cannot be easily used; therefore, using `BlsPublicKey::generate()` is acceptable.
Learnt from: shumkov
PR: dashpay/platform#2259
File: packages/rs-dapi-client/src/dapi_client.rs:137-139
Timestamp: 2024-10-22T10:53:12.111Z
Learning: In `packages/rs-dapi-client/src/dapi_client.rs`, when passing data into asynchronous code, ensure that data structures are `Send + Sync`. Using `Arc<AtomicUsize>` is necessary for the retry counter.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/rs-sdk/src/sync.rs:88-95
Timestamp: 2025-01-23T09:23:32.740Z
Learning: The `block_on` function in `packages/rs-sdk/src/sync.rs` is currently only used in tests, and its WebAssembly implementation is deferred until there's a user request for it.
packages/rs-sdk/tests/fetch/config.rs (12)
Learnt from: shumkov
PR: dashpay/platform#2345
File: packages/wallet-utils-contract/src/lib.rs:14-17
Timestamp: 2024-11-25T07:48:09.831Z
Learning: In the `wallet-utils-contract` (file `packages/wallet-utils-contract/src/lib.rs`), the `OWNER_ID_BYTES` constant is intentionally initialized to all zeros.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/tests/fetch/config.rs:233-233
Timestamp: 2024-10-30T11:19:59.163Z
Learning: In the Rust SDK's `rs-sdk/tests` integration tests (e.g., in `packages/rs-sdk/tests/fetch/config.rs`), we cannot create objects during tests because there is no support for object creation in this context. Therefore, hardcoded values for test identities must be used.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts is already handled in the data contract validation process, specifically in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts (ensuring it's between 3 and 100 characters) is already handled at the data contract validation level in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs, making additional checks in the update operations redundant.
Learnt from: QuantumExplorer
PR: dashpay/platform#2644
File: packages/rs-drive/src/cache/system_contracts.rs:18-19
Timestamp: 2025-05-28T16:22:26.334Z
Learning: In packages/rs-drive/src/cache/system_contracts.rs, the `active_since_protocol_version` field in `ActiveSystemDataContract` struct is intentionally added for future use, not current implementation. QuantumExplorer confirmed this is "meant for later" when questioned about the `#[allow(unused)]` attribute.
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/tests/strategy_tests/masternodes.rs:212-220
Timestamp: 2024-11-20T20:43:41.185Z
Learning: In `packages/rs-drive-abci/tests/strategy_tests/masternodes.rs`, the pattern of generating a `PrivateKey`, converting it to bytes, and reconstructing a `BlsPrivateKey` from those bytes is intentional. Avoid suggesting to simplify this code in future reviews.
Learnt from: shumkov
PR: dashpay/platform#2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the `IdentityTransitionVersions` structure within `packages/rs-platform-version/src/version/v2.rs`, the field `credit_withdrawal` does not need the `identity_` prefix since it is already encompassed within identity state transitions.
Learnt from: shumkov
PR: dashpay/platform#2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-03T11:51:06.980Z
Learning: In the `IdentityTransitionVersions` structure within `packages/rs-platform-version/src/version/v2.rs`, the field `credit_withdrawal` does not need the `identity_` prefix since it is already encompassed within identity state transitions.
Learnt from: QuantumExplorer
PR: dashpay/platform#2347
File: packages/rs-drive/tests/query_tests.rs:438-460
Timestamp: 2024-11-25T01:17:02.001Z
Learning: In Rust test files (`packages/rs-drive/tests/query_tests.rs`), when code is used only in tests, defining explicit enums for fields (like the `status` field in the `Withdrawal` struct) may not be necessary; using primitive types is acceptable.
Learnt from: QuantumExplorer
PR: dashpay/platform#2673
File: packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs:1164-1197
Timestamp: 2025-06-18T03:44:14.385Z
Learning: QuantumExplorer determined that a CodeRabbit suggestion about fixing signable_bytes calculation in identity update tests with contract-bound keys was incorrect - the code flow is working as intended without the suggested changes.
Learnt from: shumkov
PR: dashpay/platform#2449
File: packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/test/tokens.rs:35-38
Timestamp: 2025-02-14T04:31:17.170Z
Learning: In test scenarios, it's acceptable for different types of identifiers (e.g., identity IDs and contract IDs) to share the same byte values since they operate in different scopes and contexts.
Learnt from: QuantumExplorer
PR: dashpay/platform#2690
File: packages/wasm-sdk/src/queries/document.rs:383-384
Timestamp: 2025-07-10T00:37:09.565Z
Learning: In the Dash platform, DPNS (Dash Platform Name Service) contracts have the same ID across all networks (mainnet, testnet, etc.), so hardcoding the DPNS contract ID is appropriate and doesn't need to be configurable.
packages/rs-sdk/src/platform.rs (10)
Learnt from: lklimek
PR: dashpay/platform#2254
File: packages/rs-sdk/src/sdk.rs:585-585
Timestamp: 2024-10-18T15:39:51.172Z
Learning: The 'platform' project uses Rust version 1.80, so code in 'packages/rs-sdk' can use features available in Rust 1.80, such as the `abs_diff()` method.
Learnt from: shumkov
PR: dashpay/platform#2317
File: packages/rs-dapi-client/src/address_list.rs:175-180
Timestamp: 2024-11-28T13:49:17.301Z
Learning: In Rust code in `packages/rs-dapi-client/src/address_list.rs`, do not change the interface of deprecated methods like `add_uri`, even to fix potential panics.
Learnt from: QuantumExplorer
PR: dashpay/platform#2215
File: packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs:19-30
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the Rust file `packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs`, within the `create_owner_identity_v1` function, the `add_public_keys` method of the `Identity` struct cannot fail and does not require explicit error handling.
Learnt from: QuantumExplorer
PR: dashpay/platform#2215
File: packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs:19-30
Timestamp: 2024-10-06T16:11:34.946Z
Learning: In the Rust file `packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs`, within the `create_owner_identity_v1` function, the `add_public_keys` method of the `Identity` struct cannot fail and does not require explicit error handling.
Learnt from: lklimek
PR: dashpay/platform#2232
File: packages/rs-sdk/src/mock/sdk.rs:90-95
Timestamp: 2024-10-10T10:30:19.883Z
Learning: In `packages/rs-sdk/src/mock/sdk.rs`, the `load_expectations` method in `MockDashPlatformSdk` remains asynchronous (`async`) for backward compatibility, even though it now delegates to the synchronous `load_expectations_sync` method.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/tests/fetch/config.rs:233-233
Timestamp: 2024-10-30T11:19:59.163Z
Learning: In the Rust SDK's `rs-sdk/tests` integration tests (e.g., in `packages/rs-sdk/tests/fetch/config.rs`), we cannot create objects during tests because there is no support for object creation in this context. Therefore, hardcoded values for test identities must be used.
Learnt from: QuantumExplorer
PR: dashpay/platform#2227
File: packages/rs-drive-abci/src/platform_types/platform_state/mod.rs:141-141
Timestamp: 2024-10-08T13:28:03.529Z
Learning: When converting `PlatformStateV0` to `PlatformStateForSavingV1` in `packages/rs-drive-abci/src/platform_types/platform_state/mod.rs`, only version `0` needs to be handled in the match on `platform_state_for_saving_structure_default` because the changes are retroactive.
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/src/platform_types/platform_state/v0/old_structures/mod.rs:94-94
Timestamp: 2024-11-20T10:01:50.837Z
Learning: In `packages/rs-drive-abci/src/platform_types/platform_state/v0/old_structures/mod.rs`, when converting with `PublicKey::try_from`, it's acceptable to use `.expect()` to handle potential conversion errors.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/Cargo.toml:22-22
Timestamp: 2024-10-29T10:42:00.521Z
Learning: In `packages/rs-dapi-client/Cargo.toml`, `backon` will not work without the `tokio-sleep` feature in our setup, so it's unnecessary to declare `tokio-sleep` as a separate feature in the `[features]` section.
Learnt from: shumkov
PR: dashpay/platform#2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-03T11:51:06.980Z
Learning: In the `IdentityTransitionVersions` structure within `packages/rs-platform-version/src/version/v2.rs`, the field `credit_withdrawal` does not need the `identity_` prefix since it is already encompassed within identity state transitions.
packages/rs-sdk-trusted-context-provider/Cargo.toml (11)
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/Cargo.toml:22-22
Timestamp: 2024-10-29T10:42:00.521Z
Learning: In `packages/rs-dapi-client/Cargo.toml`, `backon` will not work without the `tokio-sleep` feature in our setup, so it's unnecessary to declare `tokio-sleep` as a separate feature in the `[features]` section.
Learnt from: lklimek
PR: dashpay/platform#2254
File: packages/rs-sdk/src/sdk.rs:585-585
Timestamp: 2024-10-18T15:39:51.172Z
Learning: The 'platform' project uses Rust version 1.80, so code in 'packages/rs-sdk' can use features available in Rust 1.80, such as the `abs_diff()` method.
Learnt from: QuantumExplorer
PR: dashpay/platform#2431
File: packages/rs-drive/Cargo.toml:55-60
Timestamp: 2025-01-19T07:36:46.042Z
Learning: The grovedb dependencies in packages/rs-drive/Cargo.toml and related files are intentionally kept at specific revisions rather than using the latest stable version, with plans to update them at a later time.
Learnt from: shumkov
PR: dashpay/platform#2248
File: packages/rs-drive-abci/src/main.rs:106-111
Timestamp: 2024-10-17T08:52:54.300Z
Learning: In this project, the environment variable `CARGO_PKG_RUST_VERSION` is defined and can be used safely with the `env!` macro.
Learnt from: QuantumExplorer
PR: dashpay/platform#2644
File: packages/rs-drive/src/cache/system_contracts.rs:18-19
Timestamp: 2025-05-28T16:22:26.334Z
Learning: In packages/rs-drive/src/cache/system_contracts.rs, the `active_since_protocol_version` field in `ActiveSystemDataContract` struct is intentionally added for future use, not current implementation. QuantumExplorer confirmed this is "meant for later" when questioned about the `#[allow(unused)]` attribute.
Learnt from: shumkov
PR: dashpay/platform#2489
File: packages/rs-dpp/Cargo.toml:32-32
Timestamp: 2025-03-11T09:39:23.071Z
Learning: In the Dash Platform project, dependencies are currently managed using Git repository references with tags (repo+tag format in Cargo.toml) rather than published crates, as the team is not currently publishing crates to crates.io.
Learnt from: shumkov
PR: dashpay/platform#2375
File: packages/rs-drive-abci/Cargo.toml:61-63
Timestamp: 2024-12-05T09:29:38.918Z
Learning: In the `drive-abci` package, avoid adding unused dependencies like `hashbrown` to `Cargo.toml`. The team relies on CI to detect dependency version issues.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/src/executor.rs:38-38
Timestamp: 2024-10-29T14:44:01.184Z
Learning: In `packages/rs-dapi-client/src/executor.rs`, for the structs `ExecutionError<E>` and `ExecutionResponse<R>`, only the serde derives (`Serialize`, `Deserialize`) should be conditional based on the "mocks" feature; the other derives (`Debug`, `Clone`, `Eq`, `PartialEq`) should always be present.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts is already handled in the data contract validation process, specifically in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/tests/fetch/config.rs:233-233
Timestamp: 2024-10-30T11:19:59.163Z
Learning: In the Rust SDK's `rs-sdk/tests` integration tests (e.g., in `packages/rs-sdk/tests/fetch/config.rs`), we cannot create objects during tests because there is no support for object creation in this context. Therefore, hardcoded values for test identities must be used.
Learnt from: QuantumExplorer
PR: dashpay/platform#2690
File: packages/wasm-sdk/src/queries/document.rs:383-384
Timestamp: 2025-07-10T00:37:09.565Z
Learning: In the Dash platform, DPNS (Dash Platform Name Service) contracts have the same ID across all networks (mainnet, testnet, etc.), so hardcoding the DPNS contract ID is appropriate and doesn't need to be configurable.
packages/wasm-drive-verify/Cargo.toml (14)
Learnt from: shumkov
PR: dashpay/platform#2375
File: packages/rs-drive-abci/Cargo.toml:61-63
Timestamp: 2024-12-05T09:29:38.918Z
Learning: In the `drive-abci` package, avoid adding unused dependencies like `hashbrown` to `Cargo.toml`. The team relies on CI to detect dependency version issues.
Learnt from: QuantumExplorer
PR: dashpay/platform#2431
File: packages/rs-drive/Cargo.toml:55-60
Timestamp: 2025-01-19T07:36:46.042Z
Learning: The grovedb dependencies in packages/rs-drive/Cargo.toml and related files are intentionally kept at specific revisions rather than using the latest stable version, with plans to update them at a later time.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/Cargo.toml:22-22
Timestamp: 2024-10-29T10:42:00.521Z
Learning: In `packages/rs-dapi-client/Cargo.toml`, `backon` will not work without the `tokio-sleep` feature in our setup, so it's unnecessary to declare `tokio-sleep` as a separate feature in the `[features]` section.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts is already handled in the data contract validation process, specifically in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs.
Learnt from: QuantumExplorer
PR: dashpay/platform#2644
File: packages/rs-drive/src/cache/system_contracts.rs:18-19
Timestamp: 2025-05-28T16:22:26.334Z
Learning: In packages/rs-drive/src/cache/system_contracts.rs, the `active_since_protocol_version` field in `ActiveSystemDataContract` struct is intentionally added for future use, not current implementation. QuantumExplorer confirmed this is "meant for later" when questioned about the `#[allow(unused)]` attribute.
Learnt from: lklimek
PR: dashpay/platform#2254
File: packages/rs-sdk/src/sdk.rs:585-585
Timestamp: 2024-10-18T15:39:51.172Z
Learning: The 'platform' project uses Rust version 1.80, so code in 'packages/rs-sdk' can use features available in Rust 1.80, such as the `abs_diff()` method.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts (ensuring it's between 3 and 100 characters) is already handled at the data contract validation level in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs, making additional checks in the update operations redundant.
Learnt from: shumkov
PR: dashpay/platform#2248
File: packages/rs-drive-abci/src/main.rs:106-111
Timestamp: 2024-10-17T08:52:54.300Z
Learning: In this project, the environment variable `CARGO_PKG_RUST_VERSION` is defined and can be used safely with the `env!` macro.
Learnt from: shumkov
PR: dashpay/platform#2489
File: packages/rs-dpp/Cargo.toml:32-32
Timestamp: 2025-03-11T09:39:23.071Z
Learning: In the Dash Platform project, dependencies are currently managed using Git repository references with tags (repo+tag format in Cargo.toml) rather than published crates, as the team is not currently publishing crates to crates.io.
Learnt from: shumkov
PR: dashpay/platform#2317
File: packages/rs-dapi-client/src/address_list.rs:175-180
Timestamp: 2024-11-28T13:49:17.301Z
Learning: In Rust code in `packages/rs-dapi-client/src/address_list.rs`, do not change the interface of deprecated methods like `add_uri`, even to fix potential panics.
Learnt from: QuantumExplorer
PR: dashpay/platform#2440
File: packages/rs-drive-abci/Cargo.toml:76-76
Timestamp: 2025-01-24T07:54:55.723Z
Learning: In the drive-abci package, bls-signatures is intentionally declared twice:
1. As an optional dependency in [dependencies] to make it an optional feature in production
2. As a non-optional dependency in [dev-dependencies] to ensure it's always available for tests
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/src/executor.rs:38-38
Timestamp: 2024-10-29T14:44:01.184Z
Learning: In `packages/rs-dapi-client/src/executor.rs`, for the structs `ExecutionError<E>` and `ExecutionResponse<R>`, only the serde derives (`Serialize`, `Deserialize`) should be conditional based on the "mocks" feature; the other derives (`Debug`, `Clone`, `Eq`, `PartialEq`) should always be present.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use `rs-drive-proof-verifier` for cryptographic proof verification
Learnt from: shumkov
PR: dashpay/platform#2259
File: packages/rs-dapi-client/src/dapi_client.rs:137-139
Timestamp: 2024-10-22T10:53:12.111Z
Learning: In `packages/rs-dapi-client/src/dapi_client.rs`, when passing data into asynchronous code, ensure that data structures are `Send + Sync`. Using `Arc<AtomicUsize>` is necessary for the retry counter.
packages/rs-drive/Cargo.toml (11)
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/Cargo.toml:22-22
Timestamp: 2024-10-29T10:42:00.521Z
Learning: In `packages/rs-dapi-client/Cargo.toml`, `backon` will not work without the `tokio-sleep` feature in our setup, so it's unnecessary to declare `tokio-sleep` as a separate feature in the `[features]` section.
Learnt from: QuantumExplorer
PR: dashpay/platform#2431
File: packages/rs-drive/Cargo.toml:55-60
Timestamp: 2025-01-19T07:36:46.042Z
Learning: The grovedb dependencies in packages/rs-drive/Cargo.toml and related files are intentionally kept at specific revisions rather than using the latest stable version, with plans to update them at a later time.
Learnt from: shumkov
PR: dashpay/platform#2375
File: packages/rs-drive-abci/Cargo.toml:61-63
Timestamp: 2024-12-05T09:29:38.918Z
Learning: In the `drive-abci` package, avoid adding unused dependencies like `hashbrown` to `Cargo.toml`. The team relies on CI to detect dependency version issues.
Learnt from: lklimek
PR: dashpay/platform#2254
File: packages/rs-sdk/src/sdk.rs:585-585
Timestamp: 2024-10-18T15:39:51.172Z
Learning: The 'platform' project uses Rust version 1.80, so code in 'packages/rs-sdk' can use features available in Rust 1.80, such as the `abs_diff()` method.
Learnt from: QuantumExplorer
PR: dashpay/platform#2644
File: packages/rs-drive/src/cache/system_contracts.rs:18-19
Timestamp: 2025-05-28T16:22:26.334Z
Learning: In packages/rs-drive/src/cache/system_contracts.rs, the `active_since_protocol_version` field in `ActiveSystemDataContract` struct is intentionally added for future use, not current implementation. QuantumExplorer confirmed this is "meant for later" when questioned about the `#[allow(unused)]` attribute.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/src/executor.rs:38-38
Timestamp: 2024-10-29T14:44:01.184Z
Learning: In `packages/rs-dapi-client/src/executor.rs`, for the structs `ExecutionError<E>` and `ExecutionResponse<R>`, only the serde derives (`Serialize`, `Deserialize`) should be conditional based on the "mocks" feature; the other derives (`Debug`, `Clone`, `Eq`, `PartialEq`) should always be present.
Learnt from: QuantumExplorer
PR: dashpay/platform#2227
File: packages/rs-drive-abci/src/platform_types/platform_state/mod.rs:141-141
Timestamp: 2024-10-08T13:28:03.529Z
Learning: When converting `PlatformStateV0` to `PlatformStateForSavingV1` in `packages/rs-drive-abci/src/platform_types/platform_state/mod.rs`, only version `0` needs to be handled in the match on `platform_state_for_saving_structure_default` because the changes are retroactive.
Learnt from: shumkov
PR: dashpay/platform#2317
File: packages/rs-dapi-client/src/address_list.rs:175-180
Timestamp: 2024-11-28T13:49:17.301Z
Learning: In Rust code in `packages/rs-dapi-client/src/address_list.rs`, do not change the interface of deprecated methods like `add_uri`, even to fix potential panics.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Applies to **/*.rs : Rust code should be formatted using `cargo fmt --all`
Learnt from: shumkov
PR: dashpay/platform#2248
File: packages/rs-drive-abci/src/main.rs:106-111
Timestamp: 2024-10-17T08:52:54.300Z
Learning: In this project, the environment variable `CARGO_PKG_RUST_VERSION` is defined and can be used safely with the `env!` macro.
Learnt from: QuantumExplorer
PR: dashpay/platform#2440
File: packages/rs-drive-abci/Cargo.toml:76-76
Timestamp: 2025-01-24T07:54:55.723Z
Learning: In the drive-abci package, bls-signatures is intentionally declared twice:
1. As an optional dependency in [dependencies] to make it an optional feature in production
2. As a non-optional dependency in [dev-dependencies] to ensure it's always available for tests
packages/wasm-sdk/build.sh (10)
Learnt from: shumkov
PR: dashpay/platform#2248
File: packages/rs-drive-abci/src/main.rs:106-111
Timestamp: 2024-10-17T08:52:54.300Z
Learning: In this project, the environment variable `CARGO_PKG_RUST_VERSION` is defined and can be used safely with the `env!` macro.
Learnt from: lklimek
PR: dashpay/platform#2254
File: packages/rs-sdk/src/sdk.rs:585-585
Timestamp: 2024-10-18T15:39:51.172Z
Learning: The 'platform' project uses Rust version 1.80, so code in 'packages/rs-sdk' can use features available in Rust 1.80, such as the `abs_diff()` method.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/Cargo.toml:22-22
Timestamp: 2024-10-29T10:42:00.521Z
Learning: In `packages/rs-dapi-client/Cargo.toml`, `backon` will not work without the `tokio-sleep` feature in our setup, so it's unnecessary to declare `tokio-sleep` as a separate feature in the `[features]` section.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
Learnt from: shumkov
PR: dashpay/platform#2375
File: packages/rs-drive-abci/Cargo.toml:61-63
Timestamp: 2024-12-05T09:29:38.918Z
Learning: In the `drive-abci` package, avoid adding unused dependencies like `hashbrown` to `Cargo.toml`. The team relies on CI to detect dependency version issues.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/rs-sdk/src/sync.rs:88-95
Timestamp: 2025-01-23T09:23:32.740Z
Learning: The `block_on` function in `packages/rs-sdk/src/sync.rs` is currently only used in tests, and its WebAssembly implementation is deferred until there's a user request for it.
Learnt from: shumkov
PR: dashpay/platform#2314
File: packages/wallet-contract/test/bootstrap.js:14-16
Timestamp: 2024-11-06T07:27:01.722Z
Learning: In `packages/wallet-contract/test/bootstrap.js`, for Mocha tests in Node.js, async functions like `loadWasmDpp` can be assigned directly to `beforeAll` without wrapping them in another async function.
Learnt from: QuantumExplorer
PR: dashpay/platform#2431
File: packages/rs-drive/Cargo.toml:55-60
Timestamp: 2025-01-19T07:36:46.042Z
Learning: The grovedb dependencies in packages/rs-drive/Cargo.toml and related files are intentionally kept at specific revisions rather than using the latest stable version, with plans to update them at a later time.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/lib.rs:13-17
Timestamp: 2025-01-23T09:43:25.080Z
Learning: The codebase uses tracing_wasm for WebAssembly tracing as it provides sufficient functionality for the project's needs.
packages/wasm-sdk/src/lib.rs (12)
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/Cargo.toml:22-22
Timestamp: 2024-10-29T10:42:00.521Z
Learning: In `packages/rs-dapi-client/Cargo.toml`, `backon` will not work without the `tokio-sleep` feature in our setup, so it's unnecessary to declare `tokio-sleep` as a separate feature in the `[features]` section.
Learnt from: shumkov
PR: dashpay/platform#2317
File: packages/rs-dapi-client/src/address_list.rs:175-180
Timestamp: 2024-11-28T13:49:17.301Z
Learning: In Rust code in `packages/rs-dapi-client/src/address_list.rs`, do not change the interface of deprecated methods like `add_uri`, even to fix potential panics.
Learnt from: lklimek
PR: dashpay/platform#2380
File: packages/rs-drive-proof-verifier/src/error.rs:122-125
Timestamp: 2024-12-06T14:15:49.367Z
Learning: All error variants in `ContextProviderError` within `packages/rs-drive-proof-verifier/src/error.rs` are designed to take `String` as their parameter.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/lib.rs:13-17
Timestamp: 2025-01-23T09:43:25.080Z
Learning: The codebase uses tracing_wasm for WebAssembly tracing as it provides sufficient functionality for the project's needs.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/rs-sdk/src/sync.rs:88-95
Timestamp: 2025-01-23T09:23:32.740Z
Learning: The `block_on` function in `packages/rs-sdk/src/sync.rs` is currently only used in tests, and its WebAssembly implementation is deferred until there's a user request for it.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/tests/fetch/config.rs:233-233
Timestamp: 2024-10-30T11:19:59.163Z
Learning: In the Rust SDK's `rs-sdk/tests` integration tests (e.g., in `packages/rs-sdk/tests/fetch/config.rs`), we cannot create objects during tests because there is no support for object creation in this context. Therefore, hardcoded values for test identities must be used.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/rs-sdk/src/sync.rs:88-95
Timestamp: 2025-01-23T09:23:32.740Z
Learning: The `block_on` function in `packages/rs-sdk/src/sync.rs` requires true blocking behavior, which is why a non-blocking WebAssembly implementation using `wasm_bindgen_futures::spawn_local` is not suitable.
Learnt from: shumkov
PR: dashpay/platform#2259
File: packages/rs-dapi-client/src/dapi_client.rs:137-139
Timestamp: 2024-10-22T10:53:12.111Z
Learning: In `packages/rs-dapi-client/src/dapi_client.rs`, when passing data into asynchronous code, ensure that data structures are `Send + Sync`. Using `Arc<AtomicUsize>` is necessary for the retry counter.
Learnt from: shumkov
PR: dashpay/platform#2270
File: packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js:69-125
Timestamp: 2024-10-24T05:07:35.892Z
Learning: Future development plans involve rewriting DAPI into Rust, as the rest of the project has already migrated.
Learnt from: QuantumExplorer
PR: dashpay/platform#2690
File: packages/wasm-sdk/src/queries/document.rs:383-384
Timestamp: 2025-07-10T00:37:09.565Z
Learning: In the Dash platform, DPNS (Dash Platform Name Service) contracts have the same ID across all networks (mainnet, testnet, etc.), so hardcoding the DPNS contract ID is appropriate and doesn't need to be configurable.
packages/rs-sdk-trusted-context-provider/src/provider.rs (14)
Learnt from: QuantumExplorer
PR: dashpay/platform#2644
File: packages/rs-drive/src/cache/system_contracts.rs:18-19
Timestamp: 2025-05-28T16:22:26.334Z
Learning: In packages/rs-drive/src/cache/system_contracts.rs, the `active_since_protocol_version` field in `ActiveSystemDataContract` struct is intentionally added for future use, not current implementation. QuantumExplorer confirmed this is "meant for later" when questioned about the `#[allow(unused)]` attribute.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts is already handled in the data contract validation process, specifically in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs.
Learnt from: shumkov
PR: dashpay/platform#2259
File: packages/rs-dapi-client/src/dapi_client.rs:137-139
Timestamp: 2024-10-22T10:53:12.111Z
Learning: In `packages/rs-dapi-client/src/dapi_client.rs`, when passing data into asynchronous code, ensure that data structures are `Send + Sync`. Using `Arc<AtomicUsize>` is necessary for the retry counter.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts (ensuring it's between 3 and 100 characters) is already handled at the data contract validation level in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs, making additional checks in the update operations redundant.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/src/executor.rs:38-38
Timestamp: 2024-10-29T14:44:01.184Z
Learning: In `packages/rs-dapi-client/src/executor.rs`, for the structs `ExecutionError<E>` and `ExecutionResponse<R>`, only the serde derives (`Serialize`, `Deserialize`) should be conditional based on the "mocks" feature; the other derives (`Debug`, `Clone`, `Eq`, `PartialEq`) should always be present.
Learnt from: lklimek
PR: dashpay/platform#2254
File: packages/rs-sdk/src/sdk.rs:654-658
Timestamp: 2024-10-18T15:43:32.447Z
Learning: In `packages/rs-sdk/src/sdk.rs`, within the `verify_metadata_height` function, when using `compare_exchange` on `last_seen_height`, it's acceptable to use `Ordering::Relaxed` for the failure ordering, as any inconsistency would only trigger an extra loop iteration without affecting correctness.
Learnt from: shumkov
PR: dashpay/platform#2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-03T11:51:06.980Z
Learning: In the `IdentityTransitionVersions` structure within `packages/rs-platform-version/src/version/v2.rs`, the field `credit_withdrawal` does not need the `identity_` prefix since it is already encompassed within identity state transitions.
Learnt from: shumkov
PR: dashpay/platform#2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the `IdentityTransitionVersions` structure within `packages/rs-platform-version/src/version/v2.rs`, the field `credit_withdrawal` does not need the `identity_` prefix since it is already encompassed within identity state transitions.
Learnt from: lklimek
PR: dashpay/platform#2254
File: packages/rs-sdk/src/sdk.rs:585-585
Timestamp: 2024-10-18T15:39:51.172Z
Learning: The 'platform' project uses Rust version 1.80, so code in 'packages/rs-sdk' can use features available in Rust 1.80, such as the `abs_diff()` method.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/src/core/transaction.rs:0-0
Timestamp: 2024-10-29T14:40:54.727Z
Learning: In `packages/rs-sdk/src/platform/document_query.rs` and `packages/rs-sdk/src/core/transaction.rs`, certain places don't implement `IntoInner`, so direct error mappings cannot be simplified using `IntoInner`. A TODO comment has been added to address this in a future PR.
Learnt from: QuantumExplorer
PR: dashpay/platform#2690
File: packages/wasm-sdk/src/queries/document.rs:383-384
Timestamp: 2025-07-10T00:37:09.565Z
Learning: In the Dash platform, DPNS (Dash Platform Name Service) contracts have the same ID across all networks (mainnet, testnet, etc.), so hardcoding the DPNS contract ID is appropriate and doesn't need to be configurable.
Learnt from: QuantumExplorer
PR: dashpay/platform#2432
File: packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/mod.rs:222-225
Timestamp: 2025-01-20T16:20:59.791Z
Learning: In the Dash Platform codebase, TokenAmount from crate::balances::credits is compatible with u64 when used for token base supply.
Learnt from: QuantumExplorer
PR: dashpay/platform#2432
File: packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/mod.rs:222-225
Timestamp: 2025-01-20T16:20:59.791Z
Learning: In the Dash Platform codebase, TokenAmount is defined as `type TokenAmount = u64` in balances/credits.rs, making it directly compatible with u64 values without any conversion needed.
Learnt from: shumkov
PR: dashpay/platform#2345
File: packages/wallet-utils-contract/src/lib.rs:14-17
Timestamp: 2024-11-25T07:48:09.831Z
Learning: In the `wallet-utils-contract` (file `packages/wallet-utils-contract/src/lib.rs`), the `OWNER_ID_BYTES` constant is intentionally initialized to all zeros.
packages/scripts/build-wasm.sh (8)
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
Learnt from: shumkov
PR: dashpay/platform#2248
File: packages/rs-drive-abci/src/main.rs:106-111
Timestamp: 2024-10-17T08:52:54.300Z
Learning: In this project, the environment variable `CARGO_PKG_RUST_VERSION` is defined and can be used safely with the `env!` macro.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Applies to **/*.rs : Check Rust code using `cargo check --workspace`
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/Cargo.toml:22-22
Timestamp: 2024-10-29T10:42:00.521Z
Learning: In `packages/rs-dapi-client/Cargo.toml`, `backon` will not work without the `tokio-sleep` feature in our setup, so it's unnecessary to declare `tokio-sleep` as a separate feature in the `[features]` section.
Learnt from: shumkov
PR: dashpay/platform#2375
File: packages/rs-drive-abci/Cargo.toml:61-63
Timestamp: 2024-12-05T09:29:38.918Z
Learning: In the `drive-abci` package, avoid adding unused dependencies like `hashbrown` to `Cargo.toml`. The team relies on CI to detect dependency version issues.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/lib.rs:13-17
Timestamp: 2025-01-23T09:43:25.080Z
Learning: The codebase uses tracing_wasm for WebAssembly tracing as it provides sufficient functionality for the project's needs.
Learnt from: lklimek
PR: dashpay/platform#2254
File: packages/rs-sdk/src/sdk.rs:585-585
Timestamp: 2024-10-18T15:39:51.172Z
Learning: The 'platform' project uses Rust version 1.80, so code in 'packages/rs-sdk' can use features available in Rust 1.80, such as the `abs_diff()` method.
Learnt from: lklimek
PR: dashpay/platform#2374
File: Dockerfile:117-118
Timestamp: 2024-12-16T08:59:40.337Z
Learning: In our Dockerfiles, using `ONBUILD ARG CARGO_BUILD_PROFILE=dev` works correctly, and `CARGO_BUILD_PROFILE` is recognized in subsequent stages.
packages/rs-dpp/src/system_data_contracts.rs (11)
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts is already handled in the data contract validation process, specifically in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs.
Learnt from: QuantumExplorer
PR: dashpay/platform#2227
File: packages/rs-drive-abci/src/platform_types/platform_state/mod.rs:141-141
Timestamp: 2024-10-08T13:28:03.529Z
Learning: When converting `PlatformStateV0` to `PlatformStateForSavingV1` in `packages/rs-drive-abci/src/platform_types/platform_state/mod.rs`, only version `0` needs to be handled in the match on `platform_state_for_saving_structure_default` because the changes are retroactive.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts (ensuring it's between 3 and 100 characters) is already handled at the data contract validation level in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs, making additional checks in the update operations redundant.
Learnt from: QuantumExplorer
PR: dashpay/platform#2644
File: packages/rs-drive/src/cache/system_contracts.rs:18-19
Timestamp: 2025-05-28T16:22:26.334Z
Learning: In packages/rs-drive/src/cache/system_contracts.rs, the `active_since_protocol_version` field in `ActiveSystemDataContract` struct is intentionally added for future use, not current implementation. QuantumExplorer confirmed this is "meant for later" when questioned about the `#[allow(unused)]` attribute.
Learnt from: shumkov
PR: dashpay/platform#2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-03T11:51:06.980Z
Learning: In the `IdentityTransitionVersions` structure within `packages/rs-platform-version/src/version/v2.rs`, the field `credit_withdrawal` does not need the `identity_` prefix since it is already encompassed within identity state transitions.
Learnt from: shumkov
PR: dashpay/platform#2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the `IdentityTransitionVersions` structure within `packages/rs-platform-version/src/version/v2.rs`, the field `credit_withdrawal` does not need the `identity_` prefix since it is already encompassed within identity state transitions.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/src/core/transaction.rs:0-0
Timestamp: 2024-10-29T14:40:54.727Z
Learning: In `packages/rs-sdk/src/platform/document_query.rs` and `packages/rs-sdk/src/core/transaction.rs`, certain places don't implement `IntoInner`, so direct error mappings cannot be simplified using `IntoInner`. A TODO comment has been added to address this in a future PR.
Learnt from: shumkov
PR: dashpay/platform#2259
File: packages/rs-dapi-client/src/dapi_client.rs:137-139
Timestamp: 2024-10-22T10:53:12.111Z
Learning: In `packages/rs-dapi-client/src/dapi_client.rs`, when passing data into asynchronous code, ensure that data structures are `Send + Sync`. Using `Arc<AtomicUsize>` is necessary for the retry counter.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/src/executor.rs:38-38
Timestamp: 2024-10-29T14:44:01.184Z
Learning: In `packages/rs-dapi-client/src/executor.rs`, for the structs `ExecutionError<E>` and `ExecutionResponse<R>`, only the serde derives (`Serialize`, `Deserialize`) should be conditional based on the "mocks" feature; the other derives (`Debug`, `Clone`, `Eq`, `PartialEq`) should always be present.
Learnt from: QuantumExplorer
PR: dashpay/platform#2182
File: packages/rs-drive/src/util/grove_operations/batch_insert_if_not_exists_return_existing_element/mod.rs:46-50
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In this codebase, match statements for versions are intentionally designed to handle known versions and treat unknown versions as mismatches.
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/src/platform_types/platform_state/v0/old_structures/mod.rs:94-94
Timestamp: 2024-11-20T10:01:50.837Z
Learning: In `packages/rs-drive-abci/src/platform_types/platform_state/v0/old_structures/mod.rs`, when converting with `PublicKey::try_from`, it's acceptable to use `.expect()` to handle potential conversion errors.
packages/rs-sdk/Cargo.toml (15)
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/Cargo.toml:22-22
Timestamp: 2024-10-29T10:42:00.521Z
Learning: In `packages/rs-dapi-client/Cargo.toml`, `backon` will not work without the `tokio-sleep` feature in our setup, so it's unnecessary to declare `tokio-sleep` as a separate feature in the `[features]` section.
Learnt from: QuantumExplorer
PR: dashpay/platform#2431
File: packages/rs-drive/Cargo.toml:55-60
Timestamp: 2025-01-19T07:36:46.042Z
Learning: The grovedb dependencies in packages/rs-drive/Cargo.toml and related files are intentionally kept at specific revisions rather than using the latest stable version, with plans to update them at a later time.
Learnt from: shumkov
PR: dashpay/platform#2489
File: packages/rs-dpp/Cargo.toml:32-32
Timestamp: 2025-03-11T09:39:23.071Z
Learning: In the Dash Platform project, dependencies are currently managed using Git repository references with tags (repo+tag format in Cargo.toml) rather than published crates, as the team is not currently publishing crates to crates.io.
Learnt from: shumkov
PR: dashpay/platform#2375
File: packages/rs-drive-abci/Cargo.toml:61-63
Timestamp: 2024-12-05T09:29:38.918Z
Learning: In the `drive-abci` package, avoid adding unused dependencies like `hashbrown` to `Cargo.toml`. The team relies on CI to detect dependency version issues.
Learnt from: QuantumExplorer
PR: dashpay/platform#2644
File: packages/rs-drive/src/cache/system_contracts.rs:18-19
Timestamp: 2025-05-28T16:22:26.334Z
Learning: In packages/rs-drive/src/cache/system_contracts.rs, the `active_since_protocol_version` field in `ActiveSystemDataContract` struct is intentionally added for future use, not current implementation. QuantumExplorer confirmed this is "meant for later" when questioned about the `#[allow(unused)]` attribute.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts is already handled in the data contract validation process, specifically in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs.
Learnt from: lklimek
PR: dashpay/platform#2254
File: packages/rs-sdk/src/sdk.rs:585-585
Timestamp: 2024-10-18T15:39:51.172Z
Learning: The 'platform' project uses Rust version 1.80, so code in 'packages/rs-sdk' can use features available in Rust 1.80, such as the `abs_diff()` method.
Learnt from: shumkov
PR: dashpay/platform#2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-03T11:51:06.980Z
Learning: In the `IdentityTransitionVersions` structure within `packages/rs-platform-version/src/version/v2.rs`, the field `credit_withdrawal` does not need the `identity_` prefix since it is already encompassed within identity state transitions.
Learnt from: shumkov
PR: dashpay/platform#2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the `IdentityTransitionVersions` structure within `packages/rs-platform-version/src/version/v2.rs`, the field `credit_withdrawal` does not need the `identity_` prefix since it is already encompassed within identity state transitions.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts (ensuring it's between 3 and 100 characters) is already handled at the data contract validation level in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs, making additional checks in the update operations redundant.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/src/sync.rs:0-0
Timestamp: 2024-10-30T11:07:18.462Z
Learning: The `test_case` crate is used in the project, and the `#[test_case::test_matrix(...)]` attribute is valid for parameterized testing in Rust.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Applies to **/*.rs : Run Rust tests using `cargo test`
Learnt from: shumkov
PR: dashpay/platform#2248
File: packages/rs-drive-abci/src/main.rs:106-111
Timestamp: 2024-10-17T08:52:54.300Z
Learning: In this project, the environment variable `CARGO_PKG_RUST_VERSION` is defined and can be used safely with the `env!` macro.
Learnt from: shumkov
PR: dashpay/platform#2345
File: packages/wallet-utils-contract/schema/v1/wallet-utils-contract-documents.json:49-55
Timestamp: 2024-11-25T07:49:05.419Z
Learning: In the schema definitions for the `wallet-utils-contract` (file `packages/wallet-utils-contract/schema/v1/wallet-utils-contract-documents.json`), the `$createdAt` field is a system field augmented by DPP and does not need to be defined explicitly in the schema's properties.
Learnt from: QuantumExplorer
PR: dashpay/platform#2690
File: packages/wasm-sdk/src/queries/document.rs:383-384
Timestamp: 2025-07-10T00:37:09.565Z
Learning: In the Dash platform, DPNS (Dash Platform Name Service) contracts have the same ID across all networks (mainnet, testnet, etc.), so hardcoding the DPNS contract ID is appropriate and doesn't need to be configurable.
packages/data-contracts/Cargo.toml (13)
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/Cargo.toml:22-22
Timestamp: 2024-10-29T10:42:00.521Z
Learning: In `packages/rs-dapi-client/Cargo.toml`, `backon` will not work without the `tokio-sleep` feature in our setup, so it's unnecessary to declare `tokio-sleep` as a separate feature in the `[features]` section.
Learnt from: shumkov
PR: dashpay/platform#2375
File: packages/rs-drive-abci/Cargo.toml:61-63
Timestamp: 2024-12-05T09:29:38.918Z
Learning: In the `drive-abci` package, avoid adding unused dependencies like `hashbrown` to `Cargo.toml`. The team relies on CI to detect dependency version issues.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts is already handled in the data contract validation process, specifically in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs.
Learnt from: QuantumExplorer
PR: dashpay/platform#2431
File: packages/rs-drive/Cargo.toml:55-60
Timestamp: 2025-01-19T07:36:46.042Z
Learning: The grovedb dependencies in packages/rs-drive/Cargo.toml and related files are intentionally kept at specific revisions rather than using the latest stable version, with plans to update them at a later time.
Learnt from: QuantumExplorer
PR: dashpay/platform#2644
File: packages/rs-drive/src/cache/system_contracts.rs:18-19
Timestamp: 2025-05-28T16:22:26.334Z
Learning: In packages/rs-drive/src/cache/system_contracts.rs, the `active_since_protocol_version` field in `ActiveSystemDataContract` struct is intentionally added for future use, not current implementation. QuantumExplorer confirmed this is "meant for later" when questioned about the `#[allow(unused)]` attribute.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts (ensuring it's between 3 and 100 characters) is already handled at the data contract validation level in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs, making additional checks in the update operations redundant.
Learnt from: shumkov
PR: dashpay/platform#2489
File: packages/rs-dpp/Cargo.toml:32-32
Timestamp: 2025-03-11T09:39:23.071Z
Learning: In the Dash Platform project, dependencies are currently managed using Git repository references with tags (repo+tag format in Cargo.toml) rather than published crates, as the team is not currently publishing crates to crates.io.
Learnt from: shumkov
PR: dashpay/platform#2248
File: packages/rs-drive-abci/src/main.rs:106-111
Timestamp: 2024-10-17T08:52:54.300Z
Learning: In this project, the environment variable `CARGO_PKG_RUST_VERSION` is defined and can be used safely with the `env!` macro.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/src/executor.rs:38-38
Timestamp: 2024-10-29T14:44:01.184Z
Learning: In `packages/rs-dapi-client/src/executor.rs`, for the structs `ExecutionError<E>` and `ExecutionResponse<R>`, only the serde derives (`Serialize`, `Deserialize`) should be conditional based on the "mocks" feature; the other derives (`Debug`, `Clone`, `Eq`, `PartialEq`) should always be present.
Learnt from: lklimek
PR: dashpay/platform#2254
File: packages/rs-sdk/src/sdk.rs:585-585
Timestamp: 2024-10-18T15:39:51.172Z
Learning: The 'platform' project uses Rust version 1.80, so code in 'packages/rs-sdk' can use features available in Rust 1.80, such as the `abs_diff()` method.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Applies to **/*.rs : Check Rust code using `cargo check --workspace`
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/rs-sdk/src/sync.rs:88-95
Timestamp: 2025-01-23T09:23:32.740Z
Learning: The `block_on` function in `packages/rs-sdk/src/sync.rs` is currently only used in tests, and its WebAssembly implementation is deferred until there's a user request for it.
Learnt from: QuantumExplorer
PR: dashpay/platform#2440
File: packages/rs-drive-abci/Cargo.toml:76-76
Timestamp: 2025-01-24T07:54:55.723Z
Learning: In the drive-abci package, bls-signatures is intentionally declared twice:
1. As an optional dependency in [dependencies] to make it an optional feature in production
2. As a non-optional dependency in [dev-dependencies] to ensure it's always available for tests
packages/wasm-sdk/index.html (6)
undefined
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2690
File: packages/wasm-sdk/src/queries/document.rs:383-384
Timestamp: 2025-07-10T00:37:09.565Z
Learning: In the Dash platform, DPNS (Dash Platform Name Service) contracts have the same ID across all networks (mainnet, testnet, etc.), so hardcoding the DPNS contract ID is appropriate and doesn't need to be configurable.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2314
File: packages/wallet-contract/test/bootstrap.js:14-16
Timestamp: 2024-11-06T07:27:01.722Z
Learning: In packages/wallet-contract/test/bootstrap.js
, for Mocha tests in Node.js, async functions like loadWasmDpp
can be assigned directly to beforeAll
without wrapping them in another async function.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2270
File: packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js:90-96
Timestamp: 2024-10-24T05:01:51.097Z
Learning: In broadcastStateTransitionHandlerFactory.js
, error handling when querying transaction status is handled in the API script.
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Documents and data contracts should use state transitions for updates
</retrieved_learning>
packages/data-contracts/src/error.rs (12)
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/src/core/transaction.rs:0-0
Timestamp: 2024-10-29T14:40:54.727Z
Learning: In `packages/rs-sdk/src/platform/document_query.rs` and `packages/rs-sdk/src/core/transaction.rs`, certain places don't implement `IntoInner`, so direct error mappings cannot be simplified using `IntoInner`. A TODO comment has been added to address this in a future PR.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/src/executor.rs:38-38
Timestamp: 2024-10-29T14:44:01.184Z
Learning: In `packages/rs-dapi-client/src/executor.rs`, for the structs `ExecutionError<E>` and `ExecutionResponse<R>`, only the serde derives (`Serialize`, `Deserialize`) should be conditional based on the "mocks" feature; the other derives (`Debug`, `Clone`, `Eq`, `PartialEq`) should always be present.
Learnt from: QuantumExplorer
PR: dashpay/platform#2644
File: packages/rs-drive/src/cache/system_contracts.rs:18-19
Timestamp: 2025-05-28T16:22:26.334Z
Learning: In packages/rs-drive/src/cache/system_contracts.rs, the `active_since_protocol_version` field in `ActiveSystemDataContract` struct is intentionally added for future use, not current implementation. QuantumExplorer confirmed this is "meant for later" when questioned about the `#[allow(unused)]` attribute.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts is already handled in the data contract validation process, specifically in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts (ensuring it's between 3 and 100 characters) is already handled at the data contract validation level in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs, making additional checks in the update operations redundant.
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: 2024-11-22T08:19:14.448Z
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.
Learnt from: lklimek
PR: dashpay/platform#2380
File: packages/rs-drive-proof-verifier/src/error.rs:122-125
Timestamp: 2024-12-06T14:15:49.367Z
Learning: All error variants in `ContextProviderError` within `packages/rs-drive-proof-verifier/src/error.rs` are designed to take `String` as their parameter.
Learnt from: shumkov
PR: dashpay/platform#2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-03T11:51:06.980Z
Learning: In the `IdentityTransitionVersions` structure within `packages/rs-platform-version/src/version/v2.rs`, the field `credit_withdrawal` does not need the `identity_` prefix since it is already encompassed within identity state transitions.
Learnt from: shumkov
PR: dashpay/platform#2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the `IdentityTransitionVersions` structure within `packages/rs-platform-version/src/version/v2.rs`, the field `credit_withdrawal` does not need the `identity_` prefix since it is already encompassed within identity state transitions.
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/src/platform_types/platform_state/v0/old_structures/mod.rs:94-94
Timestamp: 2024-11-20T10:01:50.837Z
Learning: In `packages/rs-drive-abci/src/platform_types/platform_state/v0/old_structures/mod.rs`, when converting with `PublicKey::try_from`, it's acceptable to use `.expect()` to handle potential conversion errors.
Learnt from: lklimek
PR: dashpay/platform#2337
File: packages/rs-dapi-client/src/executor.rs:161-212
Timestamp: 2024-11-20T14:14:54.721Z
Learning: In `packages/rs-dapi-client/src/executor.rs`, the `WrapWithExecutionResult` trait supports on-the-fly type conversions using the `From` trait, which is useful when using the `?` operator to return errors.
Learnt from: shumkov
PR: dashpay/platform#2259
File: packages/rs-dapi-client/src/transport.rs:51-51
Timestamp: 2024-10-22T10:51:16.910Z
Learning: In implementations of `TransportClient`, only `DapiClientError` is used as the `Error` type, and it implements `std::error::Error`.
packages/wasm-sdk/src/dpns.rs (10)
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
Learnt from: QuantumExplorer
PR: dashpay/platform#2690
File: packages/wasm-sdk/src/queries/document.rs:383-384
Timestamp: 2025-07-10T00:37:09.565Z
Learning: In the Dash platform, DPNS (Dash Platform Name Service) contracts have the same ID across all networks (mainnet, testnet, etc.), so hardcoding the DPNS contract ID is appropriate and doesn't need to be configurable.
Learnt from: lklimek
PR: dashpay/platform#2232
File: packages/rs-sdk/src/mock/sdk.rs:90-95
Timestamp: 2024-10-10T10:30:19.883Z
Learning: In `packages/rs-sdk/src/mock/sdk.rs`, the `load_expectations` method in `MockDashPlatformSdk` remains asynchronous (`async`) for backward compatibility, even though it now delegates to the synchronous `load_expectations_sync` method.
Learnt from: shumkov
PR: dashpay/platform#2317
File: packages/rs-dapi-client/src/address_list.rs:175-180
Timestamp: 2024-11-28T13:49:17.301Z
Learning: In Rust code in `packages/rs-dapi-client/src/address_list.rs`, do not change the interface of deprecated methods like `add_uri`, even to fix potential panics.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/rs-sdk/src/sync.rs:88-95
Timestamp: 2025-01-23T09:23:32.740Z
Learning: The `block_on` function in `packages/rs-sdk/src/sync.rs` is currently only used in tests, and its WebAssembly implementation is deferred until there's a user request for it.
Learnt from: lklimek
PR: dashpay/platform#2254
File: packages/rs-sdk/src/sdk.rs:585-585
Timestamp: 2024-10-18T15:39:51.172Z
Learning: The 'platform' project uses Rust version 1.80, so code in 'packages/rs-sdk' can use features available in Rust 1.80, such as the `abs_diff()` method.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/tests/fetch/config.rs:233-233
Timestamp: 2024-10-30T11:19:59.163Z
Learning: In the Rust SDK's `rs-sdk/tests` integration tests (e.g., in `packages/rs-sdk/tests/fetch/config.rs`), we cannot create objects during tests because there is no support for object creation in this context. Therefore, hardcoded values for test identities must be used.
Learnt from: shumkov
PR: dashpay/platform#2270
File: packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js:69-125
Timestamp: 2024-10-24T05:07:35.892Z
Learning: Future development plans involve rewriting DAPI into Rust, as the rest of the project has already migrated.
Learnt from: QuantumExplorer
PR: dashpay/platform#2215
File: packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs:19-30
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the Rust file `packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs`, within the `create_owner_identity_v1` function, the `add_public_keys` method of the `Identity` struct cannot fail and does not require explicit error handling.
Learnt from: QuantumExplorer
PR: dashpay/platform#2215
File: packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs:19-30
Timestamp: 2024-10-06T16:11:34.946Z
Learning: In the Rust file `packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs`, within the `create_owner_identity_v1` function, the `add_public_keys` method of the `Identity` struct cannot fail and does not require explicit error handling.
packages/rs-dpp/Cargo.toml (13)
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/Cargo.toml:22-22
Timestamp: 2024-10-29T10:42:00.521Z
Learning: In `packages/rs-dapi-client/Cargo.toml`, `backon` will not work without the `tokio-sleep` feature in our setup, so it's unnecessary to declare `tokio-sleep` as a separate feature in the `[features]` section.
Learnt from: QuantumExplorer
PR: dashpay/platform#2431
File: packages/rs-drive/Cargo.toml:55-60
Timestamp: 2025-01-19T07:36:46.042Z
Learning: The grovedb dependencies in packages/rs-drive/Cargo.toml and related files are intentionally kept at specific revisions rather than using the latest stable version, with plans to update them at a later time.
Learnt from: shumkov
PR: dashpay/platform#2489
File: packages/rs-dpp/Cargo.toml:32-32
Timestamp: 2025-03-11T09:39:23.071Z
Learning: In the Dash Platform project, dependencies are currently managed using Git repository references with tags (repo+tag format in Cargo.toml) rather than published crates, as the team is not currently publishing crates to crates.io.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts is already handled in the data contract validation process, specifically in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs.
Learnt from: shumkov
PR: dashpay/platform#2375
File: packages/rs-drive-abci/Cargo.toml:61-63
Timestamp: 2024-12-05T09:29:38.918Z
Learning: In the `drive-abci` package, avoid adding unused dependencies like `hashbrown` to `Cargo.toml`. The team relies on CI to detect dependency version issues.
Learnt from: lklimek
PR: dashpay/platform#2254
File: packages/rs-sdk/src/sdk.rs:585-585
Timestamp: 2024-10-18T15:39:51.172Z
Learning: The 'platform' project uses Rust version 1.80, so code in 'packages/rs-sdk' can use features available in Rust 1.80, such as the `abs_diff()` method.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts (ensuring it's between 3 and 100 characters) is already handled at the data contract validation level in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs, making additional checks in the update operations redundant.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/src/executor.rs:38-38
Timestamp: 2024-10-29T14:44:01.184Z
Learning: In `packages/rs-dapi-client/src/executor.rs`, for the structs `ExecutionError<E>` and `ExecutionResponse<R>`, only the serde derives (`Serialize`, `Deserialize`) should be conditional based on the "mocks" feature; the other derives (`Debug`, `Clone`, `Eq`, `PartialEq`) should always be present.
Learnt from: QuantumExplorer
PR: dashpay/platform#2644
File: packages/rs-drive/src/cache/system_contracts.rs:18-19
Timestamp: 2025-05-28T16:22:26.334Z
Learning: In packages/rs-drive/src/cache/system_contracts.rs, the `active_since_protocol_version` field in `ActiveSystemDataContract` struct is intentionally added for future use, not current implementation. QuantumExplorer confirmed this is "meant for later" when questioned about the `#[allow(unused)]` attribute.
Learnt from: shumkov
PR: dashpay/platform#2317
File: packages/rs-dapi-client/src/address_list.rs:175-180
Timestamp: 2024-11-28T13:49:17.301Z
Learning: In Rust code in `packages/rs-dapi-client/src/address_list.rs`, do not change the interface of deprecated methods like `add_uri`, even to fix potential panics.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use `rs-platform-version` for protocol versioning in platform components
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/src/platform_types/platform_state/v0/old_structures/mod.rs:94-94
Timestamp: 2024-11-20T10:01:50.837Z
Learning: In `packages/rs-drive-abci/src/platform_types/platform_state/v0/old_structures/mod.rs`, when converting with `PublicKey::try_from`, it's acceptable to use `.expect()` to handle potential conversion errors.
Learnt from: shumkov
PR: dashpay/platform#2206
File: packages/rs-drive-abci/tests/strategy_tests/main.rs:1162-1162
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the Rust test file `packages/rs-drive-abci/tests/strategy_tests/main.rs`, specific protocol versions like `PROTOCOL_VERSION_1` are intentionally used in tests instead of `PROTOCOL_VERSION_LATEST`.
packages/rs-sdk/src/platform/dpns_usernames.rs (8)
Learnt from: QuantumExplorer
PR: dashpay/platform#2690
File: packages/wasm-sdk/src/queries/document.rs:383-384
Timestamp: 2025-07-10T00:37:09.565Z
Learning: In the Dash platform, DPNS (Dash Platform Name Service) contracts have the same ID across all networks (mainnet, testnet, etc.), so hardcoding the DPNS contract ID is appropriate and doesn't need to be configurable.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/tests/fetch/config.rs:233-233
Timestamp: 2024-10-30T11:19:59.163Z
Learning: In the Rust SDK's `rs-sdk/tests` integration tests (e.g., in `packages/rs-sdk/tests/fetch/config.rs`), we cannot create objects during tests because there is no support for object creation in this context. Therefore, hardcoded values for test identities must be used.
Learnt from: lklimek
PR: dashpay/platform#2254
File: packages/rs-sdk/src/sdk.rs:585-585
Timestamp: 2024-10-18T15:39:51.172Z
Learning: The 'platform' project uses Rust version 1.80, so code in 'packages/rs-sdk' can use features available in Rust 1.80, such as the `abs_diff()` method.
Learnt from: lklimek
PR: dashpay/platform#2232
File: packages/rs-sdk/src/mock/sdk.rs:90-95
Timestamp: 2024-10-10T10:30:19.883Z
Learning: In `packages/rs-sdk/src/mock/sdk.rs`, the `load_expectations` method in `MockDashPlatformSdk` remains asynchronous (`async`) for backward compatibility, even though it now delegates to the synchronous `load_expectations_sync` method.
Learnt from: QuantumExplorer
PR: dashpay/platform#2215
File: packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs:19-30
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the Rust file `packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs`, within the `create_owner_identity_v1` function, the `add_public_keys` method of the `Identity` struct cannot fail and does not require explicit error handling.
Learnt from: QuantumExplorer
PR: dashpay/platform#2215
File: packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs:19-30
Timestamp: 2024-10-06T16:11:34.946Z
Learning: In the Rust file `packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs`, within the `create_owner_identity_v1` function, the `add_public_keys` method of the `Identity` struct cannot fail and does not require explicit error handling.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts (ensuring it's between 3 and 100 characters) is already handled at the data contract validation level in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs, making additional checks in the update operations redundant.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts is already handled in the data contract validation process, specifically in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs.
packages/data-contracts/src/lib.rs (18)
Learnt from: QuantumExplorer
PR: dashpay/platform#2644
File: packages/rs-drive/src/cache/system_contracts.rs:18-19
Timestamp: 2025-05-28T16:22:26.334Z
Learning: In packages/rs-drive/src/cache/system_contracts.rs, the `active_since_protocol_version` field in `ActiveSystemDataContract` struct is intentionally added for future use, not current implementation. QuantumExplorer confirmed this is "meant for later" when questioned about the `#[allow(unused)]` attribute.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/src/executor.rs:38-38
Timestamp: 2024-10-29T14:44:01.184Z
Learning: In `packages/rs-dapi-client/src/executor.rs`, for the structs `ExecutionError<E>` and `ExecutionResponse<R>`, only the serde derives (`Serialize`, `Deserialize`) should be conditional based on the "mocks" feature; the other derives (`Debug`, `Clone`, `Eq`, `PartialEq`) should always be present.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts is already handled in the data contract validation process, specifically in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts (ensuring it's between 3 and 100 characters) is already handled at the data contract validation level in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs, making additional checks in the update operations redundant.
Learnt from: lklimek
PR: dashpay/platform#2254
File: packages/rs-sdk/src/sdk.rs:585-585
Timestamp: 2024-10-18T15:39:51.172Z
Learning: The 'platform' project uses Rust version 1.80, so code in 'packages/rs-sdk' can use features available in Rust 1.80, such as the `abs_diff()` method.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/Cargo.toml:22-22
Timestamp: 2024-10-29T10:42:00.521Z
Learning: In `packages/rs-dapi-client/Cargo.toml`, `backon` will not work without the `tokio-sleep` feature in our setup, so it's unnecessary to declare `tokio-sleep` as a separate feature in the `[features]` section.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/src/core/transaction.rs:0-0
Timestamp: 2024-10-29T14:40:54.727Z
Learning: In `packages/rs-sdk/src/platform/document_query.rs` and `packages/rs-sdk/src/core/transaction.rs`, certain places don't implement `IntoInner`, so direct error mappings cannot be simplified using `IntoInner`. A TODO comment has been added to address this in a future PR.
Learnt from: shumkov
PR: dashpay/platform#2259
File: packages/rs-dapi-client/src/dapi_client.rs:137-139
Timestamp: 2024-10-22T10:53:12.111Z
Learning: In `packages/rs-dapi-client/src/dapi_client.rs`, when passing data into asynchronous code, ensure that data structures are `Send + Sync`. Using `Arc<AtomicUsize>` is necessary for the retry counter.
Learnt from: shumkov
PR: dashpay/platform#2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-03T11:51:06.980Z
Learning: In the `IdentityTransitionVersions` structure within `packages/rs-platform-version/src/version/v2.rs`, the field `credit_withdrawal` does not need the `identity_` prefix since it is already encompassed within identity state transitions.
Learnt from: shumkov
PR: dashpay/platform#2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the `IdentityTransitionVersions` structure within `packages/rs-platform-version/src/version/v2.rs`, the field `credit_withdrawal` does not need the `identity_` prefix since it is already encompassed within identity state transitions.
Learnt from: QuantumExplorer
PR: dashpay/platform#2432
File: packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/mod.rs:222-225
Timestamp: 2025-01-20T16:20:59.791Z
Learning: In the Dash Platform codebase, TokenAmount from crate::balances::credits is compatible with u64 when used for token base supply.
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/src/platform_types/platform_state/v0/old_structures/mod.rs:94-94
Timestamp: 2024-11-20T10:01:50.837Z
Learning: In `packages/rs-drive-abci/src/platform_types/platform_state/v0/old_structures/mod.rs`, when converting with `PublicKey::try_from`, it's acceptable to use `.expect()` to handle potential conversion errors.
Learnt from: shumkov
PR: dashpay/platform#2489
File: packages/rs-dpp/Cargo.toml:32-32
Timestamp: 2025-03-11T09:39:23.071Z
Learning: In the Dash Platform project, dependencies are currently managed using Git repository references with tags (repo+tag format in Cargo.toml) rather than published crates, as the team is not currently publishing crates to crates.io.
Learnt from: shumkov
PR: dashpay/platform#2345
File: packages/wallet-utils-contract/src/lib.rs:14-17
Timestamp: 2024-11-25T07:48:09.831Z
Learning: In the `wallet-utils-contract` (file `packages/wallet-utils-contract/src/lib.rs`), the `OWNER_ID_BYTES` constant is intentionally initialized to all zeros.
Learnt from: QuantumExplorer
PR: dashpay/platform#2432
File: packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/mod.rs:222-225
Timestamp: 2025-01-20T16:20:59.791Z
Learning: In the Dash Platform codebase, TokenAmount is defined as `type TokenAmount = u64` in balances/credits.rs, making it directly compatible with u64 values without any conversion needed.
Learnt from: QuantumExplorer
PR: dashpay/platform#2347
File: packages/rs-drive/tests/query_tests.rs:438-460
Timestamp: 2024-11-25T01:17:02.001Z
Learning: In Rust test files (`packages/rs-drive/tests/query_tests.rs`), when code is used only in tests, defining explicit enums for fields (like the `status` field in the `Withdrawal` struct) may not be necessary; using primitive types is acceptable.
Learnt from: lklimek
PR: dashpay/platform#2380
File: packages/rs-drive-proof-verifier/src/error.rs:122-125
Timestamp: 2024-12-06T14:15:49.367Z
Learning: All error variants in `ContextProviderError` within `packages/rs-drive-proof-verifier/src/error.rs` are designed to take `String` as their parameter.
Learnt from: QuantumExplorer
PR: dashpay/platform#2690
File: packages/wasm-sdk/src/queries/document.rs:383-384
Timestamp: 2025-07-10T00:37:09.565Z
Learning: In the Dash platform, DPNS (Dash Platform Name Service) contracts have the same ID across all networks (mainnet, testnet, etc.), so hardcoding the DPNS contract ID is appropriate and doesn't need to be configurable.
packages/wasm-sdk/Cargo.toml (9)
Learnt from: lklimek
PR: dashpay/platform#2254
File: packages/rs-sdk/src/sdk.rs:585-585
Timestamp: 2024-10-18T15:39:51.172Z
Learning: The 'platform' project uses Rust version 1.80, so code in 'packages/rs-sdk' can use features available in Rust 1.80, such as the `abs_diff()` method.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/Cargo.toml:22-22
Timestamp: 2024-10-29T10:42:00.521Z
Learning: In `packages/rs-dapi-client/Cargo.toml`, `backon` will not work without the `tokio-sleep` feature in our setup, so it's unnecessary to declare `tokio-sleep` as a separate feature in the `[features]` section.
Learnt from: QuantumExplorer
PR: dashpay/platform#2644
File: packages/rs-drive/src/cache/system_contracts.rs:18-19
Timestamp: 2025-05-28T16:22:26.334Z
Learning: In packages/rs-drive/src/cache/system_contracts.rs, the `active_since_protocol_version` field in `ActiveSystemDataContract` struct is intentionally added for future use, not current implementation. QuantumExplorer confirmed this is "meant for later" when questioned about the `#[allow(unused)]` attribute.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
Learnt from: shumkov
PR: dashpay/platform#2489
File: packages/rs-dpp/Cargo.toml:32-32
Timestamp: 2025-03-11T09:39:23.071Z
Learning: In the Dash Platform project, dependencies are currently managed using Git repository references with tags (repo+tag format in Cargo.toml) rather than published crates, as the team is not currently publishing crates to crates.io.
Learnt from: lklimek
PR: dashpay/platform#2232
File: packages/rs-sdk/src/mock/sdk.rs:90-95
Timestamp: 2024-10-10T10:30:19.883Z
Learning: In `packages/rs-sdk/src/mock/sdk.rs`, the `load_expectations` method in `MockDashPlatformSdk` remains asynchronous (`async`) for backward compatibility, even though it now delegates to the synchronous `load_expectations_sync` method.
Learnt from: QuantumExplorer
PR: dashpay/platform#2440
File: packages/rs-drive-abci/Cargo.toml:76-76
Timestamp: 2025-01-24T07:54:55.723Z
Learning: In the drive-abci package, bls-signatures is intentionally declared twice:
1. As an optional dependency in [dependencies] to make it an optional feature in production
2. As a non-optional dependency in [dev-dependencies] to ensure it's always available for tests
Learnt from: QuantumExplorer
PR: dashpay/platform#2690
File: packages/wasm-sdk/src/queries/document.rs:383-384
Timestamp: 2025-07-10T00:37:09.565Z
Learning: In the Dash platform, DPNS (Dash Platform Name Service) contracts have the same ID across all networks (mainnet, testnet, etc.), so hardcoding the DPNS contract ID is appropriate and doesn't need to be configurable.
🧬 Code Graph Analysis (2)
packages/rs-dpp/src/system_data_contracts.rs (1)
packages/rs-dpp/src/data_contract/config/mod.rs (1)
default_for_version
(30-47)
packages/data-contracts/src/lib.rs (2)
packages/wallet-utils-contract/src/lib.rs (2)
load_definitions
(18-27)load_documents_schemas
(28-37)packages/wallet-utils-contract/src/v1/mod.rs (1)
load_documents_schemas
(16-21)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (19)
- GitHub Check: Rust packages (drive-abci) / Tests
- GitHub Check: Rust packages (drive-abci) / Linting
- GitHub Check: Rust packages (drive-abci) / Unused dependencies
- GitHub Check: Rust packages (drive) / Formatting
- GitHub Check: Rust packages (drive) / Linting
- GitHub Check: Rust packages (drive) / Tests
- GitHub Check: Rust packages (wasm-dpp) / Linting
- GitHub Check: Rust packages (dpp) / Linting
- GitHub Check: Rust packages (dpp) / Tests
- GitHub Check: Rust packages (dpp) / Unused dependencies
- GitHub Check: Rust packages (dpp) / Formatting
- GitHub Check: Rust packages (dpp) / Check each feature
- GitHub Check: Rust packages (wasm-dpp) / Tests
- GitHub Check: Rust packages (wasm-dpp) / Formatting
- 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
- GitHub Check: build-wasm-sdk
🔇 Additional comments (29)
packages/wasm-dpp/Cargo.toml (1)
46-47
: LGTM – feature flag updated coherently with the new contract splitpackages/rs-dpp/src/withdrawal/mod.rs (1)
2-3
: Accurate feature gate – matches newwithdrawals-contract
flagThe change correctly narrows compilation to the specific contract. 👍
packages/wasm-drive-verify/Cargo.toml (2)
16-17
: Runtime features & test features now diverge – is that intentional?Prod build enables only
data-contracts
while tests pull inall-system_contracts
.
If tests rely on contracts absent in prod this can hide integration issues. Verify the discrepancy is deliberate.
49-50
:all-system_contracts
spelled with underscore vs hyphen elsewhereElsewhere the umbrella feature is named
all-contracts
; here it’sall-system_contracts
. Confirm this is the canonical name to avoid “feature not found” errors when crates depend on each other.packages/scripts/build-wasm.sh (1)
110-117
:FEATURES_ARG
construction is fragile – quote expansion & avoid empty arg
wasm-pack build … $FEATURES_ARG
expands to an empty, separate argument when
FEATURES_ARG=""
, which some tools interpret as a positional parameter.
Safer pattern:if [[ -n "${CARGO_BUILD_FEATURES:-}" ]]; then read -ra FEATURES <<<"$CARGO_BUILD_FEATURES" # preserve commas wasm-pack build --target "$TARGET_TYPE" --release --no-opt \ --features "${FEATURES[*]}" else wasm-pack build --target "$TARGET_TYPE" --release --no-opt fiReplicate the same for the
cargo build
branch.
Quoting also protects feature names with spaces (unlikely but possible).Also applies to: 121-128
⛔ Skipped due to learnings
Learnt from: lklimek PR: dashpay/platform#2374 File: Dockerfile:117-118 Timestamp: 2024-12-16T08:59:40.337Z Learning: In our Dockerfiles, using `ONBUILD ARG CARGO_BUILD_PROFILE=dev` works correctly, and `CARGO_BUILD_PROFILE` is recognized in subsequent stages.
Learnt from: lklimek PR: dashpay/platform#2344 File: .github/actions/sccache/action.yaml:0-0 Timestamp: 2024-11-26T12:46:54.812Z Learning: In the `.github/actions/sccache/action.yaml` file, the environment variables `CC` and `CXX` need quotes around their values (e.g., `CC="sccache cc"`) to be interpreted correctly.
Learnt from: shumkov PR: dashpay/platform#2248 File: packages/rs-drive-abci/src/main.rs:106-111 Timestamp: 2024-10-17T08:52:54.300Z Learning: In this project, the environment variable `CARGO_PKG_RUST_VERSION` is defined and can be used safely with the `env!` macro.
packages/rs-dpp/src/lib.rs (1)
51-52
: LGTM: Consistent feature flag updatesThe feature flag changes from
"system_contracts"
to"data-contracts"
are consistent across both the module inclusion and crate re-export, aligning with the modularization effort.Also applies to: 119-120
packages/rs-drive/Cargo.toml (1)
75-75
: LGTM: Appropriate feature flag transitionsThe feature flag updates correctly differentiate between:
"all-system_contracts"
for comprehensive contract inclusion (dev-dependencies and server)"data-contracts"
for basic data contracts functionality (verify)This aligns with the modular contract inclusion strategy.
Also applies to: 106-106, 125-125
packages/rs-dpp/src/system_data_contracts.rs (1)
25-64
: LGTM: Explicit variant handling improves maintainabilityThe refactoring from grouped match arms to explicit individual arms enhances code clarity and makes it easier to modify contract-specific configurations. The sized integer types configuration is correctly preserved for each contract type.
packages/rs-sdk/Cargo.toml (1)
118-127
: LGTM: Well-structured modular feature approachThe feature structure effectively supports the modularization goals by providing both an aggregate
all-system-contracts
feature for convenience and granular individual contract features for selective inclusion. The feature naming is consistent with the broader codebase changes.packages/data-contracts/src/error.rs (2)
17-18
: LGTM: Clear error variant for excluded contractsThe
ContractNotIncluded
error variant provides clear guidance to users about which feature to enable, improving the developer experience when contracts are excluded from builds.
21-21
: LGTM: Proper conditional compilation for modular contractsThe conditional compilation attributes correctly ensure that error conversions are only available for enabled contract features, aligning with the modular inclusion strategy.
Also applies to: 39-39, 57-57, 75-75, 95-95, 113-113, 131-131, 149-149
packages/rs-sdk-trusted-context-provider/src/provider.rs (2)
13-22
: LGTM! Well-structured conditional compilation.The feature flags properly gate the system contracts imports and align with the modularization approach introduced across the codebase.
152-152
: Good API improvement!Removing
mut
fromself
is correct since the method only modifies internal state through a mutex lock, not the struct itself. This makes the builder pattern more flexible.packages/wasm-sdk/src/queries/document.rs (2)
374-449
: Well-implemented function refactoring!The function correctly extends the previous implementation to support fetching multiple usernames with a configurable limit. The hardcoded DPNS contract ID is appropriate as per platform conventions.
451-468
: Excellent backward compatibility implementation!The wrapper function preserves the original API while leveraging the new implementation. Good use of
js_sys::Array
for proper JavaScript interop.packages/rs-dpp/Cargo.toml (2)
52-52
: Good dependency management practice!Explicitly disabling default features gives better control over what gets included from the data-contracts package.
273-283
: Well-structured feature organization!The new feature structure provides both convenience (
all-system_contracts
) and fine-grained control (individual contract features). The dependency chains are properly configured.packages/wasm-sdk/src/dpns.rs (3)
20-36
: Clean utility function implementations!The synchronous utility functions properly expose SDK functionality with appropriate WASM bindings.
38-98
: Implementation looks good, but consider security implications.The registration logic is well-implemented with proper validation and error handling. However, accepting private keys as function parameters could pose security risks if these values are logged or cached.
Consider adding a warning in the documentation about secure handling of private keys, or explore alternative approaches like having the signing happen on the JavaScript side.
100-132
: Well-implemented query functions!The async functions properly handle SDK interactions with consistent error handling and appropriate null returns for missing data.
packages/wasm-sdk/Cargo.toml (1)
9-22
: Feature structure looks good!The new feature organization properly chains dependencies and aligns with the modularization across other packages.
Please confirm that including 5 contracts in the default features is intentional. Consider if a more minimal default (e.g., just
dpns-contract
) might be preferable for reducing WASM bundle size.packages/data-contracts/src/lib.rs (3)
7-32
: LGTM! Clean feature-gated imports.The conditional compilation pattern for contract modules is well-implemented and consistent.
126-223
: Well-structured feature-gated source loading.The
source()
method correctly handles both enabled and disabled features, returning appropriate errors when contracts are not included. The pattern is consistent across all contract types.
192-192
: No action required: version field is correctly namedThe
SystemDataContractVersions
struct inrs-platform-version
defines the field aswallet
(notwallet_utils
), so usingplatform_version.system_data_contracts.wallet
for theWalletUtils
contract is intentional and correct. Approving thesource()
method implementation as is.packages/rs-sdk/src/platform/dpns_usernames.rs (5)
1-14
: LGTM!The imports are well-organized and appropriate for the DPNS functionality being implemented.
16-28
: Good security practice for preventing homograph attacks.The character mapping effectively prevents visual confusion between similar-looking characters.
30-80
: Well-implemented username validation.The function correctly implements the DPNS username rules with proper boundary checks and character validation.
82-107
: Correct implementation of contested username detection.The function properly identifies usernames that require masternode voting based on the normalized form.
109-117
: Efficient double SHA256 implementation.Good use of the sha256d hash which already performs the double hashing.
pub mod types; | ||
|
||
pub mod documents; | ||
pub mod dpns_usernames; |
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.
🛠️ Refactor suggestion
Gate the new module behind the DPNS feature to keep no-default-features
builds compiling
dpns_usernames
almost certainly relies on DPNS-specific types which only compile when the corresponding contract feature is enabled. Without a cfg
, a minimal rs-sdk
build will fail.
- pub mod dpns_usernames;
+#[cfg(feature = "dpns")]
+pub mod dpns_usernames;
(Add a stub mod dpns_usernames {}
under #[cfg(not(feature = "dpns"))]
if callers need the symbol.)
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
pub mod dpns_usernames; | |
#[cfg(feature = "dpns")] | |
pub mod dpns_usernames; |
🤖 Prompt for AI Agents
In packages/rs-sdk/src/platform.rs at line 20, the dpns_usernames module is not
gated by the DPNS feature flag, causing compilation failures in
no-default-features builds. To fix this, wrap the existing `pub mod
dpns_usernames;` declaration with `#[cfg(feature = "dpns")]`. Additionally, add
a stub module `mod dpns_usernames {}` under `#[cfg(not(feature = "dpns"))]` to
provide a placeholder when the feature is disabled, ensuring minimal builds
compile successfully.
pub mod dpns; | ||
pub mod error; |
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.
Add cfg-gates for the new dpns
module/re-export
wasm-sdk
can now be built with a reduced contract set via the new CARGO_BUILD_FEATURES
mechanism. Unconditionally compiling dpns
will break builds where dpns-contract
is not enabled.
- pub mod dpns;
+#[cfg(feature = "dpns-contract")]
+pub mod dpns;
…
- pub use dpns::*;
+#[cfg(feature = "dpns-contract")]
+pub use dpns::*;
Also applies to: 16-17
🤖 Prompt for AI Agents
In packages/wasm-sdk/src/lib.rs around lines 5-6 and 16-17, the dpns module and
its re-export are included unconditionally, which breaks builds without the
dpns-contract feature. Add cfg attribute gates to conditionally compile and
re-export dpns only when the dpns-contract feature is enabled, using
#[cfg(feature = "dpns-contract")] to guard these lines.
[features] | ||
default = [] | ||
|
||
# All system contracts (includes all individual contracts) | ||
all-system-contracts = [ | ||
"dpp/all-system_contracts", | ||
"withdrawals-contract", | ||
"dpns-contract", | ||
"dashpay-contract", | ||
"wallet-utils-contract", | ||
"token-history-contract", | ||
"keywords-contract" | ||
] | ||
|
||
# Individual contract features - these enable specific contracts in DPP | ||
withdrawals-contract = ["dpp/withdrawals-contract"] | ||
dpns-contract = ["dpp/dpns-contract"] | ||
dashpay-contract = ["dpp/dashpay-contract"] | ||
wallet-utils-contract = ["dpp/wallet-utils-contract"] | ||
token-history-contract = ["dpp/token-history-contract"] | ||
keywords-contract = ["dpp/keywords-contract"] | ||
|
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.
Feature name typo will break cargo
resolution
"dpp/all-system_contracts"
uses an underscore while all other feature
definitions (and the convention in dpp
) use dashes
(all-system-contracts
). Cargo treats “-” and “_” as different names.
- "dpp/all-system_contracts",
+ "dpp/all-system-contracts",
Please verify the exact feature spelling in rs-dpp/Cargo.toml
and align it
here; otherwise builds with --features all-system-contracts
will fail.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
[features] | |
default = [] | |
# All system contracts (includes all individual contracts) | |
all-system-contracts = [ | |
"dpp/all-system_contracts", | |
"withdrawals-contract", | |
"dpns-contract", | |
"dashpay-contract", | |
"wallet-utils-contract", | |
"token-history-contract", | |
"keywords-contract" | |
] | |
# Individual contract features - these enable specific contracts in DPP | |
withdrawals-contract = ["dpp/withdrawals-contract"] | |
dpns-contract = ["dpp/dpns-contract"] | |
dashpay-contract = ["dpp/dashpay-contract"] | |
wallet-utils-contract = ["dpp/wallet-utils-contract"] | |
token-history-contract = ["dpp/token-history-contract"] | |
keywords-contract = ["dpp/keywords-contract"] | |
[features] | |
default = [] | |
# All system contracts (includes all individual contracts) | |
all-system-contracts = [ | |
"dpp/all-system-contracts", | |
"withdrawals-contract", | |
"dpns-contract", | |
"dashpay-contract", | |
"wallet-utils-contract", | |
"token-history-contract", | |
"keywords-contract" | |
] |
🤖 Prompt for AI Agents
In packages/rs-sdk-trusted-context-provider/Cargo.toml between lines 25 and 46,
the feature name "dpp/all-system_contracts" uses an underscore instead of a
dash, which is inconsistent with other feature names and will cause cargo
resolution to fail. Check the exact feature name spelling in rs-dpp/Cargo.toml
and replace "dpp/all-system_contracts" with the correctly spelled feature name
using dashes, likely "dpp/all-system-contracts", to ensure consistent and
successful feature resolution.
SystemDataContract::WalletUtils => [ | ||
92, 20, 14, 101, 92, 2, 101, 187, 194, 168, 8, 113, 109, 225, 132, 121, 133, 19, | ||
89, 24, 173, 81, 205, 253, 11, 118, 102, 75, 169, 91, 163, 124, | ||
], |
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.
Critical: Duplicate contract ID bytes detected.
WalletUtils and KeywordSearch have identical hardcoded ID bytes, which would cause conflicts. Each contract must have a unique identifier.
The KeywordSearch contract needs its own unique ID bytes. Please update one of these to use the correct values.
Also applies to: 117-120
🤖 Prompt for AI Agents
In packages/data-contracts/src/lib.rs around lines 101 to 104 and 117 to 120,
the hardcoded ID bytes for WalletUtils and KeywordSearch contracts are
duplicated, causing conflicts. Update the ID bytes for the KeywordSearch
contract to a unique set of values that do not overlap with WalletUtils or any
other contract IDs. Ensure each contract has a distinct identifier to avoid
conflicts.
get_documents, | ||
get_document, | ||
get_dpns_username, | ||
get_dpns_usernames, | ||
// Protocol/Version queries |
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.
Remove obsolete get_dpns_username
import – it will break the runtime if the symbol has been dropped from the WASM exports
The function was renamed to get_dpns_usernames
, yet the old symbol is still imported.
If the Rust/WASM side no longer exports get_dpns_username
, the page will fail to initialise with ReferenceError: import object field 'get_dpns_username' is not a Function
.
get_document,
- get_dpns_username,
get_dpns_usernames,
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
get_documents, | |
get_document, | |
get_dpns_username, | |
get_dpns_usernames, | |
// Protocol/Version queries | |
get_documents, | |
get_document, | |
get_dpns_usernames, | |
// Protocol/Version queries |
🤖 Prompt for AI Agents
In packages/wasm-sdk/index.html around lines 834 to 838, remove the obsolete
import of `get_dpns_username` since it has been renamed to `get_dpns_usernames`
and is no longer exported by the WASM module. Keeping the old import causes a
runtime ReferenceError. Ensure only the current valid exports like
`get_dpns_usernames` are imported to prevent initialization failures.
// For now, we'll prompt the user to specify the key ID since we can't easily derive | ||
// the public key from WIF in JavaScript without additional crypto libraries | ||
|
||
// Check if the private key has a key ID suffix (format: privateKey:keyId) | ||
let keyId = null; | ||
let actualPrivateKey = privateKey; | ||
|
||
if (privateKey.includes(':')) { | ||
const parts = privateKey.split(':'); | ||
actualPrivateKey = parts[0]; | ||
keyId = parseInt(parts[1]); | ||
|
||
// Verify the key exists and has the right security level | ||
const publicKey = identityJSON.publicKeys.find(key => key.id === keyId); | ||
if (!publicKey) { | ||
throw new Error(`Key ID ${keyId} not found in identity`); | ||
} | ||
if (publicKey.disabledAt) { | ||
throw new Error(`Key ID ${keyId} is disabled`); | ||
} | ||
// Check security level - MASTER=0, CRITICAL=1, HIGH=2 | ||
console.log(`Key ${keyId} has security level: ${publicKey.securityLevel}`); | ||
if (publicKey.securityLevel === 0) { | ||
throw new Error(`Key ID ${keyId} has MASTER security level. DPNS requires CRITICAL (1) or HIGH (2) security level.`); | ||
} | ||
} else { | ||
// If no key ID provided, try to find the first suitable key | ||
const suitableKey = identityJSON.publicKeys.find(key => | ||
!key.disabledAt && key.securityLevel !== 0 // Not MASTER | ||
); | ||
|
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.
🛠️ Refactor suggestion
keyId
extraction is fragile – validate and guard against NaN
parseInt(parts[1])
may yield NaN
(e.g. empty suffix or non-numeric text).
A NaN
key id will later compare unequal to every integer and silently skip the “key exists” test, resulting in a misleading Key ID … not found error.
- keyId = parseInt(parts[1]);
+ keyId = Number(parts[1]);
+ if (!Number.isInteger(keyId) || keyId < 0) {
+ throw new Error(`Invalid keyId suffix “${parts[1]}” – expected a non-negative integer`);
+ }
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
// For now, we'll prompt the user to specify the key ID since we can't easily derive | |
// the public key from WIF in JavaScript without additional crypto libraries | |
// Check if the private key has a key ID suffix (format: privateKey:keyId) | |
let keyId = null; | |
let actualPrivateKey = privateKey; | |
if (privateKey.includes(':')) { | |
const parts = privateKey.split(':'); | |
actualPrivateKey = parts[0]; | |
keyId = parseInt(parts[1]); | |
// Verify the key exists and has the right security level | |
const publicKey = identityJSON.publicKeys.find(key => key.id === keyId); | |
if (!publicKey) { | |
throw new Error(`Key ID ${keyId} not found in identity`); | |
} | |
if (publicKey.disabledAt) { | |
throw new Error(`Key ID ${keyId} is disabled`); | |
} | |
// Check security level - MASTER=0, CRITICAL=1, HIGH=2 | |
console.log(`Key ${keyId} has security level: ${publicKey.securityLevel}`); | |
if (publicKey.securityLevel === 0) { | |
throw new Error(`Key ID ${keyId} has MASTER security level. DPNS requires CRITICAL (1) or HIGH (2) security level.`); | |
} | |
} else { | |
// If no key ID provided, try to find the first suitable key | |
const suitableKey = identityJSON.publicKeys.find(key => | |
!key.disabledAt && key.securityLevel !== 0 // Not MASTER | |
); | |
// Check if the private key has a key ID suffix (format: privateKey:keyId) | |
let keyId = null; | |
let actualPrivateKey = privateKey; | |
if (privateKey.includes(':')) { | |
const parts = privateKey.split(':'); | |
actualPrivateKey = parts[0]; | |
keyId = Number(parts[1]); | |
if (!Number.isInteger(keyId) || keyId < 0) { | |
throw new Error(`Invalid keyId suffix "${parts[1]}" – expected a non-negative integer`); | |
} | |
// Verify the key exists and has the right security level | |
const publicKey = identityJSON.publicKeys.find(key => key.id === keyId); | |
if (!publicKey) { | |
throw new Error(`Key ID ${keyId} not found in identity`); | |
} | |
if (publicKey.disabledAt) { | |
throw new Error(`Key ID ${keyId} is disabled`); | |
} | |
// Check security level - MASTER=0, CRITICAL=1, HIGH=2 | |
console.log(`Key ${keyId} has security level: ${publicKey.securityLevel}`); | |
if (publicKey.securityLevel === 0) { | |
throw new Error(`Key ID ${keyId} has MASTER security level. DPNS requires CRITICAL (1) or HIGH (2) security level.`); | |
} | |
} else { | |
// If no key ID provided, try to find the first suitable key | |
const suitableKey = identityJSON.publicKeys.find(key => | |
!key.disabledAt && key.securityLevel !== 0 // Not MASTER | |
); |
🤖 Prompt for AI Agents
In packages/wasm-sdk/index.html around lines 3490 to 3520, the keyId extraction
using parseInt(parts[1]) can produce NaN if the suffix is empty or non-numeric,
causing misleading errors later. Fix this by validating the parsed keyId after
parseInt; if it is NaN, throw an explicit error indicating the key ID is invalid
before proceeding with further checks.
pub async fn register_dpns_name<S: Signer>( | ||
&self, | ||
input: RegisterDpnsNameInput<S>, | ||
) -> Result<RegisterDpnsNameResult, Error> { | ||
// Fetch the DPNS contract | ||
const DPNS_CONTRACT_ID: &str = "GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec"; | ||
let dpns_contract_id = Identifier::from_string( | ||
DPNS_CONTRACT_ID, | ||
dpp::platform_value::string_encoding::Encoding::Base58, | ||
) | ||
.map_err(|e| Error::DapiClientError(format!("Invalid DPNS contract ID: {}", e)))?; | ||
|
||
let dpns_contract = crate::platform::DataContract::fetch(self, dpns_contract_id) | ||
.await? | ||
.ok_or_else(|| Error::DapiClientError("DPNS contract not found".to_string()))?; | ||
|
||
// Get document types | ||
let preorder_document_type = | ||
dpns_contract | ||
.document_type_for_name("preorder") | ||
.map_err(|_| { | ||
Error::DapiClientError("DPNS preorder document type not found".to_string()) | ||
})?; | ||
|
||
let domain_document_type = | ||
dpns_contract | ||
.document_type_for_name("domain") | ||
.map_err(|_| { | ||
Error::DapiClientError("DPNS domain document type not found".to_string()) | ||
})?; | ||
|
||
// Generate entropy and salt | ||
let mut rng = StdRng::from_entropy(); | ||
let entropy = Bytes32::random_with_rng(&mut rng); | ||
let salt: [u8; 32] = rng.gen(); | ||
|
||
// Generate document IDs | ||
let identity_id = input.identity.id().to_owned(); | ||
let preorder_id = Document::generate_document_id_v0( | ||
&dpns_contract.id(), | ||
&identity_id, | ||
preorder_document_type.name(), | ||
entropy.as_slice(), | ||
); | ||
let domain_id = Document::generate_document_id_v0( | ||
&dpns_contract.id(), | ||
&identity_id, | ||
domain_document_type.name(), | ||
entropy.as_slice(), | ||
); | ||
|
||
// Create salted domain hash for preorder | ||
let normalized_label = convert_to_homograph_safe_chars(&input.label); | ||
let mut salted_domain_buffer: Vec<u8> = vec![]; | ||
salted_domain_buffer.extend(salt); | ||
salted_domain_buffer.extend((normalized_label.clone() + ".dash").as_bytes()); | ||
let salted_domain_hash = hash_double(salted_domain_buffer); | ||
|
||
// Create preorder document | ||
let preorder_document = Document::V0(DocumentV0 { | ||
id: preorder_id, | ||
owner_id: identity_id, | ||
properties: BTreeMap::from([( | ||
"saltedDomainHash".to_string(), | ||
Value::Bytes32(salted_domain_hash), | ||
)]), | ||
revision: None, | ||
created_at: None, | ||
updated_at: None, | ||
transferred_at: None, | ||
created_at_block_height: None, | ||
updated_at_block_height: None, | ||
transferred_at_block_height: None, | ||
created_at_core_block_height: None, | ||
updated_at_core_block_height: None, | ||
transferred_at_core_block_height: None, | ||
}); | ||
|
||
// Create domain document | ||
let domain_document = Document::V0(DocumentV0 { | ||
id: domain_id, | ||
owner_id: identity_id, | ||
properties: BTreeMap::from([ | ||
( | ||
"parentDomainName".to_string(), | ||
Value::Text("dash".to_string()), | ||
), | ||
( | ||
"normalizedParentDomainName".to_string(), | ||
Value::Text("dash".to_string()), | ||
), | ||
("label".to_string(), Value::Text(input.label.clone())), | ||
( | ||
"normalizedLabel".to_string(), | ||
Value::Text(normalized_label.clone()), | ||
), | ||
("preorderSalt".to_string(), Value::Bytes32(salt)), | ||
( | ||
"records".to_string(), | ||
Value::Map(vec![( | ||
Value::Text("identity".to_string()), | ||
Value::Identifier(identity_id.to_buffer()), | ||
)]), | ||
), | ||
( | ||
"subdomainRules".to_string(), | ||
Value::Map(vec![( | ||
Value::Text("allowSubdomains".to_string()), | ||
Value::Bool(false), | ||
)]), | ||
), | ||
]), | ||
revision: None, | ||
created_at: None, | ||
updated_at: None, | ||
transferred_at: None, | ||
created_at_block_height: None, | ||
updated_at_block_height: None, | ||
transferred_at_block_height: None, | ||
created_at_core_block_height: None, | ||
updated_at_core_block_height: None, | ||
transferred_at_core_block_height: None, | ||
}); | ||
|
||
// Submit preorder document first | ||
preorder_document | ||
.put_to_platform_and_wait_for_response( | ||
self, | ||
preorder_document_type.to_owned_document_type(), | ||
Some(entropy.0), | ||
input.identity_public_key.clone(), | ||
None, // token payment info | ||
&input.signer, | ||
None, // settings | ||
) | ||
.await?; | ||
|
||
// Submit domain document after preorder | ||
domain_document | ||
.put_to_platform_and_wait_for_response( | ||
self, | ||
domain_document_type.to_owned_document_type(), | ||
Some(entropy.0), | ||
input.identity_public_key, | ||
None, // token payment info | ||
&input.signer, | ||
None, // settings | ||
) | ||
.await?; | ||
|
||
Ok(RegisterDpnsNameResult { | ||
preorder_document, | ||
domain_document, | ||
full_domain_name: format!("{}.dash", normalized_label), | ||
}) | ||
} |
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.
🛠️ Refactor suggestion
Extract DPNS contract ID as a constant and add label validation.
The DPNS contract ID appears multiple times in this file. Additionally, the input label should be validated before attempting registration.
Add at the module level (after imports):
/// DPNS contract ID - same across all networks
const DPNS_CONTRACT_ID: &str = "GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec";
Then add label validation at the beginning of the method:
pub async fn register_dpns_name<S: Signer>(
&self,
input: RegisterDpnsNameInput<S>,
) -> Result<RegisterDpnsNameResult, Error> {
+ // Validate the label before proceeding
+ if !is_valid_username(&input.label) {
+ return Err(Error::DapiClientError(format!(
+ "Invalid username: '{}'",
+ input.label
+ )));
+ }
+
// Fetch the DPNS contract
- const DPNS_CONTRACT_ID: &str = "GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec";
let dpns_contract_id = Identifier::from_string(
DPNS_CONTRACT_ID,
dpp::platform_value::string_encoding::Encoding::Base58,
)
.map_err(|e| Error::DapiClientError(format!("Invalid DPNS contract ID: {}", e)))?;
🤖 Prompt for AI Agents
In packages/rs-sdk/src/platform/dpns_usernames.rs between lines 162 and 317,
extract the DPNS contract ID string into a module-level constant placed after
the imports to avoid repetition. Then, at the start of the register_dpns_name
function, add validation logic for the input label to ensure it meets required
criteria before proceeding with registration. This involves defining the
constant DPNS_CONTRACT_ID once and inserting label validation code at the
method's beginning.
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: 2
♻️ Duplicate comments (1)
packages/rs-sdk/src/platform/dpns_usernames.rs (1)
164-167
: Add input validation to prevent invalid registrations.The method doesn't validate the input label before proceeding, which could result in creating invalid documents that fail on the platform. This is a critical issue that could waste user resources.
Add validation at the beginning of the method:
pub async fn register_dpns_name<S: Signer>( &self, input: RegisterDpnsNameInput<S>, ) -> Result<RegisterDpnsNameResult, Error> { + // Validate the label before proceeding + if !is_valid_username(&input.label) { + return Err(Error::DapiClientError(format!( + "Invalid username: '{}'", + input.label + ))); + } + // Get DPNS contract ID from system contract if available
🧹 Nitpick comments (1)
packages/rs-sdk/src/platform/dpns_usernames.rs (1)
218-221
: Consider using a cryptographically secure entropy source.While
StdRng::from_entropy()
is generally good, for production DPNS registrations involving financial transactions, consider using a more explicit cryptographically secure random number generator.- let mut rng = StdRng::from_entropy(); + use dpp::dashcore::secp256k1::rand::rngs::OsRng; + let mut rng = OsRng;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/rs-sdk/src/platform/dpns_usernames.rs
(1 hunks)packages/wasm-sdk/src/queries/document.rs
(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/wasm-sdk/src/queries/document.rs
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.rs`: Rust code should be formatted using `cargo fmt --all` Rust code shoul...
**/*.rs
: Rust code should be formatted usingcargo fmt --all
Rust code should be linted usingcargo clippy --workspace
Check Rust code usingcargo check --workspace
Run Rust tests usingcargo test
📄 Source: CodeRabbit Inference Engine (CLAUDE.md)
List of files the instruction was applied to:
packages/rs-sdk/src/platform/dpns_usernames.rs
🧠 Learnings (2)
📓 Common learnings
Learnt from: QuantumExplorer
PR: dashpay/platform#2690
File: packages/wasm-sdk/src/queries/document.rs:383-384
Timestamp: 2025-07-10T00:37:09.565Z
Learning: In the Dash platform, DPNS (Dash Platform Name Service) contracts have the same ID across all networks (mainnet, testnet, etc.), so hardcoding the DPNS contract ID is appropriate and doesn't need to be configurable.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
Learnt from: shumkov
PR: dashpay/platform#2270
File: packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js:69-125
Timestamp: 2024-10-24T05:07:35.892Z
Learning: Future development plans involve rewriting DAPI into Rust, as the rest of the project has already migrated.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts is already handled in the data contract validation process, specifically in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs.
Learnt from: shumkov
PR: dashpay/platform#2489
File: packages/rs-dpp/Cargo.toml:32-32
Timestamp: 2025-03-11T09:39:23.071Z
Learning: In the Dash Platform project, dependencies are currently managed using Git repository references with tags (repo+tag format in Cargo.toml) rather than published crates, as the team is not currently publishing crates to crates.io.
Learnt from: shumkov
PR: dashpay/platform#2206
File: packages/rs-platform-version/src/version/protocol_version.rs:155-157
Timestamp: 2024-10-04T09:08:48.470Z
Learning: In the dashmate default configurations, the default protocol version for local networks has been removed, and an update mechanism for the protocol version in the consensus parameters has been implemented.
Learnt from: shumkov
PR: dashpay/platform#2206
File: packages/rs-platform-version/src/version/protocol_version.rs:155-157
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the dashmate default configurations, the default protocol version for local networks has been removed, and an update mechanism for the protocol version in the consensus parameters has been implemented.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts (ensuring it's between 3 and 100 characters) is already handled at the data contract validation level in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs, making additional checks in the update operations redundant.
Learnt from: lklimek
PR: dashpay/platform#2254
File: packages/rs-sdk/src/sdk.rs:585-585
Timestamp: 2024-10-18T15:39:51.172Z
Learning: The 'platform' project uses Rust version 1.80, so code in 'packages/rs-sdk' can use features available in Rust 1.80, such as the `abs_diff()` method.
Learnt from: QuantumExplorer
PR: dashpay/platform#2644
File: packages/rs-drive/src/cache/system_contracts.rs:18-19
Timestamp: 2025-05-28T16:22:26.334Z
Learning: In packages/rs-drive/src/cache/system_contracts.rs, the `active_since_protocol_version` field in `ActiveSystemDataContract` struct is intentionally added for future use, not current implementation. QuantumExplorer confirmed this is "meant for later" when questioned about the `#[allow(unused)]` attribute.
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/src/mimic/test_quorum.rs:159-164
Timestamp: 2024-11-20T16:16:01.830Z
Learning: QuantumExplorer prefers not to receive auto-generated messages asking to post on social media.
Learnt from: QuantumExplorer
PR: dashpay/platform#2439
File: packages/rs-dpp/src/errors/consensus/state/token/mod.rs:4-22
Timestamp: 2025-01-23T02:10:08.979Z
Learning: The user QuantumExplorer prefers to handle documentation of breaking changes separately from the code changes, particularly for token-related error types and validation rules.
Learnt from: QuantumExplorer
PR: dashpay/platform#2673
File: packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs:1164-1197
Timestamp: 2025-06-18T03:44:14.385Z
Learning: QuantumExplorer determined that a CodeRabbit suggestion about fixing signable_bytes calculation in identity update tests with contract-bound keys was incorrect - the code flow is working as intended without the suggested changes.
packages/rs-sdk/src/platform/dpns_usernames.rs (20)
Learnt from: QuantumExplorer
PR: dashpay/platform#2690
File: packages/wasm-sdk/src/queries/document.rs:383-384
Timestamp: 2025-07-10T00:37:09.565Z
Learning: In the Dash platform, DPNS (Dash Platform Name Service) contracts have the same ID across all networks (mainnet, testnet, etc.), so hardcoding the DPNS contract ID is appropriate and doesn't need to be configurable.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/tests/fetch/config.rs:233-233
Timestamp: 2024-10-30T11:19:59.163Z
Learning: In the Rust SDK's `rs-sdk/tests` integration tests (e.g., in `packages/rs-sdk/tests/fetch/config.rs`), we cannot create objects during tests because there is no support for object creation in this context. Therefore, hardcoded values for test identities must be used.
Learnt from: lklimek
PR: dashpay/platform#2254
File: packages/rs-sdk/src/sdk.rs:585-585
Timestamp: 2024-10-18T15:39:51.172Z
Learning: The 'platform' project uses Rust version 1.80, so code in 'packages/rs-sdk' can use features available in Rust 1.80, such as the `abs_diff()` method.
Learnt from: lklimek
PR: dashpay/platform#2232
File: packages/rs-sdk/src/mock/sdk.rs:90-95
Timestamp: 2024-10-10T10:30:19.883Z
Learning: In `packages/rs-sdk/src/mock/sdk.rs`, the `load_expectations` method in `MockDashPlatformSdk` remains asynchronous (`async`) for backward compatibility, even though it now delegates to the synchronous `load_expectations_sync` method.
Learnt from: QuantumExplorer
PR: dashpay/platform#2215
File: packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs:19-30
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the Rust file `packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs`, within the `create_owner_identity_v1` function, the `add_public_keys` method of the `Identity` struct cannot fail and does not require explicit error handling.
Learnt from: QuantumExplorer
PR: dashpay/platform#2215
File: packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs:19-30
Timestamp: 2024-10-06T16:11:34.946Z
Learning: In the Rust file `packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs`, within the `create_owner_identity_v1` function, the `add_public_keys` method of the `Identity` struct cannot fail and does not require explicit error handling.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts (ensuring it's between 3 and 100 characters) is already handled at the data contract validation level in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs, making additional checks in the update operations redundant.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts is already handled in the data contract validation process, specifically in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs.
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/src/platform_types/platform_state/v0/old_structures/mod.rs:94-94
Timestamp: 2024-11-20T10:01:50.837Z
Learning: In `packages/rs-drive-abci/src/platform_types/platform_state/v0/old_structures/mod.rs`, when converting with `PublicKey::try_from`, it's acceptable to use `.expect()` to handle potential conversion errors.
Learnt from: shumkov
PR: dashpay/platform#2317
File: packages/rs-dapi-client/src/address_list.rs:175-180
Timestamp: 2024-11-28T13:49:17.301Z
Learning: In Rust code in `packages/rs-dapi-client/src/address_list.rs`, do not change the interface of deprecated methods like `add_uri`, even to fix potential panics.
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/tests/strategy_tests/masternodes.rs:212-220
Timestamp: 2024-11-20T20:43:41.185Z
Learning: In `packages/rs-drive-abci/tests/strategy_tests/masternodes.rs`, the pattern of generating a `PrivateKey`, converting it to bytes, and reconstructing a `BlsPrivateKey` from those bytes is intentional. Avoid suggesting to simplify this code in future reviews.
Learnt from: shumkov
PR: dashpay/platform#2259
File: packages/rs-dapi-client/src/dapi_client.rs:137-139
Timestamp: 2024-10-22T10:53:12.111Z
Learning: In `packages/rs-dapi-client/src/dapi_client.rs`, when passing data into asynchronous code, ensure that data structures are `Send + Sync`. Using `Arc<AtomicUsize>` is necessary for the retry counter.
Learnt from: shumkov
PR: dashpay/platform#2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the `IdentityTransitionVersions` structure within `packages/rs-platform-version/src/version/v2.rs`, the field `credit_withdrawal` does not need the `identity_` prefix since it is already encompassed within identity state transitions.
Learnt from: shumkov
PR: dashpay/platform#2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-03T11:51:06.980Z
Learning: In the `IdentityTransitionVersions` structure within `packages/rs-platform-version/src/version/v2.rs`, the field `credit_withdrawal` does not need the `identity_` prefix since it is already encompassed within identity state transitions.
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs:148-151
Timestamp: 2024-11-20T16:05:40.200Z
Learning: In `packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs`, when converting public keys from `QuorumForSavingV0` to `VerificationQuorum`, it's acceptable to use `.expect()` for public key conversion, as the conversion has been verified and panics are acceptable in this context.
Learnt from: QuantumExplorer
PR: dashpay/platform#2673
File: packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs:1164-1197
Timestamp: 2025-06-18T03:44:14.385Z
Learning: QuantumExplorer determined that a CodeRabbit suggestion about fixing signable_bytes calculation in identity update tests with contract-bound keys was incorrect - the code flow is working as intended without the suggested changes.
Learnt from: shumkov
PR: dashpay/platform#2345
File: packages/wallet-utils-contract/src/lib.rs:14-17
Timestamp: 2024-11-25T07:48:09.831Z
Learning: In the `wallet-utils-contract` (file `packages/wallet-utils-contract/src/lib.rs`), the `OWNER_ID_BYTES` constant is intentionally initialized to all zeros.
Learnt from: shumkov
PR: dashpay/platform#2182
File: packages/rs-platform-version/src/version/drive_abci_versions.rs:116-121
Timestamp: 2024-09-29T13:13:54.230Z
Learning: In the `DriveAbciWithdrawalConstants` struct, prefer verbose field names even if they are lengthy.
Learnt from: shumkov
PR: dashpay/platform#2182
File: packages/rs-platform-version/src/version/drive_abci_versions.rs:116-121
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the `DriveAbciWithdrawalConstants` struct, prefer verbose field names even if they are lengthy.
Learnt from: shumkov
PR: dashpay/platform#2305
File: packages/rs-drive-abci/src/abci/handler/finalize_block.rs:81-0
Timestamp: 2024-11-03T10:39:11.242Z
Learning: In `packages/rs-drive-abci/src/abci/handler/finalize_block.rs`, the use of `.expect("commit transaction")` after `app.commit_transaction(platform_version)` is intentional due to the provided comment explaining its necessity. Do not flag this usage in future reviews.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
- GitHub Check: Rust packages (drive) / Unused dependencies
- GitHub Check: Rust packages (drive) / Linting
- GitHub Check: Rust packages (wasm-dpp) / Formatting
- GitHub Check: Rust packages (wasm-dpp) / Tests
- GitHub Check: Rust packages (wasm-dpp) / Linting
- GitHub Check: Rust packages (dpp) / Tests
- GitHub Check: Rust packages (dpp) / Linting
- GitHub Check: Build Docker images (Drive, drive, drive-abci) / Build Drive image
- GitHub Check: Build JS packages / Build JS
- GitHub Check: build-wasm-sdk
🔇 Additional comments (5)
packages/rs-sdk/src/platform/dpns_usernames.rs (5)
18-30
: LGTM: Well-implemented homograph attack prevention.The character mapping logic is correct for preventing homograph attacks in usernames. The conversion to lowercase and specific character replacements ('o'→'0', 'i'/'l'→'1') follow security best practices.
49-82
: LGTM: Comprehensive username validation implementation.The validation logic correctly implements DPNS username rules with proper length checks, character validation, and consecutive hyphen detection. The implementation is robust and handles all edge cases appropriately.
97-109
: LGTM: Correct contest detection logic.The implementation properly normalizes the input first, then applies the contest criteria (3-19 characters, only [a-z01-] allowed). The logic aligns with DPNS contest requirements.
476-490
: LGTM: Improved label extraction logic.The label extraction logic correctly handles both "alice" and "alice.dash" formats with proper validation. This addresses the concerns from previous reviews about robust name parsing.
545-637
: LGTM: Comprehensive test coverage.The test suite provides excellent coverage for all utility functions with various edge cases and invalid inputs. The tests are well-structured and validate the expected behavior thoroughly.
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
♻️ Duplicate comments (8)
packages/rs-sdk/src/platform/dpns_usernames.rs (6)
164-183
: Address the duplication issue identified in past reviews.The DPNS contract ID resolution logic is duplicated across all three methods (
register_dpns_name
,is_dpns_name_available
,resolve_dpns_name
). This was previously flagged and should be extracted into a helper method.Add this helper method to the
impl Sdk
block:+ /// Get DPNS contract ID from system contract if available, otherwise use hardcoded value + fn get_dpns_contract_id(&self) -> Result<Identifier, Error> { + #[cfg(feature = "dpns-contract")] + let dpns_contract_id = { + use dpp::system_data_contracts::SystemDataContract; + SystemDataContract::DPNS.id() + }; + + #[cfg(not(feature = "dpns-contract"))] + let dpns_contract_id = { + const DPNS_CONTRACT_ID: &str = "GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec"; + Identifier::from_string( + DPNS_CONTRACT_ID, + dpp::platform_value::string_encoding::Encoding::Base58, + ) + .map_err(|e| Error::DapiClientError(format!("Invalid DPNS contract ID: {}", e)))? + }; + + Ok(dpns_contract_id) + }Then replace the existing logic with:
let dpns_contract_id = self.get_dpns_contract_id()?;
185-201
: Extract contract fetching logic into a helper method.The contract fetching logic (checking context provider first, then platform) is duplicated across all three methods and should be extracted into a reusable helper.
Add this helper method:
+ /// Get DPNS contract from context provider or fetch from platform + async fn get_dpns_contract(&self, contract_id: Identifier) -> Result<Arc<dpp::data_contract::DataContract>, Error> { + let context_provider = self.context_provider() + .ok_or_else(|| Error::DapiClientError("Context provider not set".to_string()))?; + + match context_provider.get_data_contract(&contract_id, self.version())? { + Some(contract) => Ok(contract), + None => { + // If not in context, fetch from platform + let contract = crate::platform::DataContract::fetch(self, contract_id) + .await? + .ok_or_else(|| Error::DapiClientError("DPNS contract not found".to_string()))?; + Ok(Arc::new(contract)) + } + } + }Then replace the duplicated logic with:
let dpns_contract = self.get_dpns_contract(dpns_contract_id).await?;
363-378
: Use the helper method for contract ID resolution.This method should use the helper method suggested in the previous comment to eliminate duplication.
Replace the duplicated DPNS contract ID resolution logic with:
- // Get DPNS contract ID from system contract if available - #[cfg(feature = "dpns-contract")] - let dpns_contract_id = { - use dpp::system_data_contracts::SystemDataContract; - SystemDataContract::DPNS.id() - }; - - #[cfg(not(feature = "dpns-contract"))] - let dpns_contract_id = { - const DPNS_CONTRACT_ID: &str = "GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec"; - Identifier::from_string( - DPNS_CONTRACT_ID, - dpp::platform_value::string_encoding::Encoding::Base58, - ) - .map_err(|e| Error::DapiClientError(format!("Invalid DPNS contract ID: {}", e)))? - }; + let dpns_contract_id = self.get_dpns_contract_id()?;
380-396
: Use the helper method for contract fetching.This method should use the helper method suggested in the previous comment to eliminate duplication.
Replace the duplicated contract fetching logic with:
- // First check if the contract is available in the context provider - let context_provider = self - .context_provider() - .ok_or_else(|| Error::DapiClientError("Context provider not set".to_string()))?; - - let dpns_contract = match context_provider - .get_data_contract(&dpns_contract_id, self.version())? - { - Some(contract) => contract, - None => { - // If not in context, fetch from platform - let contract = crate::platform::DataContract::fetch(self, dpns_contract_id) - .await? - .ok_or_else(|| Error::DapiClientError("DPNS contract not found".to_string()))?; - Arc::new(contract) - } - }; + let dpns_contract = self.get_dpns_contract(dpns_contract_id).await?;
441-456
: Use the helper method for contract ID resolution.This method should also use the helper method to eliminate duplication.
Replace the duplicated DPNS contract ID resolution logic with:
- // Get DPNS contract ID from system contract if available - #[cfg(feature = "dpns-contract")] - let dpns_contract_id = { - use dpp::system_data_contracts::SystemDataContract; - SystemDataContract::DPNS.id() - }; - - #[cfg(not(feature = "dpns-contract"))] - let dpns_contract_id = { - const DPNS_CONTRACT_ID: &str = "GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec"; - Identifier::from_string( - DPNS_CONTRACT_ID, - dpp::platform_value::string_encoding::Encoding::Base58, - ) - .map_err(|e| Error::DapiClientError(format!("Invalid DPNS contract ID: {}", e)))? - }; + let dpns_contract_id = self.get_dpns_contract_id()?;
458-474
: Use the helper method for contract fetching.This method should also use the helper method to eliminate duplication.
Replace the duplicated contract fetching logic with:
- // First check if the contract is available in the context provider - let context_provider = self - .context_provider() - .ok_or_else(|| Error::DapiClientError("Context provider not set".to_string()))?; - - let dpns_contract = match context_provider - .get_data_contract(&dpns_contract_id, self.version())? - { - Some(contract) => contract, - None => { - // If not in context, fetch from platform - let contract = crate::platform::DataContract::fetch(self, dpns_contract_id) - .await? - .ok_or_else(|| Error::DapiClientError("DPNS contract not found".to_string()))?; - Arc::new(contract) - } - }; + let dpns_contract = self.get_dpns_contract(dpns_contract_id).await?;packages/wasm-sdk/index.html (2)
834-838
: Obsoleteget_dpns_username
import is still present – will break on Init
The WASM module export was renamed toget_dpns_usernames
; keeping the old symbol in the import list will raiseReferenceError: import object field 'get_dpns_username' is not a Function
at start-up.
Remove the obsolete entry.
3495-3504
:parseInt
without validation can propagateNaN
as a key id
keyId = parseInt(parts[1]);
may yieldNaN
for empty / non-numeric suffixes.
Subsequent look-ups (publicKeys.find(key => key.id === keyId)
) will silently fail and throw misleading “Key ID … not found” errors.keyId = parseInt(parts[1]); -if (!Number.isInteger(keyId) || keyId < 0) { - throw new Error(`Invalid keyId suffix “${parts[1]}” – expected a non-negative integer`); -} +keyId = Number(parts[1]); +if (!Number.isInteger(keyId) || keyId < 0) { + throw new Error(`Invalid keyId suffix “${parts[1]}” – expected a non-negative integer`); +}
🧹 Nitpick comments (1)
packages/wasm-sdk/index.html (1)
2537-2581
: Debounce per-keystroke DPNS validation to avoid UI stalls
input.addEventListener('input', …)
fires on every keystroke; each time you synchronously call three WASM functions.
For fast typists this can trigger dozens of WASM calls per second and noticeably block the main thread.Recommend wrapping the body of the handler in a 150-200 ms debounce.
-let lastTimer; -input.addEventListener('input', (e) => { - clearTimeout(lastTimer); - lastTimer = setTimeout(() => validateUsername(e.target.value), 180); -}); +const validateUsername = (value) => { /* existing body */ }; + +let debounceId; +input.addEventListener('input', (e) => { + clearTimeout(debounceId); + debounceId = setTimeout(() => validateUsername(e.target.value), 180); +});
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
packages/rs-sdk/src/platform/dpns_usernames.rs
(1 hunks)packages/wasm-sdk/index.html
(11 hunks)packages/wasm-sdk/src/dpns.rs
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/wasm-sdk/src/dpns.rs
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.rs`: Rust code should be formatted using `cargo fmt --all` Rust code shoul...
**/*.rs
: Rust code should be formatted usingcargo fmt --all
Rust code should be linted usingcargo clippy --workspace
Check Rust code usingcargo check --workspace
Run Rust tests usingcargo test
📄 Source: CodeRabbit Inference Engine (CLAUDE.md)
List of files the instruction was applied to:
packages/rs-sdk/src/platform/dpns_usernames.rs
🧠 Learnings (3)
📓 Common learnings
Learnt from: QuantumExplorer
PR: dashpay/platform#2690
File: packages/wasm-sdk/src/queries/document.rs:383-384
Timestamp: 2025-07-10T00:37:09.565Z
Learning: In the Dash platform, DPNS (Dash Platform Name Service) contracts have the same ID across all networks (mainnet, testnet, etc.), so hardcoding the DPNS contract ID is appropriate and doesn't need to be configurable.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
Learnt from: shumkov
PR: dashpay/platform#2270
File: packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js:69-125
Timestamp: 2024-10-24T05:07:35.892Z
Learning: Future development plans involve rewriting DAPI into Rust, as the rest of the project has already migrated.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts is already handled in the data contract validation process, specifically in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs.
Learnt from: shumkov
PR: dashpay/platform#2489
File: packages/rs-dpp/Cargo.toml:32-32
Timestamp: 2025-03-11T09:39:23.071Z
Learning: In the Dash Platform project, dependencies are currently managed using Git repository references with tags (repo+tag format in Cargo.toml) rather than published crates, as the team is not currently publishing crates to crates.io.
Learnt from: shumkov
PR: dashpay/platform#2206
File: packages/rs-platform-version/src/version/protocol_version.rs:155-157
Timestamp: 2024-10-04T09:08:48.470Z
Learning: In the dashmate default configurations, the default protocol version for local networks has been removed, and an update mechanism for the protocol version in the consensus parameters has been implemented.
Learnt from: shumkov
PR: dashpay/platform#2206
File: packages/rs-platform-version/src/version/protocol_version.rs:155-157
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the dashmate default configurations, the default protocol version for local networks has been removed, and an update mechanism for the protocol version in the consensus parameters has been implemented.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts (ensuring it's between 3 and 100 characters) is already handled at the data contract validation level in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs, making additional checks in the update operations redundant.
Learnt from: lklimek
PR: dashpay/platform#2254
File: packages/rs-sdk/src/sdk.rs:585-585
Timestamp: 2024-10-18T15:39:51.172Z
Learning: The 'platform' project uses Rust version 1.80, so code in 'packages/rs-sdk' can use features available in Rust 1.80, such as the `abs_diff()` method.
Learnt from: QuantumExplorer
PR: dashpay/platform#2644
File: packages/rs-drive/src/cache/system_contracts.rs:18-19
Timestamp: 2025-05-28T16:22:26.334Z
Learning: In packages/rs-drive/src/cache/system_contracts.rs, the `active_since_protocol_version` field in `ActiveSystemDataContract` struct is intentionally added for future use, not current implementation. QuantumExplorer confirmed this is "meant for later" when questioned about the `#[allow(unused)]` attribute.
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/src/mimic/test_quorum.rs:159-164
Timestamp: 2024-11-20T16:16:01.830Z
Learning: QuantumExplorer prefers not to receive auto-generated messages asking to post on social media.
Learnt from: QuantumExplorer
PR: dashpay/platform#2439
File: packages/rs-dpp/src/errors/consensus/state/token/mod.rs:4-22
Timestamp: 2025-01-23T02:10:08.979Z
Learning: The user QuantumExplorer prefers to handle documentation of breaking changes separately from the code changes, particularly for token-related error types and validation rules.
Learnt from: QuantumExplorer
PR: dashpay/platform#2673
File: packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs:1164-1197
Timestamp: 2025-06-18T03:44:14.385Z
Learning: QuantumExplorer determined that a CodeRabbit suggestion about fixing signable_bytes calculation in identity update tests with contract-bound keys was incorrect - the code flow is working as intended without the suggested changes.
packages/rs-sdk/src/platform/dpns_usernames.rs (23)
Learnt from: QuantumExplorer
PR: dashpay/platform#2690
File: packages/wasm-sdk/src/queries/document.rs:383-384
Timestamp: 2025-07-10T00:37:09.565Z
Learning: In the Dash platform, DPNS (Dash Platform Name Service) contracts have the same ID across all networks (mainnet, testnet, etc.), so hardcoding the DPNS contract ID is appropriate and doesn't need to be configurable.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/tests/fetch/config.rs:233-233
Timestamp: 2024-10-30T11:19:59.163Z
Learning: In the Rust SDK's `rs-sdk/tests` integration tests (e.g., in `packages/rs-sdk/tests/fetch/config.rs`), we cannot create objects during tests because there is no support for object creation in this context. Therefore, hardcoded values for test identities must be used.
Learnt from: lklimek
PR: dashpay/platform#2254
File: packages/rs-sdk/src/sdk.rs:585-585
Timestamp: 2024-10-18T15:39:51.172Z
Learning: The 'platform' project uses Rust version 1.80, so code in 'packages/rs-sdk' can use features available in Rust 1.80, such as the `abs_diff()` method.
Learnt from: lklimek
PR: dashpay/platform#2232
File: packages/rs-sdk/src/mock/sdk.rs:90-95
Timestamp: 2024-10-10T10:30:19.883Z
Learning: In `packages/rs-sdk/src/mock/sdk.rs`, the `load_expectations` method in `MockDashPlatformSdk` remains asynchronous (`async`) for backward compatibility, even though it now delegates to the synchronous `load_expectations_sync` method.
Learnt from: QuantumExplorer
PR: dashpay/platform#2215
File: packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs:19-30
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the Rust file `packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs`, within the `create_owner_identity_v1` function, the `add_public_keys` method of the `Identity` struct cannot fail and does not require explicit error handling.
Learnt from: QuantumExplorer
PR: dashpay/platform#2215
File: packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs:19-30
Timestamp: 2024-10-06T16:11:34.946Z
Learning: In the Rust file `packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs`, within the `create_owner_identity_v1` function, the `add_public_keys` method of the `Identity` struct cannot fail and does not require explicit error handling.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts (ensuring it's between 3 and 100 characters) is already handled at the data contract validation level in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs, making additional checks in the update operations redundant.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts is already handled in the data contract validation process, specifically in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs.
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/src/platform_types/platform_state/v0/old_structures/mod.rs:94-94
Timestamp: 2024-11-20T10:01:50.837Z
Learning: In `packages/rs-drive-abci/src/platform_types/platform_state/v0/old_structures/mod.rs`, when converting with `PublicKey::try_from`, it's acceptable to use `.expect()` to handle potential conversion errors.
Learnt from: shumkov
PR: dashpay/platform#2317
File: packages/rs-dapi-client/src/address_list.rs:175-180
Timestamp: 2024-11-28T13:49:17.301Z
Learning: In Rust code in `packages/rs-dapi-client/src/address_list.rs`, do not change the interface of deprecated methods like `add_uri`, even to fix potential panics.
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/tests/strategy_tests/masternodes.rs:212-220
Timestamp: 2024-11-20T20:43:41.185Z
Learning: In `packages/rs-drive-abci/tests/strategy_tests/masternodes.rs`, the pattern of generating a `PrivateKey`, converting it to bytes, and reconstructing a `BlsPrivateKey` from those bytes is intentional. Avoid suggesting to simplify this code in future reviews.
Learnt from: shumkov
PR: dashpay/platform#2259
File: packages/rs-dapi-client/src/dapi_client.rs:137-139
Timestamp: 2024-10-22T10:53:12.111Z
Learning: In `packages/rs-dapi-client/src/dapi_client.rs`, when passing data into asynchronous code, ensure that data structures are `Send + Sync`. Using `Arc<AtomicUsize>` is necessary for the retry counter.
Learnt from: shumkov
PR: dashpay/platform#2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the `IdentityTransitionVersions` structure within `packages/rs-platform-version/src/version/v2.rs`, the field `credit_withdrawal` does not need the `identity_` prefix since it is already encompassed within identity state transitions.
Learnt from: shumkov
PR: dashpay/platform#2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-03T11:51:06.980Z
Learning: In the `IdentityTransitionVersions` structure within `packages/rs-platform-version/src/version/v2.rs`, the field `credit_withdrawal` does not need the `identity_` prefix since it is already encompassed within identity state transitions.
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs:148-151
Timestamp: 2024-11-20T16:05:40.200Z
Learning: In `packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs`, when converting public keys from `QuorumForSavingV0` to `VerificationQuorum`, it's acceptable to use `.expect()` for public key conversion, as the conversion has been verified and panics are acceptable in this context.
Learnt from: QuantumExplorer
PR: dashpay/platform#2673
File: packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs:1164-1197
Timestamp: 2025-06-18T03:44:14.385Z
Learning: QuantumExplorer determined that a CodeRabbit suggestion about fixing signable_bytes calculation in identity update tests with contract-bound keys was incorrect - the code flow is working as intended without the suggested changes.
Learnt from: shumkov
PR: dashpay/platform#2345
File: packages/wallet-utils-contract/src/lib.rs:14-17
Timestamp: 2024-11-25T07:48:09.831Z
Learning: In the `wallet-utils-contract` (file `packages/wallet-utils-contract/src/lib.rs`), the `OWNER_ID_BYTES` constant is intentionally initialized to all zeros.
Learnt from: shumkov
PR: dashpay/platform#2305
File: packages/rs-drive-abci/src/abci/handler/finalize_block.rs:81-0
Timestamp: 2024-11-03T10:39:11.242Z
Learning: In `packages/rs-drive-abci/src/abci/handler/finalize_block.rs`, the use of `.expect("commit transaction")` after `app.commit_transaction(platform_version)` is intentional due to the provided comment explaining its necessity. Do not flag this usage in future reviews.
Learnt from: shumkov
PR: dashpay/platform#2182
File: packages/rs-platform-version/src/version/drive_abci_versions.rs:116-121
Timestamp: 2024-09-29T13:13:54.230Z
Learning: In the `DriveAbciWithdrawalConstants` struct, prefer verbose field names even if they are lengthy.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/src/core/transaction.rs:0-0
Timestamp: 2024-10-29T14:40:54.727Z
Learning: In `packages/rs-sdk/src/platform/document_query.rs` and `packages/rs-sdk/src/core/transaction.rs`, certain places don't implement `IntoInner`, so direct error mappings cannot be simplified using `IntoInner`. A TODO comment has been added to address this in a future PR.
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: 2024-11-22T08:19:14.448Z
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.
Learnt from: QuantumExplorer
PR: dashpay/platform#2215
File: packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs:105-105
Timestamp: 2024-10-06T16:17:34.571Z
Learning: In `run_block_proposal` in `packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs`, when retrieving `last_block_time_ms`, it's acceptable to use `platform_state` instead of `block_platform_state`, even after updating the protocol version.
Learnt from: QuantumExplorer
PR: dashpay/platform#2215
File: packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs:105-105
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In `run_block_proposal` in `packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs`, when retrieving `last_block_time_ms`, it's acceptable to use `platform_state` instead of `block_platform_state`, even after updating the protocol version.
packages/wasm-sdk/index.html (15)
undefined
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2690
File: packages/wasm-sdk/src/queries/document.rs:383-384
Timestamp: 2025-07-10T00:37:09.565Z
Learning: In the Dash platform, DPNS (Dash Platform Name Service) contracts have the same ID across all networks (mainnet, testnet, etc.), so hardcoding the DPNS contract ID is appropriate and doesn't need to be configurable.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2317
File: packages/rs-dapi-client/src/address_list.rs:175-180
Timestamp: 2024-11-28T13:49:17.301Z
Learning: In Rust code in packages/rs-dapi-client/src/address_list.rs
, do not change the interface of deprecated methods like add_uri
, even to fix potential panics.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2314
File: packages/wallet-contract/test/bootstrap.js:14-16
Timestamp: 2024-11-06T07:27:01.722Z
Learning: In packages/wallet-contract/test/bootstrap.js
, for Mocha tests in Node.js, async functions like loadWasmDpp
can be assigned directly to beforeAll
without wrapping them in another async function.
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the IdentityTransitionVersions
structure within packages/rs-platform-version/src/version/v2.rs
, the field credit_withdrawal
does not need the identity_
prefix since it is already encompassed within identity state transitions.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-03T11:51:06.980Z
Learning: In the IdentityTransitionVersions
structure within packages/rs-platform-version/src/version/v2.rs
, the field credit_withdrawal
does not need the identity_
prefix since it is already encompassed within identity state transitions.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2277
File: packages/rs-sdk/src/core/transaction.rs:0-0
Timestamp: 2024-10-29T14:40:54.727Z
Learning: In packages/rs-sdk/src/platform/document_query.rs
and packages/rs-sdk/src/core/transaction.rs
, certain places don't implement IntoInner
, so direct error mappings cannot be simplified using IntoInner
. A TODO comment has been added to address this in a future PR.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2673
File: packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs:1164-1197
Timestamp: 2025-06-18T03:44:14.385Z
Learning: QuantumExplorer determined that a CodeRabbit suggestion about fixing signable_bytes calculation in identity update tests with contract-bound keys was incorrect - the code flow is working as intended without the suggested changes.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2365
File: packages/dashmate/src/listr/tasks/ssl/zerossl/obtainZeroSSLCertificateTaskFactory.js:206-213
Timestamp: 2024-12-03T05:47:30.524Z
Learning: In obtainZeroSSLCertificateTaskFactory.js
, when handling ZeroSSL API errors during domain verification, the error detail structure is consistent when an error occurs, so additional null checks on e.details[ctx.externalIp]
may not be necessary.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2257
File: packages/rs-drive-abci/tests/strategy_tests/masternodes.rs:212-220
Timestamp: 2024-11-20T20:43:41.185Z
Learning: In packages/rs-drive-abci/tests/strategy_tests/masternodes.rs
, the pattern of generating a PrivateKey
, converting it to bytes, and reconstructing a BlsPrivateKey
from those bytes is intentional. Avoid suggesting to simplify this code in future reviews.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2381
File: packages/rs-sdk/scripts/connect_to_remote.sh:0-0
Timestamp: 2024-12-10T12:39:38.182Z
Learning: When reviewing scripts in packages/rs-sdk/scripts/
, avoid suggesting additional error handling and timeout management that complicate the script without adding significant value.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2257
File: packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs:148-151
Timestamp: 2024-11-20T16:05:40.200Z
Learning: In packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs
, when converting public keys from QuorumForSavingV0
to VerificationQuorum
, it's acceptable to use .expect()
for public key conversion, as the conversion has been verified and panics are acceptable in this context.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2270
File: packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js:90-96
Timestamp: 2024-10-24T05:01:51.097Z
Learning: In broadcastStateTransitionHandlerFactory.js
, error handling when querying transaction status is handled in the API script.
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Documents and data contracts should use state transitions for updates
</retrieved_learning>
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (18)
- GitHub Check: Rust packages (dpp) / Tests
- GitHub Check: Rust packages (wasm-dpp) / Linting
- GitHub Check: Rust packages (wasm-dpp) / Unused dependencies
- GitHub Check: Rust packages (wasm-dpp) / Formatting
- GitHub Check: Rust packages (dpp) / Unused dependencies
- GitHub Check: Rust packages (dpp) / Linting
- GitHub Check: Rust packages (drive-abci) / Tests
- GitHub Check: Rust packages (drive-abci) / Linting
- GitHub Check: Rust packages (dash-sdk) / Formatting
- GitHub Check: Rust packages (drive-abci) / Formatting
- GitHub Check: Rust packages (dash-sdk) / Check each feature
- GitHub Check: Rust packages (dash-sdk) / Tests
- GitHub Check: Rust packages (dash-sdk) / Unused dependencies
- GitHub Check: Rust packages (dash-sdk) / Linting
- GitHub Check: Build Docker images (DAPI, dapi, dapi) / Build DAPI image
- GitHub Check: Build Docker images (Drive, drive, drive-abci) / Build Drive image
- GitHub Check: Build JS packages / Build JS
- GitHub Check: build-wasm-sdk
🔇 Additional comments (9)
packages/rs-sdk/src/platform/dpns_usernames.rs (9)
18-30
: LGTM: Homograph attack prevention implemented correctly.The character replacement logic is sound for preventing homograph attacks in DPNS usernames.
49-82
: LGTM: Comprehensive username validation logic.The validation correctly implements the DPNS rules including length constraints, character restrictions, and consecutive hyphen prevention.
97-109
: LGTM: Contest detection logic is well-implemented.The logic correctly identifies contested usernames based on normalized length and character constraints.
238-243
: LGTM: Proper salted domain hash generation.The salt and entropy generation using cryptographically secure randomness is appropriate for DPNS registration security.
246-309
: LGTM: Correct DPNS document structure.The preorder and domain document structures match the DPNS specification with appropriate properties and data types.
311-341
: LGTM: Proper document submission sequence.The preorder-then-domain submission sequence is correct for DPNS registration, with appropriate callback handling.
476-490
: LGTM: Robust label extraction logic.The label extraction correctly handles both full domain names and bare labels, with proper validation for the ".dash" suffix.
522-535
: LGTM: Correct identity extraction from domain records.The logic properly extracts the identity ID from the domain document's records property.
545-636
: LGTM: Comprehensive test coverage.The unit tests thoroughly cover all utility functions with appropriate edge cases and boundary conditions.
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: 14
🔭 Outside diff range comments (3)
packages/wasm-sdk/index.html (1)
2595-2599
: Loss of precision when converting big credit amounts to Dash
Number(creditsNum)
will truncate values aboveNumber.MAX_SAFE_INTEGER
(≈ 9 quadrillion).
Do the division inBigInt
and format as string to keep full precision:- const dashValue = Number(creditsNum) / CREDITS_PER_DASH; - const dashFormatted = dashValue.toFixed(8).replace(/\.?0+$/, ''); + const dashValueBig = creditsNum / BigInt(CREDITS_PER_DASH); + const dashRemainder = creditsNum % BigInt(CREDITS_PER_DASH); + const dashFormatted = + dashValueBig.toString() + + '.' + + dashRemainder.toString().padStart(11, '0').replace(/0+$/, '');packages/wasm-sdk/src/queries/voting.rs (2)
42-43
: Avoid hardcoding the parent domain value.The parent domain is hardcoded as "dash". This limits the function's flexibility and may not work for other domains. Consider parsing this from the
result_type
parameter or making it configurable.- // Parse result_type to get start_index_values - // For now, we'll use the standard "dash" parent domain - let start_index_values = vec!["dash".as_bytes().to_vec()]; + // Parse result_type to get start_index_values + let start_index_values = parse_index_values_from_result_type(result_type) + .unwrap_or_else(|| vec!["dash".as_bytes().to_vec()]);
249-347
: Significant code duplication between proof and non-proof variants.The functions
get_contested_resource_vote_state_with_proof_info
(lines 249-347) andget_contested_resource_vote_state
(lines 578-667) are nearly identical with only these differences:
- Proof version forces
prove: true
- Proof version returns
ProofMetadataResponse
- Non-proof version returns raw data with metadata
This violates the DRY principle and increases maintenance burden.
Extract the common logic into a shared implementation:
async fn get_contested_resource_vote_state_impl( sdk: &WasmSdk, data_contract_id: &str, document_type_name: &str, index_name: &str, result_type: &str, allow_include_locked_and_abstaining_vote_tally: Option<bool>, start_at_identifier_info: Option<String>, count: Option<u32>, prove: bool, ) -> Result<dash_sdk::platform::Response<GetContestedResourceVoteStateResponse>, JsError> { // Common implementation here }Then implement the two public functions as thin wrappers that call the shared implementation.
Also applies to: 578-667
♻️ Duplicate comments (2)
packages/wasm-sdk/index.html (2)
988-992
: Obsoleteget_dpns_username
import is still present
get_dpns_username
was renamed toget_dpns_usernames
; keeping the old symbol in the import list will raise a runtimeReferenceError
when the WASM module initializes.
Remove the stale entry.- get_dpns_username, get_dpns_usernames,
3884-3892
:keyId
parsing still unsafe –NaN
slips through
parseInt(parts[1])
can returnNaN
(e.g. empty suffix or non-numeric text).
WhenNaN
is compared to public-key IDs the lookup silently fails and yields the misleading Key ID … not found error.- keyId = parseInt(parts[1]); + keyId = Number(parts[1]); + if (!Number.isInteger(keyId) || keyId < 0) { + throw new Error(`Invalid keyId suffix “${parts[1]}” – expected a non-negative integer`); + }
🧹 Nitpick comments (3)
packages/wasm-sdk/src/queries/protocol.rs (1)
156-166
: Placeholder for future implementation.The function correctly indicates it's not yet implemented and properly marks parameters as unused.
Would you like me to help implement this function once the SDK provides the appropriate
fetch_many_with_metadata_and_proof
method forMasternodeProtocolVote
?packages/wasm-sdk/index.html (1)
2803-2807
: Comment contradicts actual behaviour of proof toggleThe code calls the
with_proof_info
variants whenproofToggle.checked === true
, therefore checked = with proof, unchecked = regular verified result.
Update the comment to avoid confusing users.packages/wasm-sdk/src/queries/voting.rs (1)
28-32
: Address unused parameters in the function signature.The parameters
_result_type
,_allow_include_locked_and_abstaining_vote_tally
, and_offset
are prefixed with underscores but not used in the implementation. These should either be:
- Implemented to support their intended functionality
- Removed if they're not needed
- Documented with a TODO comment explaining why they're currently unused
Would you like me to help implement the logic for these parameters or open an issue to track this work?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (13)
packages/rs-sdk/src/platform/dpns_usernames.rs
(1 hunks)packages/wasm-sdk/index.html
(36 hunks)packages/wasm-sdk/src/queries/data_contract.rs
(3 hunks)packages/wasm-sdk/src/queries/document.rs
(4 hunks)packages/wasm-sdk/src/queries/epoch.rs
(5 hunks)packages/wasm-sdk/src/queries/group.rs
(3 hunks)packages/wasm-sdk/src/queries/identity.rs
(17 hunks)packages/wasm-sdk/src/queries/mod.rs
(2 hunks)packages/wasm-sdk/src/queries/protocol.rs
(2 hunks)packages/wasm-sdk/src/queries/system.rs
(5 hunks)packages/wasm-sdk/src/queries/token.rs
(4 hunks)packages/wasm-sdk/src/queries/voting.rs
(15 hunks)packages/wasm-sdk/src/sdk.rs
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- packages/wasm-sdk/src/sdk.rs
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/rs-sdk/src/platform/dpns_usernames.rs
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.rs`: Rust code should be formatted using `cargo fmt --all` Rust code shoul...
**/*.rs
: Rust code should be formatted usingcargo fmt --all
Rust code should be linted usingcargo clippy --workspace
Check Rust code usingcargo check --workspace
Run Rust tests usingcargo test
📄 Source: CodeRabbit Inference Engine (CLAUDE.md)
List of files the instruction was applied to:
packages/wasm-sdk/src/queries/protocol.rs
packages/wasm-sdk/src/queries/mod.rs
packages/wasm-sdk/src/queries/document.rs
packages/wasm-sdk/src/queries/data_contract.rs
packages/wasm-sdk/src/queries/epoch.rs
packages/wasm-sdk/src/queries/system.rs
packages/wasm-sdk/src/queries/token.rs
packages/wasm-sdk/src/queries/identity.rs
packages/wasm-sdk/src/queries/group.rs
packages/wasm-sdk/src/queries/voting.rs
🧠 Learnings (12)
📓 Common learnings
Learnt from: QuantumExplorer
PR: dashpay/platform#2690
File: packages/wasm-sdk/src/queries/document.rs:383-384
Timestamp: 2025-07-10T00:37:09.565Z
Learning: In the Dash platform, DPNS (Dash Platform Name Service) contracts have the same ID across all networks (mainnet, testnet, etc.), so hardcoding the DPNS contract ID is appropriate and doesn't need to be configurable.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
Learnt from: shumkov
PR: dashpay/platform#2270
File: packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js:69-125
Timestamp: 2024-10-24T05:07:35.892Z
Learning: Future development plans involve rewriting DAPI into Rust, as the rest of the project has already migrated.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts is already handled in the data contract validation process, specifically in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs.
Learnt from: shumkov
PR: dashpay/platform#2489
File: packages/rs-dpp/Cargo.toml:32-32
Timestamp: 2025-03-11T09:39:23.071Z
Learning: In the Dash Platform project, dependencies are currently managed using Git repository references with tags (repo+tag format in Cargo.toml) rather than published crates, as the team is not currently publishing crates to crates.io.
Learnt from: shumkov
PR: dashpay/platform#2206
File: packages/rs-platform-version/src/version/protocol_version.rs:155-157
Timestamp: 2024-10-04T09:08:48.470Z
Learning: In the dashmate default configurations, the default protocol version for local networks has been removed, and an update mechanism for the protocol version in the consensus parameters has been implemented.
Learnt from: shumkov
PR: dashpay/platform#2206
File: packages/rs-platform-version/src/version/protocol_version.rs:155-157
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the dashmate default configurations, the default protocol version for local networks has been removed, and an update mechanism for the protocol version in the consensus parameters has been implemented.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts (ensuring it's between 3 and 100 characters) is already handled at the data contract validation level in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs, making additional checks in the update operations redundant.
Learnt from: lklimek
PR: dashpay/platform#2254
File: packages/rs-sdk/src/sdk.rs:585-585
Timestamp: 2024-10-18T15:39:51.172Z
Learning: The 'platform' project uses Rust version 1.80, so code in 'packages/rs-sdk' can use features available in Rust 1.80, such as the `abs_diff()` method.
Learnt from: QuantumExplorer
PR: dashpay/platform#2644
File: packages/rs-drive/src/cache/system_contracts.rs:18-19
Timestamp: 2025-05-28T16:22:26.334Z
Learning: In packages/rs-drive/src/cache/system_contracts.rs, the `active_since_protocol_version` field in `ActiveSystemDataContract` struct is intentionally added for future use, not current implementation. QuantumExplorer confirmed this is "meant for later" when questioned about the `#[allow(unused)]` attribute.
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/src/mimic/test_quorum.rs:159-164
Timestamp: 2024-11-20T16:16:01.830Z
Learning: QuantumExplorer prefers not to receive auto-generated messages asking to post on social media.
Learnt from: QuantumExplorer
PR: dashpay/platform#2439
File: packages/rs-dpp/src/errors/consensus/state/token/mod.rs:4-22
Timestamp: 2025-01-23T02:10:08.979Z
Learning: The user QuantumExplorer prefers to handle documentation of breaking changes separately from the code changes, particularly for token-related error types and validation rules.
Learnt from: QuantumExplorer
PR: dashpay/platform#2673
File: packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs:1164-1197
Timestamp: 2025-06-18T03:44:14.385Z
Learning: QuantumExplorer determined that a CodeRabbit suggestion about fixing signable_bytes calculation in identity update tests with contract-bound keys was incorrect - the code flow is working as intended without the suggested changes.
packages/wasm-sdk/src/queries/protocol.rs (19)
Learnt from: shumkov
PR: dashpay/platform#2422
File: packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs:152-163
Timestamp: 2025-01-15T08:09:59.365Z
Learning: In the `transition_to_version_8` function, errors from `grove_get_path_query` when retrieving active contested resource votes are intentionally logged and ignored (returning `Ok(())`) to allow the protocol upgrade to proceed despite query failures.
Learnt from: QuantumExplorer
PR: dashpay/platform#2644
File: packages/rs-drive/src/cache/system_contracts.rs:18-19
Timestamp: 2025-05-28T16:22:26.334Z
Learning: In packages/rs-drive/src/cache/system_contracts.rs, the `active_since_protocol_version` field in `ActiveSystemDataContract` struct is intentionally added for future use, not current implementation. QuantumExplorer confirmed this is "meant for later" when questioned about the `#[allow(unused)]` attribute.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.
Learnt from: lklimek
PR: dashpay/platform#2232
File: packages/rs-sdk/src/mock/sdk.rs:90-95
Timestamp: 2024-10-10T10:30:19.883Z
Learning: In `packages/rs-sdk/src/mock/sdk.rs`, the `load_expectations` method in `MockDashPlatformSdk` remains asynchronous (`async`) for backward compatibility, even though it now delegates to the synchronous `load_expectations_sync` method.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/rs-sdk/src/sync.rs:88-95
Timestamp: 2025-01-23T09:23:32.740Z
Learning: The `block_on` function in `packages/rs-sdk/src/sync.rs` is currently only used in tests, and its WebAssembly implementation is deferred until there's a user request for it.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/src/platform/fetch_unproved.rs:0-0
Timestamp: 2024-10-30T11:04:33.634Z
Learning: In `packages/rs-sdk/src/platform/fetch_unproved.rs`, the `execute()` method consumes the request object, so cloning the request is necessary before passing it to `execute()` and `maybe_from_unproved_with_metadata`.
Learnt from: shumkov
PR: dashpay/platform#2206
File: packages/rs-drive-abci/tests/strategy_tests/main.rs:1162-1162
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the Rust test file `packages/rs-drive-abci/tests/strategy_tests/main.rs`, specific protocol versions like `PROTOCOL_VERSION_1` are intentionally used in tests instead of `PROTOCOL_VERSION_LATEST`.
Learnt from: shumkov
PR: dashpay/platform#2206
File: packages/rs-drive-abci/tests/strategy_tests/main.rs:1162-1162
Timestamp: 2024-10-04T09:08:47.901Z
Learning: In the Rust test file `packages/rs-drive-abci/tests/strategy_tests/main.rs`, specific protocol versions like `PROTOCOL_VERSION_1` are intentionally used in tests instead of `PROTOCOL_VERSION_LATEST`.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/src/core/transaction.rs:0-0
Timestamp: 2024-10-29T14:40:54.727Z
Learning: In `packages/rs-sdk/src/platform/document_query.rs` and `packages/rs-sdk/src/core/transaction.rs`, certain places don't implement `IntoInner`, so direct error mappings cannot be simplified using `IntoInner`. A TODO comment has been added to address this in a future PR.
Learnt from: lklimek
PR: dashpay/platform#2254
File: packages/rs-sdk/src/sdk.rs:654-658
Timestamp: 2024-10-18T15:43:32.447Z
Learning: In `packages/rs-sdk/src/sdk.rs`, within the `verify_metadata_height` function, when using `compare_exchange` on `last_seen_height`, it's acceptable to use `Ordering::Relaxed` for the failure ordering, as any inconsistency would only trigger an extra loop iteration without affecting correctness.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/dapi-grpc/src/mock.rs:125-145
Timestamp: 2024-10-29T14:16:00.141Z
Learning: Using `serde_json` encoding produces deterministic output required to identify requests and responses by hash, therefore `serde_json` is used as the basic serialization algorithm for mocking.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/src/executor.rs:38-38
Timestamp: 2024-10-29T14:44:01.184Z
Learning: In `packages/rs-dapi-client/src/executor.rs`, for the structs `ExecutionError<E>` and `ExecutionResponse<R>`, only the serde derives (`Serialize`, `Deserialize`) should be conditional based on the "mocks" feature; the other derives (`Debug`, `Clone`, `Eq`, `PartialEq`) should always be present.
Learnt from: lklimek
PR: dashpay/platform#2207
File: packages/rs-sdk/src/mock/requests.rs:0-0
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In Rust, when serializing `IndexMap<K, V>` with bincode, use `bincode::serde::encode_to_vec` and `bincode::serde::decode_from_slice` because `IndexMap` does not implement `bincode::Encode`.
Learnt from: lklimek
PR: dashpay/platform#2207
File: packages/rs-sdk/src/mock/requests.rs:0-0
Timestamp: 2024-10-04T14:09:58.852Z
Learning: In Rust, when serializing `IndexMap<K, V>` with bincode, use `bincode::serde::encode_to_vec` and `bincode::serde::decode_from_slice` because `IndexMap` does not implement `bincode::Encode`.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/rs-sdk/src/sync.rs:88-95
Timestamp: 2025-01-23T09:23:32.740Z
Learning: The `block_on` function in `packages/rs-sdk/src/sync.rs` requires true blocking behavior, which is why a non-blocking WebAssembly implementation using `wasm_bindgen_futures::spawn_local` is not suitable.
Learnt from: lklimek
PR: dashpay/platform#2207
File: packages/rs-drive-proof-verifier/src/proof.rs:1646-1664
Timestamp: 2024-10-04T14:16:05.798Z
Learning: In the implementation of `FromProof<platform::GetContestedResourceIdentityVotesRequest>` in `packages/rs-drive-proof-verifier/src/proof.rs`, when matching `maybe_votes`, using `.expect()` on `v.into_iter().next()` is acceptable because the prior match arm `Some(v) if v.is_empty()` ensures that the map is not empty, preventing a panic.
Learnt from: lklimek
PR: dashpay/platform#2207
File: packages/rs-drive-proof-verifier/src/proof.rs:1646-1664
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the implementation of `FromProof<platform::GetContestedResourceIdentityVotesRequest>` in `packages/rs-drive-proof-verifier/src/proof.rs`, when matching `maybe_votes`, using `.expect()` on `v.into_iter().next()` is acceptable because the prior match arm `Some(v) if v.is_empty()` ensures that the map is not empty, preventing a panic.
Learnt from: QuantumExplorer
PR: dashpay/platform#2215
File: packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs:105-105
Timestamp: 2024-10-06T16:17:34.571Z
Learning: In `run_block_proposal` in `packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs`, when retrieving `last_block_time_ms`, it's acceptable to use `platform_state` instead of `block_platform_state`, even after updating the protocol version.
packages/wasm-sdk/src/queries/mod.rs (4)
Learnt from: QuantumExplorer
PR: dashpay/platform#2690
File: packages/wasm-sdk/src/queries/document.rs:383-384
Timestamp: 2025-07-10T00:37:09.565Z
Learning: In the Dash platform, DPNS (Dash Platform Name Service) contracts have the same ID across all networks (mainnet, testnet, etc.), so hardcoding the DPNS contract ID is appropriate and doesn't need to be configurable.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts is already handled in the data contract validation process, specifically in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/src/executor.rs:38-38
Timestamp: 2024-10-29T14:44:01.184Z
Learning: In `packages/rs-dapi-client/src/executor.rs`, for the structs `ExecutionError<E>` and `ExecutionResponse<R>`, only the serde derives (`Serialize`, `Deserialize`) should be conditional based on the "mocks" feature; the other derives (`Debug`, `Clone`, `Eq`, `PartialEq`) should always be present.
Learnt from: shumkov
PR: dashpay/platform#2259
File: packages/rs-dapi-client/src/dapi_client.rs:137-139
Timestamp: 2024-10-22T10:53:12.111Z
Learning: In `packages/rs-dapi-client/src/dapi_client.rs`, when passing data into asynchronous code, ensure that data structures are `Send + Sync`. Using `Arc<AtomicUsize>` is necessary for the retry counter.
packages/wasm-sdk/src/queries/document.rs (9)
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/src/core/transaction.rs:0-0
Timestamp: 2024-10-29T14:40:54.727Z
Learning: In `packages/rs-sdk/src/platform/document_query.rs` and `packages/rs-sdk/src/core/transaction.rs`, certain places don't implement `IntoInner`, so direct error mappings cannot be simplified using `IntoInner`. A TODO comment has been added to address this in a future PR.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/src/platform/fetch_unproved.rs:0-0
Timestamp: 2024-10-30T11:04:33.634Z
Learning: In `packages/rs-sdk/src/platform/fetch_unproved.rs`, the `execute()` method consumes the request object, so cloning the request is necessary before passing it to `execute()` and `maybe_from_unproved_with_metadata`.
Learnt from: lklimek
PR: dashpay/platform#2232
File: packages/rs-sdk/src/mock/sdk.rs:90-95
Timestamp: 2024-10-10T10:30:19.883Z
Learning: In `packages/rs-sdk/src/mock/sdk.rs`, the `load_expectations` method in `MockDashPlatformSdk` remains asynchronous (`async`) for backward compatibility, even though it now delegates to the synchronous `load_expectations_sync` method.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use `rs-drive-proof-verifier` for cryptographic proof verification
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/rs-sdk/src/sync.rs:88-95
Timestamp: 2025-01-23T09:23:32.740Z
Learning: The `block_on` function in `packages/rs-sdk/src/sync.rs` is currently only used in tests, and its WebAssembly implementation is deferred until there's a user request for it.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/tests/fetch/config.rs:233-233
Timestamp: 2024-10-30T11:19:59.163Z
Learning: In the Rust SDK's `rs-sdk/tests` integration tests (e.g., in `packages/rs-sdk/tests/fetch/config.rs`), we cannot create objects during tests because there is no support for object creation in this context. Therefore, hardcoded values for test identities must be used.
Learnt from: QuantumExplorer
PR: dashpay/platform#2690
File: packages/wasm-sdk/src/queries/document.rs:383-384
Timestamp: 2025-07-10T00:37:09.565Z
Learning: In the Dash platform, DPNS (Dash Platform Name Service) contracts have the same ID across all networks (mainnet, testnet, etc.), so hardcoding the DPNS contract ID is appropriate and doesn't need to be configurable.
packages/wasm-sdk/src/queries/data_contract.rs (10)
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.
Learnt from: QuantumExplorer
PR: dashpay/platform#2644
File: packages/rs-drive/src/cache/system_contracts.rs:18-19
Timestamp: 2025-05-28T16:22:26.334Z
Learning: In packages/rs-drive/src/cache/system_contracts.rs, the `active_since_protocol_version` field in `ActiveSystemDataContract` struct is intentionally added for future use, not current implementation. QuantumExplorer confirmed this is "meant for later" when questioned about the `#[allow(unused)]` attribute.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts is already handled in the data contract validation process, specifically in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/rs-sdk/src/sync.rs:88-95
Timestamp: 2025-01-23T09:23:32.740Z
Learning: The `block_on` function in `packages/rs-sdk/src/sync.rs` is currently only used in tests, and its WebAssembly implementation is deferred until there's a user request for it.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts (ensuring it's between 3 and 100 characters) is already handled at the data contract validation level in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs, making additional checks in the update operations redundant.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/src/platform/fetch_unproved.rs:0-0
Timestamp: 2024-10-30T11:04:33.634Z
Learning: In `packages/rs-sdk/src/platform/fetch_unproved.rs`, the `execute()` method consumes the request object, so cloning the request is necessary before passing it to `execute()` and `maybe_from_unproved_with_metadata`.
Learnt from: lklimek
PR: dashpay/platform#2232
File: packages/rs-sdk/src/mock/sdk.rs:90-95
Timestamp: 2024-10-10T10:30:19.883Z
Learning: In `packages/rs-sdk/src/mock/sdk.rs`, the `load_expectations` method in `MockDashPlatformSdk` remains asynchronous (`async`) for backward compatibility, even though it now delegates to the synchronous `load_expectations_sync` method.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/src/core/transaction.rs:0-0
Timestamp: 2024-10-29T14:40:54.727Z
Learning: In `packages/rs-sdk/src/platform/document_query.rs` and `packages/rs-sdk/src/core/transaction.rs`, certain places don't implement `IntoInner`, so direct error mappings cannot be simplified using `IntoInner`. A TODO comment has been added to address this in a future PR.
Learnt from: shumkov
PR: dashpay/platform#2259
File: packages/rs-dapi-client/src/dapi_client.rs:137-139
Timestamp: 2024-10-22T10:53:12.111Z
Learning: In `packages/rs-dapi-client/src/dapi_client.rs`, when passing data into asynchronous code, ensure that data structures are `Send + Sync`. Using `Arc<AtomicUsize>` is necessary for the retry counter.
packages/wasm-sdk/src/queries/epoch.rs (15)
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/rs-sdk/src/sync.rs:88-95
Timestamp: 2025-01-23T09:23:32.740Z
Learning: The `block_on` function in `packages/rs-sdk/src/sync.rs` is currently only used in tests, and its WebAssembly implementation is deferred until there's a user request for it.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.
Learnt from: lklimek
PR: dashpay/platform#2254
File: packages/rs-sdk/src/sdk.rs:654-658
Timestamp: 2024-10-18T15:43:32.447Z
Learning: In `packages/rs-sdk/src/sdk.rs`, within the `verify_metadata_height` function, when using `compare_exchange` on `last_seen_height`, it's acceptable to use `Ordering::Relaxed` for the failure ordering, as any inconsistency would only trigger an extra loop iteration without affecting correctness.
Learnt from: lklimek
PR: dashpay/platform#2232
File: packages/rs-sdk/src/mock/sdk.rs:90-95
Timestamp: 2024-10-10T10:30:19.883Z
Learning: In `packages/rs-sdk/src/mock/sdk.rs`, the `load_expectations` method in `MockDashPlatformSdk` remains asynchronous (`async`) for backward compatibility, even though it now delegates to the synchronous `load_expectations_sync` method.
Learnt from: QuantumExplorer
PR: dashpay/platform#2644
File: packages/rs-drive/src/cache/system_contracts.rs:18-19
Timestamp: 2025-05-28T16:22:26.334Z
Learning: In packages/rs-drive/src/cache/system_contracts.rs, the `active_since_protocol_version` field in `ActiveSystemDataContract` struct is intentionally added for future use, not current implementation. QuantumExplorer confirmed this is "meant for later" when questioned about the `#[allow(unused)]` attribute.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/src/platform/fetch_unproved.rs:0-0
Timestamp: 2024-10-30T11:04:33.634Z
Learning: In `packages/rs-sdk/src/platform/fetch_unproved.rs`, the `execute()` method consumes the request object, so cloning the request is necessary before passing it to `execute()` and `maybe_from_unproved_with_metadata`.
Learnt from: shumkov
PR: dashpay/platform#2259
File: packages/rs-dapi-client/src/dapi_client.rs:137-139
Timestamp: 2024-10-22T10:53:12.111Z
Learning: In `packages/rs-dapi-client/src/dapi_client.rs`, when passing data into asynchronous code, ensure that data structures are `Send + Sync`. Using `Arc<AtomicUsize>` is necessary for the retry counter.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/rs-sdk/src/sync.rs:88-95
Timestamp: 2025-01-23T09:23:32.740Z
Learning: The `block_on` function in `packages/rs-sdk/src/sync.rs` requires true blocking behavior, which is why a non-blocking WebAssembly implementation using `wasm_bindgen_futures::spawn_local` is not suitable.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/tests/fetch/config.rs:233-233
Timestamp: 2024-10-30T11:19:59.163Z
Learning: In the Rust SDK's `rs-sdk/tests` integration tests (e.g., in `packages/rs-sdk/tests/fetch/config.rs`), we cannot create objects during tests because there is no support for object creation in this context. Therefore, hardcoded values for test identities must be used.
Learnt from: QuantumExplorer
PR: dashpay/platform#2559
File: packages/rs-drive-abci/src/query/token_queries/token_perpetual_distribution_last_claim/v0/mod.rs:128-0
Timestamp: 2025-04-21T00:38:44.796Z
Learning: In the Dash Platform codebase, EpochIndex is defined as u16, making it safe to cast to u32 without overflow concerns.
Learnt from: QuantumExplorer
PR: dashpay/platform#2215
File: packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs:105-105
Timestamp: 2024-10-06T16:17:34.571Z
Learning: In `run_block_proposal` in `packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs`, when retrieving `last_block_time_ms`, it's acceptable to use `platform_state` instead of `block_platform_state`, even after updating the protocol version.
Learnt from: QuantumExplorer
PR: dashpay/platform#2215
File: packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs:105-105
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In `run_block_proposal` in `packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs`, when retrieving `last_block_time_ms`, it's acceptable to use `platform_state` instead of `block_platform_state`, even after updating the protocol version.
Learnt from: QuantumExplorer
PR: dashpay/platform#2215
File: packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs:119-120
Timestamp: 2024-10-06T16:18:07.994Z
Learning: In the `run_block_proposal` function in `packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs`, it's acceptable to pass `platform_state` to `perform_events_on_first_block_of_protocol_change`, even if `block_platform_state` has been updated.
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: 2024-11-22T08:19:14.448Z
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.
packages/wasm-sdk/src/queries/system.rs (22)
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/src/core/transaction.rs:0-0
Timestamp: 2024-10-29T14:40:54.727Z
Learning: In `packages/rs-sdk/src/platform/document_query.rs` and `packages/rs-sdk/src/core/transaction.rs`, certain places don't implement `IntoInner`, so direct error mappings cannot be simplified using `IntoInner`. A TODO comment has been added to address this in a future PR.
Learnt from: lklimek
PR: dashpay/platform#2232
File: packages/rs-sdk/src/mock/sdk.rs:90-95
Timestamp: 2024-10-10T10:30:19.883Z
Learning: In `packages/rs-sdk/src/mock/sdk.rs`, the `load_expectations` method in `MockDashPlatformSdk` remains asynchronous (`async`) for backward compatibility, even though it now delegates to the synchronous `load_expectations_sync` method.
Learnt from: shumkov
PR: dashpay/platform#2259
File: packages/rs-dapi-client/src/dapi_client.rs:137-139
Timestamp: 2024-10-22T10:53:12.111Z
Learning: In `packages/rs-dapi-client/src/dapi_client.rs`, when passing data into asynchronous code, ensure that data structures are `Send + Sync`. Using `Arc<AtomicUsize>` is necessary for the retry counter.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/rs-sdk/src/sync.rs:88-95
Timestamp: 2025-01-23T09:23:32.740Z
Learning: The `block_on` function in `packages/rs-sdk/src/sync.rs` is currently only used in tests, and its WebAssembly implementation is deferred until there's a user request for it.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/src/executor.rs:38-38
Timestamp: 2024-10-29T14:44:01.184Z
Learning: In `packages/rs-dapi-client/src/executor.rs`, for the structs `ExecutionError<E>` and `ExecutionResponse<R>`, only the serde derives (`Serialize`, `Deserialize`) should be conditional based on the "mocks" feature; the other derives (`Debug`, `Clone`, `Eq`, `PartialEq`) should always be present.
Learnt from: QuantumExplorer
PR: dashpay/platform#2644
File: packages/rs-drive/src/cache/system_contracts.rs:18-19
Timestamp: 2025-05-28T16:22:26.334Z
Learning: In packages/rs-drive/src/cache/system_contracts.rs, the `active_since_protocol_version` field in `ActiveSystemDataContract` struct is intentionally added for future use, not current implementation. QuantumExplorer confirmed this is "meant for later" when questioned about the `#[allow(unused)]` attribute.
Learnt from: shumkov
PR: dashpay/platform#2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-03T11:51:06.980Z
Learning: In the `IdentityTransitionVersions` structure within `packages/rs-platform-version/src/version/v2.rs`, the field `credit_withdrawal` does not need the `identity_` prefix since it is already encompassed within identity state transitions.
Learnt from: shumkov
PR: dashpay/platform#2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the `IdentityTransitionVersions` structure within `packages/rs-platform-version/src/version/v2.rs`, the field `credit_withdrawal` does not need the `identity_` prefix since it is already encompassed within identity state transitions.
Learnt from: QuantumExplorer
PR: dashpay/platform#2227
File: packages/rs-dpp/src/core_types/validator_set/v0/mod.rs:299-299
Timestamp: 2024-10-21T01:03:42.458Z
Learning: In the `test_serialize_deserialize_validator_set_v0` test within `packages/rs-dpp/src/core_types/validator_set/v0/mod.rs`, deterministic BLS keys cannot be easily used; therefore, using `BlsPublicKey::generate()` is acceptable.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/dapi-grpc/src/mock.rs:125-145
Timestamp: 2024-10-29T14:16:00.141Z
Learning: Using `serde_json` encoding produces deterministic output required to identify requests and responses by hash, therefore `serde_json` is used as the basic serialization algorithm for mocking.
Learnt from: QuantumExplorer
PR: dashpay/platform#2432
File: packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/mod.rs:222-225
Timestamp: 2025-01-20T16:20:59.791Z
Learning: In the Dash Platform codebase, TokenAmount from crate::balances::credits is compatible with u64 when used for token base supply.
Learnt from: QuantumExplorer
PR: dashpay/platform#2182
File: packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/v0/mod.rs:23-31
Timestamp: 2024-09-28T20:34:49.182Z
Learning: `Credits` is a `u64`, and division by 10 won't cause an overflow.
Learnt from: QuantumExplorer
PR: dashpay/platform#2182
File: packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/v0/mod.rs:23-31
Timestamp: 2024-10-09T00:22:57.778Z
Learning: `Credits` is a `u64`, and division by 10 won't cause an overflow.
Learnt from: lklimek
PR: dashpay/platform#2337
File: packages/rs-dapi-client/src/executor.rs:161-212
Timestamp: 2024-11-20T14:14:54.721Z
Learning: In `packages/rs-dapi-client/src/executor.rs`, the `WrapWithExecutionResult` trait supports on-the-fly type conversions using the `From` trait, which is useful when using the `?` operator to return errors.
Learnt from: shumkov
PR: dashpay/platform#2259
File: packages/rs-dapi-client/src/executor.rs:49-56
Timestamp: 2024-10-28T10:38:49.538Z
Learning: In `packages/rs-dapi-client/src/executor.rs`, the `ExecutionResponse` struct always has a non-optional `address` field of type `Address` because an address is always present when there's a successful response.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/src/platform/fetch_unproved.rs:0-0
Timestamp: 2024-10-30T11:04:33.634Z
Learning: In `packages/rs-sdk/src/platform/fetch_unproved.rs`, the `execute()` method consumes the request object, so cloning the request is necessary before passing it to `execute()` and `maybe_from_unproved_with_metadata`.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/tests/fetch/config.rs:233-233
Timestamp: 2024-10-30T11:19:59.163Z
Learning: In the Rust SDK's `rs-sdk/tests` integration tests (e.g., in `packages/rs-sdk/tests/fetch/config.rs`), we cannot create objects during tests because there is no support for object creation in this context. Therefore, hardcoded values for test identities must be used.
Learnt from: QuantumExplorer
PR: dashpay/platform#2347
File: packages/rs-drive/tests/query_tests.rs:438-460
Timestamp: 2024-11-25T01:17:02.001Z
Learning: In Rust test files (`packages/rs-drive/tests/query_tests.rs`), when code is used only in tests, defining explicit enums for fields (like the `status` field in the `Withdrawal` struct) may not be necessary; using primitive types is acceptable.
Learnt from: lklimek
PR: dashpay/platform#2207
File: packages/rs-drive-proof-verifier/src/proof.rs:1646-1664
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the implementation of `FromProof<platform::GetContestedResourceIdentityVotesRequest>` in `packages/rs-drive-proof-verifier/src/proof.rs`, when matching `maybe_votes`, using `.expect()` on `v.into_iter().next()` is acceptable because the prior match arm `Some(v) if v.is_empty()` ensures that the map is not empty, preventing a panic.
Learnt from: lklimek
PR: dashpay/platform#2207
File: packages/rs-drive-proof-verifier/src/proof.rs:1646-1664
Timestamp: 2024-10-04T14:16:05.798Z
Learning: In the implementation of `FromProof<platform::GetContestedResourceIdentityVotesRequest>` in `packages/rs-drive-proof-verifier/src/proof.rs`, when matching `maybe_votes`, using `.expect()` on `v.into_iter().next()` is acceptable because the prior match arm `Some(v) if v.is_empty()` ensures that the map is not empty, preventing a panic.
packages/wasm-sdk/index.html (22)
undefined
<retrieved_learning>
Learnt from: lklimek
PR: #2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2317
File: packages/rs-dapi-client/src/address_list.rs:175-180
Timestamp: 2024-11-28T13:49:17.301Z
Learning: In Rust code in packages/rs-dapi-client/src/address_list.rs
, do not change the interface of deprecated methods like add_uri
, even to fix potential panics.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2314
File: packages/wallet-contract/test/bootstrap.js:14-16
Timestamp: 2024-11-06T07:27:01.722Z
Learning: In packages/wallet-contract/test/bootstrap.js
, for Mocha tests in Node.js, async functions like loadWasmDpp
can be assigned directly to beforeAll
without wrapping them in another async function.
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the IdentityTransitionVersions
structure within packages/rs-platform-version/src/version/v2.rs
, the field credit_withdrawal
does not need the identity_
prefix since it is already encompassed within identity state transitions.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-03T11:51:06.980Z
Learning: In the IdentityTransitionVersions
structure within packages/rs-platform-version/src/version/v2.rs
, the field credit_withdrawal
does not need the identity_
prefix since it is already encompassed within identity state transitions.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2277
File: packages/rs-sdk/src/core/transaction.rs:0-0
Timestamp: 2024-10-29T14:40:54.727Z
Learning: In packages/rs-sdk/src/platform/document_query.rs
and packages/rs-sdk/src/core/transaction.rs
, certain places don't implement IntoInner
, so direct error mappings cannot be simplified using IntoInner
. A TODO comment has been added to address this in a future PR.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2673
File: packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs:1164-1197
Timestamp: 2025-06-18T03:44:14.385Z
Learning: QuantumExplorer determined that a CodeRabbit suggestion about fixing signable_bytes calculation in identity update tests with contract-bound keys was incorrect - the code flow is working as intended without the suggested changes.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2365
File: packages/dashmate/src/listr/tasks/ssl/zerossl/obtainZeroSSLCertificateTaskFactory.js:206-213
Timestamp: 2024-12-03T05:47:30.524Z
Learning: In obtainZeroSSLCertificateTaskFactory.js
, when handling ZeroSSL API errors during domain verification, the error detail structure is consistent when an error occurs, so additional null checks on e.details[ctx.externalIp]
may not be necessary.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2257
File: packages/rs-drive-abci/tests/strategy_tests/masternodes.rs:212-220
Timestamp: 2024-11-20T20:43:41.185Z
Learning: In packages/rs-drive-abci/tests/strategy_tests/masternodes.rs
, the pattern of generating a PrivateKey
, converting it to bytes, and reconstructing a BlsPrivateKey
from those bytes is intentional. Avoid suggesting to simplify this code in future reviews.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2381
File: packages/rs-sdk/scripts/connect_to_remote.sh:0-0
Timestamp: 2024-12-10T12:39:38.182Z
Learning: When reviewing scripts in packages/rs-sdk/scripts/
, avoid suggesting additional error handling and timeout management that complicate the script without adding significant value.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2257
File: packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs:148-151
Timestamp: 2024-11-20T16:05:40.200Z
Learning: In packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs
, when converting public keys from QuorumForSavingV0
to VerificationQuorum
, it's acceptable to use .expect()
for public key conversion, as the conversion has been verified and panics are acceptable in this context.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2690
File: packages/wasm-sdk/src/queries/document.rs:383-384
Timestamp: 2025-07-10T00:37:09.565Z
Learning: In the Dash platform, DPNS (Dash Platform Name Service) contracts have the same ID across all networks (mainnet, testnet, etc.), so hardcoding the DPNS contract ID is appropriate and doesn't need to be configurable.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2277
File: packages/rs-sdk/tests/fetch/config.rs:233-233
Timestamp: 2024-10-30T11:19:59.163Z
Learning: In the Rust SDK's rs-sdk/tests
integration tests (e.g., in packages/rs-sdk/tests/fetch/config.rs
), we cannot create objects during tests because there is no support for object creation in this context. Therefore, hardcoded values for test identities must be used.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2405
File: packages/rs-sdk/src/sync.rs:88-95
Timestamp: 2025-01-23T09:23:32.740Z
Learning: The block_on
function in packages/rs-sdk/src/sync.rs
is currently only used in tests, and its WebAssembly implementation is deferred until there's a user request for it.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2277
File: packages/rs-sdk/src/platform/fetch_unproved.rs:0-0
Timestamp: 2024-10-30T11:04:33.634Z
Learning: In packages/rs-sdk/src/platform/fetch_unproved.rs
, the execute()
method consumes the request object, so cloning the request is necessary before passing it to execute()
and maybe_from_unproved_with_metadata
.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2207
File: packages/rs-drive-proof-verifier/src/proof.rs:1646-1664
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the implementation of FromProof<platform::GetContestedResourceIdentityVotesRequest>
in packages/rs-drive-proof-verifier/src/proof.rs
, when matching maybe_votes
, using .expect()
on v.into_iter().next()
is acceptable because the prior match arm Some(v) if v.is_empty()
ensures that the map is not empty, preventing a panic.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2207
File: packages/rs-drive-proof-verifier/src/proof.rs:1646-1664
Timestamp: 2024-10-04T14:16:05.798Z
Learning: In the implementation of FromProof<platform::GetContestedResourceIdentityVotesRequest>
in packages/rs-drive-proof-verifier/src/proof.rs
, when matching maybe_votes
, using .expect()
on v.into_iter().next()
is acceptable because the prior match arm Some(v) if v.is_empty()
ensures that the map is not empty, preventing a panic.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2232
File: packages/rs-sdk/src/mock/sdk.rs:90-95
Timestamp: 2024-10-10T10:30:19.883Z
Learning: In packages/rs-sdk/src/mock/sdk.rs
, the load_expectations
method in MockDashPlatformSdk
remains asynchronous (async
) for backward compatibility, even though it now delegates to the synchronous load_expectations_sync
method.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2347
File: packages/rs-drive/tests/query_tests.rs:438-460
Timestamp: 2024-11-25T01:17:02.001Z
Learning: In Rust test files (packages/rs-drive/tests/query_tests.rs
), when code is used only in tests, defining explicit enums for fields (like the status
field in the Withdrawal
struct) may not be necessary; using primitive types is acceptable.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2270
File: packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js:90-96
Timestamp: 2024-10-24T05:01:51.097Z
Learning: In broadcastStateTransitionHandlerFactory.js
, error handling when querying transaction status is handled in the API script.
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Documents and data contracts should use state transitions for updates
</retrieved_learning>
packages/wasm-sdk/src/queries/token.rs (17)
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/src/core/transaction.rs:0-0
Timestamp: 2024-10-29T14:40:54.727Z
Learning: In `packages/rs-sdk/src/platform/document_query.rs` and `packages/rs-sdk/src/core/transaction.rs`, certain places don't implement `IntoInner`, so direct error mappings cannot be simplified using `IntoInner`. A TODO comment has been added to address this in a future PR.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/src/executor.rs:38-38
Timestamp: 2024-10-29T14:44:01.184Z
Learning: In `packages/rs-dapi-client/src/executor.rs`, for the structs `ExecutionError<E>` and `ExecutionResponse<R>`, only the serde derives (`Serialize`, `Deserialize`) should be conditional based on the "mocks" feature; the other derives (`Debug`, `Clone`, `Eq`, `PartialEq`) should always be present.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/dapi-grpc/src/mock.rs:125-145
Timestamp: 2024-10-29T14:16:00.141Z
Learning: Using `serde_json` encoding produces deterministic output required to identify requests and responses by hash, therefore `serde_json` is used as the basic serialization algorithm for mocking.
Learnt from: shumkov
PR: dashpay/platform#2259
File: packages/rs-dapi-client/src/dapi_client.rs:137-139
Timestamp: 2024-10-22T10:53:12.111Z
Learning: In `packages/rs-dapi-client/src/dapi_client.rs`, when passing data into asynchronous code, ensure that data structures are `Send + Sync`. Using `Arc<AtomicUsize>` is necessary for the retry counter.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/src/platform/fetch_unproved.rs:0-0
Timestamp: 2024-10-30T11:04:33.634Z
Learning: In `packages/rs-sdk/src/platform/fetch_unproved.rs`, the `execute()` method consumes the request object, so cloning the request is necessary before passing it to `execute()` and `maybe_from_unproved_with_metadata`.
Learnt from: lklimek
PR: dashpay/platform#2232
File: packages/rs-sdk/src/mock/sdk.rs:90-95
Timestamp: 2024-10-10T10:30:19.883Z
Learning: In `packages/rs-sdk/src/mock/sdk.rs`, the `load_expectations` method in `MockDashPlatformSdk` remains asynchronous (`async`) for backward compatibility, even though it now delegates to the synchronous `load_expectations_sync` method.
Learnt from: QuantumExplorer
PR: dashpay/platform#2439
File: packages/rs-dpp/src/errors/consensus/state/token/mod.rs:4-22
Timestamp: 2025-01-23T02:10:08.979Z
Learning: The user QuantumExplorer prefers to handle documentation of breaking changes separately from the code changes, particularly for token-related error types and validation rules.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/rs-sdk/src/sync.rs:88-95
Timestamp: 2025-01-23T09:23:32.740Z
Learning: The `block_on` function in `packages/rs-sdk/src/sync.rs` is currently only used in tests, and its WebAssembly implementation is deferred until there's a user request for it.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
Learnt from: QuantumExplorer
PR: dashpay/platform#2432
File: packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/mod.rs:222-225
Timestamp: 2025-01-20T16:20:59.791Z
Learning: In the Dash Platform codebase, TokenAmount from crate::balances::credits is compatible with u64 when used for token base supply.
Learnt from: QuantumExplorer
PR: dashpay/platform#2432
File: packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/mod.rs:222-225
Timestamp: 2025-01-20T16:20:59.791Z
Learning: In the Dash Platform codebase, TokenAmount is defined as `type TokenAmount = u64` in balances/credits.rs, making it directly compatible with u64 values without any conversion needed.
Learnt from: QuantumExplorer
PR: dashpay/platform#2347
File: packages/rs-drive/tests/query_tests.rs:438-460
Timestamp: 2024-11-25T01:17:02.001Z
Learning: In Rust test files (`packages/rs-drive/tests/query_tests.rs`), when code is used only in tests, defining explicit enums for fields (like the `status` field in the `Withdrawal` struct) may not be necessary; using primitive types is acceptable.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/dapi-grpc/src/mock.rs:95-109
Timestamp: 2024-10-29T14:13:35.584Z
Learning: In test code (e.g., `packages/dapi-grpc/src/mock.rs`), panicking on deserialization errors is acceptable behavior.
Learnt from: lklimek
PR: dashpay/platform#2337
File: packages/rs-dapi-client/src/executor.rs:161-212
Timestamp: 2024-11-20T14:14:54.721Z
Learning: In `packages/rs-dapi-client/src/executor.rs`, the `WrapWithExecutionResult` trait supports on-the-fly type conversions using the `From` trait, which is useful when using the `?` operator to return errors.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/rs-sdk/src/sync.rs:88-95
Timestamp: 2025-01-23T09:23:32.740Z
Learning: The `block_on` function in `packages/rs-sdk/src/sync.rs` requires true blocking behavior, which is why a non-blocking WebAssembly implementation using `wasm_bindgen_futures::spawn_local` is not suitable.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/tests/fetch/config.rs:233-233
Timestamp: 2024-10-30T11:19:59.163Z
Learning: In the Rust SDK's `rs-sdk/tests` integration tests (e.g., in `packages/rs-sdk/tests/fetch/config.rs`), we cannot create objects during tests because there is no support for object creation in this context. Therefore, hardcoded values for test identities must be used.
packages/wasm-sdk/src/queries/identity.rs (17)
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/tests/fetch/config.rs:233-233
Timestamp: 2024-10-30T11:19:59.163Z
Learning: In the Rust SDK's `rs-sdk/tests` integration tests (e.g., in `packages/rs-sdk/tests/fetch/config.rs`), we cannot create objects during tests because there is no support for object creation in this context. Therefore, hardcoded values for test identities must be used.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/src/platform/fetch_unproved.rs:0-0
Timestamp: 2024-10-30T11:04:33.634Z
Learning: In `packages/rs-sdk/src/platform/fetch_unproved.rs`, the `execute()` method consumes the request object, so cloning the request is necessary before passing it to `execute()` and `maybe_from_unproved_with_metadata`.
Learnt from: shumkov
PR: dashpay/platform#2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the `IdentityTransitionVersions` structure within `packages/rs-platform-version/src/version/v2.rs`, the field `credit_withdrawal` does not need the `identity_` prefix since it is already encompassed within identity state transitions.
Learnt from: shumkov
PR: dashpay/platform#2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-03T11:51:06.980Z
Learning: In the `IdentityTransitionVersions` structure within `packages/rs-platform-version/src/version/v2.rs`, the field `credit_withdrawal` does not need the `identity_` prefix since it is already encompassed within identity state transitions.
Learnt from: QuantumExplorer
PR: dashpay/platform#2215
File: packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs:19-30
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the Rust file `packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs`, within the `create_owner_identity_v1` function, the `add_public_keys` method of the `Identity` struct cannot fail and does not require explicit error handling.
Learnt from: QuantumExplorer
PR: dashpay/platform#2215
File: packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs:19-30
Timestamp: 2024-10-06T16:11:34.946Z
Learning: In the Rust file `packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs`, within the `create_owner_identity_v1` function, the `add_public_keys` method of the `Identity` struct cannot fail and does not require explicit error handling.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/rs-sdk/src/sync.rs:88-95
Timestamp: 2025-01-23T09:23:32.740Z
Learning: The `block_on` function in `packages/rs-sdk/src/sync.rs` is currently only used in tests, and its WebAssembly implementation is deferred until there's a user request for it.
Learnt from: lklimek
PR: dashpay/platform#2232
File: packages/rs-sdk/src/mock/sdk.rs:90-95
Timestamp: 2024-10-10T10:30:19.883Z
Learning: In `packages/rs-sdk/src/mock/sdk.rs`, the `load_expectations` method in `MockDashPlatformSdk` remains asynchronous (`async`) for backward compatibility, even though it now delegates to the synchronous `load_expectations_sync` method.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
Learnt from: lklimek
PR: dashpay/platform#2207
File: packages/rs-drive-proof-verifier/src/proof.rs:1646-1664
Timestamp: 2024-10-04T14:16:05.798Z
Learning: In the implementation of `FromProof<platform::GetContestedResourceIdentityVotesRequest>` in `packages/rs-drive-proof-verifier/src/proof.rs`, when matching `maybe_votes`, using `.expect()` on `v.into_iter().next()` is acceptable because the prior match arm `Some(v) if v.is_empty()` ensures that the map is not empty, preventing a panic.
Learnt from: lklimek
PR: dashpay/platform#2207
File: packages/rs-drive-proof-verifier/src/proof.rs:1646-1664
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the implementation of `FromProof<platform::GetContestedResourceIdentityVotesRequest>` in `packages/rs-drive-proof-verifier/src/proof.rs`, when matching `maybe_votes`, using `.expect()` on `v.into_iter().next()` is acceptable because the prior match arm `Some(v) if v.is_empty()` ensures that the map is not empty, preventing a panic.
Learnt from: shumkov
PR: dashpay/platform#2259
File: packages/rs-dapi-client/src/executor.rs:49-56
Timestamp: 2024-10-28T10:38:49.538Z
Learning: In `packages/rs-dapi-client/src/executor.rs`, the `ExecutionResponse` struct always has a non-optional `address` field of type `Address` because an address is always present when there's a successful response.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/src/executor.rs:38-38
Timestamp: 2024-10-29T14:44:01.184Z
Learning: In `packages/rs-dapi-client/src/executor.rs`, for the structs `ExecutionError<E>` and `ExecutionResponse<R>`, only the serde derives (`Serialize`, `Deserialize`) should be conditional based on the "mocks" feature; the other derives (`Debug`, `Clone`, `Eq`, `PartialEq`) should always be present.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/dapi-grpc/src/mock.rs:125-145
Timestamp: 2024-10-29T14:16:00.141Z
Learning: Using `serde_json` encoding produces deterministic output required to identify requests and responses by hash, therefore `serde_json` is used as the basic serialization algorithm for mocking.
Learnt from: QuantumExplorer
PR: dashpay/platform#2432
File: packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/mod.rs:222-225
Timestamp: 2025-01-20T16:20:59.791Z
Learning: In the Dash Platform codebase, TokenAmount from crate::balances::credits is compatible with u64 when used for token base supply.
Learnt from: QuantumExplorer
PR: dashpay/platform#2432
File: packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/mod.rs:222-225
Timestamp: 2025-01-20T16:20:59.791Z
Learning: In the Dash Platform codebase, TokenAmount is defined as `type TokenAmount = u64` in balances/credits.rs, making it directly compatible with u64 values without any conversion needed.
packages/wasm-sdk/src/queries/group.rs (3)
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/rs-sdk/src/sync.rs:88-95
Timestamp: 2025-01-23T09:23:32.740Z
Learning: The `block_on` function in `packages/rs-sdk/src/sync.rs` is currently only used in tests, and its WebAssembly implementation is deferred until there's a user request for it.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.
packages/wasm-sdk/src/queries/voting.rs (14)
Learnt from: lklimek
PR: dashpay/platform#2207
File: packages/rs-drive-proof-verifier/src/proof.rs:1646-1664
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the implementation of `FromProof<platform::GetContestedResourceIdentityVotesRequest>` in `packages/rs-drive-proof-verifier/src/proof.rs`, when matching `maybe_votes`, using `.expect()` on `v.into_iter().next()` is acceptable because the prior match arm `Some(v) if v.is_empty()` ensures that the map is not empty, preventing a panic.
Learnt from: lklimek
PR: dashpay/platform#2207
File: packages/rs-drive-proof-verifier/src/proof.rs:1646-1664
Timestamp: 2024-10-04T14:16:05.798Z
Learning: In the implementation of `FromProof<platform::GetContestedResourceIdentityVotesRequest>` in `packages/rs-drive-proof-verifier/src/proof.rs`, when matching `maybe_votes`, using `.expect()` on `v.into_iter().next()` is acceptable because the prior match arm `Some(v) if v.is_empty()` ensures that the map is not empty, preventing a panic.
Learnt from: shumkov
PR: dashpay/platform#2422
File: packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs:152-163
Timestamp: 2025-01-15T08:09:59.365Z
Learning: In the `transition_to_version_8` function, errors from `grove_get_path_query` when retrieving active contested resource votes are intentionally logged and ignored (returning `Ok(())`) to allow the protocol upgrade to proceed despite query failures.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/rs-sdk/src/sync.rs:88-95
Timestamp: 2025-01-23T09:23:32.740Z
Learning: The `block_on` function in `packages/rs-sdk/src/sync.rs` is currently only used in tests, and its WebAssembly implementation is deferred until there's a user request for it.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/src/core/transaction.rs:0-0
Timestamp: 2024-10-29T14:40:54.727Z
Learning: In `packages/rs-sdk/src/platform/document_query.rs` and `packages/rs-sdk/src/core/transaction.rs`, certain places don't implement `IntoInner`, so direct error mappings cannot be simplified using `IntoInner`. A TODO comment has been added to address this in a future PR.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/src/platform/fetch_unproved.rs:0-0
Timestamp: 2024-10-30T11:04:33.634Z
Learning: In `packages/rs-sdk/src/platform/fetch_unproved.rs`, the `execute()` method consumes the request object, so cloning the request is necessary before passing it to `execute()` and `maybe_from_unproved_with_metadata`.
Learnt from: lklimek
PR: dashpay/platform#2232
File: packages/rs-sdk/src/mock/sdk.rs:90-95
Timestamp: 2024-10-10T10:30:19.883Z
Learning: In `packages/rs-sdk/src/mock/sdk.rs`, the `load_expectations` method in `MockDashPlatformSdk` remains asynchronous (`async`) for backward compatibility, even though it now delegates to the synchronous `load_expectations_sync` method.
Learnt from: shumkov
PR: dashpay/platform#2259
File: packages/rs-dapi-client/src/dapi_client.rs:137-139
Timestamp: 2024-10-22T10:53:12.111Z
Learning: In `packages/rs-dapi-client/src/dapi_client.rs`, when passing data into asynchronous code, ensure that data structures are `Send + Sync`. Using `Arc<AtomicUsize>` is necessary for the retry counter.
Learnt from: QuantumExplorer
PR: dashpay/platform#2644
File: packages/rs-drive/src/cache/system_contracts.rs:18-19
Timestamp: 2025-05-28T16:22:26.334Z
Learning: In packages/rs-drive/src/cache/system_contracts.rs, the `active_since_protocol_version` field in `ActiveSystemDataContract` struct is intentionally added for future use, not current implementation. QuantumExplorer confirmed this is "meant for later" when questioned about the `#[allow(unused)]` attribute.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-sdk/tests/fetch/config.rs:233-233
Timestamp: 2024-10-30T11:19:59.163Z
Learning: In the Rust SDK's `rs-sdk/tests` integration tests (e.g., in `packages/rs-sdk/tests/fetch/config.rs`), we cannot create objects during tests because there is no support for object creation in this context. Therefore, hardcoded values for test identities must be used.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/dapi-grpc/src/mock.rs:125-145
Timestamp: 2024-10-29T14:16:00.141Z
Learning: Using `serde_json` encoding produces deterministic output required to identify requests and responses by hash, therefore `serde_json` is used as the basic serialization algorithm for mocking.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/src/executor.rs:38-38
Timestamp: 2024-10-29T14:44:01.184Z
Learning: In `packages/rs-dapi-client/src/executor.rs`, for the structs `ExecutionError<E>` and `ExecutionResponse<R>`, only the serde derives (`Serialize`, `Deserialize`) should be conditional based on the "mocks" feature; the other derives (`Debug`, `Clone`, `Eq`, `PartialEq`) should always be present.
🧬 Code Graph Analysis (1)
packages/wasm-sdk/src/queries/epoch.rs (3)
packages/rs-sdk/src/platform/fetch_many.rs (1)
fetch_many_with_metadata_and_proof
(203-253)packages/wasm-sdk/src/queries/mod.rs (2)
from
(59-68)from
(73-82)packages/wasm-sdk/src/sdk.rs (1)
from
(43-45)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (18)
- GitHub Check: Rust packages (dash-sdk) / Check each feature
- GitHub Check: Rust packages (dash-sdk) / Formatting
- GitHub Check: Rust packages (dash-sdk) / Tests
- GitHub Check: Rust packages (wasm-dpp) / Tests
- GitHub Check: Rust packages (drive-abci) / Formatting
- GitHub Check: Rust packages (drive-abci) / Check each feature
- GitHub Check: Rust packages (drive) / Tests
- GitHub Check: Rust packages (drive-abci) / Linting
- GitHub Check: Rust packages (drive) / Linting
- GitHub Check: Rust packages (dpp) / Check each feature
- GitHub Check: Rust packages (wasm-dpp) / Linting
- GitHub Check: Rust packages (dpp) / Tests
- GitHub Check: Rust packages (dpp) / Linting
- GitHub Check: Build Docker images (Drive, drive, drive-abci) / Build Drive image
- GitHub Check: Build Docker images (Dashmate helper, dashmate-helper, dashmate-helper) / Build Dashmate helper image
- GitHub Check: Build Docker images (DAPI, dapi, dapi) / Build DAPI image
- GitHub Check: Build JS packages / Build JS
- GitHub Check: build-wasm-sdk
🔇 Additional comments (23)
packages/wasm-sdk/src/queries/mod.rs (3)
1-22
: Module structure looks good!The addition of the
dpns
module and its re-export follows the established pattern for query modules.
24-56
: Well-structured response types for proof metadata.The generic
ProofMetadataResponse<T>
provides good reusability across different query types, and the field naming conventions are consistent.
58-69
: Clean type conversion implementation.The
From
trait implementation provides a clean conversion from the platform type.packages/wasm-sdk/src/queries/protocol.rs (2)
5-5
: Appropriate trait import for explicit serialization.The blank import alias allows for explicit
serialize
method calls, which is the correct pattern for the json_compatible serialization approach.
107-154
: Well-implemented proof-aware protocol query.The function correctly extends the existing query with proof metadata and follows the established pattern.
packages/wasm-sdk/src/queries/data_contract.rs (4)
3-3
: Required imports added.
29-57
: Clean implementation of proof-aware data contract fetch.Properly handles both Some and None cases with appropriate error messages.
146-202
: Consistent serialization and proof-aware history query.The serialization update and new proof-aware function follow the established patterns correctly.
204-245
: Well-implemented batch query with proof support.packages/wasm-sdk/src/queries/document.rs (5)
2-4
: Required imports for proof support and JS interop.
490-564
: Proper handling of single document with proof.Both Some and None cases are correctly handled with appropriate proof metadata.
566-643
: Good refactoring to support multiple usernames.The function now properly returns all usernames for an identity with configurable limit. The hardcoded DPNS contract ID is appropriate as per platform design.
645-661
: Excellent backward compatibility approach.The function maintains the original API while leveraging the new implementation.
666-778
: Well-implemented proof-aware DPNS queries.Both functions correctly extend the DPNS queries with proof support while maintaining API consistency.
packages/wasm-sdk/src/queries/system.rs (4)
5-5
: Consistent trait import pattern.
205-208
: Consistent serialization updates.All serialization points properly updated to use the json_compatible serializer.
Also applies to: 236-249
368-396
: Clean implementation of proof-aware credits query.
398-490
: Well-implemented proof-aware system queries.Both functions correctly extend the existing queries with proof metadata support.
packages/wasm-sdk/src/queries/group.rs (1)
15-16
: Good visibility changes for proof-aware functions.Making these structs public allows them to be used in the new proof-aware query responses. This is a necessary change for the API expansion.
Also applies to: 19-19, 249-249, 256-256
packages/wasm-sdk/src/queries/token.rs (1)
76-77
: Excellent consistency in serialization migration.All serialization calls have been consistently updated from
serde_wasm_bindgen::to_value
to useserde_wasm_bindgen::Serializer::json_compatible()
. This ensures JSON-compatible output across all token query functions.Also applies to: 155-156, 229-230, 279-280, 348-349, 390-393, 459-462, 495-498
packages/wasm-sdk/src/queries/identity.rs (3)
126-129
: Good addition of input validationThe consistent addition of empty ID validation across all identity query functions improves robustness and provides clear error messages to users.
Also applies to: 186-189, 224-227, 266-273, 317-324, 368-371, 457-460, 755-758, 823-826, 910-913
214-217
: Consistent use of json_compatible serializerThe uniform adoption of
serde_wasm_bindgen::Serializer::json_compatible()
across all response serialization ensures proper JSON output for WASM consumption and prevents potential serialization issues.Also applies to: 251-255, 302-306, 357-361, 392-396, 476-480, 813-816, 852-856, 899-903, 935-939, 975-979, 1047-1051, 1169-1173, 1228-1232
47-56
: Well-structured proof metadata response patternThe consistent use of
ProofMetadataResponse
across all proof-info functions provides a uniform API for returning data with cryptographic proofs and metadata. This pattern enhances verifiability and maintains consistency with other query modules in the PR.Also applies to: 245-250, 351-356, 806-811, 846-851, 893-898, 929-934, 969-974, 1041-1046, 1149-1168, 1222-1227
pub async fn identity_fetch_unproved(sdk: &WasmSdk, base58_id: &str) -> Result<IdentityWasm, JsError> { | ||
use dash_sdk::platform::proto::get_identity_request::{GetIdentityRequestV0, Version as GetIdentityRequestVersion}; | ||
use dash_sdk::platform::proto::get_identity_response::{get_identity_response_v0, GetIdentityResponseV0, Version}; | ||
use dash_sdk::platform::proto::{GetIdentityRequest, GetIdentityResponse}; | ||
use rs_dapi_client::{DapiRequest, RequestSettings}; | ||
|
||
let id = Identifier::from_string( | ||
base58_id, | ||
dash_sdk::dpp::platform_value::string_encoding::Encoding::Base58, | ||
)?; | ||
|
||
let request = GetIdentityRequest { | ||
version: Some(GetIdentityRequestVersion::V0(GetIdentityRequestV0 { | ||
id: id.to_vec(), | ||
prove: false, // Request without proof | ||
})), | ||
}; | ||
|
||
let response: GetIdentityResponse = request | ||
.execute(sdk.as_ref(), RequestSettings::default()) | ||
.await | ||
.map_err(|e| JsError::new(&format!("Failed to fetch identity: {}", e)))? | ||
.into_inner(); | ||
|
||
match response.version { | ||
Some(Version::V0(GetIdentityResponseV0 { | ||
result: Some(get_identity_response_v0::Result::Identity(identity_bytes)), | ||
.. | ||
})) => { | ||
use dash_sdk::dpp::serialization::PlatformDeserializable; | ||
let identity = Identity::deserialize_from_bytes( | ||
identity_bytes.as_slice() | ||
)?; | ||
Ok(identity.into()) | ||
} | ||
_ => Err(JsError::new("Identity not found")), | ||
} | ||
} |
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.
🛠️ Refactor suggestion
Consider using SDK abstractions instead of raw proto types
The identity_fetch_unproved
function directly uses proto types and manual deserialization, which bypasses the SDK's abstraction layer. This approach makes the code more fragile to protocol changes and harder to maintain.
Consider refactoring to use SDK abstractions if available, or document why raw proto usage is necessary here.
🤖 Prompt for AI Agents
In packages/wasm-sdk/src/queries/identity.rs between lines 63 and 100, the
function identity_fetch_unproved uses raw protobuf types and manual
deserialization, which bypasses the SDK's abstraction layer and reduces
maintainability. Refactor the function to use the SDK's higher-level
abstractions or API methods for fetching identities if available. If no such
abstractions exist, add clear documentation explaining why direct proto usage is
necessary to justify this approach.
// TODO: Implement get_vote_polls_by_end_date | ||
// This function should return vote polls filtered by end date | ||
let _ = (sdk, start_time_info, end_time_info, limit, order_ascending); | ||
|
||
// Return empty result for now | ||
let result = serde_json::json!({ | ||
"votePolls": [], | ||
"metadata": {} | ||
}); | ||
|
||
serde_wasm_bindgen::to_value(&result) | ||
.map_err(|e| JsError::new(&format!("Failed to serialize response: {}", e))) | ||
} |
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.
🛠️ Refactor suggestion
Use consistent serialization method and complete the implementation.
This function has the same serialization inconsistency and TODO stub implementation.
Apply the json_compatible serializer for consistency with other functions in this file.
🤖 Prompt for AI Agents
In packages/wasm-sdk/src/queries/voting.rs around lines 152 to 164, the function
is currently a stub returning an empty result and uses
serde_wasm_bindgen::to_value for serialization, which is inconsistent with other
functions. Complete the implementation to actually filter and return vote polls
by end date, and replace serde_wasm_bindgen::to_value with the json_compatible
serializer to maintain consistency in serialization across the file.
#[wasm_bindgen] | ||
pub async fn get_contested_resources_with_proof_info( | ||
sdk: &WasmSdk, | ||
document_type_name: &str, | ||
data_contract_id: &str, | ||
index_name: &str, | ||
_result_type: &str, | ||
_allow_include_locked_and_abstaining_vote_tally: Option<bool>, | ||
start_at_value: Option<Vec<u8>>, | ||
limit: Option<u32>, | ||
_offset: Option<u32>, | ||
order_ascending: Option<bool>, | ||
) -> Result<JsValue, JsError> { | ||
use crate::queries::{ProofMetadataResponse, ResponseMetadata, ProofInfo}; | ||
|
||
// Parse contract ID | ||
let contract_id = Identifier::from_string( | ||
data_contract_id, | ||
dash_sdk::dpp::platform_value::string_encoding::Encoding::Base58, | ||
)?; | ||
|
||
// Parse result_type to get start_index_values | ||
// For now, we'll use the standard "dash" parent domain | ||
let start_index_values = vec!["dash".as_bytes().to_vec()]; | ||
|
||
// Create start_at_value_info if provided | ||
let start_at_value_info = start_at_value.map(|bytes| { | ||
get_contested_resources_request::get_contested_resources_request_v0::StartAtValueInfo { | ||
start_value: bytes, | ||
start_value_included: true, | ||
} | ||
}); | ||
|
||
// Create the gRPC request directly - force prove=true for proof info | ||
let request = GetContestedResourcesRequest { | ||
version: Some(get_contested_resources_request::Version::V0( | ||
GetContestedResourcesRequestV0 { | ||
contract_id: contract_id.to_vec(), | ||
document_type_name: document_type_name.to_string(), | ||
index_name: index_name.to_string(), | ||
start_index_values, | ||
end_index_values: vec![], | ||
start_at_value_info, | ||
count: limit, | ||
order_ascending: order_ascending.unwrap_or(true), | ||
prove: true, // Always true for proof info version | ||
}, | ||
)), | ||
}; | ||
|
||
// Execute the request | ||
let response = sdk | ||
.as_ref() | ||
.execute(request, RequestSettings::default()) | ||
.await | ||
.map_err(|e| JsError::new(&format!("Failed to get contested resources with proof: {}", e)))?; | ||
|
||
// Extract metadata and proof from response | ||
let metadata = response.inner.metadata() | ||
.map_err(|e| JsError::new(&format!("Failed to get metadata: {:?}", e)))?; | ||
|
||
let proof = response.inner.proof() | ||
.map_err(|e| JsError::new(&format!("Failed to get proof: {:?}", e)))?; | ||
|
||
// For now, return a simple response structure | ||
let data = serde_json::json!({ | ||
"contestedResources": [] | ||
}); | ||
|
||
let response = ProofMetadataResponse { | ||
data, | ||
metadata: metadata.clone().into(), | ||
proof: proof.clone().into(), | ||
}; | ||
|
||
// Use json_compatible serializer | ||
let serializer = serde_wasm_bindgen::Serializer::json_compatible(); | ||
response.serialize(&serializer) | ||
.map_err(|e| JsError::new(&format!("Failed to serialize response: {}", e))) | ||
} |
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.
🛠️ Refactor suggestion
Reduce code duplication between proof and non-proof variants.
This function duplicates most of the logic from get_contested_resources
with only minor differences:
- Forces
prove: true
instead of usingsdk.prove()
- Returns
ProofMetadataResponse
instead of raw data
Consider extracting the common logic into a shared helper function to reduce duplication and maintenance burden.
async fn get_contested_resources_impl(
sdk: &WasmSdk,
// ... parameters ...
prove: bool,
) -> Result<GetContestedResourcesResponse, JsError> {
// Common implementation
}
Then both variants can call this shared implementation with different prove
values.
🤖 Prompt for AI Agents
In packages/wasm-sdk/src/queries/voting.rs between lines 168 and 247, the
function get_contested_resources_with_proof_info duplicates most logic from
get_contested_resources except for forcing prove=true and returning a different
response type. To fix this, extract the shared request creation and execution
logic into a new async helper function (e.g., get_contested_resources_impl) that
accepts a prove boolean parameter and returns the common response type. Then
refactor both get_contested_resources and
get_contested_resources_with_proof_info to call this helper with appropriate
prove values and handle their specific response formatting separately, reducing
code duplication and easing maintenance.
// TODO: Implement get_contested_resource_identity_votes | ||
// This function should return all votes made by a specific identity | ||
let _ = (sdk, identity_id, limit, start_at_vote_poll_id_info, order_ascending); | ||
|
||
// Return empty result for now | ||
let result = serde_json::json!({ | ||
"votes": [], | ||
"metadata": {} | ||
}); | ||
|
||
serde_wasm_bindgen::to_value(&result) | ||
.map_err(|e| JsError::new(&format!("Failed to serialize response: {}", e))) | ||
} |
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.
🛠️ Refactor suggestion
Use consistent serialization method and complete the implementation.
This function has the same issues as get_contested_resource_voters_for_identity
:
- Uses
serde_wasm_bindgen::to_value
instead of the json_compatible serializer - TODO indicates incomplete implementation
Apply the same serialization fix as suggested for the previous function.
🤖 Prompt for AI Agents
In packages/wasm-sdk/src/queries/voting.rs around lines 130 to 142, the function
get_contested_resource_identity_votes is incomplete and uses
serde_wasm_bindgen::to_value for serialization, which is inconsistent with the
rest of the codebase. Complete the function implementation to return all votes
made by the specified identity and replace serde_wasm_bindgen::to_value with the
json_compatible serializer for consistent serialization.
// TODO: Implement get_contested_resource_voters_for_identity | ||
// This function should return voters for a specific identity in a contested resource | ||
let _ = (sdk, contract_id, document_type_name, index_name, index_values, | ||
contestant_id, start_at_voter_info, limit, order_ascending); | ||
|
||
// Return empty result for now | ||
let result = serde_json::json!({ | ||
"voters": [], | ||
"metadata": {} | ||
}); | ||
|
||
serde_wasm_bindgen::to_value(&result) | ||
.map_err(|e| JsError::new(&format!("Failed to serialize response: {}", e))) | ||
} |
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.
🛠️ Refactor suggestion
Use consistent serialization method and complete the implementation.
- This function uses
serde_wasm_bindgen::to_value
while other functions in this file use thejson_compatible
serializer. For consistency:
- serde_wasm_bindgen::to_value(&result)
- .map_err(|e| JsError::new(&format!("Failed to serialize response: {}", e)))
+ // Use json_compatible serializer
+ let serializer = serde_wasm_bindgen::Serializer::json_compatible();
+ result.serialize(&serializer)
+ .map_err(|e| JsError::new(&format!("Failed to serialize response: {}", e)))
- The TODO comment indicates this is a stub implementation returning empty data.
Would you like me to help implement the actual functionality or create an issue to track this TODO?
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
// TODO: Implement get_contested_resource_voters_for_identity | |
// This function should return voters for a specific identity in a contested resource | |
let _ = (sdk, contract_id, document_type_name, index_name, index_values, | |
contestant_id, start_at_voter_info, limit, order_ascending); | |
// Return empty result for now | |
let result = serde_json::json!({ | |
"voters": [], | |
"metadata": {} | |
}); | |
serde_wasm_bindgen::to_value(&result) | |
.map_err(|e| JsError::new(&format!("Failed to serialize response: {}", e))) | |
} | |
// TODO: Implement get_contested_resource_voters_for_identity | |
// This function should return voters for a specific identity in a contested resource | |
let _ = (sdk, contract_id, document_type_name, index_name, index_values, | |
contestant_id, start_at_voter_info, limit, order_ascending); | |
// Return empty result for now | |
let result = serde_json::json!({ | |
"voters": [], | |
"metadata": {} | |
}); | |
// Use json_compatible serializer | |
let serializer = serde_wasm_bindgen::Serializer::json_compatible(); | |
result.serialize(&serializer) | |
.map_err(|e| JsError::new(&format!("Failed to serialize response: {}", e))) | |
} |
🤖 Prompt for AI Agents
In packages/wasm-sdk/src/queries/voting.rs around lines 107 to 120, the function
currently uses serde_wasm_bindgen::to_value for serialization, which is
inconsistent with other functions that use the json_compatible serializer. To
fix this, replace serde_wasm_bindgen::to_value with the json_compatible
serialization method for consistency. Additionally, since the function is a stub
returning empty data, either implement the actual logic to fetch voters for a
specific identity in a contested resource or create a tracking issue for this
TODO to address it later.
…as HTML Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
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
♻️ Duplicate comments (2)
packages/wasm-sdk/index.html (2)
3886-3904
:parseInt
without validation can yieldNaN
and bypass key-existence checksIf the user types
:
,:abc
or leaves the suffix empty,parseInt(parts[1])
becomesNaN
.
BecauseNaN === key.id
is alwaysfalse
, the subsequent lookup silently fails and we throw “Key … not found”, hiding the real problem.- keyId = parseInt(parts[1]); + keyId = Number(parts[1]); + if (!Number.isInteger(keyId) || keyId < 0) { + throw new Error(`Invalid keyId suffix “${parts[1]}” – expected a non-negative integer`); + }
991-994
: Stale importget_dpns_username
is still presentThe WASM side renamed the export to
get_dpns_usernames
.
Keeping the old symbol will raise a runtimeReferenceError
during module instantiation.
Remove the obsolete import line.- get_dpns_username,
🧹 Nitpick comments (3)
packages/wasm-sdk/index.html (3)
2804-2809
: Comment contradicts implementation of proof-toggleThe inline comment says “proof toggle ON → raw JSON (no proofs)” but
useProofs
is set totrue
when the checkbox is checked and every branch guarded byuseProofs
calls the*_with_proof_info
functions.
Please either flip the boolean logic or correct the comment – at the moment the documentation is misleading.
3188-3191
: Boolean name is backwards – considerwithProofs
for clarity
useProofs
istrue
when the check-box is checked, i.e. when the user wants proofs.
A name such aswithProofs
/includeProofs
would match that semantics and avoid the double-negative that currently exists when reading the code.
375-406
: Missing styles for new banner variants (warning
,info
)
updateStatus()
assigns classesstatus-banner warning
andstatus-banner info
, but the stylesheet only defines.success
,.error
, and.loading
.
Without CSS the banner falls back to default styles and becomes invisible on some themes.Add explicit rules, for example:
+.status-banner.warning { + background-color: #ff9800; + color: #fff; +} + +.status-banner.info { + background-color: #2196f3; + color: #fff; +}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
package.json
(1 hunks)packages/rs-drive/Cargo.toml
(3 hunks)packages/wasm-sdk/index.html
(37 hunks)
✅ Files skipped from review due to trivial changes (1)
- package.json
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/rs-drive/Cargo.toml
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: QuantumExplorer
PR: dashpay/platform#2690
File: packages/wasm-sdk/src/queries/document.rs:383-384
Timestamp: 2025-07-10T00:37:09.565Z
Learning: In the Dash platform, DPNS (Dash Platform Name Service) contracts have the same ID across all networks (mainnet, testnet, etc.), so hardcoding the DPNS contract ID is appropriate and doesn't need to be configurable.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
Learnt from: shumkov
PR: dashpay/platform#2270
File: packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js:69-125
Timestamp: 2024-10-24T05:07:35.892Z
Learning: Future development plans involve rewriting DAPI into Rust, as the rest of the project has already migrated.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts is already handled in the data contract validation process, specifically in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs.
Learnt from: shumkov
PR: dashpay/platform#2489
File: packages/rs-dpp/Cargo.toml:32-32
Timestamp: 2025-03-11T09:39:23.071Z
Learning: In the Dash Platform project, dependencies are currently managed using Git repository references with tags (repo+tag format in Cargo.toml) rather than published crates, as the team is not currently publishing crates to crates.io.
Learnt from: shumkov
PR: dashpay/platform#2206
File: packages/rs-platform-version/src/version/protocol_version.rs:155-157
Timestamp: 2024-10-04T09:08:48.470Z
Learning: In the dashmate default configurations, the default protocol version for local networks has been removed, and an update mechanism for the protocol version in the consensus parameters has been implemented.
Learnt from: shumkov
PR: dashpay/platform#2206
File: packages/rs-platform-version/src/version/protocol_version.rs:155-157
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the dashmate default configurations, the default protocol version for local networks has been removed, and an update mechanism for the protocol version in the consensus parameters has been implemented.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts (ensuring it's between 3 and 100 characters) is already handled at the data contract validation level in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs, making additional checks in the update operations redundant.
Learnt from: lklimek
PR: dashpay/platform#2254
File: packages/rs-sdk/src/sdk.rs:585-585
Timestamp: 2024-10-18T15:39:51.172Z
Learning: The 'platform' project uses Rust version 1.80, so code in 'packages/rs-sdk' can use features available in Rust 1.80, such as the `abs_diff()` method.
Learnt from: QuantumExplorer
PR: dashpay/platform#2644
File: packages/rs-drive/src/cache/system_contracts.rs:18-19
Timestamp: 2025-05-28T16:22:26.334Z
Learning: In packages/rs-drive/src/cache/system_contracts.rs, the `active_since_protocol_version` field in `ActiveSystemDataContract` struct is intentionally added for future use, not current implementation. QuantumExplorer confirmed this is "meant for later" when questioned about the `#[allow(unused)]` attribute.
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/src/mimic/test_quorum.rs:159-164
Timestamp: 2024-11-20T16:16:01.830Z
Learning: QuantumExplorer prefers not to receive auto-generated messages asking to post on social media.
Learnt from: QuantumExplorer
PR: dashpay/platform#2439
File: packages/rs-dpp/src/errors/consensus/state/token/mod.rs:4-22
Timestamp: 2025-01-23T02:10:08.979Z
Learning: The user QuantumExplorer prefers to handle documentation of breaking changes separately from the code changes, particularly for token-related error types and validation rules.
Learnt from: QuantumExplorer
PR: dashpay/platform#2673
File: packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs:1164-1197
Timestamp: 2025-06-18T03:44:14.385Z
Learning: QuantumExplorer determined that a CodeRabbit suggestion about fixing signable_bytes calculation in identity update tests with contract-bound keys was incorrect - the code flow is working as intended without the suggested changes.
packages/wasm-sdk/index.html (23)
undefined
<retrieved_learning>
Learnt from: lklimek
PR: #2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2439
File: packages/rs-dpp/src/errors/consensus/state/token/mod.rs:4-22
Timestamp: 2025-01-23T02:10:08.979Z
Learning: The user QuantumExplorer prefers to handle documentation of breaking changes separately from the code changes, particularly for token-related error types and validation rules.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2317
File: packages/rs-dapi-client/src/address_list.rs:175-180
Timestamp: 2024-11-28T13:49:17.301Z
Learning: In Rust code in packages/rs-dapi-client/src/address_list.rs
, do not change the interface of deprecated methods like add_uri
, even to fix potential panics.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2314
File: packages/wallet-contract/test/bootstrap.js:14-16
Timestamp: 2024-11-06T07:27:01.722Z
Learning: In packages/wallet-contract/test/bootstrap.js
, for Mocha tests in Node.js, async functions like loadWasmDpp
can be assigned directly to beforeAll
without wrapping them in another async function.
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the IdentityTransitionVersions
structure within packages/rs-platform-version/src/version/v2.rs
, the field credit_withdrawal
does not need the identity_
prefix since it is already encompassed within identity state transitions.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-03T11:51:06.980Z
Learning: In the IdentityTransitionVersions
structure within packages/rs-platform-version/src/version/v2.rs
, the field credit_withdrawal
does not need the identity_
prefix since it is already encompassed within identity state transitions.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2277
File: packages/rs-sdk/src/core/transaction.rs:0-0
Timestamp: 2024-10-29T14:40:54.727Z
Learning: In packages/rs-sdk/src/platform/document_query.rs
and packages/rs-sdk/src/core/transaction.rs
, certain places don't implement IntoInner
, so direct error mappings cannot be simplified using IntoInner
. A TODO comment has been added to address this in a future PR.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2673
File: packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs:1164-1197
Timestamp: 2025-06-18T03:44:14.385Z
Learning: QuantumExplorer determined that a CodeRabbit suggestion about fixing signable_bytes calculation in identity update tests with contract-bound keys was incorrect - the code flow is working as intended without the suggested changes.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2365
File: packages/dashmate/src/listr/tasks/ssl/zerossl/obtainZeroSSLCertificateTaskFactory.js:206-213
Timestamp: 2024-12-03T05:47:30.524Z
Learning: In obtainZeroSSLCertificateTaskFactory.js
, when handling ZeroSSL API errors during domain verification, the error detail structure is consistent when an error occurs, so additional null checks on e.details[ctx.externalIp]
may not be necessary.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2257
File: packages/rs-drive-abci/tests/strategy_tests/masternodes.rs:212-220
Timestamp: 2024-11-20T20:43:41.185Z
Learning: In packages/rs-drive-abci/tests/strategy_tests/masternodes.rs
, the pattern of generating a PrivateKey
, converting it to bytes, and reconstructing a BlsPrivateKey
from those bytes is intentional. Avoid suggesting to simplify this code in future reviews.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2381
File: packages/rs-sdk/scripts/connect_to_remote.sh:0-0
Timestamp: 2024-12-10T12:39:38.182Z
Learning: When reviewing scripts in packages/rs-sdk/scripts/
, avoid suggesting additional error handling and timeout management that complicate the script without adding significant value.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2257
File: packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs:148-151
Timestamp: 2024-11-20T16:05:40.200Z
Learning: In packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs
, when converting public keys from QuorumForSavingV0
to VerificationQuorum
, it's acceptable to use .expect()
for public key conversion, as the conversion has been verified and panics are acceptable in this context.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2690
File: packages/wasm-sdk/src/queries/document.rs:383-384
Timestamp: 2025-07-10T00:37:09.565Z
Learning: In the Dash platform, DPNS (Dash Platform Name Service) contracts have the same ID across all networks (mainnet, testnet, etc.), so hardcoding the DPNS contract ID is appropriate and doesn't need to be configurable.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2277
File: packages/rs-sdk/tests/fetch/config.rs:233-233
Timestamp: 2024-10-30T11:19:59.163Z
Learning: In the Rust SDK's rs-sdk/tests
integration tests (e.g., in packages/rs-sdk/tests/fetch/config.rs
), we cannot create objects during tests because there is no support for object creation in this context. Therefore, hardcoded values for test identities must be used.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2405
File: packages/rs-sdk/src/sync.rs:88-95
Timestamp: 2025-01-23T09:23:32.740Z
Learning: The block_on
function in packages/rs-sdk/src/sync.rs
is currently only used in tests, and its WebAssembly implementation is deferred until there's a user request for it.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2277
File: packages/rs-sdk/src/platform/fetch_unproved.rs:0-0
Timestamp: 2024-10-30T11:04:33.634Z
Learning: In packages/rs-sdk/src/platform/fetch_unproved.rs
, the execute()
method consumes the request object, so cloning the request is necessary before passing it to execute()
and maybe_from_unproved_with_metadata
.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2207
File: packages/rs-drive-proof-verifier/src/proof.rs:1646-1664
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the implementation of FromProof<platform::GetContestedResourceIdentityVotesRequest>
in packages/rs-drive-proof-verifier/src/proof.rs
, when matching maybe_votes
, using .expect()
on v.into_iter().next()
is acceptable because the prior match arm Some(v) if v.is_empty()
ensures that the map is not empty, preventing a panic.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2207
File: packages/rs-drive-proof-verifier/src/proof.rs:1646-1664
Timestamp: 2024-10-04T14:16:05.798Z
Learning: In the implementation of FromProof<platform::GetContestedResourceIdentityVotesRequest>
in packages/rs-drive-proof-verifier/src/proof.rs
, when matching maybe_votes
, using .expect()
on v.into_iter().next()
is acceptable because the prior match arm Some(v) if v.is_empty()
ensures that the map is not empty, preventing a panic.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2232
File: packages/rs-sdk/src/mock/sdk.rs:90-95
Timestamp: 2024-10-10T10:30:19.883Z
Learning: In packages/rs-sdk/src/mock/sdk.rs
, the load_expectations
method in MockDashPlatformSdk
remains asynchronous (async
) for backward compatibility, even though it now delegates to the synchronous load_expectations_sync
method.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2347
File: packages/rs-drive/tests/query_tests.rs:438-460
Timestamp: 2024-11-25T01:17:02.001Z
Learning: In Rust test files (packages/rs-drive/tests/query_tests.rs
), when code is used only in tests, defining explicit enums for fields (like the status
field in the Withdrawal
struct) may not be necessary; using primitive types is acceptable.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2270
File: packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js:90-96
Timestamp: 2024-10-24T05:01:51.097Z
Learning: In broadcastStateTransitionHandlerFactory.js
, error handling when querying transaction status is handled in the API script.
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Documents and data contracts should use state transitions for updates
</retrieved_learning>
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (19)
- GitHub Check: Rust packages (drive-abci) / Tests
- GitHub Check: Rust packages (drive) / Unused dependencies
- GitHub Check: Rust packages (drive) / Linting
- GitHub Check: Rust packages (wasm-dpp) / Tests
- GitHub Check: Rust packages (wasm-dpp) / Linting
- GitHub Check: Rust packages (wasm-dpp) / Unused dependencies
- GitHub Check: Rust packages (wasm-dpp) / Formatting
- GitHub Check: Rust packages (dash-sdk) / Linting
- GitHub Check: Rust packages (dash-sdk) / Tests
- GitHub Check: Rust packages (dash-sdk) / Check each feature
- GitHub Check: Rust packages (dpp) / Unused dependencies
- GitHub Check: Rust packages (dash-sdk) / Unused dependencies
- GitHub Check: Rust packages (dpp) / Linting
- GitHub Check: Rust packages (dpp) / Tests
- GitHub Check: Rust packages (dpp) / Check each feature
- GitHub Check: Build Docker images (Drive, drive, drive-abci) / Build Drive image
- 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-wasm-sdk
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: 1
♻️ Duplicate comments (2)
packages/wasm-sdk/index.html (2)
991-993
: Remove staleget_dpns_username
import – runtime will break once the export disappearsThe WASM layer no longer exports
get_dpns_username
. Importing the obsolete symbol will throw aReferenceError
at instantiation time and abort page initialisation.
Keep only the newget_dpns_usernames
-related imports.
3885-3904
:keyId
parsing still fragile – guard againstNaN
and invalid levels
parseInt(parts[1])
may yieldNaN
(empty suffix or non-numeric). ANaN
key id silently bypasses the existence checks and produces misleading “key not found” errors later.- keyId = parseInt(parts[1]); + keyId = Number(parts[1]); + if (!Number.isInteger(keyId) || keyId < 0) { + throw new Error(`Invalid keyId suffix “${parts[1]}” – expected a non-negative integer`); + }While touching this code, prefer early-returning if the selected public key has
securityLevel === 0
to avoid deep nesting.
🧹 Nitpick comments (1)
packages/wasm-sdk/index.html (1)
2805-2810
: Inconsistent comment: “proof toggle ON returns raw JSON”The surrounding code treats
proofToggle.checked === true
as include proof, e.g. it routes to*_with_proof_info
functions (see lines 3189–3204).
The explanatory comment here claims exactly the opposite, which will confuse future maintainers.Update the comment (or the logic) so that behaviour and documentation match.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/wasm-sdk/index.html
(37 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: QuantumExplorer
PR: dashpay/platform#2690
File: packages/wasm-sdk/src/queries/document.rs:383-384
Timestamp: 2025-07-10T00:37:09.565Z
Learning: In the Dash platform, DPNS (Dash Platform Name Service) contracts have the same ID across all networks (mainnet, testnet, etc.), so hardcoding the DPNS contract ID is appropriate and doesn't need to be configurable.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
Learnt from: shumkov
PR: dashpay/platform#2270
File: packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js:69-125
Timestamp: 2024-10-24T05:07:35.892Z
Learning: Future development plans involve rewriting DAPI into Rust, as the rest of the project has already migrated.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts is already handled in the data contract validation process, specifically in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs.
Learnt from: shumkov
PR: dashpay/platform#2489
File: packages/rs-dpp/Cargo.toml:32-32
Timestamp: 2025-03-11T09:39:23.071Z
Learning: In the Dash Platform project, dependencies are currently managed using Git repository references with tags (repo+tag format in Cargo.toml) rather than published crates, as the team is not currently publishing crates to crates.io.
Learnt from: shumkov
PR: dashpay/platform#2206
File: packages/rs-platform-version/src/version/protocol_version.rs:155-157
Timestamp: 2024-10-04T09:08:48.470Z
Learning: In the dashmate default configurations, the default protocol version for local networks has been removed, and an update mechanism for the protocol version in the consensus parameters has been implemented.
Learnt from: shumkov
PR: dashpay/platform#2206
File: packages/rs-platform-version/src/version/protocol_version.rs:155-157
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the dashmate default configurations, the default protocol version for local networks has been removed, and an update mechanism for the protocol version in the consensus parameters has been implemented.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts (ensuring it's between 3 and 100 characters) is already handled at the data contract validation level in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs, making additional checks in the update operations redundant.
Learnt from: lklimek
PR: dashpay/platform#2254
File: packages/rs-sdk/src/sdk.rs:585-585
Timestamp: 2024-10-18T15:39:51.172Z
Learning: The 'platform' project uses Rust version 1.80, so code in 'packages/rs-sdk' can use features available in Rust 1.80, such as the `abs_diff()` method.
Learnt from: QuantumExplorer
PR: dashpay/platform#2644
File: packages/rs-drive/src/cache/system_contracts.rs:18-19
Timestamp: 2025-05-28T16:22:26.334Z
Learning: In packages/rs-drive/src/cache/system_contracts.rs, the `active_since_protocol_version` field in `ActiveSystemDataContract` struct is intentionally added for future use, not current implementation. QuantumExplorer confirmed this is "meant for later" when questioned about the `#[allow(unused)]` attribute.
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/src/mimic/test_quorum.rs:159-164
Timestamp: 2024-11-20T16:16:01.830Z
Learning: QuantumExplorer prefers not to receive auto-generated messages asking to post on social media.
Learnt from: QuantumExplorer
PR: dashpay/platform#2439
File: packages/rs-dpp/src/errors/consensus/state/token/mod.rs:4-22
Timestamp: 2025-01-23T02:10:08.979Z
Learning: The user QuantumExplorer prefers to handle documentation of breaking changes separately from the code changes, particularly for token-related error types and validation rules.
Learnt from: QuantumExplorer
PR: dashpay/platform#2673
File: packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs:1164-1197
Timestamp: 2025-06-18T03:44:14.385Z
Learning: QuantumExplorer determined that a CodeRabbit suggestion about fixing signable_bytes calculation in identity update tests with contract-bound keys was incorrect - the code flow is working as intended without the suggested changes.
packages/wasm-sdk/index.html (23)
undefined
<retrieved_learning>
Learnt from: lklimek
PR: #2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2439
File: packages/rs-dpp/src/errors/consensus/state/token/mod.rs:4-22
Timestamp: 2025-01-23T02:10:08.979Z
Learning: The user QuantumExplorer prefers to handle documentation of breaking changes separately from the code changes, particularly for token-related error types and validation rules.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2317
File: packages/rs-dapi-client/src/address_list.rs:175-180
Timestamp: 2024-11-28T13:49:17.301Z
Learning: In Rust code in packages/rs-dapi-client/src/address_list.rs
, do not change the interface of deprecated methods like add_uri
, even to fix potential panics.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2314
File: packages/wallet-contract/test/bootstrap.js:14-16
Timestamp: 2024-11-06T07:27:01.722Z
Learning: In packages/wallet-contract/test/bootstrap.js
, for Mocha tests in Node.js, async functions like loadWasmDpp
can be assigned directly to beforeAll
without wrapping them in another async function.
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the IdentityTransitionVersions
structure within packages/rs-platform-version/src/version/v2.rs
, the field credit_withdrawal
does not need the identity_
prefix since it is already encompassed within identity state transitions.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-03T11:51:06.980Z
Learning: In the IdentityTransitionVersions
structure within packages/rs-platform-version/src/version/v2.rs
, the field credit_withdrawal
does not need the identity_
prefix since it is already encompassed within identity state transitions.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2277
File: packages/rs-sdk/src/core/transaction.rs:0-0
Timestamp: 2024-10-29T14:40:54.727Z
Learning: In packages/rs-sdk/src/platform/document_query.rs
and packages/rs-sdk/src/core/transaction.rs
, certain places don't implement IntoInner
, so direct error mappings cannot be simplified using IntoInner
. A TODO comment has been added to address this in a future PR.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2673
File: packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs:1164-1197
Timestamp: 2025-06-18T03:44:14.385Z
Learning: QuantumExplorer determined that a CodeRabbit suggestion about fixing signable_bytes calculation in identity update tests with contract-bound keys was incorrect - the code flow is working as intended without the suggested changes.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2365
File: packages/dashmate/src/listr/tasks/ssl/zerossl/obtainZeroSSLCertificateTaskFactory.js:206-213
Timestamp: 2024-12-03T05:47:30.524Z
Learning: In obtainZeroSSLCertificateTaskFactory.js
, when handling ZeroSSL API errors during domain verification, the error detail structure is consistent when an error occurs, so additional null checks on e.details[ctx.externalIp]
may not be necessary.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2257
File: packages/rs-drive-abci/tests/strategy_tests/masternodes.rs:212-220
Timestamp: 2024-11-20T20:43:41.185Z
Learning: In packages/rs-drive-abci/tests/strategy_tests/masternodes.rs
, the pattern of generating a PrivateKey
, converting it to bytes, and reconstructing a BlsPrivateKey
from those bytes is intentional. Avoid suggesting to simplify this code in future reviews.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2381
File: packages/rs-sdk/scripts/connect_to_remote.sh:0-0
Timestamp: 2024-12-10T12:39:38.182Z
Learning: When reviewing scripts in packages/rs-sdk/scripts/
, avoid suggesting additional error handling and timeout management that complicate the script without adding significant value.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2257
File: packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs:148-151
Timestamp: 2024-11-20T16:05:40.200Z
Learning: In packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs
, when converting public keys from QuorumForSavingV0
to VerificationQuorum
, it's acceptable to use .expect()
for public key conversion, as the conversion has been verified and panics are acceptable in this context.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2690
File: packages/wasm-sdk/src/queries/document.rs:383-384
Timestamp: 2025-07-10T00:37:09.565Z
Learning: In the Dash platform, DPNS (Dash Platform Name Service) contracts have the same ID across all networks (mainnet, testnet, etc.), so hardcoding the DPNS contract ID is appropriate and doesn't need to be configurable.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2277
File: packages/rs-sdk/tests/fetch/config.rs:233-233
Timestamp: 2024-10-30T11:19:59.163Z
Learning: In the Rust SDK's rs-sdk/tests
integration tests (e.g., in packages/rs-sdk/tests/fetch/config.rs
), we cannot create objects during tests because there is no support for object creation in this context. Therefore, hardcoded values for test identities must be used.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2405
File: packages/rs-sdk/src/sync.rs:88-95
Timestamp: 2025-01-23T09:23:32.740Z
Learning: The block_on
function in packages/rs-sdk/src/sync.rs
is currently only used in tests, and its WebAssembly implementation is deferred until there's a user request for it.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2277
File: packages/rs-sdk/src/platform/fetch_unproved.rs:0-0
Timestamp: 2024-10-30T11:04:33.634Z
Learning: In packages/rs-sdk/src/platform/fetch_unproved.rs
, the execute()
method consumes the request object, so cloning the request is necessary before passing it to execute()
and maybe_from_unproved_with_metadata
.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2207
File: packages/rs-drive-proof-verifier/src/proof.rs:1646-1664
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the implementation of FromProof<platform::GetContestedResourceIdentityVotesRequest>
in packages/rs-drive-proof-verifier/src/proof.rs
, when matching maybe_votes
, using .expect()
on v.into_iter().next()
is acceptable because the prior match arm Some(v) if v.is_empty()
ensures that the map is not empty, preventing a panic.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2207
File: packages/rs-drive-proof-verifier/src/proof.rs:1646-1664
Timestamp: 2024-10-04T14:16:05.798Z
Learning: In the implementation of FromProof<platform::GetContestedResourceIdentityVotesRequest>
in packages/rs-drive-proof-verifier/src/proof.rs
, when matching maybe_votes
, using .expect()
on v.into_iter().next()
is acceptable because the prior match arm Some(v) if v.is_empty()
ensures that the map is not empty, preventing a panic.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2232
File: packages/rs-sdk/src/mock/sdk.rs:90-95
Timestamp: 2024-10-10T10:30:19.883Z
Learning: In packages/rs-sdk/src/mock/sdk.rs
, the load_expectations
method in MockDashPlatformSdk
remains asynchronous (async
) for backward compatibility, even though it now delegates to the synchronous load_expectations_sync
method.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2347
File: packages/rs-drive/tests/query_tests.rs:438-460
Timestamp: 2024-11-25T01:17:02.001Z
Learning: In Rust test files (packages/rs-drive/tests/query_tests.rs
), when code is used only in tests, defining explicit enums for fields (like the status
field in the Withdrawal
struct) may not be necessary; using primitive types is acceptable.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2270
File: packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js:90-96
Timestamp: 2024-10-24T05:01:51.097Z
Learning: In broadcastStateTransitionHandlerFactory.js
, error handling when querying transaction status is handled in the API script.
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Documents and data contracts should use state transitions for updates
</retrieved_learning>
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (17)
- GitHub Check: Rust packages (dash-sdk) / Linting
- GitHub Check: Rust packages (dash-sdk) / Tests
- GitHub Check: Rust packages (dash-sdk) / Check each feature
- GitHub Check: Rust packages (drive) / Tests
- GitHub Check: Rust packages (drive) / Unused dependencies
- GitHub Check: Rust packages (drive) / Formatting
- GitHub Check: Rust packages (drive) / Linting
- GitHub Check: Rust packages (drive-abci) / Linting
- GitHub Check: Rust packages (drive-abci) / Tests
- GitHub Check: Rust packages (drive-abci) / Check each feature
- GitHub Check: Rust packages (wasm-dpp) / Tests
- GitHub Check: Rust packages (wasm-dpp) / Unused dependencies
- GitHub Check: Rust packages (dpp) / Linting
- GitHub Check: Rust packages (dpp) / Tests
- GitHub Check: Rust packages (dpp) / Check each feature
- GitHub Check: Build Docker images (Drive, drive, drive-abci) / Build Drive image
- GitHub Check: build-wasm-sdk
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: 1
♻️ Duplicate comments (3)
packages/wasm-sdk/index.html (3)
991-995
: Obsoleteget_dpns_username
import is still present – remove to avoid runtime failureThe WASM side has dropped
get_dpns_username
. Importing a non-existent export will crash initialisation with
ReferenceError: import object field 'get_dpns_username' is not a Function
.- get_dpns_username, get_dpns_usernames,
2601-2608
: Precision loss convertingBigInt
→Number
for credit values
Number(creditsNum)
silently loses precision > 2⁵³-1. A single identity balance can exceed that (~90 Dash).
Keep calculations inBigInt
and format as string, as already suggested previously.
3884-3896
:keyId
extraction still vulnerable toNaN
– validate afterparseInt
parseInt(parts[1])
may yieldNaN
(empty or non-numeric suffix) which then fails the.find()
check in an opaque way (“Key ID NaN not found”).
Reject invalid input immediately.keyId = Number(parts[1]); -const publicKey = identityJSON.publicKeys.find(key => key.id === keyId); +if (!Number.isInteger(keyId) || keyId < 0) { + throw new Error(`Invalid keyId suffix “${parts[1]}” – expected a non-negative integer`); +} +const publicKey = identityJSON.publicKeys.find(key => key.id === keyId);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/rs-drive/src/util/object_size_info/contract_info.rs
(1 hunks)packages/wasm-sdk/index.html
(37 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/rs-drive/src/util/object_size_info/contract_info.rs
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: QuantumExplorer
PR: dashpay/platform#2690
File: packages/wasm-sdk/src/queries/document.rs:383-384
Timestamp: 2025-07-10T00:37:09.565Z
Learning: In the Dash platform, DPNS (Dash Platform Name Service) contracts have the same ID across all networks (mainnet, testnet, etc.), so hardcoding the DPNS contract ID is appropriate and doesn't need to be configurable.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
Learnt from: shumkov
PR: dashpay/platform#2270
File: packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js:69-125
Timestamp: 2024-10-24T05:07:35.892Z
Learning: Future development plans involve rewriting DAPI into Rust, as the rest of the project has already migrated.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts is already handled in the data contract validation process, specifically in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs.
Learnt from: shumkov
PR: dashpay/platform#2489
File: packages/rs-dpp/Cargo.toml:32-32
Timestamp: 2025-03-11T09:39:23.071Z
Learning: In the Dash Platform project, dependencies are currently managed using Git repository references with tags (repo+tag format in Cargo.toml) rather than published crates, as the team is not currently publishing crates to crates.io.
Learnt from: shumkov
PR: dashpay/platform#2206
File: packages/rs-platform-version/src/version/protocol_version.rs:155-157
Timestamp: 2024-10-04T09:08:48.470Z
Learning: In the dashmate default configurations, the default protocol version for local networks has been removed, and an update mechanism for the protocol version in the consensus parameters has been implemented.
Learnt from: shumkov
PR: dashpay/platform#2206
File: packages/rs-platform-version/src/version/protocol_version.rs:155-157
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the dashmate default configurations, the default protocol version for local networks has been removed, and an update mechanism for the protocol version in the consensus parameters has been implemented.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts (ensuring it's between 3 and 100 characters) is already handled at the data contract validation level in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs, making additional checks in the update operations redundant.
Learnt from: lklimek
PR: dashpay/platform#2254
File: packages/rs-sdk/src/sdk.rs:585-585
Timestamp: 2024-10-18T15:39:51.172Z
Learning: The 'platform' project uses Rust version 1.80, so code in 'packages/rs-sdk' can use features available in Rust 1.80, such as the `abs_diff()` method.
Learnt from: QuantumExplorer
PR: dashpay/platform#2644
File: packages/rs-drive/src/cache/system_contracts.rs:18-19
Timestamp: 2025-05-28T16:22:26.334Z
Learning: In packages/rs-drive/src/cache/system_contracts.rs, the `active_since_protocol_version` field in `ActiveSystemDataContract` struct is intentionally added for future use, not current implementation. QuantumExplorer confirmed this is "meant for later" when questioned about the `#[allow(unused)]` attribute.
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/src/mimic/test_quorum.rs:159-164
Timestamp: 2024-11-20T16:16:01.830Z
Learning: QuantumExplorer prefers not to receive auto-generated messages asking to post on social media.
Learnt from: QuantumExplorer
PR: dashpay/platform#2439
File: packages/rs-dpp/src/errors/consensus/state/token/mod.rs:4-22
Timestamp: 2025-01-23T02:10:08.979Z
Learning: The user QuantumExplorer prefers to handle documentation of breaking changes separately from the code changes, particularly for token-related error types and validation rules.
Learnt from: QuantumExplorer
PR: dashpay/platform#2673
File: packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs:1164-1197
Timestamp: 2025-06-18T03:44:14.385Z
Learning: QuantumExplorer determined that a CodeRabbit suggestion about fixing signable_bytes calculation in identity update tests with contract-bound keys was incorrect - the code flow is working as intended without the suggested changes.
packages/wasm-sdk/index.html (28)
undefined
<retrieved_learning>
Learnt from: lklimek
PR: #2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2439
File: packages/rs-dpp/src/errors/consensus/state/token/mod.rs:4-22
Timestamp: 2025-01-23T02:10:08.979Z
Learning: The user QuantumExplorer prefers to handle documentation of breaking changes separately from the code changes, particularly for token-related error types and validation rules.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2317
File: packages/rs-dapi-client/src/address_list.rs:175-180
Timestamp: 2024-11-28T13:49:17.301Z
Learning: In Rust code in packages/rs-dapi-client/src/address_list.rs
, do not change the interface of deprecated methods like add_uri
, even to fix potential panics.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2314
File: packages/wallet-contract/test/bootstrap.js:14-16
Timestamp: 2024-11-06T07:27:01.722Z
Learning: In packages/wallet-contract/test/bootstrap.js
, for Mocha tests in Node.js, async functions like loadWasmDpp
can be assigned directly to beforeAll
without wrapping them in another async function.
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the IdentityTransitionVersions
structure within packages/rs-platform-version/src/version/v2.rs
, the field credit_withdrawal
does not need the identity_
prefix since it is already encompassed within identity state transitions.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-03T11:51:06.980Z
Learning: In the IdentityTransitionVersions
structure within packages/rs-platform-version/src/version/v2.rs
, the field credit_withdrawal
does not need the identity_
prefix since it is already encompassed within identity state transitions.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2277
File: packages/rs-sdk/src/core/transaction.rs:0-0
Timestamp: 2024-10-29T14:40:54.727Z
Learning: In packages/rs-sdk/src/platform/document_query.rs
and packages/rs-sdk/src/core/transaction.rs
, certain places don't implement IntoInner
, so direct error mappings cannot be simplified using IntoInner
. A TODO comment has been added to address this in a future PR.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2673
File: packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs:1164-1197
Timestamp: 2025-06-18T03:44:14.385Z
Learning: QuantumExplorer determined that a CodeRabbit suggestion about fixing signable_bytes calculation in identity update tests with contract-bound keys was incorrect - the code flow is working as intended without the suggested changes.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2365
File: packages/dashmate/src/listr/tasks/ssl/zerossl/obtainZeroSSLCertificateTaskFactory.js:206-213
Timestamp: 2024-12-03T05:47:30.524Z
Learning: In obtainZeroSSLCertificateTaskFactory.js
, when handling ZeroSSL API errors during domain verification, the error detail structure is consistent when an error occurs, so additional null checks on e.details[ctx.externalIp]
may not be necessary.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2257
File: packages/rs-drive-abci/tests/strategy_tests/masternodes.rs:212-220
Timestamp: 2024-11-20T20:43:41.185Z
Learning: In packages/rs-drive-abci/tests/strategy_tests/masternodes.rs
, the pattern of generating a PrivateKey
, converting it to bytes, and reconstructing a BlsPrivateKey
from those bytes is intentional. Avoid suggesting to simplify this code in future reviews.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2381
File: packages/rs-sdk/scripts/connect_to_remote.sh:0-0
Timestamp: 2024-12-10T12:39:38.182Z
Learning: When reviewing scripts in packages/rs-sdk/scripts/
, avoid suggesting additional error handling and timeout management that complicate the script without adding significant value.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2257
File: packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs:148-151
Timestamp: 2024-11-20T16:05:40.200Z
Learning: In packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs
, when converting public keys from QuorumForSavingV0
to VerificationQuorum
, it's acceptable to use .expect()
for public key conversion, as the conversion has been verified and panics are acceptable in this context.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2688
File: packages/dash-platform-balance-checker/src/main.rs:196-199
Timestamp: 2025-07-02T06:05:28.473Z
Learning: In the Dash Platform, the correct conversion factor is 1 DASH = 100,000,000,000 credits (100 billion credits per DASH), not 1,000,000 credits as might be found in general web searches.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2432
File: packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/mod.rs:222-225
Timestamp: 2025-01-20T16:20:59.791Z
Learning: In the Dash Platform codebase, TokenAmount is defined as type TokenAmount = u64
in balances/credits.rs, making it directly compatible with u64 values without any conversion needed.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2432
File: packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/mod.rs:222-225
Timestamp: 2025-01-20T16:20:59.791Z
Learning: In the Dash Platform codebase, TokenAmount from crate::balances::credits is compatible with u64 when used for token base supply.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2182
File: packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/v0/mod.rs:23-31
Timestamp: 2024-10-09T00:22:57.778Z
Learning: Credits
is a u64
, and division by 10 won't cause an overflow.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2182
File: packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/v0/mod.rs:23-31
Timestamp: 2024-09-28T20:34:49.182Z
Learning: Credits
is a u64
, and division by 10 won't cause an overflow.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2690
File: packages/wasm-sdk/src/queries/document.rs:383-384
Timestamp: 2025-07-10T00:37:09.565Z
Learning: In the Dash platform, DPNS (Dash Platform Name Service) contracts have the same ID across all networks (mainnet, testnet, etc.), so hardcoding the DPNS contract ID is appropriate and doesn't need to be configurable.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2277
File: packages/rs-sdk/tests/fetch/config.rs:233-233
Timestamp: 2024-10-30T11:19:59.163Z
Learning: In the Rust SDK's rs-sdk/tests
integration tests (e.g., in packages/rs-sdk/tests/fetch/config.rs
), we cannot create objects during tests because there is no support for object creation in this context. Therefore, hardcoded values for test identities must be used.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2405
File: packages/rs-sdk/src/sync.rs:88-95
Timestamp: 2025-01-23T09:23:32.740Z
Learning: The block_on
function in packages/rs-sdk/src/sync.rs
is currently only used in tests, and its WebAssembly implementation is deferred until there's a user request for it.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2277
File: packages/rs-sdk/src/platform/fetch_unproved.rs:0-0
Timestamp: 2024-10-30T11:04:33.634Z
Learning: In packages/rs-sdk/src/platform/fetch_unproved.rs
, the execute()
method consumes the request object, so cloning the request is necessary before passing it to execute()
and maybe_from_unproved_with_metadata
.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2207
File: packages/rs-drive-proof-verifier/src/proof.rs:1646-1664
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the implementation of FromProof<platform::GetContestedResourceIdentityVotesRequest>
in packages/rs-drive-proof-verifier/src/proof.rs
, when matching maybe_votes
, using .expect()
on v.into_iter().next()
is acceptable because the prior match arm Some(v) if v.is_empty()
ensures that the map is not empty, preventing a panic.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2207
File: packages/rs-drive-proof-verifier/src/proof.rs:1646-1664
Timestamp: 2024-10-04T14:16:05.798Z
Learning: In the implementation of FromProof<platform::GetContestedResourceIdentityVotesRequest>
in packages/rs-drive-proof-verifier/src/proof.rs
, when matching maybe_votes
, using .expect()
on v.into_iter().next()
is acceptable because the prior match arm Some(v) if v.is_empty()
ensures that the map is not empty, preventing a panic.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2232
File: packages/rs-sdk/src/mock/sdk.rs:90-95
Timestamp: 2024-10-10T10:30:19.883Z
Learning: In packages/rs-sdk/src/mock/sdk.rs
, the load_expectations
method in MockDashPlatformSdk
remains asynchronous (async
) for backward compatibility, even though it now delegates to the synchronous load_expectations_sync
method.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2347
File: packages/rs-drive/tests/query_tests.rs:438-460
Timestamp: 2024-11-25T01:17:02.001Z
Learning: In Rust test files (packages/rs-drive/tests/query_tests.rs
), when code is used only in tests, defining explicit enums for fields (like the status
field in the Withdrawal
struct) may not be necessary; using primitive types is acceptable.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2270
File: packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js:90-96
Timestamp: 2024-10-24T05:01:51.097Z
Learning: In broadcastStateTransitionHandlerFactory.js
, error handling when querying transaction status is handled in the API script.
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Documents and data contracts should use state transitions for updates
</retrieved_learning>
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (17)
- GitHub Check: Rust packages (drive) / Tests
- GitHub Check: Rust packages (dpp) / Check each feature
- GitHub Check: Rust packages (drive-abci) / Check each feature
- GitHub Check: Rust packages (drive-abci) / Unused dependencies
- GitHub Check: Rust packages (drive-abci) / Formatting
- GitHub Check: Rust packages (drive-abci) / Tests
- GitHub Check: Rust packages (drive-abci) / Linting
- GitHub Check: Rust packages (wasm-dpp) / Formatting
- GitHub Check: Rust packages (dpp) / Formatting
- GitHub Check: Rust packages (wasm-dpp) / Linting
- GitHub Check: Rust packages (dpp) / Linting
- GitHub Check: Rust packages (wasm-dpp) / Unused dependencies
- GitHub Check: Rust packages (wasm-dpp) / Tests
- GitHub Check: Build Docker images (DAPI, dapi, dapi) / Build DAPI image
- GitHub Check: Build Docker images (Drive, drive, drive-abci) / Build Drive image
- GitHub Check: Build Docker images (Dashmate helper, dashmate-helper, dashmate-helper) / Build Dashmate helper image
- GitHub Check: build-wasm-sdk
…nto feat/dpnsImprovements
…nto feat/dpnsImprovements
…nto feat/dpnsImprovements
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: 1
♻️ Duplicate comments (2)
packages/wasm-sdk/index.html (2)
991-993
: Obsoleteget_dpns_username
import still present
The WASM exports were renamed toget_dpns_usernames
. Keeping the old symbol causes aReferenceError
at runtime (already reported in earlier review).Please drop the stale import line.
3905-3915
:keyId
parsing still fragile – validate the suffix
parseInt(parts[1])
may yieldNaN
or negative numbers which bypass the subsequent.find()
and trigger the misleading Key ID … not found error. Guard early:- keyId = parseInt(parts[1]); + keyId = Number(parts[1]); + if (!Number.isInteger(keyId) || keyId < 0) { + throw new Error(`Invalid keyId suffix “${parts[1]}” – expected a non-negative integer`); + }Also pass radix
10
toNumber
/parseInt
if you keep the latter.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/rs-dpp/src/withdrawal/mod.rs
(1 hunks)packages/wasm-sdk/index.html
(37 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/rs-dpp/src/withdrawal/mod.rs
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: QuantumExplorer
PR: dashpay/platform#2690
File: packages/wasm-sdk/src/queries/document.rs:383-384
Timestamp: 2025-07-10T00:37:09.565Z
Learning: In the Dash platform, DPNS (Dash Platform Name Service) contracts have the same ID across all networks (mainnet, testnet, etc.), so hardcoding the DPNS contract ID is appropriate and doesn't need to be configurable.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
Learnt from: lklimek
PR: dashpay/platform#2254
File: packages/rs-sdk/src/sdk.rs:585-585
Timestamp: 2024-10-18T15:39:51.172Z
Learning: The 'platform' project uses Rust version 1.80, so code in 'packages/rs-sdk' can use features available in Rust 1.80, such as the `abs_diff()` method.
Learnt from: shumkov
PR: dashpay/platform#2270
File: packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js:69-125
Timestamp: 2024-10-24T05:07:35.892Z
Learning: Future development plans involve rewriting DAPI into Rust, as the rest of the project has already migrated.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts is already handled in the data contract validation process, specifically in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts (ensuring it's between 3 and 100 characters) is already handled at the data contract validation level in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs, making additional checks in the update operations redundant.
Learnt from: shumkov
PR: dashpay/platform#2206
File: packages/rs-platform-version/src/version/protocol_version.rs:155-157
Timestamp: 2024-10-04T09:08:48.470Z
Learning: In the dashmate default configurations, the default protocol version for local networks has been removed, and an update mechanism for the protocol version in the consensus parameters has been implemented.
Learnt from: shumkov
PR: dashpay/platform#2206
File: packages/rs-platform-version/src/version/protocol_version.rs:155-157
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the dashmate default configurations, the default protocol version for local networks has been removed, and an update mechanism for the protocol version in the consensus parameters has been implemented.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/rs-sdk/src/sync.rs:88-95
Timestamp: 2025-01-23T09:23:32.740Z
Learning: The `block_on` function in `packages/rs-sdk/src/sync.rs` is currently only used in tests, and its WebAssembly implementation is deferred until there's a user request for it.
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/src/mimic/test_quorum.rs:159-164
Timestamp: 2024-11-20T16:16:01.830Z
Learning: QuantumExplorer prefers not to receive auto-generated messages asking to post on social media.
Learnt from: QuantumExplorer
PR: dashpay/platform#2439
File: packages/rs-dpp/src/errors/consensus/state/token/mod.rs:4-22
Timestamp: 2025-01-23T02:10:08.979Z
Learning: The user QuantumExplorer prefers to handle documentation of breaking changes separately from the code changes, particularly for token-related error types and validation rules.
Learnt from: QuantumExplorer
PR: dashpay/platform#2673
File: packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs:1164-1197
Timestamp: 2025-06-18T03:44:14.385Z
Learning: QuantumExplorer determined that a CodeRabbit suggestion about fixing signable_bytes calculation in identity update tests with contract-bound keys was incorrect - the code flow is working as intended without the suggested changes.
packages/wasm-sdk/index.html (30)
undefined
<retrieved_learning>
Learnt from: lklimek
PR: #2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2439
File: packages/rs-dpp/src/errors/consensus/state/token/mod.rs:4-22
Timestamp: 2025-01-23T02:10:08.979Z
Learning: The user QuantumExplorer prefers to handle documentation of breaking changes separately from the code changes, particularly for token-related error types and validation rules.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2317
File: packages/rs-dapi-client/src/address_list.rs:175-180
Timestamp: 2024-11-28T13:49:17.301Z
Learning: In Rust code in packages/rs-dapi-client/src/address_list.rs
, do not change the interface of deprecated methods like add_uri
, even to fix potential panics.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2314
File: packages/wallet-contract/test/bootstrap.js:14-16
Timestamp: 2024-11-06T07:27:01.722Z
Learning: In packages/wallet-contract/test/bootstrap.js
, for Mocha tests in Node.js, async functions like loadWasmDpp
can be assigned directly to beforeAll
without wrapping them in another async function.
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the IdentityTransitionVersions
structure within packages/rs-platform-version/src/version/v2.rs
, the field credit_withdrawal
does not need the identity_
prefix since it is already encompassed within identity state transitions.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-03T11:51:06.980Z
Learning: In the IdentityTransitionVersions
structure within packages/rs-platform-version/src/version/v2.rs
, the field credit_withdrawal
does not need the identity_
prefix since it is already encompassed within identity state transitions.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2277
File: packages/rs-sdk/src/core/transaction.rs:0-0
Timestamp: 2024-10-29T14:40:54.727Z
Learning: In packages/rs-sdk/src/platform/document_query.rs
and packages/rs-sdk/src/core/transaction.rs
, certain places don't implement IntoInner
, so direct error mappings cannot be simplified using IntoInner
. A TODO comment has been added to address this in a future PR.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2673
File: packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs:1164-1197
Timestamp: 2025-06-18T03:44:14.385Z
Learning: QuantumExplorer determined that a CodeRabbit suggestion about fixing signable_bytes calculation in identity update tests with contract-bound keys was incorrect - the code flow is working as intended without the suggested changes.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2365
File: packages/dashmate/src/listr/tasks/ssl/zerossl/obtainZeroSSLCertificateTaskFactory.js:206-213
Timestamp: 2024-12-03T05:47:30.524Z
Learning: In obtainZeroSSLCertificateTaskFactory.js
, when handling ZeroSSL API errors during domain verification, the error detail structure is consistent when an error occurs, so additional null checks on e.details[ctx.externalIp]
may not be necessary.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2257
File: packages/rs-drive-abci/tests/strategy_tests/masternodes.rs:212-220
Timestamp: 2024-11-20T20:43:41.185Z
Learning: In packages/rs-drive-abci/tests/strategy_tests/masternodes.rs
, the pattern of generating a PrivateKey
, converting it to bytes, and reconstructing a BlsPrivateKey
from those bytes is intentional. Avoid suggesting to simplify this code in future reviews.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2381
File: packages/rs-sdk/scripts/connect_to_remote.sh:0-0
Timestamp: 2024-12-10T12:39:38.182Z
Learning: When reviewing scripts in packages/rs-sdk/scripts/
, avoid suggesting additional error handling and timeout management that complicate the script without adding significant value.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2257
File: packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs:148-151
Timestamp: 2024-11-20T16:05:40.200Z
Learning: In packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs
, when converting public keys from QuorumForSavingV0
to VerificationQuorum
, it's acceptable to use .expect()
for public key conversion, as the conversion has been verified and panics are acceptable in this context.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2688
File: packages/dash-platform-balance-checker/src/main.rs:196-199
Timestamp: 2025-07-02T06:05:28.473Z
Learning: In the Dash Platform, the correct conversion factor is 1 DASH = 100,000,000,000 credits (100 billion credits per DASH), not 1,000,000 credits as might be found in general web searches.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2432
File: packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/mod.rs:222-225
Timestamp: 2025-01-20T16:20:59.791Z
Learning: In the Dash Platform codebase, TokenAmount is defined as type TokenAmount = u64
in balances/credits.rs, making it directly compatible with u64 values without any conversion needed.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2432
File: packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/mod.rs:222-225
Timestamp: 2025-01-20T16:20:59.791Z
Learning: In the Dash Platform codebase, TokenAmount from crate::balances::credits is compatible with u64 when used for token base supply.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2182
File: packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/v0/mod.rs:23-31
Timestamp: 2024-10-09T00:22:57.778Z
Learning: Credits
is a u64
, and division by 10 won't cause an overflow.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2182
File: packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/v0/mod.rs:23-31
Timestamp: 2024-09-28T20:34:49.182Z
Learning: Credits
is a u64
, and division by 10 won't cause an overflow.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2332
File: packages/rs-drive-proof-verifier/src/error.rs:21-23
Timestamp: 2024-11-15T14:39:23.704Z
Learning: In the packages/rs-drive-proof-verifier
, avoid suggesting size limits for proof_bytes
in errors unless there's a specific need, as it may not be necessary.
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use rs-drive-proof-verifier
for cryptographic proof verification
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2690
File: packages/wasm-sdk/src/queries/document.rs:383-384
Timestamp: 2025-07-10T00:37:09.565Z
Learning: In the Dash platform, DPNS (Dash Platform Name Service) contracts have the same ID across all networks (mainnet, testnet, etc.), so hardcoding the DPNS contract ID is appropriate and doesn't need to be configurable.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2277
File: packages/rs-sdk/tests/fetch/config.rs:233-233
Timestamp: 2024-10-30T11:19:59.163Z
Learning: In the Rust SDK's rs-sdk/tests
integration tests (e.g., in packages/rs-sdk/tests/fetch/config.rs
), we cannot create objects during tests because there is no support for object creation in this context. Therefore, hardcoded values for test identities must be used.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2405
File: packages/rs-sdk/src/sync.rs:88-95
Timestamp: 2025-01-23T09:23:32.740Z
Learning: The block_on
function in packages/rs-sdk/src/sync.rs
is currently only used in tests, and its WebAssembly implementation is deferred until there's a user request for it.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2277
File: packages/rs-sdk/src/platform/fetch_unproved.rs:0-0
Timestamp: 2024-10-30T11:04:33.634Z
Learning: In packages/rs-sdk/src/platform/fetch_unproved.rs
, the execute()
method consumes the request object, so cloning the request is necessary before passing it to execute()
and maybe_from_unproved_with_metadata
.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2207
File: packages/rs-drive-proof-verifier/src/proof.rs:1646-1664
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the implementation of FromProof<platform::GetContestedResourceIdentityVotesRequest>
in packages/rs-drive-proof-verifier/src/proof.rs
, when matching maybe_votes
, using .expect()
on v.into_iter().next()
is acceptable because the prior match arm Some(v) if v.is_empty()
ensures that the map is not empty, preventing a panic.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2207
File: packages/rs-drive-proof-verifier/src/proof.rs:1646-1664
Timestamp: 2024-10-04T14:16:05.798Z
Learning: In the implementation of FromProof<platform::GetContestedResourceIdentityVotesRequest>
in packages/rs-drive-proof-verifier/src/proof.rs
, when matching maybe_votes
, using .expect()
on v.into_iter().next()
is acceptable because the prior match arm Some(v) if v.is_empty()
ensures that the map is not empty, preventing a panic.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2232
File: packages/rs-sdk/src/mock/sdk.rs:90-95
Timestamp: 2024-10-10T10:30:19.883Z
Learning: In packages/rs-sdk/src/mock/sdk.rs
, the load_expectations
method in MockDashPlatformSdk
remains asynchronous (async
) for backward compatibility, even though it now delegates to the synchronous load_expectations_sync
method.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2347
File: packages/rs-drive/tests/query_tests.rs:438-460
Timestamp: 2024-11-25T01:17:02.001Z
Learning: In Rust test files (packages/rs-drive/tests/query_tests.rs
), when code is used only in tests, defining explicit enums for fields (like the status
field in the Withdrawal
struct) may not be necessary; using primitive types is acceptable.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2270
File: packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js:90-96
Timestamp: 2024-10-24T05:01:51.097Z
Learning: In broadcastStateTransitionHandlerFactory.js
, error handling when querying transaction status is handled in the API script.
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Documents and data contracts should use state transitions for updates
</retrieved_learning>
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
- GitHub Check: Rust packages (drive) / Formatting
- GitHub Check: Rust packages (drive) / Unused dependencies
- GitHub Check: Rust packages (dpp) / Tests
- GitHub Check: Rust packages (dpp) / Check each feature
- GitHub Check: Rust packages (wasm-dpp) / Linting
- GitHub Check: Rust packages (dpp) / Formatting
- GitHub Check: Rust packages (dpp) / Unused dependencies
- GitHub Check: Rust packages (dpp) / Linting
- GitHub Check: Rust packages (dash-sdk) / Unused dependencies
- GitHub Check: Rust packages (dash-sdk) / Linting
- GitHub Check: Rust packages (dash-sdk) / Formatting
- GitHub Check: Rust packages (dash-sdk) / Check each feature
- GitHub Check: Rust packages (dash-sdk) / Tests
- GitHub Check: Rust packages (masternode-reward-shares-contract) / Tests
- GitHub Check: Rust packages (masternode-reward-shares-contract) / Linting
- GitHub Check: Build Docker images (Dashmate helper, dashmate-helper, dashmate-helper) / Build Dashmate helper image
- GitHub Check: Build Docker images (DAPI, dapi, dapi) / Build DAPI image
- GitHub Check: Build Docker images (Drive, drive, drive-abci) / Build Drive image
- GitHub Check: Build JS packages / Build JS
- GitHub Check: build-wasm-sdk
…nto feat/dpnsImprovements
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
♻️ Duplicate comments (2)
packages/wasm-sdk/index.html (2)
2829-2833
: Proof-toggle comment now matches code – issue resolved
Documentation and logic are consistent (checked ⇒ proof info shown).
3910-3928
:keyId
parsing still accepts NaN – add explicit validation
parseInt(parts[1])
yieldsNaN
for empty/non-numeric suffixes, leading to the misleading
Key ID NaN not found path that was highlighted previously.- keyId = parseInt(parts[1]); + keyId = Number(parts[1]); + if (!Number.isInteger(keyId) || keyId < 0) { + throw new Error(`Invalid keyId suffix “${parts[1]}” – expected a non-negative integer`); + }
🧹 Nitpick comments (1)
packages/wasm-sdk/build.sh (1)
19-20
: Validate script path & consider propagating user-supplied feature flagsThe hard-coded relative path (
$SCRIPT_DIR/../scripts/build-wasm.sh
) assumes the unified helper script always lives inpackages/scripts/
.
- If the helper gets relocated (which happened once in PR #2621), this call will break silently at runtime.
- Dropping the old
CARGO_BUILD_FEATURES
handling means callers can no longer build with a custom feature set without editing this file.You can make the call more robust and future-proof by (a) verifying the script exists before
exec
, and (b) forwarding an optionalCARGO_BUILD_FEATURES
env var (or--features
param) if it is defined:-BUILD_SCRIPT="$SCRIPT_DIR/../scripts/build-wasm.sh" +# Resolve helper script location and fail early if missing +BUILD_SCRIPT="$SCRIPT_DIR/../scripts/build-wasm.sh" +if [[ ! -x "$BUILD_SCRIPT" ]]; then + echo "Error: helper script not found at $BUILD_SCRIPT" >&2 + exit 1 +fi + +# Allow callers to override default features +FEATURE_ARGS=() +if [[ -n "${CARGO_BUILD_FEATURES:-}" ]]; then + FEATURE_ARGS=(--features "$CARGO_BUILD_FEATURES") +fi -exec "$SCRIPT_DIR/../scripts/build-wasm.sh" --package wasm-sdk --opt-level "$OPT_LEVEL" +exec "$BUILD_SCRIPT" --package wasm-sdk --opt-level "$OPT_LEVEL" "${FEATURE_ARGS[@]}"This keeps existing behaviour while re-enabling advanced use cases and fails fast on missing dependencies.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/wasm-sdk/build.sh
(1 hunks)packages/wasm-sdk/index.html
(37 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: QuantumExplorer
PR: dashpay/platform#2690
File: packages/wasm-sdk/src/queries/document.rs:383-384
Timestamp: 2025-07-10T00:37:09.565Z
Learning: In the Dash platform, DPNS (Dash Platform Name Service) contracts have the same ID across all networks (mainnet, testnet, etc.), so hardcoding the DPNS contract ID is appropriate and doesn't need to be configurable.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
Learnt from: lklimek
PR: dashpay/platform#2254
File: packages/rs-sdk/src/sdk.rs:585-585
Timestamp: 2024-10-18T15:39:51.172Z
Learning: The 'platform' project uses Rust version 1.80, so code in 'packages/rs-sdk' can use features available in Rust 1.80, such as the `abs_diff()` method.
Learnt from: shumkov
PR: dashpay/platform#2270
File: packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js:69-125
Timestamp: 2024-10-24T05:07:35.892Z
Learning: Future development plans involve rewriting DAPI into Rust, as the rest of the project has already migrated.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts is already handled in the data contract validation process, specifically in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs.
Learnt from: pauldelucia
PR: dashpay/platform#2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts (ensuring it's between 3 and 100 characters) is already handled at the data contract validation level in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs, making additional checks in the update operations redundant.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.
Learnt from: shumkov
PR: dashpay/platform#2206
File: packages/rs-platform-version/src/version/protocol_version.rs:155-157
Timestamp: 2024-10-04T09:08:48.470Z
Learning: In the dashmate default configurations, the default protocol version for local networks has been removed, and an update mechanism for the protocol version in the consensus parameters has been implemented.
Learnt from: shumkov
PR: dashpay/platform#2206
File: packages/rs-platform-version/src/version/protocol_version.rs:155-157
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the dashmate default configurations, the default protocol version for local networks has been removed, and an update mechanism for the protocol version in the consensus parameters has been implemented.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/rs-sdk/src/sync.rs:88-95
Timestamp: 2025-01-23T09:23:32.740Z
Learning: The `block_on` function in `packages/rs-sdk/src/sync.rs` is currently only used in tests, and its WebAssembly implementation is deferred until there's a user request for it.
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/src/mimic/test_quorum.rs:159-164
Timestamp: 2024-11-20T16:16:01.830Z
Learning: QuantumExplorer prefers not to receive auto-generated messages asking to post on social media.
Learnt from: QuantumExplorer
PR: dashpay/platform#2439
File: packages/rs-dpp/src/errors/consensus/state/token/mod.rs:4-22
Timestamp: 2025-01-23T02:10:08.979Z
Learning: The user QuantumExplorer prefers to handle documentation of breaking changes separately from the code changes, particularly for token-related error types and validation rules.
Learnt from: QuantumExplorer
PR: dashpay/platform#2673
File: packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs:1164-1197
Timestamp: 2025-06-18T03:44:14.385Z
Learning: QuantumExplorer determined that a CodeRabbit suggestion about fixing signable_bytes calculation in identity update tests with contract-bound keys was incorrect - the code flow is working as intended without the suggested changes.
packages/wasm-sdk/build.sh (10)
Learnt from: lklimek
PR: dashpay/platform#2254
File: packages/rs-sdk/src/sdk.rs:585-585
Timestamp: 2024-10-18T15:39:51.172Z
Learning: The 'platform' project uses Rust version 1.80, so code in 'packages/rs-sdk' can use features available in Rust 1.80, such as the `abs_diff()` method.
Learnt from: lklimek
PR: dashpay/platform#2277
File: packages/rs-dapi-client/Cargo.toml:22-22
Timestamp: 2024-10-29T10:42:00.521Z
Learning: In `packages/rs-dapi-client/Cargo.toml`, `backon` will not work without the `tokio-sleep` feature in our setup, so it's unnecessary to declare `tokio-sleep` as a separate feature in the `[features]` section.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.
Learnt from: shumkov
PR: dashpay/platform#2375
File: packages/rs-drive-abci/Cargo.toml:61-63
Timestamp: 2024-12-05T09:29:38.918Z
Learning: In the `drive-abci` package, avoid adding unused dependencies like `hashbrown` to `Cargo.toml`. The team relies on CI to detect dependency version issues.
Learnt from: shumkov
PR: dashpay/platform#2248
File: packages/rs-drive-abci/src/main.rs:106-111
Timestamp: 2024-10-17T08:52:54.300Z
Learning: In this project, the environment variable `CARGO_PKG_RUST_VERSION` is defined and can be used safely with the `env!` macro.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
Learnt from: lklimek
PR: dashpay/platform#2318
File: Dockerfile:0-0
Timestamp: 2024-11-13T10:31:39.746Z
Learning: In the `Dockerfile`, when building the RocksDB static library, the command `make static_lib` compiles in release mode with optimizations enabled by default, so additional optimization flags are unnecessary.
Learnt from: lklimek
PR: dashpay/platform#2381
File: packages/rs-sdk/scripts/connect_to_remote.sh:0-0
Timestamp: 2024-12-10T12:39:38.182Z
Learning: When reviewing scripts in `packages/rs-sdk/scripts/`, avoid suggesting additional error handling and timeout management that complicate the script without adding significant value.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/rs-sdk/src/sync.rs:88-95
Timestamp: 2025-01-23T09:23:32.740Z
Learning: The `block_on` function in `packages/rs-sdk/src/sync.rs` is currently only used in tests, and its WebAssembly implementation is deferred until there's a user request for it.
Learnt from: shumkov
PR: dashpay/platform#2314
File: packages/wallet-contract/test/bootstrap.js:14-16
Timestamp: 2024-11-06T07:27:01.722Z
Learning: In `packages/wallet-contract/test/bootstrap.js`, for Mocha tests in Node.js, async functions like `loadWasmDpp` can be assigned directly to `beforeAll` without wrapping them in another async function.
packages/wasm-sdk/index.html (30)
undefined
<retrieved_learning>
Learnt from: lklimek
PR: #2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2439
File: packages/rs-dpp/src/errors/consensus/state/token/mod.rs:4-22
Timestamp: 2025-01-23T02:10:08.979Z
Learning: The user QuantumExplorer prefers to handle documentation of breaking changes separately from the code changes, particularly for token-related error types and validation rules.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2317
File: packages/rs-dapi-client/src/address_list.rs:175-180
Timestamp: 2024-11-28T13:49:17.301Z
Learning: In Rust code in packages/rs-dapi-client/src/address_list.rs
, do not change the interface of deprecated methods like add_uri
, even to fix potential panics.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2314
File: packages/wallet-contract/test/bootstrap.js:14-16
Timestamp: 2024-11-06T07:27:01.722Z
Learning: In packages/wallet-contract/test/bootstrap.js
, for Mocha tests in Node.js, async functions like loadWasmDpp
can be assigned directly to beforeAll
without wrapping them in another async function.
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use WASM bindings to connect Rust and JavaScript code for cross-language integration
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the IdentityTransitionVersions
structure within packages/rs-platform-version/src/version/v2.rs
, the field credit_withdrawal
does not need the identity_
prefix since it is already encompassed within identity state transitions.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-03T11:51:06.980Z
Learning: In the IdentityTransitionVersions
structure within packages/rs-platform-version/src/version/v2.rs
, the field credit_withdrawal
does not need the identity_
prefix since it is already encompassed within identity state transitions.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2277
File: packages/rs-sdk/src/core/transaction.rs:0-0
Timestamp: 2024-10-29T14:40:54.727Z
Learning: In packages/rs-sdk/src/platform/document_query.rs
and packages/rs-sdk/src/core/transaction.rs
, certain places don't implement IntoInner
, so direct error mappings cannot be simplified using IntoInner
. A TODO comment has been added to address this in a future PR.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2673
File: packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs:1164-1197
Timestamp: 2025-06-18T03:44:14.385Z
Learning: QuantumExplorer determined that a CodeRabbit suggestion about fixing signable_bytes calculation in identity update tests with contract-bound keys was incorrect - the code flow is working as intended without the suggested changes.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2365
File: packages/dashmate/src/listr/tasks/ssl/zerossl/obtainZeroSSLCertificateTaskFactory.js:206-213
Timestamp: 2024-12-03T05:47:30.524Z
Learning: In obtainZeroSSLCertificateTaskFactory.js
, when handling ZeroSSL API errors during domain verification, the error detail structure is consistent when an error occurs, so additional null checks on e.details[ctx.externalIp]
may not be necessary.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2257
File: packages/rs-drive-abci/tests/strategy_tests/masternodes.rs:212-220
Timestamp: 2024-11-20T20:43:41.185Z
Learning: In packages/rs-drive-abci/tests/strategy_tests/masternodes.rs
, the pattern of generating a PrivateKey
, converting it to bytes, and reconstructing a BlsPrivateKey
from those bytes is intentional. Avoid suggesting to simplify this code in future reviews.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2381
File: packages/rs-sdk/scripts/connect_to_remote.sh:0-0
Timestamp: 2024-12-10T12:39:38.182Z
Learning: When reviewing scripts in packages/rs-sdk/scripts/
, avoid suggesting additional error handling and timeout management that complicate the script without adding significant value.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2257
File: packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs:148-151
Timestamp: 2024-11-20T16:05:40.200Z
Learning: In packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs
, when converting public keys from QuorumForSavingV0
to VerificationQuorum
, it's acceptable to use .expect()
for public key conversion, as the conversion has been verified and panics are acceptable in this context.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2688
File: packages/dash-platform-balance-checker/src/main.rs:196-199
Timestamp: 2025-07-02T06:05:28.473Z
Learning: In the Dash Platform, the correct conversion factor is 1 DASH = 100,000,000,000 credits (100 billion credits per DASH), not 1,000,000 credits as might be found in general web searches.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2432
File: packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/mod.rs:222-225
Timestamp: 2025-01-20T16:20:59.791Z
Learning: In the Dash Platform codebase, TokenAmount is defined as type TokenAmount = u64
in balances/credits.rs, making it directly compatible with u64 values without any conversion needed.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2432
File: packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/mod.rs:222-225
Timestamp: 2025-01-20T16:20:59.791Z
Learning: In the Dash Platform codebase, TokenAmount from crate::balances::credits is compatible with u64 when used for token base supply.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2182
File: packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/v0/mod.rs:23-31
Timestamp: 2024-10-09T00:22:57.778Z
Learning: Credits
is a u64
, and division by 10 won't cause an overflow.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2182
File: packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/v0/mod.rs:23-31
Timestamp: 2024-09-28T20:34:49.182Z
Learning: Credits
is a u64
, and division by 10 won't cause an overflow.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2332
File: packages/rs-drive-proof-verifier/src/error.rs:21-23
Timestamp: 2024-11-15T14:39:23.704Z
Learning: In the packages/rs-drive-proof-verifier
, avoid suggesting size limits for proof_bytes
in errors unless there's a specific need, as it may not be necessary.
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Use rs-drive-proof-verifier
for cryptographic proof verification
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2690
File: packages/wasm-sdk/src/queries/document.rs:383-384
Timestamp: 2025-07-10T00:37:09.565Z
Learning: In the Dash platform, DPNS (Dash Platform Name Service) contracts have the same ID across all networks (mainnet, testnet, etc.), so hardcoding the DPNS contract ID is appropriate and doesn't need to be configurable.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2277
File: packages/rs-sdk/tests/fetch/config.rs:233-233
Timestamp: 2024-10-30T11:19:59.163Z
Learning: In the Rust SDK's rs-sdk/tests
integration tests (e.g., in packages/rs-sdk/tests/fetch/config.rs
), we cannot create objects during tests because there is no support for object creation in this context. Therefore, hardcoded values for test identities must be used.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2405
File: packages/rs-sdk/src/sync.rs:88-95
Timestamp: 2025-01-23T09:23:32.740Z
Learning: The block_on
function in packages/rs-sdk/src/sync.rs
is currently only used in tests, and its WebAssembly implementation is deferred until there's a user request for it.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2277
File: packages/rs-sdk/src/platform/fetch_unproved.rs:0-0
Timestamp: 2024-10-30T11:04:33.634Z
Learning: In packages/rs-sdk/src/platform/fetch_unproved.rs
, the execute()
method consumes the request object, so cloning the request is necessary before passing it to execute()
and maybe_from_unproved_with_metadata
.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2207
File: packages/rs-drive-proof-verifier/src/proof.rs:1646-1664
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the implementation of FromProof<platform::GetContestedResourceIdentityVotesRequest>
in packages/rs-drive-proof-verifier/src/proof.rs
, when matching maybe_votes
, using .expect()
on v.into_iter().next()
is acceptable because the prior match arm Some(v) if v.is_empty()
ensures that the map is not empty, preventing a panic.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2207
File: packages/rs-drive-proof-verifier/src/proof.rs:1646-1664
Timestamp: 2024-10-04T14:16:05.798Z
Learning: In the implementation of FromProof<platform::GetContestedResourceIdentityVotesRequest>
in packages/rs-drive-proof-verifier/src/proof.rs
, when matching maybe_votes
, using .expect()
on v.into_iter().next()
is acceptable because the prior match arm Some(v) if v.is_empty()
ensures that the map is not empty, preventing a panic.
</retrieved_learning>
<retrieved_learning>
Learnt from: lklimek
PR: #2232
File: packages/rs-sdk/src/mock/sdk.rs:90-95
Timestamp: 2024-10-10T10:30:19.883Z
Learning: In packages/rs-sdk/src/mock/sdk.rs
, the load_expectations
method in MockDashPlatformSdk
remains asynchronous (async
) for backward compatibility, even though it now delegates to the synchronous load_expectations_sync
method.
</retrieved_learning>
<retrieved_learning>
Learnt from: QuantumExplorer
PR: #2347
File: packages/rs-drive/tests/query_tests.rs:438-460
Timestamp: 2024-11-25T01:17:02.001Z
Learning: In Rust test files (packages/rs-drive/tests/query_tests.rs
), when code is used only in tests, defining explicit enums for fields (like the status
field in the Withdrawal
struct) may not be necessary; using primitive types is acceptable.
</retrieved_learning>
<retrieved_learning>
Learnt from: shumkov
PR: #2270
File: packages/dapi/lib/grpcServer/handlers/platform/broadcastStateTransitionHandlerFactory.js:90-96
Timestamp: 2024-10-24T05:01:51.097Z
Learning: In broadcastStateTransitionHandlerFactory.js
, error handling when querying transaction status is handled in the API script.
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Documents and data contracts should use state transitions for updates
</retrieved_learning>
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
- GitHub Check: Rust packages (masternode-reward-shares-contract) / Unused dependencies
- GitHub Check: Rust packages (dpp) / Unused dependencies
- GitHub Check: Rust packages (masternode-reward-shares-contract) / Tests
- GitHub Check: Rust packages (masternode-reward-shares-contract) / Formatting
- GitHub Check: Rust packages (masternode-reward-shares-contract) / Linting
- GitHub Check: Rust packages (drive-abci) / Tests
- GitHub Check: Rust packages (drive-abci) / Check each feature
- GitHub Check: Rust packages (drive-abci) / Linting
- GitHub Check: Rust packages (dash-sdk) / Linting
- GitHub Check: Rust packages (drive-abci) / Unused dependencies
- GitHub Check: Rust packages (dash-sdk) / Tests
- GitHub Check: Rust packages (dash-sdk) / Unused dependencies
- GitHub Check: Rust packages (wasm-dpp) / Tests
- GitHub Check: Rust packages (drive) / Formatting
- GitHub Check: Rust packages (drive) / Linting
- GitHub Check: Rust packages (drive) / Tests
- GitHub Check: Rust packages (wasm-dpp) / Unused dependencies
- GitHub Check: Rust packages (wasm-dpp) / Linting
- GitHub Check: Build JS packages / Build JS
- GitHub Check: build-wasm-sdk
🔇 Additional comments (2)
packages/wasm-sdk/index.html (2)
3-5
: External DOMPurify script now loaded with SRI &crossorigin
– well done
This removes the CSP/XSS hole previously flagged.
989-997
: get_dpns_username is still exported via wasm_bindgen – no removal needed
The#[wasm_bindgen] pub async fn get_dpns_username(...)
in
packages/wasm-sdk/src/queries/document.rs
(lines 644–652) ensures that the function remains available to JavaScript. Keeping the import inpackages/wasm-sdk/index.html
is correct; no change required.Likely an incorrect or invalid review comment.
@CodeRabbit review |
✅ Actions performedReview triggered.
|
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.
Self Reviewed
Summary by CodeRabbit
New Features
Improvements
Bug Fixes
Documentation
Chores
Checklist:
For repository code-owners and collaborators only