Repository navigation
Events 2.1.0: grant milestone splits - #167
Merged
Merged
Conversation
A grant can be published with ReleaseKind::Split: each milestone's share of every award in basis points, in milestone order, adding up to 10,000. Each claim or forfeit pays that milestone's share, rounded down, and whichever milestone settles last takes what is left, so an award pays exactly its amount in any order. create_event refuses a split that is empty, longer than 20, has a zero share or does not add up (InvalidMilestoneSplit, 98), or is not on a grant; selection refuses an award too small for its smallest share. The variant is appended, so stored records decode and existing callers are unaffected. Testnet runs 2.1.0 since 2026-10-08 (runbook Section 9; grant run 337/337 with a split grant). Mainnet still goes to 2.0.0 first and takes 2.1.0 as a separate upgrade.
Plan expiredYour subscription has expired. Please renew your subscription to continue using CI/CD integration and other features. |
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.
Events 2.1.0: a grant can pay its milestones fixed, unequal shares of each award. This is the contract half of boundlessfi/boundless-nestjs#890 and boundlessfi/boundless-platform#809 (backend boundlessfi/boundless-nestjs#921, platform boundlessfi/boundless-platform#836).
Testnet already runs this build (details below). Mainnet does not change: it still goes from 1.7.0 to 2.0.0 through runbook Section 8, and takes 2.1.0 later as its own upgrade.
Why a contract change
2.0.0 pays every grant claim
award / n, with whichever milestone settles last taking the remainder, andclaim_milestonetakes no amount. A 30 / 40 / 30 split could not be paid however the backend recorded it.What changes
ReleaseKind::Split(Vec<u32>): each milestone's share of an award in basis points, in milestone order. The variant is appended, so stored records still decode and a caller that only sendsSingleorMultiis unaffected.create_eventaccepts a split only on a grant, and refuses one that is empty, longer than 20 milestones, has a zero share or does not add up to 10,000, with the newInvalidMilestoneSplit(98).claim_milestoneandforfeit_milestonepay a milestone its share, rounded down; whichever settles last still takes what is left, which is its own share plus every rounding, so an award pays exactly its amount in any order.select_winnersrefuses an award too small for the smallest share to pay a stroop, as it already did for an award smaller than its milestone count. That check stays a comparison forMulti, which has no length cap.Cargo.toml,INITIAL_VERSION, contractmeta). WASM 63,294 bytes against the 64 KB ceiling (2.0.0 was 61,641).Testing
cargo test --release: 337 events and 60 profile tests. A newsplitgroup covers storage, every refusal, payouts per share, awards of different sizes, rounding in any settlement order, forfeits and selecting once. The randomized run now gives half its multi-milestone grants a random split; 400 seeds reconcile to the last token.scripts/test-storage-compat.sh: the mainnet replay upgrades into this build and then pays a split grant in full.-D warnings,check-versions.sh, the admin-script and upgrade-guard tests: all pass.CBEODVJG…went 2.0.0 to 2.1.0 on 2026-10-08 (proposedfc713ba2…, appliedd3f1e8c0…, 10migrate_eventspages, stampedd91f1ddc…). A grant created on 2.0.0 reads the same afterwards. The grant run, with a new split scenario, passed 337 of 337 checks across 163 transactions (docs/audit/testnet-grant-run-2.1.0.md); the 2.0.0 report is unchanged.Docs
Merge with a squash; the branch is one commit.