Skip to content

Commit a592fb7

Browse files
committed
standardize testing and miner properties docs
1 parent d095dee commit a592fb7

File tree

1 file changed

+59
-21
lines changed

1 file changed

+59
-21
lines changed

stackslib/src/config/mod.rs

Lines changed: 59 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,36 +1219,54 @@ pub struct BurnchainConfig {
12191219
/// This setting determines network parameters (like chain ID, peer version),
12201220
/// default configurations, genesis block definitions, and overall node behavior.
12211221
///
1222-
/// Supported values: `"mainnet"`, `"mocknet"`, `"helium"`, `"neon"`, `"argon"`, `"krypton"`, `"xenon"`, `"nakamoto-neon"`.
1222+
/// Supported values:
1223+
/// ```text
1224+
/// | Mode | Network Type |
1225+
/// |-----------------|--------------|
1226+
/// | "mainnet" | mainnet |
1227+
/// | "xenon" | testnet |
1228+
/// | "mocknet" | regtest |
1229+
/// | "helium" | regtest |
1230+
/// | "neon" | regtest |
1231+
/// | "argon" | regtest |
1232+
/// | "krypton" | regtest |
1233+
/// | "nakamoto-neon" | regtest |
1234+
/// ```
12231235
///
12241236
/// Default: `"mocknet"`
12251237
pub mode: String,
1226-
/// The network-specific identifier used in P2P communication and database initialization .
1238+
/// The network-specific identifier used in P2P communication and database initialization.
12271239
/// Derived from `mode` during config load, unless explicitly overridden (for test purposes).
12281240
///
1241+
/// **Warning:** Do not modify this unless you really know what you're doing.
1242+
/// This is intended strictly for testing purposes.
1243+
///
12291244
/// Default: Derived from [`BurnchainConfig::mode`] ([`CHAIN_ID_MAINNET`] for `mainnet`, [`CHAIN_ID_TESTNET`] otherwise).
12301245
pub chain_id: u32,
12311246
/// The peer protocol version number used in P2P communication.
12321247
/// This parameter cannot be set via the configuration file.
12331248
///
1249+
/// **Warning:** Do not modify this unless you really know what you're doing.
1250+
///
12341251
/// Default: Derived from [`BurnchainConfig::mode`] ([`PEER_VERSION_MAINNET`] for `mainnet`, [`PEER_VERSION_TESTNET`] otherwise).
12351252
pub peer_version: u32,
12361253
/// Specifies a mandatory wait period (in milliseconds) after receiving a burnchain tip
12371254
/// before the node attempts to build the anchored block for the new tenure.
12381255
/// This duration effectively schedules the start of the block-building
12391256
/// process relative to the tip's arrival time.
1240-
/// Only when [`BurnchainConfig::mode`] is `"helium"` or `"mocknet"`.
1257+
///
1258+
/// This is intended strictly for testing purposes.
12411259
///
12421260
/// Default: `5000` milliseconds.
12431261
/// `10000` milliseconds when launched with the `helium` or `mocknet` subcommands.
12441262
pub commit_anchor_block_within: u64,
12451263
/// The Maximum amount (in sats) of "burn commitment" to broadcast for the next block's leader election.
1246-
/// Acts as a safety cap to limit the maximum amount spent on mining.
1247-
///
1264+
/// Acts as a safety cap to limit the maximum amount spent on mining.
12481265
/// It serves as both the target fee and a fallback if dynamic fee calculations fail or cannot be performed
12491266
///
1250-
/// This setting can be hot-reloaded from a miner's config file, allowing adjustment without restarting.
1251-
/// Primarily relevant for miners.
1267+
/// This setting can be hot-reloaded from the config file, allowing adjustment without restarting.
1268+
///
1269+
/// Only relevant if [`NodeConfig::miner`] is `true`.
12521270
///
12531271
/// Default: `20000` satoshis
12541272
pub burn_fee_cap: u64,
@@ -1292,24 +1310,32 @@ pub struct BurnchainConfig {
12921310
/// These two-byte identifiers help ensure that nodes only connect to peers on the same network type.
12931311
/// Common values include:
12941312
/// - "X2" for mainnet
1295-
/// - "T2" for Xenon testnet
1313+
/// - "T2" for testnet (xenon)
12961314
/// - Other values for specific test networks
12971315
///
12981316
/// Configured as a 2-character ASCII string (e.g., "X2" for mainnet).
12991317
///
1300-
/// Default: [`BLOCKSTACK_MAGIC_MAINNET`] (corresponds to "X2") unless overridden by [`BurnchainConfig::mode`] (e.g., "T2" for Xenon testnet).
1318+
/// Default: [`BLOCKSTACK_MAGIC_MAINNET`] (corresponds to "X2") unless overridden by [`BurnchainConfig::mode`] (e.g., "T2" for testnet (xenon)).
13011319
pub magic_bytes: MagicBytes,
1302-
/// The public key associated with the local mining address.
1303-
/// Provided as a hex string representing a public key.
1304-
/// This is intended strictly for testing purposes. Only used for [`BurnchainConfig::mode`] "helium".
1320+
/// The public key associated with the local mining address for the underlying Bitcoin regtest node.
1321+
/// Provided as a hex string representing an uncompressed public key.
1322+
///
1323+
/// It is primarily used in modes that rely on a controlled Bitcoin regtest backend
1324+
/// (e.g., "helium", "mocknet", "neon") where the Stacks node itself needs to
1325+
/// instruct the Bitcoin node to generate blocks.
1326+
///
1327+
/// The key is used to derive the Bitcoin address that receives the coinbase rewards
1328+
/// when generating blocks on the regtest network.
13051329
///
1306-
/// Used to derive the mining address for generating and receiving coinbase rewards.
1330+
/// Mandatory if [`BurnchainConfig::mode`] is "helium".
1331+
/// This is intended strictly for testing purposes.
13071332
///
13081333
/// Default: `None`
13091334
pub local_mining_public_key: Option<String>,
13101335
/// Optional bitcoin block height at which the Stacks node process should gracefully exit.
13111336
/// When bitcoin reaches this height, the node logs a message and initiates a graceful shutdown.
13121337
///
1338+
/// Applied only if [`BurnchainConfig::mode`] is not "mainnet".
13131339
/// This is intended strictly for testing purposes.
13141340
///
13151341
/// Default: `None`
@@ -1323,33 +1349,38 @@ pub struct BurnchainConfig {
13231349
pub poll_time_secs: u64,
13241350
/// The default fee rate in satoshis per virtual byte (sats/vB) to use when estimating fees for miners
13251351
/// to submit bitcoin transactions (like block commits or leader key registrations).
1326-
/// Primarily relevant for miners.
1352+
///
1353+
/// Only relevant if [`NodeConfig::miner`] is `true`.
13271354
///
13281355
/// Default: [`DEFAULT_SATS_PER_VB`] (currently 50 satoshis per virtual byte)
13291356
pub satoshis_per_byte: u64,
13301357
/// Maximum fee rate multiplier allowed when using Replace-By-Fee (RBF) for bitcoin transactions.
13311358
/// Expressed as a percentage of the original [`BurnchainConfig::satoshis_per_byte`] rate (e.g.,
13321359
/// 150 means the fee rate can be increased up to 1.5x). Used in mining logic for RBF decisions
13331360
/// to cap the replacement fee rate.
1334-
/// Primarily relevant for miners.
1361+
///
1362+
/// Only relevant if [`NodeConfig::miner`] is `true`.
13351363
///
13361364
/// Default: [`DEFAULT_MAX_RBF_RATE`] (currently 150, i.e., 1.5x)
13371365
pub max_rbf: u64,
13381366
/// Estimated size (in virtual bytes) of a leader key registration transaction on bitcoin.
13391367
/// Used for fee calculation in mining logic by multiplying with the fee rate [`BurnchainConfig::satoshis_per_byte`].
1340-
/// Primarily relevant for miners.
1368+
///
1369+
/// Only relevant if [`NodeConfig::miner`] is `true`.
13411370
///
13421371
/// Default: [`OP_TX_LEADER_KEY_ESTIM_SIZE`] (currently 290)
13431372
pub leader_key_tx_estimated_size: u64,
13441373
/// Estimated size (in virtual bytes) of a block commit transaction on bitcoin.
13451374
/// Used for fee calculation in mining logic by multiplying with the fee rate [`BurnchainConfig::satoshis_per_byte`].
1346-
/// Primarily relevant for miners.
1375+
///
1376+
/// Only relevant if [`NodeConfig::miner`] is `true`.
13471377
///
13481378
/// Default: [`OP_TX_BLOCK_COMMIT_ESTIM_SIZE`] (currently 380)
13491379
pub block_commit_tx_estimated_size: u64,
13501380
/// The incremental amount (in Sats/vByte) to add to the previous transaction's
13511381
/// fee rate for RBF bitcoin transactions.
1352-
/// Primarily relevant for miners.
1382+
///
1383+
/// Only relevant if [`NodeConfig::miner`] is `true`.
13531384
///
13541385
/// Default: [`DEFAULT_RBF_FEE_RATE_INCREMENT`] (currently 5 satoshis per virtual byte)
13551386
pub rbf_fee_increment: u64,
@@ -1426,18 +1457,21 @@ pub struct BurnchainConfig {
14261457
/// - However, the height specified in `epochs` for Epoch 2.1 takes precedence.
14271458
///
14281459
/// Applied only if [`BurnchainConfig::mode`] is not "mainnet".
1460+
/// This is intended strictly for testing purposes.
14291461
///
14301462
/// Default: `None`.
14311463
pub pox_2_activation: Option<u32>,
14321464
/// Overrides the length (in bitcoin blocks) of the PoX reward cycle.
14331465
///
14341466
/// Applied only if [`BurnchainConfig::mode`] is not "mainnet".
1467+
/// This is intended strictly for testing purposes.
14351468
///
14361469
/// Default: `None` (uses the standard reward cycle length for the mode).
14371470
pub pox_reward_length: Option<u32>,
14381471
/// Overrides the length (in bitcoin blocks) of the PoX prepare phase.
14391472
///
14401473
/// Applied only if [`BurnchainConfig::mode`] is not "mainnet".
1474+
/// This is intended strictly for testing purposes.
14411475
///
14421476
/// Default: `None` (uses the standard prepare phase length for the mode).
14431477
pub pox_prepare_length: Option<u32>,
@@ -1447,6 +1481,7 @@ pub struct BurnchainConfig {
14471481
/// testing the PoX sunset transition by explicitly setting its start height.
14481482
///
14491483
/// Applied only if [`BurnchainConfig::mode`] is not "mainnet".
1484+
/// This is intended strictly for testing purposes.
14501485
///
14511486
/// Default: `None` (uses the standard sunset start height for the mode).
14521487
/// Deprecated: The sunset phase was removed in Epoch 2.1. This parameter can still be used for testing purposes for epochs before 2.1.
@@ -1457,6 +1492,7 @@ pub struct BurnchainConfig {
14571492
/// with `sunset_start` to define the full sunset transition period for PoX.
14581493
///
14591494
/// Applied only if [`BurnchainConfig::mode`] is not "mainnet".
1495+
/// This is intended strictly for testing purposes.
14601496
///
14611497
/// Default: `None` (uses the standard sunset end height for the mode).
14621498
/// Deprecated: The sunset phase was removed in Epoch 2.1. This parameter can still be used for testing purposes for epochs before 2.1.
@@ -1465,7 +1501,7 @@ pub struct BurnchainConfig {
14651501
/// Used to interact with a specific named wallet if the bitcoin node manages multiple wallets.
14661502
///
14671503
/// If the specified wallet doesn't exist, the node will attempt to create it via the createwallet RPC call.
1468-
/// This is particularly useful for miners who need to manage separate wallets for testing or organizational purposes.
1504+
/// This is particularly useful for miners who need to manage separate wallets.
14691505
///
14701506
/// Primarily relevant for miners interacting with multi-wallet Bitcoin nodes.
14711507
///
@@ -1506,7 +1542,8 @@ pub struct BurnchainConfig {
15061542
pub affirmation_overrides: HashMap<u64, AffirmationMap>,
15071543
/// Fault injection setting for testing. Introduces an artificial delay (in milliseconds)
15081544
/// before processing each burnchain block download. Simulates a slow burnchain connection.
1509-
/// Only intended for testing environments.
1545+
///
1546+
/// This is intended strictly for testing purposes.
15101547
///
15111548
/// Default: `0` (no delay).
15121549
pub fault_injection_burnchain_block_delay: u64,
@@ -1522,7 +1559,8 @@ pub struct BurnchainConfig {
15221559
/// for a transaction, even if sufficient funds exist across more UTXOs not returned by the limited query.
15231560
///
15241561
/// This value must be `<= 1024`.
1525-
/// Primarily relevant for miners.
1562+
///
1563+
/// Only relevant if [`NodeConfig::miner`] is `true`.
15261564
///
15271565
/// Default: `Some(1024)`
15281566
pub max_unspent_utxos: Option<u64>,

0 commit comments

Comments
 (0)