-
Notifications
You must be signed in to change notification settings - Fork 297
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: reduce redundancy with msgpack #1108
Conversation
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.
Over 550 lines deleted. Gotta love this kind of PRs!
using serialize::read; | ||
|
||
read(it, new_contract_data.contract_address); | ||
read(it, new_contract_data.portal_contract_address.address_); |
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.
Seems like here we're reading/writing directly to a field within this struct, which is not the same as msgpack is doing I guess. Is this change ok?
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.
This was never needed I believe, see read(portal_contract_address), confusing though!
template <typename B> void read(B& it, address& addr)
{
using serialize::read;
fr address_field;
read(it, address_field);
addr = address(address_field);
}
=>
address(fr const& address)
: address_(address){};
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! Great to remove superfluous code.
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.
Awesome. Lgtm
Description
Going through lists-of-fields now that we have poor-man's reflection.
This currently DOES NOT switch barretenberg 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
Also see AztecProtocol/barretenberg#612
There's still read and write methods that can be done similarly.
Checklist: