-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
when a string param is empty in data then decodeLog throws "The parameter "0x" must be a valid HEX string." #1044
Comments
The current 1.0 branch will result in the following: > web3.eth.abi.decodeLog(_inputs,_logDataTx1,_topics);
Result {
'0': '0xae653250B4220835050B75D3bC91433246903A95',
'1': '0x94011c67BC1E6448ed4b8682047358ca6cD09470',
'2': '10000',
'3': 'test x',
__length__: 4,
from: '0xae653250B4220835050B75D3bC91433246903A95',
to: '0x94011c67BC1E6448ed4b8682047358ca6cD09470',
amount: '10000',
narrative: 'test x' }
>
> web3.eth.abi.decodeLog(_inputs,_logDataTx2,_topics);
Result {
'0': '0xae653250B4220835050B75D3bC91433246903A95',
'1': '0x94011c67BC1E6448ed4b8682047358ca6cD09470',
'2': '10000',
__length__: 4,
from: '0xae653250B4220835050B75D3bC91433246903A95',
to: '0x94011c67BC1E6448ed4b8682047358ca6cD09470',
amount: '10000',
narrative: undefined } I would have to dig deeper, to figure out how i can make it return an empty string here, as we use the same coder also for call return values etc. |
Great, thanks. Is it a released branch? If so I will test it. |
I can make a beta release now. |
will be as follows: > web3.eth.abi.decodeLog(_inputs,_logDataTx1,_topics);
Result {
'0': '0xae653250B4220835050B75D3bC91433246903A95',
'1': '0x94011c67BC1E6448ed4b8682047358ca6cD09470',
'2': '10000',
'3': 'test x',
__length__: 4,
from: '0xae653250B4220835050B75D3bC91433246903A95',
to: '0x94011c67BC1E6448ed4b8682047358ca6cD09470',
amount: '10000',
narrative: 'test x' }
>
> web3.eth.abi.decodeLog(_inputs,_logDataTx2,_topics);
Result {
'0': '0xae653250B4220835050B75D3bC91433246903A95',
'1': '0x94011c67BC1E6448ed4b8682047358ca6cD09470',
'2': '10000',
'3': '',
__length__: 4,
from: '0xae653250B4220835050B75D3bC91433246903A95',
to: '0x94011c67BC1E6448ed4b8682047358ca6cD09470',
amount: '10000',
narrative: '' } |
released beta 21 |
works fine with 1.0.0-beta.21, thank you |
web3@1.0.0-beta.20
It seems
web3.eth.abi.decodeLog
doesn't handle cases when a string data in event log is empty, it throws:To reproduce, based on
Tx1 (param "narrative" is "test x" in data) and Tx2 (param "narrative" is "" in data)
The text was updated successfully, but these errors were encountered: