Skip to content

Commit fb4ee3e

Browse files
committed
node: Fix weight documentation and remove dead firehose weight
- Document that weight 0.0 is intentional (disables from weighted selection while keeping the provider for error-retesting) - Fix contradictory example in full_config.toml that showed weights >1.0 despite validation rejecting them - Remove weight from firehose provider config since it is only used for RPC providers
1 parent e2a9c8e commit fb4ee3e

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

node/resources/tests/full_config.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,17 @@ ingestor = "index_0"
4949
# - Weights must be between 0.0 and 1.0 (inclusive)
5050
# - Weights are relative - they don't need to sum to 1.0
5151
# - Traffic is distributed proportionally based on weights
52-
# - Example: weights [0.2, 0.8] = 20% and 80% traffic distribution
53-
# - Example: weights [1.0, 2.0, 1.0] = 25%, 50%, 25% distribution
52+
# - Example: weights [0.3, 0.5, 0.2] = 30%, 50%, 20% traffic distribution
5453
# - At least one provider must have weight > 0.0
54+
# - Weight is only used for RPC providers; it is ignored for firehose providers
5555
[chains.mainnet]
5656
shard = "primary"
5757
amp = "ethereum-mainnet"
5858
provider = [
5959
{ label = "mainnet-0", url = "http://rpc.mainnet.io", features = ["archive", "traces"], weight = 0.1 },
6060
{ label = "mainnet-1", details = { type = "web3call", url = "http://rpc.mainnet.io", features = ["archive", "traces"] }, weight = 0.2 },
6161
{ label = "mainnet-2", details = { type = "web3", url = "http://rpc.mainnet.io", features = ["archive", "compression/gzip"] }, weight = 0.3 },
62-
{ label = "firehose", details = { type = "firehose", url = "http://localhost:9000", features = [] }, weight = 0.3 },
62+
{ label = "firehose", details = { type = "firehose", url = "http://localhost:9000", features = [] } },
6363
]
6464

6565
[chains.ropsten]

node/src/config.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,8 @@ const DEFAULT_PROVIDER_FEATURES: [&str; 2] = ["traces", "archive"];
815815
impl Provider {
816816
fn validate(&mut self) -> Result<()> {
817817
validate_name(&self.label).context("illegal provider name")?;
818+
// Weight of 0.0 is intentional: it disables the provider from weighted selection
819+
// while keeping it available for error-retesting and non-weighted fallback paths.
818820
if self.weight < 0.0 || self.weight > 1.0 {
819821
bail!("provider {} must have a weight between 0 and 1", self.label);
820822
}

0 commit comments

Comments
 (0)