Skip to content

perf(#397): reduce ledger storage footprint of pf_alloc_admin_override - #432

Open
CollinsC1O wants to merge 3 commits into
Goldii-locks:mainfrom
CollinsC1O:storage
Open

perf(#397): reduce ledger storage footprint of pf_alloc_admin_override#432
CollinsC1O wants to merge 3 commits into
Goldii-locks:mainfrom
CollinsC1O:storage

Conversation

@CollinsC1O

Copy link
Copy Markdown

perf(#397): reduce ledger storage footprint of pf_alloc_admin_override

What

pf_alloc_admin_override no longer takes the PlatformFeeAllocationLock
re-entrancy guard around its write.

Before: set(Lock, true)set(PlatformFeeAllocation, …)set(Lock, false)
2 distinct instance keys written, 3 set ops.

After: a single set(PlatformFeeAllocation, …)1 key written, 1 set op.

Why

The guarded body is one unconditional set with no token transfers or
cross-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.locked
check, assert_platform_fee_allocation_not_locked,
assert_emergency_pause_not_locked, validate_fee_allocation), and the
observable result — allocation replaced and unlocked — is identical.
set_platform_fee_allocation / lock_platform_fee_allocation are untouched.

Tests

  • test_pf_alloc_admin_override_writes_single_storage_key — clears the guard
    key, 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_guardsPlatformFeeAllocationLock
    and EmergencyPauseLock still block the call; locked allocation not mutated.
  • test_pf_alloc_admin_override_failure_path_writes_nothing — invalid ratio
    rejected before any write.

Verification

  • cargo test → 460 passed, 0 failed (all existing tests unchanged)
  • cargo build --release --target wasm32-unknown-unknown → ok
  • cargo fmt --check clean, cargo clippy no new warnings

Closes #397

@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

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.

Reduce the ledger storage footprint of pf_alloc_admin_override

1 participant