Skip to content

updateWeightedAverage safety concerns #561

@jalextowle

Description

@jalextowle

Goal

updateWeightedAverage should satisfy the invariant that _average >= min(oldAverage, delta) && _average <= max(oldAverage, delta) in Hyperdrive deployments.

Deliverables

  • Unit tests for updateWeightedAverage that identify the dangerous regimes. A matrix based test is the stretch goal.
  • Evaluate how updateWeightedAverage is being used. Which dangerous regimes are we worried about? Include documentation inline that describes which regimes we are avoiding and how we are avoiding them.
  • Configuration testing. For DAI, ETH, and USDC, we should have tests that verify that updateWeightedAverage will never violate its invariant in normal operation.
  • Maybe: If the current implementation can't pass configuration testing (e.g. there are possible inputs that can break updateWeightedAverage), then we'll need a fix. This probably looks something like a minimum bond amount.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions