Skip to content

Commit 23ae9de

Browse files
committed
chore: use clippy on all modules
1 parent f1b991b commit 23ae9de

File tree

6 files changed

+38
-73
lines changed

6 files changed

+38
-73
lines changed

.github/workflows/run-tests-on-push-to-main.yml

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -24,34 +24,7 @@ jobs:
2424
run: cargo fmt --all -- --check
2525

2626
- name: Run Clippy
27-
run: |
28-
cargo clippy --all-targets --all-features \
29-
--package acropolis_common \
30-
--package acropolis_codec \
31-
--package acropolis_module_accounts_state \
32-
--package acropolis_module_address_state \
33-
--package acropolis_module_assets_state \
34-
--package acropolis_module_block_unpacker \
35-
--package acropolis_module_chain_store \
36-
--package acropolis_module_consensus \
37-
--package acropolis_module_drdd_state \
38-
--package acropolis_module_drep_state \
39-
--package acropolis_module_epochs_state \
40-
--package acropolis_module_genesis_bootstrapper \
41-
--package acropolis_module_governance_state \
42-
--package acropolis_module_historical_accounts_state \
43-
--package acropolis_module_mithril_snapshot_fetcher \
44-
--package acropolis_module_parameters_state \
45-
--package acropolis_module_rest_blockfrost \
46-
--package acropolis_module_snapshot_bootstrapper \
47-
--package acropolis_module_spdd_state \
48-
--package acropolis_module_spo_state \
49-
--package acropolis_module_stake_delta_filter \
50-
--package acropolis_module_tx_submitter \
51-
--package acropolis_module_tx_unpacker \
52-
--package acropolis_module_upstream_chain_fetcher \
53-
--package acropolis_module_utxo_state \
54-
--package acropolis_process_tx_submitter_cli
27+
run: cargo clippy --all-targets --all-features
5528

5629
- name: Run Build
5730
run: cargo build --verbose

processes/golden_tests/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ pub fn signal_test_completion() {
2828
}
2929
}
3030

31-
// Disabled test pending fix
32-
// #[tokio::test]
31+
#[tokio::test]
32+
#[ignore = "Disabled test pending fix"]
3333
async fn golden_test() -> Result<()> {
3434
let config = Arc::new(
3535
Config::builder()

processes/golden_tests/src/test_module.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ pub struct TestModule;
2323

2424
impl TestModule {
2525
pub async fn init(&self, context: Arc<Context<Message>>, config: Arc<Config>) -> Result<()> {
26-
// temporarily forcing test to pass so CI looks happy :)
27-
super::signal_test_completion();
28-
return Ok(());
29-
3026
// TODO: we need to somehow get test data into the context so this module can unpack it all
3127
// Currently just *assuming* it exists in the context as a string
3228
let transactions_topic = config
@@ -87,14 +83,12 @@ impl TestModule {
8783
return;
8884
};
8985

90-
match message.as_ref() {
91-
Message::Snapshot(SnapshotMessage::Dump(SnapshotStateMessage::SPOState(
92-
spo_state,
93-
))) => {
94-
assert_eq!(&expected_final_state.spo_state, spo_state);
95-
super::signal_test_completion();
96-
}
97-
_ => {}
86+
if let Message::Snapshot(SnapshotMessage::Dump(SnapshotStateMessage::SPOState(
87+
spo_state,
88+
))) = message.as_ref()
89+
{
90+
assert_eq!(&expected_final_state.spo_state, spo_state);
91+
super::signal_test_completion();
9892
}
9993
}
10094
});

processes/omnibus/src/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use caryatid_process::Process;
66
use config::{Config, Environment, File};
77
use std::sync::Arc;
88
use tracing::info;
9-
use tracing_subscriber;
109

1110
// External modules
1211
use acropolis_module_accounts_state::AccountsState;

processes/replayer/src/recorder.rs

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -110,25 +110,23 @@ impl Recorder {
110110
gov_recorder.write(&blk_g, CardanoMessage::GovernanceProcedures(gov_procs));
111111
}
112112

113-
if blk_g.new_epoch {
114-
if blk_g.epoch > 0 {
115-
info!("Waiting drep...");
116-
let (blk_drep, d_drep) = Self::read_drep(&mut drep_s).await?;
117-
if blk_g != blk_drep {
118-
error!("Governance {blk_g:?} and DRep distribution {blk_drep:?} are out of sync");
119-
}
120-
121-
info!("Waiting spo...");
122-
let (blk_spo, d_spo) = Self::read_spo(&mut spo_s).await?;
123-
if blk_g != blk_spo {
124-
error!(
125-
"Governance {blk_g:?} and SPO distribution {blk_spo:?} are out of sync"
126-
);
127-
}
128-
129-
drep_recorder.write(&blk_g, CardanoMessage::DRepStakeDistribution(d_drep));
130-
spo_recorder.write(&blk_g, CardanoMessage::SPOStakeDistribution(d_spo));
113+
if blk_g.new_epoch && blk_g.epoch > 0 {
114+
info!("Waiting drep...");
115+
let (blk_drep, d_drep) = Self::read_drep(&mut drep_s).await?;
116+
if blk_g != blk_drep {
117+
error!(
118+
"Governance {blk_g:?} and DRep distribution {blk_drep:?} are out of sync"
119+
);
131120
}
121+
122+
info!("Waiting spo...");
123+
let (blk_spo, d_spo) = Self::read_spo(&mut spo_s).await?;
124+
if blk_g != blk_spo {
125+
error!("Governance {blk_g:?} and SPO distribution {blk_spo:?} are out of sync");
126+
}
127+
128+
drep_recorder.write(&blk_g, CardanoMessage::DRepStakeDistribution(d_drep));
129+
spo_recorder.write(&blk_g, CardanoMessage::SPOStakeDistribution(d_spo));
132130
}
133131
}
134132
}

processes/replayer/src/recorder_alonzo_governance.rs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,18 @@ pub struct RecorderAlonzoGovernance;
2525
#[derive(serde::Serialize, serde::Deserialize)]
2626
struct ReplayerGenesisKeyhash(#[serde_as(as = "Base64")] GenesisKeyhash);
2727

28+
// key, vote
29+
#[derive(serde::Serialize)]
30+
struct VoteRecord(ReplayerGenesisKeyhash, Box<ProtocolParamUpdate>);
31+
32+
// slot, epoch, era (num), new_epoch, [enactment epoch, voting]
33+
#[derive(serde::Serialize)]
34+
struct BlockRecord(u64, u64, u8, u8, Vec<(u64, Vec<VoteRecord>)>);
35+
2836
struct BlockRecorder {
2937
cfg: Arc<ReplayerConfig>,
3038
prefix: String,
31-
// slot, epoch, era (num), new_epoch, [enactment epoch, voting: [key, vote]]
32-
list: Vec<(
33-
u64,
34-
u64,
35-
u8,
36-
u8,
37-
Vec<(u64, Vec<(ReplayerGenesisKeyhash, Box<ProtocolParamUpdate>)>)>,
38-
)>,
39+
list: Vec<BlockRecord>,
3940
}
4041

4142
impl BlockRecorder {
@@ -47,22 +48,22 @@ impl BlockRecorder {
4748
}
4849
}
4950

50-
pub fn write(&mut self, block: &BlockInfo, votes: &Vec<AlonzoBabbageUpdateProposal>) {
51+
pub fn write(&mut self, block: &BlockInfo, votes: &[AlonzoBabbageUpdateProposal]) {
5152
let file = format!("{}/{}.json", self.cfg.path, self.prefix);
5253

5354
let mut proposals = Vec::new();
5455
for vote in votes.iter() {
5556
let mut votes_indexed = Vec::new();
5657
for (h, u) in &vote.proposals {
57-
votes_indexed.push((ReplayerGenesisKeyhash(h.clone()), u.clone()));
58+
votes_indexed.push(VoteRecord(ReplayerGenesisKeyhash(h.clone()), u.clone()));
5859
}
5960
proposals.push((vote.enactment_epoch, votes_indexed));
6061
}
6162

62-
self.list.push((
63+
self.list.push(BlockRecord(
6364
block.slot,
6465
block.epoch,
65-
block.era.clone() as u8,
66+
block.era as u8,
6667
block.new_epoch as u8,
6768
proposals,
6869
));

0 commit comments

Comments
 (0)