-
Notifications
You must be signed in to change notification settings - Fork 116
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
chore: Use msgpack to reduce redundancy #612
Conversation
Args args; // Args instance | ||
R ret; // Holds return type | ||
MSGPACK_FIELDS(args, ret); // Macro from msgpack library to serialize/deserialize fields | ||
typedef std::tuple<typename std::decay<Vs>::type...> Args; // Define a tuple type that holds all argument types |
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.
Needed to support const Type& args
065f83f
to
077245a
Compare
@@ -120,24 +120,25 @@ TEST(ECDSASecp256r1, test_hardcoded) | |||
|
|||
size_t num_variables = | |||
generate_r1_constraints(ecdsa_r1_constraint, witness_values, pub_key_x, pub_key_y, hashed_message, signature); | |||
|
|||
acir_format constraint_system{ | |||
.varnum = static_cast<uint32_t>(num_variables), | |||
.public_inputs = {}, |
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.
Reordered to match serialization order (hard to work around doing this)
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.
LGTM, but don't count it as an approval since much of the cpp magic used here still escapes me.
Foiled again! It's almost like I should avoid C++ magic |
Cannot parse "This currently DOES NOT switch barretenberg's serialization to msgpack. This instead uses msgpack common reflection utils to derive such read and write functions." Could you explain this like im a 5 year old? |
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.
LGTM, left some minor comments.
* @brief Passthrough method for better error reporting. | ||
*/ | ||
template <msgpack_concepts::HasMsgPack T> void msgpack_apply(const auto& func, auto&... args) | ||
{ | ||
std::apply(func, msgpack::drop_keys(std::tie(args...))); |
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.
Can you expand on this comment a bit (or the fn below)? What does it mean that they are passthrough methods and how might they be used?
I hope the edited text now makes more sense |
Co-authored-by: ludamad <[email protected]>
Co-authored-by: ludamad <[email protected]>
Description
Going through lists-of-fields now that we have poor-man's reflection.
This currently DOES NOT switch barretenberg's serialization to msgpack. This instead uses msgpack common reflection utils to derive such read and write functions.
For example:
MSGPACK_FIELDS(arg1, arg2);
is now used to define
for any object that has a MSGPACK_FIELDS macro. This is also used for write
Also removes a debug utility I introduced during the hackathon that has not really been used, fine to remove
Checklist:
@brief
describing the intended functionality.include
directives have been added.