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

Brave Ads crash when refilling unblinded tokens after downloading catalog due to invalid blinded token #12836

Closed
tmancey opened this issue Nov 21, 2020 · 3 comments

Comments

@tmancey
Copy link
Contributor

tmancey commented Nov 21, 2020

[ 00 ] 0x7f89bc6c2dfa
[ 01 ] ads::RequestSignedTokensUrlRequestBuilder::Build()
[ 02 ] ads::RefillUnblindedTokens::RequestSignedTokens()
[ 03 ] ads::RefillUnblindedTokens::MaybeRefill()
[ 04 ] ads::GetCatalog::OnDownloaded(ads::mojom::BraveAdsUrlResponse const&)
[ 05 ] bat_ads::OnUrlRequest(std::__1::function<void (ads::mojom::BraveAdsUrlResponse const&)> const&, mojo::StructPtr<ads::mojom::BraveAdsUrlResponse>)
[ 06 ] base::internal::Invoker<base::internal::BindState<void (*)(std::__1::function<void (ads::mojom::BraveAdsUrlResponse const&)> const&, mojo::StructPtr<ads::mojom::BraveAdsUrlResponse>), std::__1::function<void (ads::mojom::BraveAdsUrlResponse const&)> >, void (mojo::StructPtr<ads::mojom::BraveAdsUrlResponse>)>::RunOnce(base::internal::BindStateBase*, mojo::StructPtr<ads::mojom::BraveAdsUrlResponse>&&)
[ 07 ] bat_ads::mojom::BatAdsClient_UrlRequest_ForwardToCallback::Accept(mojo::Message*)
[ 08 ] mojo::InterfaceEndpointClient::HandleIncomingMessageThunk::Accept(mojo::Message*)
[ 09 ] mojo::internal::MultiplexRouter::ProcessIncomingMessage(mojo::internal::MultiplexRouter::MessageWrapper*, mojo::internal::MultiplexRouter::ClientCallBehavior, base::SequencedTaskRunner*)
[ 10 ] mojo::internal::MultiplexRouter::Accept(mojo::Message*)
[ 11 ] mojo::Connector::ReadAllAvailableMessages()
[ 12 ] mojo::SimpleWatcher::OnHandleReady(int, unsigned int, mojo::HandleSignalsState const&)
[ 13 ] base::TaskAnnotator::RunTask(char const*, base::PendingTask*)
[ 14 ] base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork()
[ 15 ] base::MessagePumpDefault::Run(base::MessagePump::Delegate*)
[ 16 ] base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run(bool, base::TimeDelta)
[ 17 ] base::RunLoop::Run()
[ 18 ] content::UtilityMain(content::MainFunctionParams const&)
[ 19 ] content::ContentMainRunnerImpl::Run(bool)
[ 20 ] service_manager::Main(service_manager::MainParams const&)
[ 21 ] content::ContentMain(content::ContentMainParams const&)
[ 22 ] ChromeMain
[ 23 ] 0x7f89bc65bf45
[ 24 ] ps_parser_skip_PS_token$d047009f2e1a96a9f3b5bd0ef7e4a196
[ 25 ] 0x7f89c45605c0
[ 26 ] 0x7f89c231b2c3
[ 27 ] 0x7f89c45605c0
[ 28 ] _start

https://brave.sp.backtrace.io/p/brave/triage?time=month&filters=((callstack%2Cregex%2CRequestSignedTokens))&aggregations=((ver%2Cdistribution)%2C(fingerprint%3Bissues%3Binvariants%2Chead)%2C(fingerprint%3Bissues%3Btags%2Chead)%2C(fingerprint%3Bissues%3Bticket%2Chead)%2C(fingerprint%3Bissues%3Bassignee%2Chead)%2C(fingerprint%3Bissues%3Bstate%2Chead)%2C(fingerprint%3Bfirst_seen%2Chead)%2C(callstack%2Chead)%2C(timestamp%2Cbin%2C32)%2C(timestamp%2Crange)%2C(uname.sysname%2Cdistribution%2C3)%2C(ver%2Cmax)%2C(ver%2Cmin)%2C(guid%2Cunique)%2C(classifiers%2Chead))&similarity=false

@tmancey tmancey added crash priority/P1 A very extremely bad problem. We might push a hotfix for it. QA/Yes release-notes/include feature/ads OS/Desktop labels Nov 21, 2020
@tmancey tmancey self-assigned this Nov 21, 2020
@tmancey tmancey changed the title Brave Ads crash when refilling unblinded tokens after downloading catalog Brave Ads crash when refilling unblinded tokens after downloading catalog due to invalid blinded token Nov 21, 2020
@tmancey
Copy link
Contributor Author

tmancey commented Nov 21, 2020

Crash occurs at const std::string blinded_token_base64 = blinded_token.encode_base64(); in request_signed_tokens_url_request_builder.cc and occurs if the blinded token was invalid

@tmancey
Copy link
Contributor Author

tmancey commented Nov 24, 2020

Fixed as part of #12833.

Steps:

  • Fresh install
  • Launch the browser
  • Wait for ads to initialize
  • Quit the browser
  • Edit confirmations.json and invalidate the first unblinded token in the unblinded tokens JSON node
  • Launch the browser
  • Redeem an ad

Expected:
Ads process does not crash

@tmancey tmancey added this to the 1.19.x - Nightly milestone Nov 26, 2020
@tmancey tmancey closed this as completed Dec 2, 2020
@GeetaSarvadnya
Copy link

GeetaSarvadnya commented Jan 7, 2021

Verification passed on


Brave | 1.19.76 Chromium: 87.0.4280.101 (Official Build) dev (64-bit)
-- | --
Revision | 9407c80213cda69c2b7abcb4fa8e3f74488f4956-refs/branch-heads/4280@{#1807}
OS | Windows 10 OS Version 2004 (Build 19041.685)


image

[7308:20900:0107/165735.426:VERBOSE6:ad_notification_event_viewed.cc(33)] Successfully logged ad notification viewed event
[7308:20900:0107/165736.617:VERBOSE1:redeem_unblinded_token.cc(81)] OnCreateConfirmation
[7308:20900:0107/165736.617:VERBOSE6:redeem_unblinded_token.cc(83)] URL Response:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/806e3962-9871-4587-8eca-a4627f0e18ec/eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlblwiOlwibERmcVVtRlpoaG9iblprWTJzRVowTTl0YWkxcnMvSzU3QkZPemR0WmJUaz1cIixcImJ1aWxkQ2hhbm5lbFwiOlwiZGV2XCIsXCJjcmVhdGl2ZUluc3RhbmNlSWRcIjpcImVkNmM0NjdhLTg2NDMtNDJlYi1hN2NkLTMyZTg3OGZhM2NkNFwiLFwiZXhwZXJpbWVudFwiOnt9LFwicGF5bG9hZFwiOnt9LFwicGxhdGZvcm1cIjpcIndpbmRvd3NcIixcInR5cGVcIjpcInZpZXdcIn0iLCJzaWduYXR1cmUiOiJNK1luMjhtTFRmQXducnljU09aTU1hV1lCd0phOWVmejZZMFd3ZEplT1piU0xpeXVJRkM1WWc5bEUrcDFpLyt1Nk9jRDNzOC9IcHdNQzhSWjh6ckhNQT09IiwidCI6ImFhK1VkbEQraG1jNEVOSDg1d0JVdXFhcTFPTjRYZnpBa1l6ZXZNV2VkWjd2blRkc2ZGQ0hONFdjWUl3bkNhRC9XNVYzK3hvTVpuOWRidTlrOWtwVy9nPT0ifQ==
  Response Status Code: 400
  Response: {"error":"Credential is invalid, Could not verify that token redemption is valid","statusCode":400}
[7308:20900:0107/165736.617:VERBOSE1:redeem_unblinded_token.cc(90)] Duplicate/bad confirmation
[7308:20900:0107/165736.617:VERBOSE1:redeem_unblinded_token.cc(103)] FetchPaymentToken
[7308:20900:0107/165736.617:VERBOSE2:redeem_unblinded_token.cc(104)] GET /v1/confirmation/{confirmation_id}/paymentToken
[7308:20900:0107/165736.617:VERBOSE5:redeem_unblinded_token.cc(108)] URL Request:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/806e3962-9871-4587-8eca-a4627f0e18ec/paymentToken
  Method: BraveAdsUrlRequestMethod::GET
[7308:20900:0107/165737.361:VERBOSE1:tab_manager.cc(56)] Browser window did enter background
[7308:20900:0107/165737.739:VERBOSE1:redeem_unblinded_token.cc(119)] OnFetchPaymentToken
[7308:20900:0107/165737.739:VERBOSE6:redeem_unblinded_token.cc(121)] URL Response:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/806e3962-9871-4587-8eca-a4627f0e18ec/paymentToken
  Response Status Code: 404
  Response: {"error":"Confirmation does not exist","statusCode":404}
[7308:20900:0107/165737.739:VERBOSE1:redeem_unblinded_token.cc(125)] Confirmation not found
[7308:20900:0107/165737.739:VERBOSE1:confirmations.cc(260)] Failed to redeem unblinded token with confirmation id 806e3962-9871-4587-8eca-a4627f0e18ec, creative instance id ed6c467a-8643-42eb-a7cd-32e878fa3cd4 and view

[7308:20900:0107/165737.740:VERBOSE1:confirmations.cc(178)] Added confirmation id ff230963-8457-4cca-828d-5571bc9adabd, creative instance id ed6c467a-8643-42eb-a7cd-32e878fa3cd4 and view to the confirmations queue

[7308:20900:0107/165738.771:VERBOSE1:confirmations.cc(228)] Successfully redeemed unblinded token with confirmation id 3f570a8f-b8bb-4a28-8eb8-e754b4fb14e5, creative instance id ed6c467a-8643-42eb-a7cd-32e878fa3cd4 and click
[7308:20900:0107/165738.772:VERBOSE1:confirmations.cc(249)] Added 1 unblinded payment token with an estimated redemption value of 0 BAT, you now have 1 unblinded payment tokens

  • Verified that failed confirmations are retried and tokens are successfully redeemed for viewed AD
[7308:20900:0107/171310.884:VERBOSE1:confirmations.cc(119)] Retry failed confirmations in 0 hours, 0 minutes, 20 seconds at 5:13 PM
[7308:20900:0107/171312.494:VERBOSE1:redeem_unblinded_token.cc(81)] OnCreateConfirmation
[7308:20900:0107/171312.494:VERBOSE6:redeem_unblinded_token.cc(83)] URL Response:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/ff230963-8457-4cca-828d-5571bc9adabd/eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlblwiOlwiU0JuRVBCR29yZkVVa056eGk5RWlVMlFWL1ZrdDZmaGpvNFhid2xQZDBRaz1cIixcImJ1aWxkQ2hhbm5lbFwiOlwiZGV2XCIsXCJjcmVhdGl2ZUluc3RhbmNlSWRcIjpcImVkNmM0NjdhLTg2NDMtNDJlYi1hN2NkLTMyZTg3OGZhM2NkNFwiLFwiZXhwZXJpbWVudFwiOnt9LFwicGF5bG9hZFwiOnt9LFwicGxhdGZvcm1cIjpcIndpbmRvd3NcIixcInR5cGVcIjpcInZpZXdcIn0iLCJzaWduYXR1cmUiOiJGSXpiaUdWdlA5Vmc5Q1V2WUZpYlcvWkl3ZGZxMXlQNzBaTmFRQ25DS05MM2ZNcHVZWWxGMzVINFI5UFEvZnowQ0gwVy9sZW1vL0cyWVpURjZyUkJZQT09IiwidCI6ImQyMmo4by8xQlhkdnJ1aysybE9xUGs3YXphQU45OVo1a3c3UHZoTzg0V0pOUmhkN3V5aVE1RU43bGlDZ21KUVhNQjl3OXhUcUpEL0Z3Q3R4eWc1L0xRPT0ifQ==
  Response Status Code: 201
  Response: {"id":"ff230963-8457-4cca-828d-5571bc9adabd","payload":{},"createdAt":"2021-01-07T11:43:12.421Z","type":"view","modifiedAt":"2021-01-07T11:43:12.421Z","creativeInstanceId":"ed6c467a-8643-42eb-a7cd-32e878fa3cd4"}
[7308:20900:0107/171312.495:VERBOSE1:redeem_unblinded_token.cc(103)] FetchPaymentToken
[7308:20900:0107/171312.495:VERBOSE2:redeem_unblinded_token.cc(104)] GET /v1/confirmation/{confirmation_id}/paymentToken
[7308:20900:0107/171312.495:VERBOSE5:redeem_unblinded_token.cc(108)] URL Request:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/ff230963-8457-4cca-828d-5571bc9adabd/paymentToken
  Method: BraveAdsUrlRequestMethod::GET
[7308:20900:0107/171313.657:VERBOSE1:redeem_unblinded_token.cc(119)] OnFetchPaymentToken
[7308:20900:0107/171313.657:VERBOSE6:redeem_unblinded_token.cc(121)] URL Response:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/ff230963-8457-4cca-828d-5571bc9adabd/paymentToken
  Response Status Code: 200
  Response: {"id":"ff230963-8457-4cca-828d-5571bc9adabd","createdAt":"2021-01-07T11:43:12.421Z","type":"view","modifiedAt":"2021-01-07T11:43:12.456Z","creativeInstanceId":"ed6c467a-8643-42eb-a7cd-32e878fa3cd4","paymentToken":{"publicKey":"CrQLMWmUuYog6Q93nScS8Lo1HHSex8WM2Qxij7qhjkQ=","batchProof":"KrjK2z7IU7kHtm8XXTkDUrTFZw3M5iv5xQcJAxy/CACDo0yBUgevYMBRjQW9OhxNFZpRB1cxpJwt69fL41OdDQ==","signedTokens":["Cre/4+0Q3ceAISS7L6vYKTApH4wyV72O04HChB7W6w8="]}}
[7308:20900:0107/171313.659:VERBOSE1:confirmations.cc(228)] Successfully redeemed unblinded token with confirmation id ff230963-8457-4cca-828d-5571bc9adabd, creative instance id ed6c467a-8643-42eb-a7cd-32e878fa3cd4 and view
[7308:20900:0107/171313.659:VERBOSE1:confirmations.cc(249)] Added 1 unblinded payment token with an estimated redemption value of 0.025 BAT, you now have 2 unblinded payment tokens

image


Verification passed on

Brave 1.19.78 Chromium: 87.0.4280.101 (Official Build) dev (64-bit)
Revision 9407c80213cda69c2b7abcb4fa8e3f74488f4956-refs/branch-heads/4280@{#1807}
OS Ubuntu 18.04 LTS

image

[29081:29081:0108/105601.306209:VERBOSE6:ad_notification_event_viewed.cc(33)] Successfully logged ad notification viewed event
[29081:29081:0108/105602.201849:VERBOSE1:redeem_unblinded_token.cc(81)] OnCreateConfirmation
[29081:29081:0108/105602.201926:VERBOSE6:redeem_unblinded_token.cc(83)] URL Response:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/1ace7415-7e2b-4412-b4f8-a501950bab1c/eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlblwiOlwibEJtM0RQTXdmWWl6Ym42R082UWJXTlJMd2R2VmEzZXg4NFZrQlFkV0JCbz1cIixcImJ1aWxkQ2hhbm5lbFwiOlwiZGV2XCIsXCJjcmVhdGl2ZUluc3RhbmNlSWRcIjpcIjMwZWNkNzBmLWY1NmQtNDc0NS1hNDU3LTQwMzVmY2FiNTRiNlwiLFwiZXhwZXJpbWVudFwiOnt9LFwicGF5bG9hZFwiOnt9LFwicGxhdGZvcm1cIjpcImxpbnV4XCIsXCJ0eXBlXCI6XCJ2aWV3XCJ9Iiwic2lnbmF0dXJlIjoiVmU1ZkNPUWNWNkpCU3FxQjlIbDV4LzJ5bWUwdVBlZUdDRlh4NFA0V3BMSmM1ZzROakc2YkVNTERTdmV0ME0rc2dPRlV4a3dZMGl1TndlU0pVQm9QY3c9PSIsInQiOiI5WlJpblMrNEJLVTR5dDVMQ01RU2hHNzJ1UklDdDZZUGVSSVJOLytDd2NrUjlEV1BiUnhjTWZsdU1ubm5tWXU0aWNpOURHdjAzVEZRWG10ektTVUZIUT09In0=
  Response Status Code: 400
  Response: {"error":"Credential is invalid, Could not verify that token redemption is valid","statusCode":400}
[29081:29081:0108/105602.201986:VERBOSE1:redeem_unblinded_token.cc(90)] Duplicate/bad confirmation
[29081:29081:0108/105602.202023:VERBOSE1:redeem_unblinded_token.cc(103)] FetchPaymentToken
[29081:29081:0108/105602.202047:VERBOSE2:redeem_unblinded_token.cc(104)] GET /v1/confirmation/{confirmation_id}/paymentToken
[29081:29081:0108/105602.202082:VERBOSE5:redeem_unblinded_token.cc(108)] URL Request:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/1ace7415-7e2b-4412-b4f8-a501950bab1c/paymentToken
  Method: BraveAdsUrlRequestMethod::GET
[29081:29081:0108/105602.463177:VERBOSE1:redeem_unblinded_token.cc(119)] OnFetchPaymentToken
[29081:29081:0108/105602.463259:VERBOSE6:redeem_unblinded_token.cc(121)] URL Response:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/1ace7415-7e2b-4412-b4f8-a501950bab1c/paymentToken
  Response Status Code: 404
  Response: {"error":"Confirmation does not exist","statusCode":404}
[29081:29081:0108/105602.463321:VERBOSE1:redeem_unblinded_token.cc(125)] Confirmation not found
[29081:29081:0108/105602.463480:VERBOSE1:confirmations.cc(260)] Failed to redeem unblinded token with confirmation id 1ace7415-7e2b-4412-b4f8-a501950bab1c, creative instance id 30ecd70f-f56d-4745-a457-4035fcab54b6 and view
[29081:29081:0108/105602.464937:VERBOSE1:confirmations.cc(178)] Added confirmation id c6da2706-6e55-4187-9772-2f5f30ebe5ad, creative instance id 30ecd70f-f56d-4745-a457-4035fcab54b6 and view to the confirmations queue

  • Verified that failed confirmations are retried and tokens are successfully redeemed for viewed AD
    image
[29081:29081:0108/110423.086674:VERBOSE1:confirmations.cc(194)] Removed confirmation id c6da2706-6e55-4187-9772-2f5f30ebe5ad, creative instance id 30ecd70f-f56d-4745-a457-4035fcab54b6 and view from the confirmations queue
[29081:29081:0108/110423.087848:VERBOSE1:redeem_unblinded_token.cc(49)] Redeem unblinded token
[29081:29081:0108/110423.088020:VERBOSE1:redeem_unblinded_token.cc(63)] CreateConfirmation
[29081:29081:0108/110423.088070:VERBOSE2:redeem_unblinded_token.cc(64)] POST /v1/confirmation/{confirmation_id}/{credential}
[29081:29081:0108/110423.088129:VERBOSE5:redeem_unblinded_token.cc(68)] URL Request:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/c6da2706-6e55-4187-9772-2f5f30ebe5ad/eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlblwiOlwidEVVUlo1VzFOWEFDWGNBQ0V0UGZrQUdEWDJnWDdZelEyMUhueVhWYjhFZz1cIixcImJ1aWxkQ2hhbm5lbFwiOlwiZGV2XCIsXCJjcmVhdGl2ZUluc3RhbmNlSWRcIjpcIjMwZWNkNzBmLWY1NmQtNDc0NS1hNDU3LTQwMzVmY2FiNTRiNlwiLFwiZXhwZXJpbWVudFwiOnt9LFwicGF5bG9hZFwiOnt9LFwicGxhdGZvcm1cIjpcImxpbnV4XCIsXCJ0eXBlXCI6XCJ2aWV3XCJ9Iiwic2lnbmF0dXJlIjoiOFlyc0U2Sk0yOCtHRGVxajhncGpCN1laL3h6bHhxdW1jU21CaVNrbzF5eEUxbnNnekpUYnRyeHJOQUVWc2lLdDZ5T2tEaWdHSmtBaVd4SVhxREFnamc9PSIsInQiOiJwMWNUMllwOUp2STU0UnFENmw3RHVkaFd6MkNaaVR6NU5abTlEOExlaHZqcG5ZK0p1YVNqdEhRczhESnk3TEZoTFEyRTRZdzAwS3VlM1hmeG9RUjJqQT09In0=
  Content: {"blindedPaymentToken":"tEURZ5W1NXACXcACEtPfkAGDX2gX7YzQ21HnyXVb8Eg=","buildChannel":"dev","creativeInstanceId":"30ecd70f-f56d-4745-a457-4035fcab54b6","experiment":{},"payload":{},"platform":"linux","type":"view"}
  Content Type: application/json
  Method: BraveAdsUrlRequestMethod::POST
[29081:29081:0108/110423.088550:VERBOSE1:confirmations.cc(119)] Retry failed confirmations in 0 godzin, 4 minuty i 48 sekund at 11:09
[29081:29081:0108/110424.385186:VERBOSE1:redeem_unblinded_token.cc(81)] OnCreateConfirmation
[29081:29081:0108/110424.385244:VERBOSE6:redeem_unblinded_token.cc(83)] URL Response:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/c6da2706-6e55-4187-9772-2f5f30ebe5ad/eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlblwiOlwidEVVUlo1VzFOWEFDWGNBQ0V0UGZrQUdEWDJnWDdZelEyMUhueVhWYjhFZz1cIixcImJ1aWxkQ2hhbm5lbFwiOlwiZGV2XCIsXCJjcmVhdGl2ZUluc3RhbmNlSWRcIjpcIjMwZWNkNzBmLWY1NmQtNDc0NS1hNDU3LTQwMzVmY2FiNTRiNlwiLFwiZXhwZXJpbWVudFwiOnt9LFwicGF5bG9hZFwiOnt9LFwicGxhdGZvcm1cIjpcImxpbnV4XCIsXCJ0eXBlXCI6XCJ2aWV3XCJ9Iiwic2lnbmF0dXJlIjoiOFlyc0U2Sk0yOCtHRGVxajhncGpCN1laL3h6bHhxdW1jU21CaVNrbzF5eEUxbnNnekpUYnRyeHJOQUVWc2lLdDZ5T2tEaWdHSmtBaVd4SVhxREFnamc9PSIsInQiOiJwMWNUMllwOUp2STU0UnFENmw3RHVkaFd6MkNaaVR6NU5abTlEOExlaHZqcG5ZK0p1YVNqdEhRczhESnk3TEZoTFEyRTRZdzAwS3VlM1hmeG9RUjJqQT09In0=
  Response Status Code: 201
  Response: {"id":"c6da2706-6e55-4187-9772-2f5f30ebe5ad","payload":{},"createdAt":"2021-01-08T10:04:26.007Z","type":"view","modifiedAt":"2021-01-08T10:04:26.007Z","creativeInstanceId":"30ecd70f-f56d-4745-a457-4035fcab54b6"}
[29081:29081:0108/110424.385345:VERBOSE1:redeem_unblinded_token.cc(103)] FetchPaymentToken
[29081:29081:0108/110424.385399:VERBOSE2:redeem_unblinded_token.cc(104)] GET /v1/confirmation/{confirmation_id}/paymentToken
[29081:29081:0108/110424.385486:VERBOSE5:redeem_unblinded_token.cc(108)] URL Request:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/c6da2706-6e55-4187-9772-2f5f30ebe5ad/paymentToken
  Method: BraveAdsUrlRequestMethod::GET
[29081:29081:0108/110424.748229:VERBOSE1:redeem_unblinded_token.cc(119)] OnFetchPaymentToken
[29081:29081:0108/110424.748321:VERBOSE6:redeem_unblinded_token.cc(121)] URL Response:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/c6da2706-6e55-4187-9772-2f5f30ebe5ad/paymentToken
  Response Status Code: 200
  Response: {"id":"c6da2706-6e55-4187-9772-2f5f30ebe5ad","createdAt":"2021-01-08T10:04:26.007Z","type":"view","modifiedAt":"2021-01-08T10:04:26.042Z","creativeInstanceId":"30ecd70f-f56d-4745-a457-4035fcab54b6","paymentToken":{"publicKey":"CrQLMWmUuYog6Q93nScS8Lo1HHSex8WM2Qxij7qhjkQ=","batchProof":"vR+vHqgMmJvMEYvGGbrOSNn+uhuHBCraP84Raoz3Fgoe629j7+dKNur5tdXn75Mqu0lbtrqkLcsFDWl4LtHiDA==","signedTokens":["WLnA+zM/hbb9zOTzHxS/OJxKaHkwVh9YgZ9njaIoazE="]}}
[29081:29081:0108/110424.750596:VERBOSE1:confirmations.cc(228)] Successfully redeemed unblinded token with confirmation id c6da2706-6e55-4187-9772-2f5f30ebe5ad, creative instance id 30ecd70f-f56d-4745-a457-4035fcab54b6 and view

Verification PASSED on macOS 11.1 x64 using the following build:

Brave | 1.19.81 Chromium: 87.0.4280.141 (Official Build) dev (x86_64)
--- | ---
Revision | 9f05d1d9ee7483a73e9fe91ddcb8274ebcec9d7f-refs/branch-heads/4280@{#2007}
OS | macOS Version 11.1 (Build 20C69)

Verified the STR/Cases outlined via #12836 (comment) and ensured that the unblinded token redemption is failed after viewing an ad and didn't crash the browser as per the following:

Failed Example Failed Example
Screen Shot 2021-01-12 at 11 52 36 PM Screen Shot 2021-01-12 at 11 52 45 PM
[60798:775:0113/001107.469134:VERBOSE1:ad_notification_serving.cc(98)] Ad notification delivered:
  uuid: 92c5cd3a-26d9-45cb-bbc9-0478c3b3940e
  creativeInstanceId: f385d5c8-853d-47fc-a8f9-71e5af1dd6ca
  creativeSetId: 10e18661-afcd-44bc-8ed4-6d9771687a40
  campaignId: 8f19a586-122b-4111-ab21-c417f13a7df2
  category: technology & computing-software
  title: Coinsmart.com
  body: Crypto gets you 10% off on Twitch! Buy BTC at CoinSmart.com
  targetUrl: https://www.coinsmart.com/bravecrypto/?utm_source=brave&utm_medium=cpc&utm_campaign=brave_sept
[60798:775:0113/001107.469226:VERBOSE3:ad_notification_event_viewed.cc(24)] Viewed ad notification with uuid 92c5cd3a-26d9-45cb-bbc9-0478c3b3940e and creative instance id f385d5c8-853d-47fc-a8f9-71e5af1dd6ca
[60798:775:0113/001107.469370:VERBOSE1:confirmations.cc(94)] Confirming view ad for creative instance id f385d5c8-853d-47fc-a8f9-71e5af1dd6ca
[60798:775:0113/001107.469605:INFO:challenge_bypass_ristretto_util.cc(19)] Challenge Bypass Ristretto Error: Failed to sign message: Pointer to verification key was null
[60798:775:0113/001107.470119:VERBOSE1:redeem_unblinded_token.cc(49)] Redeem unblinded token
[60798:775:0113/001107.470170:VERBOSE1:redeem_unblinded_token.cc(63)] CreateConfirmation
[60798:775:0113/001107.470209:VERBOSE2:redeem_unblinded_token.cc(64)] POST /v1/confirmation/{confirmation_id}/{credential}
[60798:775:0113/001107.470246:VERBOSE5:redeem_unblinded_token.cc(68)] URL Request:
  URL: https://ads-serve.brave.com/v1/confirmation/ffecc068-43fb-49d7-8f92-dbb0731afef9/
  Content: {"blindedPaymentToken":"plawg+rOlbcu7Y99T3Mngdy2Ol+vpaI7bNiUkxvf/xg=","buildChannel":"dev","creativeInstanceId":"f385d5c8-853d-47fc-a8f9-71e5af1dd6ca","experiment":{},"payload":{},"platform":"macos","type":"view"}
  Content Type: application/json
  Method: BraveAdsUrlRequestMethod::POST
[60798:775:0113/001107.560579:VERBOSE6:ad_notification_event_viewed.cc(33)] Successfully logged ad notification viewed event
[60798:775:0113/001107.588160:VERBOSE1:redeem_unblinded_token.cc(81)] OnCreateConfirmation
[60798:775:0113/001107.588220:VERBOSE6:redeem_unblinded_token.cc(83)] URL Response:
  URL: https://ads-serve.brave.com/v1/confirmation/ffecc068-43fb-49d7-8f92-dbb0731afef9/
  Response Status Code: 404
  Response: {"statusCode":404,"error":"Not Found","message":"Cannot POST /v1/confirmation/ffecc068-43fb-49d7-8f92-dbb0731afef9/"}
[60798:775:0113/001107.588264:VERBOSE1:redeem_unblinded_token.cc(103)] FetchPaymentToken
[60798:775:0113/001107.588291:VERBOSE2:redeem_unblinded_token.cc(104)] GET /v1/confirmation/{confirmation_id}/paymentToken
[60798:775:0113/001107.588319:VERBOSE5:redeem_unblinded_token.cc(108)] URL Request:
  URL: https://ads-serve.brave.com/v1/confirmation/ffecc068-43fb-49d7-8f92-dbb0731afef9/paymentToken
  Method: BraveAdsUrlRequestMethod::GET
[60798:775:0113/001107.720631:VERBOSE1:redeem_unblinded_token.cc(119)] OnFetchPaymentToken
[60798:775:0113/001107.720710:VERBOSE6:redeem_unblinded_token.cc(121)] URL Response:
  URL: https://ads-serve.brave.com/v1/confirmation/ffecc068-43fb-49d7-8f92-dbb0731afef9/paymentToken
  Response Status Code: 404
  Response: {"error":"Confirmation does not exist","statusCode":404}
[60798:775:0113/001107.720760:VERBOSE1:redeem_unblinded_token.cc(125)] Confirmation not found
[60798:775:0113/001107.720791:VERBOSE1:redeem_unblinded_token.cc(128)] Failed to verify confirmation
[60798:775:0113/001107.720824:VERBOSE1:confirmations.cc(260)] Failed to redeem unblinded token with confirmation id ffecc068-43fb-49d7-8f92-dbb0731afef9, creative instance id f385d5c8-853d-47fc-a8f9-71e5af1dd6ca and view
[60798:775:0113/001107.720857:VERBOSE1:refill_unblinded_tokens.cc(68)] No need to refill unblinded tokens as we already have 49 unblinded tokens which is above the minimum threshold of 20

Verified that failed confirmations are retried and tokens are successfully redeemed after viewing a second ad as per the following:

Success Example Success Example
Screen Shot 2021-01-13 at 12 23 53 AM Screen Shot 2021-01-13 at 12 24 01 AM
  uuid: d2862b3a-f4db-478c-ba52-7532d70bc742
  creativeInstanceId: bc01b3dc-f826-468c-8203-d3da4b1f6611
  creativeSetId: 10e18661-afcd-44bc-8ed4-6d9771687a40
  campaignId: 8f19a586-122b-4111-ab21-c417f13a7df2
  category: technology & computing-software
  title: Coinsmart.com
  body: Get $20 in BTC to try CoinSmart today. Instant verification.
  targetUrl: https://www.coinsmart.com/bravecrypto/?utm_source=brave&utm_medium=cpc&utm_campaign=brave_sept
[60798:775:0113/002339.454694:VERBOSE3:ad_notification_event_viewed.cc(24)] Viewed ad notification with uuid d2862b3a-f4db-478c-ba52-7532d70bc742 and creative instance id bc01b3dc-f826-468c-8203-d3da4b1f6611
[60798:775:0113/002339.454888:VERBOSE1:confirmations.cc(94)] Confirming view ad for creative instance id bc01b3dc-f826-468c-8203-d3da4b1f6611
[60798:775:0113/002339.455524:VERBOSE1:redeem_unblinded_token.cc(49)] Redeem unblinded token
[60798:775:0113/002339.455576:VERBOSE1:redeem_unblinded_token.cc(63)] CreateConfirmation
[60798:775:0113/002339.455612:VERBOSE2:redeem_unblinded_token.cc(64)] POST /v1/confirmation/{confirmation_id}/{credential}
[60798:775:0113/002339.455646:VERBOSE5:redeem_unblinded_token.cc(68)] URL Request:
  URL: https://ads-serve.brave.com/v1/confirmation/5e4e55a9-f432-48ce-bf69-35adc5a91fcf/eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlblwiOlwiTWd4YkM0V0ZiR1BWZ1pITzlvb1B5VUw5VFAzR01TRTZCNkNaZmpYOFdVcz1cIixcImJ1aWxkQ2hhbm5lbFwiOlwiZGV2XCIsXCJjcmVhdGl2ZUluc3RhbmNlSWRcIjpcImJjMDFiM2RjLWY4MjYtNDY4Yy04MjAzLWQzZGE0YjFmNjYxMVwiLFwiZXhwZXJpbWVudFwiOnt9LFwicGF5bG9hZFwiOnt9LFwicGxhdGZvcm1cIjpcIm1hY29zXCIsXCJ0eXBlXCI6XCJ2aWV3XCJ9Iiwic2lnbmF0dXJlIjoiKzFzL2hUTTZVU2cyM0g0aEdHTDltaFh4U2VIcmtReGlVVUQ0aG13N3E1aTBUaFNGR0VMUzVuUGJUNGhXQTNWQkVwVmd6ZmNpNkFINGF6bUsrWExseWc9PSIsInQiOiJ5V0VieWUxZnQzdy9nM0l0NHJBOFVRQzQ5R2paUmZOK3dwVENERnB5NzcrUkErd3p6dGh5SFRHOEdkVXhWOFp2UG8wbVFmLzREVGhiZjhBTndMU3FCdz09In0=
  Content: {"blindedPaymentToken":"MgxbC4WFbGPVgZHO9ooPyUL9TP3GMSE6B6CZfjX8WUs=","buildChannel":"dev","creativeInstanceId":"bc01b3dc-f826-468c-8203-d3da4b1f6611","experiment":{},"payload":{},"platform":"macos","type":"view"}
  Content Type: application/json
  Method: BraveAdsUrlRequestMethod::POST
[60798:775:0113/002339.562750:VERBOSE6:ad_notification_event_viewed.cc(33)] Successfully logged ad notification viewed event
[60798:775:0113/002339.793114:VERBOSE1:redeem_unblinded_token.cc(81)] OnCreateConfirmation
[60798:775:0113/002339.793222:VERBOSE6:redeem_unblinded_token.cc(83)] URL Response:
  URL: https://ads-serve.brave.com/v1/confirmation/5e4e55a9-f432-48ce-bf69-35adc5a91fcf/eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlblwiOlwiTWd4YkM0V0ZiR1BWZ1pITzlvb1B5VUw5VFAzR01TRTZCNkNaZmpYOFdVcz1cIixcImJ1aWxkQ2hhbm5lbFwiOlwiZGV2XCIsXCJjcmVhdGl2ZUluc3RhbmNlSWRcIjpcImJjMDFiM2RjLWY4MjYtNDY4Yy04MjAzLWQzZGE0YjFmNjYxMVwiLFwiZXhwZXJpbWVudFwiOnt9LFwicGF5bG9hZFwiOnt9LFwicGxhdGZvcm1cIjpcIm1hY29zXCIsXCJ0eXBlXCI6XCJ2aWV3XCJ9Iiwic2lnbmF0dXJlIjoiKzFzL2hUTTZVU2cyM0g0aEdHTDltaFh4U2VIcmtReGlVVUQ0aG13N3E1aTBUaFNGR0VMUzVuUGJUNGhXQTNWQkVwVmd6ZmNpNkFINGF6bUsrWExseWc9PSIsInQiOiJ5V0VieWUxZnQzdy9nM0l0NHJBOFVRQzQ5R2paUmZOK3dwVENERnB5NzcrUkErd3p6dGh5SFRHOEdkVXhWOFp2UG8wbVFmLzREVGhiZjhBTndMU3FCdz09In0=
  Response Status Code: 201
  Response: {"id":"5e4e55a9-f432-48ce-bf69-35adc5a91fcf","payload":{},"createdAt":"2021-01-13T05:23:39.757Z","type":"view","modifiedAt":"2021-01-13T05:23:39.757Z","creativeInstanceId":"bc01b3dc-f826-468c-8203-d3da4b1f6611"}
[60798:775:0113/002339.793430:VERBOSE1:redeem_unblinded_token.cc(103)] FetchPaymentToken
[60798:775:0113/002339.793502:VERBOSE2:redeem_unblinded_token.cc(104)] GET /v1/confirmation/{confirmation_id}/paymentToken
[60798:775:0113/002339.793556:VERBOSE5:redeem_unblinded_token.cc(108)] URL Request:
  URL: https://ads-serve.brave.com/v1/confirmation/5e4e55a9-f432-48ce-bf69-35adc5a91fcf/paymentToken
  Method: BraveAdsUrlRequestMethod::GET
[60798:775:0113/002339.912186:VERBOSE1:redeem_unblinded_token.cc(119)] OnFetchPaymentToken
[60798:775:0113/002339.912268:VERBOSE6:redeem_unblinded_token.cc(121)] URL Response:
  URL: https://ads-serve.brave.com/v1/confirmation/5e4e55a9-f432-48ce-bf69-35adc5a91fcf/paymentToken
  Response Status Code: 200
  Response: {"id":"5e4e55a9-f432-48ce-bf69-35adc5a91fcf","createdAt":"2021-01-13T05:23:39.757Z","type":"view","modifiedAt":"2021-01-13T05:23:39.770Z","creativeInstanceId":"bc01b3dc-f826-468c-8203-d3da4b1f6611","paymentToken":{"publicKey":"yjoFRpnBNgkaS7wf0cgyEFop99q1nuZj/APdxeEVSTc=","batchProof":"fZvMDADGBcuXsb/pm0vAKHm82lPzZdryKM3Fq7cozgPP7dAEGfWYyJj7lh0VeR+AMTIt5pN23IfPgvOZf+HdDg==","signedTokens":["4iWhDIj77TEZKq2U9gLE9ShM0XI0+5dgPyglBwa8UVw="]}}
[60798:775:0113/002339.912850:VERBOSE1:confirmations.cc(228)] Successfully redeemed unblinded token with confirmation id 5e4e55a9-f432-48ce-bf69-35adc5a91fcf, creative instance id bc01b3dc-f826-468c-8203-d3da4b1f6611 and view
[60798:775:0113/002339.913381:VERBOSE1:confirmations.cc(249)] Added 1 unblinded payment token with an estimated redemption value of 0.025 BAT, you now have 2 unblinded payment tokens
[60798:775:0113/002339.913957:VERBOSE1:refill_unblinded_tokens.cc(68)] No need to refill unblinded tokens as we already have 47 unblinded tokens which is above the minimum threshold of 20```

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

No branches or pull requests

4 participants