Skip to content

Commit 731d279

Browse files
committed
fixes
1 parent 3eac657 commit 731d279

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

demo/node/src/diff_sources.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,14 @@ impl AuthoritySelectionDataSource for AuthoritySelectionDataSourceImplDiff {
120120
epoch_number: McEpochNumber,
121121
committee_candidate_address: MainchainAddress,
122122
) -> Result<Vec<CandidateRegistrations>, Box<dyn std::error::Error + Send + Sync>> {
123-
let reference = self
123+
let mut reference = self
124124
.dbsync
125125
.get_candidates(epoch_number, committee_candidate_address.clone())
126126
.await?;
127-
let dolos_output =
127+
let mut dolos_output =
128128
self.dolos.get_candidates(epoch_number, committee_candidate_address).await?;
129+
reference.sort_by_key(|a| a.mainchain_pub_key().clone());
130+
dolos_output.sort_by_key(|a| a.mainchain_pub_key().clone());
129131
if reference != dolos_output {
130132
println!(
131133
">>>>>>>>>>>>>>>>>>>>>>>>>>>> McHashDataSource::get_candidates mismatch: dbs: {reference:?} dolos: {dolos_output:?}"

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.1"
77
OGMIOS_IMAGE="cardanosolutions/ogmios:v6.13.0"
88
POSTGRES_IMAGE="postgres:17.2"
99
TESTS_IMAGE="python:3.12-slim"

toolkit/data-sources/dolos/src/candidate.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl AuthoritySelectionDataSource for AuthoritySelectionDataSourceImpl {
110110
let history = self.client.pools_history(&pool.pool_id).await?;
111111
Result::Ok(match history.into_iter().find(|h| h.epoch <= epoch.0 as i32) {
112112
Some(e) => Some((
113-
MainchainKeyHash::decode_hex(&pool.pool_id)?, // TODO is pool_id a pool hash?
113+
MainchainKeyHash::decode_hex(&pool.pool_id)?,
114114
StakeDelegation(e.active_stake.parse::<u64>()?),
115115
)),
116116
None => None,
@@ -265,9 +265,9 @@ impl AuthoritySelectionDataSourceImpl {
265265
output.clone().output_index
266266
))?;
267267
let datum = cardano_serialization_lib::PlutusData::from_hex(&datum_str)
268-
.map_err(|e| e.to_string())?;
268+
.map_err(|e| format!("Failed to parse datum string: {e}"))?;
269269
let utxo_id = UtxoId {
270-
tx_hash: output.tx_hash.as_bytes().try_into()?,
270+
tx_hash: McTxHash::decode_hex(&output.tx_hash)?,
271271
index: UtxoIndex(output.tx_index.try_into()?),
272272
};
273273
let register_validator_datum = RegisterValidatorDatum::try_from(datum)
@@ -285,7 +285,7 @@ impl AuthoritySelectionDataSourceImpl {
285285
.into_iter()
286286
.map(|input| {
287287
Ok::<sidechain_domain::UtxoId, Box<dyn std::error::Error + Send + Sync>>(UtxoId {
288-
tx_hash: input.tx_hash.as_bytes().try_into()?,
288+
tx_hash: McTxHash::decode_hex(&input.tx_hash)?,
289289
index: UtxoIndex(input.output_index.try_into()?),
290290
})
291291
})
@@ -316,7 +316,7 @@ impl AuthoritySelectionDataSourceImpl {
316316
.filter_map(|r| match r {
317317
Ok(candidate) => Some(candidate.clone()),
318318
Err(msg) => {
319-
log::error!("{msg}");
319+
log::error!("Failed to parse candidate: {msg}");
320320
None
321321
},
322322
})
@@ -359,13 +359,10 @@ impl AuthoritySelectionDataSourceImpl {
359359
let active_utxos = match registrations_block_for_epoch_opt {
360360
Some(registrations_block_for_epoch) => {
361361
let pred = |utxo: AddressUtxoContentInner| async move {
362+
let block = self.client.blocks_by_id(utxo.block.clone()).await?;
362363
Ok::<bool, ResultErr>(
363-
self.client
364-
.blocks_by_id(utxo.block.clone())
365-
.await?
366-
.height
367-
.ok_or("committee candidate block height missing")? as u32
368-
>= registrations_block_for_epoch
364+
block.height.ok_or("committee candidate block height missing")? as u32
365+
<= registrations_block_for_epoch
369366
.height
370367
.ok_or("last_block_for_epoch block height missing")? as u32,
371368
)

0 commit comments

Comments
 (0)