You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried web3.eth.abi.decodeLog() and got "null" value from latest version (beta.41)
I could get correct return value from beta.35.
Actual behavior
from beta.41
I get this output from decodeLog()
{ '0': '0xBA826fEc90CEFdf6706858E5FbaFcb27A290Fbe0',
'1': '0xF64D22513198d7F3dbe24ac9f6eCDbfc95209d25',
'2': null,
from: '0xBA826fEc90CEFdf6706858E5FbaFcb27A290Fbe0',
to: '0xF64D22513198d7F3dbe24ac9f6eCDbfc95209d25',
value: null }
from beta.35
{
'0': '0xBA826fEc90CEFdf6706858E5FbaFcb27A290Fbe0',
'1': '0xF64D22513198d7F3dbe24ac9f6eCDbfc95209d25',
'2': '1000000000000000000000', length: 3,
from: '0xBA826fEc90CEFdf6706858E5FbaFcb27A290Fbe0',
to: '0xF64D22513198d7F3dbe24ac9f6eCDbfc95209d25',
value: '1000000000000000000000' }
The '2' value should be '1000000000000000000000' as previous version.
Steps to reproduce the behavior
Here's the txid I tried.
0xd95194fc6cdcf68caf90cd887c0e9338cb69856c5edaf0544fd09fef4f331842
And here's the txReceipt log I inserted from that tx.
{ address: '0x0d8775f648430679a709e98d2b0cb6250d2887ef',
blockHash: '0xb600a1147851792b056c35f2fb9a830ecde5082ea23ac6daac7b4d0aea49a7c6',
blockNumber: '0x6d0326',
data: '0x00000000000000000000000000000000000000000000003635c9adc5dea00000',
logIndex: '0x2',
removed: false,
topics:
[ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
'0x000000000000000000000000ba826fec90cefdf6706858e5fbafcb27a290fbe0',
'0x000000000000000000000000f64d22513198d7f3dbe24ac9f6ecdbfc95209d25' ],
transactionHash: '0xd95194fc6cdcf68caf90cd887c0e9338cb69856c5edaf0544fd09fef4f331842',
transactionIndex: '0x56',
transactionLogIndex: '0x0',
type: 'mined' }
Error Logs
Versions
1.0.0-beta.41
The text was updated successfully, but these errors were encountered:
Fix `decodeLog()` for non indexed params.
The issue can be reproduced for events like this:
```
event Authorize(
bytes32 indexed platformId,
bytes32 indexed uid,
address indexed user,
AuthorizationRequest request
);
```
It is cause by `_mapTypes(types)` used in `decodeParameters(outputs, bytes)` (`var res = this.ethersAbiCoder.decode(this._mapTypes(outputs), "0x".concat(bytes.replace(/0x/i, '')));`) which returns `[ { indexed: false, name: 'request', type: 'address' } ]` for `types = outputs = [null, null, null, {"indexed":false,"name":"request","type":"address"}]` passed as argument.
So when the iteration `outputs.forEach(function (output, i) {}` is performed the `returnValues` do not get `res[i]` assigned correctly because the index is shifted due to empty types cleanup.
The fix might be linked to the following issue: web3#2268
Expected behavior
I tried web3.eth.abi.decodeLog() and got "null" value from latest version (beta.41)
I could get correct return value from beta.35.
Actual behavior
from beta.41
I get this output from decodeLog()
{ '0': '0xBA826fEc90CEFdf6706858E5FbaFcb27A290Fbe0',
'1': '0xF64D22513198d7F3dbe24ac9f6eCDbfc95209d25',
'2': null,
from: '0xBA826fEc90CEFdf6706858E5FbaFcb27A290Fbe0',
to: '0xF64D22513198d7F3dbe24ac9f6eCDbfc95209d25',
value: null }
from beta.35
{
'0': '0xBA826fEc90CEFdf6706858E5FbaFcb27A290Fbe0',
'1': '0xF64D22513198d7F3dbe24ac9f6eCDbfc95209d25',
'2': '1000000000000000000000',
length: 3,
from: '0xBA826fEc90CEFdf6706858E5FbaFcb27A290Fbe0',
to: '0xF64D22513198d7F3dbe24ac9f6eCDbfc95209d25',
value: '1000000000000000000000' }
The '2' value should be '1000000000000000000000' as previous version.
Steps to reproduce the behavior
Here's the txid I tried.
0xd95194fc6cdcf68caf90cd887c0e9338cb69856c5edaf0544fd09fef4f331842
And here's the txReceipt log I inserted from that tx.
{ address: '0x0d8775f648430679a709e98d2b0cb6250d2887ef',
blockHash: '0xb600a1147851792b056c35f2fb9a830ecde5082ea23ac6daac7b4d0aea49a7c6',
blockNumber: '0x6d0326',
data: '0x00000000000000000000000000000000000000000000003635c9adc5dea00000',
logIndex: '0x2',
removed: false,
topics:
[ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
'0x000000000000000000000000ba826fec90cefdf6706858e5fbafcb27a290fbe0',
'0x000000000000000000000000f64d22513198d7f3dbe24ac9f6ecdbfc95209d25' ],
transactionHash: '0xd95194fc6cdcf68caf90cd887c0e9338cb69856c5edaf0544fd09fef4f331842',
transactionIndex: '0x56',
transactionLogIndex: '0x0',
type: 'mined' }
Error Logs
Versions
1.0.0-beta.41
The text was updated successfully, but these errors were encountered: