@@ -170,6 +170,28 @@ pub struct ConfigFile {
170
170
pub __path : Option < String > , // Only used for config file reloads
171
171
pub burnchain : Option < BurnchainConfigFile > ,
172
172
pub node : Option < NodeConfigFile > ,
173
+ /// Represents an initial STX balance allocation for an address at genesis
174
+ /// for testing purposes.
175
+ ///
176
+ /// This struct is used to define pre-allocated STX balances that are credited to
177
+ /// specific addresses when the Stacks node first initializes its chainstate. These balances
178
+ /// are included in the genesis block and are immediately available for spending.
179
+ ///
180
+ /// **Configuration:**
181
+ /// Configured as a list `[[ustx_balance]]` in TOML.
182
+ ///
183
+ /// Example TOML entry:
184
+ /// ```toml
185
+ /// [[ustx_balance]]
186
+ /// address = "ST2QKZ4FKHAH1NQKYKYAYZPY440FEPK7GZ1R5HBP2"
187
+ /// amount = 10000000000000000
188
+ /// ```
189
+ ///
190
+ /// This is intended strictly for testing purposes.
191
+ /// Attempting to specify initial balances if [`BurnchainConfig::mode`] is "mainnet" will
192
+ /// result in an invalid config error.
193
+ ///
194
+ /// Default: `None`
173
195
pub ustx_balance : Option < Vec < InitialBalanceFile > > ,
174
196
/// Deprecated: use `ustx_balance` instead
175
197
pub mstx_balance : Option < Vec < InitialBalanceFile > > ,
@@ -3784,12 +3806,97 @@ impl NodeConfigFile {
3784
3806
#[ derive( Clone , Deserialize , Default , Debug ) ]
3785
3807
#[ serde( deny_unknown_fields) ]
3786
3808
pub struct FeeEstimationConfigFile {
3809
+ /// Specifies the name of the cost estimator to use.
3810
+ /// This controls how the node estimates computational costs for transactions.
3811
+ ///
3812
+ /// Accepted values:
3813
+ /// - `"NaivePessimistic"`: The only currently supported cost estimator. This estimator
3814
+ /// tracks the highest observed costs for each operation type and uses the average
3815
+ /// of the top 10 values as its estimate, providing a conservative approach to
3816
+ /// cost estimation.
3817
+ ///
3818
+ /// If not specified, or if [`FeeEstimationConfigFile::disabled`] is `true`,
3819
+ /// the node will use the default cost estimator.
3820
+ ///
3821
+ /// Default: `"NaivePessimistic"`
3787
3822
pub cost_estimator : Option < String > ,
3823
+ /// Specifies the name of the fee estimator to use.
3824
+ /// This controls how the node calculates appropriate transaction fees based on costs.
3825
+ ///
3826
+ /// Accepted values:
3827
+ /// - `"ScalarFeeRate"`: Simple multiplier-based fee estimation that uses percentiles
3828
+ /// (5th, 50th, and 95th) of observed fee rates from recent blocks.
3829
+ /// - `"FuzzedWeightedMedianFeeRate"`: Fee estimation that adds controlled randomness
3830
+ /// to a weighted median rate calculator. This helps prevent fee optimization attacks
3831
+ /// by adding unpredictability to fee estimates while still maintaining accuracy.
3832
+ ///
3833
+ /// If not specified, or if [`FeeEstimationConfigFile::disabled`] is `true`,
3834
+ /// the node will use the default fee estimator.
3835
+ ///
3836
+ /// Default: `"ScalarFeeRate"`
3788
3837
pub fee_estimator : Option < String > ,
3838
+ /// Specifies the name of the cost metric to use.
3839
+ /// This controls how the node measures and compares transaction costs.
3840
+ ///
3841
+ /// Accepted values:
3842
+ /// - `"ProportionDotProduct"`: The only currently supported cost metric. This metric
3843
+ /// computes a weighted sum of cost dimensions (runtime, read/write counts, etc.)
3844
+ /// proportional to how much of the block limit they consume.
3845
+ ///
3846
+ /// If not specified, or if [`FeeEstimationConfigFile::disabled`] is `true`,
3847
+ /// the node will use the default cost metric.
3848
+ ///
3849
+ /// Default: `"ProportionDotProduct"`
3789
3850
pub cost_metric : Option < String > ,
3851
+ /// If `true`, all fee and cost estimation features are disabled.
3852
+ /// The node will use unit estimators and metrics, which effectively
3853
+ /// provide no actual estimation capabilities.
3854
+ ///
3855
+ /// When disabled, the node will:
3856
+ /// 1. Not track historical transaction costs or fee rates
3857
+ /// 2. Return simple unit values for costs for any transaction, regardless of its actual complexity
3858
+ /// 3. Be unable to provide meaningful fee estimates for API requests (always returns an error)
3859
+ /// 4. Consider only raw transaction fees (not fees per cost unit) when assembling blocks
3860
+ ///
3861
+ /// This setting takes precedence over individual estimator/metric configurations.
3862
+ /// When `true`, the values for [`FeeEstimationConfigFile::cost_estimator`],
3863
+ /// [`FeeEstimationConfigFile::fee_estimator`], and [`FeeEstimationConfigFile::cost_metric`]
3864
+ /// are ignored and treated as `None`.
3865
+ ///
3866
+ /// Default: `false`
3790
3867
pub disabled : Option < bool > ,
3868
+ /// If `true`, errors encountered during cost or fee estimation will be logged.
3869
+ /// This can help diagnose issues with the fee estimation subsystem.
3870
+ ///
3871
+ /// Default: `false`
3791
3872
pub log_error : Option < bool > ,
3873
+ /// Specifies the fraction of random noise to add if using the `FuzzedWeightedMedianFeeRate` fee estimator.
3874
+ /// This value should be in the range [0, 1], representing a percentage of the base fee rate.
3875
+ ///
3876
+ /// For example, with a value of 0.1 (10%), fee rate estimates will have random noise added
3877
+ /// within the range of ±10% of the original estimate. This randomization makes it difficult
3878
+ /// for users to precisely optimize their fees while still providing reasonable estimates.
3879
+ ///
3880
+ /// This setting is only relevant when [`FeeEstimationConfigFile::fee_estimator`] is set to
3881
+ /// `"FuzzedWeightedMedianFeeRate"`. It controls how much randomness is introduced in the
3882
+ /// fee estimation process to prevent fee optimization attacks.
3883
+ ///
3884
+ /// Default: `0.1` (10%)
3792
3885
pub fee_rate_fuzzer_fraction : Option < f64 > ,
3886
+ /// Specifies the window size for the [`WeightedMedianFeeRateEstimator`].
3887
+ /// This determines how many historical fee rate data points are considered
3888
+ /// when calculating the median fee rate.
3889
+ ///
3890
+ /// The window size controls how quickly the fee estimator responds to changing
3891
+ /// network conditions. A smaller window size (e.g., 5) makes the estimator more
3892
+ /// responsive to recent fee rate changes but potentially more volatile. A larger
3893
+ /// window size (e.g., 10) produces more stable estimates but may be slower to
3894
+ /// adapt to rapid network changes.
3895
+ ///
3896
+ /// This setting is primarily relevant when [`FeeEstimationConfigFile::fee_estimator`] is set to
3897
+ /// `"FuzzedWeightedMedianFeeRate"`, as it's used by the underlying [`WeightedMedianFeeRateEstimator`].
3898
+ ///
3899
+ /// Default: `5`
3793
3900
pub fee_rate_window_size : Option < u64 > ,
3794
3901
}
3795
3902
@@ -4047,9 +4154,118 @@ impl AtlasConfigFile {
4047
4154
#[ derive( Clone , Deserialize , Default , Debug , Hash , PartialEq , Eq , PartialOrd ) ]
4048
4155
#[ serde( deny_unknown_fields) ]
4049
4156
pub struct EventObserverConfigFile {
4157
+ /// URL endpoint (hostname and port) where event notifications will be sent via HTTP POST requests.
4158
+ ///
4159
+ /// The node will automatically prepend `http://` to this endpoint and append the
4160
+ /// specific event path (e.g., `/new_block`, `/new_mempool_tx`).
4161
+ /// Therefore, this value should be specified as `hostname:port` (e.g., "localhost:3700").
4162
+ ///
4163
+ /// **Do NOT include the `http://` scheme in this configuration value.**
4164
+ ///
4165
+ /// This should point to a service capable of receiving and processing Stacks event data.
4166
+ ///
4167
+ /// Default: No default. This field is required.
4050
4168
pub endpoint : String ,
4169
+ /// List of event types that this observer is configured to receive.
4170
+ ///
4171
+ /// For a more detailed documentation check the event-dispatcher docs in the `/docs` folder.
4172
+ ///
4173
+ /// Each string in the list specifies an event category or a specific event to subscribe to.
4174
+ /// For an observer to receive any notifications, this list must contain at least one valid key.
4175
+ /// Providing an invalid string that doesn't match any of the valid formats below will cause
4176
+ /// the node to panic on startup when parsing the configuration.
4177
+ ///
4178
+ /// All observers, regardless of their `events_keys` configuration, implicitly receive
4179
+ /// payloads on the `/attachments/new` endpoint.
4180
+ ///
4181
+ /// **Valid Event Keys:**
4182
+ ///
4183
+ /// - `"*"`: Subscribes to a broad set of common events.
4184
+ /// - **Events delivered to:**
4185
+ /// - `/new_block`: For blocks containing transactions that generate STX, FT, NFT, or smart contract events.
4186
+ /// - `/new_microblocks`: For all new microblock streams. **Note:** Only until epoch 2.5.
4187
+ /// - `/new_mempool_tx`: For new mempool transactions.
4188
+ /// - `/drop_mempool_tx`: For dropped mempool transactions.
4189
+ /// - `/new_burn_block`: For new burnchain blocks.
4190
+ /// - **Note:** This key does NOT by itself subscribe to `/stackerdb_chunks` or `/proposal_response`.
4191
+ ///
4192
+ /// - `"stx"`: Subscribes to STX token operation events (transfer, mint, burn, lock).
4193
+ /// - **Events delivered to:** `/new_block`, `/new_microblocks`.
4194
+ /// - **Payload details:** The "events" array in the delivered payloads will be filtered to include only STX-related events.
4195
+ ///
4196
+ /// - `"memtx"`: Subscribes to new and dropped mempool transaction events.
4197
+ /// - **Events delivered to:** `/new_mempool_tx`, `/drop_mempool_tx`.
4198
+ ///
4199
+ /// - `"burn_blocks"`: Subscribes to new burnchain block events.
4200
+ /// - **Events delivered to:** `/new_burn_block`.
4201
+ ///
4202
+ /// - `"microblocks"`: Subscribes to new microblock stream events.
4203
+ /// - **Events delivered to:** `/new_microblocks`.
4204
+ /// - **Payload details:**
4205
+ /// - The "transactions" field will contain all transactions from the microblocks.
4206
+ /// - The "events" field will contain STX, FT, NFT, or specific smart contract events
4207
+ /// *only if* this observer is also subscribed to those more specific event types
4208
+ /// (e.g., via `"stx"`, `"*"`, a specific contract event key, or a specific asset identifier key).
4209
+ /// - **Note:** Only until epoch 2.5.
4210
+ ///
4211
+ /// - `"stackerdb"`: Subscribes to StackerDB chunk update events.
4212
+ /// - **Events delivered to:** `/stackerdb_chunks`.
4213
+ ///
4214
+ /// - `"block_proposal"`: Subscribes to block proposal response events (for Nakamoto consensus).
4215
+ /// - **Events delivered to:** `/proposal_response`.
4216
+ ///
4217
+ /// - **Smart Contract Event**: Subscribes to a specific smart contract event.
4218
+ /// - **Format:** `"{contract_address}.{contract_name}::{event_name}"`
4219
+ /// (e.g., `ST0000000000000000000000000000000000000000.my-contract::my-custom-event`)
4220
+ /// - **Events delivered to:** `/new_block`, `/new_microblocks`.
4221
+ /// - **Payload details:** The "events" array in the delivered payloads will be filtered for this specific event.
4222
+ ///
4223
+ /// - **Asset Identifier for FT/NFT Events**: Subscribes to events (mint, burn, transfer) for a specific Fungible Token (FT) or Non-Fungible Token (NFT).
4224
+ /// - **Format:** `"{contract_address}.{contract_name}.{asset_name}"`
4225
+ /// (e.g., for an FT: `ST0000000000000000000000000000000000000000.my-ft-contract.my-fungible-token`)
4226
+ /// - **Events delivered to:** `/new_block`, `/new_microblocks`.
4227
+ /// - **Payload details:** The "events" array in the delivered payloads will be filtered for events related to the specified asset.
4228
+ ///
4229
+ /// **Configuration:**
4230
+ ///
4231
+ /// ```toml
4232
+ /// # Example events_keys in TOML configuration:
4233
+ /// events_keys = [
4234
+ /// "burn_blocks",
4235
+ /// "memtx",
4236
+ /// "ST0000000000000000000000000000000000000000.my-contract::my-custom-event", # Smart contract event
4237
+ /// "ST0000000000000000000000000000000000000000.token-contract.my-ft" # Fungible token asset event
4238
+ /// ]
4239
+ /// ```
4240
+ ///
4241
+ /// Default: No default. This field is required.
4051
4242
pub events_keys : Vec < String > ,
4243
+ /// Maximum duration (in milliseconds) to wait for the observer endpoint to respond.
4244
+ ///
4245
+ /// When the node sends an event notification to this observer, it will wait at most this long
4246
+ /// for a successful HTTP response (status code 200) before considering the request timed out.
4247
+ /// If a timeout occurs and retries are enabled (see [`EventObserverConfig::disable_retries`]),
4248
+ /// the request will be attempted again according to the retry strategy.
4249
+ ///
4250
+ /// Default: `1_000` ms (1 second).
4052
4251
pub timeout_ms : Option < u64 > ,
4252
+ /// Controls whether the node should retry sending event notifications if delivery fails or times out.
4253
+ ///
4254
+ /// - If `false` (default): The node will attempt to deliver event notifications persistently.
4255
+ /// If an attempt fails (due to network error, timeout, or a non-200 HTTP response), the event
4256
+ /// payload is saved and retried indefinitely. This ensures that all events will eventually be
4257
+ /// delivered. However, this can cause the node's block processing to stall if an observer is
4258
+ /// down, or indefinitely fails to process the event.
4259
+ ///
4260
+ /// - If `true`: The node will make only a single attempt to deliver each event notification.
4261
+ /// If this single attempt fails for any reason, the event is discarded, and no further retries
4262
+ /// will be made for that specific event.
4263
+ ///
4264
+ /// **Warning:** Setting this to `true` can lead to missed events if the observer endpoint is
4265
+ /// temporarily unavailable or experiences issues. This setting should only be used for observers
4266
+ /// where completeness of the event history is not critical.
4267
+ ///
4268
+ /// Default: `false` (retries are enabled).
4053
4269
pub disable_retries : Option < bool > ,
4054
4270
}
4055
4271
@@ -4152,7 +4368,15 @@ pub struct InitialBalance {
4152
4368
#[ derive( Clone , Deserialize , Default , Debug ) ]
4153
4369
#[ serde( deny_unknown_fields) ]
4154
4370
pub struct InitialBalanceFile {
4371
+ /// The Stacks address to receive the initial STX balance.
4372
+ /// Must be a valid "non-mainnet" Stacks address (e.g., "ST2QKZ4FKHAH1NQKYKYAYZPY440FEPK7GZ1R5HBP2").
4373
+ ///
4374
+ /// Default: No default. This field is required.
4155
4375
pub address : String ,
4376
+ /// The amount of microSTX to allocate to the address at node startup.
4377
+ /// 1 STX = 1_000_000 microSTX.
4378
+ ///
4379
+ /// Default: No default. This field is required.
4156
4380
pub amount : u64 ,
4157
4381
}
4158
4382
0 commit comments