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

7004 wallet errors #7135

Merged
merged 3 commits into from
Mar 9, 2023
Merged

7004 wallet errors #7135

merged 3 commits into from
Mar 9, 2023

Conversation

turadg
Copy link
Member

@turadg turadg commented Mar 8, 2023

closes: #7004

Description

Users need to be able find out about errors in their wallet actions. The offer handler already publishes errors to vstorage. This makes it so that errors that happen earlier, in reading the walletAction, also get published, under a new updated: walletAction status.

It leaves out publishing errors before that because there's no way yet to associate it with the account owner or transaction. And once there is, feeding it back will be done by the Cosmos bridge instead of the contract.

This also cleans up error handling within the offer executor. This required test changes, mostly simplifications to use throwsAsync instead of checking vstorage after. We have sufficient tests for offer failures writing to vstorage so we don't have to test it everywhere.

Security Considerations

Error's message is logged to vstorage. The error construction should redact as needed.

Scaling Considerations

Writes walletAction errors to vstorage.

Documentation Considerations

--

Testing Considerations

CI

@turadg turadg requested review from dckc and samsiegart March 8, 2023 21:53
@@ -182,15 +202,17 @@ test('close vault', async t => {
{
offerId: 'close-well',
collateralBrandKey,
giveMinted: 5.0,
Copy link
Member Author

@turadg turadg Mar 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was a bug in the test. it wasn't detected because I had mistakenly thought numWantsSatisified: 1 meant it succeeded. There were no wants so they were trivially satisfied.

That it looked like it succeeded and it didn't underlines the value of the promise rejecting.

@datadog-full-agoric
Copy link

datadog-full-agoric bot commented Mar 8, 2023

Datadog Report

Branch report: 7004-wallet-errors
Commit report: 94718b4

agoric-sdk: 0 Failed, 0 New Flaky, 3663 Passed, 55 Skipped, 14m 38.85s Wall Time

@turadg turadg marked this pull request as ready for review March 8, 2023 23:23
@dckc
Copy link
Member

dckc commented Mar 9, 2023

feeding it back will be done by the Cosmos bridge instead of the contract

I hope we have an issue to represent that plan.

This PR would still be forward progress without it, though...

@samsiegart
Copy link
Contributor

Are there any UI changes that need to accompany this?

Copy link
Member

@dckc dckc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to understand the compatibility impact on the wallet UI better.

With this change, if the wallet UI doesn't change, will the wallet UI fail to notice some of the errors that it currently notices?

@@ -1,3 +1,4 @@
import { Fail } from '@agoric/assert';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did we get on that idiom? Ah yes... #5672 is still open.

Comment on lines -281 to +282
error:
'Error: In "pushPrice" method of (OracleKit oracle): arg 0: unitPrice: number 1 - Must be a bigint',
// trivially satisfied because the Want is empty
numWantsSatisfied: 1,
message:
'In "pushPrice" method of (OracleKit oracle): arg 0: unitPrice: number 1 - Must be a bigint',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the wallet UI need a corresponding update to error handling?

That would make this a BREAKING CHANGE, yes?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be a breaking change, but the wallet UI isn't affected. The same errors are written to vstorage.

err,
);
updatePublishKit.publisher.publish({
updated: 'walletAction',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

impacts wallet UI?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wallet UI can begin to observe these messages. It shouldn't break because it should never have assumed that new updates would never be added.

* Designed to be called by the bridgeManager vat.
*
* If this errors before calling handleBridgeAction(), the failure will not be observable. The
* promise does rejects, but as of now bridge manager drops instead of handling it. Eventually
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* promise does rejects, but as of now bridge manager drops instead of handling it. Eventually
* promise does reject, but as of now bridge manager drops instead of handling it. Eventually

Comment on lines 163 to 164
* associate it with. (We could have a shared `lastError` node but it would be so noisy as to
* not provide much info to the end user.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* associate it with. (We could have a shared `lastError` node but it would be so noisy as to
* not provide much info to the end user.
* associate it with. (We could have a shared `lastError` node but it would be so noisy as to
* not provide much info to the end user.)

const likePayouts = (collateral, minted) => ({
Collateral: {
value: {
digits: String(collateral * 1_000_000),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this will survive the move to smallcaps (#6822).

Not critical. We'll notice when it's time.

@turadg
Copy link
Member Author

turadg commented Mar 9, 2023

With this change, if the wallet UI doesn't change, will the wallet UI fail to notice some of the errors that it currently notices?

No, this doesn't change any of the what has been published to vstorage. The only change to vstorage is that it adds a new update event for walletAction messages. The wallet UI can begin to read and display those. A good idea but not a breaking change.

The changes to the tests for existing messages is that now the function call carries the rejection message so tests running in JS (which can get the promise) don't need to resort to reading over RPC.

Copy link
Member

@dckc dckc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, not a breaking change then.

@turadg turadg force-pushed the 7004-wallet-errors branch from 5d89556 to 308caab Compare March 9, 2023 17:25
@turadg turadg added the automerge:no-update (expert!) Automatically merge without updates label Mar 9, 2023
@mergify mergify bot merged commit 95c7d1a into master Mar 9, 2023
@mergify mergify bot deleted the 7004-wallet-errors branch March 9, 2023 17:59
@turadg
Copy link
Member Author

turadg commented Mar 9, 2023

feeding it back will be done by the Cosmos bridge instead of the contract

I hope we have an issue to represent that plan.

#7148

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:no-update (expert!) Automatically merge without updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[requirement] any failure in smart-wallet observable in chain storage
3 participants