Add validation for beneficiary basis points sum in plan updates#965
Merged
ONEONUORA merged 9 commits intoJul 18, 2026
Merged
Conversation
- Add update_plan function to contract with allocation_bps validation
- Add PUT /api/plans/{id} endpoint to backend with allocation_bps validation
- Enforce that beneficiary allocation_bps sum equals exactly 10000 (100%)
- Return Error::InvalidBasisPoints in contract if validation fails
- Return 400 error with descriptive message in backend if validation fails
- Both contract and backend now validate on plan updates
Fixes Fracverse#960
Fixes ethnum v1.5.2 transmute error with newer Rust toolchain
The contract CI failure is due to ethnum v1.5.2 incompatibility with CI's Rust toolchain. This is a pre-existing infrastructure issue unrelated to the validation feature changes. The contract compiles successfully locally with the original SDK version.
ethnum v1.5.2 has a transmute bug that fails with Rust 1.71+ Pinning to 1.70.0 resolves the CI build failure
Lock file version 4 is incompatible with Rust 1.70.0 Regenerated with correct Rust version to match CI toolchain
ONEONUORA
approved these changes
Jul 18, 2026
ONEONUORA
left a comment
Contributor
There was a problem hiding this comment.
Great job @anonfedora
Thank you for your contribution
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.
Title: Add validation for beneficiary basis points sum in plan updates
Description:
This PR addresses issue #960 by adding validation to ensure that the sum of beneficiary allocation basis points (
allocation_bps) equals exactly 10000 (100.00%) in any plan updates.Changes Made
Smart Contract (contracts/inheritance-contract/src/lib.rs)
allocation_bpssum equals exactly 10000Error::InvalidBasisPointsif validation failsBackend API (backend/src/api.rs)
allocation_bpsdoes not exceed 10000allocation_bpsequals exactly 10000 - returns 400 error with descriptive message if not/api/plans/{id}endpoint added to user routes (requires signature authentication)putimport: Updated routing imports to support PUT methodValidation Logic
Both the contract and backend enforce the same validation:
allocation_bpscannot exceed 10000allocation_bpsmust equal exactly 10000 (100%)Error::InvalidBasisPoints"Total allocation_bps must be exactly 10000 (100%), got {actual_sum}"Testing
Related Issues
Fixes #960