Skip to content

Commit e658018

Browse files
authored
ETCM-12351 some dolos fixes (#1088)
1 parent 66f012b commit e658018

File tree

17 files changed

+560
-113
lines changed

17 files changed

+560
-113
lines changed

Cargo.lock

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ fork-tree = { version = "13.0.1" }
188188
ureq = { version = "3.1.2", default-features = false }
189189
url = { version = "2.5.7", default-features = false }
190190
blockfrost-openapi = { version = "0.1.75", default-features = false }
191+
chrono = { version = "0.4.31", default-features = false }
191192

192193
# substrate dependencies
193194
frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-stable2509" }

demo/node/src/data_sources.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,22 @@ pub async fn create_dolos_data_sources(
107107
) -> std::result::Result<DataSources, Box<dyn Error + Send + Sync + 'static>> {
108108
let dolos_client = partner_chains_dolos_data_sources::get_connection_from_env()?;
109109
let pool = partner_chains_db_sync_data_sources::get_connection_from_env().await?;
110-
let block = Arc::new(
110+
let block_dbsync = Arc::new(
111111
partner_chains_db_sync_data_sources::BlockDataSourceImpl::new_from_env(pool.clone())
112112
.await?,
113113
);
114+
let block_dolos = Arc::new(
115+
partner_chains_dolos_data_sources::BlockDataSourceImpl::new_from_env(dolos_client.clone())
116+
.await?,
117+
);
114118
Ok(DataSources {
115119
sidechain_rpc: Arc::new(
116120
partner_chains_dolos_data_sources::SidechainRpcDataSourceImpl::new(
117121
dolos_client.clone(),
118122
),
119123
),
120124
mc_hash: Arc::new(partner_chains_dolos_data_sources::McHashDataSourceImpl::new(
121-
dolos_client.clone(),
125+
block_dolos.clone(),
122126
)),
123127
authority_selection: Arc::new(
124128
partner_chains_dolos_data_sources::AuthoritySelectionDataSourceImpl::new(
@@ -137,15 +141,15 @@ pub async fn create_dolos_data_sources(
137141
pool.clone(),
138142
metrics_opt.clone(),
139143
GOVERNED_MAP_CACHE_SIZE,
140-
block.clone(),
144+
block_dbsync.clone(),
141145
)
142146
.await?,
143147
),
144148
bridge: Arc::new(
145149
partner_chains_db_sync_data_sources::CachedTokenBridgeDataSourceImpl::new(
146150
pool,
147151
metrics_opt,
148-
block,
152+
block_dbsync,
149153
BRIDGE_TRANSFER_CACHE_LOOKAHEAD,
150154
),
151155
),

dev/local-environment/setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
PARTNER_CHAINS_NODE_IMAGE="ghcr.io/input-output-hk/partner-chains/partner-chains-node-unstable:latest"
44
CARDANO_IMAGE="ghcr.io/intersectmbo/cardano-node:10.5.1"
55
DBSYNC_IMAGE="ghcr.io/intersectmbo/cardano-db-sync:13.6.0.5"
6-
DOLOS_IMAGE="ghcr.io/txpipe/dolos:1.0.0-beta.8"
6+
DOLOS_IMAGE="ghcr.io/txpipe/dolos:1.0.0-rc.2"
77
OGMIOS_IMAGE="cardanosolutions/ogmios:v6.13.0"
88
POSTGRES_IMAGE="postgres:17.2"
99
TESTS_IMAGE="python:3.12-slim"

toolkit/data-sources/db-sync/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ sqlx = { workspace = true }
1616
db-sync-sqlx = { workspace = true }
1717
tokio = { workspace = true, features = ["full"] }
1818
futures = { workspace = true }
19-
chrono = "0.4.31"
19+
chrono = { workspace = true }
2020
hex = { workspace = true }
2121
hex-literal = { workspace = true }
2222
itertools = { workspace = true }

toolkit/data-sources/db-sync/src/candidates/cached.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ pub type ArcMut<T> = Arc<Mutex<T>>;
2020

2121
type AriadneParametersCacheKey = (McEpochNumber, PolicyId, PolicyId);
2222
type CandidatesCacheKey = (McEpochNumber, String);
23+
/// Cached candidate data source
2324
pub struct CandidateDataSourceCached {
2425
inner: CandidatesDataSourceImpl,
2526
get_ariadne_parameters_for_epoch_cache:
@@ -96,6 +97,7 @@ impl CandidateDataSourceCacheConfig {
9697
}
9798

9899
impl CandidateDataSourceCached {
100+
/// Creates new instance of the data source
99101
pub fn new(
100102
inner: CandidatesDataSourceImpl,
101103
candidates_for_epoch_cache_size: usize,
@@ -114,6 +116,7 @@ impl CandidateDataSourceCached {
114116
}
115117
}
116118

119+
/// Creates a new instance of the data source, reading configuration from the environment.
117120
pub fn new_from_env(
118121
inner: CandidatesDataSourceImpl,
119122
candidates_for_epoch_cache_size: usize,

toolkit/data-sources/db-sync/src/candidates/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use sqlx::PgPool;
1717
use std::collections::HashMap;
1818
use std::error::Error;
1919

20-
mod cached;
20+
pub mod cached;
2121

2222
#[cfg(test)]
2323
mod tests;

toolkit/data-sources/db-sync/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ pub use crate::block::{BlockDataSourceImpl, DbSyncBlockDataSourceConfig};
103103
#[cfg(feature = "bridge")]
104104
pub use crate::bridge::{TokenBridgeDataSourceImpl, cache::CachedTokenBridgeDataSourceImpl};
105105
#[cfg(feature = "candidate-source")]
106-
pub use crate::candidates::CandidatesDataSourceImpl;
106+
pub use crate::candidates::{CandidatesDataSourceImpl, cached::CandidateDataSourceCached};
107107
#[cfg(feature = "governed-map")]
108108
pub use crate::governed_map::{GovernedMapDataSourceCachedImpl, GovernedMapDataSourceImpl};
109109
#[cfg(feature = "mc-hash")]

toolkit/data-sources/dolos/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ cardano-serialization-lib = { workspace = true }
4040
itertools = { workspace = true }
4141
figment = { workspace = true }
4242
tokio = { workspace = true }
43+
derive-new = { workspace = true }
44+
chrono = { workspace = true }
45+
bech32 = { workspace = true }
4346

4447
[features]
4548
default = []

0 commit comments

Comments
 (0)