-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
document spork system with doxygen comments #2301
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.
May be it is better to place method descriptions in header file and to place only some implementation-specific notes in cpp file?
src/spork.cpp
Outdated
@@ -316,6 +378,10 @@ bool CSporkMessage::Sign(const CKey& key, bool fSporkSixActive) | |||
return true; | |||
} | |||
|
|||
/** | |||
* CheckSignature will ensire the spork signature matches the provided public |
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.
s/ensire/ensure/
src/spork.cpp
Outdated
@@ -260,23 +308,37 @@ bool CSporkManager::SetPrivKey(const std::string& strPrivKey) | |||
} | |||
} | |||
|
|||
/** | |||
* ToString returns the string representations of the SporkManager. |
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.
"representations" should be singular
Thanks for the suggestion. I added them with the implementations because I thought that made more sense, but maybe the actual C++ way is to add them in the header files. Since the classes were declared in header files, that's where I added those class comments. Technically the methods are "declared" in the class definition (e.g. the function prototypes). I guess the big questions (for me) are:
|
Doesn't seem like there is one that I can find. Found this that makes sense (just some guys opinion):
|
There is no common convention for comments, but there is google styleguide, for example, https://google.github.io/styleguide/cppguide.html#Function_Comments or such guide: http://www.edparrish.net/common/cppdoc.html. The most common practice is describe function goal and usage conditions in header and non-obvious implementation details in cpp file, I think.
Function description in header is more helpful: when you see unknown function in code, you are clicking |
@gladcow The more I look over DashCore code, I'm realizing that I don't actually look in the header files. And in my IDE when I click to go to the function, it's taking me to the implementation (e.g. the cpp file), not the header declaration (I use CLion). Personally I don't think it makes since to stick the documentation in the header files where I'm not even looking at the file. The comments make the most sense to me where the method is defined (not declared). |
@PastaPastaPasta I'm almost certain your random guy's opinion came from StackExchange, which I also found yesterday as well, while searching conventions. I also found others which differ, also on Stack Exchange, such as this one (which I tend to agree with):
|
Rebased onto |
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.
Looks good. Will require a bit more work after #2288. Added a couple of notes, see comments below.
src/spork.h
Outdated
@@ -75,15 +88,41 @@ class CSporkMessage | |||
} | |||
} | |||
|
|||
/** | |||
* GetHash returns the double-sha256 hash of the serialized spork message. The |
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 signature field is not included in the serialization.
this will not be true after #2288
src/spork.h
Outdated
uint256 GetHash() const; | ||
|
||
/** | ||
* GetSignatureHash is currently an alias for GetHash, and I'm not sure why it |
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 not sure why
The signature field is not included in the serialization.
- that's why in this case ;)
src/spork.h
Outdated
bool UpdateSpork(int nSporkID, int64_t nValue, CConnman& connman); | ||
|
||
/** | ||
* IsSporkActive returns a bool for "on/off" sporks, which should be used to | ||
* determine whether the spork can be considered active or not. |
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.
Should probably clarify that this is only true for time-based sporks (which are majority), for pure value-based sporks like SPORK_5_INSTANTSEND_MAX_VALUE this function makes no sense and should not be used.
Fixed |
This is an initial shot at an on-going WIP, which will add documentation via Doxygen comments to (especially) Dash-specific features in the codebase.
Added comments for new methods introduced in #2288, squashed & rebased to resolve conflicts. Please re-review. |
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
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.
LGTM 👍
utACK
This is an initial shot at an on-going WIP, which will add documentation via Doxygen comments to (especially) Dash-specific features in the codebase.
This is an initial shot at an on-going WIP, which will add documentation via Doxygen comments to (especially) Dash-specific features in the codebase.
@UdjinM6 I will need some guidance on the rationale for
GetSignatureHash
, as you will see. 😉