-
Notifications
You must be signed in to change notification settings - Fork 696
chore: document NodeConfig parameters #6000
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
base: develop
Are you sure you want to change the base?
Conversation
few minor nits, but overall this is a great start! |
stackslib/src/config/mod.rs
Outdated
pub miner: bool, | ||
/// Flag indicating whether this node is configured to operate with Stacker responsibilities, | ||
/// such as participating in (PoX) by signaling support via StackerDB interactions. | ||
/// Setting this to `true` requires also running a signer. |
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.
Setting this to true is required if you are running a signer, but setting it to true does not require running a signer.
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.
changed in e8cca43
stackslib/src/config/mod.rs
Outdated
/// Flag indicating whether this node is configured to operate with Stacker responsibilities, | ||
/// such as participating in (PoX) by signaling support via StackerDB interactions. |
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 it would be more correct to say that setting this flag to true sets the node up to replicate the miner and signer Stacker DBs required for signing.
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.
changed in e8cca43
stackslib/src/config/mod.rs
Outdated
/// Enables a simulated mining mode, primarily for local testing and development. | ||
/// When `true`, the node may generate blocks locally without participating in the real | ||
/// burn chain consensus or P2P block production process. |
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.
Can you also add a note that miner
must also be set to true
to enable mock-mining.
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.
changed in e8cca43
stackslib/src/config/mod.rs
Outdated
pub wait_time_for_microblocks: u64, | ||
/// Maximum time (in milliseconds) to wait between mining blocks. |
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.
This one is related to mining after new blocks are seen in the network. I'm not quite sure what it should say though.
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.
changed in e8cca43
stackslib/src/config/mod.rs
Outdated
pub stacker: bool, | ||
/// Enables a simulated mining mode, primarily for local testing and development. | ||
/// When `true`, *and* [`NodeConfig::miner`] is also `true`, the node may generate blocks |
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.
/// When `true`, *and* [`NodeConfig::miner`] is also `true`, the node may generate blocks | |
/// When `true`, *and* [`node::miner`] is also `true`, the node may generate blocks |
i'm not sure if we should document this using the function name vs the toml name of node
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.
or maybe just "and miner
is also true", since the context should be clear that it is referring to the above field.
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.
That's a really good point about how this will look in the config.toml!
So, the reason I went with [`NodeConfig::miner`] in the Rust comments is because it's super handy for us developers. cargo docs automatically generates links to the fields or even in the IDE and it jumps you straight to where miner is defined. But you're right, we definitely need to think about the final config.toml docs that users will see. Here’s what I’m thinking:
- In the Rust code comments, let's stick to [`StructName::field_name`] everywhere. So, we'd always write [`NodeConfig::miner`] or [`BurnchainConfig::whatever`]. It's just one simple rule to follow.
- Then, we'll need a sort of script for auto-generating the TOML docs from the Configs. The original idea was to have this script ingest directly the rustdoc output. When it's creating the docs for the
NodeConfig
struct and it sees [`NodeConfig::miner`], it'll just putminer
in the TOML doc. Nice and clean for the TOML.
And if we reference something from another struct, say NodeConfig
talks about [`BurnchainConfig::some_setting`], the script could turn that into something like [burnchain].some_setting (I am open to better suggestions for it though!) in the TOML. So it clearly points to the right spot in the TOML.
Basically, we keep the full [`StructName::field_name`] in the code for our own benefit (the links!). Then, the script takes care of making the final TOML documentation look good and easy to understand for anyone reading that.
This way, we get those useful developer links and clean TOML docs without having to write comments differently all the time.
What do you all think?
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 explaining. Your plan sounds good to me!
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.
In VS Code, I see that these link to the https://docs.rs site, not to the local definition. If that's the case, we should also make an effort to publish a crate so that our docs are available on https://docs.rs.
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.
Glad the plan sounds good! That's interesting about VS Code linking to docs.rs for you. On my setup, when I Ctrl+Click on a link like [`NodeConfig::miner`] directly within the code comments, VS Code with Rust Analyzer jumps directly to the local definition of miner within the NodeConfig struct in my workspace. But maybe I'm misunderstanding the specific context where you saw 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.
This looks good, I just had some minor comments.
I think these descriptive comments should also be added to the NodeConfigFile
struct, since this would be the one that would be most important to extract into documentation for users. Maybe it is less important to document the default values on NodeConfig
and more important to show that on NodeConfigFile
, since it would be shown to users trying to understand the config file.
stackslib/src/config/mod.rs
Outdated
pub stacker: bool, | ||
/// Enables a simulated mining mode, primarily for local testing and development. | ||
/// When `true`, *and* [`NodeConfig::miner`] is also `true`, the node may generate blocks |
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.
or maybe just "and miner
is also true", since the context should be clear that it is referring to the above field.
stackslib/src/config/mod.rs
Outdated
pub mine_microblocks: bool, | ||
/// How often to attempt producing microblocks, in milliseconds (pre-Nakamoto). | ||
/// Only applies when `mine_microblocks` is true and before Epoch 3.0. |
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.
Microblocks were disabled in 2.5 (See #4561). This applies to other mentions about 3.0 and microblocks.
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 the info! I didn't know, I just thought they were deprecated because of Nakamoto! Changed in 723f16e
stackslib/src/config/mod.rs
Outdated
/// | ||
/// Default value of 10 seconds is reasonable in mainnet (where bitcoin blocks are ~10 minutes), | ||
/// but environments where burn blocks are more frequent may want to decrease this value. | ||
/// Default: `10_000` (10 seconds) |
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.
Let's make this consistent -- either include the (X seconds)
on all of the ms parameters, or on none of them.
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.
added to all, 723f16e
Per discussion in the Nakamoto sync, let's leave the comments as-is for now, and in a separate issue, we will work on merging the two versions of the config structs. |
@obycode Unfortunately, I couldn't attend today's sync :( , but your first comment is interesting because I actually came to a similar conclusion about where the docs might best live. When I worked on Given that, I'd be open to move the documentation to the Of course, I'm also perfectly fine sticking to the plan from the sync if that's preferred, and then we can address it all during the struct merge. Either way, great idea merging the two struct versions in the long run. It'll definitely simplify things and make the config handling clearer. We'll just have to decine on a strategy for the internal-only fields, but that's for the future discussion. |
As per discussion in today's Naka sync, we'll keep the comments in the "non-file" structs, because the comments will be useful for the developers. We'll try to achieve the merging of the Config structs in the near future. |
Description
Add documentation for all
NodeConfig
paramtersApplicable issues
Additional info (benefits, drawbacks, caveats)
Checklist
docs/rpc/openapi.yaml
andrpc-endpoints.md
for v2 endpoints,event-dispatcher.md
for new events)clarity-benchmarking
repobitcoin-tests.yml