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

wallet balance decreasing by AC amount each time browser is relaunched #7844

Closed
LaurenWags opened this issue Jan 21, 2020 · 6 comments · Fixed by brave/brave-core#4399
Closed

Comments

@LaurenWags
Copy link
Member

Description

Looks like if you have a user funded anon wallet and you perform an auto contribute using 1.3.x, when you close/relaunch the browser, it is retrying step 3 in the contribution process and as a result, is deducting the AC monthly budget amount from your wallet balance. It seems like step 3 isn't being marked as successful and so it keeps getting retried on each relaunch, even though the amount is being deducted from the balance.

Steps to Reproduce

  1. clean profile 1.3.x staging profile, short reconcile interval (I used 5)
  2. enable rewards, restore user funded anon wallet. Beginning wallet balance was 25 BAT
  3. Change monthly budget to 5 BAT.
  4. add a verified site to a-c table and Trigger ac, ac completed 5 BAT deducted from wallet
  5. Wallet balance is now 20 BAT
    --> look at logs, see item about retrying step 3 (why?)
[ RESPONSE - ReconcilePayloadCallback ]
> time: 1579627546
> result: Success
> http code: 200
> response: {"paymentStamp":1579627546681,"probi":"5000000000000000000","altcurrency":"BAT"}
> headers accept-ranges: bytes
> headers cache-control: private
> headers content-length: 80
> headers content-type: application/json; charset=utf-8
> headers date: Tue, 21 Jan 2020 17:25:46 GMT
> headers server: Cowboy
> headers status: 200
> headers via: 1.1 varnish
> headers x-cache: MISS
> headers x-cache-hits: 0
> headers x-served-by: cache-ewr18133-EWR
[ END RESPONSE ]
[38160:775:0121/122546.708684:WARNING:contribution.cc(447)] Re-trying contribution for step 3 for 3d4d68a3-2292-4361-a540-642a3b00635f
[38160:775:0121/122546.708721:VERBOSE1:ledger_impl.cc(1102)] Contribution step 3 for 3d4d68a3-2292-4361-a540-642a3b00635f
  1. Keep AC table blank, let a reconcile period (5min) go by without any data in AC table (so AC should not go thru as the table is blank). Wallet balance remained at 20 BAT. Keep AC table blank.
  2. Close and relaunch (using staging flags, etc)
  3. Wallet balance decreases by 5 BAT.
    --> look at logs again, it is retrying step 3 as above:
[ RESPONSE - ReconcilePayloadCallback ]
> time: 1579627873
> result: Success
> http code: 200
> response: {"paymentStamp":1579627873623,"probi":"5000000000000000000","altcurrency":"BAT"}
> headers accept-ranges: bytes
> headers cache-control: private
> headers content-length: 80
> headers content-type: application/json; charset=utf-8
> headers date: Tue, 21 Jan 2020 17:31:13 GMT
> headers server: Cowboy
> headers status: 200
> headers via: 1.1 varnish
> headers x-cache: MISS
> headers x-cache-hits: 0
> headers x-served-by: cache-lga21944-LGA
[ END RESPONSE ]
[38198:775:0121/123113.742973:WARNING:contribution.cc(447)] Re-trying contribution for step 3 for 3d4d68a3-2292-4361-a540-642a3b00635f
[38198:775:0121/123113.743021:VERBOSE1:ledger_impl.cc(1102)] Contribution step 3 for 3d4d68a3-2292-4361-a540-642a3b00635f

You can repeat steps 7-8 and the wallet balance will decrease by 5 BAT each time.

Actual result:

wallet balance decreases by AC budget amount on each relaunch. Logs shows retrying step 3 for some reason.

Expected result:

wallet balance should not be decreasing on each relaunch

Reproduces how often:

easily

Brave version (brave://version info)

Brave 1.3.97 Chromium: 79.0.3945.130 (Official Build) beta (64-bit)
Revision e22de67c28798d98833a7137c0e22876237fc40a-refs/branch-heads/3945@{#1047}
OS macOS Version 10.14.6 (Build 18G103)

Version/Channel Information:

  • Can you reproduce this issue with the current release?
  • Can you reproduce this issue with the beta channel? yes
  • Can you reproduce this issue with the dev channel?
  • Can you reproduce this issue with the nightly channel?

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 @NejcZdovc @rebron @brave/legacy_qa

@LaurenWags
Copy link
Member Author

Note - I tried this with a KYC'd user wallet as the source of BAT, and this is what I saw:

  1. clean profile 1.3.x staging profile, short reconcile interval (I used 5)
  2. enable rewards, do not claim grant, and connect KYC'd uphold account
  3. fund the wallet from sandbox uphold (enough for a couple ACs) - starting wallet balance was 25 BAT
  4. Change monthly budget to 5 BAT.
  5. add a verified site to a-c table and Trigger ac, ac completes and 5 BAT deducted from wallet
  6. Wallet balance is now 20 BAT

--> look at logs, see item about retrying step 3 (why?)

[38021:775:0121/115136.409953:VERBOSE1:ledger_impl.cc(1102)] Contribution step 3 for 25f5ba91-df59-4c54-9821-ab8a01d60f5f
[38021:775:0121/115136.413732:VERBOSE1:ledger_impl.cc(395)] 
[ REQUEST ]
> url: https://ledger-staging.mercury.basicattentiontoken.org/v2/wallet/a7cf864f-f488-4351-a5ee-bf4dcfbcc4ed
> method: UrlMethod::PUT
> content: {"requestType":"httpSignature","signedTx":{"headers":{"digest":"SHA-256=sWh/DtY5jN8umAPNQRsG8i8pnr88ySLEBQ2ys07y2DU=","signature":"keyId=\"primary\",algorithm=\"ed25519\",headers=\"digest\",signature=\"nZeVhXdZK/ogAJjvVVlUDyKOcAQuRg2zoEFDBYk+mdWYrTDhHM3ERGtuJS8+n8SdeNgLOBfXm2HWyjsh5ny8Dw==\""},"body":{"denomination":{"amount":"5","currency":"BAT"},"destination":"6654ecb0-6079-4f6c-ba58-791cc890a561"},"octets":"{\"denomination\":{\"amount\":\"5\",\"currency\":\"BAT\"},\"destination\":\"6654ecb0-6079-4f6c-ba58-791cc890a561\"}"},"surveyorId":"5OQOKxhYVGQ4aGshNgjpfo3+OK8HVrgSGMdAQLDUZpM","viewingId":"25f5ba91-df59-4c54-9821-ab8a01d60f5f"}
> contentType: application/json; charset=utf-8
> header: Content-Type: application/json; charset=UTF-8
[ END REQUEST ]
[38021:775:0121/115138.122038:INFO:confirmations_impl.cc(1064)] OnTimer:
  timer_id: 15
  retry_getting_signed_tokens_timer_id_: 8
  payout_redeemed_tokens_timer_id_: 5
[38021:775:0121/115138.122119:INFO:ads_rewards.cc(98)] OnTimer: 
  timer_id: 15
  retry_timer_id_: 0

[38021:775:0121/115138.122148:INFO:uphold.cc(354)] OnTimer Uphold: 15
[38021:775:0121/115138.184272:VERBOSE1:ledger_impl.cc(866)] 
[ RESPONSE - ReconcilePayloadCallback ]
> time: 1579625498
> result: Success
> http code: 200
> response: {"paymentStamp":1579625498113,"probi":"5000000000000000000","altcurrency":"BAT"}
> headers accept-ranges: bytes
> headers cache-control: private
> headers content-length: 80
> headers content-type: application/json; charset=utf-8
> headers date: Tue, 21 Jan 2020 16:51:38 GMT
> headers server: Cowboy
> headers status: 200
> headers via: 1.1 varnish
> headers x-cache: MISS
> headers x-cache-hits: 0
> headers x-served-by: cache-ewr18134-EWR
[ END RESPONSE ]
[38021:775:0121/115138.184358:WARNING:contribution.cc(447)] Re-trying contribution for step 3 for 25f5ba91-df59-4c54-9821-ab8a01d60f5f
[38021:775:0121/115138.184408:VERBOSE1:ledger_impl.cc(1102)] Contribution step 3 for 25f5ba91-df59-4c54-9821-ab8a01d60f5f
  1. Keep AC table blank, let a reconcile period go by without any data in AC table (so AC should not go thru as the table is blank). Wallet balance remained at 20 BAT.
  2. Close and relaunch (using staging flags, etc)
  3. Wallet balance remains 20 BAT.

--> again, look at logs. It looks like it's trying the same contribution which was successful in earlier but was stopped:

[ RESPONSE - ReconcilePayloadCallback ]
> time: 1579625848
> result: Failure
> http code: 500
> response: {"statusCode":500,"error":"Internal Server Error","message":"An internal server error occurred"}
> headers accept-ranges: bytes
> headers cache-control: no-cache
> headers content-length: 96
> headers content-type: application/json; charset=utf-8
> headers date: Tue, 21 Jan 2020 16:57:28 GMT
> headers server: Cowboy
> headers status: 500
> headers via: 1.1 varnish
> headers x-cache: MISS
> headers x-cache-hits: 0
> headers x-served-by: cache-lga21924-LGA
[ END RESPONSE ]
[38069:775:0121/115728.755829:WARNING:contribution.cc(447)] Re-trying contribution for step 3 for 25f5ba91-df59-4c54-9821-ab8a01d60f5f
[38069:775:0121/115728.755867:VERBOSE1:ledger_impl.cc(1102)] Contribution step 3 for 25f5ba91-df59-4c54-9821-ab8a01d60f5f

It still retried step 3, but was stopped.

@NejcZdovc
Copy link
Contributor

this one regressed with brave/brave-core#4045

NejcZdovc added a commit to brave/brave-core that referenced this issue Jan 21, 2020
@LaurenWags
Copy link
Member Author

@brave/legacy_qa when retesting this, please test with a clean profile and an upgrade profile per https://bravesoftware.slack.com/archives/CB0KCRCQN/p1579642207038100?thread_ts=1579640334.035500&cid=CB0KCRCQN

@kjozwiak
Copy link
Member

Removed the QA/Blocked label as brave/brave-core#4399 was merged into both 1.4.x & 1.3.x via brave/brave-core#4437 & brave/brave-core#4438.

@LaurenWags
Copy link
Member Author

Needs fixes from brave/brave-core#4372 uplifted to fully test this. Once those are uplifted this can be retested.

@LaurenWags
Copy link
Member Author

LaurenWags commented Feb 3, 2020

Verified passed using

Brave 1.3.108 Chromium: 79.0.3945.130 (Official Build) beta (64-bit)
Revision e22de67c28798d98833a7137c0e22876237fc40a-refs/branch-heads/3945@{#1047}
OS macOS Version 10.14.6 (Build 18G103)

Verification passed on

Brave 1.3.108 Chromium: 79.0.3945.130 (Official Build) beta (64-bit)
Revision e22de67c28798d98833a7137c0e22876237fc40a-refs/branch-heads/3945@{#1047}
OS Ubuntu 18.04 LTS

Verification passed on

Brave 1.3.109 Chromium: 79.0.3945.130 (Official Build) beta (64-bit)
Revision e22de67c28798d98833a7137c0e22876237fc40a-refs/branch-heads/3945@{#1047}
OS Windows 10 OS Version 1803 (Build 17134.1006)

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