-
Notifications
You must be signed in to change notification settings - Fork 25
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
Fix typos and inaccuracies in comments of the ChainSync client #233
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.
Thanks, only a minor comment below ❤️
@@ -171,7 +171,7 @@ bracketChainSyncClient tracer ChainDbView { getIsInvalidBlock } varCandidates | |||
-- We must keep the candidate chain synchronised with the corresponding | |||
-- upstream chain. The upstream node's chain might roll forward or | |||
-- backwards, and they will inform us about this. When we get these | |||
-- messages, we will replicate these actions on our candidate chain. | |||
-- messages, we will replicate these actions on our current chain. |
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.
I think this is already an improvement; but maybe using "our fragment" is even slightly better as it is called ourFrag
in the code and "current chain" often refers to our selection in other places (i.e. the method of the ChainDB to get the current selection is called getCurrentChain
).
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.
Adopted in a38ce67.
-- The @intersection@ is not on our current chain, even though | ||
-- we sent only points from our current chain to find an |
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.
Same point about "our current chain" -> "our fragment" as above.
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.
Adopted in a38ce67.
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.
Thank you for opening this!
I'm Requesting Changes because I think "our fragment" is correct in one of the places you wrote it but incorrect in the other.
@@ -171,7 +171,7 @@ bracketChainSyncClient tracer ChainDbView { getIsInvalidBlock } varCandidates | |||
-- We must keep the candidate chain synchronised with the corresponding | |||
-- upstream chain. The upstream node's chain might roll forward or | |||
-- backwards, and they will inform us about this. When we get these | |||
-- messages, we will replicate these actions on our candidate chain. | |||
-- messages, we will replicate these actions on our fragment. |
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.
The phrase "candidate chain" features prominently in the preceding paragraphs of this comment (starting with "Our task:"), so it is somewhat discontinuous to change only this occurrence.
Would you rather change every occurrence of "candidate chain" to "candidate fragment"?
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.
Adopted in 93395a3.
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.
I'm sorry this didn't occur to me earlier, but: there are plenty of other occurrences of "candidate chain" in the rest of the comments in this source file.
Ultimately this is because engineers on this project eventually realize that "fragment" and "chain" are essentially interchangeable. It seems that whoever originally wrote this module was favoring "chain" at the time. Some other comments do already say "candidate fragment". I would guess that---if anything---it's most correlated to how broad the context of the comment is: "chains" in the broad cases, "fragment" in the very specific cases.
Usually, I wouldn't object to your PR as-is now: you've ensured the wording is at least coherent within its local context.
However, in this case, that local context happens to effectively be the binding site of "candidate chain" as it occurs throughout the rest of the module.
However however, the module was already using both "candidate chains" and "candidate fragment"... and it doesn't really matter which is used where. The only possible downside to your PR is that it inverts my hypothesized correlation between scope and chain-versus-fragment word choice 🤷.
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.
Thanks for paying attention @nfrisby; in my initial review, I somehow thought that the context was the same for both changes in 982fc1c. I agree that the choice of "candidate chain" vs "candidate fragment" doesn't matter that much.
I am both fine with reverting the change in this block comment, or keeping it, in that case probably adding "candidate" again
-- messages, we will replicate these actions on our fragment. | |
-- messages, we will replicate these actions on the candidate fragment. |
to make it clear that this is in fact not referring to the ourFrag
variable.
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.
I'm finding useful to talk about "candidate fragment" when referring to the local anchored fragment, and "candidate chain" to refer to the "upstream chain". My last commit 26c999a makes this story consistent in Client.hs.
To make this even more obvious, we could rename "candidate chain" to "upstream chain" if you want.
Update: I think considering "candidate fragment" and "candidate chain" interchangeable would really hide whether the text is referring to the upstream chain or to "their fragment" which is locally kept.
I haven't fully processed this. But my first knee-jerk reaction is that it seems while to point out: from a practical perspective, the upstream chain is almost always irrelevant to the code, simply because we have no way of observing it. The only thing we can observe is the candidate fragment, ie the prefix of the upstream chain that they have sent so far. The only knowledge we have about the upstream chain is that it is some (perhaps non-proper) extension of the candidate fragment. (Exception: they also send the tip point annotation and MsgAwaitReply
, but those merely determine whether it's a proper or non-proper extension.)
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.
the upstream chain is almost always irrelevant to the code, simply because we have no way of observing it.
In that case, I invite you to check the remaining references to "candidate chain". I think they all refer to the upstream chain despite of lacking a way to observe it.
...boros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/MiniProtocol/ChainSync/Client.hs
Show resolved
Hide resolved
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.
As I explain verbosely below: I think this is unblocked, now that the changes are coherent in their local context.
HOWEVER, if you're interested, there are other occurrences of "candidate chain" in this module. Feel free to hunt them down as well. But please do read my longer comment first, so that you know what swamp you're wading into.
I'm not going to Approve, because I want someone else's opinion first. (Perhaps even just yours.)
@@ -171,7 +171,7 @@ bracketChainSyncClient tracer ChainDbView { getIsInvalidBlock } varCandidates | |||
-- We must keep the candidate chain synchronised with the corresponding | |||
-- upstream chain. The upstream node's chain might roll forward or | |||
-- backwards, and they will inform us about this. When we get these | |||
-- messages, we will replicate these actions on our candidate chain. | |||
-- messages, we will replicate these actions on our fragment. |
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.
I'm sorry this didn't occur to me earlier, but: there are plenty of other occurrences of "candidate chain" in the rest of the comments in this source file.
Ultimately this is because engineers on this project eventually realize that "fragment" and "chain" are essentially interchangeable. It seems that whoever originally wrote this module was favoring "chain" at the time. Some other comments do already say "candidate fragment". I would guess that---if anything---it's most correlated to how broad the context of the comment is: "chains" in the broad cases, "fragment" in the very specific cases.
Usually, I wouldn't object to your PR as-is now: you've ensured the wording is at least coherent within its local context.
However, in this case, that local context happens to effectively be the binding site of "candidate chain" as it occurs throughout the rest of the module.
However however, the module was already using both "candidate chains" and "candidate fragment"... and it doesn't really matter which is used where. The only possible downside to your PR is that it inverts my hypothesized correlation between scope and chain-versus-fragment word choice 🤷.
I'm finding useful to talk about "candidate fragment" when referring to the local anchored fragment, and "candidate chain" to refer to the "upstream chain". My last commit 26c999a makes this story consistent in To make this even more obvious, we could rename "candidate chain" to "upstream chain" if you want. Update: I think considering "candidate fragment" and "candidate chain" interchangeable would really hide whether the text is referring to the upstream chain or to "their fragment" which is locally kept. |
…nt.hs Co-authored-by: amesgen <amesgen@amesgen.de>
ff8ea73
to
3f45b95
Compare
I'm merging given that the approvals stood for a while and we all seem to agree that the changes are better resting in main than here. But @nfrisby, let's continue the conversation on the need to refer to the upstream chain in comments. |
This PR only modifies comments.