-
Notifications
You must be signed in to change notification settings - Fork 717
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
[Backport] Serialization framework updates #2412
[Backport] Serialization framework updates #2412
Conversation
475c54d
to
adba8de
Compare
rebased on master, ready to go. |
This is a great job, really loved it. The issue here is a mis-use of So, for example, we have something like: std::vector<unsigned char> bytes;
READWRITE(bytes);
SER_READ(obj, obj.vBits = BytesToBits(bytes)); where, when ser_action.ForRead, When, instead, we do things like: SER_READ(obj, nMoneySupply); we are essentially passing this lambda to ::SerRead [&](Stream& s, typename std::remove_const<Type>::type& obj) { nMoneySupply; } which is a statement that has no effect on And IMO this actually signals an error: as we are not reading anything with those |
yeah great, nice catch ☕ . Updating. |
adba8de
to
4f80853
Compare
Updated per feedback, cherry-picked your commit zebra and removed the warning suppress. |
4f80853
to
6cfd257
Compare
Rebased on master, migrating the recently merged |
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.
There is a change in the serialization of CBudgetVote
, which makes it impossible to sync proposal votes from nodes that are not running this PR.
6cfd257
to
d361548
Compare
Updated per feedback, squashed change in 8a12b0c. |
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.
Code review ACK d361548
Will run it live for some time.
Based on btc@da74db0940720407fafaf3582bbaf9c81a4d3b4d
Now that `GetType()` is not propagated, the benefits are not worth the code.
This new approach uses a static method which takes the object as a argument. This has the advantage that its constness can be a template parameter, allowing a single implementation that sees the object as const for serialization and non-const for deserialization, without casts. More boilerplate is included in the new macro as well.
… other classes This adds the (internal) Wrapper class, and the Using function that uses it. Given a class F that implements Ser(stream, const object&) and Unser(stream, object&) functions, this permits writing e.g. READWRITE(Using<F>(object)).
This removes the need for the GNU C++ extension of variadic macros.
Extracted by Pieter Wuille from a comment by Russ Yanofsky, see bitcoin#18317 (comment).
Extracted and extended by Pieter Wuille from a comment by Russ Yanofsky (see bitcoin#18317 (comment)).
…ions that doesn't require an special treatment.
Adaptation of btc@ef17c03e074b6c3f185afa4eff572ba687c2a171
d361548
to
bd4b846
Compare
Rebased on master, no code changes. So this branch does not reject blocks v10 on mainnet due the recently merged #2434 for v5.2 (requirement signaled by zebra that has been testing it ☕ ☕). Can easily verify that nothing has changed with |
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.
ACK bd4b846
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.
ACK bd4b846
Decoupled from #2411, built on top of #2359.
Focused on creating the Span class and updating the serialization framework and every object using it up to latest upstream structure (3-4 years ahead of what we currently are in master). We will be up-to-date with them in the area after finishing with #2411 entirely (there are few more updates to the serialization code that comes down #2411 commits line that cannot cherry-pick here).
Adapted the following PRs: