Skip to content

doc: Improve versionbits.h documentation#16587

Merged
fanquake merged 1 commit intobitcoin:masterfrom
ariard:2019-08-docs-versionbits
Aug 16, 2019
Merged

doc: Improve versionbits.h documentation#16587
fanquake merged 1 commit intobitcoin:masterfrom
ariard:2019-08-docs-versionbits

Conversation

@ariard
Copy link
Copy Markdown

@ariard ariard commented Aug 12, 2019

While reviewing burying of BIP 9 deployments, seen that versionbits.h wasn't that much documented. This is an attempt to improve it. It can be useful, given after burying this code isn't going to be used anymore and isn't straightforward at first sight.

@fanquake fanquake added the Docs label Aug 12, 2019
@cvengler
Copy link
Copy Markdown
Contributor

cvengler commented Aug 12, 2019

I like it but I NACK about the change in the header file.
Why do you remove this comment?

@ariard
Copy link
Copy Markdown
Author

ariard commented Aug 12, 2019

@emilengler "Note that the functions below take a pindexPrev as input: they compute information for block B based on its parent." you mean this one ? I've tried to incorporate it in both GetStateFor and GetStateSinceHeightFor ones but should I make it clearer?

Comment thread src/versionbits.h Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be "in-progress" :-)

Copy link
Copy Markdown
Member

@fanquake fanquake 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. Thanks for writing more documentation.

@jnewbery or @ajtowns might want to take a look here, given they have been recently doing some BIP9 related stuff.

Comment thread src/versionbits.h Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These match the States definitions in BIP9 👍

Comment thread src/versionbits.h Outdated
@laanwj
Copy link
Copy Markdown
Member

laanwj commented Aug 14, 2019

ACK, thanks for adding documentation

Why do you remove this comment?

The comment is moved from the cpp to the header file, where it should be. Public functions should be documented at declaration and not at the implementation as this keeps the API documentation better together.

Copy link
Copy Markdown
Contributor

@jnewbery jnewbery 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. Thanks for adding documentation.

A couple of nits inline.

Comment thread src/versionbits.h Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: drop the part about 'a monotonic clock', since it's confusing. The chain is not monotonic (timestamps of blocks may precede their ancestors' timestamps). Besides, BIP 9 doesn't have any dependence on clock time.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Sorry was thinking in MTP. "The expression GetMedianTimePast(block.parent) is referred to as MTP in the diagram above, and is treated as a monotonic clock defined by the chain." In the context of Median-Time-Past, I think BIP 9 envision the chain as a monotonic counter. Further, softfork timeout doesn't rely on it ?
(dropped it anyway, maybe too much)

Comment thread src/versionbits.h Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

s/Caches state for/Caches state from/

@ariard ariard force-pushed the 2019-08-docs-versionbits branch from bcc2a0f to 001b58b Compare August 14, 2019 17:55
@ariard
Copy link
Copy Markdown
Author

ariard commented Aug 14, 2019

Updated at 001b58b with typos and corrections, thanks all for reviews

Copy link
Copy Markdown
Contributor

@ajtowns ajtowns left a comment

Choose a reason for hiding this comment

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

This seems mostly fine to me

Comment thread src/versionbits.h Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The FAILED description there is verbatim from BIP-9 but it's nevertheless not accurate -- it'll be all blocks once the first retarget period after the timeout time is reached, if LOCKED_IN wasn't already reached.

@jnewbery
Copy link
Copy Markdown
Contributor

ACK 001b58b20413f692166aca19c8f21cab64b2a09a after @ajtowns's nit is addressed.

@ariard ariard force-pushed the 2019-08-docs-versionbits branch from 001b58b to 6576a87 Compare August 15, 2019 15:04
@ariard
Copy link
Copy Markdown
Author

ariard commented Aug 15, 2019

Updated at 6576a87 with @ajtowns comment addressed.

@jnewbery
Copy link
Copy Markdown
Contributor

ACK 6576a87

@ajtowns
Copy link
Copy Markdown
Contributor

ajtowns commented Aug 16, 2019

ACK 6576a87

Copy link
Copy Markdown
Member

@fanquake fanquake left a comment

Choose a reason for hiding this comment

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

ACK 6576a87

Thanks for following up @ajtowns and @jnewbery.

This is a doc only change, and the Travis failures here are unrelated.

@fanquake fanquake merged commit 6576a87 into bitcoin:master Aug 16, 2019
fanquake added a commit that referenced this pull request Aug 16, 2019
6576a87 doc: Improve versionbits.h documentation (Antoine Riard)

Pull request description:

  While reviewing burying of BIP 9 deployments, seen that versionbits.h wasn't that much documented. This is an attempt to improve it. It can be useful, given after burying this code isn't going to be used anymore and isn't straightforward at first sight.

ACKs for top commit:
  jnewbery:
    ACK 6576a87
  ajtowns:
    ACK 6576a87
  fanquake:
    ACK 6576a87

Tree-SHA512: 906463e0b22b988f89d77f798bf94d294f70467d29975088b87384764fb5d0dd1350be67562cc264656f61f1eada2cba20f99c0d797d1d7f90203c269e34c714
vijaydasmp pushed a commit to vijaydasmp/dash that referenced this pull request Nov 16, 2021
6576a87 doc: Improve versionbits.h documentation (Antoine Riard)

Pull request description:

  While reviewing burying of BIP 9 deployments, seen that versionbits.h wasn't that much documented. This is an attempt to improve it. It can be useful, given after burying this code isn't going to be used anymore and isn't straightforward at first sight.

ACKs for top commit:
  jnewbery:
    ACK 6576a87
  ajtowns:
    ACK 6576a87
  fanquake:
    ACK 6576a87

Tree-SHA512: 906463e0b22b988f89d77f798bf94d294f70467d29975088b87384764fb5d0dd1350be67562cc264656f61f1eada2cba20f99c0d797d1d7f90203c269e34c714
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants