Skip to content

feat: defer revenue reports until atomic close_period flush#507

Open
dev-RAM11 wants to merge 1 commit into
RevoraOrg:masterfrom
dev-RAM11:feat/deferred-distributions-v3
Open

feat: defer revenue reports until atomic close_period flush#507
dev-RAM11 wants to merge 1 commit 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!

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

1 participant