-
Notifications
You must be signed in to change notification settings - Fork 871
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
Refactor signing code #25386
Refactor signing code #25386
Conversation
f578b42
to
0c60869
Compare
98134f8
to
c5993a3
Compare
A Storybook has been deployed to preview UI for the latest push |
A Storybook has been deployed to preview UI for the latest push |
A Storybook has been deployed to preview UI for the latest push |
16f257f
to
04ce21e
Compare
04ce21e
to
451ffaf
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.
core code LGTM but this needs an issue and a manual test plan filled, thanks.
4fbdfbe
to
e2b7211
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.
sources-gni-reviewers
lgtm
return; | ||
} | ||
maybeShowPendingTransactions(); | ||
maybeShowSignTxRequestLayout(); |
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.
Maybe I'm not grasping the whole picture here, but what happened to the ETH pending transactions? The method maybeShowSignTxRequestLayout()
was in charge of processing both (SOL + ETH pending transaction requests).
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.
maybeShowSignTxRequestLayout
-> SIGN_TRANSACTION
maybeShowSignAllTxRequestLayout
-> SIGN_ALL_TRANSACTIONS
were both in charge of SOL transactions only.
Now both cases are covered by a single type
maybeShowSignSolTransactionsRequestLayout
-> SIGN_SOL_TRANSACTIONS
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.
Okay, then there's something sketchy going on: the method maybeShowSignSolTransactionsRequestLayout
is called for all transactions (ETH too). ETH pending transactions need it otherwise the panel won't show up.
Here is a quick recording. Precondition: 1 ETH pending transaction. Observe how the breakpoint for the method maybeShowSignSolTransactionsRequestLayout
is hit and processed anyway.
Screencast.from.13-09-2024.13.53.02.webm
Here is another recording, same ETH pending transaction, but the method maybeShowSignSolTransactionsRequestLayout
was commented. Result: the wallet panel is never displayed.
Screencast.from.13-09-2024.13.59.18.webm
Let's continue on DMs.
e2b7211
to
27aee45
Compare
|
||
private void maybeShowSignAllTxRequestLayout() { | ||
// TODO(apaymyshev): refactor this to have a better name. | ||
private void maybeShowSignSolTransactionsRequestLayout() { |
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.
I'm going to take care of this in my next PR, entangle the chains and and detach the logic that is not related to SOL transactions!
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 looks good!
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.
frontend ++
Nice work on the typing. Please add a test plan covering the common hardware wallet signing scenarios.
@@ -99,11 +97,16 @@ export const ConnectHardwareWalletPanel = ({ | |||
const request = signMessageData?.at(0) | |||
const isSigning = request && request.id !== -1 | |||
|
|||
const { account: messageAccount } = useAccountQuery(request?.accountId) | |||
const { account: singMessageAccount } = useAccountQuery(request?.accountId) |
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.
nit: typo
27aee45
to
3e6d74a
Compare
8016689
to
1284c5f
Compare
[puLL-Merge] - brave/brave-core@25386 DescriptionThis PR makes significant changes to the Brave Wallet codebase, particularly focusing on the handling of Solana transactions and hardware wallet interactions. The changes streamline the process of signing Solana transactions, improve type safety, and refactor several components to handle hardware wallet signatures more consistently across different cryptocurrencies. ChangesChanges
Possible Issues
Security Hotspots
|
Resolves brave/brave-browser#41121
Refactored parts of core/ui responsible of signing transactions/messages:
SignTransactionRequest
andSignAllTransactionsRequest
intoSignSolTransactionsRequest
. This is SOL only. Both dAppsignTransaction
andsignAllTransactions
are still there but internally there is only one implementation.SignSolTransactionsRequest
andTransactionInfo
. Also instead of sending ids instead of corresponding payloads from ui to core.TxService.GetTransactionMessageToSign
is moved to proxies. Each explicitly specifies what is returned (vs mojo union).EthereumSignatureVRS
EthereumSignatureBytes
SolanaSignature
FilecoinSignature
to distinguish signature type in type-safe manner.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 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:
Browser with this PR should behave in the same way as previous versions for these scenarios: