Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ATOM assets missing following liquidation and reconstitution #7806

Closed
otoole-brendan opened this issue May 19, 2023 · 2 comments · Fixed by #7827
Closed

ATOM assets missing following liquidation and reconstitution #7806

otoole-brendan opened this issue May 19, 2023 · 2 comments · Fixed by #7827
Assignees
Labels
bug Something isn't working v1_triaged DO NOT USE vaults_triage DO NOT USE
Milestone

Comments

@otoole-brendan
Copy link
Contributor

Describe the bug

In validation testing the second half of #7784 - impact to reserve metrics, two issues were observed:

  1. Total amounts distributed were less than what is going in (assets missing) - 14.99 (returned to vault) + 14.99 (returned to vault) + 10.01 (bid payout) + 3.575 (bid payout) + 1.107 (ATOM in reserve) vs 45 ATOM
  2. vaults seem to have too much and no longer match expectations (each reconstituted vault was expected to receive 14.889 ATOM / 100.5 IST and 14.896 ATOM / 103.51 IST back after reconstitution but had 14.99 ATOM /100.5IST and 14.99 ATOM/ 103.51 IST respectively)

To Reproduce

Steps to reproduce the behavior:

  1. Using 12.34 price set up vaults per Flow 2b/reconstitution and 2x bid per https://docs.google.com/document/d/1bXnQ_o3wwfnu-uhX2KSb6ZXB0dU6CsAsGBWm1DXgmE0/edit?usp=sharing
  2. trigger liquidaion with 9.99 pushPrice
  3. Check reserve metrics before auction starts
  4. Observe liquidation and auction take place
  5. Review reconstituted vault information, bid payouts and post-auction reserve metrics

Expected behavior

A clear and concise description of what you expected to happen.

Platform Environment

  • what OS are you using? what version of Node.js?
  • is there anything special/unusual about your platform?
  • what version of the Agoric-SDK are you using? (run git describe --tags --always)

Additional context

Reserve metrics before auction:

root@3ac654d9e579:/usr/src/agoric-sdk# agoric follow -lF :published.reserve.metrics
{
allocations: {},
shortfallBalance: {
brand: slotToVal("board0257","Alleged: IST brand"),
value: 0n,
},
totalFeeBurned: {
brand: slotToVal("board0257"),
value: 0n,
},
totalFeeMinted: {
brand: slotToVal("board0257"),
value: 0n,

Reserve metrics after:

Reserve after:

allocations: {
ATOM: {
brand: slotToVal("board05557","Alleged: ATOM brand"),
value: 1107181n, (1.107 IST)
},
Fee: {
brand: slotToVal("board0257","Alleged: IST brand"),
value: 2135000n, (2.1 IST)
},
},
shortfallBalance: {
brand: slotToVal("board0257"),
value: 5525000n, (5.525)
},
totalFeeBurned: {
brand: slotToVal("board0257"),
value: 0n,
},
totalFeeMinted: {
brand: slotToVal("board0257"),
value: 0n,

Screenshots

Pasted Graphic 10 Pasted Graphic 11
@otoole-brendan otoole-brendan added the bug Something isn't working label May 19, 2023
@otoole-brendan otoole-brendan added this to the Vaults Validation milestone May 19, 2023
@ivanlei ivanlei removed this from the Vaults Validation milestone May 19, 2023
@ivanlei ivanlei added v1_triaged DO NOT USE and removed v1_triaged DO NOT USE labels May 22, 2023
@Chris-Hibbert
Copy link
Contributor

In the unit test that replicates this scenario, the numbers have a little more resolution. Because of rounding, they don't match the spreadsheet. The UI does some truncation, so it doesn't display all the low-order bits.

The two vaults get 14.998 Atom each. The amount sent to the reserve is 1.109. There's .310 of penalty that doesn't seem to be transferred anywhere. The bidders got 13.585. (I have a correction for the test that shows this.)

45 = 13.585 + .310 + 2 * 14.998 + 1.109.

Early on, distributeProceeds subtracts out the penalty, and doesn't add it back before sending what should be all the leftovers to the reserve. That leaks the penalty (.310 in this case)

@Chris-Hibbert
Copy link
Contributor

#7827 should fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v1_triaged DO NOT USE vaults_triage DO NOT USE
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants