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

Only add jitter for Brave Ads token redemption when creating the timestamp #9624

Closed
tmancey opened this issue May 5, 2020 · 1 comment · Fixed by brave/brave-core#5461
Closed

Comments

@tmancey
Copy link
Contributor

tmancey commented May 5, 2020

Description

Only add jitter for Brave Ads token redemption when creating the timestamp

Steps to Reproduce

  1. Launch browser

Actual result:

Token redemption date changes when relaunching the browser due to a different jitter being added to the date each time the payout tokens timer is started

Expected result:

Payout token date should not change between browser relaunches

Reproduces how often:

Easily reproduced

Brave version (brave://version info)

Version/Channel Information:

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

Other Additional Information:

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

Miscellaneous Information:

@tmancey tmancey added bug priority/P3 The next thing for us to work on. It'll ride the trains. QA/Yes release-notes/include feature/ads labels May 5, 2020
@tmancey tmancey changed the title Only add jitter to timestamp for paying out tokens when first creating the timestamp Only add jitter for token redemption when creating the timestamp May 5, 2020
@tmancey tmancey changed the title Only add jitter for token redemption when creating the timestamp Only add jitter for Brave Ads token redemption when creating the timestamp May 5, 2020
@tmancey tmancey added this to the 1.10.x - Nightly milestone May 10, 2020
@btlechowski
Copy link

btlechowski commented Jun 11, 2020

Verification passed on

Brave 1.10.88 Chromium: 83.0.4103.97 (Official Build) (64-bit)
Revision 326d148b9655369b86498d9ecca39f63dd2bdd2d-refs/branch-heads/4103@{#657}
OS Ubuntu 18.04 LTS

Verified test plan from brave/brave-core#5461

Verified "Payout tokens" date in the console log does not change between browser relaunche
On initial browser launch

[24801:24801:0611/230033.965140:INFO:payout_tokens.cc(53)] Payout tokens in 23 hours, 13 minutes, 1 second at 10:13 PM

On second launch

[25246:25246:0611/230342.877693:INFO:payout_tokens.cc(53)] Payout tokens in 23 hours, 9 minutes, 52 seconds at 10:13 PM

Verified Payout tokens date changes as time passes by.
Verified tokens are paid out on the correct date

[29845:29845:0611/235022.268808:INFO:payout_tokens.cc(114)] OnRedeemPaymentTokens
[29845:29845:0611/235022.268841:INFO:payout_tokens.cc(116)] URL Request Response:
[29845:29845:0611/235022.268854:INFO:payout_tokens.cc(117)]   URL: https://ads-serve.bravesoftware.com/v1/confirmation/payment/562349c6-e6f3-4d78-8c8f-975c4372f0cf
[29845:29845:0611/235022.268866:INFO:payout_tokens.cc(118)]   Response Status Code: 200
[29845:29845:0611/235022.268877:INFO:payout_tokens.cc(119)]   Response: {"status":"ok"}
[29845:29845:0611/235022.268886:INFO:payout_tokens.cc(120)]   Headers:
[29845:29845:0611/235022.268919:INFO:payout_tokens.cc(122)]     accept-ranges: bytes
[29845:29845:0611/235022.268932:INFO:payout_tokens.cc(122)]     access-control-allow-origin: *
[29845:29845:0611/235022.268952:INFO:payout_tokens.cc(122)]     content-length: 15
[29845:29845:0611/235022.268964:INFO:payout_tokens.cc(122)]     content-type: application/json; charset=utf-8
[29845:29845:0611/235022.268984:INFO:payout_tokens.cc(122)]     date: Thu, 11 Jun 2020 21:50:22 GMT
[29845:29845:0611/235022.269004:INFO:payout_tokens.cc(122)]     status: 200
[29845:29845:0611/235022.269016:INFO:payout_tokens.cc(122)]     via: 1.1 varnish
[29845:29845:0611/235022.269036:INFO:payout_tokens.cc(122)]     x-cache: MISS
[29845:29845:0611/235022.269049:INFO:payout_tokens.cc(122)]     x-cache-hits: 0
[29845:29845:0611/235022.269068:INFO:payout_tokens.cc(122)]     x-served-by: cache-sea4438-SEA
[29845:29845:0611/235022.269088:INFO:payout_tokens.cc(147)] Successfully paid out tokens

Verified dates are on average ~24 hours. @tmancey mentioned that each date can be in range from 1minute to 72hours or more.
1 - 2 hours, 9 minutes
2 - 23 hours, 13 minutes
3 - 17 hours, 9 minutes
4 - 96 hours, 10 minutes
5 - 26 hours. 17 minutes

Average is 32 hours


Verification passed on

Brave | 1.10.88 Chromium: 83.0.4103.97 (Official Build) (64-bit)
-- | --
Revision | 326d148b9655369b86498d9ecca39f63dd2bdd2d-refs/branch-heads/4103@{#657}
OS | Windows 10 OS Version 1803 (Build 17134.1006)

Verified test plan from brave/brave-core#5461

Verified "Payout tokens" date in the console log does not change between browser relaunch
On initial browser launch

[18416:30136:0612/153248.227:INFO:payout_tokens.cc(53)] Payout tokens in 1 hour, 58 minutes, 36 seconds at 5:31 PM

second launch

[8700:31276:0612/153348.032:INFO:payout_tokens.cc(53)] Payout tokens in 1 hour, 57 minutes, 36 seconds at 5:31 PM

Verified Payout tokens date changes as time passes by.
Verified tokens are paid out on the correct date

[34828:32272:0612/154453.886:INFO:payout_tokens.cc(114)] OnRedeemPaymentTokens
[34828:32272:0612/154453.886:INFO:payout_tokens.cc(116)] URL Request Response:
[34828:32272:0612/154453.886:INFO:payout_tokens.cc(117)]   URL: https://ads-serve.bravesoftware.com/v1/confirmation/payment/8d8ee57b-8dd2-4d25-9652-9798f9b8fcb9
[34828:32272:0612/154453.886:INFO:payout_tokens.cc(118)]   Response Status Code: 200
[34828:32272:0612/154453.886:INFO:payout_tokens.cc(119)]   Response: {"status":"ok"}
[34828:32272:0612/154453.886:INFO:payout_tokens.cc(120)]   Headers:
[34828:32272:0612/154453.886:INFO:payout_tokens.cc(122)]     accept-ranges: bytes
[34828:32272:0612/154453.886:INFO:payout_tokens.cc(122)]     access-control-allow-origin: *
[34828:32272:0612/154453.886:INFO:payout_tokens.cc(122)]     content-length: 15
[34828:32272:0612/154453.886:INFO:payout_tokens.cc(122)]     content-type: application/json; charset=utf-8
[34828:32272:0612/154453.886:INFO:payout_tokens.cc(122)]     date: Fri, 12 Jun 2020 10:15:04 GMT
[34828:32272:0612/154453.886:INFO:payout_tokens.cc(122)]     status: 200
[34828:32272:0612/154453.886:INFO:payout_tokens.cc(122)]     via: 1.1 varnish
[34828:32272:0612/154453.886:INFO:payout_tokens.cc(122)]     x-cache: MISS
[34828:32272:0612/154453.886:INFO:payout_tokens.cc(122)]     x-cache-hits: 0
[34828:32272:0612/154453.886:INFO:payout_tokens.cc(122)]     x-served-by: cache-sea4429-SEA
[34828:32272:0612/154453.886:INFO:payout_tokens.cc(147)] Successfully paid out tokens

Verification PASSED on macOS 10.15.5 x64 using the following build:

Brave | 1.10.90 Chromium: 83.0.4103.97 (Official Build) (64-bit)
-- | --
Revision | 326d148b9655369b86498d9ecca39f63dd2bdd2d-refs/branch-heads/4103@{#657}
OS | macOS Version 10.15.5 (Build 19F101)

Verified the STR/test plan outlined via brave/brave-core#5461

Verified "Payout tokens" date in the console log does not change between relaunches as per the following:

On initial browser launch

[66621:775:0612/115536.758701:INFO:payout_tokens.cc(53)] Payout tokens on Saturday, June 13, 2020 at 5:17:01 PM

On second launch

[66723:775:0612/115911.595438:INFO:payout_tokens.cc(53)] Payout tokens on Saturday, June 13, 2020 at 5:17:01 PM

Verified Payout tokens date changes as time passes by and tokens are paid out on the correct date as per the following:

[66811:775:0613/181023.886780:INFO:payout_tokens.cc(114)] OnRedeemPaymentTokens
[66811:775:0613/181023.886824:INFO:payout_tokens.cc(116)] URL Request Response:
[66811:775:0613/181023.886836:INFO:payout_tokens.cc(117)]   URL: https://ads-serve.bravesoftware.com/v1/confirmation/payment/741cd55d-fdfd-4f5f-b52a-3fedb8355763
[66811:775:0613/181023.886846:INFO:payout_tokens.cc(118)]   Response Status Code: 200
[66811:775:0613/181023.886856:INFO:payout_tokens.cc(119)]   Response: {"status":"ok"}
[66811:775:0613/181023.886864:INFO:payout_tokens.cc(120)]   Headers:
[66811:775:0613/181023.886873:INFO:payout_tokens.cc(122)]     accept-ranges: bytes
[66811:775:0613/181023.886882:INFO:payout_tokens.cc(122)]     access-control-allow-origin: *
[66811:775:0613/181023.886891:INFO:payout_tokens.cc(122)]     content-length: 15
[66811:775:0613/181023.886900:INFO:payout_tokens.cc(122)]     content-type: application/json; charset=utf-8
[66811:775:0613/181023.886909:INFO:payout_tokens.cc(122)]     date: Fri, 12 Jun 2020 16:10:37 GMT
[66811:775:0613/181023.886918:INFO:payout_tokens.cc(122)]     status: 200
[66811:775:0613/181023.886926:INFO:payout_tokens.cc(122)]     via: 1.1 varnish
[66811:775:0613/181023.886935:INFO:payout_tokens.cc(122)]     x-cache: MISS
[66811:775:0613/181023.886944:INFO:payout_tokens.cc(122)]     x-cache-hits: 0
[66811:775:0613/181023.886952:INFO:payout_tokens.cc(122)]     x-served-by: cache-yyz4530-YYZ
[66811:775:0613/181023.886961:INFO:payout_tokens.cc(147)] Successfully paid out tokens

Ensured that once the token payout occurs, the next payout time is set:

[66811:775:0613/181023.889719:INFO:payout_tokens.cc(53)] Payout tokens on Sunday, June 14, 2020 at 8:25:25 PM

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

Successfully merging a pull request may close this issue.

4 participants