-
Notifications
You must be signed in to change notification settings - Fork 43
feat(dpp)!: add marketplace rules accessor to token configuration #2651
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe change enhances the Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant TokenConfigurationV0Getters
participant MarketplaceRules
Caller->>TokenConfigurationV0Getters: call all_change_control_rules()
TokenConfigurationV0Getters->>MarketplaceRules: access trade_mode_change_rules
TokenConfigurationV0Getters-->>Caller: return vector including trade_mode_change_rules
Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Self reviewed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/accessors.rs
(2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 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.
⏰ Context from checks skipped due to timeout of 90000ms (20)
- GitHub Check: PR title
- GitHub Check: Rust packages (dpp) / Detect immutable structure changes
- GitHub Check: Rust packages (dpp) / Linting
- GitHub Check: Rust packages (dash-sdk) / Tests
- GitHub Check: Rust packages (dash-sdk) / Unused dependencies
- GitHub Check: Rust packages (dash-sdk) / Linting
- GitHub Check: Rust packages (drive-abci) / Unused dependencies
- 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: Rust packages (drive) / Tests
- GitHub Check: Rust packages (drive) / Linting
- GitHub Check: Rust packages (drive) / Unused dependencies
- GitHub Check: Rust packages (wasm-dpp) / Unused dependencies
- GitHub Check: Rust packages (wasm-dpp) / Linting
- GitHub Check: Rust packages (wasm-dpp) / Tests
- GitHub Check: Build Docker images (Drive, drive, drive-abci) / Build Drive image
- GitHub Check: Build Docker images (Dashmate helper, dashmate-helper, dashmate-helper) / Build Dashmate helper image
- GitHub Check: Build Docker images (DAPI, dapi, dapi) / Build DAPI image
- GitHub Check: Build JS packages / Build JS
🔇 Additional comments (1)
packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/accessors.rs (1)
11-11
: LGTM! Import addition is correct.The import of
TokenMarketplaceRulesV0Getters
trait is necessary to access thetrade_mode_change_rules()
method used in theall_change_control_rules
method below.
( | ||
"trade_mode_change_rules", | ||
&self.marketplace_rules.trade_mode_change_rules(), | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
LGTM! Verify marketplace_rules field exists and consider updating all_used_group_positions.
The addition follows the existing pattern correctly. However, please verify two things:
- Ensure the
marketplace_rules
field exists on theTokenConfigurationV0
struct - If the trade mode change rules can contain group positions, consider updating the
all_used_group_positions
method (lines 118-165) to also process marketplace rules
🏁 Script executed:
#!/bin/bash
# Description: Verify that marketplace_rules field exists on TokenConfigurationV0 struct and check if all_used_group_positions needs updating
# Check if marketplace_rules field exists in TokenConfigurationV0 struct
ast-grep --pattern $'struct TokenConfigurationV0 {
$$$
marketplace_rules: $_,
$$$
}'
# Check if marketplace_rules is referenced elsewhere in all_used_group_positions logic
rg -A 5 -B 5 "marketplace_rules" --type rust
Length of output: 45548
🏁 Script executed:
#!/bin/bash
# Extract the all_used_group_positions method to verify inclusion of marketplace_rules
rg -n -A60 -B5 "fn all_used_group_positions" packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/accessors.rs
Length of output: 3541
Include marketplace_rules in all_used_group_positions
The new tuple in all_change_control_rules
is correct and the marketplace_rules
field exists on TokenConfigurationV0
. However, all_used_group_positions
(lines 118–165 in packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/accessors.rs
) doesn’t process marketplace_rules.trade_mode_change_rules()
. To capture any group positions from those change rules, add:
// After existing add_from_change_control_rules calls
add_from_change_control_rules(&self.marketplace_rules.trade_mode_change_rules());
🤖 Prompt for AI Agents
In
packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/accessors.rs
between lines 118 and 165, the all_used_group_positions method does not
currently process the marketplace_rules.trade_mode_change_rules(). To fix this,
add a call to add_from_change_control_rules passing
self.marketplace_rules.trade_mode_change_rules() after the existing calls to
add_from_change_control_rules within that method. This ensures group positions
from marketplace_rules are included in the aggregation.
Issue being fixed or feature implemented
Add support for accessing marketplace rules in the token configuration.
What was done?
Introduced a new accessor for marketplace rules within the
TokenConfigurationV0Getters
implementation. This includes the addition oftrade_mode_change_rules
to the existing set of rules.How Has This Been Tested?
Not tested, but obvious.
Breaking Changes
Yes
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
For repository code-owners and collaborators only
I have assigned this pull request to a milestone
Summary by CodeRabbit