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

Make tipping banner response depend on success/error from server: Follow up to 15543 #19071

Closed
LaurenWags opened this issue Oct 28, 2021 · 7 comments · Fixed by brave/brave-core#14205

Comments

@LaurenWags
Copy link
Member

LaurenWags commented Oct 28, 2021

Description

Update Oct 29, 2021: Upon further testing and investigation, original #15543 was not resolved by changes there. Much deeper changes to the contribution engine will be needed to successfully resolve #15543. I have updated title of this issue to become the new #15543.

@szilardszaloki found this issue while discussing #15543

Due to a long existing but, anon or Uphold user wallets will always show "Success" (confetti) after tipping. They do not show the "Failure" state. From @szilardszaloki:

Just found a bug deep down in the contribution code (which has been around since June 2020). ContributionTip doesn't pass down the callback to the layer that actually handles the processing of contributions, but instead returns with LEDGER_OK when saving the contribution queue in the contribution_queue table (no matter if it was successful or not).

Steps to Reproduce

Case 1 - Anon wallet (pre-req: have Charles Proxy set up to return 500 error for https://grant.rewards.bravesoftware.com/v1/suggestions)

  1. Clean profile, staging env
  2. Enable Rewards, claim UGP grant
  3. Go to tip a verified publisher
  4. Watch logs
  5. You will see the 500 error, but you get the success/confetti on tip banner

Case 2 - Uphold wallet (pre-req: have Charles Proxy set up to return 500 error for https://api-sandbox.uphold.com/v0/me/cards/card-id/transactions)

  1. Clean profile, staging env
  2. Enable Rewards, connect KYC'd Uphold staging wallet
  3. Go to tip an Uphold verified publisher
  4. Watch logs
  5. You will see the 500 error, but you get the success/confetti on tip banner

All tipping scenarios for all wallet types (including bitFlyer and Gemini) would need to be retested once this is resolved.

Actual result:

Success on tip banner

Expected result:

Failure on tip banner

Reproduces how often:

easily

Brave version (brave://version info)

Brave | 1.32.84 Chromium: 95.0.4638.54 (Official Build) beta (x86_64)
-- | --
Revision | d31a821ec901f68d0d34ccdbaea45b4c86ce543e-refs/branch-heads/4638@{#871}
OS | macOS Version 11.6 (Build 20G165)

Version/Channel Information:

  • Can you reproduce this issue with the current release? n/a
  • Can you reproduce this issue with the beta channel? yes
  • Can you reproduce this issue with the nightly channel? yes

Other Additional Information:

  • Does the issue resolve itself when disabling Brave Shields?
  • Does the issue resolve itself when disabling Brave Rewards?
  • Is the issue reproducible on the latest version of Chrome?

Miscellaneous Information:

cc @szilardszaloki @Miyayes

@Miyayes Miyayes changed the title tip banner always shows success for anon/Uphold wallets - follow up to 15543 Make tipping banner response depend on success/error from server: Follow up to 15543 Oct 29, 2021
@Miyayes
Copy link
Collaborator

Miyayes commented Oct 29, 2021

Update Oct 29, 2021: Upon further testing and investigation, original #15543 was not resolved by changes there. Much deeper changes to the contribution engine will be needed to successfully resolve #15543. I have updated title of this issue to become the new #15543.

@Miyayes Miyayes added priority/P4 Planned work. We expect to get to it "soon". and removed priority/P3 The next thing for us to work on. It'll ride the trains. labels Oct 29, 2021
@Miyayes Miyayes added needs-investigation A bug not 100% confirmed/fixed and removed needs-investigation A bug not 100% confirmed/fixed labels Oct 30, 2021
@LaurenWags
Copy link
Member Author

thanks for the updates to this issue @Miyayes 👍🏻

@Miyayes Miyayes added priority/P3 The next thing for us to work on. It'll ride the trains. and removed priority/P4 Planned work. We expect to get to it "soon". labels Jan 25, 2022
@Miyayes
Copy link
Collaborator

Miyayes commented Jan 26, 2022

Will be able to implement fix following this refactor: #20473.

@szilardszaloki
Copy link
Contributor

I think there's a good chance @zenparsing's work on refactoring the contribution_queue in #20473 will make the changes in #15543 take effect.

@Miyayes
Copy link
Collaborator

Miyayes commented Jul 15, 2022

Possible workaround w/o full contribution engine refactor: Tipping banner won't wait for contribution engine. It'll get a success response from contribution engine ("successfully put into queue"), but then it would listen for general contribution failures. @zenparsing

@Miyayes Miyayes removed the blocked label Jul 15, 2022
@brave-builds brave-builds added this to the 1.43.x - Nightly milestone Jul 20, 2022
@LaurenWags LaurenWags added the QA/In-Progress Indicates that QA is currently in progress for that particular issue label Aug 10, 2022
@LaurenWags
Copy link
Member Author

LaurenWags commented Aug 10, 2022

Verified with

Brave | 1.43.63 Chromium: 104.0.5112.81 (Official Build) beta (x86_64)
-- | --
Revision | 5b7b76419d50f583022568b6764b630f6ddc9208-refs/branch-heads/5112@{#1309}
OS | macOS Version 12.5 (Build 21G72)

Note, manually enabled "Use WebUI Rewards Panel" prior to below cases to do additional testing of #22423.

Per the test plan in brave/brave-core#14205 (comment), the following items have been regression tested via #20748 (comment):

  • Sending a tip successfully
    • Able to tip successfully from anon (vBAT funded) rewards to connected/not KYC'd, Uphold, Gemini, bF creators
    • Able to tip successfully using Uphold rewards to Uphold KYC'd creator
    • Able to tip successfully using bitFlyer rewards to bitFlyer creator
    • Able to tip successfully using Gemini rewards to Gemini creator
  • Sending a tip to a non-verified/non-registered publisher (an entry should be added to the pending tips list)
    • Pending tips set up successfully from anon (vBAT funded) rewards for unverified creators
    • Pending tips set up successfully using Uphold rewards for unverified, connected/not KYC'd, Gemini, and bF creators
    • Pending tips set up successfully using bF rewards for unverified, connected/not KYC'd, Uphold, and Gemini creators
    • Pending tips set up successfully using Gemini rewards for unverified, connected/not KYC'd, Uphold, and bF creators
  • Also confirmed correct messaging on the panel (and hover text if applicable) for the above creator/custodian scenarios - screenshots under linked comment
  • Also confirmed expected messaging on the tip banner (success or pending tip) for the above scenarios - screenshots under linked comment
Brave | 1.43.71 Chromium: 104.0.5112.81 (Official Build) beta (x86_64)
-- | --
Revision | 5b7b76419d50f583022568b6764b630f6ddc9208-refs/branch-heads/5112@{#1309}
OS | macOS Version 12.5 (Build 21G72)
vBAT failed tip - FAILED, follow up issue logged

Verified STR from Case 1 in #19071 (comment).

Failed as tip banner still showed success even though logs showed 500. Tip also went into retry loop (not sure if this part is expected).

Follow up issue logged: #24707

vBAT

Logs:

[ REQUEST ]
> URL: https://grant.rewards.bravesoftware.com/v1/suggestions
> Method: POST
> Content: {"credentials":[{"publicKey":"6AphTvx13IgxVRG1nljV2ql1Y7yGUol6yrVMhEP85wI=","signature":"VH1eBPDkF/RE7wnEfraHWyyz0k2/AlzEvg6rEmL2XuUsIErfsgMX49z6aqkGcfUFOZ5fT1ku7dfkAGYSlr5ZnQ==","t":"jlNSf4xfRp/ZhcEROrcTtepWBHTcVh7ThmQC0LLza+LAfQ/E6HScsjOr3YrYzDO0GmhUQqWAnJxlVfDysNfGkg=="},{"publicKey":"6AphTvx13IgxVRG1nljV2ql1Y7yGUol6yrVMhEP85wI=","signature":"9De3U0GZjcUksvjwuphcBqtBOkme7q/0dpMaigVVdOFswm/F2pfTFjBiXLws4BlXLhFF54XI0p8n9RbnpP8DGg==","t":"bIqxO21a0byesEBBAW3zivRGm9fiAKXmN3tw0NK3IOQMAA6rtukt3i09AyyX/62xeJoab0X61A0cs5bDU+KNZw=="},{"publicKey":"6AphTvx13IgxVRG1nljV2ql1Y7yGUol6yrVMhEP85wI=","signature":"97e/sm0J8XtKJqoXqrV6VLN3/dglpwmk6YhndVgAAKxBPfs88g8AAYiYufKPIlA4i9ydYQ1mJjcx9zlYEfV1UA==","t":"F4fYkdrRwBbzeY/PDzKsakudDC5uWJ1xAv5Ioy6gLtgzJPhtPbupnw8h1xs5ZuUYJCTLJCo/8M5vFMzp138Ufw=="},{"publicKey":"6AphTvx13IgxVRG1nljV2ql1Y7yGUol6yrVMhEP85wI=","signature":"swQ5tirqbPEGip2CZy0Qvc6D5HcnDWrP8LYNJgLlfRyRab5AbbPxeaDwFmjlsqDPAteZQy/sOPPKp84sAXuAhQ==","t":"XInKd/S10ss1+XGHaXuYgziRUVT8u5vplbTW0VruOLOTehRMHaaeGbnaDJS4hBBoBujFX0TPC2Wae0EAjABaUg=="},{"publicKey":"6AphTvx13IgxVRG1nljV2ql1Y7yGUol6yrVMhEP85wI=","signature":"5MZe1d80qquw+sUbg/XtU15L9Xj8TLAbALL+Xa0hdgZGjOocQ88teS/U6R6WklaZPT8fr/OZd7WGj2TTMYVzcQ==","t":"Ia82D78zdLHNKjLa2TWUq+7R5LUcmLWUyIui7lgP34FjN01xExm1FMiNk3DLdNIYYxHM3/u7ME+exACO6CS1UA=="}],"suggestion":"eyJjaGFubmVsIjoiZHVja2R1Y2tnby5jb20iLCJ0eXBlIjoib25lb2ZmLXRpcCJ9"}
> Content Type: application/json; charset=utf-8
[66885:259:0816/104235.133528:VERBOSE6:logging_util.cc(137)] 
[ RESPONSE - OnRequest ]
> Url: https://grant.rewards.bravesoftware.com/v1/suggestions
> Result: Failure
> HTTP Code: 500
> Body: 
[66885:259:0816/104235.133634:VERBOSE9:logging_util.cc(138)] 
[66885:259:0816/104235.134490:INFO:post_suggestions.cc(82)] Unexpected HTTP status: 500
[66885:259:0816/104235.135106:INFO:credentials_promotion.cc(472)] Failed to parse redeem tokens response
[66885:259:0816/104235.135710:INFO:contribution_unblinded.cc(500)] Tokens were not processed correctly
[66885:259:0816/104235.135812:VERBOSE1:contribution.cc(670)] Timer for contribution retry (d240c0fb-b17e-4460-a2dd-9cc952ca4acd) set for 102 s
Uphold failed tip - PASSED

Verified STR from Case 2 in #19071 (comment).

Confirmed when https://api-sandbox.uphold.com/v0/me/cards/card-id/transactions returns 500, the tip banner reflects that there is a failed tip.

Uphold

Logs:

[67148:259:0816/110211.456686:VERBOSE1:contribution.cc(383)] Creating contribution for wallet type uphold (amount: 1, type: ONE_TIME_TIP)
[67148:259:0816/110211.460526:VERBOSE1:contribution.cc(117)] Queue timer set for 13 s
[67148:259:0816/110211.461965:VERBOSE5:ledger_impl.cc(117)] 
[ REQUEST ]
> URL: https://api-sandbox.uphold.com/v0/me/cards/16c82421-4b1d-49cd-b811-a97eb74a7e64/transactions
> Method: POST
> Content: {"denomination":{"amount":"0.950000","currency":"BAT"},"destination":"abf1ff79-a239-42af-abff-20eb121edd1c","message":""}
> Content Type: application/json; charset=utf-8
[67148:259:0816/110211.624072:VERBOSE6:logging_util.cc(137)] 
[ RESPONSE - OnRequest ]
> Url: https://api-sandbox.uphold.com/v0/me/cards/16c82421-4b1d-49cd-b811-a97eb74a7e64/transactions
> Result: Failure
> HTTP Code: 500
> Body: {"application":{"clientId":"4c2b665ca060d..........
[67148:259:0816/110211.624237:VERBOSE9:logging_util.cc(138)] 
[ RESPONSE HEADERS ]
> Url: https://api-sandbox.uphold.com/v0/me/cards/16c82421-4b1d-49cd-b811-a97eb74a7e64/transactions
[67148:259:0816/110211.625253:INFO:post_transaction.cc(63)] Unexpected HTTP status: 500
Gemini failed tip - PASSED

Verified STR from Case 2 in #19071 (comment) for Gemini.

Confirmed when https://api.sandbox.gemini.com/v1/payments/pay returns 500, the tip banner reflects that there is a failed tip.

Gemini

Logs:

[68262:259:0816/125353.661943:VERBOSE1:contribution.cc(383)] Creating contribution for wallet type gemini (amount: 1, type: ONE_TIME_TIP)
[68262:259:0816/125353.665497:VERBOSE1:contribution.cc(117)] Queue timer set for 7 s
[68262:259:0816/125353.667957:INFO:post_transaction_gemini.cc(103)] Initiating gemini transaction to: 621e9dbc-6c28-4021-bce7-e3460841a7ccfor 0.95
[68262:259:0816/125353.668015:VERBOSE5:ledger_impl.cc(117)] 
[ REQUEST ]
> URL: https://api.sandbox.gemini.com/v1/payments/pay
> Method: POST
> Content Type: application/json; charset=utf-8
[68262:259:0816/125353.754916:VERBOSE6:logging_util.cc(137)] 
[ RESPONSE - OnRequest ]
> Url: https://api.sandbox.gemini.com/v1/payments/pay
> Result: Failure
> HTTP Code: 500
> Body: {"result":"OK","tx_ref":"16960357-5e02-43df-b550-a8feea9f62f3","amount":0.95,"currency":"BAT","destination":"621e9dbc-6c28-4021-bce7-e3460841a7cc","status":"Pending"}
[68262:259:0816/125353.754988:VERBOSE9:logging_util.cc(138)] 
[68262:259:0816/125353.755649:INFO:post_transaction_gemini.cc(114)] Gemini transaction failed
bitFlyer failed tip - PASSED

Verified STR from Case 2 in #19071 (comment) for bitFlyer.

Confirmed when https://demo24kiuw4dcyncsy3qlud8u8.azurewebsites.net/api/link/v1/coin/withdraw-to-deposit-id/request returns 500, the tip banner reflects that there is a failed tip.

bF

Logs:

[70161:259:0816/153801.394803:VERBOSE1:contribution.cc(383)] Creating contribution for wallet type bitflyer (amount: 1, type: ONE_TIME_TIP)
[70161:259:0816/153801.397262:VERBOSE1:contribution.cc(117)] Queue timer set for 6 s
[70161:259:0816/153801.397564:VERBOSE1:database_server_publisher_banner.cc(140)] Server publisher banner not found
[70161:259:0816/153801.397974:VERBOSE5:ledger_impl.cc(117)] 
[ REQUEST ]
> URL: https://demo24kiuw4dcyncsy3qlud8u8.azurewebsites.net/api/link/v1/coin/withdraw-to-deposit-id/request
> Method: POST
> Content: {"amount":"0.950000","currency_code":"BAT","deposit_id":"63149e8a-0008-4584-a243-ed792d445064","dry_run":false,"transfer_id":"2150975f-62c3-44fb-a662-90a93ee1187f"}
> Content Type: application/json; charset=utf-8
[70161:259:0816/153802.370087:VERBOSE6:logging_util.cc(137)] 
[ RESPONSE - OnRequest ]
> Url: https://demo24kiuw4dcyncsy3qlud8u8.azurewebsites.net/api/link/v1/coin/withdraw-to-deposit-id/request
> Result: Failure
> HTTP Code: 500
> Body: {
  "dry_run": false,
  "currency_code": "BAT",
  "amount": 0.950000,
  "message": null,
  "transfer_status": "SUCCESS",
  "transfer_id": "2150975f-62c3-44fb-a662-90a93ee1187f"
}
[70161:259:0816/153802.371095:INFO:post_transaction_bitflyer.cc(73)] Unexpected HTTP status: 500

Note, manually enabled "Use WebUI Rewards Panel" prior to below cases to do additional testing of #22423.

Per the test plan in brave/brave-core#14205 (comment), the following items have been regression tested:

  • Changing the monthly tip amount for a publisher.
Example Example Example Example Example
2 3 4 5 6
  • Clearing the monthly tip amount for a publisher.
Example Example Example Example Example Example
2 3 4 5 6 7

@GeetaSarvadnya
Copy link

GeetaSarvadnya commented Aug 25, 2022

Verification PASSED on

Brave | 1.43.78 Chromium: 104.0.5112.102 (Official Build) beta (64-bit)
-- | --
Revision | 8e5396254975ef939f2ef7d0bd334e48a052b536-refs/branch-heads/5112@{#1478}
OS | Windows 10 Version 21H2 (Build 19044.1889)

Uphold failed tip - PASSED

Verified STR from Case 2 in #19071 (comment).

Confirmed when https://api-sandbox.uphold.com/v0/me/cards/card-id/transactions returns 500, the tip banner reflects that there is a failed tip.

image

Logs:

[ REQUEST ]
> URL: https://api-sandbox.uphold.com/v0/me/cards/4f157868-e243-4eab-bbea-e10318a3b971/transactions
> Method: POST
> Content: {"denomination":{"amount":"0.950000","currency":"BAT"},"destination":"abf1ff79-a239-42af-abff-20eb121edd1c","message":""}
> Content Type: application/json; charset=utf-8
[18924:3804:0825/162553.057:VERBOSE6:logging_util.cc(137)]
[ RESPONSE - OnRequest ]
> Url: https://api-sandbox.uphold.com/v0/me/cards/4f157868-e243-4eab-bbea-e10318a3b971/transactions
> Result: Failure
> HTTP Code: 500
> Body: {"application":{"clientId":"4c2b665ca06.....}
[18924:3804:0825/162553.057:VERBOSE9:logging_util.cc(138)]
[ RESPONSE HEADERS ]
> Url: https://api-sandbox.uphold.com/v0/me/cards/4f157868-e243-4eab-bbea-e10318a3b971/transactions

[18924:3804:0825/162553.062:INFO:post_transaction.cc(63)] Unexpected HTTP status: 500
[18924:3804:0825/162553.086:VERBOSE5:ledger_impl.cc(117)]

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