perf(#397): reduce ledger storage footprint of pf_alloc_admin_override - #432
Open
CollinsC1O wants to merge 3 commits into
Open
perf(#397): reduce ledger storage footprint of pf_alloc_admin_override#432CollinsC1O wants to merge 3 commits into
CollinsC1O wants to merge 3 commits into
Conversation
added 3 commits
August 30, 2026 18:51
|
@CollinsC1O 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! 🚀 |
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.
perf(#397): reduce ledger storage footprint of pf_alloc_admin_override
What
pf_alloc_admin_overrideno longer takes thePlatformFeeAllocationLockre-entrancy guard around its write.
Before:
set(Lock, true)→set(PlatformFeeAllocation, …)→set(Lock, false)— 2 distinct instance keys written, 3
setops.After: a single
set(PlatformFeeAllocation, …)— 1 key written, 1setop.Why
The guarded body is one unconditional
setwith no token transfers orcross-contract calls between validation and the write, so there is no
re-entrancy window for the lock to protect. The lock writes were pure overhead.
All read-only preconditions are unchanged (
require_admin,current.lockedcheck,
assert_platform_fee_allocation_not_locked,assert_emergency_pause_not_locked,validate_fee_allocation), and theobservable result — allocation replaced and unlocked — is identical.
set_platform_fee_allocation/lock_platform_fee_allocationare untouched.Tests
test_pf_alloc_admin_override_writes_single_storage_key— clears the guardkey, runs the override, asserts it stays absent while the allocation updates
(proves 1 distinct key written, down from 2).
test_pf_alloc_admin_override_preserves_lock_guards—PlatformFeeAllocationLockand
EmergencyPauseLockstill block the call; locked allocation not mutated.test_pf_alloc_admin_override_failure_path_writes_nothing— invalid ratiorejected before any write.
Verification
cargo test→ 460 passed, 0 failed (all existing tests unchanged)cargo build --release --target wasm32-unknown-unknown→ okcargo fmt --checkclean,cargo clippyno new warningsCloses #397