NexusMutual / cover-router

Computes optimal capacity allocation per Nexus Mutual staking pool on cover purchase
MIT License
1 stars 1 forks source link

reduce unit size to 1% #37

Closed danoctavian closed 1 year ago

danoctavian commented 1 year ago

When making a request to buy 2500 ETH on balancer the router is not able to find an allocation.

  poolId: 1,
  poolCapacityUsed: '0',
  amountToAllocate: '8860',
  totalCapacity: '7228'
}
CANNOT
{
  poolId: 2,
  poolCapacityUsed: '0',
  amountToAllocate: '8860',
  totalCapacity: '8390'
}
CANNOT
{
  poolId: 3,
  poolCapacityUsed: '64761',
  amountToAllocate: '8860',
  totalCapacity: '68382'
}
CANNOT
{
  poolId: 4,
  poolCapacityUsed: '18073',
  amountToAllocate: '8860',
  totalCapacity: '23242'
}
CANNOT

A test case is written to capture this specific production setup to prove allocation now works given the fix.

With a 10% chunk size it hits a pathological case where it cannot utilize the capacity (units don't fit in the existing gaps).

Reducing size to 1%.