-
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
Flag for Stricter ABI Type Checking #1419
Conversation
602db5f
to
9096240
Compare
47089aa
to
4647b7d
Compare
6c9f050
to
b56de55
Compare
b56de55
to
264843f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work.
264843f
to
0f26553
Compare
0ca91eb
to
042c934
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some thoughts doing a quick look over this. Ping me for a real review whenever you're ready.
6200fd0
to
f82a19d
Compare
@pipermerriam this is ready for another (and hopefully the last) round of real review |
3bb9369
to
319dd33
Compare
319dd33
to
3b83926
Compare
What was wrong?
web3 v5 will accept a bytestring or a hexstring if a bytes value is specified in an ABI. Because an empty string can be decoded as hex, it wasn't raising a
ValidationError
like v4 did. It was also requested that we not allow bytes values that are shorter than the specified size.Related to issue #1412
How was it fixed
This PR adds a stricter type checking mechanism for bytes values that is available on the web3 instance. Using
w3.enable_strict_bytes_type_checking()
will disallow strings that don't have a'0x'
, and will disallow byte strings that are different from the size the ABI specifies.I also noticed that we were using eth-abi's codec for events instead of the one registered in web3, so changed that over to use the codec on the web3 instance.
0x
to an ABI with bytes specifiedCute animal picture
Todos: