Skip to content
Merged
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
40 changes: 19 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions crates/config/maximal-config-example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,15 @@ max_receipts_per_request = 10000

# DIPS (Decentralized Indexing Payment System)
# NOTE: DIPS requires Horizon mode ([horizon].enabled = true)
# Payer authorization is handled via escrow accounts (same trust model as TAP)
[dips]
host = "0.0.0.0"
port = "7601"
allowed_payers = ["0x3333333333333333333333333333333333333333"]
recurring_collector = "0x4444444444444444444444444444444444444444"

price_per_entity = "1000"
tokens_per_entity_per_second = "1000"

[dips.price_per_epoch]
[dips.tokens_per_second]
mainnet = "100"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are quite high example values for per second rates?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hardhat = "100"

Expand Down
37 changes: 21 additions & 16 deletions crates/config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -631,27 +631,32 @@ fn default_allocation_reconciliation_interval_secs() -> Duration {
Duration::from_secs(300)
}

/// DIPS V2 configuration.
///
/// V2 validates RCA proposals (signature, IPFS manifest, network, pricing)
/// before storing. The indexer agent queries pending proposals from the
/// database and decides on-chain acceptance.
#[derive(Debug, Deserialize)]
#[serde(default)]
#[cfg_attr(test, derive(PartialEq))]
pub struct DipsConfig {
pub host: String,
pub port: String,
pub allowed_payers: Vec<Address>,

pub price_per_entity: U256,
pub price_per_epoch: BTreeMap<String, U256>,
pub additional_networks: HashMap<String, String>,
pub recurring_collector: Address,
pub tokens_per_second: BTreeMap<String, U256>,
pub tokens_per_entity_per_second: U256,
pub additional_networks: BTreeMap<String, String>,
}

impl Default for DipsConfig {
fn default() -> Self {
DipsConfig {
host: "0.0.0.0".to_string(),
port: "7601".to_string(),
allowed_payers: vec![],
price_per_entity: U256::from(100),
price_per_epoch: BTreeMap::new(),
additional_networks: HashMap::new(),
recurring_collector: Address::ZERO,
tokens_per_second: BTreeMap::new(),
tokens_per_entity_per_second: U256::ZERO,
additional_networks: BTreeMap::new(),
}
}
}
Expand Down Expand Up @@ -739,7 +744,7 @@ pub struct HorizonConfig {
#[cfg(test)]
mod tests {
use std::{
collections::{BTreeMap, HashMap, HashSet},
collections::{BTreeMap, HashSet},
env, fs,
path::PathBuf,
str::FromStr,
Expand Down Expand Up @@ -774,15 +779,15 @@ mod tests {
max_config.tap.trusted_senders =
HashSet::from([address!("deadbeefcafebabedeadbeefcafebabedeadbeef")]);
max_config.dips = Some(crate::DipsConfig {
allowed_payers: vec![Address(
FixedBytes::<20>::from_str("0x3333333333333333333333333333333333333333").unwrap(),
)],
price_per_entity: U256::from(1000),
price_per_epoch: BTreeMap::from_iter(vec![
recurring_collector: Address(
FixedBytes::<20>::from_str("0x4444444444444444444444444444444444444444").unwrap(),
),
tokens_per_entity_per_second: U256::from(1000),
tokens_per_second: BTreeMap::from_iter(vec![
("mainnet".to_string(), U256::from(100)),
("hardhat".to_string(), U256::from(100)),
]),
additional_networks: HashMap::from([(
additional_networks: BTreeMap::from([(
"eip155:1337".to_string(),
"hardhat".to_string(),
)]),
Expand Down
43 changes: 26 additions & 17 deletions crates/dips/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,43 +12,52 @@ rpc = [
"dep:tonic-prost",
"dep:tonic-prost-build",
"dep:bytes",
"dep:graph-networks-registry",
"dep:serde",
"dep:serde_yaml",
]
db = [
"dep:sqlx",
"dep:build-info",
"dep:indexer-monitor",
"dep:graph-networks-registry",
"dep:serde",
"dep:serde_yaml",
]
db = ["dep:sqlx"]

[dependencies]
build-info.workspace = true
thiserror.workspace = true
anyhow.workspace = true
thegraph-core.workspace = true
async-trait.workspace = true
uuid.workspace = true
tokio.workspace = true
indexer-monitor = { path = "../monitor" }
tracing.workspace = true
graph-networks-registry.workspace = true
bs58 = "0.5"
build-info = { workspace = true, optional = true }
indexer-monitor = { path = "../monitor", optional = true }
thiserror.workspace = true
graph-networks-registry = { workspace = true, optional = true }
serde = { workspace = true, optional = true }
serde_yaml = { version = "0.9", optional = true }

bytes = { version = "1.10.0", optional = true }
# IPFS client dependencies
derivative = "2.2.0"

futures.workspace = true
http = "0.2"
ipfs-api-backend-hyper = { version = "0.6.0", features = ["with-send-sync", "with-hyper-tls"] }

bytes = { version = "1.10.0", optional = true }
prost = { workspace = true, optional = true }
ipfs-api-backend-hyper = { version = "0.6.0", features = [
"with-send-sync",
"with-hyper-tls",
] }
serde_yaml.workspace = true
serde.workspace = true
sqlx = { workspace = true, optional = true }
tonic = { workspace = true, optional = true }
tonic-prost = { workspace = true, optional = true }
serde_json.workspace = true

[dev-dependencies]
rand.workspace = true
indexer-watcher = { path = "../watcher" }
testcontainers-modules = { workspace = true, features = ["postgres"] }
test-assets = { path = "../test-assets" }
indexer-monitor = { path = "../monitor" }
graph-networks-registry.workspace = true
build-info.workspace = true
rand = "0.8"

[build-dependencies]
tonic-build = { workspace = true, optional = true }
Expand Down
Loading
Loading