-
Notifications
You must be signed in to change notification settings - Fork 819
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
feat(wallet): extend ABI decoder to support dynamic and nested types #23730
Conversation
e0d518e
to
6b20104
Compare
1a9d2e5
to
a997420
Compare
a997420
to
8417c6a
Compare
wallet core lgtm |
[puLL-Merge] - brave/brave-core@23730 Here's my review of the PR: DescriptionThis PR makes significant changes to the ChangesChanges
Security HotspotsNone found. The changes are focused on enhancing the ABI decoding capabilities and don't seem to introduce any new attack surface or vulnerabilities. Overall this looks like a solid set of changes to improve the Ethereum ABI decoding support in the Brave wallet. The new Let me know if you have any other questions! |
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.
Overall, this refactor LGTM. I think it would be useful to split this ABIDecode logic out onto the separate utility process, but that will likely require a larger consideration into how that should be done to address this on iOS. I don't think this is something that we need to address in the PR, but I'll add an issue for it so we can address when we get a bit more time (lower priority IMO).
} | ||
|
||
offset += 32; | ||
std::optional<base::Value::List> ABIDecode(const eth_abi::Type& type, |
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: it would be nice to move this into BraveWalletUtilsService
as a defense in depth measure
…rave#23730) * feat(wallet): extend ABI decoder to support dynamic and nested types * review(supermassive): use builder pattern to construct ABI types * review(supermassive): move method declarations in Type struct * review(supermassive): add CHECK limits for uint<m> and bytes<m> * Remove unnecessary kBytesM field * review(supermassive): function rename * review(supermassive): NOTREACHED_NORETURN * Rename UintM to Uint * review(supermassive): convert DecoderResult to struct * review(supermassive): add CHECK_EQ * review(supermassive): avoid casting to double * review(supermassive): reduce allocations using ByteView struct * review(supermassive): use base::span for ByteView
Resolves brave/brave-browser#38402
Improved
ABIDecode
to handle arbitrary calldata with complex types. The result is now encoded into abase::Value
to be generic. Also added a new parser for LiFi transactions, which utilises these the decoder improvements.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:
See linked issue