Skip to content

Commit

Permalink
update preprod version, add additional logging, disable registration …
Browse files Browse the repository at this point in the history
…indexing
  • Loading branch information
Mr-Leshiy committed Apr 7, 2024
1 parent dae8048 commit e5feaef
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
1 change: 1 addition & 0 deletions catalyst-gateway/bin/src/event_db/voter_registration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ impl EventDB {
}

/// Index registration data
#[allow(dead_code)]
pub async fn index_registration_data(
&self, txs: Vec<MultiEraTx<'_>>, slot_no: SlotNumber, network: Network,
) -> Result<(), Error> {
Expand Down
30 changes: 16 additions & 14 deletions catalyst-gateway/bin/src/follower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use cardano_chain_follower::{
};
use chrono::TimeZone;
use tokio::{task::JoinHandle, time};
use tracing::{error, info};
use tracing::{error, info, warn};

use crate::{
event_db::{
Expand Down Expand Up @@ -199,7 +199,6 @@ async fn init_follower(
continue;
},
};

// Parse block
let epoch = match block.epoch(&genesis_values).0.try_into() {
Ok(epoch) => epoch,
Expand All @@ -208,6 +207,7 @@ async fn init_follower(
continue;
},
};
warn!("Block hash: {}", block.hash());

let wallclock = match block.wallclock(&genesis_values).try_into() {
Ok(time) => chrono::Utc.timestamp_nanos(time),
Expand All @@ -224,7 +224,7 @@ async fn init_follower(
continue;
},
};

warn!("Start index follower data...");
match db
.index_follower_data(
slot,
Expand All @@ -243,6 +243,7 @@ async fn init_follower(
}

// index utxo
warn!("Start index utxo data...");
match db.index_utxo_data(block.txs(), slot, network).await {
Ok(()) => (),
Err(err) => {
Expand All @@ -253,23 +254,24 @@ async fn init_follower(

// Block processing for Eras before staking are ignored.
if valid_era(block.era()) {

// Registration
match db.index_registration_data(block.txs(), slot, network).await {
Ok(()) => (),
Err(err) => {
error!(
"Unable to index registration data for block {:?} - skip..",
err
);
continue;
},
}
warn!("Start index registration data...");
// match db.index_registration_data(block.txs(), slot,
// network).await { Ok(()) => (),
// Err(err) => {
// error!(
// "Unable to index registration data for block {:?} -
// skip..", err
// );
// continue;
// },
// }

// Rewards
}

// Refresh update metadata for future followers
warn!("Refresh last updated...");
match db
.refresh_last_updated(
chrono::offset::Utc::now(),
Expand Down
7 changes: 4 additions & 3 deletions catalyst-gateway/tests/api_tests/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ builder:
cat-gateway-test:
ARG DB_URL="postgres://catalyst-event-dev:CHANGE_ME@event-db/CatalystEventDev"
ARG CAT_ADDRESS="0.0.0.0:3030"
ARG LOG_LEVEL="warn"

FROM ../../+package-cat-gateway --address=$CAT_ADDRESS --db_url=$DB_URL
FROM ../../+package-cat-gateway --address=$CAT_ADDRESS --db_url=$DB_URL --log_level=$LOG_LEVEL

# copy preprod mithril snapshot to /tmp/preprod dir
COPY github.com/input-output-hk/catalyst-ci/earthly/mithril_snapshot:v2.11.0+package-preprod-snapshot/snapshot /tmp/preprod
COPY github.com/input-output-hk/catalyst-ci/earthly/mithril_snapshot:feat/update-preprod+package-preprod-snapshot/snapshot /tmp/preprod

SAVE IMAGE cat-gateway-test:latest

Expand All @@ -29,5 +30,5 @@ test:
--load cat-gateway-test:latest=(+cat-gateway-test) \
--service cat-gateway \
--allow-privileged
RUN poetry run pytest -s
RUN poetry run pytest api_tests/test_utxo.py -s
END

0 comments on commit e5feaef

Please sign in to comment.