Skip to content

Feat/deferred distributions v2#506

Open
dev-RAM11 wants to merge 3 commits into
RevoraOrg:masterfrom
dev-RAM11:feat/deferred-distributions-v2
Open

Feat/deferred distributions v2#506
dev-RAM11 wants to merge 3 commits into
RevoraOrg:masterfrom
dev-RAM11:feat/deferred-distributions-v2

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.
  • Event Emission: Added def_report and def_flush to track the lifecycle dynamically off-chain.

Verification Status

  • Local compilation and workspace sanity checks successfully pass:
    cargo fmt --check
    cargo check

dev-RAM11 added 3 commits May 30, 2026 19:07
- Add mod test_time_windows to lib.rs so tests are compiled and run
- Move set_report_window, set_claim_window, get_report_window,
  get_claim_window, and claim into contractimpl block
- Fix test_time_windows.rs compatibility issues
- All 41 boundary matrix tests passing

Closes RevoraOrg#374
test: cover report window inclusive boundaries and zero-width slot
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