brave / brave-ios

Brave iOS Browser
https://brave.com
Mozilla Public License 2.0
1.7k stars 440 forks source link

Can't create rewards wallet - Rewards grants endpoint is empty/null in `1.33` #4731

Closed kjozwiak closed 2 years ago

kjozwiak commented 2 years ago

Description:

With 1.33, rewards fails to create a wallet every time and receives the following error message:

default 14:48:24.799393-0500    Client  [Error] [BraveCore] [get_available.cc:69] > Unexpected HTTP status: 0

Steps to Reproduce

  1. download/install 1.33 from TF
  2. enable rewards (use Dev so you can see the errors via xCode and the rewards internal settings)

Actual result:

Wallet not created. Outbound calls to https://grant.rewards.brave.com not shown in Charles Proxy image

Expected result:

Wallet should be created. Outbound calls to https://grant.rewards.brave.com should show in Charles Proxy image

Reproduces how often: [Easily reproduced, Intermittent Issue]

Reproducible 100% using the STR/Cases outlined above.

Brave Version:

1.33 (21.12.13.3)

Device details:

Additional Information

Logs here:

default 15:33:15.484173-0500    Client  [Info] [BraveCore] [ads_impl.cc:110] > Initializing ads
default 15:33:15.484679-0500    Client  [Error] [BraveCore] [get_available.cc:69] > Unexpected HTTP status: 0
default 15:33:15.484707-0500    Client  [Info] [BraveCore] [promotion.cc:563] > Failed to refresh promotion, will try again in 18 s
default 15:33:15.485125-0500    Client  [Info] [BraveCore] [database_migration.cc:50] > Migrated database from version 0 to version 17
default 15:33:15.486224-0500    Client  [Info] [BraveCore] [publisher.cc:521] > Publisher list is empty
default 15:33:15.486654-0500    Client  [Info] [BraveCore] [publisher.cc:521] > Publisher list is empty
default 15:33:15.486999-0500    Client  [Info] [BraveCore] [publisher.cc:521] > Publisher list is empty
default 15:33:15.487471-0500    Client  [Info] [BraveCore] [publisher.cc:521] > Publisher list is empty
default 15:33:15.488123-0500    Client  [Debug] [BraveCore] [legacy_conversion_migration.cc:128] > Loading conversion state
default 15:33:15.488506-0500    Client  [Debug] [BraveCore] [legacy_conversion_migration.cc:134] > Successfully migrated conversion state
default 15:33:15.488539-0500    Client  [Debug] [BraveCore] [client.cc:607] > Loading client state
default 15:33:15.488782-0500    Client  [Debug] [BraveCore] [client.cc:616] > Client state does not exist, creating default state
default 15:33:15.489214-0500    Client  [Debug] [BraveCore] [confirmations_state.cc:72] > Loading confirmations state
default 15:33:15.489605-0500    Client  [Debug] [BraveCore] [confirmations_state.cc:77] > Confirmations state does not exist, creating default state
default 15:33:15.489984-0500    Client  [Debug] [BraveCore] [ad_notifications.cc:399] > Loading ad notifications state
default 15:33:15.490309-0500    Client  [Debug] [BraveCore] [ad_notifications.cc:408] > Ad notifications state does not exist, creating default state
default 15:33:15.490786-0500    Client  [Info] [BraveCore] [ads_impl.cc:632] > Successfully initialized ads
default 15:33:15.490931-0500    Client  [Info] [BraveCore] [brave_ads.mm:801] > Registering Brave Ads Resources Installer (en) with id ocilmpijebaopmdifcomolmpigakocmo
default 15:33:15.490968-0500    Client  [Info] [BraveCore] [brave_ads.mm:803] > Notifying ads resource observers
default 15:33:15.491046-0500    Client  [Info] [BraveCore] [brave_ads.mm:937] > Downloading iso_639_1_en ads resource manifest
default 15:33:15.491632-0500    Client  [Info] [BraveCore] [brave_ads.mm:839] > Registering Brave Ads Resources Installer (CA) with id lgejdiamednlaeiknhnnjnkofmapfbbf
default 15:33:15.491723-0500    Client  [Info] [BraveCore] [brave_ads.mm:841] > Notifying ads resource observers
default 15:33:15.491791-0500    Client  [Info] [BraveCore] [brave_ads.mm:937] > Downloading iso_3166_1_ca ads resource manifest
default 15:33:15.495533-0500    Client  [Error] [BraveCore] [ads_impl.cc:742] > Failed to set wallet
default 15:33:15.495724-0500    Client  [Error] [BraveCore] [ad_rewards.cc:67] > Failed to reconcile ad rewards due to invalid wallet
default 15:33:15.497627-0500    Client  [Info] [BraveCore] [confirmations.cc:115] > Retry failed confirmations in 0 hours, 1 minute, 38 seconds at 3:34 PM
default 15:33:15.498004-0500    Client  [Error] [BraveCore] [redeem_unblinded_payment_tokens.cc:55] > Failed to redeem unblinded payment tokens due to invalid wallet
default 15:33:15.498307-0500    Client  [Info] [BraveCore] [account.cc:202] > Failed to redeem unblinded payment tokens
default 15:33:15.498334-0500    Client  [Info] [BraveCore] [subdivision_targeting.cc:79] > Ads subdivision targeting is not supported for en_CA locale
default 15:33:15.498708-0500    Client  [Info] [BraveCore] [ad_server.cc:66] > GetCatalog
default 15:33:15.498791-0500    Client  [Debug] [BraveCore] [ad_server.cc:67] > GET /v8/catalog
bsclifton commented 2 years ago

Re-opening as this will be closed when https://github.com/brave/brave-core/pull/11585 is merged and we do another build

kjozwiak commented 2 years ago

Closing as https://github.com/brave/brave-core/pull/11586 & https://github.com/brave/brave-core/pull/11585 have been merged into 1.34.x & 1.33.x. Once we get a new build via TF, we should be able to run through the above and verify that reward wallets are being created. However, we'll need a new 1.33.x build that includes iOS so it can be used for the new 1.33 TF build.

GeetaSarvadnya commented 2 years ago

Verification PASSED on iPhone 8 version iOS 15.1 running Brave version 1.33 (21.12.14.16)


Verification PASSED on iPad mini with iOS 15 running Brave version 1.33 (21.12.14.16)

Clean Install - Confirmed wallet is getting created ``` [Info] [BraveCore] [ads_impl.cc:728] > Successfully set wallet ``` - Confirmed wallet payment id and seed info is displayed correctly in Dev internal page - Confirmed ads are served and can be viewed - Confirmed rewarded for ad views (via console logs) ``` [Info] [BraveCore] [ad_notification_serving.cc:263] > Serving ad notification: uuid: 15b7b696-484f-40d6-9eaa-b4dcc9acf505 creativeInstanceId: ea6a7172-6f4a-45f6-83df-81672027f8a4 creativeSetId: 36434118-44e6-4054-a52c-8d4f62a650ad campaignId: 617dc580-c577-495a-b3c4-5020f2a06dca advertiserId: 6280a50e-7a5d-45d6-b142-bddc7a8e5e16 segment: untargeted title: Good Crypto body: Best mobile crypto trading terminal targetUrl: https://click.goodcrypto.app/b9EC/c11455ad ``` ``` [Info] [BraveCore] [confirmations.cc:260] > Successfully redeemed unblinded token with confirmation id c3eb3935-e22f-4321-b11a-bf2ec1a0a3ea, creative instance id ea6a7172-6f4a-45f6-83df-81672027f8a4 and view ``` ``` [Info] [BraveCore] [confirmations.cc:283] > Added 1 unblinded payment token with an estimated redemption value of 0.01 BAT, you now have 5 unblinded payment tokens ```
Upgrade - Confirmed wallet is retained on upgrade from 1.32.3 to 1.33 - Confirmed wallet payment id and seed info is displayed in Dev internal page - Confirmed ads are served and can be viewed after upgrade - Confirmed rewarded for ad views (via console logs)

Verification PASSED on iPhone 6+ running iOS 14.6 using 1.33 (21.12.14.16)

Clean Install Cases - Confirmed wallet is getting created - Confirmed wallet payment id and seed info is displayed correctly in Dev internal page - Confirmed ads are served and can be viewed - Confirmed rewarded for viewing NTP SI (via console logs) - Confirmed rewarded for ad views (via console logs) **`Successfully creating rewards wallet`** ``` default 19:58:35.396188-0500 Client [Info] [BraveCore] [ads_impl.cc:728] > Successfully set wallet default 19:58:36.491575-0500 Client [Info] [BraveCore] [refill_unblinded_tokens.cc:219] > OnGetSignedTokens default 19:58:36.491750-0500 Client [Info] [BraveCore] [refill_unblinded_tokens.cc:337] > Added 50 unblinded tokens, you now have 50 unblinded tokens ``` **`Viewing/Rewarded for Ad notification`** ``` default 20:30:06.838227-0500 Client [Info] [BraveCore] [eligible_ad_notifications_v1.cc:39] > Get eligible ad notifications: default 20:30:06.844510-0500 Client [Info] [BraveCore] [eligible_ad_notifications_v1.cc:140] > Get eligible ads for untargeted segment default 20:30:06.850750-0500 Client [Debug] [BraveCore] [ad_priority.h:32] > 15 ads with a priority of 1 in bucket 1 default 20:30:06.850888-0500 Client [Debug] [BraveCore] [ad_priority.h:41] > 17 ads with a priority of 5 in bucket 2 default 20:30:06.850966-0500 Client [Debug] [BraveCore] [ad_priority.h:41] > 3 ads with a priority of 6 in bucket 3 default 20:30:06.852042-0500 Client [Info] [BraveCore] [ad_notification_serving.cc:144] > Found 15 eligible ads default 20:30:06.852879-0500 Client [Info] [BraveCore] [ad_notification_serving.cc:263] > Serving ad notification: uuid: 01bbf59e-bf80-4611-9643-1e00c47ba079 creativeInstanceId: dc04ab64-fed7-4cd2-9656-b1c645bc53b8 creativeSetId: 5ec64b7f-c194-4fcf-a171-56bd3259f1fb campaignId: bb04458d-9b48-4e3d-b32c-1b6ea9b7434c advertiserId: bfa711e7-f5e0-4f39-8984-3be7974b6449 segment: untargeted title: Stoic AI body: Simple automated crypto trading app with AI. Fee: 5% min $50 targetUrl: https://cryptostoic.com/brave?utm_soure=brave&utm_medium=push&utm_campaign=september-ios default 20:30:06.866439-0500 Client [Debug] [BraveCore] [ad_notification_event_viewed.cc:24] > Viewed ad notification with uuid 01bbf59e-bf80-4611-9643-1e00c47ba079 and creative instance id dc04ab64-fed7-4cd2-9656-b1c645bc53b8 default 20:30:06.873220-0500 Client [Info] [BraveCore] [confirmations.cc:93] > Confirming view for creative instance id dc04ab64-fed7-4cd2-9656-b1c645bc53b8 default 20:30:06.880584-0500 Client [Info] [BraveCore] [redeem_unblinded_token.cc:53] > Redeem unblinded token default 20:30:06.880738-0500 Client [Info] [BraveCore] [redeem_unblinded_token.cc:67] > CreateConfirmation default 20:30:06.880779-0500 Client [Debug] [BraveCore] [redeem_unblinded_token.cc:68] > POST /v1/confirmation/{confirmation_id}/{credential} default 20:30:06.905322-0500 Client [Debug] [BraveCore] [ad_notification_event_served.cc:24] > Served ad notification with uuid 01bbf59e-bf80-4611-9643-1e00c47ba079 and creative instance id dc04ab64-fed7-4cd2-9656-b1c645bc53b8 default 20:30:06.910703-0500 Client [Info] [BraveCore] [ad_notification_serving.cc:156] > Served ad notification default 20:30:06.922483-0500 Client [Info] [BraveCore] [ad_notification_serving.cc:231] > Maybe serve ad notification in 0 hours, 30 minutes, 0 seconds at 9:00 PM default 20:30:06.924434-0500 Client [Info] [BraveCore] [ad_notification_event_served.cc:32] > Successfully logged ad notification served event default 20:30:07.129074-0500 Client [Info] [BraveCore] [redeem_unblinded_token.cc:83] > OnCreateConfirmation default 20:30:07.129136-0500 Client [Info] [BraveCore] [redeem_unblinded_token.cc:111] > FetchPaymentToken default 20:30:07.129205-0500 Client [Debug] [BraveCore] [redeem_unblinded_token.cc:112] > GET /v1/confirmation/{confirmation_id}/paymentToken default 20:30:07.261166-0500 Client [Info] [BraveCore] [redeem_unblinded_token.cc:127] > OnFetchPaymentToken default 20:30:07.261240-0500 Client [Info] [BraveCore] [confirmations.cc:260] > Successfully redeemed unblinded token with confirmation id bb7d4cd7-b61a-4944-b66e-0adbe9145838, creative instance id dc04ab64-fed7-4cd2-9656-b1c645bc53b8 and view default 20:30:07.274739-0500 Client [Info] [BraveCore] [confirmations.cc:283] > Added 1 unblinded payment token with an estimated redemption value of 0.01 BAT, you now have 1 unblinded payment tokens default 20:30:07.293186-0500 Client [Info] [BraveCore] [refill_unblinded_tokens.cc:71] > No need to refill unblinded tokens as we already have 49 unblinded tokens which is above the minimum threshold of 20 ``` **`Viewing/Rewarded for NTP SI`** ``` default 20:32:53.283612-0500 Client [Debug] [BraveCore] [new_tab_page_ad_event_viewed.cc:23] > Viewed new tab page ad with uuid 05B456D3-7270-4378-B2E9-BED4A761A96F and creative instance id de3d81c4-53dc-4bcf-a6e3-236e42384907 default 20:32:53.283814-0500 Client [Info] [BraveCore] [confirmations.cc:93] > Confirming view for creative instance id de3d81c4-53dc-4bcf-a6e3-236e42384907 default 20:32:53.284272-0500 Client [Info] [BraveCore] [redeem_unblinded_token.cc:53] > Redeem unblinded token default 20:32:53.284311-0500 Client [Info] [BraveCore] [redeem_unblinded_token.cc:67] > CreateConfirmation default 20:32:53.284337-0500 Client [Debug] [BraveCore] [redeem_unblinded_token.cc:68] > POST /v1/confirmation/{confirmation_id}/{credential} default 20:32:53.288423-0500 Client [Debug] [BraveCore] [new_tab_page_ad_event_served.cc:23] > Served new tab page ad with uuid 05B456D3-7270-4378-B2E9-BED4A761A96F and creative instance id de3d81c4-53dc-4bcf-a6e3-236e42384907 default 20:32:53.302004-0500 Client [Warning] [BraveCore] [BVC+Rewards.swift:316] > No favicon found in to report to rewards panel default 20:32:53.302027-0500 Client [Info] [BraveCore] [ads_impl.cc:183] > Visited URL is not supported default 20:32:53.302052-0500 Client [Info] [BraveCore] [conversions.cc:199] > URL is not supported for conversions default 20:32:53.349759-0500 Client [Info] [BraveCore] [redeem_unblinded_token.cc:83] > OnCreateConfirmation default 20:32:53.349867-0500 Client [Info] [BraveCore] [redeem_unblinded_token.cc:111] > FetchPaymentToken default 20:32:53.349946-0500 Client [Debug] [BraveCore] [redeem_unblinded_token.cc:112] > GET /v1/confirmation/{confirmation_id}/paymentToken default 20:32:53.452426-0500 Client [Info] [BraveCore] [redeem_unblinded_token.cc:127] > OnFetchPaymentToken default 20:32:53.453233-0500 Client [Info] [BraveCore] [confirmations.cc:260] > Successfully redeemed unblinded token with confirmation id 2ee926fc-b7c5-4994-9499-777d6497bfb4, creative instance id de3d81c4-53dc-4bcf-a6e3-236e42384907 and view default 20:32:53.464349-0500 Client [Info] [BraveCore] [confirmations.cc:283] > Added 1 unblinded payment token with an estimated redemption value of 0.005 BAT, you now have 5 unblinded payment tokens default 20:32:53.470940-0500 Client [Info] [BraveCore] [refill_unblinded_tokens.cc:71] > No need to refill unblinded tokens as we already have 45 unblinded tokens which is above the minimum threshold of 20 ``` **`Example`** | **`Example`** ---------------|--------------- ![IMG_0247](https://user-images.githubusercontent.com/2602313/146104704-8d718880-5b1b-4a43-b329-732f9cb56965.png) | ![IMG_0248](https://user-images.githubusercontent.com/2602313/146104718-d51010d3-a0c6-409a-be60-7526f5c5c9cf.png)
Upgrade Cases - Confirmed wallet is retained on upgrade from `1.32.3 (21.11.17.15)` -> `1.33 (21.12.14.16)` - Confirmed wallet payment id and seed info is displayed in Dev internal page - Confirmed ads are served and can be viewed after upgrade - Confirmed rewarded for ad views (via console logs) - Confirmed rewarded for ad views (via console logs) **`Viewing/Rewarded for Ad notification`** ``` default 23:46:07.349797-0500 Client [Info] [BraveCore] [eligible_ad_notifications_v1.cc:39] > Get eligible ad notifications: default 23:46:07.355554-0500 Client [Info] [BraveCore] [eligible_ad_notifications_v1.cc:140] > Get eligible ads for untargeted segment default 23:46:07.357539-0500 Client [Debug] [BraveCore] [ad_priority.h:32] > 15 ads with a priority of 1 in bucket 1 default 23:46:07.357635-0500 Client [Debug] [BraveCore] [ad_priority.h:41] > 17 ads with a priority of 5 in bucket 2 default 23:46:07.357824-0500 Client [Debug] [BraveCore] [ad_priority.h:41] > 3 ads with a priority of 6 in bucket 3 default 23:46:07.358048-0500 Client [Info] [BraveCore] [ad_notification_serving.cc:144] > Found 15 eligible ads default 23:46:07.359744-0500 Client [Info] [BraveCore] [ad_notification_serving.cc:263] > Serving ad notification: uuid: f7ac1bae-801a-400f-899a-6a7e68fe8625 creativeInstanceId: ea6a7172-6f4a-45f6-83df-81672027f8a4 creativeSetId: 36434118-44e6-4054-a52c-8d4f62a650ad campaignId: 617dc580-c577-495a-b3c4-5020f2a06dca advertiserId: 6280a50e-7a5d-45d6-b142-bddc7a8e5e16 segment: untargeted title: Good Crypto body: Best mobile crypto trading terminal targetUrl: https://click.goodcrypto.app/b9EC/c11455ad default 23:46:07.375616-0500 Client [Debug] [BraveCore] [ad_notification_event_viewed.cc:24] > Viewed ad notification with uuid f7ac1bae-801a-400f-899a-6a7e68fe8625 and creative instance id ea6a7172-6f4a-45f6-83df-81672027f8a4 default 23:46:07.392889-0500 Client [Info] [BraveCore] [confirmations.cc:93] > Confirming view for creative instance id ea6a7172-6f4a-45f6-83df-81672027f8a4 default 23:46:07.393964-0500 Client [Info] [BraveCore] [redeem_unblinded_token.cc:53] > Redeem unblinded token default 23:46:07.394012-0500 Client [Info] [BraveCore] [redeem_unblinded_token.cc:67] > CreateConfirmation default 23:46:07.394059-0500 Client [Debug] [BraveCore] [redeem_unblinded_token.cc:68] > POST /v1/confirmation/{confirmation_id}/{credential} default 23:46:07.439423-0500 Client [Debug] [BraveCore] [ad_notification_event_served.cc:24] > Served ad notification with uuid f7ac1bae-801a-400f-899a-6a7e68fe8625 and creative instance id ea6a7172-6f4a-45f6-83df-81672027f8a4 default 23:46:07.449810-0500 Client [Info] [BraveCore] [ad_notification_serving.cc:156] > Served ad notification default 23:46:07.459423-0500 Client [Info] [BraveCore] [ad_notification_serving.cc:231] > Maybe serve ad notification in 0 hours, 30 minutes, 0 seconds at 12:16 AM default 23:46:07.459530-0500 Client [Info] [BraveCore] [ad_notification_event_served.cc:32] > Successfully logged ad notification served event default 23:46:07.755099-0500 Client [Info] [BraveCore] [redeem_unblinded_token.cc:83] > OnCreateConfirmation default 23:46:07.755153-0500 Client [Info] [BraveCore] [redeem_unblinded_token.cc:111] > FetchPaymentToken default 23:46:07.755204-0500 Client [Debug] [BraveCore] [redeem_unblinded_token.cc:112] > GET /v1/confirmation/{confirmation_id}/paymentToken default 23:46:08.310729-0500 Client [Info] [BraveCore] [redeem_unblinded_token.cc:127] > OnFetchPaymentToken default 23:46:08.312052-0500 Client [Info] [BraveCore] [confirmations.cc:260] > Successfully redeemed unblinded token with confirmation id 27c78413-a32f-4715-a1a1-f4ab1332bba0, creative instance id ea6a7172-6f4a-45f6-83df-81672027f8a4 and view default 23:46:08.321027-0500 Client [Info] [BraveCore] [confirmations.cc:283] > Added 1 unblinded payment token with an estimated redemption value of 0.01 BAT, you now have 2 unblinded payment tokens ``` **`Viewing/Rewarded for NTP SI`** ``` default 20:17:04.598193-0500 Client [Debug] [BraveCore] [new_tab_page_ad_event_viewed.cc:23] > Viewed new tab page ad with uuid AE7353BD-6795-47C2-92CA-DF4F13079794 and creative instance id e5ce887e-9bdd-4fa2-8f33-05b338fd06db default 20:17:04.598447-0500 Client [Info] [BraveCore] [confirmations.cc:93] > Confirming view for creative instance id e5ce887e-9bdd-4fa2-8f33-05b338fd06db default 20:17:04.599509-0500 Client [Info] [BraveCore] [redeem_unblinded_token.cc:53] > Redeem unblinded token default 20:17:04.599574-0500 Client [Info] [BraveCore] [redeem_unblinded_token.cc:67] > CreateConfirmation default 20:17:04.599622-0500 Client [Debug] [BraveCore] [redeem_unblinded_token.cc:68] > POST /v1/confirmation/{confirmation_id}/{credential} default 20:17:04.693136-0500 Client [Debug] [BraveCore] [new_tab_page_ad_event_served.cc:23] > Served new tab page ad with uuid AE7353BD-6795-47C2-92CA-DF4F13079794 and creative instance id e5ce887e-9bdd-4fa2-8f33-05b338fd06db default 20:17:04.825608-0500 Client [Info] [BraveCore] [redeem_unblinded_token.cc:83] > OnCreateConfirmation default 20:17:04.825932-0500 Client [Info] [BraveCore] [redeem_unblinded_token.cc:111] > FetchPaymentToken default 20:17:04.825988-0500 Client [Debug] [BraveCore] [redeem_unblinded_token.cc:112] > GET /v1/confirmation/{confirmation_id}/paymentToken default 20:17:04.831042-0500 Client [Warning] [BraveCore] [BVC+Rewards.swift:316] > No favicon found in to report to rewards panel default 20:17:04.831126-0500 Client [Info] [BraveCore] [ads_impl.cc:183] > Visited URL is not supported default 20:17:04.831192-0500 Client [Info] [BraveCore] [conversions.cc:199] > URL is not supported for conversions default 20:17:04.846586-0500 Client [Info] [BraveCore] [redeem_unblinded_token.cc:127] > OnFetchPaymentToken default 20:17:04.846741-0500 Client [Info] [BraveCore] [confirmations.cc:260] > Successfully redeemed unblinded token with confirmation id 951f5d43-4009-4359-b46f-1cf7f20d528d, creative instance id e5ce887e-9bdd-4fa2-8f33-05b338fd06db and view default 20:17:04.849678-0500 Client [Info] [BraveCore] [confirmations.cc:283] > Added 1 unblinded payment token with an estimated redemption value of 0.005 BAT, you now have 1 unblinded payment tokens default 20:17:04.849783-0500 Client [Info] [BraveCore] [refill_unblinded_tokens.cc:71] > No need to refill unblinded tokens as we already have 49 unblinded tokens which is above the minimum threshold of 20 ``` **`Example`** | **`Example`** ---------------|--------------- ![IMG_0247](https://user-images.githubusercontent.com/2602313/146105496-453ae588-af3d-4bfd-a550-9efbc5e0e40d.png) | ![IMG_0248](https://user-images.githubusercontent.com/2602313/146105511-9c0b60f1-d6a2-49e4-b993-ac83a8a675ad.png)