-
Notifications
You must be signed in to change notification settings - Fork 873
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
Selected network per origin #17986
Selected network per origin #17986
Conversation
3b4782a
to
aafd9cd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strings changes ++
Adding @SergeyZhukovsky for reviewing Fix Android build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strings ++
bbb8cf2
to
8839fa3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++ Android part. Do we need to create an issue for Android to pass origin?
Already created: brave/brave-browser#29635 |
8839fa3
to
461761e
Compare
It's used to filter out unwanted origin events, ex. dapp on origin A should not be notified when network changed on origin B.
…ShouldRun We should be able to update all the pending txs without specifying chain_id especially for cases like wallet unlock. When specifying chain_id, we won't need to pull out all the pending txs, ex. approve tx.
Since now we will consider origin when determining active network, brave://settings/wallet/networks will be used to manage default network when per origin network is not set yet.
This only preseves backward compatibility with what current Android behavior is to comply with new interfaces. It doesn't update Android with new core network per origin capacity nor some new interfaces with fine-grained chain id option.
SignAllTransactionsRequest To simplify front end displaying correct chain_id initiated from the dapp rather than the current selected network.
We now have cached pending_chain_ids and new pending_chain_ids as input. When the function is called, it will stop out dated chain_id tracker and start tracker for new chain_id. If wallet is locked, all trackers will be stopped.
It should also be stopped when chain_id changed.
…ForOrigin Both of them call non mojo GetChainIdSync
71fdeac
to
0fcaa64
Compare
P3ARotationSchedulerTest.ConstellationRotation and AdBlockServiceTest.SubscribeToCustomSubscription failures on macOS are not related to this PR |
Resolves brave/brave-browser#29638
Resolves brave/brave-browser#24414
Recommend reviewing this PR in the sequential commits order.
Muli-chain refactoring
is necessary before we allow using different network per origin because current tx components are built on a global selected network per coin basis. The refactor is to make sure we can handle multiple transactions in different networks per coin at the same time.When dealing with per origin selected network, we need to persist it in
kBraveWalletSelectedNetworksPerOrigin
which is different thankBraveWalletSelectedNetworks
which is what we currently used. And we won't need to migratekBraveWalletSelectedNetworks
because it will still be used whenOrigin
is not available as a fallback option, we call it default network now. Users can change it in brave://settings/wallet/networks or through panel in internal pages likebrave://wallet
Desktop UI now also shows chain_id from tx or from request instead of selected network when showing
SendTransaction
,SignMessage
,SignTransaction
andSignAllTransactions
.Note that this PR only update desktop UI for supporting selected network per origin and leverage some fine grained chain_id API, Android doesn't get it for free. We make sure the behavior on Android doesn't change after this PR.
Follow-up issues:
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
wikinpm run lint
,npm run presubmit
wiki,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan:
Test different selected network for different dapps
Change default network in panel
brave://
pages.Different networks for different transactions
Selected network should not affect Transaction
Send Transaction
Selected network should not affect Transaction
Add and switch chain