Skip to content

fix(contracts): check virtual offset additions - #609

Open
samlogy1 wants to merge 1 commit into
drydocs:mainfrom
samlogy1:fix/checked-pricing-additions
Open

fix(contracts): check virtual offset additions#609
samlogy1 wants to merge 1 commit into
drydocs:mainfrom
samlogy1:fix/checked-pricing-additions

Conversation

@samlogy1

Copy link
Copy Markdown

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 test pass locally
  • [ ]

Closes #

Return ContractError::Overflow when pricing offset additions exceed i128 instead of panicking.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <[email protected]>
@vercel

vercel Bot commented Aug 27, 2026

Copy link
Copy Markdown

@samlogy1 is attempting to deploy a commit to the Collins' projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Aug 27, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@collinsezedike collinsezedike left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@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_assets toward the limit where the addition would overflow and asserts ContractError::Overflow is 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: ## Summary has no bullet, both ## Test plan boxes are unchecked, and there's a dangling Closes # with no number at the end on top of the closes #569 already at the top. Please fill it in per CONTRIBUTING.md's PR body format.

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.

[Bug] Unchecked additions inside the checked pricing expression

2 participants