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

fix(cli): handle not found error in vstorage requests #8538

Merged
merged 2 commits into from
Nov 17, 2023

Conversation

mhofman
Copy link
Member

@mhofman mhofman commented Nov 16, 2023

closes: #8535
refs: #8348

Description

#8348 changed the validation of vstorage paths, including the errors returned for invalid or not found paths.

Unfortunately some code had hardcoded part of the error message when iterating over values to break out of the iteration, resulting in the error terminating abruptly instead.

This change uses the more stable error code of the error returned by the RPC server.

Security Considerations

None

Scaling Considerations

None

Documentation Considerations

None

Testing Considerations

No integration test exists for this. I'm not sure where it could live.
Tested manually.

Upgrade Considerations

Should be backported to the release-mainnet1B for consistency

Copy link
Contributor

@samsiegart samsiegart left a comment

Choose a reason for hiding this comment

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

Just one question but lgtm either way

@@ -143,7 +147,11 @@ export const makeVStorage = (powers, config = networkConfig) => {
));
// console.debug('readAt returned', { blockHeight });
} catch (err) {
if (err.message.match(/unknown request/)) {
if (
err.message.match(/unknown request/) ||
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason to keep this check around or can we remove it?

Copy link
Member Author

@mhofman mhofman Nov 16, 2023

Choose a reason for hiding this comment

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

to not break mainnet and devnet users, until each is respectively updated.

Copy link
Contributor

@samsiegart samsiegart Nov 16, 2023

Choose a reason for hiding this comment

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

Ah I just tested on devnet, I'm getting error code "6", so looks like the code changed and not just the message

Copy link
Member Author

Choose a reason for hiding this comment

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

packages/agoric-cli/src/lib/rpc.js Outdated Show resolved Hide resolved
@mhofman mhofman requested a review from gibson042 November 17, 2023 02:23
@mhofman
Copy link
Member Author

mhofman commented Nov 17, 2023

@gibson042 I added a test suite to vstorage querier. PTAL

Copy link
Member

@gibson042 gibson042 left a comment

Choose a reason for hiding this comment

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

Nice!

path: []string{"data", "bar"},
// DO NOT CHANGE
// The UI and CLI check for the specific cosmos-sdk error code & codespace
err: sdkerrors.ErrNotFound,
Copy link
Member

@gibson042 gibson042 Nov 17, 2023

Choose a reason for hiding this comment

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

Would it be going too far to also assert somewhere that sdkerrors.ErrNotFound itself corresponds with code 38 in codespace "sdk"? That would capture our requirement of stability in cosmos-sdk.

@mhofman mhofman force-pushed the mhofman/8535-fix-cli-vstorage-not-found branch from 2e97211 to 21db80e Compare November 17, 2023 15:07
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 defer to other reviewers.
filing this review to get it off my queue

@mhofman mhofman added the automerge:rebase Automatically rebase updates, then merge label Nov 17, 2023
@mergify mergify bot merged commit c14f1bb into master Nov 17, 2023
77 checks passed
@mergify mergify bot deleted the mhofman/8535-fix-cli-vstorage-not-found branch November 17, 2023 16:52
mhofman pushed a commit that referenced this pull request Dec 6, 2023
…t-found

fix(cli): handle not found error in vstorage requests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:rebase Automatically rebase updates, then merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error when trying to check bid list in CLI
4 participants