Skip to content

Conversation

kiminuo
Copy link
Contributor

@kiminuo kiminuo commented Mar 14, 2021

It seems that not all documentation comments were updated in #19478 correctly.

@kiminuo kiminuo changed the title Documentation fixes after #19478 doc: Fixes after #19478 Mar 14, 2021
@fanquake fanquake added the Docs label Mar 14, 2021
Copy link
Member

@jonatack jonatack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK, can you pick up the remaining documentation fixes noted in #19478?

(While here, could fixup s/must updated/must update/ in txmempool.h::L610)

@kiminuo kiminuo force-pushed the feature/2021-03-mempool-nits branch from d8a942c to 09adbcc Compare March 14, 2021 21:20
@kiminuo
Copy link
Contributor Author

kiminuo commented Mar 14, 2021

Yes, the docs were objectively wrong, I probably fucked up the autocomplete when changing it, and if someone wants to fix it before I get around to it that's dandy. Just noting that the prior name -- setMemPoolChildren -- was wrong (no such member existed) for like 5 years and no one fixed it (and even more wrong -- there was no field anywhere), so I sort of doubt anyone is actually reading the docs to learn how the code works anyways.

(#19478 (comment))

@JeremyRubin FWIW, I read the docs today - by chance and out of curiosity - and the documentation got me confused. So count me in. :)

(While here, could fixup s/must updated/must update/ in txmempool.h::L610)

👍 Fixed.

can you pick up the remaining documentation fixes noted in #19478?

@jonatack My original goal was to learn more about mempool today, so my contribution here is meant as fixing "obviously wrong things" and certainly not details as I don't know them.

There are two remaining cases returned by git grep --extended-regexp '(setMemPool|mapLinks|CTxMemPool::(Parents|m_children))' (see #19478 (comment)). It would be great to fix them too but I'm not sure about proper fixes.

@kiminuo kiminuo requested a review from jonatack March 15, 2021 11:22
Copy link
Contributor

@RiccardoMasutti RiccardoMasutti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 09adbcc

@maflcko
Copy link
Member

maflcko commented Mar 22, 2021

$ git grep --extended-regexp '(setMemPool|mapLinks|CTxMemPool::(Parents|m_children))' src
src/txmempool.h: * the set of in-mempool direct parents and direct children in mapLinks.  Within
src/txmempool.h: * mapLinks may not be correct (and therefore functions like

@maflcko
Copy link
Member

maflcko commented Mar 22, 2021

Also, please adjust the title to something more meaningful. Otherwise it will be hard to understand what the changes are by looking at the title.

@kiminuo kiminuo changed the title doc: Fixes after #19478 doc: Fix several txmempool comments Mar 22, 2021
@kiminuo
Copy link
Contributor Author

kiminuo commented Mar 22, 2021

@MarcoFalke

$ git grep --extended-regexp '(setMemPool|mapLinks|CTxMemPool::(Parents|m_children))' src
src/txmempool.h: * the set of in-mempool direct parents and direct children in mapLinks.  Within
src/txmempool.h: * mapLinks may not be correct (and therefore functions like

As I wrote above:

There are two remaining cases returned by git grep --extended-regexp '(setMemPool|mapLinks|CTxMemPool::(Parents|m_children))' (see #19478 (comment)). It would be great to fix them too but I'm not sure about proper fixes.

@kiminuo kiminuo changed the title doc: Fix several txmempool comments doc: Fix several references in txmempool comments Mar 22, 2021
@JeremyRubin
Copy link
Contributor

These mostly look like correct incremental improvements.

I still worry the docs are generally stale/misleading, but that's a much larger effort that shouldn't preclude minor fixups.

@kiminuo kiminuo force-pushed the feature/2021-03-mempool-nits branch from 09adbcc to 106f9bb Compare March 23, 2021 16:46
Copy link
Member

@jarolrod jarolrod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK

@@ -119,7 +119,7 @@ void CTxMemPool::UpdateTransactionsFromBlock(const std::vector<uint256> &vHashes
// Iterate in reverse, so that whenever we are looking at a transaction
// we are sure that all in-mempool descendants have already been processed.
// This maximizes the benefit of the descendant cache and guarantees that
// CTxMemPool::m_children will be updated, an assumption made in
// CTxMemPoolEntry::m_children will be updated, an assumption made in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while here maybe refactor into a doxygen comment

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, I think the assumptions made by the function are something that should be in the doxygen comment above its signature in txmempool.h

@fanquake fanquake requested a review from glozow September 2, 2021 03:33
Copy link
Member

@glozow glozow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 106f9bb

The new comments look correct to me. Feel free to ignore my suggestions, they're just my opinions.

Edit: also, if you have the chance in this PR or another, should remove all mentions of mapLinks as a followup to #19478 #21436 (comment)

@@ -119,7 +119,7 @@ void CTxMemPool::UpdateTransactionsFromBlock(const std::vector<uint256> &vHashes
// Iterate in reverse, so that whenever we are looking at a transaction
// we are sure that all in-mempool descendants have already been processed.
// This maximizes the benefit of the descendant cache and guarantees that
// CTxMemPool::m_children will be updated, an assumption made in
// CTxMemPoolEntry::m_children will be updated, an assumption made in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, I think the assumptions made by the function are something that should be in the doxygen comment above its signature in txmempool.h

src/txmempool.h Outdated
@@ -677,7 +677,7 @@ class CTxMemPool
* limitDescendantSize = max size of descendants any ancestor can have
* errString = populated with error reason if any limits are hit
* fSearchForParents = whether to search a tx's vin for in-mempool parents, or
* look up parents from mapLinks. Must be true for entries not in the mempool
* look up parents from CTxMemPoolEntry::m_parents. Must be true for entries not in the mempool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just my opinion, but I think it's more helpful to refer to the specific parameter here. Same thing for the other docs.

Suggested change
* look up parents from CTxMemPoolEntry::m_parents. Must be true for entries not in the mempool
* look up parents from entry.m_parents. Must be true for entries not in the mempool

Copy link
Contributor Author

@kiminuo kiminuo Sep 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the suggestion is very good in general. But let me just show what I would actually love:

* look up parents from <see cref="entry.m_parents"/>. Must be true for entries not in the mempool

(Syntax borrowed from C#)

This is, of course, just made up syntax but it would be great to reference parameter's member (m_parents) in Doxygen. The only problem is that I'm unable to find the syntax for Doxygen, if it actually supports it.

Do you possibly know?

Copy link
Contributor Author

@kiminuo kiminuo Sep 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 \link CTxMemPoolEntry::m_children updateIt.m_children \endlink seems to do the job.

Resources:

Edit: This is an example from generated Doxygen page:

image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if there have been discussions about this, but my feeling is that most devs read the source rather than the actual doxygen-generated file (at least I do), so I don't like special commands like \link ... \endlink that improve the doxygen-generated documentation, but come at the cost of disturbing the reading flow when looking at the source.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand your point of view. An alternative point of view is that doxygen can warn us that a reference no longer exists so that it can be fixed in a PR and it would not be necessary to dig where something changed and why (this PR).

Personally, I don't think it would be that bad to have \link ... \endlink (I agree it's not visually nice). However, we already use doxygen syntax so a clear rule explaining why this is "too much" should be presented I think.

Having said that, I can remove it if you insist but I would rather not.

@DrahtBot
Copy link
Contributor

DrahtBot commented Sep 3, 2021

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #21464 (Mempool Update Cut-Through Optimization by JeremyRubin)
  • #17786 (refactor: Nuke policy/fees->mempool circular dependencies by hebasto)

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.

@glozow
Copy link
Member

glozow commented Sep 3, 2021

Remove other mentions of mapLinks as well? #21436 (comment)

@kiminuo
Copy link
Contributor Author

kiminuo commented Sep 3, 2021

Remove other mentions of mapLinks as well? #21436 (comment)

I'm not sure how to fix it really as I said here: #21436 (comment) and here #21436 (comment). I'm open to suggestions!

@DrahtBot
Copy link
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".

@kiminuo kiminuo closed this Jan 25, 2022
@kiminuo kiminuo deleted the feature/2021-03-mempool-nits branch January 25, 2022 07:28
@bitcoin bitcoin locked and limited conversation to collaborators Jan 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants