-
Notifications
You must be signed in to change notification settings - Fork 217
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
Rework CLI error reporting for the --blockfrost-token-file #3184
Conversation
638e29f
to
5b2ce0c
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 (with some thoughts below):
Valid: ✔️
$ cardano-wallet serve --light --blockfrost-token-file blockfrost.api.key --testnet testnet-byron-genesis.json
[cardano-wallet.main:Info:4] [2022-03-21 08:31:19.91 UTC] Running as v2022-01-18 (git revision: 0000000000000000000000000000000000000000) on x86_64-linux
...
Not a file: ✔️
$ cardano-wallet serve --light --blockfrost-token-file not_a_file --testnet testnet-byron-genesis.json
...
cardano-wallet: not_a_file: openFile: does not exist (No such file or directory)
empty file: ✔️
$ cardano-wallet serve --light --blockfrost-token-file empty --testnet testnet-byron-genesis.json
...
[cardano-wallet.main:Error:4] [2022-03-21 08:32:58.76 UTC] File empty specified in the --blockfrost-token-file argument doesn't contain a valid Blockfrost API token.
wrong file: ✔️
$ cardano-wallet serve --light --blockfrost-token-file testnet-byron-genesis.json --testnet testnet-byron-genesis.json
...
[cardano-wallet.main:Error:4] [2022-03-21 08:33:31.50 UTC] File testnet-byron-genesis.json specified in the --blockfrost-token-file argument doesn't contain a valid Blockfrost API token.
Thoughts:
-
Perhaps the above cases could be translated into automated tests in
BlockfrostSpec
(where missing)? -
I'm also wondering... so blockfrost API key has an id of the network (
testnet
ormainnet
) as a prefix in it's API key. We need to also add--mainnet
or--testnet byron-genesis-file
to the serve. So I'm wondering if we shouldn't fail with error in case when we supplytestnet
API key and add--mainnet
and vice versa. 🤔
lib/shelley/exe/cardano-wallet.hs
Outdated
[ "File" | ||
, T.pack tokenFile | ||
, "specified in the --blockfrost-token-file\ | ||
\ argument doesn't contain a valid Blockfrost API token." | ||
] |
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.
Perhaps it would be nice to have a test against this in BlockfrostSpec
?
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.
Makes sense! I'll add some more tests there.
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've added tests for the cases you mentioned above but didn't go as far as testing correspondence between testnet/mainnet
environment flag and blockfrost token environment as it would require bigger effort to test several flags in combination.
bors r+ |
3184: Rework CLI error reporting for the --blockfrost-token-file r=Unisay a=Unisay - [x] I have changed the way token parsing errors are reported. ### Comments Example: ``` [cardano-wallet.main:Error:4] [2022-03-18 17:44:51.47 UTC] File /nix/store/7mxbly45mn9x8lijmigk3k25wlzvcn3a-cardano-node-deployments/testnet/genesis-byron.json specified in the --blockfrost-token-file argument doesn't contain a valid Blockfrost API token. [cardano-wallet.main:Debug:4] [2022-03-18 17:44:51.47 UTC] Logging shutdown. ``` ### Issue Number ADP-1426 3188: Update docker/Windows e2e workflows r=piotr-iohk a=piotr-iohk <!-- Detail in a few bullet points the work accomplished in this PR. Before you submit, don't forget to: * Make sure the GitHub PR fields are correct: ✓ Set a good Title for your PR. ✓ Assign yourself to the PR. ✓ Assign one or more reviewer(s). ✓ Link to a Jira issue, and/or other GitHub issues or PRs. ✓ In the PR description delete any empty sections and all text commented in <!--, so that this text does not appear in merge commit messages. * Don't waste reviewers' time: ✓ If it's a draft, select the Create Draft PR option. ✓ Self-review your changes to make sure nothing unexpected slipped through. * Try to make your intent clear: ✓ Write a good Description that explains what this PR is meant to do. ✓ Jira will detect and link to this PR once created, but you can also link this PR in the description of the corresponding Jira ticket. ✓ Highlight what Testing you have done. ✓ Acknowledge any changes required to the Documentation. --> - [x] Update docker/Windows e2e workflows ### Comments <!-- Additional comments, links, or screenshots to attach, if any. --> ### Issue Number <!-- Reference the Jira/GitHub issue that this PR relates to, and which requirements it tackles. Note: Jira issues of the form ADP- will be auto-linked. --> Co-authored-by: Yuriy Lazaryev <[email protected]> Co-authored-by: IOHK <[email protected]> Co-authored-by: Piotr Stachyra <[email protected]>
Build failed (retrying...): |
3184: Rework CLI error reporting for the --blockfrost-token-file r=Unisay a=Unisay - [x] I have changed the way token parsing errors are reported. ### Comments Example: ``` [cardano-wallet.main:Error:4] [2022-03-18 17:44:51.47 UTC] File /nix/store/7mxbly45mn9x8lijmigk3k25wlzvcn3a-cardano-node-deployments/testnet/genesis-byron.json specified in the --blockfrost-token-file argument doesn't contain a valid Blockfrost API token. [cardano-wallet.main:Debug:4] [2022-03-18 17:44:51.47 UTC] Logging shutdown. ``` ### Issue Number ADP-1426 Co-authored-by: Yuriy Lazaryev <[email protected]> Co-authored-by: IOHK <[email protected]>
bors merge |
Already running a review |
Build failed: |
bors r+ |
3184: Rework CLI error reporting for the --blockfrost-token-file r=Unisay a=Unisay - [x] I have changed the way token parsing errors are reported. ### Comments Example: ``` [cardano-wallet.main:Error:4] [2022-03-18 17:44:51.47 UTC] File /nix/store/7mxbly45mn9x8lijmigk3k25wlzvcn3a-cardano-node-deployments/testnet/genesis-byron.json specified in the --blockfrost-token-file argument doesn't contain a valid Blockfrost API token. [cardano-wallet.main:Debug:4] [2022-03-18 17:44:51.47 UTC] Logging shutdown. ``` ### Issue Number ADP-1426 Co-authored-by: Yuriy Lazaryev <[email protected]> Co-authored-by: IOHK <[email protected]>
Timed out. |
bors r+ |
3184: Rework CLI error reporting for the --blockfrost-token-file r=Unisay a=Unisay - [x] I have changed the way token parsing errors are reported. ### Comments Example: ``` [cardano-wallet.main:Error:4] [2022-03-18 17:44:51.47 UTC] File /nix/store/7mxbly45mn9x8lijmigk3k25wlzvcn3a-cardano-node-deployments/testnet/genesis-byron.json specified in the --blockfrost-token-file argument doesn't contain a valid Blockfrost API token. [cardano-wallet.main:Debug:4] [2022-03-18 17:44:51.47 UTC] Logging shutdown. ``` ### Issue Number ADP-1426 Co-authored-by: Yuriy Lazaryev <[email protected]> Co-authored-by: IOHK <[email protected]>
Build failed: |
bors r+ |
Build succeeded: |
Comments
Example:
Issue Number
ADP-1426