Repository navigation
Harden governor & treasury_streams initialization and governor vote arithmetic - #604
Merged
techisigu merged 6 commits intoOct 24, 2026
Merged
Conversation
… authorization check at al Closes stellar-vortex-protocol#580
…` has the identical missin Closes stellar-vortex-protocol#581
…eadline arithmetic uses ra Closes stellar-vortex-protocol#582
|
@meetestherpeter 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! 🚀 |
- governor/src/lib.rs: merged [markers] — model resolved the conflict markers Co-authored-by: Simple Agent <agent@simple.dev>
- governor/src/lib.rs: merged [markers] — model resolved the conflict markers Co-authored-by: Simple Agent <agent@simple.dev>
- governor/src/lib.rs: merged [markers] — model resolved the conflict markers - treasury_streams/Cargo.toml: merged [markers] — model resolved the conflict markers Co-authored-by: Simple Agent <agent@simple.dev>
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.
Summary
Harden governor & treasury_streams initialization and governor vote arithmetic
What was solved
#580 — [High]
governor::initializehas no authorization check at all — anyone can claim and configure a freshly-deployed governorAdd an authorization check to
governor::initializeso an arbitrary caller cannot front-run and configure a freshly-deployed governor. The issue's preferred approach is migrating to Soroban's__constructorpattern (astimelockdoes), which removes the front-running window entirely; alternatively, add an explicitrequire_auth()on the deploying admin. The fix must include a test confirming an unauthorized caller cannot initialize the contract.Addressed:
initialize(or its constructor-pattern replacement) must not be callable/front-runnable by an unauthorized partyrequire_auth()on the admin, or migrate to__constructorpertimelock/src/lib.rsprecedent#581 — [High]
treasury_streams::initializehas the identical missing-authorization bug asgovernor(#120)Add an explicit authorization check to
treasury_streams::initializeso an unauthorized party cannot front-run initialization and set themselves asgovernor. The fix mirrors the siblinggovernorcrate pattern (issue #120): require auth from the suppliedgovernoraddress before persisting it, and add a test confirming an unauthorized caller is rejected.Addressed:
governor.require_auth()(or equivalent explicit auth check) intreasury_streams::initializebefore writingDataKey::Governorto storageAlreadyInitializedguard and all other initialize behavior#582 — [High]
governor's vote-tally and deadline arithmetic uses raw, unchecked operators instead of this codebase's establishedchecked_*/saturating_*conventionReplace unchecked vote-tally accumulation and deadline arithmetic in
governor/src/lib.rswith checked arithmetic that fails closed with dedicated errors, and add a boundary test. Scope is limited to the four arithmetic sites incast_voteandpropose(for/against/abstain tallies and the snapshot+delay+period deadline), optionally factoring the deadline into a single helper to remove duplication.Addressed:
proposal.for_votes += powerwithchecked_add, panicking with a dedicated error on overflowproposal.against_votes += powerandproposal.abstain_votes += powerwithchecked_addand dedicated overflow errorssnapshot + config.voting_delay + config.voting_periodexpression inproposewith achecked_addchain (or a single helper) that fails closedChanges
treasury_streams/src/lib.rs(modify)governor/src/lib.rs(modify)treasury_streams/Cargo.toml(modify)Approach
governor::initializehas no authorization check at all — anyone can claim and configure a freshly-deployed governor #580 — [High]governor::initializehas no authorization check at all — anyone can claim and configure a freshly-deployed governor (Changed: governor/src/lib.rs)treasury_streams::initializehas the identical missing-authorization bug asgovernor(#120) #581 — [High]treasury_streams::initializehas the identical missing-authorization bug asgovernor(Add a distinct 'pauser' role separate from full admin #120) (Changed: treasury_streams/src/lib.rs, treasury_streams/Cargo.toml)governor's vote-tally and deadline arithmetic uses raw, unchecked operators instead of this codebase's establishedchecked_*/saturating_*convention #582 — [High]governor's vote-tally and deadline arithmetic uses raw, unchecked operators instead of this codebase's establishedchecked_*/saturating_*convention (Changed: governor/src/lib.rs)Issues
Closes #580
Closes #581
Closes #582