-
Notifications
You must be signed in to change notification settings - Fork 13
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
Tuple/Struct support #73 #79
Conversation
4016105
to
7fa8856
Compare
This includes encoding std::vector<std::tuple<Args...> and std::tuple<std::tuple<>> nested support.
Now it is compatible for all dynamic/static tuples. See https://docs.soliditylang.org/en/latest/abi-spec.html#formal-specification-of-the-encoding for more information.
JSON ABI is completely broken, this commit is not compilable as it errors out with BytesEncoded functions. BytesEncoded is to be deprecated within the next commit
Include tests :)
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.
Adding tuple support required us to shift both the ABI and ContractReflectionInterface entirely to a pure template-based approach. This effort, particularly integrating nested tuple/struct support, was more challenging and time-consuming than anticipated, necessitating a complete overhaul of the existing system.
Highlights:
- The compiler now autonomously generates functions for encoding/decoding types, applicable for each function call, supporting all basic Solidity types.
- Elimination of dependency on the "meta" metaprogramming library.
- Capability to return nested tuples and vectors, with compiler-generated code for these structures.
Implementation Example:
See SimpleContract.cpp for examples of the new ABI's application, demonstrating the enhanced handling of std::vector<T>
P and std::tuple<T...>
.
Impact:
The refactor has affected all areas interacting with the ABI, particularly in DynamicContracts function registrations and JSON ABI generation. New tests have been added to ensure the integrity of these changes.
Notable Changes:
- Deprecated ABI::Encode::encodeFunction; transition to ABI::FunctorEncode.
- Removed ABI::Types, BaseTypes, and BytesEncoded as the templated ABI negates their necessity.
- DynamicContract no longer uses std::any, reflecting the new templated methodology.
- Removed specializations for decoding/encoding
std::vector<BaseSolidityType>
since the templated functions handlesstd::vector<T>
.
Next Steps:
- Remove std::any usage within the ContractFactory.
TODOs: