diff --git a/.github/workflows/run-tests-on-push-to-main.yml b/.github/workflows/run-tests-on-push-to-main.yml index eb937201..7fdab789 100644 --- a/.github/workflows/run-tests-on-push-to-main.yml +++ b/.github/workflows/run-tests-on-push-to-main.yml @@ -24,34 +24,7 @@ jobs: run: cargo fmt --all -- --check - name: Run Clippy - run: | - cargo clippy --all-targets --all-features \ - --package acropolis_common \ - --package acropolis_codec \ - --package acropolis_module_accounts_state \ - --package acropolis_module_address_state \ - --package acropolis_module_assets_state \ - --package acropolis_module_block_unpacker \ - --package acropolis_module_chain_store \ - --package acropolis_module_consensus \ - --package acropolis_module_drdd_state \ - --package acropolis_module_drep_state \ - --package acropolis_module_epochs_state \ - --package acropolis_module_genesis_bootstrapper \ - --package acropolis_module_governance_state \ - --package acropolis_module_historical_accounts_state \ - --package acropolis_module_mithril_snapshot_fetcher \ - --package acropolis_module_parameters_state \ - --package acropolis_module_rest_blockfrost \ - --package acropolis_module_snapshot_bootstrapper \ - --package acropolis_module_spdd_state \ - --package acropolis_module_spo_state \ - --package acropolis_module_stake_delta_filter \ - --package acropolis_module_tx_submitter \ - --package acropolis_module_tx_unpacker \ - --package acropolis_module_upstream_chain_fetcher \ - --package acropolis_module_utxo_state \ - --package acropolis_process_tx_submitter_cli + run: cargo clippy --all-targets --all-features - name: Run Build run: cargo build --verbose diff --git a/processes/golden_tests/src/lib.rs b/processes/golden_tests/src/lib.rs index 462dbd03..97a6d8df 100644 --- a/processes/golden_tests/src/lib.rs +++ b/processes/golden_tests/src/lib.rs @@ -28,8 +28,8 @@ pub fn signal_test_completion() { } } -// Disabled test pending fix -// #[tokio::test] +#[tokio::test] +#[ignore = "Disabled test pending fix"] async fn golden_test() -> Result<()> { let config = Arc::new( Config::builder() diff --git a/processes/golden_tests/src/test_module.rs b/processes/golden_tests/src/test_module.rs index 61377e6b..3b00adac 100644 --- a/processes/golden_tests/src/test_module.rs +++ b/processes/golden_tests/src/test_module.rs @@ -23,10 +23,6 @@ pub struct TestModule; impl TestModule { pub async fn init(&self, context: Arc>, config: Arc) -> Result<()> { - // temporarily forcing test to pass so CI looks happy :) - super::signal_test_completion(); - return Ok(()); - // TODO: we need to somehow get test data into the context so this module can unpack it all // Currently just *assuming* it exists in the context as a string let transactions_topic = config @@ -87,14 +83,12 @@ impl TestModule { return; }; - match message.as_ref() { - Message::Snapshot(SnapshotMessage::Dump(SnapshotStateMessage::SPOState( - spo_state, - ))) => { - assert_eq!(&expected_final_state.spo_state, spo_state); - super::signal_test_completion(); - } - _ => {} + if let Message::Snapshot(SnapshotMessage::Dump(SnapshotStateMessage::SPOState( + spo_state, + ))) = message.as_ref() + { + assert_eq!(&expected_final_state.spo_state, spo_state); + super::signal_test_completion(); } } }); diff --git a/processes/omnibus/src/main.rs b/processes/omnibus/src/main.rs index 0d8a6636..ab2d4ca2 100644 --- a/processes/omnibus/src/main.rs +++ b/processes/omnibus/src/main.rs @@ -6,7 +6,6 @@ use caryatid_process::Process; use config::{Config, Environment, File}; use std::sync::Arc; use tracing::info; -use tracing_subscriber; // External modules use acropolis_module_accounts_state::AccountsState; diff --git a/processes/replayer/src/recorder.rs b/processes/replayer/src/recorder.rs index c7677b9e..069ad834 100644 --- a/processes/replayer/src/recorder.rs +++ b/processes/replayer/src/recorder.rs @@ -110,25 +110,23 @@ impl Recorder { gov_recorder.write(&blk_g, CardanoMessage::GovernanceProcedures(gov_procs)); } - if blk_g.new_epoch { - if blk_g.epoch > 0 { - info!("Waiting drep..."); - let (blk_drep, d_drep) = Self::read_drep(&mut drep_s).await?; - if blk_g != blk_drep { - error!("Governance {blk_g:?} and DRep distribution {blk_drep:?} are out of sync"); - } - - info!("Waiting spo..."); - let (blk_spo, d_spo) = Self::read_spo(&mut spo_s).await?; - if blk_g != blk_spo { - error!( - "Governance {blk_g:?} and SPO distribution {blk_spo:?} are out of sync" - ); - } - - drep_recorder.write(&blk_g, CardanoMessage::DRepStakeDistribution(d_drep)); - spo_recorder.write(&blk_g, CardanoMessage::SPOStakeDistribution(d_spo)); + if blk_g.new_epoch && blk_g.epoch > 0 { + info!("Waiting drep..."); + let (blk_drep, d_drep) = Self::read_drep(&mut drep_s).await?; + if blk_g != blk_drep { + error!( + "Governance {blk_g:?} and DRep distribution {blk_drep:?} are out of sync" + ); } + + info!("Waiting spo..."); + let (blk_spo, d_spo) = Self::read_spo(&mut spo_s).await?; + if blk_g != blk_spo { + error!("Governance {blk_g:?} and SPO distribution {blk_spo:?} are out of sync"); + } + + drep_recorder.write(&blk_g, CardanoMessage::DRepStakeDistribution(d_drep)); + spo_recorder.write(&blk_g, CardanoMessage::SPOStakeDistribution(d_spo)); } } } diff --git a/processes/replayer/src/recorder_alonzo_governance.rs b/processes/replayer/src/recorder_alonzo_governance.rs index d779ffb9..8d7f7181 100644 --- a/processes/replayer/src/recorder_alonzo_governance.rs +++ b/processes/replayer/src/recorder_alonzo_governance.rs @@ -25,17 +25,18 @@ pub struct RecorderAlonzoGovernance; #[derive(serde::Serialize, serde::Deserialize)] struct ReplayerGenesisKeyhash(#[serde_as(as = "Base64")] GenesisKeyhash); +// key, vote +#[derive(serde::Serialize)] +struct VoteRecord(ReplayerGenesisKeyhash, Box); + +// slot, epoch, era (num), new_epoch, [enactment epoch, voting] +#[derive(serde::Serialize)] +struct BlockRecord(u64, u64, u8, u8, Vec<(u64, Vec)>); + struct BlockRecorder { cfg: Arc, prefix: String, - // slot, epoch, era (num), new_epoch, [enactment epoch, voting: [key, vote]] - list: Vec<( - u64, - u64, - u8, - u8, - Vec<(u64, Vec<(ReplayerGenesisKeyhash, Box)>)>, - )>, + list: Vec, } impl BlockRecorder { @@ -47,22 +48,22 @@ impl BlockRecorder { } } - pub fn write(&mut self, block: &BlockInfo, votes: &Vec) { + pub fn write(&mut self, block: &BlockInfo, votes: &[AlonzoBabbageUpdateProposal]) { let file = format!("{}/{}.json", self.cfg.path, self.prefix); let mut proposals = Vec::new(); for vote in votes.iter() { let mut votes_indexed = Vec::new(); for (h, u) in &vote.proposals { - votes_indexed.push((ReplayerGenesisKeyhash(h.clone()), u.clone())); + votes_indexed.push(VoteRecord(ReplayerGenesisKeyhash(h.clone()), u.clone())); } proposals.push((vote.enactment_epoch, votes_indexed)); } - self.list.push(( + self.list.push(BlockRecord( block.slot, block.epoch, - block.era.clone() as u8, + block.era as u8, block.new_epoch as u8, proposals, ));