feat: harden pause and resume authorization (#152) - #166
Draft
s6pa1rta3n-lab wants to merge 2 commits into
Draft
Conversation
10 tasks
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
Closes #152
This pull request centralizes pause policy, hardens authorization across pause/resume lifecycles, and introduces a full entrypoint-matrix test suite covering all state transitions and recovery paths.
Acceptance Criteria Checklist
settle_streamandbatch_settle) on paused streams return 0 and deduct zero value from the remaining balance (tests/issue152_pause_resume_matrix.rs:test_settle_stream_while_paused_moves_zero_value,test_batch_settle_while_paused_moves_zero_value).cancel_stream) and stops (stop_stream) while paused are strictly reserved for the stream payer viarequire_auth()and cleanly terminalize the stream (tests/issue152_pause_resume_matrix.rs:test_recovery_path_cancel_while_paused,test_recovery_path_stop_while_paused,test_unauthorized_recovery_paths_rejected,test_non_payer_role_transition_isolation).start_timeto the current ledger timestamp, clearspaused_at, and handles terminalization if the schedule ended while paused (tests/issue152_pause_resume_matrix.rs:test_resume_preserves_balance_and_updates_start_timestamp,test_multiple_pause_resume_cycles_strictly_conserve_balance,test_resume_on_stream_past_natural_end_is_terminal).tests/issue152_pause_resume_matrix.rs:test_entrypoint_matrix_unstarted_stream,test_entrypoint_matrix_active_stream,test_entrypoint_matrix_paused_stream,test_entrypoint_matrix_stopped_terminal_stream,test_entrypoint_matrix_cancelled_terminal_stream,test_rapid_toggle_at_same_timestamp).Security & Failure Mode Considerations
info.payer.require_auth()).accrual_bound(now, end_time, paused_at)ensuring no double crediting or unearned token movement occurs during pause intervals.end_timetransitions the stream directly to an inactive terminal state without resurrecting accrual.saturating_mul,saturating_sub,.min(balance)) protects against integer overflow.Payout Routing
0xF46C9F6d70C50BF81ef3588AB523a90a594a2F89GCL6OXAMLD75BMTINA6EMRUDWK5THQUSHMYNLSNBCJAPZJHNYJTUNIBC