-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
add abi.decode strictness flag and catch InsufficientDataBytes error … #3256
add abi.decode strictness flag and catch InsufficientDataBytes error … #3256
Conversation
ab73bef
to
0f7fbb1
Compare
Instead of creating a new flag and passing that flag around, we should let this be determined by the Web3.strict_bytes_type_checking flag. We should use this flag in the decoder for web3 to mark the |
Building on this, it looks like the previous version of the global strict bytes checking only re-builds encoders with If we can find a good balance to set the strictness at the decoder level, then we can maybe even solve issues like #2489 when we pass in the I think we should take a step back and re-evaluate how we want to add this globally since it doesn't seem like the global flag is handling decoding strictness very gracefully. edit: Looking at the eth-abi code again, I think we just need to override the Curious on your thoughts there. |
4d09ec2
to
a779467
Compare
a779467
to
b6ccf36
Compare
As far as I can tell, I don't think this will work without updates to From def _get_decoder_uncached(self, type_str, strict=True):
decoder = self._get_registration(self._decoders, type_str)
if hasattr(decoder, "is_dynamic") and decoder.is_dynamic:
# Set a transient flag each time a call is made to ``get_decoder()``.
# Only dynamic decoders should be allowed these looser constraints. All
# other decoders should keep the default value of ``True``.
decoder.strict = strict
return decoder |
Let me know if I'm missing something. Otherwise, I think scaling this back to just catching the |
…when parsing logs
This should use the existing global strictness flag.
What was wrong?
Related to Issue #1441 , if a user is decoding logs with length not a multiple of 32 bytes, it throws an
eth-abi
InsufficientBytesLength
error which is not properly caught.How was it fixed?
Add catching the error type
InsuffiecientDataBytes
and allow the passing ofstrict
flag through toeth_abi.decode
inprocess_receipt
.Since the flag is then passed to
get_event_data
, I considered making the flag available everywhereget_event_data
is called, but that would greatly expand the scope and doesn't seem necessary, given the original issue.Todo:
Cute Animal Picture