-
Notifications
You must be signed in to change notification settings - Fork 247
6969 fix vaults error recovery #7020
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
Conversation
This motivates giving clients the ability to exit #6906. |
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.
notes so far...
} catch (e) { | ||
console.error('CAUGHT HERE', e); | ||
} | ||
execFileSync('agd', [`query`, 'bank', 'balances', opts.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.
indexing under ambient authority #2160
(not to mention sync io)
@@ -863,6 +864,8 @@ export const prepareVaultManagerKit = ( | |||
vaultId, | |||
'never stored during initVaultKit failure', | |||
); | |||
} finally { |
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 seems to be a different try/catch than the one that used to contain seat.exit()
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.
Good catch! My eye was fooled into doing the wrong curly matching for some reason.
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.
Good eyes! Thankfully the tests caught this too
b710d84
to
2321d8a
Compare
2321d8a
to
08a449c
Compare
08a449c
to
e0fe6f3
Compare
[clientSeat, vaultSeat, { [KW.Attestation]: giveColl }], | ||
[vaultSeat, clientSeat, { [KW.Attestation]: wantColl }], | ||
[clientSeat, vaultSeat, { [KW.Debt]: give }], |
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.
Could be
[clientSeat, vaultSeat, { [KW.Attestation]: giveColl }], | |
[vaultSeat, clientSeat, { [KW.Attestation]: wantColl }], | |
[clientSeat, vaultSeat, { [KW.Debt]: give }], | |
[clientSeat, vaultSeat, { [KW.Attestation]: giveColl, [KW.Debt]: give }], | |
[vaultSeat, clientSeat, { [KW.Attestation]: wantColl }], |
Do you prefer the existing version?
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 tried that and the line wrapping made it less readable. I think this style make it more clear what's going on, coming from the stageDelta style.
/** @type {import('@agoric/zoe/src/contractSupport/atomicTransfer.js').TransferPart[]} */ | ||
const transfers = [ | ||
...nonMintTransfers, | ||
[stage, vaultFactorySeat, { Minted: fee }], |
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.
Please rename stage
, and drop the stage.clear()
on line 97. It's no longer being used for staging, and people familiar with stagings will be confused by this naming.
Are there other calls to .clear()
in vaults or staking that can also be dropped?
// Make best efforts to burn the newly minted tokens, for hygiene. | ||
// That only relies on the internal mint, so it cannot fail without | ||
// there being much larger problems. There's no risk of tokens being | ||
// stolen here because the staging for them was already cleared. |
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.
There's no staging remaining, right? What is this referring to?
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 was just copied over. But that means I should revert the change here and go update vaultDirector and stakeFactory to not talk about staging.
Object.values(stage.getCurrentAllocation()).every(a => | ||
AmountMath.isEmpty(a), | ||
), | ||
X`Stage should be empty of Minted`, |
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.
Can we drop this?
e0fe6f3
to
2406cc4
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.
LGTM. Very clean. Thanks.
2406cc4
to
3986485
Compare
export const TransferPartShape = M.arrayOf( | ||
M.or(SeatShape, AmountKeywordRecordShape), | ||
); |
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.
Seems surprisingly loose. Trying a tighter pattern at #7040 , but do not yet know what CI has to say about it.
Have not yet looked at the TransferPart
type, but clearly they should be co-maintained
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.
#7040 green. TransferPart
type already consistent with suggested TransferPartShape
Only requested changes because I saw this PR was already on the merge train. Now that it's knocked off, I'll approve (with my suggestion), but remove the automerge label first. |
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.
Not fully reviewed, but approving because I have no objections, and approving is the only way I know to cancel a "Request changes". Because this approval has an outstanding suggestion, I also removed the automerge label first.
bb8322c
to
1d23fb1
Compare
Co-Authored-By: Mark S. Miller <[email protected]>
1d23fb1
to
4a550ee
Compare
closes: #6969
Description
When a vault failed to init, the seat wouldn't be exited. This resulted in the funds hanging on the seat and not being returned to the caller. The fix was to move the
exit()
tofinally
.This then sometimes errored with stagings due to #7024 . The solution is to stop using stages, so this does that for vaultFactory as part of #7025. It also does it for stakeFactory because they have a coupling through a shared a dependency on
chargeInterest
.Along the way I tried making a smart wallet integration test to detect the #6969 but it's only with vaults and we can't test that integration until #6880. I left the test in anyway.
This also has a CLI feature that was helpful while debugging,
And a drive-by for a different state problem,
Security Considerations
Prevents a theoretical exploit,
Scaling Considerations
--
Documentation Considerations
--
Testing Considerations
Using
start-local-chain
made vaults that used to error and lose funds. Then made the fix and verified the funds are restored after error.