Skip to content

feat: defer revenue reports until atomic close_period flush#507

Merged
thlpkee20-wq merged 2 commits into
RevoraOrg:masterfrom
dev-RAM11:feat/deferred-distributions-v3
Jul 8, 2026
Merged

feat: defer revenue reports until atomic close_period flush#507
thlpkee20-wq merged 2 commits into
RevoraOrg:masterfrom
dev-RAM11:feat/deferred-distributions-v3

Conversation

@dev-RAM11

Copy link
Copy Markdown
Contributor

Closes #456

Description

This PR implements the deferred distribution lifecycle. It ensures that revenue reports can be queued using the defer_until_close flag, preventing immediate individual claims until an atomic close_period flush occurs. This ensures all holders see the exact same cutover instant.

Key Implementations

  • Storage Mapping: Added DeferredReports storage map keyed by period_id.
  • Security Check: Implemented DistributionDeferred error. claim() strictly panics if the requested period is still residing in the deferred queue.
  • Reordering Capability: Added replace_deferred to allow amount updates on pending reports before the period cutover.
  • Atomic Flush: close_period safely clears the deferred queue and makes the funds globally claimable at the exact same ledger sequence.
  • Testing: Injected isolated boundary tests inside test_close_period.rs to validate the panic routing.

⚠️ Note for Reviewers regarding CI: The automated CI pipeline will fail on this PR because the upstream master branch is currently failing to compile. There are ~295 workspace errors related to an incomplete DataKey -> DataKey2 refactor and missing PauseState definitions in the global implementation.

My isolated deferred distribution logic, however, is complete and ready for review once the master branch compiles again!

@thlpkee20-wq
thlpkee20-wq merged commit e0d5da3 into RevoraOrg:master Jul 8, 2026
0 of 2 checks passed
@drips-wave

drips-wave Bot commented Jul 8, 2026

Copy link
Copy Markdown

@dev-RAM11 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.

Add deferred distribution events queued for atomic release on close_period

2 participants