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
28 changes: 28 additions & 0 deletions crates/core/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,8 @@ pub struct MinibfConfig {
pub url: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
max_scan_items: Option<u64>,
#[serde(default, skip_serializing_if = "Option::is_none")]
ipfs_gateways: Option<Vec<String>>,
}

impl MinibfConfig {
Expand All @@ -938,6 +940,7 @@ impl MinibfConfig {
token_registry_url: None,
url: None,
max_scan_items: None,
ipfs_gateways: None,
}
}

Expand All @@ -958,6 +961,19 @@ impl MinibfConfig {
pub fn max_scan_items(&self) -> u64 {
self.max_scan_items.unwrap_or(default_max_scan_items())
}

/// These are the base URLs of the HTTP gateways, in order. The gateways
/// resolve `ipfs://` governance-anchor URLs. Dolos sends a request to each
/// gateway in order. Dolos stops at the first gateway that serves the
/// content. cardano-db-sync resolves `ipfs://` anchors the same way.
///
/// An absent setting gives the default list. An empty list stops IPFS
/// resolution, so `ipfs://` anchors do not resolve.
pub fn ipfs_gateways(&self) -> Vec<String> {
self.ipfs_gateways
.clone()
.unwrap_or_else(default_ipfs_gateways)
}
}

#[derive(Deserialize, Serialize, Clone)]
Expand Down Expand Up @@ -1036,6 +1052,18 @@ fn default_max_scan_items() -> u64 {
3000
}

fn default_ipfs_gateways() -> Vec<String> {
// The main public gateway is first. A fallback gateway is second. If the
// first gateway returns HTTP 429, the resolver uses the fallback.
// cardano-db-sync uses the same two-entry shape. There the second entry is
// a private gateway of Blockfrost that pins the content. Dolos has no
// private infrastructure, so Dolos names a second public gateway.
vec![
"https://ipfs.io".to_string(),
"https://gateway.pinata.cloud".to_string(),
]
}

#[derive(Deserialize, Serialize, Clone, Default)]
pub struct ServeConfig {
pub ouroboros: Option<OuroborosConfig>,
Expand Down
2 changes: 1 addition & 1 deletion crates/minibf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition.workspace = true
[dependencies]
tracing.workspace = true
serde.workspace = true
tokio.workspace = true
tokio = { workspace = true, features = ["net"] }
tokio-util.workspace = true
pallas.workspace = true
tower = { workspace = true, features = ["util"] }
Expand Down
8 changes: 8 additions & 0 deletions crates/minibf/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,14 @@ where
"/governance/proposals/{gov_action_id}",
get(routes::governance::proposal_by_gov_action_id::<D>),
)
.route(
"/governance/proposals/{tx_hash}/{cert_index}/metadata",
get(routes::governance::proposal_metadata::<D>),
)
.route(
"/governance/proposals/{gov_action_id}/metadata",
get(routes::governance::proposal_metadata_by_gov_action::<D>),
)
.route(
"/governance/proposals/{tx_hash}/{cert_index}/withdrawals",
get(routes::governance::proposal_withdrawals::<D>),
Expand Down
Loading
Loading