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

Add migration flow for old grants to new promotions #6937

Closed
NejcZdovc opened this issue Nov 15, 2019 · 2 comments · Fixed by brave/brave-core#4101
Closed

Add migration flow for old grants to new promotions #6937

NejcZdovc opened this issue Nov 15, 2019 · 2 comments · Fixed by brave/brave-core#4101

Comments

@NejcZdovc
Copy link
Contributor

NejcZdovc commented Nov 15, 2019

Now that we switched to new promotions we need to migrate old promotions.

What needs to happen is when in native lib we fetch promotions we need to add additional parameter to the fetch url migrate=true. This will fetch old promotions as well. After that we need to check parameter legacyClaimed and if it's true we skip attestation flow and just trigger claim process. Promotion should be automatically claimed.

@NejcZdovc NejcZdovc added feature/rewards priority/P2 A bad problem. We might uplift this to the next planned release. labels Nov 15, 2019
@NejcZdovc NejcZdovc added this to the 1.3.x - Nightly milestone Dec 3, 2019
masparrow added a commit to brave/brave-core that referenced this issue Dec 3, 2019
@btlechowski
Copy link

Added QA/Yes as it contains test plan in brave/brave-core#4101

@LaurenWags
Copy link
Member

LaurenWags commented Jan 15, 2020

Verified passed with

Brave 1.3.92 Chromium: 79.0.3945.117 (Official Build) beta (64-bit)
Revision 04f0a055010adab4484f7497fbfdbf312c307f1d-refs/branch-heads/3945@{#1019}
OS macOS Version 10.14.6 (Build 18G103)

Scenario 1:

1 0 0-Claim UGP Grant only

  • Confirmed on upgrade to 1.3.x that BAT value remains the same:

1 0 0 ugp claim upgrade to 1 3 x

  • Also confirmed the parameters from the description showed in terminal:
    migrate=true parameter:
[ REQUEST ]
> url: https://grant.rewards.bravesoftware.com/v1/promotions?migrate=true&paymentId=359a11cc-b2b6-4d76-9d5c-4845b9335275&platform=osx
> method: UrlMethod::GET
> content: 
> contentType: 
[ END REQUEST ]

legacyClaimed parameter:

[ RESPONSE - OnFetch ]
> time: 1579110026
> result: Success
> http code: 200
> response: {"promotions":[{"id":"36baa4c3-f92d-4121-b6d9-db44cb273a02","createdAt":"2019-10-30T23:17:15.681226Z","expiresAt":"2020-02-29T23:17:15.681226Z","version":5,"suggestionsPerGrant":70,"approximateValue":"17.5","type":"ugp","available":true,"platform":"desktop","publicKeys":["vNnt88kCh650dFFHt+48SS4d4skQ2FYSxmmlzmKDgkE="],"legacyClaimed":true}]}

> headers accept-ranges: bytes
> headers content-length: 344
> headers content-type: application/json
> headers date: Wed, 15 Jan 2020 17:40:26 GMT
> headers request-id: bofkt2ni3l06m1b56c60
> headers status: 200
> headers via: 1.1 varnish
> headers x-cache: MISS
> headers x-cache-hits: 0
> headers x-ratelimit-limit: 1
> headers x-ratelimit-remaining: 0
> headers x-ratelimit-reset: 1
> headers x-served-by: cache-lga21941-LGA
[ END RESPONSE ]
  • Also confirmed that once the grant is virtualized, restoring the wallet on a new profile, 0 BAT is restored (confirming 1 way conversion).

Scenario 2:

1 0 0-Claim ad grant only

  • Confirmed on upgrade to 1.3.x that BAT value remains the same (note, discussed discrepancy with @NejcZdovc - confirmed this looks like a rounding discrepancy):

1 0 0 ad claim upgrade to 1 3 x

  • Also confirmed the parameters from the description showed in terminal:
    migrate=true parameter:
[ REQUEST ]
> url: https://grant.rewards.bravesoftware.com/v1/promotions?migrate=true&paymentId=1aea8f10-406e-4e53-98f8-7b2fd92a0083&platform=osx
> method: UrlMethod::GET
> content: 
> contentType: 
[ END REQUEST ]

legacyClaimed parameter:

[ RESPONSE - OnFetch ]
> time: 1579113472
> result: Success
> http code: 200
> response: {"promotions":[{"id":"1502b3cd-d1a7-45db-8380-f405f2fc787d","createdAt":"2019-04-19T03:25:29Z","expiresAt":"2020-04-17T03:25:29Z","version":5,"suggestionsPerGrant":11,"approximateValue":"2.75","type":"ads","available":true,"platform":"","publicKeys":["gG28CWWzZG2F/390LA0jxhO67TVV4y1v5uE1evyz/3Y="],"legacyClaimed":true},{"id":"36baa4c3-f92d-4121-b6d9-db44cb273a02","createdAt":"2019-10-30T23:17:15.681226Z","expiresAt":"2020-02-29T23:17:15.681226Z","version":5,"suggestionsPerGrant":70,"approximateValue":"17.5","type":"ugp","available":true,"platform":"desktop","publicKeys":["vNnt88kCh650dFFHt+48SS4d4skQ2FYSxmmlzmKDgkE="],"legacyClaimed":false}]}

> headers accept-ranges: bytes
> headers content-length: 651
> headers content-type: application/json
> headers date: Wed, 15 Jan 2020 18:37:52 GMT
> headers request-id: boflo07i3l06m1b56e70
> headers status: 200
> headers via: 1.1 varnish
> headers x-cache: MISS
> headers x-cache-hits: 0
> headers x-ratelimit-limit: 1
> headers x-ratelimit-remaining: 0
> headers x-ratelimit-reset: 1
> headers x-served-by: cache-ewr18134-EWR
[ END RESPONSE ]
  • Also confirmed that once the grant is virtualized, restoring the wallet on a new profile, 0 BAT is restored (confirming 1 way conversion).

Scenario 3:

1 0 0-Claim UGP and Ad Grant

  • Confirmed on upgrade to 1.3.x that BAT value remains the same (note, discussed discrepancy with @NejcZdovc - confirmed this looks like a rounding discrepancy):

1 0 0 ugp and ad claim upgrade to 1 3 x

  • Also confirmed the parameters from the description showed in terminal:
    migrate=true parameter:
[ REQUEST ]
> url: https://grant.rewards.bravesoftware.com/v1/promotions?migrate=true&paymentId=d6812b86-1f88-48e6-a0e1-f4f94c396159&platform=osx
> method: UrlMethod::GET
> content: 
> contentType: 
[ END REQUEST ]

legacyClaimed parameter:

[ RESPONSE - OnFetch ]
> time: 1579114077
> result: Success
> http code: 200
> response: {"promotions":[{"id":"1502b3cd-d1a7-45db-8380-f405f2fc787d","createdAt":"2019-04-19T03:25:29Z","expiresAt":"2020-04-17T03:25:29Z","version":5,"suggestionsPerGrant":14,"approximateValue":"3.5","type":"ads","available":true,"platform":"","publicKeys":["gG28CWWzZG2F/390LA0jxhO67TVV4y1v5uE1evyz/3Y="],"legacyClaimed":true},{"id":"36baa4c3-f92d-4121-b6d9-db44cb273a02","createdAt":"2019-10-30T23:17:15.681226Z","expiresAt":"2020-02-29T23:17:15.681226Z","version":5,"suggestionsPerGrant":70,"approximateValue":"17.5","type":"ugp","available":true,"platform":"desktop","publicKeys":["vNnt88kCh650dFFHt+48SS4d4skQ2FYSxmmlzmKDgkE="],"legacyClaimed":true}]}

> headers accept-ranges: bytes
> headers content-length: 649
> headers content-type: application/json
> headers date: Wed, 15 Jan 2020 18:47:57 GMT
> headers request-id: boflsndna6ah13u8thj0
> headers status: 200
> headers via: 1.1 varnish
> headers x-cache: MISS
> headers x-cache-hits: 0
> headers x-ratelimit-limit: 1
> headers x-ratelimit-remaining: 0
> headers x-ratelimit-reset: 1
> headers x-served-by: cache-ewr18121-EWR
[ END RESPONSE ]
  • Also confirmed that once the grant is virtualized, restoring the wallet on a new profile, 0 BAT is restored (confirming 1 way conversion).

Verification passed on

Brave 1.3.68 Chromium: 79.0.3945.79 (Official Build) dev (64-bit)
Revision 29f75ce3f42b007bd80361b0dfcfee3a13ff90b8-refs/branch-heads/3945@{#916}
OS Ubuntu 18.04 LTS

Test Case 1 - UGP grant

Verified test plan from brave/brave-core#4101 when claiming only a UGP grant on 1.0.1:

image

Confirmed on upgrade to 1.3.x that BAT value remains the same:

image

Also confirmed the parameters from the description showed in terminal:
migrate=true parameter:

image

legacyClaimed parameter

image

Test Case 2 - Ads grant

legacyClaimed parameter:
image

  • Also confirmed that once the grant is virtualized, restoring the wallet on a new profile, 0 BAT is restored (confirming 1 way conversion).

Test Case 3 - UGP grant & ads grant

legacyClaimed parameter:
image

  • Also confirmed that once the grant is virtualized, restoring the wallet on a new profile, 0 BAT is restored (confirming 1 way conversion).

Verification is passed on

Brave 1.3.97 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)

Scenario 1:

  • Confirmed on upgrade to 1.3.x that BAT value remains the same:
    image
  • Also confirmed the parameters from the description showed in terminal:
    migrate=true parameter:
[ REQUEST ]
> url: https://grant.rewards.bravesoftware.com/v1/promotions?migrate=true&paymentId=059490f1-03d0-42c2-b2b6-286095e0118a&platform=windows
> method: UrlMethod::GET
> content: 
> contentType: 
[ END REQUEST ]

legacyClaimed parameter:

[ RESPONSE - OnFetch ]
> time: 1579712974
> result: Success
> http code: 200
> response: {"promotions":[{"id":"36baa4c3-f92d-4121-b6d9-db44cb273a02","createdAt":"2019-10-30T23:17:15.681226Z","expiresAt":"2020-02-29T23:17:15.681226Z","version":5,"suggestionsPerGrant":70,"approximateValue":"17.5","type":"ugp","available":true,"platform":"desktop","publicKeys":["vNnt88kCh650dFFHt+48SS4d4skQ2FYSxmmlzmKDgkE="],"legacyClaimed":true}]}

> headers accept-ranges: bytes
> headers age: 298
> headers content-length: 344
> headers content-type: application/json
> headers date: Wed, 22 Jan 2020 17:09:45 GMT
> headers request-id: bok81buktoe14ei7g750
> headers status: 200
> headers via: 1.1 varnish
> headers x-cache: HIT
> headers x-cache-hits: 2
> headers x-ratelimit-limit: 1
> headers x-ratelimit-remaining: 0
> headers x-ratelimit-reset: 1
> headers x-served-by: cache-sea4455-SEA
[ END RESPONSE ]
  • Also confirmed that once the grant is virtualized, restoring the wallet on a new profile, 0 BAT is restored (confirming 1 way conversion).

Scenario 2:

image
Also confirmed the parameters from the description showed in terminal:
migrate=true parameter:

[ REQUEST ]
> url: https://grant.rewards.bravesoftware.com/v1/promotions?migrate=true&paymentId=936bf562-2010-4014-a682-a86c8cc1bb26&platform=windows
> method: UrlMethod::GET
> content: 
> contentType: 
[ END REQUEST ]

legacyClaimed parameter:

[ RESPONSE - OnFetch ]
> time: 1579718640
> result: Success
> http code: 200
> response: {"promotions":[{"id":"1502b3cd-d1a7-45db-8380-f405f2fc787d","createdAt":"2019-04-19T03:25:29Z","expiresAt":"2020-04-17T03:25:29Z","version":5,"suggestionsPerGrant":9,"approximateValue":"2.25","type":"ads","available":true,"platform":"","publicKeys":["gG28CWWzZG2F/390LA0jxhO67TVV4y1v5uE1evyz/3Y="],"legacyClaimed":true},{"id":"36baa4c3-f92d-4121-b6d9-db44cb273a02","createdAt":"2019-10-30T23:17:15.681226Z","expiresAt":"2020-02-29T23:17:15.681226Z","version":5,"suggestionsPerGrant":70,"approximateValue":"17.5","type":"ugp","available":true,"platform":"desktop","publicKeys":["vNnt88kCh650dFFHt+48SS4d4skQ2FYSxmmlzmKDgkE="],"legacyClaimed":false}]}

> headers accept-ranges: bytes
> headers age: 27
> headers content-length: 650
> headers content-type: application/json
> headers date: Wed, 22 Jan 2020 18:44:11 GMT
> headers request-id: bok9fnuktoe14ei7g7v0
> headers status: 200
> headers via: 1.1 varnish
> headers x-cache: HIT
> headers x-cache-hits: 4
> headers x-ratelimit-limit: 1
> headers x-ratelimit-remaining: 0
> headers x-ratelimit-reset: 1
> headers x-served-by: cache-del21720-DEL
[ END RESPONSE ]

Also confirmed that once the grant is virtualized, restoring the wallet on a new profile, 0 BAT is restored (confirming 1 way conversion).
Scenario 3:

Verified test plan from brave/brave-core#4101 when claiming both an ad grant and a UGP grant on 1.0.0:
image

  • Confirmed on upgrade to 1.3.x that BAT value remains the same
    image
    Also confirmed the parameters from the description showed in terminal:
    migrate=true parameter:
[ REQUEST ]
> url: https://grant.rewards.bravesoftware.com/v1/promotions?migrate=true&paymentId=94d51022-6a7d-4606-b11c-66c5f3c4dcf6&platform=windows
> method: UrlMethod::GET
> content: 
> contentType: 
[ END REQUEST ]

legacyClaimed parameter:

[ RESPONSE - OnFetch ]
> time: 1579719443
> result: Success
> http code: 200
> response: {"promotions":[{"id":"1502b3cd-d1a7-45db-8380-f405f2fc787d","createdAt":"2019-04-19T03:25:29Z","expiresAt":"2020-04-17T03:25:29Z","version":5,"suggestionsPerGrant":15,"approximateValue":"3.75","type":"ads","available":true,"platform":"","publicKeys":["gG28CWWzZG2F/390LA0jxhO67TVV4y1v5uE1evyz/3Y="],"legacyClaimed":true},{"id":"36baa4c3-f92d-4121-b6d9-db44cb273a02","createdAt":"2019-10-30T23:17:15.681226Z","expiresAt":"2020-02-29T23:17:15.681226Z","version":5,"suggestionsPerGrant":70,"approximateValue":"17.5","type":"ugp","available":true,"platform":"desktop","publicKeys":["vNnt88kCh650dFFHt+48SS4d4skQ2FYSxmmlzmKDgkE="],"legacyClaimed":true}]}

> headers accept-ranges: bytes
> headers age: 8
> headers content-length: 650
> headers content-type: application/json
> headers date: Wed, 22 Jan 2020 18:57:34 GMT
> headers request-id: bok9m5ektoe14ei7g85g
> headers status: 200
> headers via: 1.1 varnish
> headers x-cache: HIT
> headers x-cache-hits: 4
> headers x-ratelimit-limit: 1
> headers x-ratelimit-remaining: 0
> headers x-ratelimit-reset: 1
> headers x-served-by: cache-bom18225-BOM
[ END RESPONSE ]

Also confirmed that once the grant is virtualized, restoring the wallet on a new profile, 0 BAT is restored (confirming 1 way conversion).

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

Successfully merging a pull request may close this issue.

5 participants