Skip to content

Add fixed-point e18 accrual representation for share-conserving rounding across reports #479

Description

@thlpkee20-wq

Description

Accrual today uses bps math, accumulating rounding dust on each report. Switch the internal accrual index to e18 fixed-point and only collapse to integer on claim, eliminating cumulative dust within typical period counts.

Requirements and context

  • Must be secure, tested, and documented
  • Should be efficient and easy to review
  • Relevant code: Revora-Contracts/src/lib.rs, Revora-Contracts/src/payout_test.rs
  • Conversion to/from e18 must use checked_mul and checked_div consistently

Suggested execution

  • Fork the repo and create a branch
  • git checkout -b feat/e18-accrual-fixed-point
  • Implement changes
    • Replace acc_per_share_bps with acc_per_share_e18
    • Update report_revenue index update and claim settlement
    • Add invariant: collapsing all holders' e18 owed sums equals reported revenue
  • Validate security and correctness assumptions

Test and commit

  • Run tests
    • cargo test --all
  • Cover edge cases
    • 10_000 sequential 1-unit reports must not accumulate >1 unit of dust per holder
  • Include test output and security notes

Example commit message

feat: switch accrual to e18 fixed-point for tighter rounding

Guidelines

  • Minimum 95 percent test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions