-
Notifications
You must be signed in to change notification settings - Fork 44
fix(dpp): correct stepwise distribution logic in evaluate.rs #2636
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 changes update the function signature of Changes
Sequence Diagram(s)sequenceDiagram
participant Test
participant Platform
participant Contract
participant DistributionFunction
Test->>Platform: create_token_contract_with_owner_identity(..., contract_start_block, ...)
Platform->>Contract: Set created_at_block_height = contract_start_block or 0
Test->>DistributionFunction: evaluate(x)
alt Stepwise variant
DistributionFunction->>DistributionFunction: if x < contract_registration_step return 0
DistributionFunction->>DistributionFunction: steps.range(..(x - contract_registration_step))
else StepDecreasingAmount variant
DistributionFunction->>DistributionFunction: era_intervals_passed = ...
end
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (14)
🧰 Additional context used🧠 Learnings (1)📓 Common learnings
🧬 Code Graph Analysis (2)packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/freeze/mod.rs (5)
packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/config_update/mod.rs (5)
⏰ Context from checks skipped due to timeout of 90000ms (20)
🔇 Additional comments (46)
✨ 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 (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Self Reviewed
Issue being fixed or feature implemented
Fixes the logic for calculating stepwise distribution in the
evaluate.rs
file to ensure correct distribution amounts are returned.What was done?
steps_passed
toera_intervals_passed
for clarity.contract_registration_step
.x
is less thancontract_registration_step
to return0
immediately.How Has This Been Tested?
The changes have been tested through existing unit tests and additional tests have been added to ensure the correctness of stepwise distribution calculations.
Breaking Changes
None
Checklist
For repository code-owners and collaborators only
Summary by CodeRabbit
New Features
Bug Fixes
Tests
Refactor