Skip to content

Commit

Permalink
refactor: config groupings
Browse files Browse the repository at this point in the history
  • Loading branch information
hopeyen committed Aug 7, 2023
1 parent b770057 commit ee04adb
Show file tree
Hide file tree
Showing 23 changed files with 825 additions and 626 deletions.
543 changes: 320 additions & 223 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions subgraph-radio/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ keywords = ["graphprotocol", "data-integrity", "Indexer", "waku", "p2p"]
categories = ["network-programming", "web-programming::http-client"]

[dependencies]
graphcast-sdk = "0.4.0"
graphcast-sdk = { git = "https://github.com/graphops/graphcast-sdk" }
prost = "0.11"
once_cell = "1.17"
chrono = "0.4"
Expand Down Expand Up @@ -52,7 +52,7 @@ async-trait = "0.1.71"
metrics = "0.21.0"
opentelemetry = { version = "0.19.0", features = ["rt-tokio", "trace"] }
tracing-opentelemetry = "0.18.0"
clap = { version = "3.2.25", features = ["derive", "env"] }
clap = { version = "4.3.1", features = ["derive", "env"] }

[dev-dependencies]
criterion = { version = "0.4", features = ["async", "async_futures"] }
Expand Down
91 changes: 49 additions & 42 deletions subgraph-radio/benches/gossips.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use secp256k1::SecretKey;
use std::collections::HashMap;

use graphcast_sdk::networks::NetworkName;
use graphcast_sdk::{BlockPointer, NetworkPointer};
use subgraph_radio::config::Config;
use graphcast_sdk::{BlockPointer, GraphcastNetworkName, LogFormat, NetworkPointer};
use subgraph_radio::config::{Config, CoverageLevel, GraphStack, RadioInfrastructure, Waku};

fn gossip_poi_bench(c: &mut Criterion) {
let identifiers = black_box(vec!["identifier1".to_string(), "identifier2".to_string()]);
Expand All @@ -20,46 +20,53 @@ fn gossip_poi_bench(c: &mut Criterion) {
let pk = black_box(generate_random_private_key());

let config = black_box(Config {
radio_name: String::from("test"),
indexer_address: String::from("indexer_address"),
graph_node_endpoint: String::from("http://localhost:8030/graphql"),
private_key: Some(pk.display_secret().to_string()),
mnemonic: None,
registry_subgraph: String::from(
"https://api.thegraph.com/subgraphs/name/hopeyen/graphcast-registry-goerli",
),
network_subgraph: String::from(
"https://api.thegraph.com/subgraphs/name/graphprotocol/graph-network-goerli",
),
graphcast_network: String::from("testnet"),
topics: vec![String::from(
"QmbaLc7fEfLGUioKWehRhq838rRzeR8cBoapNJWNSAZE8u",
)],
coverage: subgraph_radio::config::CoverageLevel::Comprehensive,
collect_message_duration: 10,
waku_host: None,
waku_port: None,
waku_node_key: None,
boot_node_addresses: vec![],
waku_log_level: None,
waku_addr: None,
log_level: String::from("info"),
slack_token: None,
slack_channel: None,
discord_webhook: None,
telegram_token: None,
telegram_chat_id: None,
metrics_host: String::from("0.0.0.0"),
metrics_port: None,
server_host: String::from("0.0.0.0"),
server_port: None,
log_format: String::from("pretty"),
persistence_file_path: None,
discv5_enrs: None,
discv5_port: None,
filter_protocol: None,
id_validation: IdentityValidation::NoCheck,
topic_update_interval: 600,
graph_stack: GraphStack {
indexer_address: String::from("indexer_address"),
graph_node_status_endpoint: String::from("http://localhost:8030/graphql"),
private_key: Some(pk.display_secret().to_string()),
mnemonic: None,
registry_subgraph: String::from(
"https://api.thegraph.com/subgraphs/name/hopeyen/graphcast-registry-goerli",
),
network_subgraph: String::from(
"https://api.thegraph.com/subgraphs/name/graphprotocol/graph-network-goerli",
),
},
waku: Waku {
waku_host: None,
waku_port: None,
waku_node_key: None,
boot_node_addresses: vec![],
waku_log_level: None,
waku_addr: None,
discv5_enrs: None,
discv5_port: None,
filter_protocol: None,
},
radio_infrastructure: RadioInfrastructure {
radio_name: String::from("test"),
topics: vec![String::from(
"QmbaLc7fEfLGUioKWehRhq838rRzeR8cBoapNJWNSAZE8u",
)],
coverage: CoverageLevel::Comprehensive,
collect_message_duration: 10,
log_level: String::from("info"),
slack_token: None,
slack_channel: None,
discord_webhook: None,
telegram_token: None,
telegram_chat_id: None,
metrics_host: String::from("0.0.0.0"),
metrics_port: None,
server_host: String::from("0.0.0.0"),
server_port: None,
persistence_file_path: None,
id_validation: IdentityValidation::NoCheck,
topic_update_interval: 600,
log_format: LogFormat::Pretty,
graphcast_network: GraphcastNetworkName::Testnet,
},
config_file: None,
});

c.bench_function("gossip_poi", move |b| {
Expand Down
Loading

0 comments on commit ee04adb

Please sign in to comment.