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

Rework CLI error reporting for the --blockfrost-token-file #3184

Merged
merged 6 commits into from
Apr 11, 2022

Conversation

Unisay
Copy link
Contributor

@Unisay Unisay commented Mar 18, 2022

  • 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

@Unisay Unisay requested a review from piotr-iohk March 18, 2022 17:48
@Unisay Unisay self-assigned this Mar 18, 2022
@Unisay Unisay force-pushed the yura/ADP-1426/clean-exit branch from 638e29f to 5b2ce0c Compare March 18, 2022 17:51
Copy link
Contributor

@piotr-iohk piotr-iohk left a 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 or mainnet) 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 supply testnet API key and add --mainnet and vice versa. 🤔

Comment on lines 320 to 324
[ "File"
, T.pack tokenFile
, "specified in the --blockfrost-token-file\
\ argument doesn't contain a valid Blockfrost API token."
]
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

@cardano-foundation cardano-foundation deleted a comment from iohk-bors bot Mar 21, 2022
@Unisay
Copy link
Contributor Author

Unisay commented Mar 21, 2022

bors r+

iohk-bors bot added a commit that referenced this pull request Mar 21, 2022
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]>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Mar 21, 2022

Build failed (retrying...):

iohk-bors bot added a commit that referenced this pull request Mar 21, 2022
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]>
@Unisay
Copy link
Contributor Author

Unisay commented Mar 21, 2022

bors merge

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Mar 21, 2022

Already running a review

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Mar 21, 2022

Build failed:

@Unisay
Copy link
Contributor Author

Unisay commented Mar 21, 2022

bors r+

iohk-bors bot added a commit that referenced this pull request Mar 21, 2022
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]>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Mar 22, 2022

Timed out.

@Unisay
Copy link
Contributor Author

Unisay commented Mar 22, 2022

bors r+

iohk-bors bot added a commit that referenced this pull request Mar 22, 2022
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]>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Mar 22, 2022

Build failed:

@Unisay
Copy link
Contributor Author

Unisay commented Apr 11, 2022

bors r+

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Apr 11, 2022

Build succeeded:

@iohk-bors iohk-bors bot merged commit db638a4 into master Apr 11, 2022
@iohk-bors iohk-bors bot deleted the yura/ADP-1426/clean-exit branch April 11, 2022 17:01
WilliamKingNoel-Bot pushed a commit that referenced this pull request Apr 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants