-
Notifications
You must be signed in to change notification settings - Fork 214
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
fix: giving collateral should not change totalDebt #9873
Conversation
Deploying agoric-sdk with Cloudflare Pages
|
a48000c
to
ad65961
Compare
totalDebt += WANT_EXTRA + 29n; // magic number is fees | ||
totalDebt += WANT_EXTRA + 20n; // magic number is fees |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Chris-Hibbert I'm particularly interested in reviewer feedback on the changes in this file.
I just sort of updated them arbitrarily to match the new observed values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed e9388a5 to repair the test.
packages/inter-protocol/test/vaultFactory/vault-collateralization.test.js
Outdated
Show resolved
Hide resolved
packages/inter-protocol/test/vaultFactory/vault-collateralization.test.js
Show resolved
Hide resolved
|
||
t.log('charge 2% per day to simulate lower rates over longer times'); | ||
const aethKey = { collateralBrand: aeth.brand }; | ||
const twoPctPerDay = run.makeRatio(2n * 360n, 100n); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const twoPctPerDay = run.makeRatio(2n * 360n, 100n); | |
const twoPctPerDay = run.makeRatio(2n * 365n, 100n); |
totalDebt += WANT_EXTRA + 29n; // magic number is fees | ||
totalDebt += WANT_EXTRA + 20n; // magic number is fees |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed e9388a5 to repair the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
if (oldDen < newDen) { | ||
return ratio; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a change in behavior and I think breaks the declared behavior,
Make an equivalant ratio with a new denominator
This function quantize
quantizes. Deciding not to quantize is the responsibility of the caller.
Feel free to drop the |
a118019
to
ae42f73
Compare
- use driver to check metrics notifications
When doing `totalDebt += newDebtFor1Vault - oldDebtFor1Vault`, make sure to use the same sort of calculation for old and new.
The verifications for metrics updates were misplaced. Added interest
closes: #XXXX
refs: #XXXX
Description
Updating
totalDebt
for 1vault
was doingtotalDebt += vault.getCurrentDebt() - old
where current debt includes compounded interest but old did not.Security Considerations
This (in combination with another PR to reset totalDebt to the sum over all vaults) should address a confusion risk for metrics clients.
Scaling Considerations
The separate work to reset totalDebt to the sum over all vaults may have some, but I don't see any here.
Testing Considerations
A straightforward unit test is included.
Upgrade Considerations
This change takes effect with the next upgrade to the
vaultFactory
.Documentation Considerations
As part of the governance decision to upgrade
vaultFactory
, metrics consumers should be notified of this fix.