-
Notifications
You must be signed in to change notification settings - Fork 215
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
Multi collateral support - add concurrent liquidation tests #8422
Conversation
6486d53
to
41bcf85
Compare
41bcf85
to
9af1e08
Compare
t.log('building proposal'); | ||
const proposal = await buildProposal({ | ||
package: 'builders', | ||
packageScriptName: 'build:add-STARS-proposal', |
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.
Out of scope, but we should parameterize this function to addNewCollateral
and take the collateral name. @Chris-Hibbert needed (and made) such a thing in https://github.com/Agoric/agoric-sdk/pull/8398/files#diff-3c4081d1865d2d24a7abaee93a075a8852065c32783fbe25265746c13441875bR38-R45
|
||
const test = anyTest as TestFn<LiquidationTestContext>; | ||
|
||
const atomSetup = { |
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'm not reviewing the arithmetic. I assume you'll sync with PM on the correctness per their spec
packages/boot/test/bootstrapTests/test-liquidation-concurrent-1.ts
Outdated
Show resolved
Hide resolved
packages/boot/test/bootstrapTests/test-liquidation-concurrent-1.ts
Outdated
Show resolved
Hide resolved
packages/boot/test/bootstrapTests/test-liquidation-concurrent-1.ts
Outdated
Show resolved
Hide resolved
const buyer = await walletFactoryDriver.provideSmartWallet('agoric1buyer'); | ||
const minter = await walletFactoryDriver.provideSmartWallet('agoric1minter'); | ||
|
||
const setupVault = async ( |
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.
isn't this the same as in concurrent-1? please dedupe
return t.context.shutdown && t.context.shutdown(); | ||
}); | ||
|
||
const checkFlow2b = async (t: ExecutionContext<LiquidationTestContext>) => { |
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.
where is the "b" coming from?
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.
Flow 2b from #7123
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 asked socratically :) (that 2b is for a different test flow than this one)
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 asked socratically :) (that 2b is for a different test flow than this one)
}; | ||
|
||
// Reference: Flow 2b from https://github.com/Agoric/agoric-sdk/issues/7123 | ||
test.serial('scenario: Flow 2b', async t => { |
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.
the helper function factoring is for re-use in multiple tests. since there's only in in this case it's an unwarranted complication
9af1e08
to
3d149fe
Compare
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.
Looking good.
94694b6
to
de35fd0
Compare
de35fd0
to
90b2cc0
Compare
collateralBrandKey: string, | ||
t: ExecutionContext<LiquidationTestContext>, | ||
) => { | ||
// TODO: we'd like to have this work on any brand |
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.
nice solution! creates the right abstraction and we can improve its robustness later
for (const { collateralBrandKey } of cases) { | ||
await ensureVaultCollateral(collateralBrandKey, t) | ||
} |
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 lint error could be ignored for tests but it still would be better to:
await Promise.all(
cases.map(({collateralBrandKey}) => ensureVaultCollateral(collateralBrandKey, t));
);
{ | ||
// --------------- |
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.
consider restoring this block to reduce churn for indentation.
90b2cc0
to
c59e114
Compare
c59e114
to
c900417
Compare
closes: #8270
Description
Adds test that validate concurrent liquidation of multiple collaterals.
Security Considerations
N/A
Scaling Considerations
N/A
Documentation Considerations
N/A
Testing Considerations
Adding new test, that have been validated locally
Upgrade Considerations
N/A