Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

May ads payout recovery #2536

Closed
kylehickinson opened this issue May 11, 2020 · 5 comments · Fixed by #2542
Closed

May ads payout recovery #2536

kylehickinson opened this issue May 11, 2020 · 5 comments · Fixed by #2542

Comments

@kylehickinson
Copy link
Collaborator

Duplicate of brave/brave-browser#9684

Requires brave-core pull

@kjozwiak
Copy link
Member

@NejcZdovc any idea how we can QA this on iOS? We have the ability to Share/Export the rewards database on the dev builds but there's no way to import that back into the profile. @kylehickinson please correct me if that's incorrect.

QA won't be able to run through the cases outlined via brave/brave-core#5495 (comment) so we'll need to check with someone who's in this case and verify it works (probably difficult unless we get IPA's) or we QA/No if there's no alternative way of checking this.

@kylehickinson
Copy link
Collaborator Author

Theoretically the code you're testing should be the exact same, but now that the database is actually the same, building out some sort of import DB functionality actually might not be difficult to do.

May give it a go and see if I can add an import feature to debug menu if it's simple and can be done quickly.

If not then this will not be testable on iOS

@kjozwiak
Copy link
Member

kjozwiak commented May 13, 2020

Verification PASSED on iPhone 6s+ iOS 12.4.1 using the following build:

1.16.1 (20.5.12.20)

Case #1 (x2)

  • install 1.16 (20.5.13.1) which includes the export/import DB feature
  • skip onboarding and switch over to the staging server
  • once you've restarted, enable rewards and clam the UGP promotion
  • export the DB via Settings --> View Rewards Debug Menu --> Export Rewards Database
  • open rewards.db using DB Browser for SQLite
  • remove all the entries under the unblinded_tokens table
  • change public_keys to [] under the promotion table
  • change status to 1 under the promotion table
  • change status to 3 under the creds_batch table
  • save rewards.db (write changes) and exit DB Browser for SQLite
  • move rewards.db back on the device (use AirDrop to make it easier)
  • import the DB via Settings --> View Rewards Debug Menu --> Import Rewards Database
  • you'll notice that the balance appears as 0.00 rather than 20.00
  • update and open 1.16.1 (20.5.12.20) (using TF)
  • you'll notice that the balance appears as 20.00
  • tip https://laurenwags.github.io & https://duckduckgo.com
Corrupted DB After Upgrading (Fixed DB)
IMG_0028 IMG_0029

Case #2 (x2)

  • install 1.16 (20.5.13.1) which includes the export/import DB feature
  • skip onboarding and switch over to the staging server
  • once you've restarted, enable rewards and clam the UGP promotion
  • export the DB via Settings --> View Rewards Debug Menu --> Export Rewards Database
  • open rewards.db using DB Browser for SQLite
  • change status to 1 under the promotion table
  • change status to 3 under the creds_batch table
  • replace signed_creds with blinded_creds in the creds_batch table
  • save rewards.db (write changes) and exit DB Browser for SQLite
  • move rewards.db back on the device (use AirDrop to make it easier)
  • import the DB via Settings --> View Rewards Debug Menu --> Import Rewards Database and close 1.16 (20.5.13.1)
  • update and open 1.16.1 (20.5.12.20) (using TF)
23:05:22.996818-0400 Client	[Debug] [BraveRewards] > [ledger_impl.cc.538] [ REQUEST ]
23:05:22.997277-0400 Client	[Debug] [BraveRewards] > [ledger_impl.cc.538] > url: https://grant.rewards.bravesoftware.com/v2/promotions/reportclobberedclaims
23:05:22.997366-0400 Client	[Debug] [BraveRewards] > [ledger_impl.cc.538] > method: UrlMethod::POST
23:05:22.997467-0400 Client	[Debug] [BraveRewards] > [ledger_impl.cc.538] > content: {"claimIds":["a6504943-0dcd-44a4-b9ec-dc7b02441cc0"]}
23:05:22.997592-0400 Client	[Debug] [BraveRewards] > [ledger_impl.cc.538] > contentType: application/json; charset=utf-8
23:05:22.997752-0400 Client	[Debug] [BraveRewards] > [ledger_impl.cc.538] [ END REQUEST ]
  • export the DB via Settings --> View Rewards Debug Menu --> Export Rewards Database
  • open rewards.db using DB Browser for SQLite
  • ensure that the status under promotion is 6
  • ensure that the status under creds_batch is 5

@kjozwiak
Copy link
Member

@srirambv mind running through the above on your iPhone that has 1GB of RAM to make sure the above process doesn't cause any crashes/issues? Unfortunately my iPhone 6s+ has 2GB RAM but is working 👍

@srirambv
Copy link
Contributor

srirambv commented May 13, 2020

Verification passed on iPhone XR with iOS 13.5 running 1.16.1 (20.5.12.20)

Scenario 1

  • Installed 1.16(20.5.13.1)
  • Switch to staging and claim grant
  • Export DB file
  • Set status to 1 under the promotion table
  • Set status to 3 under the creds_batch table
  • Set public_keys to [] under the promotion table
  • Delete all the entries under the unblinded_tokens table
  • Write changes to db file and airdrop the file to device
  • Import DB file on 1.16(20.5.13.1)
  • BR panel shows broken state
    image
  • Upgrade to 1.16.1(20.5.12.20)
  • BR panel shows proper wallet balance
    image
  • Able to tip verified pubs and wallet balance updates accordingly
    image

Scenario 2

  • Installed 1.16(20.5.13.1)
  • Set env to staging and claim grant
  • Export DB file
  • Set status to 1 under the promotion table
  • Set status to 3 under the creds_batch table
  • Replace signed_creds with blinded_creds in the creds_batch table
  • Write changes to db file and airdrop the file to device
  • Import DB file on 1.16(20.5.13.1)
  • Upgrade to 1.16.1(20.5.12.20)
10:46:47.436579+0530	libswiftFoundation.dylib	Client	[Debug] [BraveRewards] > [ledger_impl.cc.538] [ REQUEST ]
10:46:47.436638+0530	libswiftFoundation.dylib	Client	[Debug] [BraveRewards] > [ledger_impl.cc.538] > url: https://grant.rewards.bravesoftware.com/v2/promotions/reportclobberedclaims
10:46:47.436695+0530	libswiftFoundation.dylib	Client	[Debug] [BraveRewards] > [ledger_impl.cc.538] > method: UrlMethod::POST
10:46:47.436750+0530	libswiftFoundation.dylib	Client	[Debug] [BraveRewards] > [ledger_impl.cc.538] > content: {"claimIds":["a648825a-df10-4cf4-8228-518f0b54f6b3"]}
10:46:47.436805+0530	libswiftFoundation.dylib	Client	[Debug] [BraveRewards] > [ledger_impl.cc.538] > contentType: application/json; charset=utf-8
10:46:47.436861+0530	libswiftFoundation.dylib	Client	[Debug] [BraveRewards] > [ledger_impl.cc.538] [ END REQUEST ]
  • Export the DB on 1.16.1 and open
  • Verified status under promotion is set to 6
  • Verified status under cred_batch is set to 5

Verification passed on iPad Pro with iOS 13.4.5 running 1.16.1 (20.5.12.20)

Scenario 1

  • Installed 1.16(20.5.13.20)

  • Switch to staging and claim grant

  • Export DB file

  • Set status to 1 under the promotion table

  • Set status to 3 under the creds_batch table

  • Set public_keys to [] under the promotio table

  • Delete all the entries under the unblinded_tokens table

  • Write changes to db file and airdrop the file to device

  • Import DB file on 1.16(20.5.13.1)

  • BR panel shows broken state

    image

  • Upgrade to 1.16.1(20.5.12.20)

  • BR panel shows proper wallet balance

    image

  • Able to tip verified pubs and wallet balance updates accordingly

    image

Scenario 2

  • Installed 1.16(20.5.13.20)
  • Set env to staging and claim grant
  • Export DB file
  • Set status to 1 under the promotion table
  • Set status to 3 under the creds_batch table
  • Replace signed_creds with blinded_creds in the creds_batch table
  • Write changes to db file and airdrop the file to device
  • Import DB file on 1.16(20.5.13.1)
  • Upgrade to 1.16.1(20.5.12.20)
10:22:47.933670+0530	Client	[Debug] [BraveRewards] > [ledger_impl.cc.538] [ REQUEST ]
10:22:47.933727+0530	Client	[Debug] [BraveRewards] > [ledger_impl.cc.538] > url: https://grant.rewards.bravesoftware.com/v2/promotions/reportclobberedclaims
10:22:47.933779+0530	Client	[Debug] [BraveRewards] > [ledger_impl.cc.538] > method: UrlMethod::POST
10:22:47.933815+0530	Client	[Debug] [BraveRewards] > [ledger_impl.cc.538] > content: {"claimIds":["ccbcc16a-672d-49e6-9c43-b7317a0744b1"]}
10:22:47.933866+0530	Client	[Debug] [BraveRewards] > [ledger_impl.cc.538] > contentType: application/json; charset=utf-8
10:22:47.933901+0530	Client	[Debug] [BraveRewards] > [ledger_impl.cc.538] [ END REQUEST ]
  • Export the DB on 1.16.1 and open
  • Verified status under promotion is set to 6
  • Verified status under cred_batch is set to 5

Verification passed on iPad Pro with iOS 12.4.5 running 1.16.1(20.05.12.20)

  • Verified both scenarios and work as expected

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