refactor: extract typed boolean-flag storage accessors - #55
Merged
mikewheeleer merged 1 commit intoJun 24, 2026
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Jagadeeshftw
force-pushed
the
refactor/contracts-bool-flag-accessors
branch
from
June 24, 2026 02:29
ebe883f to
a00c6a7
Compare
Contributor
|
nice refactor — the typed flag accessors cut a lot of unwrap_or(false) noise. lgtm |
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
Pure refactor — behaviour is byte-for-byte identical. Adds two private free functions,
read_flag(centralising theunwrap_or(false)default) andwrite_flag, and routes every persistent boolean read/write through them: thePausedchecks inrecord_usage/settle; theRequireServiceRegistration/ServiceRegistered/ServiceDisabled/AllowlistEnabled/AgentAllowedreads inrecord_usage; the bool getters; and the bool writes inset_allowlist_enabled,set_agent_allowed,set_require_service_registration,register_service,pause/unpause, andset_service_disabled.u32/i128/u64slots (including theu32::MAX-defaultingMaxRequestsPerCall) are untouched, and the ordering of checks is preserved.Closes #47
Test output
Security notes
Centralising
unwrap_or(false)ensures a new boolean flag can never accidentally default totrueor skip its gate; the full existing suite passes unchanged, confirming no behavioural drift.