Skip to content

Add set treasury two step rotation#607

Open
gloskull wants to merge 2 commits into
CalloraOrg:mainfrom
gloskull:add-set-treasury-two-step-rotation
Open

Add set treasury two step rotation#607
gloskull wants to merge 2 commits into
CalloraOrg:mainfrom
gloskull:add-set-treasury-two-step-rotation

Conversation

@gloskull

Copy link
Copy Markdown

Motivation
Introduce a dedicated treasury principal for deposit_yield() so yield-deposit authority can be rotated separately from the admin for stronger operational security.
Use a two-step nomination/accept pattern for rotating the treasury to avoid accidental or unilateral changes to deposit authority.
Preserve backward compatibility by defaulting the new treasury slot to the existing admin on initialization.
Description
Add dedicated storage keys and views: TREASURY_KEY / PENDING_TREASURY_KEY, get_treasury(), and get_pending_treasury() and initialize treasury to the admin in init() (changes in contracts/revenue_pool/src/lib.rs).
Implement two-step rotation entrypoints set_treasury(caller, new_treasury), accept_treasury(env, caller), and cancel_treasury_transfer(env, caller) with TTL bumps and events, and update deposit_yield() to require the configured treasury (not implicitly admin) (changes in contracts/revenue_pool/src/lib.rs).
Add event helpers for treasury lifecycle topics and unit tests for their byte identity in contracts/revenue_pool/src/events.rs, plus document new events and update the revenue-pool interface JSON and EVENT_SCHEMA.md to describe the new calls and event shapes.
Add focused unit tests exercising initialization, nomination, acceptance, cancellation, authorization rejections, and post-acceptance behaviour, and small proptest adjustment to maintain invariant checks (changes in contracts/revenue_pool/src/test.rs and contracts/revenue_pool/src/test_proptest.rs).
Testing
Ran cargo test -p callora-revenue-pool which passed locally (101 tests passed).
Ran bash scripts/check-event-shape.sh which verified event publish sites match EVENT_SCHEMA.md and passed.
Ran rustfmt --check on modified revenue pool files which passed formatting checks.
Ran cargo test across the workspace which failed due to unrelated compile errors in the settlement contract (duplicate/mismatched symbols and types outside the revenue-pool changes); these workspace-level failures are pre-existing and not caused by the revenue-pool changes.
Closes #564

gloskull added 2 commits June 28, 2026 23:48
…plementation

feat(revenue-pool): two-step treasury rotation (set_treasury)
@gloskull

Copy link
Copy Markdown
Author

Done with this issue.
Please merge and give and high review.
Please if there are any more tasks, assign them to me, i'd make sure to get them done quickly and submit my PR's in under 5 hours

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.

Add set_treasury two-step rotation

1 participant