Skip to content

Conversation

@QuantumExplorer
Copy link
Member

@QuantumExplorer QuantumExplorer commented May 12, 2025

Issue being fixed or feature implemented

Group proofs were not working as intended. In this PR we fix this by introducing a better proof system for group actions where both the fact the signing occurred and the result is returned in provable form.

How Has This Been Tested?

Heavily tested with a lot more unit tests.

Breaking Changes

Not breaking vis a vis 1.8.

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 support for closing group actions and tracking their status (active/closed).
    • Introduced advanced querying and verification for group action signers and their total power.
    • Enhanced error handling with new error types for invalid actions and missing elements.
    • Added new batch move and batch delete operations with customizable options.
    • Expanded group action metadata to include contract and token position identifiers.
    • Improved verification of group actions within token state transitions, including proof result variants for group actions.
    • Added method to check if a group action is closed.
    • Introduced unified interface for token transition path queries.
  • Bug Fixes

    • Corrected group action path usage to distinguish between active and closed actions.
  • Tests

    • Added comprehensive tests for token freeze/unfreeze scenarios, group-based authorization, and multi-member group actions.
    • Updated test vectors and assertions to reflect changes in group action structure and metadata.
  • Chores

    • Updated dependencies to newer versions.
    • Added and removed test vector files to align with updated group action logic.
  • Documentation

    • Improved and extended documentation for new modules and methods, including detailed usage and error descriptions.
  • Refactor

    • Refactored group action insertion and move operations for clarity and extensibility.
    • Updated method and field names for clearer distinction between active and closed group actions.

@QuantumExplorer QuantumExplorer added this to the v2.0.0 milestone May 12, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 12, 2025

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 25 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

📥 Commits

Reviewing files that changed from the base of the PR and between 155a288 and bea7678.

📒 Files selected for processing (1)
  • packages/rs-drive/src/drive/group/insert/add_group_action/v0/mod.rs (7 hunks)

Walkthrough

This set of changes introduces comprehensive enhancements and new features for group action management within the platform. Key updates include distinguishing between active and closed group actions, tracking and verifying group action signers' total power, supporting batch move operations, and extending error handling and query capabilities. Numerous structs, enums, and method signatures are updated to accommodate new fields and parameters, with corresponding adjustments in tests and platform versioning.

Changes

File(s) / Path(s) Change Summary
.../group_action/v0/mod.rs, .../group_action/mod.rs, .../group_action_status.rs Added contract_id and token_contract_position fields to GroupActionV0; introduced GroupActionAccessors trait and implemented it; derived Copy for GroupActionStatus.
.../state_transition/proof_result.rs Added new StateTransitionProofResult variants for group actions with associated data and status.
.../state_transition_action/batch/batched_transition/token_transition/token_base_transition_action/v0/transformer.rs Added logic to check if a group action is closed before processing, returning an error if so.
.../drive/group/insert/add_group_action/mod.rs, .../v0/mod.rs, .../util/batch/drive_op_batch/group.rs Added closes_group_action boolean parameter to group action insertion methods and corresponding enum variant.
.../drive/group/paths.rs, .../fetch/fetch_action_id_info_keep_serialized/v0/mod.rs, .../fetch/fetch_action_id_signers_power/v0/mod.rs, .../fetch/fetch_active_action_info/v0/mod.rs Renamed group_action_path to group_active_action_path and updated all usages accordingly.
.../drive/group/estimated_costs/for_add_group_action/mod.rs, .../v0/mod.rs Added also_add_closed_tree parameter to estimation methods to handle closed group action trees.
.../drive/group/fetch/fetch_action_is_closed/mod.rs, .../v0/mod.rs, .../fetch/mod.rs Introduced methods to fetch and determine if a group action is closed.
.../drive/group/queries.rs Added multiple query-building methods for group actions and signers, supporting active/closed status and identity filtering.
.../drive/error/drive.rs Added InvalidAction and ElementNotFound error variants to DriveError enum.
.../drive/fees/op.rs Added version-aware conditional for handling SectionedStorageRemoval in fee consumption logic.
.../drive/prove/prove_action_infos/v0/mod.rs, .../prove/prove_action_signers/v0/mod.rs Updated tests to include new group action fields and parameters.
.../drive-abci/src/execution/platform_events/initialization/create_genesis_state/test/tokens.rs Updated group action construction and method calls to include new fields and parameters.
.../drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/freeze/mod.rs Added comprehensive tests for token freeze/unfreeze and group-based authorization scenarios.
.../state_transition_action/action_convert_to_operations/batch/token/token_*_transition.rs Added contract_id, token_contract_position, and closes_group_action fields to group action and operation construction.
.../drive/util/grove_operations/batch_delete/mod.rs, .../v0/mod.rs Added batch_delete_with_options method and refactored existing batch delete logic to support options.
.../drive/util/grove_operations/batch_move/mod.rs, .../v0/mod.rs, .../mod.rs Introduced batch move operation methods and updated BatchMoveApplyType enum to support optional tree types.
.../drive/util/grove_operations/batch_move_items_in_path_query/mod.rs, .../v0/mod.rs Added optional flag alteration parameter to batch move items methods and logic.
.../drive/lib.rs, .../prove/mod.rs Updated conditional compilation attributes for module inclusion.
.../drive/prove/prove_state_transition/v0/mod.rs Refactored token transition path query logic to use a trait-based approach.
.../drive/verify/group/mod.rs, .../verify/group/verify_action_signers_total_power/mod.rs, .../v0/mod.rs Added module and methods for verifying group action signers' total power using proofs.
.../drive/verify/state_transition/mod.rs, .../state_transition_execution_path_queries/mod.rs, .../token_transition.rs Added documentation and trait for converting state transitions to path queries, with implementation for token transitions.
.../drive/verify/state_transition/verify_state_transition_was_executed_with_proof/v0/mod.rs Extended state transition proof verification to support group actions, signers, and associated data.
.../platform-version/src/version/drive_versions/drive_group_method_versions/mod.rs, .../v1.rs Added fetch_action_is_closed version field to group fetch method versions.
.../platform-version/src/version/drive_versions/drive_grove_method_versions/mod.rs, .../v1.rs Added batch_move version field to grove batch method versions.
.../platform-version/src/version/drive_versions/drive_verify_method_versions/mod.rs, .../v1.rs Added verify_action_signers_total_power version field to verify group method versions.
.../platform-version/src/version/system_limits/mod.rs, .../rs-dpp/src/data_contract/group/v0/mod.rs Changed type of max_contract_group_size from u32 to u16 and updated casting logic.
.../drive/Cargo.toml, .../platform-version/Cargo.toml Updated grovedb dependency revision hashes.
.../rs-sdk/tests/fetch/group_actions.rs, .../vectors/test_fetch_all_group_actions/.json, .../vectors/test_fetch_one_group_action_since_existing_one_with_limit/.json Updated test assertions for new group action fields; replaced and removed test vector files.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Drive
    participant GroveDB

    Client->>Drive: add_group_action(..., closes_group_action, ...)
    alt closes_group_action == false
        Drive->>GroveDB: Insert/ensure active group action tree
        Drive->>GroveDB: Insert/update signer sum tree
        Drive->>GroveDB: Insert/update signer power with flags
    else closes_group_action == true
        Drive->>GroveDB: Insert closed group action tree
        Drive->>GroveDB: Insert signer sum tree (closed)
        Drive->>GroveDB: Insert signer power (no flags)
        Drive->>GroveDB: Move signer entries from active to closed
        Drive->>GroveDB: Move or insert action info to closed tree
        Drive->>GroveDB: Delete active signer sums and action entries
    end
    Drive-->>Client: FeeResult or error
Loading
sequenceDiagram
    participant Verifier
    participant Drive
    participant GroveDB

    Verifier->>Drive: verify_action_signer_and_total_power(proof, ...)
    Drive->>GroveDB: Query proof for active/closed group action state
    alt Exactly one state present
        Drive->>GroveDB: Query for signer's power in group action
        Drive->>Verifier: Return (root_hash, action_status, sum_power)
    else Both or neither state present
        Drive-->>Verifier: Error (proof invalid or ambiguous)
    end
Loading

Possibly related PRs

Suggested labels

dapi-endpoint

Suggested reviewers

  • shumkov

Poem

In the warren of code where the group actions dwell,
We now track who signs, and when actions fell.
With active and closed, the stories unfold,
Batch moves and queries, the logic is bold.
Rabbits rejoice as the proofs are in tow—
Group power is counted, and off we all go!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 10

🧹 Nitpick comments (24)
packages/rs-sdk/tests/vectors/test_fetch_one_group_action_since_existing_one_with_limit/quorum_pubkey-106-101a4299cad9e06288ea7a290a730a1c696ab53d03e0b241f35f9d002eee3233.json (1)

1-1: Format JSON string value with double quotes

The static analysis tool correctly flagged that this JSON file contains an unquoted string value. JSON requires string values to be enclosed in double quotes.

-aa8fcaad83dc96339d97ce135e408ca1eb5f7392ade678e224856b394b6370b2fa522a002acb149020e17d3bbbe6444e
+"aa8fcaad83dc96339d97ce135e408ca1eb5f7392ade678e224856b394b6370b2fa522a002acb149020e17d3bbbe6444e"
🧰 Tools
🪛 Biome (1.9.4)

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

(parse)

packages/rs-drive/src/drive/group/fetch/fetch_active_action_info/v0/mod.rs (1)

27-27: Refine comment to reflect active action context
The generic comment above path construction could mention "active" to improve clarity:

- // Construct the GroveDB path for the action signers
+ // Construct the GroveDB path for the active action info
packages/rs-drive/src/util/grove_operations/mod.rs (1)

217-219: Update to BatchMoveApplyType makes sense but contains a grammatical error

Making tree_type optional allows for more flexibility in batch move operations. However, the comment "Are we moving a trees?" contains a grammatical error - it should be either "Are we moving a tree?" or "Are we moving trees?".

-        /// Are we moving a trees?
+        /// Are we moving trees?
packages/rs-drive/src/fees/op.rs (1)

6-6: Version-aware fee refund handling improves backward compatibility

This change implements a version-specific approach to fee refunds, using an empty BTreeMap for fee version 1 and the previous behavior for other versions. This provides a clean way to handle version differences while maintaining backward compatibility.

The conditional approach is appropriate, but consider adding a brief comment explaining why fee version 1 is handled differently to improve future maintainability.

                               if fee_version.fee_version_number == 1 {
+                                   // For fee version 1, we use an empty map as we don't need previous fee versions
                                    (
                                        FeeRefunds::from_storage_removal(
                                            removal_per_epoch_by_identifier,

Also applies to: 247-268

packages/rs-drive/src/state_transition_action/action_convert_to_operations/batch/token/token_destroy_frozen_funds_transition.rs (1)

58-60: Prefer re-using the already-cloned data_contract_id to avoid an extra allocation

self.base().data_contract_id() is already cloned into data_contract_id (line 33).
Calling it again here performs a second clone/allocation of the 32-byte buffer every time the proposer path is taken.

-    contract_id: self.base().data_contract_id(),
+    contract_id: data_contract_id,

A micro-optimisation, but this code runs for every destroy-frozen-funds transition in a batch.

packages/rs-drive/src/drive/group/estimated_costs/for_add_group_action/mod.rs (1)

50-57: Missing docstring for the new also_add_closed_tree parameter

The public comment block explains every parameter except the newly-added also_add_closed_tree.
Readers have to dive into v0 to understand the flag’s purpose.

Add a short bullet such as:

/// - `also_add_closed_tree`: if `true`, cost estimation also covers the closed-action subtree

to keep the API self-documenting.

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

44-65: create_token_historical_document_query is now orphaned

Since the token-transition branch delegates to try_transition_into_path_query_with_contract, the helper create_token_historical_document_query (lines 44-65) is no longer referenced inside this module.

If the function is truly obsolete, please delete it to avoid dead-code warnings (several crates use #![deny(dead_code)]).
Otherwise, add a comment or #[allow(dead_code)] explaining the future use.


174-178: Surface trait-level errors for easier debugging

try_transition_into_path_query_with_contract is forwarded with ?, which will wrap its Error::Drive/Error::Proof variants indistinguishably from surrounding logic. Consider mapping the error to include the transition’s id for context:

token_transition
    .try_transition_into_path_query_with_contract(contract, owner_id, platform_version)
    .map_err(|e| e.into_additional_context(format!("while building query for token {}", token_transition.token_id())))?

Not mandatory, but greatly simplifies troubleshooting complex batch proofs.

packages/rs-drive/src/drive/group/fetch/fetch_action_is_closed/v0/mod.rs (1)

44-44: Consider adding a comment about the active root check

The implementation currently only checks if the action exists in the closed root. If you intend to keep this implementation, it would be helpful to add a comment explaining why the active root check is not performed or when it would be performed.

-        Ok(false)
+        // Return false if not found in closed root, as we only care about closed status
+        Ok(false)
packages/rs-drive/src/util/grove_operations/batch_move/mod.rs (1)

15-15: Consider adding more detailed documentation

The current comment is brief. Since this is a new public API, it would be helpful to add more details about what the batch move operation does, especially explaining the purpose of the alter_flags_to_new_flags parameter and the BatchMoveApplyType enum.

packages/rs-drive/src/util/grove_operations/batch_move_items_in_path_query/mod.rs (1)

21-21: Improve parameter documentation

The documentation for the new parameter is quite brief. Consider enhancing it to explain the possible values and their effects.

-    /// * `alter_flags_to_new_flags`: Should we alter flags of items to new flags
+    /// * `alter_flags_to_new_flags`: Controls flag modification during the move:
+    ///   - `None`: Preserve existing flags
+    ///   - `Some(None)`: Remove all flags
+    ///   - `Some(Some(flags))`: Set specific flags
packages/rs-drive/src/drive/group/estimated_costs/for_add_group_action/v0/mod.rs (1)

36-44: Doc-comment is stale – new also_add_closed_tree parameter is undocumented

The parameter list in the docstring has not been updated after introducing the
also_add_closed_tree: bool argument. Readers of the public API (and future
maintainers) will miss this important behaviour switch.

@@
- /// - `action_id`: An optional identifier ...
- ///   will be inserted. The keys represent paths to the trees, and the values represent their estimated layer information.
+ /// - `action_id`: An optional identifier for the specific action being added.  
+ /// - `also_add_closed_tree`: When `true`, the same set of cost estimates is
+ ///   added for the *closed*-action sub-trees.  
+ /// - `estimated_costs_only_with_layer_info`: ...
packages/rs-drive/src/util/grove_operations/batch_move_items_in_path_query/v0/mod.rs (2)

21-30: Missing explanation of the new alter_flags_to_new_flags parameter

The doc-comment enumerates the function parameters but the freshly added
alter_flags_to_new_flags is only mentioned in a brief bullet without
describing its semantics (e.g. Some(None) strips flags, Some(Some(flags))
replaces them, None keeps them).


124-132: Order-of-operations may cause unintended double charging of sum-tree updates

element.set_flags(..) is executed after the delete operation has been
generated but before the insert op is queued. That is fine for correctness,
yet it means the replacement item may carry a different flag length (thereby
different byte-size) than the element that was removed. GroveDB’s fee logic
usually assumes delete/insert symmetry; if flag size changes, fee estimation
may become inaccurate.

Two safer alternatives:

  1. Perform the flag mutation before computing delete_operation so the fee
    calculator sees symmetrical sizes, or
  2. When flags change, explicitly add a fee refund/charge delta.
packages/rs-drive/src/verify/state_transition/state_transition_execution_path_queries/token_transition.rs (1)

163-178: Query merge may introduce duplicate paths leading to oversize proofs

PathQuery::merge concatenates the two queries; because both queries refer to
the same contract subtree they share a large common prefix. The resulting
proof could include redundant nodes and bloat proof sizes.

A small optimisation is to build one Query with the union of keys instead
of merging two independent PathQuerys.

packages/rs-drive/src/util/grove_operations/batch_delete/v0/mod.rs (1)

53-55: Redundant batch calculation

LowLevelDriveOperation::grovedb_operations_batch(drive_operations) is
performed before any new operations are added, yet the result is passed to
delete_operation_for_delete_internal, which again inspects the batch.
This duplicate conversion costs time on large batches.

Store the GroveDbOpBatch once in the outer scope of the caller and pass a
reference, or push the current delete op after the delete-internal call so
it isn’t converted twice.

packages/rs-drive/src/util/grove_operations/batch_move/v0/mod.rs (2)

29-47: Stateless move still performs a DB read

When apply_type is StatelessBatchMove the caller promises to supply size
estimates, so performing a full grove_get() defeats the purpose and becomes a
hot-path read.

Consider:

  1. Skipping the read for stateless mode and letting the caller provide the
    element (or its size) up-front, or
  2. Downgrading StatelessBatchMove to Stateful internally if the element is
    really needed.

This will cut a network/local-SSD round-trip in many batch scenarios.


90-99: Flag alteration mutates the original element

element.set_flags() modifies the in-memory Element that was fetched from the
database, which may have shared ownership with caches.
Cloning before mutation avoids surprising aliasing:

-            if let Some(flags) = alter_flags_to_new_flags.as_ref() {
-                element.set_flags(StorageFlags::map_to_some_element_flags(flags.as_ref()));
-            }
+            if let Some(flags) = alter_flags_to_new_flags.as_ref() {
+                let mut new_el = element.clone();
+                new_el.set_flags(StorageFlags::map_to_some_element_flags(flags.as_ref()));
+                element = new_el;
+            }
packages/rs-drive/src/drive/group/queries.rs (2)

94-121: group_action_query naming collides with existing group_action_signers_query

Both functions return signer-related data, yet one is called
group_action_query and the other group_action_signers_query. The naming
does not convey their semantic difference (single key vs full range) and will
confuse future maintainers.

Consider:

  • Renaming group_action_querygroup_action_signers_root_query
    (or similar)
  • Adding doc-comments that explicitly state the returned path & key.

195-224: Function name suggests “active or closed” but still requires an action_status argument

group_active_or_closed_action_single_signer_query ostensibly hides the active
/ closed distinction, yet the caller must pass action_status. Either:

  1. Remove the parameter and probe both sub-trees internally, or
  2. Rename to group_action_single_signer_query and drop the “active_or_closed”
    qualifier.

The current API invites misuse and double-checks by reviewers.

packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/freeze/mod.rs (1)

1-667: High value tests, but duplication is skyrocketing

The three basic freeze/unfreeze tests and the group freeze scenarios repeat
large swaths of setup code (platform boot-strap, identity creation, contract
template tweaking, transaction execution boiler-plate).

Extract helpers (e.g. fn setup_platform(), fn exec_transition(platform, tx_bytes))
or use Rust test fixtures (#[fixture] with rstest) to cut ~300 lines.
This keeps individual test intent clear and shortens compile time.

packages/rs-drive/src/drive/group/insert/add_group_action/mod.rs (3)

21-35: Consider updating method documentation

While the implementation is correct, the method documentation should be updated to explain the purpose of the new closes_group_action parameter for better code maintainability.

 /// Adds an action to the state
+/// 
+/// When `closes_group_action` is true, the action is marked as closed, finalizing its state
+/// and moving relevant data from active to closed trees.
 #[allow(clippy::too_many_arguments)]

58-74: Consider updating documentation for operation building method

Similar to the main method, the documentation for this method should include information about the new parameter.

 /// Adds action creation operations to drive operations
+/// 
+/// When `closes_group_action` is true, operations for closing the group action will be included,
+/// handling the transition from active to closed state.
 #[allow(clippy::too_many_arguments)]

97-114: Consider updating documentation for operations method

The operations method would also benefit from documentation explaining the new parameter.

 /// The operations needed to create a new group action
+///
+/// When `closes_group_action` is true, includes operations for closing the group action
+/// and managing the transition between active and closed states.
 #[allow(clippy::too_many_arguments)]
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between cd062be and d155361.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (65)
  • packages/rs-dpp/src/data_contract/group/v0/mod.rs (1 hunks)
  • packages/rs-dpp/src/group/group_action/mod.rs (2 hunks)
  • packages/rs-dpp/src/group/group_action/v0/mod.rs (1 hunks)
  • packages/rs-dpp/src/group/group_action_status.rs (1 hunks)
  • packages/rs-dpp/src/state_transition/proof_result.rs (2 hunks)
  • packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/test/tokens.rs (1 hunks)
  • packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/freeze/mod.rs (1 hunks)
  • packages/rs-drive/Cargo.toml (1 hunks)
  • packages/rs-drive/src/drive/group/estimated_costs/for_add_group_action/mod.rs (2 hunks)
  • packages/rs-drive/src/drive/group/estimated_costs/for_add_group_action/v0/mod.rs (4 hunks)
  • packages/rs-drive/src/drive/group/fetch/fetch_action_id_info_keep_serialized/v0/mod.rs (3 hunks)
  • packages/rs-drive/src/drive/group/fetch/fetch_action_id_signers_power/v0/mod.rs (3 hunks)
  • packages/rs-drive/src/drive/group/fetch/fetch_action_is_closed/mod.rs (1 hunks)
  • packages/rs-drive/src/drive/group/fetch/fetch_action_is_closed/v0/mod.rs (1 hunks)
  • packages/rs-drive/src/drive/group/fetch/fetch_active_action_info/v0/mod.rs (3 hunks)
  • packages/rs-drive/src/drive/group/fetch/mod.rs (1 hunks)
  • packages/rs-drive/src/drive/group/insert/add_group_action/mod.rs (6 hunks)
  • packages/rs-drive/src/drive/group/insert/add_group_action/v0/mod.rs (7 hunks)
  • packages/rs-drive/src/drive/group/paths.rs (2 hunks)
  • packages/rs-drive/src/drive/group/prove/prove_action_infos/v0/mod.rs (9 hunks)
  • packages/rs-drive/src/drive/group/prove/prove_action_signers/v0/mod.rs (8 hunks)
  • packages/rs-drive/src/drive/group/queries.rs (3 hunks)
  • packages/rs-drive/src/error/drive.rs (1 hunks)
  • packages/rs-drive/src/fees/op.rs (2 hunks)
  • packages/rs-drive/src/lib.rs (1 hunks)
  • packages/rs-drive/src/prove/mod.rs (1 hunks)
  • packages/rs-drive/src/prove/prove_state_transition/v0/mod.rs (3 hunks)
  • packages/rs-drive/src/state_transition_action/action_convert_to_operations/batch/token/token_burn_transition.rs (2 hunks)
  • packages/rs-drive/src/state_transition_action/action_convert_to_operations/batch/token/token_config_update_transition.rs (2 hunks)
  • packages/rs-drive/src/state_transition_action/action_convert_to_operations/batch/token/token_destroy_frozen_funds_transition.rs (2 hunks)
  • packages/rs-drive/src/state_transition_action/action_convert_to_operations/batch/token/token_emergency_action_transition.rs (2 hunks)
  • packages/rs-drive/src/state_transition_action/action_convert_to_operations/batch/token/token_freeze_transition.rs (2 hunks)
  • packages/rs-drive/src/state_transition_action/action_convert_to_operations/batch/token/token_mint_transition.rs (2 hunks)
  • packages/rs-drive/src/state_transition_action/action_convert_to_operations/batch/token/token_set_price_for_direct_purchase_transition.rs (2 hunks)
  • packages/rs-drive/src/state_transition_action/action_convert_to_operations/batch/token/token_unfreeze_transition.rs (2 hunks)
  • packages/rs-drive/src/state_transition_action/batch/batched_transition/token_transition/token_base_transition_action/v0/transformer.rs (2 hunks)
  • packages/rs-drive/src/util/batch/drive_op_batch/group.rs (2 hunks)
  • packages/rs-drive/src/util/batch/drive_op_batch/withdrawals.rs (2 hunks)
  • packages/rs-drive/src/util/grove_operations/batch_delete/mod.rs (2 hunks)
  • packages/rs-drive/src/util/grove_operations/batch_delete/v0/mod.rs (2 hunks)
  • packages/rs-drive/src/util/grove_operations/batch_move/mod.rs (1 hunks)
  • packages/rs-drive/src/util/grove_operations/batch_move/v0/mod.rs (1 hunks)
  • packages/rs-drive/src/util/grove_operations/batch_move_items_in_path_query/mod.rs (4 hunks)
  • packages/rs-drive/src/util/grove_operations/batch_move_items_in_path_query/v0/mod.rs (8 hunks)
  • packages/rs-drive/src/util/grove_operations/mod.rs (2 hunks)
  • packages/rs-drive/src/verify/group/mod.rs (1 hunks)
  • packages/rs-drive/src/verify/group/verify_action_signers_total_power/mod.rs (1 hunks)
  • packages/rs-drive/src/verify/group/verify_action_signers_total_power/v0/mod.rs (1 hunks)
  • packages/rs-drive/src/verify/state_transition/mod.rs (1 hunks)
  • packages/rs-drive/src/verify/state_transition/state_transition_execution_path_queries/mod.rs (1 hunks)
  • packages/rs-drive/src/verify/state_transition/state_transition_execution_path_queries/token_transition.rs (1 hunks)
  • packages/rs-drive/src/verify/state_transition/verify_state_transition_was_executed_with_proof/v0/mod.rs (10 hunks)
  • packages/rs-platform-version/Cargo.toml (1 hunks)
  • packages/rs-platform-version/src/version/drive_versions/drive_group_method_versions/mod.rs (1 hunks)
  • packages/rs-platform-version/src/version/drive_versions/drive_group_method_versions/v1.rs (1 hunks)
  • packages/rs-platform-version/src/version/drive_versions/drive_grove_method_versions/mod.rs (1 hunks)
  • packages/rs-platform-version/src/version/drive_versions/drive_grove_method_versions/v1.rs (1 hunks)
  • packages/rs-platform-version/src/version/drive_versions/drive_verify_method_versions/mod.rs (1 hunks)
  • packages/rs-platform-version/src/version/drive_versions/drive_verify_method_versions/v1.rs (1 hunks)
  • packages/rs-platform-version/src/version/system_limits/mod.rs (1 hunks)
  • packages/rs-sdk/tests/fetch/group_actions.rs (2 hunks)
  • packages/rs-sdk/tests/vectors/test_fetch_all_group_actions/quorum_pubkey-106-1f0a25d463a2912cd31dd4f91b899a143d6ae990bb9bc89cb34f7c5db8b1b705.json (0 hunks)
  • packages/rs-sdk/tests/vectors/test_fetch_all_group_actions/quorum_pubkey-106-4308e13f7335a56c12a2fd4a2e64670383282934865ccc3241c0f7fedf218853.json (1 hunks)
  • packages/rs-sdk/tests/vectors/test_fetch_one_group_action_since_existing_one_with_limit/quorum_pubkey-106-101a4299cad9e06288ea7a290a730a1c696ab53d03e0b241f35f9d002eee3233.json (1 hunks)
  • packages/rs-sdk/tests/vectors/test_fetch_one_group_action_since_existing_one_with_limit/quorum_pubkey-106-1f0a25d463a2912cd31dd4f91b899a143d6ae990bb9bc89cb34f7c5db8b1b705.json (0 hunks)
💤 Files with no reviewable changes (2)
  • packages/rs-sdk/tests/vectors/test_fetch_one_group_action_since_existing_one_with_limit/quorum_pubkey-106-1f0a25d463a2912cd31dd4f91b899a143d6ae990bb9bc89cb34f7c5db8b1b705.json
  • packages/rs-sdk/tests/vectors/test_fetch_all_group_actions/quorum_pubkey-106-1f0a25d463a2912cd31dd4f91b899a143d6ae990bb9bc89cb34f7c5db8b1b705.json
🧰 Additional context used
🧠 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.
packages/rs-platform-version/Cargo.toml (1)
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.
packages/rs-drive/Cargo.toml (1)
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.
packages/rs-drive/src/verify/state_transition/verify_state_transition_was_executed_with_proof/v0/mod.rs (2)
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.
🧬 Code Graph Analysis (12)
packages/rs-drive/src/drive/group/fetch/mod.rs (1)
packages/rs-drive/src/drive/group/fetch/fetch_action_is_closed/mod.rs (1)
  • fetch_action_is_closed (18-48)
packages/rs-drive/src/fees/op.rs (1)
packages/rs-dpp/src/fee/fee_result/refunds.rs (1)
  • from_storage_removal (37-78)
packages/rs-drive/src/drive/group/fetch/fetch_action_id_info_keep_serialized/v0/mod.rs (1)
packages/rs-drive/src/drive/group/paths.rs (1)
  • group_active_action_path (91-103)
packages/rs-drive/src/drive/group/fetch/fetch_action_id_signers_power/v0/mod.rs (1)
packages/rs-drive/src/drive/group/paths.rs (1)
  • group_active_action_path (91-103)
packages/rs-drive/src/verify/state_transition/state_transition_execution_path_queries/token_transition.rs (9)
packages/rs-dpp/src/system_data_contracts.rs (1)
  • load_system_data_contract (42-49)
packages/rs-drive/src/prove/prove_state_transition/v0/mod.rs (1)
  • create_token_historical_document_query (44-64)
packages/rs-dpp/src/group/group_action/mod.rs (2)
  • contract_id (20-20)
  • contract_id (25-29)
packages/rs-dpp/src/group/group_action/v0/mod.rs (1)
  • contract_id (20-22)
packages/rs-drive/src/drive/group/queries.rs (1)
  • group_active_and_closed_action_single_signer_query (249-275)
packages/rs-drive/src/verify/state_transition/state_transition_execution_path_queries/mod.rs (1)
  • try_transition_into_path_query_with_contract (42-47)
packages/rs-drive/src/drive/tokens/balance/queries.rs (2)
  • token_balance_for_identity_id_query (12-20)
  • token_balances_for_identity_ids_query (23-38)
packages/rs-drive/src/drive/tokens/info/queries.rs (1)
  • token_info_for_identity_id_query (11-19)
packages/rs-drive/src/drive/tokens/direct_purchase/queries.rs (1)
  • token_direct_purchase_price_query (24-32)
packages/rs-drive/src/verify/state_transition/state_transition_execution_path_queries/mod.rs (1)
packages/rs-drive/src/verify/state_transition/state_transition_execution_path_queries/token_transition.rs (1)
  • try_transition_into_path_query_with_contract (69-184)
packages/rs-dpp/src/group/group_action/mod.rs (2)
packages/dapi-grpc/clients/platform/v0/web/platform_pb.d.ts (1)
  • GroupActionEvent (8224-8249)
packages/rs-dpp/src/group/group_action/v0/mod.rs (3)
  • contract_id (20-22)
  • token_contract_position (24-26)
  • event (28-30)
packages/rs-dpp/src/group/group_action/v0/mod.rs (2)
packages/dapi-grpc/clients/platform/v0/web/platform_pb.d.ts (1)
  • GroupActionEvent (8224-8249)
packages/rs-dpp/src/group/group_action/mod.rs (6)
  • contract_id (20-20)
  • contract_id (25-29)
  • token_contract_position (21-21)
  • token_contract_position (31-35)
  • event (22-22)
  • event (37-41)
packages/rs-drive/src/verify/group/verify_action_signers_total_power/mod.rs (1)
packages/rs-drive/src/verify/group/verify_action_signers_total_power/v0/mod.rs (1)
  • verify_action_signers_total_power_v0 (18-132)
packages/rs-drive/src/drive/group/fetch/fetch_action_is_closed/v0/mod.rs (2)
packages/rs-drive/src/drive/group/paths.rs (1)
  • group_closed_action_root_path (153-163)
packages/rs-dpp/src/errors/consensus/state/token/new_authorized_action_taker_group_does_not_exist_error.rs (1)
  • group_contract_position (25-27)
packages/rs-drive/src/verify/group/verify_action_signers_total_power/v0/mod.rs (1)
packages/rs-drive/src/drive/group/queries.rs (2)
  • group_active_or_closed_action_query (227-246)
  • group_active_or_closed_action_single_signer_query (196-224)
packages/rs-drive/src/util/grove_operations/batch_delete/v0/mod.rs (1)
packages/rs-drive/src/fees/op.rs (1)
  • grovedb_operations_batch (310-321)
🪛 Biome (1.9.4)
packages/rs-sdk/tests/vectors/test_fetch_all_group_actions/quorum_pubkey-106-4308e13f7335a56c12a2fd4a2e64670383282934865ccc3241c0f7fedf218853.json

[error] 1-1: Missing exponent

Expected a digit as the exponent

(parse)


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

(parse)

packages/rs-sdk/tests/vectors/test_fetch_one_group_action_since_existing_one_with_limit/quorum_pubkey-106-101a4299cad9e06288ea7a290a730a1c696ab53d03e0b241f35f9d002eee3233.json

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

(parse)

⏰ Context from checks skipped due to timeout of 90000ms (19)
  • GitHub Check: Rust packages (wasm-dpp) / Unused dependencies
  • GitHub Check: Rust packages (wasm-dpp) / 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 (dpp) / Unused dependencies
  • GitHub Check: Rust packages (dpp) / Formatting
  • GitHub Check: Rust packages (dash-sdk) / Linting
  • GitHub Check: Rust packages (dash-sdk) / Unused dependencies
  • GitHub Check: Rust packages (dash-sdk) / Tests
  • GitHub Check: Rust packages (dash-sdk) / Check each feature
  • GitHub Check: Rust packages (rs-dapi-client) / Check each feature
  • GitHub Check: Rust packages (drive-abci) / Check each feature
  • GitHub Check: Rust packages (drive-abci) / Tests
  • GitHub Check: Rust packages (drive-abci) / 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
🔇 Additional comments (103)
packages/rs-drive/Cargo.toml (1)

55-60: Align Grovedb dependencies to new Git revision

The grovedb, grovedb-costs, grovedb-path, grovedb-storage, grovedb-version, and grovedb-epoch-based-storage-flags crates are now consistently pinned to commit 221ca6ec6b8d2b192d334192bd5a7b2cab5b0aa8. This matches the intended GroveDB update for enhanced group action proofs and follows the existing strategy of locking to specific revisions.

packages/rs-platform-version/Cargo.toml (1)

14-14: Update grovedb-version to match GroveDB revision

The grovedb-version dependency has been updated to rev 221ca6ec6b8d2b192d334192bd5a7b2cab5b0aa8, aligning it with the changes in the rs-drive package and ensuring version consistency across the workspace.

packages/rs-drive/src/drive/group/fetch/mod.rs (1)

1-10: New module declaration looks correct.
The fetch_action_is_closed submodule is added in the correct alphabetical grouping and matches the file path fetch_action_is_closed/mod.rs.

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

12-12:

Details

❓ Verification inconclusive

Verify type change safety for max_contract_group_size.
Changing from u32 to u16 may truncate values if the JSON defaults exceed u16::MAX. Please ensure the default version JSON and any runtime configurations use values ≤ 65535.

Run this script to confirm the JSON spec values:


🏁 Script executed:

#!/bin/bash
# Find the default v1 version defining system limits
version_file=$(fd -t f 'v1.json' packages/rs-platform-version/src/version | head -n1)
echo "Checking max_contract_group_size in $version_file"
jq '.drive.system_limits.max_contract_group_size' "$version_file"

Length of output: 282


I couldn’t locate v1.json directly—let’s surface all JSON specs under src/version and extract the field:

This will confirm which version files define max_contract_group_size and their values.


🏁 Script executed:

#!/bin/bash
set -e

# List all JSON spec files
echo "JSON spec files under src/version:"
find packages/rs-platform-version/src/version -type f -name '*.json' || echo "  (none found)"

# For each spec, report max_contract_group_size (or note if missing)
echo
for file in $(find packages/rs-platform-version/src/version -type f -name '*.json'); do
  echo "Checking $file:"
  jq '.drive.system_limits.max_contract_group_size // "not defined"' "$file"
  echo
done

Length of output: 238


Let’s search the entire repo for any JSON specs and where max_contract_group_size is mentioned:

#!/bin/bash
set -e

echo "🔍 Looking for any v1.json anywhere in the repo:"
fd -t f 'v1.json' || echo "  → v1.json not found"

echo
echo "🔍 Listing all .json files:"
find . -type f -name '*.json' || echo "  → No JSON files found"

echo
echo "🔍 Grepping for max_contract_group_size occurrences:"
rg 'max_contract_group_size' -n . || echo "  → No occurrences found"

echo
echo "🔍 Grepping for system_limits occurrences:"
rg 'system_limits' -n . || echo "  → No occurrences found"

Let’s inspect the Rust defaults for SystemLimits to see what value max_contract_group_size gets when no JSON spec is present:

#!/bin/bash
set -e

echo "🔍 struct SystemLimits definition:"
rg -n "struct SystemLimits" -n .

echo
echo "🔍 Default implementation for SystemLimits:"
files=$(rg -l "impl Default for SystemLimits" -n . || true)
if [ -z "$files" ]; then
  echo "⚠️ No Default impl found for SystemLimits"
else
  for file in $files; do
    echo
    echo "=== $file ==="
    sed -n '/impl Default for SystemLimits/,/}/p' "$file"
  done
fi

echo
echo "🔍 All occurrences of max_contract_group_size:"
rg -n "max_contract_group_size" -n .

Verify JSON defaults and code defaults for max_contract_group_size
I wasn’t able to locate any JSON spec files under packages/rs-platform-version/src/version. Please ensure that all version spec JSON (e.g. v1.json) define

"drive": {
  "system_limits": {
    "max_contract_group_size": 
  }
}

with values ≤ u16::MAX (65535). If your specs live elsewhere or are generated, double-check their definitions. Also inspect the impl Default for SystemLimits in mod.rs to confirm it initializes max_contract_group_size within the u16 range.

• Verify JSON spec(s) define drive.system_limits.max_contract_group_size and that it never exceeds 65535.
• Examine the Default implementation for SystemLimits to ensure its fallback value fits in u16.

packages/rs-drive/src/verify/group/mod.rs (1)

1-5: New verification module added.
The verify_action_signers_total_power submodule is correctly declared alongside existing modules.

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

60-60:

Details

✅ Verification successful

Ensure version definitions include batch_move.
The new batch_move: FeatureVersion field is added to the struct. Confirm that the corresponding v1 version definitions (e.g., JSON or v1.rs) have been updated to include this feature, otherwise deserialization will break.


🏁 Script executed:

#!/bin/bash
# Verify v1 definitions contain "batch_move"
rg -n '"batch_move"' -n packages/rs-platform-version/src/version/drive_versions

Length of output: 81


🏁 Script executed:

#!/bin/bash
# List Rust files in drive_grove_method_versions
find packages/rs-platform-version/src/version/drive_versions/drive_grove_method_versions -maxdepth 1 -type f -name "*.rs"

# Show the first 200 lines of v1.rs to check for batch_move
if [[ -f packages/rs-platform-version/src/version/drive_versions/drive_grove_method_versions/v1.rs ]]; then
  sed -n '1,200p' packages/rs-platform-version/src/version/drive_versions/drive_grove_method_versions/v1.rs
else
  echo "v1.rs not found"
fi

Length of output: 2877


Resolved: batch_move present in v1 definitions
The batch_move field is already defined in packages/rs-platform-version/src/version/drive_versions/drive_grove_method_versions/v1.rs within DriveGroveBatchMethodVersions, so no further changes are needed.

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

23-23: Appropriate addition of feature version field

The addition of fetch_action_is_closed to the DriveGroupFetchMethodVersions struct aligns well with the PR's goal of improving the group action proof system. This field will enable distinguishing between active and closed group actions.

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

55-55: Good addition of verification feature field

The new verify_action_signers_total_power field is a necessary extension to support verification of the total signing power in group actions. This aligns with the PR's objective of enhancing the proof system for group actions.

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

91-91: Explicit type casting improves code clarity

The explicit cast to u32 makes the code more type-safe and clearer. This is a good practice, especially when dealing with numeric comparisons in validation logic.

packages/rs-drive/src/prove/mod.rs (1)

3-4: Clean gate for server-specific functionality

The conditional compilation flag ensures the prove_state_transition module is only included when the "server" feature is enabled, which aligns with the architectural separation of concerns in the platform. This matches the pattern used for other server-specific modules.

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

51-51: Version registration for new batch_move operation

The addition of batch_move: 0 properly registers the new batch move operation in the versioning system. This ensures backward compatibility while enabling the new functionality needed for improved group action proofs.

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

90-94: Enhanced group action metadata for token events

You've added contract ID and token position metadata to the GroupActionV0 structure. This is essential for the improved proof system, as it ensures that group actions can be properly associated with their originating contracts and token positions.


96-108: Added support for active/closed group action distinction

The new false parameter indicates that this action doesn't close a group action. This distinction between active and closed group actions enhances the proof system's ability to track the lifecycle of group actions.

packages/rs-dpp/src/group/group_action_status.rs (1)

3-3: Added Copy trait to improve ergonomics

Adding the Copy trait to GroupActionStatus is appropriate as it's a small, stack-allocated enum. This improves ergonomics by allowing implicit copying rather than requiring explicit cloning, which aligns with Rust best practices for small value types.

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

39-39:

Details

✅ Verification successful

Add new verify_action_signers_total_power method version
The field verify_action_signers_total_power: 0 has been added to DriveVerifyGroupMethodVersions. Ensure that the corresponding dispatch logic in the rs-drive crate maps version 0 to the new implementation (verify_action_signers_total_power_v0).

Run the following to verify references:


🏁 Script executed:

#!/bin/bash
# Search for all occurrences to confirm dispatch mappings exist
rg "verify_action_signers_total_power" -n packages/rs-drive

Length of output: 931


Dispatch mapping confirmed for verify_action_signers_total_power
The dispatch logic in packages/rs-drive/src/verify/group/verify_action_signers_total_power/mod.rs already maps version 0 to verify_action_signers_total_power_v0. No further changes are required.

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

58-59: Broaden verify module feature gating
The verify module is now correctly gated by both server and verify features, matching other modules like drive and query. This ensures proof verification functions are available when the verify feature is enabled.

packages/rs-drive/src/verify/state_transition/mod.rs (2)

1-3: Add module-level documentation
The new doc comment clearly explains the purpose of verify_state_transition_was_executed_with_proof, improving readability and compliance with #![deny(missing_docs)].


4-6: Add module-level documentation
The doc comment for state_transition_execution_path_queries clarifies its role in constructing path queries for state transition verification. Good for maintainability.

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

16-16:

Details

✅ Verification successful

Add fetch_action_is_closed fetch method version
The field fetch_action_is_closed: 0 has been added to DriveGroupFetchMethodVersions. Confirm that version dispatch in the rs-drive crate correctly handles this new method (fetch_action_is_closed_v0).


🏁 Script executed:

#!/bin/bash
# Search for implementations and dispatch references
rg "fetch_action_is_closed" -n packages/rs-drive

Length of output: 1122


fetch_action_is_closed version dispatch verified

The new fetch_action_is_closed: 0 entry is correctly handled in the rs-drive crate:

  • packages/rs-drive/src/drive/group/fetch/mod.rs: imports fetch_action_is_closed
  • packages/rs-drive/src/drive/group/fetch/fetch_action_is_closed/mod.rs: has the 0 => self.fetch_action_is_closed_v0(...) arm
  • packages/rs-drive/src/drive/group/fetch/fetch_action_is_closed/v0/mod.rs: implements fetch_action_is_closed_v0

No further changes required.

packages/rs-drive/src/drive/group/fetch/fetch_active_action_info/v0/mod.rs (3)

3-3: Rename import to active action path
The import of group_active_action_path replaces the old group_action_path, aligning with the active-action API. Good consistency with the updated path definitions.


28-32: Use active action path for fetching
In fetch_active_action_info_v0, calling group_active_action_path ensures data is read from the active-action tree. This correctly scopes the fetch to active actions.


63-69: Use active action path in add operations
In fetch_active_action_info_and_add_operations_v0, the call to group_active_action_path is correctly applied, ensuring operations target the active-action subtree.

packages/rs-drive/src/state_transition_action/action_convert_to_operations/batch/token/token_unfreeze_transition.rs (2)

62-63: LGTM: Added contract and token position identifiers

These new fields in the GroupActionV0 struct initialization provide important metadata for group action traceability, making the action proofs more robust.


77-77: LGTM: Added group action closing flag

The new closes_group_action parameter indicates whether this operation should close the group action. This is a key part of the improved proof system as it correctly tracks the lifecycle of group actions.

packages/rs-drive/src/state_transition_action/action_convert_to_operations/batch/token/token_mint_transition.rs (2)

63-64: LGTM: Added contract and token position identifiers

These new fields in the GroupActionV0 struct initialization provide important metadata for group action traceability, consistent with similar changes in other token transition actions.


78-78: LGTM: Added group action closing flag

The new closes_group_action parameter indicates whether this operation should close the group action, providing proper lifecycle tracking for the group action proof system.

packages/rs-drive/src/state_transition_action/action_convert_to_operations/batch/token/token_emergency_action_transition.rs (2)

58-59: LGTM: Added contract and token position identifiers

These new fields enhance the group action metadata with explicit contract and token position identifiers, consistent with the improvements to the group action proof system throughout the codebase.


73-73: LGTM: Added group action closing flag

The new closes_group_action parameter correctly determines the lifecycle state of the group action based on the base transition's perform_action() result.

packages/rs-sdk/tests/fetch/group_actions.rs (2)

153-154: LGTM: Updated test assertion with new fields

The test assertion has been properly updated to include the new contract_id and token_contract_position fields in the GroupActionV0 struct, ensuring the test validates the extended group action metadata.


185-186: LGTM: Updated test assertion with new fields

Test assertion correctly updated to match the new GroupActionV0 structure, maintaining test coverage for the enhanced group action proof system.

packages/rs-drive/src/state_transition_action/action_convert_to_operations/batch/token/token_burn_transition.rs (2)

59-60: Fields added to enhance group action metadata with contract and token position.

The addition of contract_id and token_contract_position provides better identification and traceability of group actions. This change properly enriches the group action metadata with explicit contract and token position identifiers.


74-74: Group action closure status tracking implemented.

The new closes_group_action field appropriately uses the base transition's perform_action() method to determine whether the group action should be closed. This enables proper lifecycle management for group actions.

packages/rs-drive/src/drive/group/fetch/fetch_action_id_info_keep_serialized/v0/mod.rs (3)

3-3: Import path updated to reflect active group actions.

The import has been updated from group_action_path to group_active_action_path to explicitly indicate that this path is associated with active group actions.


49-53: Path construction updated to use active group action path.

Function call changed from group_action_path to group_active_action_path to properly fetch from the active group actions subtree. This change aligns with the broader refactor to distinguish between active and closed group actions.


108-112: Path construction updated to use active group action path.

Function call changed from group_action_path to group_active_action_path to properly fetch from the active group actions subtree. This change maintains consistency with the other path construction update in this file.

packages/rs-drive/src/util/batch/drive_op_batch/withdrawals.rs (2)

169-169: Added optional flag alterations parameter for batch move operations.

The new None argument corresponds to the alter_flags_to_new_flags parameter, indicating that the storage flags of moved items should not be altered during the batch move operation.


211-211: Added optional flag alterations parameter for batch move operations.

The new None argument corresponds to the alter_flags_to_new_flags parameter, indicating that the storage flags of moved items should not be altered during the batch move operation. This maintains consistency with the similar change at line 169.

packages/rs-drive/src/state_transition_action/action_convert_to_operations/batch/token/token_freeze_transition.rs (2)

62-63: Fields added to enhance group action metadata with contract and token position.

The addition of contract_id and token_contract_position provides better identification and traceability of group actions. This change properly enriches the group action metadata with explicit contract and token position identifiers, consistent with similar changes in other token transition files.


77-77: Group action closure status tracking implemented.

The new closes_group_action field appropriately uses the base transition's perform_action() method to determine whether the group action should be closed. This enables proper lifecycle management for group actions, consistent with similar changes in other token transition files.

packages/rs-drive/src/error/drive.rs (1)

196-203: Two new error variants for enhanced group action handling.

These new error variants extend the error handling capabilities for group action management:

  1. InvalidAction will be used for invalid group action operations
  2. ElementNotFound will help with handling missing elements during batch moves and other operations

Both follow the established error pattern in this enum and are well-documented with appropriate error messages.

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

178-182: Updated GroupActionV0 with contract_id and token_contract_position fields.

These new fields provide important context for token-related group actions, ensuring that the group action contains all necessary information about which contract and token it applies to. This is part of the improved proof system for group actions mentioned in the PR objectives.


184-188: Updated GroupActionV0 with contract_id and token_contract_position fields.

The second group action is also updated with the necessary contract and token position fields, maintaining consistency with the updated struct definition.


191-204: Added closes_group_action parameter to add_group_action.

The new false parameter indicates that this action doesn't close the group action. This enhancement allows for distinguishing between active and closed group actions, which is crucial for the new proof system's reliability.


207-221: Added closes_group_action parameter to add_group_action.

Similar to the first call, this action also doesn't close the group action (false). This is consistent with the improved handling of group action lifecycles.


415-419: Updated GroupActionV0 with contract_id and token_contract_position fields.

The test data is consistently updated with the required fields for all group actions, ensuring proper test coverage of the enhanced struct.


421-425: Updated GroupActionV0 with contract_id and token_contract_position fields.

Continues the pattern of adding the new fields to all group actions in the test.


427-437: Updated GroupActionV0 with contract_id and token_contract_position fields.

This transfer action is properly updated with the new fields required by the enhanced GroupActionV0 struct.


439-449: Updated GroupActionV0 with contract_id and token_contract_position fields.

The last group action in the test is also updated with the new fields, maintaining consistency across all test cases.


452-465: Added closes_group_action parameter to add_group_action.

The closes_group_action flag is consistently set to false across all add_group_action calls, ensuring that the actions remain active.


468-481: Added closes_group_action parameter to add_group_action.

The second call to add_group_action also includes the closes_group_action flag set to false, maintaining consistency.


484-497: Added closes_group_action parameter to add_group_action.

All add_group_action calls are consistently updated with the new parameter throughout the test case.


500-513: Added closes_group_action parameter to add_group_action.

The final call to add_group_action is also properly updated with the new closes_group_action parameter.

packages/rs-drive/src/drive/group/fetch/fetch_action_id_signers_power/v0/mod.rs (3)

1-1: Updated import to use the renamed group_active_action_path function.

The import has been updated to use the more specific group_active_action_path function instead of the generic group_action_path. This change explicitly indicates that the operation targets active group actions.


47-51: Updated to use group_active_action_path for constructing the path.

The code now uses group_active_action_path to construct the GroveDB path for fetching action signers, making it clear that this operation targets active group actions.


104-108: Updated to use group_active_action_path consistently.

This ensures consistent use of the renamed path function throughout the file. This is part of the broader enhancement that distinguishes between active and closed group actions.

packages/rs-drive/src/state_transition_action/action_convert_to_operations/batch/token/token_set_price_for_direct_purchase_transition.rs (2)

60-68: Enhanced GroupActionV0 with contract_id and token_contract_position fields.

The group action now includes two important new fields:

  1. contract_id - Specifies which contract the action belongs to
  2. token_contract_position - Identifies the token's position within the contract

These new fields provide critical context for token-related group actions, ensuring that the generated proof contains all necessary information.


70-78: Added closes_group_action flag to AddGroupAction operation.

The closes_group_action flag now determines whether this operation should close the group action. It's derived from the base transition's perform_action() method, establishing a clear connection between performing an action and closing it.

This enhancement supports the improved proof system by tracking whether actions remain active or are closed.

packages/rs-dpp/src/group/group_action/mod.rs (3)

3-5: Appropriate imports added for the new trait.

The new imports correctly support the GroupActionAccessors trait that's being added to this file, providing the necessary types for the accessors.

Also applies to: 9-9


19-23: Well-designed accessor trait.

This trait provides a clean interface for accessing key properties of group actions. The trait declaration clearly defines the contract with three essential accessor methods.


24-42: Good implementation of the accessor trait for GroupAction.

The implementation properly delegates to the inner variant methods, providing a consistent interface regardless of the version. This pattern ensures that clients don't need to know about the internal structure of the enum.

packages/rs-drive/src/drive/group/paths.rs (2)

91-103: Function rename clarifies it's for active actions only.

The function was renamed from group_action_path to group_active_action_path to explicitly indicate its association with active group actions. This improves code clarity and aligns with the distinction between active and closed actions.


106-118: Vector version of path function also renamed consistently.

Similarly, group_action_path_vec was renamed to group_active_action_path_vec to maintain consistency with the non-vector version. This rename is part of a broader refactoring to explicitly distinguish between active and closed group actions.

packages/rs-drive/src/util/batch/drive_op_batch/group.rs (2)

32-34: Added boolean flag to indicate group action closure.

The new closes_group_action field added to GroupOperationType::AddGroupAction enables distinguishing between initiating a new action and closing an existing one. The comment clearly explains its purpose.


56-62: Parameter properly passed to add_group_action_operations.

The implementation correctly passes the new closes_group_action parameter to the drive method. This change aligns with the enhanced group action lifecycle management where actions can be explicitly marked as closed.

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

128-130: Simplified syntax for BTreeMap initialization.

The code now uses a more concise syntax for initializing the BTreeMap of member powers, improving readability while maintaining the same functionality.

Also applies to: 136-139


174-178: Added new required fields to GroupActionV0.

The test correctly includes the new required fields contract_id and token_contract_position when constructing the GroupActionV0 instance, ensuring the tests reflect the updated data structure.


180-184: Consistent structure for all test GroupActionV0 instances.

This second test action is also correctly updated with the new required fields, maintaining consistency across all test cases.


191-193: Updated add_group_action call with new parameter.

The test now includes the new closes_group_action parameter (set to false) when calling add_group_action, reflecting the API changes for group action management.


207-209: All add_group_action calls consistently updated.

All calls to add_group_action throughout the test file have been updated to include the closes_group_action parameter, ensuring consistent testing of the new API.

Also applies to: 223-225


444-448: Test for closed actions updated with new fields.

The test for closed actions now correctly includes the required contract_id and token_contract_position fields in the GroupActionV0 instance, maintaining test validity with the updated data structures.


455-456: Consistent parameter update in final test case.

The final test case also correctly includes the new closes_group_action parameter in the add_group_action call, ensuring all tests consistently exercise the new API.

packages/rs-drive/src/util/grove_operations/mod.rs (1)

140-140: Addition of a new batch_move module looks good!

This addition follows the established pattern of modular organization in this file, where each Grove DB operation type has its own module.

packages/rs-drive/src/state_transition_action/action_convert_to_operations/batch/token/token_config_update_transition.rs (2)

63-64: Enriching GroupActionV0 with additional context data looks good!

Adding the contract_id and token_contract_position fields to GroupActionV0 improves the traceability and contextual information available for group actions. This is a valuable enhancement for tracking and identifying token-related group actions.


78-78: Properly implementing group action lifecycle with closes_group_action flag

Adding the closes_group_action flag derived from perform_action() enables proper lifecycle management of group actions. This allows the system to distinguish between active and closed group actions, which is essential for the improved proof system described in the PR objectives.

packages/rs-dpp/src/group/group_action/v0/mod.rs (3)

1-7: Imports for new fields look good

The additional imports support the new fields being added to GroupActionV0 and its accessor implementation.


14-16: Enhanced GroupActionV0 with additional context fields

Adding contract_id and token_contract_position to GroupActionV0 provides valuable context information that helps with group action identification and verification. This is well-aligned with the PR objective of improving the proof system for group actions.


19-31: Well-implemented accessor trait for GroupActionV0

The implementation of GroupActionAccessors provides a clean, standardized interface for accessing the fields of GroupActionV0. This improves code consistency and follows good object-oriented design principles.

packages/rs-drive/src/state_transition_action/action_convert_to_operations/batch/token/token_destroy_frozen_funds_transition.rs (1)

73-74: Confirm semantic coupling between closes_group_action and perform_action()

You derive closes_group_action straight from self.base().perform_action().
For most token transitions this is correct, but if future versions introduce “dry-run” transitions (perform=false yet still closing the action) this direct tie may become brittle.

Consider exposing an explicit accessor on TokenBaseTransitionAction (e.g. closes_group_action()) or documenting that perform_action() doubles as a “close” flag for destroy-frozen-funds.

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

28-39: Inconsistent inclusion of GroupActionStatus across new variants

The three new “token group action” variants that carry balances, identity info, and pricing schedules include a GroupActionStatus, yet the …WithDocument variant does not. Was that intentional?

If action status is relevant for those three cases it is probably also valuable when returning an associated document; omitting it may force downstream callers to fetch status separately.

-VerifiedTokenGroupActionWithDocument(GroupSumPower, Option<Document>),
+VerifiedTokenGroupActionWithDocument(GroupSumPower, GroupActionStatus, Option<Document>),

Confirm whether the extra field is required for consistency.

packages/rs-drive/src/util/grove_operations/batch_delete/mod.rs (2)

8-8: LGTM: New import for DeleteOptions.

Clean addition of the DeleteOptions import from grovedb for supporting customizable delete operations.


55-96: Well-structured extension for customizable delete operations.

This new method appropriately extends the existing batch delete functionality by accepting customizable DeleteOptions. The implementation follows the established versioning pattern and error handling approach used throughout the codebase.

packages/rs-drive/src/verify/state_transition/state_transition_execution_path_queries/mod.rs (3)

1-5: LGTM: Clean imports for the new module.

The imports are appropriate for the functionality being introduced.


6-36: Well-documented trait introduction with clear purpose.

The documentation comprehensively explains the trait's purpose, required methods, and expected behavior. It provides good context for implementers about when and how to use this trait.


37-48: Good trait design for converting transitions to path queries.

The TryTransitionIntoPathQuery trait is well-designed with an associated error type and a clear method signature. This abstraction will help standardize how state transitions are converted to path queries across different transition types.

packages/rs-drive/src/state_transition_action/batch/batched_transition/token_transition/token_base_transition_action/v0/transformer.rs (2)

70-91: Improved group action validation with early detection of closed actions.

This addition properly checks if a group action is already closed before attempting to fetch signers' power, preventing unnecessary processing and providing appropriate error responses. The error handling uses the correct error type (GroupActionAlreadyCompletedError) and follows the established pattern.


204-225: Consistent implementation of closed action check in borrowed version.

The same improvement has been correctly applied to the borrowed base transition method, maintaining consistency between the two implementations. This ensures that both entry points have the same validation logic.

packages/rs-drive/src/drive/group/fetch/fetch_action_is_closed/mod.rs (2)

1-11: LGTM: Well-structured new module with appropriate imports.

The module organization and imports follow the established patterns in the codebase.


12-48: Clear implementation of a method to check group action status.

The fetch_action_is_closed method is well-documented and follows the versioning pattern used throughout the codebase. It provides a clean API for determining whether a group action is closed or still active, which is essential for the enhanced group action proof system described in the PR objectives.

packages/rs-drive/src/util/grove_operations/batch_move/mod.rs (1)

16-26: LGTM! Well-structured batch move operation implementation

The implementation follows the standard pattern for versioned operations in the codebase and has proper error handling.

packages/rs-drive/src/verify/group/verify_action_signers_total_power/mod.rs (2)

18-47: Excellent documentation and implementation

The documentation is thorough and clearly explains the purpose, parameters, return values, errors, and versioning. The implementation properly handles version dispatch.


49-82: Well-structured method implementation

The method follows the standard pattern for versioned dispatch and includes proper error handling for unknown versions.

packages/rs-drive/src/util/grove_operations/batch_move_items_in_path_query/mod.rs (1)

12-12: LGTM! Well-structured parameter addition

The parameter alter_flags_to_new_flags is properly added to the method signature, documentation, and passed to the versioned implementation.

Also applies to: 21-21, 36-36, 51-51

packages/rs-drive/src/drive/group/estimated_costs/for_add_group_action/v0/mod.rs (1)

174-218: Potential double-insert of identical layer-info entries when called twice

When also_add_closed_tree is true the function unconditionally inserts
entries for the closed-action root/path/signers. If the caller ever invokes
add_estimation_costs_for_add_group_action_v0 first with false (for the
active tree) and later with true (e.g. for closing the same action in the
same estimation map) the HashMap::insert will overwrite the previous records
silently, losing the active-tree estimates.

Consider guarding each insert with entry().or_insert_with(...), or providing
separate maps for active / closed estimations so information cannot be lost.

packages/rs-drive/src/util/grove_operations/batch_move_items_in_path_query/v0/mod.rs (1)

240-459: Unit tests do not exercise the new flag-alteration branch

All added tests pass None for alter_flags_to_new_flags. Edge-cases such as
Some(None) (strip flags) and Some(Some(flags)) (replace with new) are still
untested, so regressions could slip in unnoticed.

Would you like help writing a small test that moves items while stripping their
flags to confirm the behaviour?

packages/rs-drive/src/verify/group/verify_action_signers_total_power/v0/mod.rs (2)

91-103: Subset verification path may drop parent feature

verify_subset_query_get_parent_tree_info() only returns the immediate parent feature of the queried key.
If action_signer_id is several levels below the summed root, the returned tree_feature can be None, causing a false “expected a summed tree” error.

Double-check that the query always targets the first level under the summed-Merk node or fetch the feature from proved_key_values instead of the parent info when tree_feature.is_none().


117-131: ⚠️ Potential issue

Casting aggregate power may truncate

aggregate_power comes from TreeFeatureType::SummedMerkNode(u64), but GroupSumPower is an alias for u128.
The as cast is silent and lossy if values exceed u64::MAX.

Either:

  1. Change TreeFeatureType::SummedMerkNode to hold a wider type, or
  2. Return u64 here and up-cast later with explicit widening.
-Ok((root_hash, action_status, aggregate_power as GroupSumPower))
+Ok((root_hash, action_status, GroupSumPower::from(aggregate_power)))

Likely an incorrect or invalid review comment.

packages/rs-drive/src/util/grove_operations/batch_delete/v0/mod.rs (1)

24-31: validate_tree_at_path_exists: false may hide data-loss bugs

Setting validate_tree_at_path_exists to false will silently proceed when the
target path is mistyped or was pruned earlier, potentially deleting the wrong
element (because the resolved path collapses).

Unless there is a strong performance reason, prefer enabling the check:

-validate_tree_at_path_exists: false,
+validate_tree_at_path_exists: true,

or expose the choice to the caller instead of hard-coding it.

packages/rs-drive/src/util/grove_operations/batch_move/v0/mod.rs (1)

302-331: Test covers tree move error — good catch

The negative test ensures we don’t accidentally move sub-trees.
No issues spotted here – thanks for the defensive test.

packages/rs-drive/src/verify/state_transition/verify_state_transition_was_executed_with_proof/v0/mod.rs (1)

352-360: Use caller-supplied block_info when building the expected historical document

build_historical_document currently receives &BlockInfo::default(), which
throws away the real block height / time provided by the caller and may cause
false negatives when the verifier compares system-populated fields (e.g.
blockHeight, blockTime). Passing the actual block_info keeps the check
honest.

-        &BlockInfo::default(),
+        block_info,
packages/rs-drive/src/drive/group/insert/add_group_action/mod.rs (4)

27-27: Clear parameter addition for group action closing functionality

The new boolean parameter closes_group_action is added to distinguish between active and closing group actions, which aligns with the PR objective of improving the group action proof system.


41-41: Parameter correctly passed to implementation method

The closes_group_action parameter is correctly passed to the version-specific implementation, maintaining consistency with the public API.


65-65: Consistent parameter addition in operation building method

The closes_group_action parameter is similarly added to the operation-building method and properly passed to its implementation, maintaining API consistency across the related methods.

Also applies to: 80-80


104-104: Parameter consistently added to operations generation method

The parameter addition to add_group_action_operations completes the consistent implementation across all three related methods, properly supporting the distinction between active and closing group actions.

Also applies to: 120-120

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 a21764d into v2.0-dev May 12, 2025
147 of 148 checks passed
@QuantumExplorer QuantumExplorer deleted the feat/groupProofs branch May 12, 2025 22:17
@coderabbitai coderabbitai bot mentioned this pull request Sep 24, 2025
6 tasks
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.

3 participants