You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] BlendAdapter uses unchecked subtraction where DefindexAdapter guards it #1106
BlendAdapter computes deposit and withdrawal deltas with raw subtraction. The DefindexAdapter guards the identical operation against a negative result and overflow and returns a typed error. On the Blend path, a below-baseline read traps with an opaque host panic instead of the adapter's own error variant.
Tasks
packages/contracts/blend-adapter/src/lib.rs:155 computes let b_tokens_credited = b_tokens_after - b_tokens_before;.
packages/contracts/blend-adapter/src/lib.rs:211 computes let delivered = after - before;.
packages/contracts/defindex-adapter/src/lib.rs:196-208 handles the same shape by checking shares_after < shares_before first, then using checked_sub, and panicking with ContractError::Overflow in both cases.
Apply the same guarded subtraction on the Blend path, using the Blend adapter's error enum.
Scope
Field
Value
Area
Contracts
Protocol affected
Blend
Network
testnet and mainnet
Breaking change?
No
Acceptance Criteria
Both Blend subtraction sites guard against a negative result and overflow.
Tests cover the below-baseline case and assert the typed error.
cargo fmt --all, cargo clippy --all-targets -- -D warnings, and cargo test --all pass under packages/contracts.
Additional Context
Found in a repository-wide code audit on 2026-10-16 and re-verified against the source at 9c7109f.
Star the repo
Please star this repository before picking up this issue. It is a small ask that meaningfully helps the project reach more people.
Congratulations, @laxjovial! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on October 22, 2026.
🧑💻 @laxjovial: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.
Warning
When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.
🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.
😎 @laxjovial: You earned 200 Points for completing this issue! Once the Wave's rewards are finalized, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.
🧑💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.
Activity
laxjovial commentedon Oct 17, 2026
@laxjovial has applied to work on this issue as part of the Stellar Wave Program's 10th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @laxjovial to this issue.
VeronicDev commentedon Oct 17, 2026
@VeronicDev has applied to work on this issue as part of the Stellar Wave Program's 10th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @VeronicDev to this issue.
drips-wave commentedon Oct 17, 2026
Congratulations, @laxjovial! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on October 22, 2026.
🧑💻 @laxjovial: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.
Warning
When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.
🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.
🌊 Happy Wave 🌊
grantfox-oss commentedon Oct 23, 2026
🎉 This issue has been marked as completed on GrantFox!
@laxjovial's PR #1182 was approved and merged by @collinsezedike.
🏆 @laxjovial: You earned 35 FoxPoints for this contribution! Your current tier: Explorer (901 total points). Track your full progress on GrantFox.
👏 Great work, @laxjovial! Keep contributing to drydocs.
drips-wave commentedon Oct 23, 2026
This issue has been completed by @laxjovial as part of the Stellar Wave Program's 10th Wave 🥳
😎 @laxjovial: You earned 200 Points for completing this issue! Once the Wave's rewards are finalized, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.
🧑💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.