@@ -3805,12 +3805,97 @@ impl NodeConfigFile {
3805
3805
#[ derive( Clone , Deserialize , Default , Debug ) ]
3806
3806
#[ serde( deny_unknown_fields) ]
3807
3807
pub struct FeeEstimationConfigFile {
3808
+ /// Specifies the name of the cost estimator to use.
3809
+ /// This controls how the node estimates computational costs for transactions.
3810
+ ///
3811
+ /// Accepted values:
3812
+ /// - `"NaivePessimistic"`: The only currently supported cost estimator. This estimator
3813
+ /// tracks the highest observed costs for each operation type and uses the average
3814
+ /// of the top 10 values as its estimate, providing a conservative approach to
3815
+ /// cost estimation.
3816
+ ///
3817
+ /// If not specified, or if [`FeeEstimationConfigFile::disabled`] is `true`,
3818
+ /// the node will use the default cost estimator.
3819
+ ///
3820
+ /// Default: `"NaivePessimistic"`
3808
3821
pub cost_estimator : Option < String > ,
3822
+ /// Specifies the name of the fee estimator to use.
3823
+ /// This controls how the node calculates appropriate transaction fees based on costs.
3824
+ ///
3825
+ /// Accepted values:
3826
+ /// - `"ScalarFeeRate"`: Simple multiplier-based fee estimation that uses percentiles
3827
+ /// (5th, 50th, and 95th) of observed fee rates from recent blocks.
3828
+ /// - `"FuzzedWeightedMedianFeeRate"`: Fee estimation that adds controlled randomness
3829
+ /// to a weighted median rate calculator. This helps prevent fee optimization attacks
3830
+ /// by adding unpredictability to fee estimates while still maintaining accuracy.
3831
+ ///
3832
+ /// If not specified, or if [`FeeEstimationConfigFile::disabled`] is `true`,
3833
+ /// the node will use the default fee estimator.
3834
+ ///
3835
+ /// Default: `"ScalarFeeRate"`
3809
3836
pub fee_estimator : Option < String > ,
3837
+ /// Specifies the name of the cost metric to use.
3838
+ /// This controls how the node measures and compares transaction costs.
3839
+ ///
3840
+ /// Accepted values:
3841
+ /// - `"ProportionDotProduct"`: The only currently supported cost metric. This metric
3842
+ /// computes a weighted sum of cost dimensions (runtime, read/write counts, etc.)
3843
+ /// proportional to how much of the block limit they consume.
3844
+ ///
3845
+ /// If not specified, or if [`FeeEstimationConfigFile::disabled`] is `true`,
3846
+ /// the node will use the default cost metric.
3847
+ ///
3848
+ /// Default: `"ProportionDotProduct"`
3810
3849
pub cost_metric : Option < String > ,
3850
+ /// If `true`, all fee and cost estimation features are disabled.
3851
+ /// The node will use unit estimators and metrics, which effectively
3852
+ /// provide no actual estimation capabilities.
3853
+ ///
3854
+ /// When disabled, the node will:
3855
+ /// 1. Not track historical transaction costs or fee rates
3856
+ /// 2. Return simple unit values for costs for any transaction, regardless of its actual complexity
3857
+ /// 3. Be unable to provide meaningful fee estimates for API requests (always returns an error)
3858
+ /// 4. Consider only raw transaction fees (not fees per cost unit) when assembling blocks
3859
+ ///
3860
+ /// This setting takes precedence over individual estimator/metric configurations.
3861
+ /// When `true`, the values for [`FeeEstimationConfigFile::cost_estimator`],
3862
+ /// [`FeeEstimationConfigFile::fee_estimator`], and [`FeeEstimationConfigFile::cost_metric`]
3863
+ /// are ignored and treated as `None`.
3864
+ ///
3865
+ /// Default: `false`
3811
3866
pub disabled : Option < bool > ,
3867
+ /// If `true`, errors encountered during cost or fee estimation will be logged.
3868
+ /// This can help diagnose issues with the fee estimation subsystem.
3869
+ ///
3870
+ /// Default: `false`
3812
3871
pub log_error : Option < bool > ,
3872
+ /// Specifies the fraction of random noise to add if using the `FuzzedWeightedMedianFeeRate` fee estimator.
3873
+ /// This value should be in the range [0, 1], representing a percentage of the base fee rate.
3874
+ ///
3875
+ /// For example, with a value of 0.1 (10%), fee rate estimates will have random noise added
3876
+ /// within the range of ±10% of the original estimate. This randomization makes it difficult
3877
+ /// for users to precisely optimize their fees while still providing reasonable estimates.
3878
+ ///
3879
+ /// This setting is only relevant when [`FeeEstimationConfigFile::fee_estimator`] is set to
3880
+ /// `"FuzzedWeightedMedianFeeRate"`. It controls how much randomness is introduced in the
3881
+ /// fee estimation process to prevent fee optimization attacks.
3882
+ ///
3883
+ /// Default: `0.1` (10%)
3813
3884
pub fee_rate_fuzzer_fraction : Option < f64 > ,
3885
+ /// Specifies the window size for the [`WeightedMedianFeeRateEstimator`].
3886
+ /// This determines how many historical fee rate data points are considered
3887
+ /// when calculating the median fee rate.
3888
+ ///
3889
+ /// The window size controls how quickly the fee estimator responds to changing
3890
+ /// network conditions. A smaller window size (e.g., 5) makes the estimator more
3891
+ /// responsive to recent fee rate changes but potentially more volatile. A larger
3892
+ /// window size (e.g., 10) produces more stable estimates but may be slower to
3893
+ /// adapt to rapid network changes.
3894
+ ///
3895
+ /// This setting is primarily relevant when [`FeeEstimationConfigFile::fee_estimator`] is set to
3896
+ /// `"FuzzedWeightedMedianFeeRate"`, as it's used by the underlying [`WeightedMedianFeeRateEstimator`].
3897
+ ///
3898
+ /// Default: `5`
3814
3899
pub fee_rate_window_size : Option < u64 > ,
3815
3900
}
3816
3901
0 commit comments