-
Notifications
You must be signed in to change notification settings - Fork 53
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
contracts: fix share points check #2597
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
WalkthroughThe pull request introduces a modification to the Changes
Sequence DiagramsequenceDiagram
participant Func as compute_total_share_points
participant Hasher as Poseidon Hash
participant Storage as Point Tracking Storage
Func->>Hasher: Generate unique key
Hasher-->>Func: Hashed key (entity ID + epoch)
Func->>Storage: Check if points already added
alt Points not added
Func->>Storage: Add points
else Points already added
Func->>Func: Raise error with detailed message
end
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🔇 Additional comments (4)contracts/src/systems/hyperstructure/contracts.cairo (4)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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.
The changes look good and fix the issue with points calculation for different epochs of the same hyperstructure. The implementation is secure using poseidon_hash_span to create unique keys from both hyperstructure ID and epoch index. The only minor suggestion is to enhance the error message for better debugging.
Thanks for using MentatBot. Give comments a 👍 or 👎 to help me improve!
array![hyperstructure_entity_id.into(), index.into()].span() | ||
); | ||
|
||
if points_already_added.get(points_already_added_key) { | ||
panic!("points already added for hyperstructure {}", hyperstructure_entity_id); |
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.
Consider enhancing the error message to include the epoch index for better debugging. Something like: points already added for hyperstructure {} epoch {}
panic!("points already added for hyperstructure {}", hyperstructure_entity_id); | |
panic!("points already added for hyperstructure {} epoch {}", hyperstructure_entity_id, index); |
Failed to generate code suggestions for PR |
Summary by CodeRabbit
New Features
Bug Fixes