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

fixes balance being an empty string #5883

Merged
merged 1 commit into from
Jun 18, 2020
Merged

Conversation

AndriusA
Copy link

@AndriusA AndriusA commented Jun 17, 2020

Resolves brave/brave-browser#10315

Submitter Checklist:

Test Plan:

Steps to reproduce issue (Verified on Brave Dev 1.11.82 on Macos):

  1. Start with a fresh profile
  2. Verify wallet with uphold, there should not be any grants in the wallet already
  3. As soon as wallet is verified, logs should contain POST requests to v2/wallet/WALLET_ID/claim endpoint including "denomination":{"amount":"","currency":"BAT"} in the body and server responses with error code 500

For testing, browser was launched with:

--args --user-data-dir=./profile-5883 \
  --enable-logging=stderr \
  --vmodule="*/bat-native-ledger/*"=6,"*/brave_rewards/*"=6,"*/bat-native-ads/*"=6,"*/bat-native-confirmations/*"=6,"*/brave_ads/*"=6 \
  --rewards=staging=true

And relevant output:

[ REQUEST ]
> URL: https://ledger-staging.mercury.basicattentiontoken.org/v2/wallet/ZZZZ/claim
> Method: UrlMethod::POST
> Content: {"anonymousAddress":"ZZZZ","signedTx":{"body":{"denomination":{"amount":"","currency":"BAT"},"destination":"ZZZZ"},"headers":{"digest":"SHA-256=4GobaOVP+I+43Eh1dOOUaKiNzFN0E0gB0aY48Y0rhWw=","signature":"keyId=\"primary\",algorithm=\"ed25519\",headers=\"digest\",signature=\"oxsmsZbsi4uM1cBKIJXX2dfomXzs733LoH8rgltfgiUvZnjdFY8mTzDnDVR6JNyNbo2/KnDDtshG5pnujdJgBg==\""},"octets":"{\"denomination\":{\"amount\":\"\",\"currency\":\"BAT\"},\"destination\":\"ZZZZ\"}"}}
> Content Type: application/json; charset=utf-8
> Header Content-Type: application/json; charset=UTF-8
[95374:775:0630/132704.611833:VERBOSE6:wallet.cc(190)]
[ RESPONSE - OnTransferAnonToExternalWallet ]
> Url: https://ledger-staging.mercury.basicattentiontoken.org/v2/wallet/ZZZZ/claim
> Result: Failure
> HTTP Code: 500
> Body: {"statusCode":500,"error":"Internal Server Error","message":"An internal server error occurred"}

With the issue fixed and calls to v2/wallet/WALLET_ID/claim should not be made or amount in the POST payload should be a non-empty numeric string

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions
  • Verify test plan is specified in PR before merging to source

After-merge Checklist:

  • The associated issue milestone is set to the smallest version that the
    changes has landed on.
  • All relevant documentation has been updated.

Copy link
Contributor

@emerick emerick left a comment

Choose a reason for hiding this comment

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

LGTM, a couple of minor comments

@kjozwiak
Copy link
Member

kjozwiak commented Jul 6, 2020

Verification PASSED on macOS 10.15.5 x64 using the following build:

Brave | 1.12.72 Chromium: 84.0.4147.68 (Official Build) nightly (64-bit)
-- | --
Revision | e7b7234037639b407e69c5428c891ce018cd6c0d-refs/branch-heads/4147@{#772}
OS | macOS Version 10.15.5 (Build 19F101)
  • Created a new account on staging and waited till Uphold verified the account
  • Once verified, ensure that the amount in the POST request was a non-empty numeric string

Example:

[ REQUEST ]
> URL: https://ledger-staging.mercury.basicattentiontoken.org/v2/wallet/33df2720-d774-4965-8bf8-c8b584e4e305/claim
> Method: UrlMethod::POST
> Content: {"anonymousAddress":"5672d309-f9b2-420b-82e8-74e04a67ecba","signedTx":{"body":{"denomination":{"amount":"0","currency":"BAT"},"destination":"d587539b-a32f-413d-80e9-fd1e1ca8b4dc"},"headers":{"digest":"SHA-256=icQV0kJzJUsmPehFR2qDVKh6QLLv1Y1g2NyjeBblrvU=","signature":"keyId=\"primary\",algorithm=\"ed25519\",headers=\"digest\",signature=\"yPhHvjHBgmndZcYtc+waJlndc2gkeX45bFlR5Nb3dkhA74S1CM0b9axFmddxy1qWw7GHHAwBeN/KIWvJqJpCCg==\""},"octets":"{\"denomination\":{\"amount\":\"0\",\"currency\":\"BAT\"},\"destination\":\"d587539b-a32f-413d-80e9-fd1e1ca8b4dc\"}"}}
> Content Type: application/json; charset=utf-8
> Header Content-Type: application/json; charset=UTF-8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Desktop] If no user funds wallet is not reported when connected to uphold
4 participants