Closed ankitchiplunkar closed 5 years ago
The decode_abi
function expects for the data stream to be tuple-encoded. That means that the value at b_variables[96:128]
should be a byte offset (relative to the beginning of the tuple-encoded object) that points to the beginning of the encoding of the dynamic bytes
value. The value at b_variables[96:128]
is 0x20
which, when interpreted as an offset (unsigned integer), is 32
. That points to b_variables[32]
. It seems that you expect for b_variables[96]
to be the beginning of the encoded bytes
value. Log events are tuple-encoded so I think your data stream is malformed. I'm not sure where you obtained that encoded data.
However, this does reveal another issue which is that the lower-level stream call seems to expect that buffer sizes must be bounded in the range possible for ssize_t
. I guess we don't currently handle this case properly. Practically speaking, we probably won't have to handle it for a long time or, at least, not until people start encoding bytes
values with a length greater than that which can be represented by a 32 or 64 bit integer. That's a heckuva lot of data and I don't think we really need to worry about it for now.
I'm going to close this for now. Feel free to re-open the issue if you have any other questions or if you feel things haven't been resolved. Thanks for submitting your issue!
In a log there are topics and data fields which constitute the variables of an event log. If there are 3 topics and data in an event log. I would create the variables field as
# topic[0] is the event signature_hash
variables = [to_hex(topic[1]) + to_hex(topic[2]) + to_hex(data)]
Since the decode_abi
function expects byte offsets in the data_stream, my above approach would not work. How would you propose I should decode my event log using only types, topics and data of a log?
Where are the topic
and data
values coming from in your example?
What was wrong?
Cannot decode the first event of this transaction using
decode_abi
but can decode usingdecode_single
: https://etherscan.io/tx/0xe331b086561bad5554503115728123d93b8cb64f89b71d94e90876127c773379#eventlogPlease include any of the following that are applicable:
Data of the event
Tried decoding using
decode_abi
Can decode using
decode_single
How can it be fixed?
Don't know