Skip to content

Accrue tests#363

Open
MishaShWoof wants to merge 7 commits into
feat/service-patchfrom
test/accrue
Open

Accrue tests#363
MishaShWoof wants to merge 7 commits into
feat/service-patchfrom
test/accrue

Conversation

@MishaShWoof
Copy link
Copy Markdown
Collaborator

Accrue Tests

accrueAccount test suite — added a dedicated set of tests covering the accrueAccount function, verifying correct behavior across various collateralization states.

Comment thread test/accrue-test.ts Outdated
Comment thread test/accrue-test.ts Outdated
Comment thread test/accrue-test.ts Outdated
Comment thread test/accrue-test.ts Outdated
Comment thread test/accrue-test.ts
Comment thread test/accrue-test.ts
Comment thread test/accrue-test.ts Outdated
Comment thread test/accrue-test.ts Outdated
Comment thread test/accrue-test.ts Outdated
Comment thread test/accrue-test.ts Outdated
@VladyslavPerederWoof
Copy link
Copy Markdown
Collaborator

  1. accrueAccount idempotency within the same block
    Calling accrueAccount twice in the same block should be a pure no-op (timeElapsed = 0). Not tested.

  2. accrueAccount on one user after global state was advanced by another user's action
    Pattern: bob's supply/withdraw triggers accrueInternal (global), updating lastAccrualTime. Then accrueAccount(alice) is called. Alice's baseTrackingAccrued should update based on the delta between totals.trackingSupplyIndex and alice.baseTrackingIndex. No test isolates this sequence explicitly.

  3. balanceOf / borrowBalanceOf increasing over time
    The test verifies userBasic.principal is unchanged after accrue (correct — principal is fixed). But there is no test confirming that balanceOf(alice) (which calls presentValueSupply(baseSupplyIndex, principal)) actually returns a larger value after the index grows, i.e., that supplier earned interest is reflected in their balance.

  4. lastAccrualTime after accrueAccount vs. state-changing operations
    accrueInternal updates lastAccrualTime. The test checks lastAccrualTime after supply (line 264-268) but never after a standalone accrueAccount. There's no explicit assertion that lastAccrualTime = block.timestamp after accrueAccount.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Tests Tests refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants