Skip to content

Rebalancing Failures #280

@UlyanaAndrukhiv

Description

@UlyanaAndrukhiv

Context

Current Gap: Tests cover successful rebalancing, need failure scenarios.

Missing Test Coverage:

  • Insufficient TopUpSource Funds

    • Position undercollateralized
    • Rebalance requires 100 MOET
    • topUpSource only has 50 MOET
    • Rebalance fails or partial execution
    • Position remains undercollateralized
  • Malicious TopUpSource

    • topUpSource always reverts on withdrawal
    • Prevents rebalancing
    • Enables liquidation that could have been avoided
    • Attack vector for forcing liquidations
  • DrawDownSink Rejection

    • Position overcollateralized
    • Rebalance pushes surplus to drawDownSink
    • drawDownSink rejects deposit (e.g., full capacity)
    • Rebalance fails, position remains overcollateralized
  • Rebalance Gas Limits

    • Complex rebalance operation
    • Multiple swaps through connectors
    • Gas cost exceeds block limit
    • Transaction fails, position not rebalanced
  • Circular Dependencies

    • Position A topUpSource = Position B
    • Position B topUpSource = Position A
    • Both positions need rebalancing
    • Circular dependency deadlock
  • Concurrent Rebalances

    • Position A and Position B both trigger rebalance
    • Both attempt to pull from same liquidity source
    • First succeeds, second fails
    • Handling of failed rebalance

Recommended Tests:

Test: Rebalance needs 100 MOET, topUpSource has 50, fails gracefully
Test: topUpSource always reverts, rebalance fails, position can be liquidated
Test: drawDownSink rejects deposit, rebalance fails
Test: Rebalance operation exceeds gas limit
Test: Position A and B have circular topUpSource dependency
Test: Two positions trigger rebalance, share same source, first succeeds

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions