Empact
commented at 8:42 pm on June 13, 2018:
member
Most invocations of CHashWriter use SER_GETHASH and version 0, this allows for eliding those values, ~and removes SER_GETHASH as a type, because it functions simply as “has no external destination” in practice.~
~SerializeHash basically existed due to the overhead of CHashWriter construction, now that that is minimized, it’s unnecessary.~
Empact force-pushed
on Jun 13, 2018
Empact force-pushed
on Jun 13, 2018
Empact renamed this:
scripted-diff: Simplify common case of CHashWriter and drop SER_GETHASH
scripted-diff: Simplify common case of CHashWriter and drop SER_GETHASH & SerializeHash
on Jun 13, 2018
in
src/primitives/block.cpp:15
in
d697362d10outdated
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
Empact
commented at 9:06 pm on June 14, 2018:
member
Withdrawing this pending #10785. Will re-open after.
Empact closed this
on Jun 14, 2018
sipa
commented at 9:35 pm on June 14, 2018:
member
@Empact#10785 is low priority, and will probably take a while. Don’t let it stop you.
Empact reopened this
on Jun 14, 2018
Empact
commented at 9:48 pm on June 14, 2018:
member
Good to know, thanks.
Empact closed this
on Jun 14, 2018
Empact reopened this
on Jun 14, 2018
sipa
commented at 10:15 pm on June 14, 2018:
member
I don’t understand “scripted-diff: Drop SER_GETHASH”; it changes !(s.GetType() & SER_GETHASH) to s.GetType(). That means that what used to be the branch for DISK/NETWORK will end up being run just for DISK, and what used to be the branch for GETHASH will end up being run for NETWORK and GETHASH.
Empact
commented at 11:23 pm on June 14, 2018:
member
sipa
commented at 11:27 pm on June 14, 2018:
member
Ah of course; I missed the (1 << ...) around it.
This isn’t very readable code though. Would you mind keeping SER_GETHASH as a constant (perhaps just defined as 0), and explicit comparisons with it (rather than bit masking). That should still be a nice simplification.
Empact force-pushed
on Jun 14, 2018
Empact force-pushed
on Jun 14, 2018
Empact force-pushed
on Jun 15, 2018
Empact renamed this:
scripted-diff: Simplify common case of CHashWriter and drop SER_GETHASH & SerializeHash
scripted-diff: Simplify common case of CHashWriter and drop SerializeHash
on Jun 15, 2018
Empact
commented at 0:13 am on June 15, 2018:
member
@sipa Fair enough, I dropped that commit. Def more straight-forward now.
sipa
commented at 0:24 am on June 15, 2018:
member
Thinking a bit more about this, I think you can actually go further. I believe none of the serializers which have conditionals that mention SER_GETHASH (CDiskBlockIndex, CBlockLocator, CAddress, CKeyPool, CWalletKey, CAccountingEntry, CAccount) are ever actually invoked with SER_GETHASH as nType, so we could literally delete SER_GETHASH entire and all conditions that test for it. SerializeHash could then just use SER_NETWORK afaict.
Empact
commented at 0:25 am on June 15, 2018:
member
Reviewing calls to GetType after these changes, it seems like there are only 2 calls that affect the output, both testing GetType for SER_DISK in CAddress::SerializationOp. Is it possible to remove those? If so we could get right of GetType entirely, which seems like a big win.
If not, it seems like SER_NETWORK would not cause negative effects, but it would be a bit misleading for those cases where the serialization is not propagated to the network.
Switched to SER_NETWORK - it’s equivalent to 0 now as only SER_DISK has conditional behavior associated with it.
Empact renamed this:
scripted-diff: Simplify common case of CHashWriter and drop SerializeHash
Simplify common case of CHashWriter and drop SerializeHash
on Jun 28, 2018
DrahtBot closed this
on Aug 10, 2018
DrahtBot reopened this
on Aug 10, 2018
DrahtBot added the label
Needs rebase
on Aug 30, 2018
Empact force-pushed
on Sep 1, 2018
DrahtBot removed the label
Needs rebase
on Sep 1, 2018
laanwj referenced this in commit
bcffd8743e
on Sep 11, 2018
practicalswift
commented at 8:13 pm on October 23, 2018:
This should be explicit? :-)
DrahtBot added the label
Needs rebase
on Dec 1, 2018
Empact force-pushed
on Dec 2, 2018
Empact force-pushed
on Dec 2, 2018
DrahtBot removed the label
Needs rebase
on Dec 3, 2018
DrahtBot added the label
Needs rebase
on Dec 13, 2018
Empact force-pushed
on Dec 14, 2018
Empact renamed this:
Simplify common case of CHashWriter and drop SerializeHash
Simplify common case of CHashWriter
on Dec 14, 2018
Empact force-pushed
on Dec 14, 2018
Empact renamed this:
Simplify common case of CHashWriter
Make SER_GETHASH implicit for CHashWriter and SerializeHash
on Dec 14, 2018
Empact
commented at 10:01 am on December 14, 2018:
member
In case the SER_GETHASH removal was complicating things, I reoriented this around simply making SER_GETHASH implicit in the obviously hash-specific contexts.
DrahtBot removed the label
Needs rebase
on Dec 14, 2018
DrahtBot added the label
Needs rebase
on Aug 27, 2019
Empact force-pushed
on Feb 28, 2020
DrahtBot removed the label
Needs rebase
on Feb 28, 2020
Empact
commented at 10:34 am on February 29, 2020:
member
Rebased, refined, how about another look?
DrahtBot added the label
Needs rebase
on Jul 6, 2020
Empact force-pushed
on Apr 13, 2021
Empact force-pushed
on Apr 13, 2021
Empact force-pushed
on Apr 13, 2021
DrahtBot removed the label
Needs rebase
on Apr 13, 2021
Empact
commented at 4:32 pm on April 13, 2021:
member
Rebased
laanwj
commented at 12:12 pm on April 14, 2021:
member
This has been open for two (almost three) years ! we probably should get to either merging it if it is worth doing, or decide not to, but not keep @Empact rebasing it forever.
Edit: personally I’m not 100% convinced, I mean, yes the arguments can be elided now in some cases but does this make the code clearer than being explicit?
Empact force-pushed
on Apr 14, 2021
Empact
commented at 5:39 pm on April 14, 2021:
member
Hi @laanwj - I took 2020 (and then some) off, but it’s good to be back at it. As you note, this is old work and may not be worthwhile but here are my thoughts:
In these contexts, SER_GETHASH is redundant/noise. It’s a matter of interpretation whether CHashWriter(0) is more informative than CHashWriter - I tend to think it does not convey information so should be elided for readability.
It’s a bit striking when you consider that of 39 references to SER_GETHASH in master, 30 of them are content-free/noise. This removes those. The original PR was to remove SER_GETHASH entirely, but I walked that back to this more modest change.
As the bulk of the changes are in the form of a scripted-diff covering the specific cases, I look at this as a low-risk improvement to readability - refinement/readability being important to the long-term health of any software project.
If the answer to this is “meh,” though, fair enough.
practicalswift
commented at 7:18 am on April 15, 2021:
contributor
Personally I don’t have any strong opinions about this PR but I do have strong opinions about another thing: very glad to have you back @Empact! Warm welcome back as a contributor! :)
I took 2020 (and then some) off, but it’s good to be back at it.
laanwj
commented at 8:00 am on April 19, 2021:
member
Yes, welcome back!
If the answer to this is “meh,” though, fair enough.
I hope we can get some people who are more familiar with this specific code to review it.
I mean if @sipa is okay with it we should go ahead with it.
DrahtBot added the label
Needs rebase
on Apr 30, 2021
Empact force-pushed
on Feb 28, 2022
Empact force-pushed
on Feb 28, 2022
bitcoin deleted a comment
on Feb 28, 2022
bitcoin deleted a comment
on Feb 28, 2022
DrahtBot removed the label
Needs rebase
on Feb 28, 2022
DrahtBot added the label
Needs rebase
on Apr 22, 2022
Drop nType argument from SerializeHash
All callers either relied on the default value of SER_GETHASH or provided
SER_GETHASH.
f387b6d512
Add convenience constructors for CHashWriterf9239759bc
Include serialize.h wherever SER_GETHASH is referencedc05246bf00
Empact force-pushed
on Apr 22, 2022
DrahtBot removed the label
Needs rebase
on Apr 22, 2022
Munkybooty referenced this in commit
331ac88012
on Apr 29, 2022
Munkybooty referenced this in commit
ed33495fa4
on Apr 29, 2022
Munkybooty referenced this in commit
7467255e4c
on Apr 29, 2022
Munkybooty referenced this in commit
966112ed80
on May 6, 2022
Munkybooty referenced this in commit
2ab77afb79
on May 17, 2022
jonatack
commented at 5:44 am on May 18, 2022:
contributor
Approach ACK on this simplification, code looks reasonable on first read.
jonatack approved
jonatack
commented at 6:54 am on May 18, 2022:
contributor
At nearly four years old, this may be the pull that has been open the longest so far.
ACKc05246bf00bf8ffa5e73ed739a5001dc3639830c code review, clean rebase to master, clean debug build, ran unit tests
Empact
commented at 6:13 pm on May 21, 2022:
member
Incidentally, @jonatack do you happen to know the situation with Cirrus-CI? I’d like to retry this build, but I don’t have the option to do so on the site.
hebasto
commented at 6:20 pm on May 21, 2022:
member
Incidentally, @jonatack do you happen to know the situation with Cirrus-CI? I’d like to retry this build, but I don’t have the option to do so on the site.
Restarted.
DrahtBot
commented at 1:41 pm on May 24, 2022:
contributor
🐙 This pull request conflicts with the target branch and needs rebase.
Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a “draft”.
DrahtBot added the label
Needs rebase
on May 24, 2022
Munkybooty referenced this in commit
d413109da5
on May 30, 2022
maflcko
commented at 1:05 pm on June 6, 2022:
member
Not sure on this. I think it might be cleaner to remove ser-type and ser-version completely. See #19477 (comment)
maflcko
commented at 10:04 am on June 10, 2022:
member
This is a metadata mirror of the GitHub repository
bitcoin/bitcoin.
This site is not affiliated with GitHub.
Content is generated from a GitHub metadata backup.
generated: 2024-11-17 09:12 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me