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

Ad rewards not updated at brave://rewards due to loss of precision #15801

Closed
tmancey opened this issue May 12, 2021 · 4 comments · Fixed by brave/brave-core#8786
Closed

Ad rewards not updated at brave://rewards due to loss of precision #15801

tmancey opened this issue May 12, 2021 · 4 comments · Fixed by brave/brave-core#8786

Comments

@tmancey
Copy link
Contributor

tmancey commented May 12, 2021

Description

Ad rewards not updated due to loss of precision

Steps to Reproduce

  1. Close the browser
  2. Replace the ads_rewards node of confirmations.json with CONFIRMATIONS JSON (see below)
  3. Rewrite GET /v1/confirmation/payment/{payment_id} endpoint to return PAYMENT BALANCE RESPONSE DATA (see below)
  4. Rewrite GET /v1/promotions/ads/grants/summary?paymentId={payment_id} endpoint to return AD GRANT RESPONSE DATA (see below)
  5. Launch the browser

Actual result:

Payment balance is not ready appear in the console log

Expected result:

Successfully reconciled ad rewards should appear in the console log

Reproduces how often:

Intermittent issue depending on payment balances and ad grant balance

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 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:

CONFIRMATIONS JSON:

  "ads_rewards": {
    "grants_balance": 40.355,
    "payments": [
      {
        "balance": 0.6075,
        "month": "2021-05",
        "transaction_count": "108"
      },
      {
        "balance": 2.6895,
        "month": "2021-04",
        "transaction_count": "275"
      },
      {
        "balance": 6.015,
        "month": "2021-03",
        "transaction_count": "498"
      },
      {
        "balance": 6.235,
        "month": "2021-02",
        "transaction_count": "430"
      },
      {
        "balance": 3.1,
        "month": "2021-01",
        "transaction_count": "273"
      },
      {
        "balance": 10.66,
        "month": "2020-12",
        "transaction_count": "390"
      },
      {
        "balance": 5.795,
        "month": "2020-11",
        "transaction_count": "198"
      },
      {
        "balance": 6.8,
        "month": "2020-10",
        "transaction_count": "228"
      },
      {
        "balance": 2.05,
        "month": "2020-09",
        "transaction_count": "93"
      }
    ],
    "unreconciled_estimated_pending_rewards": 0.41750000000000015
  },

PAYMENT BALANCE RESPONSE DATA:

          [
             {
                "month":"2021-05",
                "transactionCount":"180",
                "balance":"1.025"
              },
              {
                "month":"2021-04",
                "transactionCount":"275",
                "balance":"2.6895"
              },
              {
                "month":"2021-03",
                "transactionCount":"498",
                "balance":"6.015"
              },
              {
                "month":"2021-02",
                "transactionCount":"430",
                "balance":"6.235"
              },
              {
                "month":"2021-01",
                "transactionCount":"273",
                "balance":"3.1"
              },
              {
                "month":"2020-12",
                "transactionCount":"390",
                "balance":"10.66"
              },
              {
                "month":"2020-11",
                "transactionCount":"198",
                "balance":"5.795"
              },
              {
                "month":"2020-10",
                "transactionCount":"228",
                "balance":"6.8"
              },
              {
                "month":"2020-09",
                "transactionCount":"93",
                "balance":"2.05"
              }
            ]

AD GRANT RESPONSE DATA:

           {
              "type" : "ads",
              "amount" : "42.98",
              "lastClaim" : "2021-05-06T20:55:56Z"
            }
@RupeshBhandari
Copy link

where is the confirmations.json file?

@tmancey
Copy link
Contributor Author

tmancey commented May 13, 2021

@RupeshBhandari these steps are for our support team and not for use outside of Brave

@RupeshBhandari
Copy link

@tmancey thanks for letting me know.

@GeetaSarvadnya
Copy link

GeetaSarvadnya commented May 26, 2021

Verification passed on


<!--StartFragment-->
Brave | 1.25.68 Chromium: 91.0.4472.77&nbsp;(Official Build)&nbsp;(64-bit)
-- | --
Revision | 1cecd5c8a856bc2a5adda436e7b84d8d21b339b6-refs/branch-heads/4472@{#1246}
OS | Windows&nbsp;10 OS Version 2004 (Build 19041.985)

<!--EndFragment-->

[11860:11176:0526/144636.859:VERBOSE1:ad_rewards.cc(310)] OnGetAdGrants
[11860:11176:0526/144636.860:VERBOSE6:ad_rewards.cc(312)] URL Response:
  URL: https://grant.rewards.brave.com/v1/promotions/ads/grants/summary?paymentId=09398212-13e5-4f4f-9be4-56087ed2fab6
  Response Status Code: 204
  Response:
[11860:11176:0526/144636.872:VERBOSE1:ad_rewards.cc(340)] Successfully reconciled ad rewards

Verified passed with

Brave | 1.25.68 Chromium: 91.0.4472.77&nbsp;(Official Build)&nbsp;(x86_64)
-- | --
Revision | 1cecd5c8a856bc2a5adda436e7b84d8d21b339b6-refs/branch-heads/4472@{#1246}
OS | macOS Version 10.15.7 (Build 19H1030)

Verified STR from description.

[12169:775:0526/100855.389534:VERBOSE1:ad_rewards.cc(296)] GetAdGrants
[12169:775:0526/100855.389630:VERBOSE2:ad_rewards.cc(297)] GET /v1/promotions/ads/grants/summary?paymentId={payment_id}
[12169:775:0526/100855.389686:VERBOSE5:ad_rewards.cc(301)] URL Request:
  URL: https://grant.rewards.brave.com/v1/promotions/ads/grants/summary?paymentId=eb8e4efe-6a16-405c-ad11-26712dee939b
  Method: GET
[12169:775:0526/100855.732338:VERBOSE1:ad_rewards.cc(310)] OnGetAdGrants
[12169:775:0526/100855.732420:VERBOSE6:ad_rewards.cc(312)] URL Response:
  URL: https://grant.rewards.brave.com/v1/promotions/ads/grants/summary?paymentId=eb8e4efe-6a16-405c-ad11-26712dee939b
  Response Status Code: 204
  Response: 
[12169:775:0526/100855.732486:VERBOSE1:ad_rewards.cc(340)] Successfully reconciled ad rewards

Verification passed on

Brave 1.25.68 Chromium: 91.0.4472.77 (Official Build) (64-bit)
Revision 1cecd5c8a856bc2a5adda436e7b84d8d21b339b6-refs/branch-heads/4472@{#1246}
OS Ubuntu 18.04 LTS

Verified STR from description.

[7295:7295:0526/183227.157340:VERBOSE1:ad_rewards.cc(296)] GetAdGrants
[7295:7295:0526/183227.157382:VERBOSE2:ad_rewards.cc(297)] GET /v1/promotions/ads/grants/summary?paymentId={payment_id}
[7295:7295:0526/183227.157432:VERBOSE5:ad_rewards.cc(301)] URL Request:
  URL: https://grant.rewards.brave.com/v1/promotions/ads/grants/summary?paymentId=e1e56560-fbe1-43c5-9082-6b7c8a03e9f8
  Method: GET
[7295:7295:0526/183227.506546:VERBOSE1:ad_rewards.cc(310)] OnGetAdGrants
[7295:7295:0526/183227.506583:VERBOSE6:ad_rewards.cc(312)] URL Response:
  URL: https://grant.rewards.brave.com/v1/promotions/ads/grants/summary?paymentId=e1e56560-fbe1-43c5-9082-6b7c8a03e9f8
  Response Status Code: 204
  Response: 
[7295:7295:0526/183227.506628:VERBOSE1:ad_rewards.cc(340)] Successfully reconciled ad rewards

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