Skip to content

Conversation

QuantumExplorer
Copy link
Member

@QuantumExplorer QuantumExplorer commented Sep 8, 2025

Issue being fixed or feature implemented

The purpose of this PR is to clean DPP of Clippy issues.

What was done?

Cleaned DPP of Clippy issues.

How Has This Been Tested?

CI

Breaking Changes

None

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

  • New Features

    • Added DocumentType V1 to support newer document definitions.
  • Refactor

    • PlatformVersion now passed by value in some versioned APIs.
    • Validation collectors generalized to accept broader container types.
    • Minor iteration and size-calculation adjustments with preserved behavior.
  • Style

    • Improved documentation formatting, including fenced ASCII diagrams.
  • Chores

    • Added lint allowlists to reduce compile-time warnings.
  • Tests

    • Updated tests and one expected serialization length.

Copy link
Contributor

coderabbitai bot commented Sep 8, 2025

Walkthrough

General lint-suppression and doc-formatting edits across crates; widened several validation collectors from &mut Vec<...> to &mut impl Extend<...>; added DocumentType::V1; small iterator/sum/math simplifications, a minor request-type parsing tweak in the DAPI client, and test updates for PlatformVersion-by-value.

Changes

Cohort / File(s) Summary
DAPI client: request type parsing
packages/rs-dapi-client/src/dump.rs
Switches last-segment extraction from split(':').last() to rsplit(':').next() in DumpData<T>::request_type().
DocumentType enum variant addition
packages/rs-dpp/src/data_contract/document_type/mod.rs
Adds DocumentType::V1(DocumentTypeV1) and #[allow(clippy::large_enum_variant)]; From derive now covers V1.
Try-from-schema API generalization
packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/... (v0, v1, mod.rs)
Replaces validation_operations: &mut Vec<ProtocolValidationOperation> with &mut impl Extend<ProtocolValidationOperation> and replaces push(...) with validation_operations.extend(std::iter::once(...)).
Create-document-types API generalization
packages/rs-dpp/src/data_contract/document_type/class_methods/create_document_types_from_document_schemas/v0/mod.rs
validation_operations parameter changed from &mut Vec<...> to &mut impl Extend<...>.
Iteration simplifications over map values
packages/rs-dpp/src/state_transition/.../identity_create_transition/v0/mod.rs, .../v0/v0_methods.rs, packages/wasm-dpp/src/identity/identity.rs
Replace `.iter().map(
Ceiling midpoint via div_ceil
packages/rs-dpp/src/data_contract/document_type/property/mod.rs
Replace manual ceil-average (... + 1) / 2 with (...).div_ceil(2) for protocol_version > 8.
Refund sum simplification
packages/rs-dpp/src/fee/fee_result/refunds.rs
Sum credits using credits_per_epoch.values().sum() instead of mapping then summing.
Asset lock proof Result→Option
packages/rs-dpp/src/identity/state_transition/asset_lock_proof/mod.rs
Replace match AssetLockProofType::try_from(...) with AssetLockProofType::try_from(...).ok().
PlatformVersion call-site updates (tests)
packages/rs-dpp/src/system_data_contracts.rs
Tests updated to pass PlatformVersion by value; expected serialized length adjusted (1757 → 1758).
Drive API tests map checks
packages/rs-dpp/src/data_contract/extra/drive_api_tests.rs
Replace .get(...).is_some() / .is_none() with .contains_key(...); remove ..Default::default() shorthand in two test structs.
Lint allowances added (crate/enums)
packages/rs-dpp/src/lib.rs, packages/rs-drive-abci/src/lib.rs, packages/rs-drive-proof-verifier/src/lib.rs, packages/strategy-tests/src/lib.rs, packages/strategy-tests/src/operations.rs, packages/rs-dpp/src/errors/..., packages/wasm-drive-verify/src/lib.rs
Add crate- and item-level #![allow(...)] / #[allow(...)] for clippy lints (e.g., result_large_err, large_enum_variant, type_complexity, too_many_arguments).
Docs/comment formatting
packages/rs-dpp/src/data_contract/associated_token/..., packages/rs-dpp/src/data_contract/document_type/methods/mod.rs, packages/rs-dpp/src/identity/identity_public_key/random.rs, packages/rs-drive-abci/src/execution/..., packages/rs-drive-proof-verifier/src/proof.rs, packages/rs-dpp/src/state_transition/.../data_contract_create_transition/methods/v0/mod.rs
Reflowing, re-indentation, and fenced code block formatting in doc-comments only.
StateTransition unused variable suppression
packages/rs-dpp/src/state_transition/mod.rs
Adds #[allow(unused_variables)] to deserialize_from_bytes_in_version; no logic change.
WASM drive verify: prelude conditional + lints
packages/wasm-drive-verify/src/lib.rs
Make wasm_bindgen import/start conditional on wasm32 and add clippy allows; no API changes.
Misc small edits in tests/examples
packages/rs-drive-abci/tests/..., packages/rs-platform-wallet/examples/basic_usage.rs
Minor destructuring simplifications, remove unused vars, and change mut to immutable where safe.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Caller
  participant DocumentTypeModule as DocumentType::try_from_schema
  participant V0 as DocumentTypeV0::try_from_schema
  participant V1 as DocumentTypeV1::try_from_schema

  Caller->>DocumentTypeModule: try_from_schema(schema, &mut impl Extend...)
  alt version == 0
    DocumentTypeModule->>V0: try_from_schema(..., &mut impl Extend...)
    V0-->>DocumentTypeModule: Result<DocumentTypeV0,...>
    DocumentTypeModule-->>Caller: DocumentType::V0(...)
  else version == 1
    DocumentTypeModule->>V1: try_from_schema(..., &mut impl Extend...)
    V1-->>DocumentTypeModule: Result<DocumentTypeV1,...>
    DocumentTypeModule-->>Caller: DocumentType::V1(...)
  end
  Note over DocumentTypeModule: validation_operations now accepts any Extend<ProtocolValidationOperation>
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • pauldelucia
  • shumkov

Poem

A rabbit hops through lint and line,
Adds V1 to enums with tidy sign.
Iterators trimmed, sums made neat,
Validation collectors now more fleet.
Thump-thump — small hops, the code feels fine. 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/cleanDppClippy

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (30)
packages/rs-dpp/src/identity/state_transition/asset_lock_proof/mod.rs (2)

166-176: Optional: collapse to a single expression for brevity.

Keeps intent clear and removes the local variable.

 pub fn type_from_raw_value(value: &Value) -> Option<AssetLockProofType> {
-    let proof_type_res = value.get_integer::<u8>("type");
-
-    match proof_type_res {
-        Ok(proof_type_int) => {
-            let proof_type = AssetLockProofType::try_from(proof_type_int);
-            proof_type.ok()
-        }
-        Err(_) => None,
-    }
+    value
+        .get_integer::<u8>("type")
+        .ok()
+        .and_then(|i| AssetLockProofType::try_from(i).ok())
 }

135-138: Optional: derive Copy for the small C-like enum.

This can reduce moves and is a common clippy suggestion for simple enums.

+#[derive(Copy, Clone)]
 pub enum AssetLockProofType {
     Instant = 0,
     Chain = 1,
 }
packages/rs-dpp/src/fee/fee_result/refunds.rs (5)

161-164: Consider overflow-safe accumulation

If Credits is a fixed-size integer (e.g., u64), summing across many epochs can overflow in release builds. Prefer saturating or checked accumulation to avoid wraparound.

Apply this diff to use saturating addition without changing the method’s signature:

-        let credits = credits_per_epoch.values().sum();
+        let credits: Credits = credits_per_epoch
+            .values()
+            .copied()
+            .fold(0 as Credits, |acc, v| acc.saturating_add(v));

125-128: Use saturating_add when merging per-epoch credits

Align overflow handling with the previous comment by avoiding potential wrap on addition here as well.

-                        .and_modify(|base_credits| *base_credits += credits)
+                        .and_modify(|base_credits| *base_credits = base_credits.saturating_add(credits))

141-143: Compare identifiers by bytes to avoid cross-type Eq surprises

Be explicit and consistent with get(...as_bytes()) usage.

-                if identifier == identity_id {
+                if identifier == *identity_id.as_bytes() {
                     return None;
                 }

55-56: Tighten overflow error message

The source type isn’t necessarily u64; keep the message generic.

-                        let epoch_index : u16 = encoded_epoch_index.try_into().map_err(|_| ProtocolError::Overflow("can't fit u64 epoch index from StorageRemovalPerEpochByIdentifier to u16 EpochIndex"))?;
+                        let epoch_index: u16 = encoded_epoch_index
+                            .try_into()
+                            .map_err(|_| ProtocolError::Overflow("can't fit epoch index into u16 EpochIndex"))?;

21-23: Polish docs grammar and punctuation

Minor wording improvements for clarity.

-/// There are additional work and storage required to process refunds
-/// To protect system from the spam and unnecessary work
-/// a dust refund limit is used
+/// There is additional work and storage required to process refunds.
+/// To protect the system from spam and unnecessary work,
+/// a dust refund limit is used.
packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/v0_methods.rs (1)

52-54: Remove redundant clone to stay clippy-clean and match the other site

public_key.clone() is unnecessary if Into<IdentityPublicKeyInCreation> is implemented for &IdentityPublicKey (as used in mod.rs). Use Into::into directly to avoid allocations.

Apply:

-            .values()
-            .map(|public_key| public_key.clone().into())
+            .values()
+            .map(Into::into)
packages/rs-drive-proof-verifier/src/proof.rs (5)

92-98: Fix return docs for maybe_from_proof()

Docs mention a tuple but the function returns Result<Option, Error>. Align bullets with the signature.

-    /// * `Ok(Some(object, metadata))` when the requested object was found in the proof.
-    /// * `Ok(None)` when the requested object was not found in the proof; this can be interpreted as proof of non-existence.
-    ///   For collections, returns Ok(None) if none of the requested objects were found.
+    /// * `Ok(Some(object))` when the requested object was found in the proof.
+    /// * `Ok(None)` when the requested object was not found in the proof; this can be interpreted as proof of non-existence.
+    ///   For collections, returns `Ok(None)` if none of the requested objects were found.

122-128: Fix return docs for maybe_from_proof_with_metadata()

The Ok variant returns (Option, ResponseMetadata, Proof), not an Option of a tuple.

-    /// * `Ok(Some((object, metadata)))` when the requested object was found in the proof.
-    /// * `Ok(None)` when the requested object was not found in the proof; this can be interpreted as proof of non-existence.
-    ///   For collections, returns Ok(None) if none of the requested objects were found.
+    /// * `Ok((Some(object), metadata, proof))` when the requested object was found in the proof.
+    /// * `Ok((None, metadata, proof))` when the requested object was not found in the proof; this can be interpreted as proof of non-existence.
+    ///   For collections, returns `Ok((None, metadata, proof))` if none of the requested objects were found.

155-157: Align documented error with implementation

Code returns Error::NotFound; docs say Error::DocumentMissingInProof.

-    /// * `Err(Error::DocumentMissingInProof)` when the requested object was not found in the proof.
+    /// * `Err(Error::NotFound)` when the requested object was not found in the proof.

189-191: Correct tuple shape in from_proof_with_metadata() docs

Return type is Result<(Self, ResponseMetadata), Error>.

-    /// * `Ok(Some(object, metadata))` when the requested object was found in the proof.
-    /// * `Err(Error::DocumentMissingInProof)` when the requested object was not found in the proof.
+    /// * `Ok((object, metadata))` when the requested object was found in the proof.
+    /// * `Err(Error::NotFound)` when the requested object was not found in the proof.

229-231: Correct tuple shape in from_proof_with_metadata_and_proof() docs

Return type is Result<(Self, ResponseMetadata, Proof), Error>.

-    /// * `Ok(Some(object, metadata, proof))` when the requested object was found in the proof.
-    /// * `Err(Error::DocumentMissingInProof)` when the requested object was not found in the proof.
+    /// * `Ok((object, metadata, proof))` when the requested object was found in the proof.
+    /// * `Err(Error::NotFound)` when the requested object was not found in the proof.
packages/rs-dpp/src/lib.rs (1)

6-6: Scope clippy::result_large_err to specific items
Remove the crate-level #![allow(clippy::result_large_err)] in packages/rs-dpp/src/lib.rs and apply #[allow(clippy::result_large_err)] only on the functions or modules that return large‐error Result types—this narrows the suppression to just the necessary code paths and prevents masking other warnings.

packages/rs-drive-proof-verifier/src/lib.rs (1)

3-3: OK to allow result_large_err at crate level

Given large error enums, this is reasonable. Revisit later to localize if we refactor error types.

packages/strategy-tests/src/operations.rs (4)

586-595: Avoid potential panic on invalid weights in choose_weighted_choice()

WeightedIndex::new(...) can error when all weights are zero. Handle the error instead of unwrap.

-            let dist = WeightedIndex::new(weights).unwrap();
+            let dist = match WeightedIndex::new(weights) {
+                Ok(d) => d,
+                Err(_) => return ResourceVoteChoice::Abstain,
+            };

88-90: Fix copy/paste in error text (TokenOp serialization)

Message says “DocumentOp” while serializing TokenOp.

-        bincode::encode_to_vec(document_op, config).map_err(|e| {
-            PlatformSerializationError(format!("unable to serialize DocumentOp: {}", e))
-        })
+        bincode::encode_to_vec(document_op, config).map_err(|e| {
+            PlatformSerializationError(format!("unable to serialize TokenOp: {}", e))
+        })

106-110: Fix copy/paste in error text (TokenOp deserialization)

Message says “DocumentOp” while deserializing TokenOp.

-            bincode::borrow_decode_from_slice(data, config)
-                .map_err(|e| {
-                    PlatformDeserializationError(format!("unable to deserialize DocumentOp: {}", e))
-                })?
+            bincode::borrow_decode_from_slice(data, config).map_err(|e| {
+                PlatformDeserializationError(format!("unable to deserialize TokenOp: {}", e))
+            })?

298-301: Fix copy/paste in error text (Operation deserialization)

Should reference Operation, not DocumentOp.

-            bincode::borrow_decode_from_slice(data, config)
-                .map_err(|e| {
-                    PlatformDeserializationError(format!("unable to deserialize DocumentOp: {}", e))
-                })?
+            bincode::borrow_decode_from_slice(data, config).map_err(|e| {
+                PlatformDeserializationError(format!("unable to deserialize Operation: {}", e))
+            })?
packages/rs-dpp/src/errors/consensus/consensus_error.rs (1)

30-31: OK to allow large_enum_variant on ConsensusError

Public error enums often aggregate data; documenting the rationale inline would help future readers.

packages/rs-drive-abci/src/lib.rs (1)

12-14: Crate-level allows acknowledged

Keeping clippy clean is good; consider localizing these allows over time to avoid masking unrelated warnings.

packages/rs-dpp/src/errors/protocol_error.rs (1)

45-45: Consider boxing large payload variants instead of suppressing Clippy

Allowing large_enum_variant is fine short-term, but boxing heavy fields (where practical) can reduce move costs and improve memory footprint for ProtocolError.

packages/rs-dapi-client/src/dump.rs (1)

106-109: Prefer splitting by :: and sanitize generics for filesystem safety

Type names can include generics (<...>) and module paths; consider:

  • Split by "::" (not ':') to avoid empty segments.
  • Strip generics and sanitize characters to ensure safe filenames on all platforms.

Apply this minimal change within the current method:

-        req_type.rsplit(':').next().unwrap_or(req_type).to_string()
+        req_type.rsplit("::").next().unwrap_or(req_type).to_string()

If you want stronger sanitization:

fn request_type() -> String {
    let req_type = std::any::type_name::<T>();
    let base = req_type.rsplit("::").next().unwrap_or(req_type);
    let base_no_generics = base.split('<').next().unwrap_or(base);
    base_no_generics
        .chars()
        .map(|c| match c {
            'A'..='Z' | 'a'..='z' | '0'..='9' | '-' | '_' => c,
            _ => '-',
        })
        .collect()
}
packages/rs-dpp/src/errors/consensus/basic/basic_error.rs (1)

106-106: Large enum variant suppression: acceptable, but consider targeted boxing

Keeping Clippy clean via allow is okay, though boxing the few largest variants would reduce move size and keep the enum lean.

packages/rs-dpp/src/state_transition/mod.rs (1)

307-309: Name the magic number for readability

268435456 is opaque; consider a named constant to document intent (e.g., upper bound for test builds).

Example:

const TEST_PROTOCOL_VERSION_UPPER_BOUND: ProtocolVersion = 268_435_456;
if active_version_range.contains(&_platform_version.protocol_version)
    || _platform_version.protocol_version > TEST_PROTOCOL_VERSION_UPPER_BOUND
{ /* ... */ }
packages/rs-dpp/src/system_data_contracts.rs (1)

171-196: Passing PlatformVersion by value: OK; length assertions are brittle

The pass-by-value updates look consistent. Consider asserting structural invariants instead of exact byte lengths to reduce test fragility across harmless encoding tweaks.

packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v0/mod.rs (1)

64-65: Scope lint allows and address the no-op expression instead.

Function-wide allows are broader than needed. You can:

  • Drop clippy::ptr_arg unless Clippy actually flags a specific param here.
  • Localize clippy::unnecessary_operation to the small cfg block, or remove the cause.

Minimal change without altering behavior:

-    #[allow(clippy::ptr_arg)]
-    #[allow(clippy::unnecessary_operation)]
+    // keep function clean; handle the specific lint at the callsite below

Then wrap the no-op creation under the cfg with a localized allow or make the intent explicit:

#[cfg(not(feature = "validation"))]
if full_validation {
    #[allow(clippy::unnecessary_operation)]
    {
        // keep the breadcrumb without returning to avoid test fallout
        let _ = ProtocolError::CorruptedCodeExecution(
            "validation is not enabled but is being called on try_from_schema".to_string(),
        );
    }
}
packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v1/mod.rs (1)

80-81: Narrow lint allowances; fix the root cause.

Same as V0: avoid function-wide clippy::ptr_arg and clippy::unnecessary_operation. Prefer a localized allow (or explicit let _ = ...;) inside the #[cfg(not(feature = "validation"))] branch to silence the no-op expression only.

packages/rs-dpp/src/data_contract/associated_token/token_perpetual_distribution/distribution_function/mod.rs (1)

122-126: Tighten phrasing in docs for defaults and offset behavior.

Suggest minor wording tweaks for clarity and tone.

-    ///   If this is provided before this number we give out the distribution start amount every interval.
+    ///   If set, emissions before this offset use `distribution_start_amount` each interval.
-    ///   !!!Very important!!! -> This will default to 128 is default if not set.
-    ///   This means that after 128 cycles we will be distributing trailing_distribution_interval_amount per interval.
+    ///   Defaults to 128 if not set.
+    ///   After 128 cycles, the function emits `trailing_distribution_interval_amount` per interval.
packages/rs-dpp/src/data_contract/document_type/mod.rs (1)

91-91: Allowing large enum variant is fine; keep an eye on move/copy costs.

Given V1/V0 carry sizable structures, the allow makes sense. If perf hotspots appear, consider boxing heavy fields inside variants to shrink enum size.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3af1aaf and bffd610.

📒 Files selected for processing (29)
  • packages/rs-dapi-client/src/dump.rs (1 hunks)
  • packages/rs-dpp/src/data_contract/associated_token/token_perpetual_distribution/distribution_function/mod.rs (3 hunks)
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v0/mod.rs (1 hunks)
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v1/mod.rs (1 hunks)
  • packages/rs-dpp/src/data_contract/document_type/methods/mod.rs (1 hunks)
  • packages/rs-dpp/src/data_contract/document_type/mod.rs (1 hunks)
  • packages/rs-dpp/src/data_contract/document_type/property/mod.rs (2 hunks)
  • packages/rs-dpp/src/data_contract/extra/drive_api_tests.rs (1 hunks)
  • packages/rs-dpp/src/errors/consensus/basic/basic_error.rs (1 hunks)
  • packages/rs-dpp/src/errors/consensus/consensus_error.rs (1 hunks)
  • packages/rs-dpp/src/errors/protocol_error.rs (1 hunks)
  • packages/rs-dpp/src/fee/fee_result/refunds.rs (1 hunks)
  • packages/rs-dpp/src/identity/identity_public_key/random.rs (11 hunks)
  • packages/rs-dpp/src/identity/state_transition/asset_lock_proof/mod.rs (1 hunks)
  • packages/rs-dpp/src/lib.rs (1 hunks)
  • packages/rs-dpp/src/state_transition/mod.rs (2 hunks)
  • packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/methods/v0/mod.rs (1 hunks)
  • packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/mod.rs (1 hunks)
  • packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/v0_methods.rs (1 hunks)
  • packages/rs-dpp/src/system_data_contracts.rs (1 hunks)
  • packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/mod.rs (1 hunks)
  • packages/rs-drive-abci/src/execution/platform_events/withdrawals/update_broadcasted_withdrawal_statuses/mod.rs (1 hunks)
  • packages/rs-drive-abci/src/lib.rs (1 hunks)
  • packages/rs-drive-proof-verifier/src/lib.rs (1 hunks)
  • packages/rs-drive-proof-verifier/src/proof.rs (2 hunks)
  • packages/strategy-tests/src/lib.rs (1 hunks)
  • packages/strategy-tests/src/operations.rs (1 hunks)
  • packages/wasm-dpp/src/identity/identity.rs (1 hunks)
  • packages/wasm-drive-verify/src/lib.rs (2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.rs: Format Rust code with cargo fmt
Run Clippy linter for Rust code

**/*.rs: Use 4-space indentation for Rust files
Format Rust code with rustfmt defaults
Keep Rust code clippy-clean (no warnings)
In Rust, modules use snake_case, types use PascalCase, constants use SCREAMING_SNAKE_CASE

Files:

  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v1/mod.rs
  • packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/mod.rs
  • packages/rs-drive-abci/src/execution/platform_events/withdrawals/update_broadcasted_withdrawal_statuses/mod.rs
  • packages/rs-dpp/src/errors/consensus/consensus_error.rs
  • packages/strategy-tests/src/lib.rs
  • packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/methods/v0/mod.rs
  • packages/rs-drive-proof-verifier/src/proof.rs
  • packages/rs-drive-abci/src/lib.rs
  • packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/mod.rs
  • packages/rs-dpp/src/errors/protocol_error.rs
  • packages/rs-drive-proof-verifier/src/lib.rs
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v0/mod.rs
  • packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/v0_methods.rs
  • packages/strategy-tests/src/operations.rs
  • packages/rs-dpp/src/lib.rs
  • packages/rs-dpp/src/errors/consensus/basic/basic_error.rs
  • packages/wasm-dpp/src/identity/identity.rs
  • packages/rs-dapi-client/src/dump.rs
  • packages/rs-dpp/src/identity/state_transition/asset_lock_proof/mod.rs
  • packages/rs-dpp/src/state_transition/mod.rs
  • packages/rs-dpp/src/data_contract/extra/drive_api_tests.rs
  • packages/rs-dpp/src/fee/fee_result/refunds.rs
  • packages/rs-dpp/src/data_contract/associated_token/token_perpetual_distribution/distribution_function/mod.rs
  • packages/rs-dpp/src/data_contract/document_type/property/mod.rs
  • packages/wasm-drive-verify/src/lib.rs
  • packages/rs-dpp/src/identity/identity_public_key/random.rs
  • packages/rs-dpp/src/data_contract/document_type/mod.rs
  • packages/rs-dpp/src/data_contract/document_type/methods/mod.rs
  • packages/rs-dpp/src/system_data_contracts.rs
packages/**

📄 CodeRabbit inference engine (AGENTS.md)

Place all source packages under packages/* (JS/TS packages and Rust crates)

Files:

  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v1/mod.rs
  • packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/mod.rs
  • packages/rs-drive-abci/src/execution/platform_events/withdrawals/update_broadcasted_withdrawal_statuses/mod.rs
  • packages/rs-dpp/src/errors/consensus/consensus_error.rs
  • packages/strategy-tests/src/lib.rs
  • packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/methods/v0/mod.rs
  • packages/rs-drive-proof-verifier/src/proof.rs
  • packages/rs-drive-abci/src/lib.rs
  • packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/mod.rs
  • packages/rs-dpp/src/errors/protocol_error.rs
  • packages/rs-drive-proof-verifier/src/lib.rs
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v0/mod.rs
  • packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/v0_methods.rs
  • packages/strategy-tests/src/operations.rs
  • packages/rs-dpp/src/lib.rs
  • packages/rs-dpp/src/errors/consensus/basic/basic_error.rs
  • packages/wasm-dpp/src/identity/identity.rs
  • packages/rs-dapi-client/src/dump.rs
  • packages/rs-dpp/src/identity/state_transition/asset_lock_proof/mod.rs
  • packages/rs-dpp/src/state_transition/mod.rs
  • packages/rs-dpp/src/data_contract/extra/drive_api_tests.rs
  • packages/rs-dpp/src/fee/fee_result/refunds.rs
  • packages/rs-dpp/src/data_contract/associated_token/token_perpetual_distribution/distribution_function/mod.rs
  • packages/rs-dpp/src/data_contract/document_type/property/mod.rs
  • packages/wasm-drive-verify/src/lib.rs
  • packages/rs-dpp/src/identity/identity_public_key/random.rs
  • packages/rs-dpp/src/data_contract/document_type/mod.rs
  • packages/rs-dpp/src/data_contract/document_type/methods/mod.rs
  • packages/rs-dpp/src/system_data_contracts.rs
**/*.{js,jsx,ts,tsx,rs}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{js,jsx,ts,tsx,rs}: Use LF line endings in source files
Ensure a final newline at end of source files

Files:

  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v1/mod.rs
  • packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/mod.rs
  • packages/rs-drive-abci/src/execution/platform_events/withdrawals/update_broadcasted_withdrawal_statuses/mod.rs
  • packages/rs-dpp/src/errors/consensus/consensus_error.rs
  • packages/strategy-tests/src/lib.rs
  • packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/methods/v0/mod.rs
  • packages/rs-drive-proof-verifier/src/proof.rs
  • packages/rs-drive-abci/src/lib.rs
  • packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/mod.rs
  • packages/rs-dpp/src/errors/protocol_error.rs
  • packages/rs-drive-proof-verifier/src/lib.rs
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v0/mod.rs
  • packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/v0_methods.rs
  • packages/strategy-tests/src/operations.rs
  • packages/rs-dpp/src/lib.rs
  • packages/rs-dpp/src/errors/consensus/basic/basic_error.rs
  • packages/wasm-dpp/src/identity/identity.rs
  • packages/rs-dapi-client/src/dump.rs
  • packages/rs-dpp/src/identity/state_transition/asset_lock_proof/mod.rs
  • packages/rs-dpp/src/state_transition/mod.rs
  • packages/rs-dpp/src/data_contract/extra/drive_api_tests.rs
  • packages/rs-dpp/src/fee/fee_result/refunds.rs
  • packages/rs-dpp/src/data_contract/associated_token/token_perpetual_distribution/distribution_function/mod.rs
  • packages/rs-dpp/src/data_contract/document_type/property/mod.rs
  • packages/wasm-drive-verify/src/lib.rs
  • packages/rs-dpp/src/identity/identity_public_key/random.rs
  • packages/rs-dpp/src/data_contract/document_type/mod.rs
  • packages/rs-dpp/src/data_contract/document_type/methods/mod.rs
  • packages/rs-dpp/src/system_data_contracts.rs
🧠 Learnings (22)
📓 Common learnings
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.
📚 Learning: 2024-11-20T10:01:50.837Z
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.

Applied to files:

  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v1/mod.rs
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v0/mod.rs
  • packages/rs-dpp/src/state_transition/mod.rs
📚 Learning: 2024-10-09T00:22:57.778Z
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.

Applied to files:

  • packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/mod.rs
  • packages/rs-drive-abci/src/execution/platform_events/withdrawals/update_broadcasted_withdrawal_statuses/mod.rs
  • packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/methods/v0/mod.rs
  • packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/v0_methods.rs
  • packages/rs-dpp/src/state_transition/mod.rs
📚 Learning: 2024-10-06T16:11:34.946Z
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.

Applied to files:

  • packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/mod.rs
  • packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/v0_methods.rs
  • packages/rs-dpp/src/errors/consensus/basic/basic_error.rs
  • packages/wasm-dpp/src/identity/identity.rs
📚 Learning: 2025-09-07T22:20:55.315Z
Learnt from: CR
PR: dashpay/platform#0
File: AGENTS.md:0-0
Timestamp: 2025-09-07T22:20:55.315Z
Learning: Applies to **/*.rs : Keep Rust code clippy-clean (no warnings)

Applied to files:

  • packages/rs-dpp/src/errors/consensus/consensus_error.rs
  • packages/strategy-tests/src/lib.rs
  • packages/rs-drive-abci/src/lib.rs
  • packages/rs-drive-proof-verifier/src/lib.rs
  • packages/rs-dpp/src/lib.rs
  • packages/rs-dpp/src/errors/consensus/basic/basic_error.rs
📚 Learning: 2025-09-07T22:18:50.851Z
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-07T22:18:50.851Z
Learning: Applies to **/*.rs : Run Clippy linter for Rust code

Applied to files:

  • packages/strategy-tests/src/lib.rs
  • packages/rs-drive-abci/src/lib.rs
  • packages/rs-drive-proof-verifier/src/lib.rs
  • packages/rs-dpp/src/lib.rs
📚 Learning: 2024-10-08T13:28:03.529Z
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.

Applied to files:

  • packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/methods/v0/mod.rs
  • packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/mod.rs
  • packages/rs-dpp/src/state_transition/mod.rs
  • packages/rs-dpp/src/data_contract/document_type/mod.rs
  • packages/rs-dpp/src/system_data_contracts.rs
📚 Learning: 2025-04-11T09:08:05.652Z
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.

Applied to files:

  • packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/methods/v0/mod.rs
  • packages/rs-dpp/src/data_contract/document_type/methods/mod.rs
📚 Learning: 2024-12-05T09:29:38.918Z
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.

Applied to files:

  • packages/rs-drive-abci/src/lib.rs
📚 Learning: 2024-10-06T16:18:07.994Z
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.

Applied to files:

  • packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/mod.rs
  • packages/rs-dpp/src/state_transition/mod.rs
📚 Learning: 2024-10-04T09:08:47.901Z
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`.

Applied to files:

  • packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/mod.rs
  • packages/rs-dpp/src/state_transition/mod.rs
📚 Learning: 2024-11-22T08:19:14.448Z
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.

Applied to files:

  • packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/mod.rs
📚 Learning: 2024-11-20T16:05:40.200Z
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.

Applied to files:

  • packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/v0_methods.rs
  • packages/wasm-dpp/src/identity/identity.rs
📚 Learning: 2025-08-05T13:55:39.147Z
Learnt from: thephez
PR: dashpay/platform#2718
File: packages/wasm-sdk/index.html:0-0
Timestamp: 2025-08-05T13:55:39.147Z
Learning: The get_identity_keys_with_proof_info function in the Rust WASM bindings does not support the "search" key request type and lacks the searchPurposeMap parameter. When proof mode is enabled with keyRequestType === 'search', the implementation falls back to the non-proof version (get_identity_keys) to maintain functionality.

Applied to files:

  • packages/wasm-dpp/src/identity/identity.rs
📚 Learning: 2024-10-04T14:16:05.798Z
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.

Applied to files:

  • packages/rs-dpp/src/identity/state_transition/asset_lock_proof/mod.rs
📚 Learning: 2024-10-06T16:17:34.571Z
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.

Applied to files:

  • packages/rs-dpp/src/state_transition/mod.rs
📚 Learning: 2025-01-15T08:09:59.365Z
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.

Applied to files:

  • packages/rs-dpp/src/state_transition/mod.rs
📚 Learning: 2024-11-25T01:17:02.001Z
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.

Applied to files:

  • packages/rs-dpp/src/data_contract/extra/drive_api_tests.rs
📚 Learning: 2025-07-23T08:31:42.268Z
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : When implementing WASM SDK functionality, always refer to AI_REFERENCE.md first for accurate method signatures and examples.

Applied to files:

  • packages/wasm-drive-verify/src/lib.rs
📚 Learning: 2025-07-23T08:31:42.268Z
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : Token functions are methods on WasmSdk, not standalone functions; avoid importing them as standalone.

Applied to files:

  • packages/wasm-drive-verify/src/lib.rs
📚 Learning: 2025-07-23T08:31:42.268Z
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : For WASM builds, fix 'time not implemented on this platform' errors by using js_sys::Date::now().

Applied to files:

  • packages/wasm-drive-verify/src/lib.rs
📚 Learning: 2024-09-29T13:13:54.230Z
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: Adding Rust doc comments to structs and fields is recommended to enhance clarity and documentation.

Applied to files:

  • packages/rs-dpp/src/identity/identity_public_key/random.rs
  • packages/rs-dpp/src/data_contract/document_type/methods/mod.rs
🧬 Code graph analysis (1)
packages/rs-dpp/src/data_contract/document_type/property/mod.rs (1)
packages/rs-dpp/src/data_contract/document_type/methods/mod.rs (1)
  • max_size (141-156)
⏰ 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 (rs-dapi-client) / Unused dependencies
  • GitHub Check: Rust packages (rs-dapi-client) / Check each feature
  • GitHub Check: Rust packages (rs-dapi-client) / Linting
  • GitHub Check: Rust packages (rs-dapi-client) / Tests
  • GitHub Check: Rust packages (drive-abci) / Formatting
  • GitHub Check: Rust packages (drive-abci) / Unused dependencies
  • GitHub Check: Rust packages (drive-abci) / Tests
  • GitHub Check: Rust packages (drive-abci) / Linting
  • GitHub Check: Rust packages (drive-abci) / Check each feature
  • GitHub Check: Rust packages (drive) / Tests
  • GitHub Check: Rust packages (wasm-dpp) / Unused dependencies
  • GitHub Check: Rust packages (wasm-dpp) / Tests
  • GitHub Check: Rust packages (wasm-dpp) / Formatting
  • GitHub Check: Rust packages (drive) / Linting
  • GitHub Check: Rust packages (wasm-dpp) / 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
🔇 Additional comments (19)
packages/rs-dpp/src/identity/state_transition/asset_lock_proof/mod.rs (1)

171-173: Nice clippy-friendly simplification with .ok().

This cleanly maps Result->Option without changing behavior.

packages/rs-dpp/src/fee/fee_result/refunds.rs (1)

161-163: Idiomatic accumulation via values().sum() looks good

Cleaner, clippy-friendly, and keeps intent clear.

packages/wasm-dpp/src/identity/identity.rs (1)

91-92: Good clippy cleanup: prefer values() over iterating K/V pairs

Switching to .values().cloned() removes needless tuple destructuring and keeps order consistent with the map’s iteration. Behavior unchanged.

packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/mod.rs (1)

101-103: Iterating over values is cleaner and equivalent

Using .values().map(|public_key| public_key.into()) is concise and avoids unused key bindings. Semantics preserved.

packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/v0_methods.rs (1)

66-69: No ordering issue: identity.public_keys() uses a BTreeMap, which guarantees a deterministic, key-sorted iteration order—zipping these iterators remains aligned.

packages/strategy-tests/src/lib.rs (1)

1-1: OK to allow result_large_err in tests crate

Acceptable for test utilities with big error enums.

packages/strategy-tests/src/operations.rs (1)

620-632: Allowing large enum variant here is appropriate

This enum is a serialization shim; the allow keeps clippy clean without affecting runtime code.

packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/methods/v0/mod.rs (1)

23-24: Doc wording tweak LGTM

Minor formatting improvement; no behavior change.

packages/rs-dapi-client/src/dump.rs (1)

108-108: LGTM: rsplit is the right tool here

Switching to rsplit avoids allocating an intermediate Vec; behavior remains the same.

packages/wasm-drive-verify/src/lib.rs (2)

2-3: LGTM: crate-level Clippy allowances are reasonable for WASM bindings

These lints often trigger in FFI/JS-interop surfaces; allowing them at crate level keeps builds warning-free.


108-108: Comment clarity

The note about avoiding prelude imports is helpful and avoids accidental wildcard imports.

packages/rs-dpp/src/data_contract/extra/drive_api_tests.rs (1)

151-151: LGTM: contains_key() is clearer for presence checks

Using contains_key reads better than comparing get(...).is_some() and avoids constructing an Option.

Also applies to: 157-157, 163-163, 169-169

packages/rs-dpp/src/state_transition/mod.rs (1)

298-299: LGTM: underscore parameter avoids unused warnings under feature gates

Renaming to _platform_version is a clean way to silence conditional unused warnings.

Also applies to: 307-309, 316-317

packages/rs-dpp/src/identity/identity_public_key/random.rs (1)

78-78: Docs-only reflow: looks good

Indentation/wording tweaks improve rustdoc readability without affecting APIs.

Also applies to: 84-84, 124-124, 130-130, 161-161, 167-167, 209-209, 215-215, 254-254, 260-260, 314-314, 380-380, 407-407, 439-439

packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/mod.rs (1)

21-22: Docs formatting LGTM.

Continuation lines under Returns read cleaner and are consistent with surrounding style.

packages/rs-drive-abci/src/execution/platform_events/withdrawals/update_broadcasted_withdrawal_statuses/mod.rs (1)

31-31: Docs indentation tweak looks good.

No behavioral change; comment now renders as intended.

packages/rs-dpp/src/data_contract/document_type/property/mod.rs (1)

309-309: Safe to use u32::div_ceil with MSRV 1.89 Confirmed div_ceil was stabilized in Rust 1.73 and the repo’s MSRV is 1.89 (doc.rust-lang.org)

packages/rs-dpp/src/data_contract/associated_token/token_perpetual_distribution/distribution_function/mod.rs (1)

527-542: Nice: fenced ASCII diagram renders properly now.

The added code fence ensures consistent formatting in rustdoc.

packages/rs-dpp/src/data_contract/document_type/methods/mod.rs (1)

215-218: Docs clarification LGTM.

The note about block heights being ignored on broadcast is clearer and consistent.

Also applies to: 220-221, 223-223

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v1/mod.rs (1)

98-103: Remove no-op to_string; either signal in debug or handle the error explicitly

This expression has no effect and likely exists only to silence tests. Prefer a debug assertion (non-breaking in release) to surface misuse during development.

 #[cfg(not(feature = "validation"))]
 if full_validation {
-    // TODO we are silently dropping this error when we shouldn't be
-    // but returning this error causes tests to fail; investigate more.
-    "validation is not enabled but is being called on try_from_schema".to_string();
+    // Signal in debug builds without breaking release behavior.
+    debug_assert!(
+        !full_validation,
+        "validation feature is disabled but full_validation=true in try_from_schema(V1)"
+    );
 }
🧹 Nitpick comments (6)
packages/rs-dpp/src/data_contract/document_type/class_methods/create_document_types_from_document_schemas/v0/mod.rs (1)

21-23: Refactor remaining validation_operations to use impl Extend
Several methods in packages/rs-dpp (e.g. in data_contract//serialization, data_contract//methods/schema, and document_type/**) still accept &mut Vec<ProtocolValidationOperation> and call validation_operations.push(…); please generalize their signatures to &mut impl Extend<ProtocolValidationOperation> and replace push calls with extend.

packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v0/mod.rs (2)

81-86: Avoid no-op string; surface a warning in non-validation builds.

Silently dropping full_validation is risky for misuse detection. Emit a debug-only warning instead.

Apply:

-            "validation is not enabled but is being called on try_from_schema".to_string();
+            #[cfg(debug_assertions)]
+            eprintln!(
+                "validation requested for try_from_schema but 'validation' feature is disabled"
+            );

113-116: Minor: prefer array literal over std::iter::once for single item extend.

Slightly shorter; same semantics. Safe on stable.

For each occurrence:

-                validation_operations.extend(std::iter::once(
-                    ProtocolValidationOperation::DocumentTypeSchemaValidationForSize(schema_size),
-                ));
+                validation_operations.extend([
+                    ProtocolValidationOperation::DocumentTypeSchemaValidationForSize(schema_size),
+                ]);
-            validation_operations.extend(std::iter::once(
-                ProtocolValidationOperation::DocumentTypeSchemaValidationForSize(schema_size),
-            ));
+            validation_operations.extend([
+                ProtocolValidationOperation::DocumentTypeSchemaValidationForSize(schema_size),
+            ]);
-            validation_operations.extend(std::iter::once(
-                ProtocolValidationOperation::DocumentTypeSchemaPropertyValidation(
-                    property_values.values().len() as u64,
-                ),
-            ));
+            validation_operations.extend([ProtocolValidationOperation::DocumentTypeSchemaPropertyValidation(
+                property_values.values().len() as u64,
+            )]);
-                            validation_operations.extend(std::iter::once(
-                                ProtocolValidationOperation::DocumentTypeSchemaIndexValidation(
-                                    index.properties.len() as u64,
-                                    index.unique,
-                                ),
-                            ));
+                            validation_operations.extend([ProtocolValidationOperation::DocumentTypeSchemaIndexValidation(
+                                index.properties.len() as u64,
+                                index.unique,
+                            )]);

Also applies to: 122-125, 201-206, 303-309

packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v1/mod.rs (3)

85-86: Typo in parameter name: data_contact_config → data_contract_config

Purely a readability nit; consider renaming for consistency with the type.


725-725: Fix test names: “should_no_be_” → “should_not_be_

Minor grammar/readability improvement for test names.

-        fn should_no_be_empty() {
+        fn should_not_be_empty() {
@@
-        fn should_no_be_longer_than_64_chars() {
+        fn should_not_be_longer_than_64_chars() {
@@
-        fn should_no_be_alphanumeric() {
+        fn should_not_be_alphanumeric() {

Also applies to: 767-767, 811-811


828-837: Optional: Test V1 as well for the “space in name” case

This test targets V0; consider adding an analogous V1 test to keep coverage symmetric with V1 API changes.

I can draft a V1 variant mirroring this case if helpful.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bffd610 and c6360de.

📒 Files selected for processing (5)
  • packages/rs-dpp/src/data_contract/document_type/class_methods/create_document_types_from_document_schemas/v0/mod.rs (1 hunks)
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/mod.rs (1 hunks)
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v0/mod.rs (5 hunks)
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v1/mod.rs (4 hunks)
  • packages/rs-dpp/src/state_transition/mod.rs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/rs-dpp/src/state_transition/mod.rs
🧰 Additional context used
📓 Path-based instructions (3)
**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.rs: Format Rust code with cargo fmt
Run Clippy linter for Rust code

**/*.rs: Use 4-space indentation for Rust files
Format Rust code with rustfmt defaults
Keep Rust code clippy-clean (no warnings)
In Rust, modules use snake_case, types use PascalCase, constants use SCREAMING_SNAKE_CASE

Files:

  • packages/rs-dpp/src/data_contract/document_type/class_methods/create_document_types_from_document_schemas/v0/mod.rs
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v0/mod.rs
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/mod.rs
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v1/mod.rs
packages/**

📄 CodeRabbit inference engine (AGENTS.md)

Place all source packages under packages/* (JS/TS packages and Rust crates)

Files:

  • packages/rs-dpp/src/data_contract/document_type/class_methods/create_document_types_from_document_schemas/v0/mod.rs
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v0/mod.rs
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/mod.rs
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v1/mod.rs
**/*.{js,jsx,ts,tsx,rs}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{js,jsx,ts,tsx,rs}: Use LF line endings in source files
Ensure a final newline at end of source files

Files:

  • packages/rs-dpp/src/data_contract/document_type/class_methods/create_document_types_from_document_schemas/v0/mod.rs
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v0/mod.rs
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/mod.rs
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v1/mod.rs
🧠 Learnings (2)
📓 Common learnings
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.
📚 Learning: 2025-04-11T09:08:05.652Z
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.

Applied to files:

  • packages/rs-dpp/src/data_contract/document_type/class_methods/create_document_types_from_document_schemas/v0/mod.rs
⏰ 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 (wasm-dpp) / Detect immutable structure changes
  • GitHub Check: Rust packages (wasm-dpp) / Formatting
  • GitHub Check: Rust packages (wasm-dpp) / Tests
  • GitHub Check: Rust packages (dpp) / Unused dependencies
  • GitHub Check: Rust packages (dpp) / Formatting
  • GitHub Check: Rust packages (dash-sdk) / Linting
  • GitHub Check: Rust packages (dpp) / Check each feature
  • GitHub Check: Rust packages (dpp) / Tests
  • GitHub Check: Rust packages (dpp) / Linting
  • GitHub Check: Rust packages (dash-sdk) / Check each feature
  • GitHub Check: Rust packages (dash-sdk) / Unused dependencies
  • GitHub Check: Rust packages (dash-sdk) / Tests
  • GitHub Check: Rust packages (rs-sdk-ffi) / Unused dependencies
  • GitHub Check: Rust packages (rs-sdk-ffi) / Linting
  • GitHub Check: Rust packages (rs-sdk-ffi) / Tests
  • 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 Docker images (DAPI, dapi, dapi) / Build DAPI image
  • GitHub Check: Build JS packages / Build JS
  • GitHub Check: build-wasm-sdk
🔇 Additional comments (4)
packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/mod.rs (1)

49-51: Signature change to &mut impl Extend is appropriate.

Keeps API surface clippy-clean and compatible with existing Vec call sites.

packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v0/mod.rs (1)

72-73: V0 try_from_schema now takes impl Extend — good.

Matches the top-level dispatcher and avoids tying to Vec.

packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v1/mod.rs (2)

130-133: Nice: switched to Extend via extend(std::iter::once(...))

This aligns with the generalized parameter and keeps Clippy happy.

Also applies to: 139-142


320-326: Consistent use of Extend here looks good

Matches the new signature and avoids Vec-specific APIs.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v1/mod.rs (1)

218-223: Leftover push fixed — resolves the earlier build break with validation feature.

🧹 Nitpick comments (11)
packages/rs-platform-wallet/examples/basic_usage.rs (3)

9-9: Prefer .into() over .to_string() for String conversions

Slightly more idiomatic and Clippy-friendly when the constructor accepts Into.

-    let platform_wallet = PlatformWalletInfo::new(wallet_id, "My Platform Wallet".to_string());
+    let platform_wallet = PlatformWalletInfo::new(wallet_id, "My Platform Wallet".into());

11-11: Use Display formatting for &str

Use {} instead of {:?} for clearer output (and to keep Clippy quiet on style nits).

-    println!("Created wallet: {:?}", platform_wallet.name());
+    println!("Created wallet: {}", platform_wallet.name());

16-19: Avoid direct field access if not part of the stable API

If identity_manager is intended to remain an internal detail, consider exposing a read-only accessor on PlatformWalletInfo instead of accessing the field directly in examples.

packages/rs-drive-abci/tests/strategy_tests/token_tests.rs (4)

475-476: Fix stale inline comment: block_count is 60, not 30.

Apply:

-            block_count, // block count is 30
+            block_count, // block count is 60

487-492: Unused read-lock variable; make intent explicit or remove.

counter isn’t read, which triggers an unused-variable lint. If the goal is to hold the read guard during fetch_versions_with_counter, rename to an underscored guard; otherwise, drop the line.

Apply one of:

  • Keep the guard (preferred if intentional):
-            let counter = platform.drive.cache.protocol_versions_counter.read();
+            // Hold a read guard intentionally while fetching versions to keep snapshot stable.
+            let _versions_counter_guard = platform.drive.cache.protocol_versions_counter.read();
  • Or remove entirely if unnecessary:
-            let counter = platform.drive.cache.protocol_versions_counter.read();

Note: the same pattern appears later (Lines 1005–1010, 1280–1292, 1383–1399, 1602–1618, 1981–1997, 2200–2216). Consider applying consistently.


631-633: Update math in comment to match the asserted value (222).

The explanatory comment says 250, but the test asserts 222. Reflect integer division in the note to avoid confusion.

Apply:

-        // They should get 2 * 1000 * 4 / 36
-        // This is equal to 250
+        // They should get 2 * 1000 * 4 / 36
+        // This equals 222 (integer division)

759-763: Same stale inline comment here: block_count is 60, not 30.

Apply:

-            block_count, // block count is 30
+            block_count, // block count is 60
packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v1/mod.rs (4)

86-86: Nit: typo in parameter name — use data_contract_config.

Use “contract” rather than “contact” for consistency across the codebase.


725-725: Nit: test name grammar.

Rename to should_not_be_empty for clarity.


768-768: Nit: test name grammar.

Rename to should_not_be_longer_than_64_chars.


811-811: Nit: test name grammar.

Rename to should_not_be_alphanumeric (the test asserts non-alphanumeric names are invalid).

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c6360de and 4e68e29.

📒 Files selected for processing (3)
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v1/mod.rs (5 hunks)
  • packages/rs-drive-abci/tests/strategy_tests/token_tests.rs (1 hunks)
  • packages/rs-platform-wallet/examples/basic_usage.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.rs: Format Rust code with cargo fmt
Run Clippy linter for Rust code

**/*.rs: Use 4-space indentation for Rust files
Format Rust code with rustfmt defaults
Keep Rust code clippy-clean (no warnings)
In Rust, modules use snake_case, types use PascalCase, constants use SCREAMING_SNAKE_CASE

Files:

  • packages/rs-platform-wallet/examples/basic_usage.rs
  • packages/rs-drive-abci/tests/strategy_tests/token_tests.rs
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v1/mod.rs
packages/**

📄 CodeRabbit inference engine (AGENTS.md)

Place all source packages under packages/* (JS/TS packages and Rust crates)

Files:

  • packages/rs-platform-wallet/examples/basic_usage.rs
  • packages/rs-drive-abci/tests/strategy_tests/token_tests.rs
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v1/mod.rs
**/*.{js,jsx,ts,tsx,rs}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{js,jsx,ts,tsx,rs}: Use LF line endings in source files
Ensure a final newline at end of source files

Files:

  • packages/rs-platform-wallet/examples/basic_usage.rs
  • packages/rs-drive-abci/tests/strategy_tests/token_tests.rs
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v1/mod.rs
packages/*/tests/**

📄 CodeRabbit inference engine (AGENTS.md)

Place unit/integration tests alongside each package under packages//tests

Files:

  • packages/rs-drive-abci/tests/strategy_tests/token_tests.rs
packages/*/tests/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

Rust unit/integration tests must not perform network calls; mock dependencies

Files:

  • packages/rs-drive-abci/tests/strategy_tests/token_tests.rs
🧠 Learnings (7)
📓 Common learnings
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/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.
📚 Learning: 2024-10-08T13:28:03.529Z
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.

Applied to files:

  • packages/rs-platform-wallet/examples/basic_usage.rs
  • packages/rs-drive-abci/tests/strategy_tests/token_tests.rs
📚 Learning: 2024-10-04T09:08:47.901Z
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`.

Applied to files:

  • packages/rs-drive-abci/tests/strategy_tests/token_tests.rs
📚 Learning: 2024-11-20T20:43:41.185Z
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.

Applied to files:

  • packages/rs-drive-abci/tests/strategy_tests/token_tests.rs
📚 Learning: 2024-10-04T09:07:11.452Z
Learnt from: shumkov
PR: dashpay/platform#2206
File: packages/rs-drive-abci/tests/strategy_tests/main.rs:89-89
Timestamp: 2024-10-04T09:07:11.452Z
Learning: In tests located in the `packages/rs-drive-abci/tests` directory, the team prefers to use specific protocol versions (e.g., `PROTOCOL_VERSION_1`) instead of `PROTOCOL_VERSION_LATEST`.

Applied to files:

  • packages/rs-drive-abci/tests/strategy_tests/token_tests.rs
📚 Learning: 2024-10-06T16:17:34.571Z
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.

Applied to files:

  • packages/rs-drive-abci/tests/strategy_tests/token_tests.rs
📚 Learning: 2024-10-06T16:18:07.994Z
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.

Applied to files:

  • packages/rs-drive-abci/tests/strategy_tests/token_tests.rs
🧬 Code graph analysis (1)
packages/rs-drive-abci/tests/strategy_tests/token_tests.rs (1)
packages/rs-drive-abci/tests/strategy_tests/execution.rs (1)
  • run_chain_for_strategy (51-784)
⏰ 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-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) / Linting
  • GitHub Check: Rust packages (drive) / Unused dependencies
  • GitHub Check: Rust packages (drive) / Tests
  • GitHub Check: Rust packages (drive) / Linting
  • GitHub Check: Rust packages (wasm-dpp) / Tests
  • GitHub Check: Rust packages (wasm-dpp) / Unused dependencies
  • GitHub Check: Rust packages (wasm-dpp) / Formatting
  • GitHub Check: Rust packages (wasm-dpp) / Linting
  • GitHub Check: Rust packages (dpp) / Unused dependencies
  • GitHub Check: Rust packages (dpp) / Linting
  • GitHub Check: Rust packages (dpp) / Check each feature
  • GitHub Check: Rust packages (dpp) / Tests
  • 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 JS packages / Build JS
  • GitHub Check: build-wasm-sdk
🔇 Additional comments (5)
packages/rs-platform-wallet/examples/basic_usage.rs (1)

9-9: Good: removed unnecessary mut

This resolves the Clippy needless_mut lint; variable isn’t mutated.

packages/rs-drive-abci/tests/strategy_tests/token_tests.rs (1)

473-473: Nice: simplified destructuring with .. to avoid unused bindings.

This removes noise and keeps tests clippy-clean without changing behavior.

packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v1/mod.rs (3)

130-133: Correct switch from push(...) to extend(once(...)) — aligns with the new signature.

Also applies to: 139-142


320-325: LGTM: index validation op now uses extend(once(...)).


88-90: Signature change verified—no remaining Vec-specific push calls on validation_operations.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (8)
packages/rs-drive-abci/src/execution/types/unpaid_epoch/v0/mod.rs (3)

74-99: Same for setters: narrow or justify the dead_code suppression

Apply the same #[expect(dead_code, reason = "...")] or targeted gating to this trait.


152-166: Use alias types in impl for resilience and clarity

Match the trait signatures by using BlockHeight/CoreBlockHeight instead of bare u64/u32. This prevents churn if the aliases change later.

Apply:

-    fn set_start_block_height(&mut self, start_block_height: u64) {
+    fn set_start_block_height(&mut self, start_block_height: BlockHeight) {
         self.start_block_height = start_block_height;
     }
 
-    fn set_next_epoch_start_block_height(&mut self, next_epoch_start_block_height: u64) {
+    fn set_next_epoch_start_block_height(&mut self, next_epoch_start_block_height: BlockHeight) {
         self.next_epoch_start_block_height = next_epoch_start_block_height;
     }
 
-    fn set_start_block_core_height(&mut self, start_block_core_height: u32) {
+    fn set_start_block_core_height(&mut self, start_block_core_height: CoreBlockHeight) {
         self.start_block_core_height = start_block_core_height;
     }
 
-    fn set_next_epoch_start_block_core_height(&mut self, next_epoch_start_block_core_height: u32) {
+    fn set_next_epoch_start_block_core_height(&mut self, next_epoch_start_block_core_height: CoreBlockHeight) {
         self.next_epoch_start_block_core_height = next_epoch_start_block_core_height;
     }

49-71: Use #[expect(dead_code, reason = "...")] instead of a blanket allow
Rust 1.81 stabilized the expect lint (RFC 2383), and your MSRV is 1.89 (github.com). Add a descriptive reason to ensure unused getters trigger warnings when they become used; if this is only needed in tests, scope it with cfg_attr(test, allow(dead_code)).

packages/rs-drive-abci/src/platform_types/validator_set/v0/mod.rs (2)

18-19: Trait-level dead_code allow: prefer #[expect(...)] or tighter scoping

If this trait is kept for forward compatibility, add a reason via #[expect(dead_code, reason = "...")] or limit the scope (module/test cfg). This keeps clippy clean without masking unrelated items.


24-25: Remove unnecessary #[allow(dead_code)] on to_update_owned
Drop the #[allow(dead_code)] on fn to_update_owned(self) -> ValidatorSetUpdate in packages/rs-drive-abci/src/platform_types/validator_set/v0/mod.rs:24, since it’s invoked by the wrapper’s to_update_owned.

packages/rs-drive-abci/src/execution/types/block_fees/v0/mod.rs (3)

17-21: Dead-code suppression: switch to #[expect(...)] with reason or gate

Same note here—prefer #[expect(dead_code, reason = "...")] or cfg_attr to avoid blanket suppression.


34-50: Repeat: narrow or justify the dead_code allowance on getters

Consider #[expect(dead_code, reason = "...")] for traceability.


53-63: Repeat: narrow or justify the dead_code allowance on setters

Apply #[expect(dead_code, reason = "...")] or gate under cfgs.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4e68e29 and a8dbe68.

📒 Files selected for processing (5)
  • packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/update_state_masternode_list/v0/mod.rs (2 hunks)
  • packages/rs-drive-abci/src/execution/types/block_fees/v0/mod.rs (3 hunks)
  • packages/rs-drive-abci/src/execution/types/unpaid_epoch/v0/mod.rs (2 hunks)
  • packages/rs-drive-abci/src/platform_types/validator_set/v0/mod.rs (1 hunks)
  • packages/wasm-drive-verify/src/lib.rs (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/update_state_masternode_list/v0/mod.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/wasm-drive-verify/src/lib.rs
🧰 Additional context used
📓 Path-based instructions (3)
**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.rs: Format Rust code with cargo fmt
Run Clippy linter for Rust code

**/*.rs: Use 4-space indentation for Rust files
Format Rust code with rustfmt defaults
Keep Rust code clippy-clean (no warnings)
In Rust, modules use snake_case, types use PascalCase, constants use SCREAMING_SNAKE_CASE

Files:

  • packages/rs-drive-abci/src/execution/types/unpaid_epoch/v0/mod.rs
  • packages/rs-drive-abci/src/platform_types/validator_set/v0/mod.rs
  • packages/rs-drive-abci/src/execution/types/block_fees/v0/mod.rs
packages/**

📄 CodeRabbit inference engine (AGENTS.md)

Place all source packages under packages/* (JS/TS packages and Rust crates)

Files:

  • packages/rs-drive-abci/src/execution/types/unpaid_epoch/v0/mod.rs
  • packages/rs-drive-abci/src/platform_types/validator_set/v0/mod.rs
  • packages/rs-drive-abci/src/execution/types/block_fees/v0/mod.rs
**/*.{js,jsx,ts,tsx,rs}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{js,jsx,ts,tsx,rs}: Use LF line endings in source files
Ensure a final newline at end of source files

Files:

  • packages/rs-drive-abci/src/execution/types/unpaid_epoch/v0/mod.rs
  • packages/rs-drive-abci/src/platform_types/validator_set/v0/mod.rs
  • packages/rs-drive-abci/src/execution/types/block_fees/v0/mod.rs
🧠 Learnings (4)
📓 Common learnings
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.
📚 Learning: 2025-05-28T16:22:26.334Z
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.

Applied to files:

  • packages/rs-drive-abci/src/execution/types/unpaid_epoch/v0/mod.rs
📚 Learning: 2024-10-08T13:28:03.529Z
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.

Applied to files:

  • packages/rs-drive-abci/src/platform_types/validator_set/v0/mod.rs
📚 Learning: 2024-10-21T01:03:42.458Z
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.

Applied to files:

  • packages/rs-drive-abci/src/platform_types/validator_set/v0/mod.rs
🧬 Code graph analysis (1)
packages/rs-drive-abci/src/platform_types/validator_set/v0/mod.rs (1)
packages/rs-drive-abci/src/platform_types/validator_set/mod.rs (2)
  • to_update (10-10)
  • to_update (16-20)
⏰ 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). (14)
  • GitHub Check: Rust packages (dpp) / Linting
  • GitHub Check: Rust packages (dpp) / Check each feature
  • 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 (rs-dapi-client) / Unused dependencies
  • GitHub Check: Rust packages (dash-sdk) / Linting
  • GitHub Check: Rust packages (dash-sdk) / Formatting
  • GitHub Check: Rust packages (rs-dapi-client) / Linting
  • GitHub Check: Rust packages (rs-dapi-client) / Formatting
  • GitHub Check: Rust packages (rs-dapi-client) / Check each feature
  • GitHub Check: Build Docker images (Drive, drive, drive-abci) / Build Drive image
  • GitHub Check: Build JS packages / Build JS
  • GitHub Check: build-wasm-sdk

@QuantumExplorer QuantumExplorer added this to the v2.1 milestone Sep 8, 2025
Copy link
Member Author

@QuantumExplorer QuantumExplorer left a comment

Choose a reason for hiding this comment

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

Self Reviewed.

@QuantumExplorer QuantumExplorer merged commit b521d53 into v2.1-dev Sep 8, 2025
73 of 80 checks passed
@QuantumExplorer QuantumExplorer deleted the chore/cleanDppClippy branch September 8, 2025 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant