fix(contracts): check virtual offset additions - #609
Open
samlogy1 wants to merge 1 commit into
Open
Conversation
Return ContractError::Overflow when pricing offset additions exceed i128 instead of panicking. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <[email protected]>
|
@samlogy1 is attempting to deploy a commit to the Collins' projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@samlogy1 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
collinsezedike
requested changes
Aug 27, 2026
collinsezedike
left a comment
Collaborator
There was a problem hiding this comment.
@samlogy1 the fix itself is correct, both additions now go through checked_add before the multiply/divide, matching the issue's proposed solution exactly. Two things needed before this can merge:
- No test covers the overflow path this fix adds. Add one that drives
total_shares/total_assetstoward the limit where the addition would overflow and assertsContractError::Overflowis returned. PR #605 in this repo is a good model for how to trigger an overflow in a test. - The PR body is still the unfilled template:
## Summaryhas no bullet, both## Test planboxes are unchecked, and there's a danglingCloses #with no number at the end on top of thecloses #569already at the top. Please fill it in perCONTRIBUTING.md's PR body format.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #569
Return ContractError::Overflow when pricing offset additions exceed i128 instead of panicking.
🤖 Generated with Codebuff
Summary
Test plan
pnpm lint && pnpm typecheck && pnpm testpass locallyCloses #