-
Notifications
You must be signed in to change notification settings - Fork 20.5k
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
[Proposal] Comprehensive type encoding and decoding tests #20275
Comments
I think this would be a very very welcome work. The Re the 1.9.5 fix, that was not caused by |
Thank you for the feedback. Noted regarding 1.9.5, changed |
@MariusVanDerWijden is working on it |
Great!!! @MariusVanDerWijden, not sure how familiar you are with this part of the code, but if you need some pointers or hints, let us know if there's anything our team can do to help. |
@shoenseiwaso Thank you very much for the offer! I'm currently all set, but if you have any suggestions, please feel free to open additional issues. I already unified the test cases for packing and unpacking, and refactored the three different types of type checking into one. |
I think this issue can be closed now. Following improvements have been made to the
If you have some more suggestions how to improve the |
Overview
This is a proposal to add comprehensive type encoding and decoding tests to go-ethereum, including all of the
Pack*
andUnpack*
functions inaccounts/abi
andaccounts/abi/bind
. The tests would also test how the values are sent to/from smart contracts and therefore also check the full consensus mechanism as it relates to go-ethereum.Background
Several recent bugs have exposed inconsistencies with how data types are encoded/decoded from the ABI (bugs fixed in Solidity 0.5.10 release, bugs fixed in Solidity 0.5.11 release, #20269), as well as how geth produces valid blocks (regressions fixed in go-ethereum 1.9.5 release). Comprehensive testing would help catch these during the development cycle.
Approach
Part 1: unify, fix and DRY
pack_test.go
,unpack_test.go
andtopics_test.go
to use a unified set of test cases. It is highly likely this will expose additional issues that should be addressed.Pack*
andUnpack*
functions inaccounts/abi
andaccounts/abi/bind
. The most complete and DRY of these looks to be inaccounts/abi
. Some of the changes will probably have to be percolated up from the private functions to, for example, rely on a unified primary key acrossabi.Type.Type
,abi.Type.T
andabi.Type.Kind
. Some of the helper functions (toGoType()
, etc.) may need to be further pulled apart or adjusted to handle the difference between decoding "standard" ABI-encoded bytes and how indexed events (i.e., transaction logs) are encoded.Part 2: comprehensive end-to-end tests
solc
to the Travis CI configuration so that we can compile contracts as part of Go tests.bind_test.go
and dynamically generate getter/setter smart contracts for all base types and select dynamic (composite) types, including both indexed and non-indexed events (where appropriate).Implementation notes
Resolving this issue in the way described above is a fairly large amount of work, even for someone with detailed knowledge of Go, go-ethereum and Solidity. It could be ~2 months of full time engineering effort.
The text was updated successfully, but these errors were encountered: