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

Extraneous data in eth_call response is not handled correctly #23998

Closed
onyb opened this issue Jul 12, 2022 · 3 comments · Fixed by brave/brave-core#14138
Closed

Extraneous data in eth_call response is not handled correctly #23998

onyb opened this issue Jul 12, 2022 · 3 comments · Fixed by brave/brave-core#14138

Comments

@onyb
Copy link
Member

onyb commented Jul 12, 2022

Per https://community.brave.com/t/wrong-price-to-vusdc/400120.

The result of calling balanceOf(address account) → uint256 on the VUSDC contract (BSC network) returns 0x0000000000000000000000000000000000000000000000000000000000045d120000000000000000000000000000000000000000000000000000000000000000000000000 which is 32 + 32 bytes.

Since we consider the entire hex string as the uint256 response, the resulting balance is incorrect. Etherscan, ethers, and other libraries only extract the first 32 bytes, so we should have same behaviour in brave-core. We should do the same for allowance(address owner, address spender) → uint256 as well.

Note that there's already a function called GetUint256HexFromData in eth_abi_decoder.cc that we can use for this purpose.

Contact me if you need VUSDC on BSC network to test.

@kjozwiak
Copy link
Member

The above will require 1.42.69 or higher for 1.42.x verification 👍

@LaurenWags LaurenWags added the feature/web3/wallet Integrating Ethereum+ wallet support label Jul 18, 2022
@srirambv
Copy link
Contributor

Verification passed on Oppo Reno 5 with Android 12 running 1.42.77 x64 build

23998.mp4

@srirambv
Copy link
Contributor

Brave 1.42.80 Chromium: 104.0.5112.57 (Official Build) (64-bit)
Revision 212fd173a0da1e0a024f328295bb56a2529190bb-refs/branch-heads/5112@{#1042}
OS ☑️ Linux ☑️ Windows 11 Version 21H2
(Build 22000.708)
☑️ macOS Version 12.0.1
(Build 21C52)
23998-Linux.mp4
23998-Windows.mp4
23998-macOS.mov

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

Successfully merging a pull request may close this issue.

4 participants