feat: add revocable trusted contract authorization - #115
Open
afeezorobsco-cyber wants to merge 5 commits into
Open
feat: add revocable trusted contract authorization#115afeezorobsco-cyber wants to merge 5 commits into
afeezorobsco-cyber wants to merge 5 commits into
Conversation
Cap lives in pulse_token::mint() (DataKey::MaxSupply, instance storage) so every authorized minter - leaderboard reward/reward_bonus or any future minter - shares one global ceiling. Result is computed via i128::checked_add before any write; over-cap or overflow mints reject with MaxSupplyExceeded (SPulse-Org#7) leaving balance and total_supply untouched. No authoritative tokenomics value exists in the repo, so the cap is deployer-supplied via initialize(_, max_supply); legacy instances fail closed until admin declares a cap through set_max_supply, an admin-only one-way ratchet (cannot raise, cannot go below current supply). Closes issue SPulse-Org#34.
Market, Bet, Payout, and bettor-index entries in persistent storage could expire before claim/refund, permanently locking user funds (issue SPulse-Org#9). Add read-time TTL refresh: claim now also bumps the winner's Payout key, resolve_market bumps the bettor index/Bets/Payouts it walks, and the user-facing views (get_market/get_bet/get_payout/get_market_bettors_page) re-arm the entries they read. Every bump reuses the existing TTL_BUMP/TTL_HIGH constants; missing/expired state keeps its not-found semantics. Already-expired entries cannot be resurrected by design.
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.
##close #85
Summary
Introduces explicit revocation and restoration for trusted cross-contract dependencies.
Previously, trusted contract addresses could be replaced but there was no explicit emergency state in which a dependency could be completely disabled. This change adds revocable trust while preserving existing authorization behavior when dependencies are enabled.
Changes
Security
A revoked trusted contract has no privileged authority until explicitly restored by the authorized administrator/multisig.
Revocation is distinct from replacement: the system can enter a deliberate state where no contract is trusted for a capability.
Validation
cargo fmt --all -- --checkcargo clippy --workspace --all-targets -- -D warningscargo test --workspaceIssue
Closes #[ISSUE_NUMBER]