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

chore(wallet): Migrate Report Tx Sent P3A question into core #22360

Merged
merged 12 commits into from
Mar 7, 2024

Conversation

StephenHeaps
Copy link
Collaborator

@StephenHeaps StephenHeaps commented Feb 27, 2024

Resolves brave/brave-browser#36156

Submitter Checklist:

  • I confirm that no security/privacy review is needed and no other type of reviews are needed, or that I have requested them
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally:
    • npm run test -- brave_browser_tests, npm run test -- brave_unit_tests wiki
    • npm run presubmit wiki, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

Desktop/Android:

  1. Start browser with --p3a-count-wallet-test-networks flag. Ensure profile contains wallet with testnet tokens.
  2. Ensure metric does not exist in local state.
  3. Send transaction, ensure metric has value of 1.
  4. Close browser, move system time ahead by seven days.
  5. Open browser, ensure metric has value of 0.
  6. Send another transaction, ensure metric has value of 1.

iOS:

  1. Start browser with Brave Wallet Count Test Networks Brave Core Switch enabled. Ensure profile contains wallet with testnet tokens.
    • This can be enabled on iOS in main browser via ... -> Settings -> BraveCore Switches -> enable Brave Wallet Count Test Networks. You will have to quit the app and restart for changes to take effect.
  2. Ensure metric does not exist in local state.
    • On iOS, local state can be viewed in ... -> Settings -> View Chromium Local State
  3. In Wallet, tap ... and tap Wallet Settings -> Networks -> enable Show Test Networks switch.
  4. Send transaction, ensure metric has value of 1.
  5. Close browser, move system time ahead by seven days.
  6. Open browser, ensure metric has value of 0.
  7. Send another transaction, ensure metric has value of 1.

@StephenHeaps StephenHeaps self-assigned this Feb 27, 2024
@github-actions github-actions bot added CI/storybook-url Deploy storybook and provide a unique URL for each build feature/web3/wallet feature/web3/wallet/core labels Feb 27, 2024
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@StephenHeaps StephenHeaps force-pushed the wallet/p3a-report-transaction-core branch from 7c84fb1 to 717dc64 Compare March 3, 2024 16:57
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@StephenHeaps StephenHeaps force-pushed the wallet/p3a-report-transaction-core branch from 717dc64 to f099e07 Compare March 3, 2024 21:27
@StephenHeaps StephenHeaps force-pushed the wallet/p3a-report-transaction-core branch from f099e07 to 8b7cb6a Compare March 3, 2024 21:31
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

}
auto tx_coin = GetCoinTypeFromTxDataUnion(*tx_info->tx_data_union);
if (tx_coin == mojom::CoinType::BTC || tx_coin == mojom::CoinType::ZEC) {
// BTC, ZEV transactions are not tracked yet
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: ZEC

@@ -1967,7 +1977,8 @@ TEST_F(KeyringServiceUnitTest, RestoreLegacyBraveWallet) {
KeyringService service(json_rpc_service(), GetPrefs(), GetLocalState());
BraveWalletService brave_wallet_service(
shared_url_loader_factory(), nullptr, &service, json_rpc_service(),
nullptr, nullptr, nullptr, GetPrefs(), GetLocalState(), false);
tx_service(&service).get(), nullptr, nullptr, GetPrefs(), GetLocalState(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This creates unique_ptr<TxService> and immediately destroys it leaving danglig pointer in brave_wallet_service.tx_service_ -- most likely will crash in ASAN builds. It should be either TxService living on stack like KeyringService service above or allowing tx_service to be null for tests(see CHECK_IS_TEST())

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL about CHECK_IS_TEST 👍 . I went with MakeTxService route given check_is_test.h documentation.

@@ -170,6 +171,15 @@ class KeyringServiceUnitTest : public testing::Test {

JsonRpcService* json_rpc_service() { return json_rpc_service_; }

std::unique_ptr<TxService> tx_service(KeyringService* service) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tx_service() naming style is for trivial getters only. For this case it should be like MakeTxService(...)

scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory_;
network::TestURLLoaderFactory url_loader_factory_;
data_decoder::test::InProcessDataDecoder in_process_data_decoder_;
std::string tx_hash1_;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems we don't need tx_hash1_ being a field

…ervice` to avoid dangling pointer & cleanup.
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@@ -590,7 +589,7 @@ TEST_F(BraveWalletP3AUnitTest, SolTransactionSentObservation) {
mojom::TxDataUnion::NewSolanaTxData(std::move(solana_tx_data)),
mojom::kSolanaMainnet, sol_from(), &tx_meta_id));

tx_hash1_ =
std::string tx_hash1_ =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: local variables should not have trailing underscore

Copy link
Collaborator

@supermassive supermassive left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wallet core lgtm.
Please uplift to 1.64 and 1.65

@StephenHeaps StephenHeaps marked this pull request as ready for review March 5, 2024 18:27
@StephenHeaps StephenHeaps requested review from a team as code owners March 5, 2024 18:27
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

Copy link
Member

@yrliou yrliou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just unblocking for wallet-core since @supermassive already approved.

Copy link
Contributor

@josheleonard josheleonard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wallet Desktop Frontend ++

Copy link
Collaborator

@simoarpe simoarpe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Android code looks good!
Thank you for the fix.

@StephenHeaps StephenHeaps enabled auto-merge (squash) March 6, 2024 18:38
@StephenHeaps StephenHeaps requested a review from nuo-xu March 7, 2024 00:05
@StephenHeaps StephenHeaps merged commit 01f9f5f into master Mar 7, 2024
22 checks passed
@StephenHeaps StephenHeaps deleted the wallet/p3a-report-transaction-core branch March 7, 2024 15:00
@github-actions github-actions bot added this to the 1.65.x - Nightly milestone Mar 7, 2024
StephenHeaps added a commit that referenced this pull request Mar 8, 2024
* Move P3A transaction sent reporting into core
@GeetaSarvadnya
Copy link

GeetaSarvadnya commented Mar 12, 2024

Verification PASSED on

Brave | 1.65.73 Chromium: 123.0.6312.29 (Official Build) nightly (64-bit)
-- | --
Revision | 9cc34b8cfe9e8df8faede773545252783eefd953
OS | Windows 10 Version 22H2 (Build 19045.4046)

EthAccounts

Case 1: Brave.Wallet.EthTransactionSent = 0_PASSED
Case 1.1: No Eth TransactionSent
  1. Clean profile 1.65.73, launch browser using brave.exe --p3a-count-wallet-test-networks
  2. Go to brave://settings/wallet/networks and click on 3 dot menu for Sepolia Test Network and click on set as active
  3. Create a wallet, enable the Show test networks switch while creating a wallet
  4. Create a Ethereum account in Testnet
  5. Send Eth to Ethereum accounts via https://sepolia-faucet.pk910.de/
  6. Ensured that the Eth appeared in the Ethereum account
  7. Ensure that the Transactions list is empty under brave://wallet/crypto/accounts/0x3c0478feF0e0fA6304382f0dfA098C32F5bbE2d7/transactions
  8. Open brave://local-state file and ensured that the metrics Brave.Wallet.EthTransactionSent is not shown as there are no Eth transaction sent
step 6 step 7 step 8
image image image
Case 1.2: Eth transactions sent exceeded 7 days_PASSED
  1. Clean profile 1.65.73, launch browser using brave.exe --p3a-count-wallet-test-networks
  2. Go to brave://settings/wallet/networks and click on 3 dot menu for Sepolia Test Network and click on set as active
  3. Create a wallet, enable the Show test networks switch while creating a wallet
  4. Create a Ethereum account in Testnet
  5. Send Eth to Ethereum accounts via https://sepolia-faucet.pk910.de/
  6. Ensured that the Eth appeared in the Solana account
  7. Ensure that the Transactions list is empty under ``
  8. Create a 2nd Ethereum accounts and send 0.005 SOL to 2nd account
  9. Open 1st Ethereum account and check the Transactions list and ensured that there is one Transactions listed for sending 0.005 to 2nd Eth account
  10. Open brave://local-state file and ensured that the metrics Brave.Wallet.EthTransactionSent response value is 1 as expected
  11. Close the browser and set the system date ahead by 8 days
  12. Relaunch the browser
  13. Open brave://local-state file and ensured that the metrics Brave.Wallet.EthTransactionSent response value is 0 as expected
    image
Case 2: Brave.Wallet.EthTransactionSent = 1_PASSED
Case 2.1: Eth TransactionSent
  1. Clean profile 1.65.73, launch browser using brave.exe --p3a-count-wallet-test-networks
  2. Go to brave://settings/wallet/networks and click on 3 dot menu for Sepolia Test Network and click on set as active
  3. Create a wallet, enable the Show test networks switch while creating a wallet
  4. Create a Ethereum account in Testnet
  5. Send Eth to Ethereum accounts via https://sepolia-faucet.pk910.de/
  6. Ensured that the Eth appeared in the Ethereum account
  7. Ensure that the Transactions list is empty under brave://wallet/crypto/accounts/0x3c0478feF0e0fA6304382f0dfA098C32F5bbE2d7/transactions
  8. Create a 2nd Ethereum accounts and send 0.005 Eth to 2nd account
  9. Open 1st Ethereum account and check the Transactions list and ensured that there is one Transactions listed for sending 0.005 to 2nd Eth account
  10. Open brave://local-state file and ensured that the metrics Brave.Wallet.EthTransactionSent response value is 1 as expected
step 8 step 9 step 10
image image image
Case 2.2: Eth Transaction Sent in past 7 days_PASSED
  1. Clean profile 1.65.73, launch browser using brave.exe --p3a-count-wallet-test-networks
  2. Go to brave://settings/wallet/networks and click on 3 dot menu for Sepolia Test Network and click on set as active
  3. Create a wallet, enable the Show test networks switch while creating a wallet
  4. Create a Ethereum account in Testnet
  5. Send Eth to Ethereum accounts via https://sepolia-faucet.pk910.de/
  6. Ensured that the Eth appeared in the Ethereum account
  7. Ensure that the Transactions list is empty under ``
  8. Create a 2nd Ethereum accounts and send 0.005 Eth to 2nd account
  9. Open 1st Ethereum account and check the Transactions list and ensured that there is one Transactions listed for sending 0.005 to 2nd Eth account
  10. Open brave://local-state file and ensured that the metrics Brave.Wallet.EthTransactionSent response value is 1 as expected
  11. Close the browser and set the system date ahead by 7 days
  12. Relaunch the browser
  13. Open brave://local-state file and ensured that the metrics Brave.Wallet.EthTransactionSent response value is 1 as expected
  14. Close the browser and set the system date ahead by 8 days
  15. Relaunch the browser
  16. Open brave://local-state file and ensured that the metrics Brave.Wallet.EthTransactionSent response value is 0 as expected
  17. Create a 3rd Ethereum accounts and send 0.005 SOL to 3rd account
  18. Open brave://local-state file and ensured that the metrics Brave.Wallet.EthTransactionSent response value is 1 as expected
step 13 step 16 step 18 (1) step 18 (2)
image image image image

Solana accounts:

Case 1: Brave.Wallet.SolTransactionSent = 0_PASSED
Case 1.1: No Sol TransactionSent
  1. Clean profile 1.65.73, launch browser using brave.exe --p3a-count-wallet-test-networks
  2. Go to brave://settings/wallet/networks and click on 3 dot menu for Solana Testnet and click on set as active
  3. Create a wallet, enable the Show test networks switch while creating a wallet
  4. Create a Solana account in Testnet
  5. Send Sol to Solana accounts via https://solfaucet.com/
  6. Ensured that the SOL appeared in the Solana account
  7. Ensure that the Transactions list is empty under brave://wallet/crypto/accounts/HsWidLU9nGjXWhhthWAuMNAJrxxihxKxNw7Ntc9FXeN7/transactions
  8. Open brave://local-state file and ensured that the metrics Brave.Wallet.SolTransactionSent is not shown as there are no SOL transaction sent
step 6 step 7 step 8
image image image
Case 1.2: Sol transactions sent exceeded 7 days_PASSED
  1. Clean profile 1.65.73, launch browser using brave.exe --p3a-count-wallet-test-networks
  2. Go to brave://settings/wallet/networks and click on 3 dot menu for Solana Testnet and click on set as active
  3. Create a wallet, enable the Show test networks switch while creating a wallet
  4. Create a Solana account in Testnet
  5. Send Sol to Solana accounts via https://solfaucet.com/
  6. Ensured that the SOL appeared in the Solana account
  7. Ensure that the Transactions list is empty under brave://wallet/crypto/accounts/HsWidLU9nGjXWhhthWAuMNAJrxxihxKxNw7Ntc9FXeN7/transactions
  8. Create a 2nd Solana accounts and send 0.005 SOL to 2nd account
  9. Open 1st Solana account and check the Transactions list and ensured that there is one Transactions listed for sending 0.005 to 2nd SOL account
  10. Open brave://local-state file and ensured that the metrics Brave.Wallet.SolTransactionSent response value is 1 as expected
  11. Close the browser and set the system date ahead by 8 days
  12. Relaunch the browser
  13. Open brave://local-state file and ensured that the metrics Brave.Wallet.SolTransactionSent response value is 0 as expected
step 10 step11 step 12 step 15 step 18
image image image image (12) image (12)
Case 2: Brave.Wallet.SolTransactionSent = 1_PASSED
Case 2.1: Sol TransactionSent
  1. Clean profile 1.65.73, launch browser using brave.exe --p3a-count-wallet-test-networks
  2. Go to brave://settings/wallet/networks and click on 3 dot menu for Solana Testnet and click on set as active
  3. Create a wallet, enable the Show test networks switch while creating a wallet
  4. Create a Solana account in Testnet
  5. Send Sol to Solana accounts via https://solfaucet.com/
  6. Ensured that the SOL appeared in the Solana account
  7. Ensure that the Transactions list is empty under brave://wallet/crypto/accounts/HsWidLU9nGjXWhhthWAuMNAJrxxihxKxNw7Ntc9FXeN7/transactions
  8. Create a 2nd Solana accounts and send 0.005 SOL to 2nd account
  9. Open 1st Solana account and check the Transactions list and ensured that there is one Transactions listed for sending 0.005 to 2nd SOL account
  10. Open brave://local-state file and ensured that the metrics Brave.Wallet.SolTransactionSent response value is 1 as expected
step 8 step 9 step 10
image image image
Case 2.2: Sol Transaction Sent in past 7 days_PASSED
  1. Clean profile 1.65.73, launch browser using brave.exe --p3a-count-wallet-test-networks
  2. Go to brave://settings/wallet/networks and click on 3 dot menu for Solana Testnet and click on set as active
  3. Create a wallet, enable the Show test networks switch while creating a wallet
  4. Create a Solana account in Testnet
  5. Send Sol to Solana accounts via https://solfaucet.com/
  6. Ensured that the SOL appeared in the Solana account
  7. Ensure that the Transactions list is empty under brave://wallet/crypto/accounts/HsWidLU9nGjXWhhthWAuMNAJrxxihxKxNw7Ntc9FXeN7/transactions
  8. Create a 2nd Solana accounts and send 0.005 SOL to 2nd account
  9. Open 1st Solana account and check the Transactions list and ensured that there is one Transactions listed for sending 0.005 to 2nd SOL account
  10. Open brave://local-state file and ensured that the metrics Brave.Wallet.SolTransactionSent response value is 1 as expected
  11. Close the browser and set the system date ahead by 7 days
  12. Relaunch the browser
  13. Open brave://local-state file and ensured that the metrics Brave.Wallet.SolTransactionSent response value is 1 as expected
  14. Close the browser and set the system date ahead by 8 days
  15. Relaunch the browser
  16. Open brave://local-state file and ensured that the metrics Brave.Wallet.SolTransactionSent response value is 0 as expected
  17. Create a 3rd Solana accounts and send 0.005 SOL to 3rd account
  18. Open brave://local-state file and ensured that the metrics Brave.Wallet.SolTransactionSent response value is 1 as expected
step 8 step 9 step 10 step 13 step 16 step 18
image image image image (12) image (12) image

FilecoinAccounts

Case 1: Brave.Wallet.FilTransactionSent = 0_PASSED
Case 1.1: No Fil TransactionSent
  1. Clean profile 1.65.73, launch browser using brave.exe --p3a-count-wallet-test-networks
  2. Go to brave://settings/wallet/networks and click on 3 dot menu for Filecoin Testnet and click on set as active
  3. Create a wallet, enable the Show test networks switch while creating a wallet
  4. Create a Filecoin account in Testnet
  5. Send Fil to Filecoin accounts via https://faucet.calibnet.chainsafe-fil.io
  6. Ensured that the Fil appeared in the Filecoin account
  7. Ensure that the Transactions list is empty under brave://wallet/crypto/accounts/t1rapzhlhwvpj7tfs6jwphsiqkvq4cdab3efmunaa/transactions
  8. Open brave://local-state file and ensured that the metrics Brave.Wallet.FilTransactionSent is not shown as there are no Fil transaction sent
step 6 step 7 step 8
image image image
Case 1.2: Sol transactions sent exceeded 7 days_PASSED
  1. Clean profile 1.65.73, launch browser using brave.exe --p3a-count-wallet-test-networks
  2. Go to brave://settings/wallet/networks and click on 3 dot menu for Filecoin Testnet`` and click on set as active`
  3. Create a wallet, enable the Show test networks switch while creating a wallet
  4. Create a Filecoin account in Testnet
  5. Send Fil to Filecoin accounts via https://faucet.calibnet.chainsafe-fil.io/send
  6. Ensured that the Fil appeared in the Filecoin account
  7. Ensure that the Transactions list is empty under brave://wallet/crypto/accounts/HsWidLU9nGjXWhhthWAuMNAJrxxihxKxNw7Ntc9FXeN7/transactions
  8. Create a 2nd Filecoin accounts and send 0.005 Fil to 2nd account
  9. Open 1st Filecoin account and check the Transactions list and ensured that there is one Transactions listed for sending 0.005 to 2nd Fil account
  10. Open brave://local-state file and ensured that the metrics Brave.Wallet.FilTransactionSent response value is 1 as expected
  11. Close the browser and set the system date ahead by 8 days
  12. Relaunch the browser
  13. Open brave://local-state file and ensured that the metrics Brave.Wallet.FilTransactionSent response value is 0 as expected
    image
Case 2: Brave.Wallet.FilTransactionSent = 1_PASSED
Case 2.1: Fil TransactionSent
  1. Clean profile 1.65.73, launch browser using brave.exe --p3a-count-wallet-test-networks
  2. Go to brave://settings/wallet/networks and click on 3 dot menu for Filecoin Testnet and click on set as active
  3. Create a wallet, enable the Show test networks switch while creating a wallet
  4. Create a Filecoin account in Testnet
  5. Send Fil to Filecoin accounts via https://faucet.calibnet.chainsafe-fil.io/send
  6. Ensured that the Fil appeared in the Filecoin account
  7. Ensure that the Transactions list is empty under brave://wallet/crypto/accounts/HsWidLU9nGjXWhhthWAuMNAJrxxihxKxNw7Ntc9FXeN7/transactions
  8. Create a 2nd Filecoin accounts and send 1 Fil to 2nd account
  9. Open 1st Filecoin account and check the Transactions list and ensured that there is one Transactions listed for sending 1 to 2nd Fil account
  10. Open brave://local-state file and ensured that the metrics Brave.Wallet.FilTransactionSent response value is 1 as expected
step 8 step 9 step 10
image image image
Case 2.2: Sol Transaction Sent in past 7 days_PASSED
  1. Clean profile 1.65.73, launch browser using brave.exe --p3a-count-wallet-test-networks
  2. Go to brave://settings/wallet/networks and click on 3 dot menu for Filecoin Testnet and click on set as active
  3. Create a wallet, enable the Show test networks switch while creating a wallet
  4. Create a Filecoin account in Testnet
  5. Send Fil to Filecoin accounts via https://faucet.calibnet.chainsafe-fil.io/send
  6. Ensured that the Fil appeared in the Filecoin account
  7. Ensure that the Transactions list is empty under brave://wallet/crypto/accounts/HsWidLU9nGjXWhhthWAuMNAJrxxihxKxNw7Ntc9FXeN7/transactions
  8. Create a 2nd Filecoin accounts and send 0.005 Fil to 2nd account
  9. Open 1st Filecoin account and check the Transactions list and ensured that there is one Transactions listed for sending 0.005 to 2nd Fil account
  10. Open brave://local-state file and ensured that the metrics Brave.Wallet.FilTransactionSent response value is 1 as expected
  11. Close the browser and set the system date ahead by 7 days
  12. Relaunch the browser
  13. Open brave://local-state file and ensured that the metrics Brave.Wallet.FilTransactionSent response value is 1 as expected
  14. Close the browser and set the system date ahead by 8 days
  15. Relaunch the browser
  16. Open brave://local-state file and ensured that the metrics Brave.Wallet.FilTransactionSent response value is 0 as expected
  17. Create a 3rd Filecoin accounts and send 1 Fil to 3rd account
  18. Open brave://local-state file and ensured that the metrics Brave.Wallet.FilTransactionSent response value is 1 as expected
step 15 step 18 step 19 step 20 (1) step 20 (2)
image image image image image

Verification PASSED on Samsung Galaxy version 12 running Bravemonoarm64.apk_1.65.75

Note: Filecoin is NOT implemented for Android, confirmed with wallet QA spoc @srirambv. Hence not verified Filecoin accounts verification on Android

EthAccounts

Note: Step 2, 3 are not required on Android as Test nework is enabled by default when brave is launched using --p3a-count-wallet-test-networks

Case 1: Brave.Wallet.EthTransactionSent = 0_PASSED
Case 1.1: No Eth TransactionSent
  1. Clean profile 1.65.73, launch browser using brave.exe --p3a-count-wallet-test-networks
  2. Go to brave://settings/wallet/networks and click on 3 dot menu for Sepolia Test Network and click on set as active
  3. Create a wallet, enable the Show test networks switch while creating a wallet
  4. Create a Ethereum account in Testnet
  5. Send Eth to Ethereum accounts via https://sepolia-faucet.pk910.de/
  6. Ensured that the Eth appeared in the Ethereum account
  7. Ensure that the Transactions list is empty under brave://wallet/crypto/accounts/0x3c0478feF0e0fA6304382f0dfA098C32F5bbE2d7/transactions
  8. Open brave://local-state file and ensured that the metrics Brave.Wallet.EthTransactionSent is not shown as there are no Eth transaction sent
step 6 step 7 step 8
Screenshot_20240319_163103_Brave - Nightly Screenshot_20240319_163108_Brave - Nightly Screenshot_20240319_163131_Brave - Nightly
Case 1.2: Eth transactions sent exceeded 7 days_PASSED
  1. Clean profile 1.65.73, launch browser using brave.exe --p3a-count-wallet-test-networks
  2. Go to brave://settings/wallet/networks and click on 3 dot menu for Sepolia Test Network and click on set as active
  3. Create a wallet, enable the Show test networks switch while creating a wallet
  4. Create a Ethereum account in Testnet
  5. Send Eth to Ethereum accounts via https://sepolia-faucet.pk910.de/
  6. Ensured that the Eth appeared in the Solana account
  7. Ensure that the Transactions list is empty under ``
  8. Create a 2nd Ethereum accounts and send 0.005 SOL to 2nd account
  9. Open 1st Ethereum account and check the Transactions list and ensured that there is one Transactions listed for sending 0.005 to 2nd Eth account
  10. Open brave://local-state file and ensured that the metrics Brave.Wallet.EthTransactionSent response value is 1 as expected
  11. Close the browser and set the system date ahead by 8 days
  12. Relaunch the browser
  13. Open brave://local-state file and ensured that the metrics Brave.Wallet.EthTransactionSent response value is 0 as expected
    Screenshot_20240326_163501_Brave - Nightly
Case 2: Brave.Wallet.EthTransactionSent = 1_PASSED
Case 2.1: Eth TransactionSent
  1. Clean profile 1.65.73, launch browser using brave.exe --p3a-count-wallet-test-networks
  2. Go to brave://settings/wallet/networks and click on 3 dot menu for Sepolia Test Network and click on set as active
  3. Create a wallet, enable the Show test networks switch while creating a wallet
  4. Create a Ethereum account in Testnet
  5. Send Eth to Ethereum accounts via https://sepolia-faucet.pk910.de/
  6. Ensured that the Eth appeared in the Ethereum account
  7. Ensure that the Transactions list is empty under brave://wallet/crypto/accounts/0x3c0478feF0e0fA6304382f0dfA098C32F5bbE2d7/transactions
  8. Create a 2nd Ethereum accounts and send 0.005 Eth to 2nd account
  9. Open 1st Ethereum account and check the Transactions list and ensured that there is one Transactions listed for sending 0.005 to 2nd Eth account
  10. Open brave://local-state file and ensured that the metrics Brave.Wallet.EthTransactionSent response value is 1 as expected
step 8 step 9 step 10
Screenshot_20240319_163258_Brave - Nightly Screenshot_20240319_163304_Brave - Nightly Screenshot_20240319_163318_Brave - Nightly
Case 2.2: Eth Transaction Sent in past 7 days_PASSED
  1. Clean profile 1.65.73, launch browser using brave.exe --p3a-count-wallet-test-networks
  2. Go to brave://settings/wallet/networks and click on 3 dot menu for Sepolia Test Network and click on set as active
  3. Create a wallet, enable the Show test networks switch while creating a wallet
  4. Create a Ethereum account in Testnet
  5. Send Eth to Ethereum accounts via https://sepolia-faucet.pk910.de/
  6. Ensured that the Eth appeared in the Ethereum account
  7. Ensure that the Transactions list is empty under ``
  8. Create a 2nd Ethereum accounts and send 0.005 Eth to 2nd account
  9. Open 1st Ethereum account and check the Transactions list and ensured that there is one Transactions listed for sending 0.005 to 2nd Eth account
  10. Open brave://local-state file and ensured that the metrics Brave.Wallet.EthTransactionSent response value is 1 as expected
  11. Close the browser and set the system date ahead by 7 days
  12. Relaunch the browser
  13. Open brave://local-state file and ensured that the metrics Brave.Wallet.EthTransactionSent response value is 1 as expected
  14. Close the browser and set the system date ahead by 8 days
  15. Relaunch the browser
  16. Open brave://local-state file and ensured that the metrics Brave.Wallet.EthTransactionSent response value is 0 as expected
  17. Create a 3rd Ethereum accounts and send 0.005 SOL to 3rd account
  18. Open brave://local-state file and ensured that the metrics Brave.Wallet.EthTransactionSent response value is 1 as expected
step 10 step 13 step 16 step 17 (1) step 17 (2) step 18
Screenshot_20240319_163326_Brave - Nightly Screenshot_20240325_163425_Brave - Nightly Screenshot_20240326_163501_Brave - Nightly Screenshot_20240326_163628_Brave - Nightly Screenshot_20240326_163636_Brave - Nightly Screenshot_20240326_163648_Brave - Nightly

Solana accounts:

Note: Step 2 is not required on Android as Test nework is enabled by default when brave is launched using --p3a-count-wallet-test-networks

Case 1: Brave.Wallet.SolTransactionSent = 0_PASSED
Case 1.1: No Sol TransactionSent
  1. Clean profile 1.65.73, launch browser using brave.exe --p3a-count-wallet-test-networks
  2. Go to brave://settings/wallet/networks and click on 3 dot menu for Solana Testnet and click on set as active
  3. Create a wallet, enable the Show test networks switch while creating a wallet
  4. Create a Solana account in Testnet
  5. Send Sol to Solana accounts via https://solfaucet.com/
  6. Ensured that the SOL appeared in the Solana account
  7. Ensure that the Transactions list is empty under brave://wallet/crypto/accounts/HsWidLU9nGjXWhhthWAuMNAJrxxihxKxNw7Ntc9FXeN7/transactions
  8. Open brave://local-state file and ensured that the metrics Brave.Wallet.SolTransactionSent is not shown as there are no SOL transaction sent
step 6 step 7 step 8
Screenshot_20240312_155210_Brave - Nightly Screenshot_20240312_155217_Brave - Nightly Screenshot_20240312_155246_Brave - Nightly
Case 1.2: Sol transactions sent exceeded 7 days_PASSED
  1. Clean profile 1.65.73, launch browser using brave.exe --p3a-count-wallet-test-networks
  2. Go to brave://settings/wallet/networks and click on 3 dot menu for Solana Testnet and click on set as active
  3. Create a wallet, enable the Show test networks switch while creating a wallet
  4. Create a Solana account in Testnet
  5. Send Sol to Solana accounts via https://solfaucet.com/
  6. Ensured that the SOL appeared in the Solana account
  7. Ensure that the Transactions list is empty under brave://wallet/crypto/accounts/HsWidLU9nGjXWhhthWAuMNAJrxxihxKxNw7Ntc9FXeN7/transactions
  8. Create a 2nd Solana accounts and send 0.005 SOL to 2nd account
  9. Open 1st Solana account and check the Transactions list and ensured that there is one Transactions listed for sending 0.005 to 2nd SOL account
  10. Open brave://local-state file and ensured that the metrics Brave.Wallet.SolTransactionSent response value is 1 as expected
  11. Close the browser and set the system date ahead by 8 days
  12. Relaunch the browser
  13. Open brave://local-state file and ensured that the metrics Brave.Wallet.SolTransactionSent response value is 0 as expected

Screenshot_20240319_155705_Brave - Nightly

Case 2: Brave.Wallet.SolTransactionSent = 1_PASSED
Case 2.1: Sol TransactionSent
  1. Clean profile 1.65.73, launch browser using brave.exe --p3a-count-wallet-test-networks
  2. Go to brave://settings/wallet/networks and click on 3 dot menu for Solana Testnet and click on set as active
  3. Create a wallet, enable the Show test networks switch while creating a wallet
  4. Create a Solana account in Testnet
  5. Send Sol to Solana accounts via https://solfaucet.com/
  6. Ensured that the SOL appeared in the Solana account
  7. Ensure that the Transactions list is empty under brave://wallet/crypto/accounts/HsWidLU9nGjXWhhthWAuMNAJrxxihxKxNw7Ntc9FXeN7/transactions
  8. Create a 2nd Solana accounts and send 0.005 SOL to 2nd account
  9. Open 1st Solana account and check the Transactions list and ensured that there is one Transactions listed for sending 0.005 to 2nd SOL account
  10. Open brave://local-state file and ensured that the metrics Brave.Wallet.SolTransactionSent response value is 1 as expected
step 8 step 9 step 10
Screenshot_20240312_155442_Brave - Nightly Screenshot_20240312_155451_Brave - Nightly Screenshot_20240312_155513_Brave - Nightly
Case 2.2: Sol Transaction Sent in past 7 days_PASSED
  1. Clean profile 1.65.73, launch browser using brave.exe --p3a-count-wallet-test-networks
  2. Go to brave://settings/wallet/networks and click on 3 dot menu for Solana Testnet and click on set as active
  3. Create a wallet, enable the Show test networks switch while creating a wallet
  4. Create a Solana account in Testnet
  5. Send Sol to Solana accounts via https://solfaucet.com/
  6. Ensured that the SOL appeared in the Solana account
  7. Ensure that the Transactions list is empty under brave://wallet/crypto/accounts/HsWidLU9nGjXWhhthWAuMNAJrxxihxKxNw7Ntc9FXeN7/transactions
  8. Create a 2nd Solana accounts and send 0.005 SOL to 2nd account
  9. Open 1st Solana account and check the Transactions list and ensured that there is one Transactions listed for sending 0.005 to 2nd SOL account
  10. Open brave://local-state file and ensured that the metrics Brave.Wallet.SolTransactionSent response value is 1 as expected
  11. Close the browser and set the system date ahead by 7 days
  12. Relaunch the browser
  13. Open brave://local-state file and ensured that the metrics Brave.Wallet.SolTransactionSent response value is 1 as expected
  14. Close the browser and set the system date ahead by 8 days
  15. Relaunch the browser
  16. Open brave://local-state file and ensured that the metrics Brave.Wallet.SolTransactionSent response value is 0 as expected
  17. Create a 3rd Solana accounts and send 0.005 SOL to 3rd account
  18. Open brave://local-state file and ensured that the metrics Brave.Wallet.SolTransactionSent response value is 1 as expected
step 13 step 16 step 17 step 17 (1) step 18
Screenshot_20240318_155626_Brave - Nightly Screenshot_20240319_155705_Brave - Nightly Screenshot_20240319_155931_Brave - Nightly Screenshot_20240319_160012_Brave - Nightly Screenshot_20240319_155959_Brave - Nightly

kjozwiak pushed a commit that referenced this pull request Mar 12, 2024
…to 1.64.x) (#22502)

chore(wallet): Migrate Report Tx Sent P3A question into core (#22360)

* Move P3A transaction sent reporting into core
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/storybook-url Deploy storybook and provide a unique URL for each build feature/web3/wallet/core feature/web3/wallet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move Transaction Sent P3A metric reporting into core
9 participants