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

API: Pass TokenMetadataError through to API #2670

Merged
merged 4 commits into from
May 26, 2021

Conversation

rvl
Copy link
Contributor

@rvl rvl commented May 26, 2021

Issue Number

ADP-925

Overview

If there was an error fetching metadata in the listMetadata or getMetadata endpoints, tell the user, rather than just returning "no metadata".

Comments

Could someone please pick this up and merge for v2021-05-26.

@rvl rvl assigned rvl and Anviking May 26, 2021
@rvl rvl requested a review from Anviking May 26, 2021 07:50
@rvl rvl force-pushed the rvl/adp-925/asset-list-show-metadata-error branch from a9de669 to f2e4721 Compare May 26, 2021 08:31
@@ -356,6 +355,9 @@ data TokenMetadataError
-- ^ Error from aeson decoding of JSON
deriving (Generic, Show, Eq)

instance NFData TokenMetadataError where
rnf = rnf . show
Copy link
Member

Choose a reason for hiding this comment

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

Is this show right? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it's a cheap trick to make NFData instances, where some of the fields don't have NFData.
In this case the problem was SomeException.
show usually works well enough for the purpose of deeply evaluating some data.

@@ -480,7 +480,8 @@ data ApiAsset = ApiAsset
, assetName :: ApiT W.TokenName
, fingerprint :: ApiT W.TokenFingerprint
, metadata :: Maybe ApiAssetMetadata
} deriving (Eq, Generic, Ord, Show)
, metadataError :: Maybe Text
Copy link
Member

Choose a reason for hiding this comment

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

Replaced with a proper sum-type

Copy link
Member

@Anviking Anviking left a comment

Choose a reason for hiding this comment

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

lgtm

Testing this seems a bit cumbersome, as I think our mock metadata server would refuse to serve invalid JSON.

@Anviking Anviking force-pushed the rvl/adp-925/asset-list-show-metadata-error branch from 23e359e to 4e66cd4 Compare May 26, 2021 13:57
@Anviking
Copy link
Member

bors r+

iohk-bors bot added a commit that referenced this pull request May 26, 2021
2662: Basic migration plans e2e tests r=rvl a=piotr-iohk

# Issue Number

ADP-680


# Overview

<!-- Detail in a few bullet points the work accomplished in this PR -->

- [ ] e2e tests on testnet for creating migration plans for Byron/Icarus/Shelley wallets.


# Comments

<!-- Additional comments or screenshots to attach if any -->

<!--
Don't forget to:

 ✓ Self-review your changes to make sure nothing unexpected slipped through
 ✓ Assign yourself to the PR
 ✓ Assign one or several reviewer(s)
 ✓ Jira will detect and link to this PR once created, but you can also link this PR in the description of the corresponding ticket
 ✓ Acknowledge any changes required to the Wiki
 ✓ Finally, in the PR description delete any empty sections and all text commented in <!--, so that this text does not appear in merge commit messages.
-->


2669: Bump version to v2021-05-26 r=Anviking a=rvl

### Overview

As per the [Release Checklist](https://github.com/input-output-hk/cardano-wallet/wiki/Release-Checklist).


2670: API: Pass TokenMetadataError through to API r=Anviking a=rvl

### Issue Number

ADP-925

### Overview

If there was an error fetching metadata in the listMetadata or getMetadata endpoints, tell the user, rather than just returning "no metadata".

### Comments

Could someone please pick this up and merge for v2021-05-26.


2673: Testing additional account pub key endpoints r=piotr-iohk a=piotr-iohk

# Issue Number

ADP-934


# Overview

- 55b2fa4
  Tests for get acc pub key for shelley and shared wallets
  
- a388e30
  Add assertions for shared wallet status
  
- 9ab8eaf
  Cannot create acc pub key for wallets from acc pub key tests
  
- 42dab09
  Re-shuffle order and extend summary of key eps in swagger for clarity


# Comments

I've also improved a bit key endpoints summary in swagger for better clarity:

![Screenshot from 2021-05-26 16-08-47](https://user-images.githubusercontent.com/42900201/119674720-b80b5e00-be3c-11eb-81e5-38d95f88131f.png)

![Screenshot from 2021-05-26 16-09-01](https://user-images.githubusercontent.com/42900201/119674734-bcd01200-be3c-11eb-824e-c104bf1b927b.png)



Co-authored-by: Piotr Stachyra <[email protected]>
Co-authored-by: Rodney Lorrimar <[email protected]>
Co-authored-by: Johannes Lund <[email protected]>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented May 26, 2021

Build failed (retrying...):

iohk-bors bot added a commit that referenced this pull request May 26, 2021
2662: Basic migration plans e2e tests r=rvl a=piotr-iohk

# Issue Number

ADP-680


# Overview

<!-- Detail in a few bullet points the work accomplished in this PR -->

- [ ] e2e tests on testnet for creating migration plans for Byron/Icarus/Shelley wallets.


# Comments

<!-- Additional comments or screenshots to attach if any -->

<!--
Don't forget to:

 ✓ Self-review your changes to make sure nothing unexpected slipped through
 ✓ Assign yourself to the PR
 ✓ Assign one or several reviewer(s)
 ✓ Jira will detect and link to this PR once created, but you can also link this PR in the description of the corresponding ticket
 ✓ Acknowledge any changes required to the Wiki
 ✓ Finally, in the PR description delete any empty sections and all text commented in <!--, so that this text does not appear in merge commit messages.
-->


2670: API: Pass TokenMetadataError through to API r=Anviking a=rvl

### Issue Number

ADP-925

### Overview

If there was an error fetching metadata in the listMetadata or getMetadata endpoints, tell the user, rather than just returning "no metadata".

### Comments

Could someone please pick this up and merge for v2021-05-26.


Co-authored-by: Piotr Stachyra <[email protected]>
Co-authored-by: Rodney Lorrimar <[email protected]>
Co-authored-by: Johannes Lund <[email protected]>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented May 26, 2021

Build failed (retrying...):

rvl and others added 4 commits May 26, 2021 20:10
This commit adds very basic generators for token metadata (better than
the not generating at all), and re-regnerates the golden.

Now we see the new metadata_error field in some goldens.
@Anviking Anviking force-pushed the rvl/adp-925/asset-list-show-metadata-error branch from 4e66cd4 to 94b859d Compare May 26, 2021 18:10
@iohk-bors
Copy link
Contributor

iohk-bors bot commented May 26, 2021

Canceled.

@Anviking
Copy link
Member

Oops - having hlint passing is probably a good idea before borsing 🙈

@Anviking
Copy link
Member

bors r+

@iohk-bors
Copy link
Contributor

iohk-bors bot commented May 26, 2021

Build succeeded:

@iohk-bors iohk-bors bot merged commit 2de1910 into master May 26, 2021
@iohk-bors iohk-bors bot deleted the rvl/adp-925/asset-list-show-metadata-error branch May 26, 2021 20:01
WilliamKingNoel-Bot pushed a commit that referenced this pull request May 26, 2021
2670: API: Pass TokenMetadataError through to API r=Anviking a=rvl

### Issue Number

ADP-925

### Overview

If there was an error fetching metadata in the listMetadata or getMetadata endpoints, tell the user, rather than just returning "no metadata".

### Comments

Could someone please pick this up and merge for v2021-05-26.

Co-authored-by: Rodney Lorrimar <[email protected]>
Co-authored-by: Johannes Lund <[email protected]> 2de1910
arbitrary = AssetDecimals <$> choose (1, 19)

instance Arbitrary AssetMetadata where
-- TODO: We should add a proper arbitrary instance
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, yes we should.

<*> (pure "An asset")
<*> (oneof [pure Nothing, pure $ Just "AST"])
<*> genMaybe (pure $ AssetURL $ fromJust $
parseURI "https://asset.url")
Copy link
Member

Choose a reason for hiding this comment

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

FYI - I first tried using an existing Aribitrary URI instance, but it failed, because it generated http urls despite the swagger api promising it to be https.

I'm not sure what the metadata server promises, but if it allows http urls, then our swagger spec promises too much...

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