Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions contrib/indexer-service/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,6 @@ deployment_id = \"$network_deployment\""; fi)
recently_closed_allocation_buffer_secs = 60
syncing_interval_secs = 30

[subgraphs.escrow]
query_url = "http://graph-node:8000/subgraphs/name/semiotic/tap"$(if [ -n "$escrow_deployment" ] && [ "$escrow_deployment" != "null" ]; then echo "
deployment_id = \"$escrow_deployment\""; fi)
syncing_interval_secs = 30

[blockchain]
chain_id = 1337
receipts_verifier_address = "${tap_verifier}"
Expand All @@ -85,7 +80,6 @@ free_query_auth_token = "freestuff"
host_and_port = "0.0.0.0:7601"
url_prefix = "/"
serve_network_subgraph = false
serve_escrow_subgraph = false


[service.tap]
Expand Down
6 changes: 0 additions & 6 deletions contrib/tap-agent/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,6 @@ deployment_id = \"$NETWORK_DEPLOYMENT\""; fi)
recently_closed_allocation_buffer_secs = 60
syncing_interval_secs = 30

[subgraphs.escrow]
query_url = "http://graph-node:${GRAPH_NODE_GRAPHQL}/subgraphs/name/semiotic/tap"$(if [ -n "$ESCROW_DEPLOYMENT" ] && [ "$ESCROW_DEPLOYMENT" != "null" ]; then echo "
deployment_id = \"$ESCROW_DEPLOYMENT\""; fi)
syncing_interval_secs = 30

[blockchain]
chain_id = 1337
receipts_verifier_address = "${tap_verifier}"
Expand All @@ -135,7 +130,6 @@ subgraph_service_address = "${subgraph_service}"
host_and_port = "0.0.0.0:${INDEXER_SERVICE}"
url_prefix = "/"
serve_network_subgraph = false
serve_escrow_subgraph = false


[service.tap]
Expand Down
4 changes: 0 additions & 4 deletions crates/config/default_values.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,9 @@ max_data_staleness_mins = 30
escrow_min_balance_grt_wei = "100000000000000000"
max_signers_per_payer = 0

[subgraphs.escrow]
syncing_interval_secs = 60

[service]
ipfs_url = "https://api.thegraph.com/ipfs/"
serve_network_subgraph = false
serve_escrow_subgraph = false
host_and_port = "0.0.0.0:7600"
url_prefix = "/"
max_cost_model_batch_size = 200
Expand Down
18 changes: 0 additions & 18 deletions crates/config/maximal-config-example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,22 +91,6 @@ escrow_min_balance_grt_wei = "100000000000000000"
# signers, orphaning receipts and enabling free queries.
max_signers_per_payer = 0

[subgraphs.escrow]
# NOTE: It is heavily recomended to use both `query_url` and `deployment_id`,
# Query URL for the Escrow subgraph (v1). This is the old escrow subgraph.
# NOTE: This is not used in v2, as the escrow subgraph is now in the network subgraph.
query_url = "http://example.com/escrow-subgraph"
# Optional, Auth token will used a "bearer auth"
# query_auth_token = "super-secret"

# Optional, deployment to look for in the local `graph-node`, if locally indexed.
# Locally indexing the subgraph is recommended.
deployment_id = "Qmaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
# Refreshing interval for the Escrow contracts information from the Escrow subgraph.
syncing_interval_secs = 60

# NOTE: V2 escrow accounts are now in the network subgraph, not a separate escrow_v2 subgraph

[blockchain]
# The chain ID of the network that the graph network is running on
chain_id = 1337
Expand All @@ -125,8 +109,6 @@ host_and_port = "0.0.0.0:7600"
url_prefix = "/"
# Serve the network subgraph on `common.server.host_and_port`/network
serve_network_subgraph = false
# Serve the escrow subgraph on `common.server.host_and_port`/escrow
serve_escrow_subgraph = false
#### OPTIONAL VALUES ####
## use this to add a layer while serving network/escrow subgraph
# serve_auth_token = "token"
Expand Down
8 changes: 0 additions & 8 deletions crates/config/minimal-config-example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,6 @@ query_url = "http://example.com/network-subgraph"
# NOTE: Use `query_url` or `deployment_id` only
deployment_id = "Qmaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"

[subgraphs.escrow]
# Query URL for the Escrow subgraph (v1).
query_url = "http://example.com/escrow-subgraph"
# Optional, deployment to look for in the local `graph-node`, if locally indexed.
# Locally indexing the subgraph is recommended.
# NOTE: Use `query_url` or `deployment_id` only
deployment_id = "Qmaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"

[blockchain]
# The chain ID of the network that the graph network is running on
chain_id = 1337
Expand Down
89 changes: 59 additions & 30 deletions crates/config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ pub struct Config {
pub service: ServiceConfig,
pub tap: TapConfig,
pub dips: Option<DipsConfig>,
/// Deprecated: Horizon is always enabled. This section is ignored.
#[serde(default)]
pub horizon: HorizonConfig,
}
Expand Down Expand Up @@ -223,30 +222,21 @@ impl Config {
}

// Validate syncing_interval_secs is not zero
if self.subgraphs.escrow.config.syncing_interval_secs == Duration::ZERO {
return Err(
"subgraphs.escrow.syncing_interval_secs must be greater than 0".to_string(),
);
}
if self.subgraphs.network.config.syncing_interval_secs == Duration::ZERO {
return Err(
"subgraphs.network.syncing_interval_secs must be greater than 0".to_string(),
);
}

if self.subgraphs.escrow.config.syncing_interval_secs < Duration::from_secs(10)
|| self.subgraphs.network.config.syncing_interval_secs < Duration::from_secs(10)
{
if self.subgraphs.network.config.syncing_interval_secs < Duration::from_secs(10) {
tracing::warn!(
"Your `syncing_interval_secs` value it too low. \
This may overload your graph-node instance, \
a recommended value is about 60 seconds."
);
}

if self.subgraphs.escrow.config.syncing_interval_secs > Duration::from_secs(600)
|| self.subgraphs.network.config.syncing_interval_secs > Duration::from_secs(600)
{
if self.subgraphs.network.config.syncing_interval_secs > Duration::from_secs(600) {
tracing::warn!(
"Your `syncing_interval_secs` value it too high. \
This may cause issues while reacting to updates in the blockchain. \
Expand Down Expand Up @@ -306,11 +296,46 @@ impl Config {
self.subgraphs.network.config.query_auth_token.as_ref(),
"subgraphs.network",
);
Self::warn_if_token_over_http(
&self.subgraphs.escrow.config.query_url,
self.subgraphs.escrow.config.query_auth_token.as_ref(),
"subgraphs.escrow",
);

// Warn about deprecated escrow config
#[allow(deprecated)]
if self.subgraphs.escrow.is_some() {
tracing::warn!(
"The `subgraphs.escrow` configuration is deprecated and will be ignored. \
V2 escrow accounts are now sourced from the network subgraph. \
You can safely remove the `[subgraphs.escrow]` section from your config."
);
}

// Warn about deprecated serve_escrow_subgraph
#[allow(deprecated)]
if self.service.serve_escrow_subgraph {
tracing::warn!(
"The `service.serve_escrow_subgraph` configuration is deprecated and will be ignored. \
The escrow subgraph endpoint is no longer served. \
You can safely remove this setting from your config."
);
}

// Warn about deprecated receipts_verifier_address (V1)
#[allow(deprecated)]
if self.blockchain.receipts_verifier_address.is_some() {
tracing::warn!(
"The `blockchain.receipts_verifier_address` configuration is deprecated and will be ignored. \
Horizon (V2) is now always enabled and uses `receipts_verifier_address_v2`. \
You can safely remove `receipts_verifier_address` from your config."
);
}

// Warn about deprecated horizon.enabled
#[allow(deprecated)]
if self.horizon.enabled.is_some() {
tracing::warn!(
"The `horizon.enabled` configuration is deprecated and will be ignored. \
Horizon is now always enabled. \
You can safely remove the `[horizon]` section from your config."
);
}

Ok(())
}
Expand Down Expand Up @@ -448,10 +473,12 @@ impl MetricsConfig {

#[derive(Debug, Deserialize)]
#[cfg_attr(test, derive(PartialEq))]
#[allow(deprecated)] // Allow using deprecated EscrowSubgraphConfig type
pub struct SubgraphsConfig {
pub network: NetworkSubgraphConfig,
pub escrow: EscrowSubgraphConfig,
// Note: V2 escrow accounts are in the network subgraph, not a separate escrow_v2 subgraph
#[deprecated(note = "V2 escrow accounts are in the network subgraph; this field is ignored.")]
#[serde(default)]
pub escrow: Option<EscrowSubgraphConfig>,
}

#[serde_as]
Expand Down Expand Up @@ -497,11 +524,12 @@ fn default_max_signers_per_payer() -> usize {
0
}

#[derive(Debug, Deserialize)]
#[deprecated(note = "V2 escrow accounts are in the network subgraph; escrow config is ignored.")]
#[derive(Debug, Deserialize, Default)]
#[cfg_attr(test, derive(PartialEq))]
pub struct EscrowSubgraphConfig {
#[serde(flatten)]
pub config: SubgraphConfig,
#[serde(flatten, default)]
pub config: Option<SubgraphConfig>,
}

#[serde_as]
Expand Down Expand Up @@ -532,7 +560,7 @@ pub enum TheGraphChainId {
#[cfg_attr(test, derive(PartialEq))]
pub struct BlockchainConfig {
pub chain_id: TheGraphChainId,
/// Legacy verifier address (deprecated; optional, not used).
/// Legacy verifier address
#[deprecated(note = "Use `receipts_verifier_address_v2` for Horizon receipts.")]
pub receipts_verifier_address: Option<Address>,
/// Verifier address for Horizon receipts.
Expand All @@ -552,6 +580,8 @@ impl BlockchainConfig {
pub struct ServiceConfig {
pub ipfs_url: Url,
pub serve_network_subgraph: bool,
#[deprecated(note = "Escrow subgraph is no longer used; this field is ignored.")]
#[serde(default)]
pub serve_escrow_subgraph: bool,
pub serve_auth_token: Option<String>,
pub host_and_port: SocketAddr,
Expand Down Expand Up @@ -688,14 +718,13 @@ pub struct RavRequestConfig {

/// Configuration for Horizon support.
///
/// Note: Horizon is always enabled. The `enabled` field is deprecated and ignored.
/// Note: This struct is kept for backwards compatibility.
#[derive(Debug, Default, Deserialize)]
#[cfg_attr(test, derive(PartialEq))]
pub struct HorizonConfig {
/// Deprecated: Horizon is now always enabled. This field is ignored.
#[deprecated(note = "Horizon is always enabled; this field is ignored.")]
#[serde(default)]
pub enabled: bool,
pub enabled: Option<bool>,
}

#[cfg(test)]
Expand Down Expand Up @@ -772,7 +801,7 @@ mod tests {
Some(PathBuf::from("minimal-config-example.toml")).as_ref(),
)
.unwrap();
assert!(config_with_horizon_true.horizon.enabled);
assert_eq!(config_with_horizon_true.horizon.enabled, Some(true));
env::remove_var("INDEXER_SERVICE_HORIZON__ENABLED");

// Test with horizon.enabled = false via environment variable
Expand All @@ -782,7 +811,7 @@ mod tests {
Some(PathBuf::from("minimal-config-example.toml")).as_ref(),
)
.unwrap();
assert!(!config_with_horizon_false.horizon.enabled);
assert_eq!(config_with_horizon_false.horizon.enabled, Some(false));
env::remove_var("INDEXER_SERVICE_HORIZON__ENABLED");

// Test without horizon section (uses default)
Expand All @@ -791,8 +820,8 @@ mod tests {
Some(PathBuf::from("minimal-config-example.toml")).as_ref(),
)
.unwrap();
// Default is false since #[serde(default)] on bool defaults to false
assert!(!config_without_horizon.horizon.enabled);
// Default is None since #[serde(default)] on Option<bool> defaults to None
assert_eq!(config_without_horizon.horizon.enabled, None);
}

// Test that we can load config with unknown fields, in particular coming from environment variables
Expand Down
8 changes: 0 additions & 8 deletions crates/service/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,6 @@ pub async fn run() -> anyhow::Result<()> {
}
};

let escrow_subgraph = create_subgraph_client(
http_client.clone(),
&config.graph_node,
&config.subgraphs.escrow.config,
)
.await;

let router = ServiceRouter::builder()
.database(database.clone())
.domain_separator_v2(domain_separator_v2.clone())
Expand All @@ -173,7 +166,6 @@ pub async fn run() -> anyhow::Result<()> {
.blockchain(config.blockchain)
.timestamp_buffer_secs(config.tap.rav_request.timestamp_buffer_secs)
.network_subgraph(network_subgraph, config.subgraphs.network)
.escrow_subgraph(escrow_subgraph, config.subgraphs.escrow)
.escrow_accounts_v2(v2_watcher)
.build();

Expand Down
Loading
Loading