From 2d455e3ca940378b5a6736c8e1da466a843cabf7 Mon Sep 17 00:00:00 2001 From: Simon Gellis Date: Tue, 28 Oct 2025 13:02:50 -0400 Subject: [PATCH] chore: enable clippy on tx_unpacker --- .../workflows/run-tests-on-push-to-main.yml | 1 + codec/src/map_parameters.rs | 6 ++--- modules/tx_unpacker/src/tx_unpacker.rs | 22 +++++++++---------- modules/tx_unpacker/src/utxo_registry.rs | 2 +- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.github/workflows/run-tests-on-push-to-main.yml b/.github/workflows/run-tests-on-push-to-main.yml index aef0082b..c04a2192 100644 --- a/.github/workflows/run-tests-on-push-to-main.yml +++ b/.github/workflows/run-tests-on-push-to-main.yml @@ -44,6 +44,7 @@ jobs: --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 diff --git a/codec/src/map_parameters.rs b/codec/src/map_parameters.rs index ecae6d64..05064345 100644 --- a/codec/src/map_parameters.rs +++ b/codec/src/map_parameters.rs @@ -100,7 +100,7 @@ pub fn map_stake_address(cred: &PallasStakeCredential, network_id: NetworkId) -> } }; - StakeAddress::new(payload, network_id.into()) + StakeAddress::new(payload, network_id) } /// Map a Pallas DRep to our DRepChoice @@ -262,7 +262,7 @@ pub fn map_certificate( .map(|v| { StakeAddress::new( StakeCredential::AddrKeyHash(v.to_vec()), - network_id.clone().into(), + network_id.clone(), ) }) .collect(), @@ -382,7 +382,7 @@ pub fn map_certificate( .map(|v| { StakeAddress::new( StakeCredential::AddrKeyHash(v.to_vec()), - network_id.clone().into(), + network_id.clone(), ) }) .collect(), diff --git a/modules/tx_unpacker/src/tx_unpacker.rs b/modules/tx_unpacker/src/tx_unpacker.rs index 7111ca3c..bd3025b8 100644 --- a/modules/tx_unpacker/src/tx_unpacker.rs +++ b/modules/tx_unpacker/src/tx_unpacker.rs @@ -161,7 +161,7 @@ impl TxUnpacker { let tx_index = tx_index as u16; // Parse the tx - match MultiEraTx::decode(&raw_tx) { + match MultiEraTx::decode(raw_tx) { Ok(tx) => { let tx_hash: TxHash = tx.hash().to_vec().try_into().expect("invalid tx hash length"); let tx_identifier = TxIdentifier::new(block_number, tx_index); @@ -269,7 +269,7 @@ impl TxUnpacker { if publish_certificates_topic.is_some() { for ( cert_index, cert) in certs.iter().enumerate() { - match map_parameters::map_certificate(&cert, tx_identifier, cert_index, network_id.clone()) { + match map_parameters::map_certificate(cert, tx_identifier, cert_index, network_id.clone()) { Ok(tx_cert) => { certificates.push(tx_cert); }, @@ -299,7 +299,7 @@ impl TxUnpacker { if publish_governance_procedures_topic.is_some() { //Self::decode_legacy_updates(&mut legacy_update_proposals, &block, &raw_tx); if block.era >= Era::Shelley && block.era < Era::Babbage { - if let Ok(alonzo) = MultiEraTx::decode_for_era(traverse::Era::Alonzo, &raw_tx) { + if let Ok(alonzo) = MultiEraTx::decode_for_era(traverse::Era::Alonzo, raw_tx) { if let Some(update) = alonzo.update() { if let Some(alonzo_update) = update.as_alonzo() { Self::decode_updates( @@ -313,7 +313,7 @@ impl TxUnpacker { } } else if block.era >= Era::Babbage && block.era < Era::Conway{ - if let Ok(babbage) = MultiEraTx::decode_for_era(traverse::Era::Babbage, &raw_tx) { + if let Ok(babbage) = MultiEraTx::decode_for_era(traverse::Era::Babbage, raw_tx) { if let Some(update) = babbage.update() { if let Some(babbage_update) = update.as_babbage() { Self::decode_updates( @@ -345,7 +345,7 @@ impl TxUnpacker { let mut proc_id = GovActionId { transaction_id: TxHash(*tx.hash()), action_index: 0 }; for (action_index, pallas_governance_proposals) in pp.iter().enumerate() { match proc_id.set_action_index(action_index) - .and_then (|proc_id| map_parameters::map_governance_proposals_procedures(&proc_id, &pallas_governance_proposals)) + .and_then (|proc_id| map_parameters::map_governance_proposals_procedures(proc_id, pallas_governance_proposals)) { Ok(g) => proposal_procedures.push(g), Err(e) => error!("Cannot decode governance proposal procedure {} idx {} in slot {}: {e}", proc_id, action_index, block.slot) @@ -385,7 +385,7 @@ impl TxUnpacker { }) )); - futures.push(context.message_bus.publish(&topic, Arc::new(msg))); + futures.push(context.message_bus.publish(topic, Arc::new(msg))); } if let Some(ref topic) = publish_asset_deltas_topic { @@ -397,7 +397,7 @@ impl TxUnpacker { }) )); - futures.push(context.message_bus.publish(&topic, Arc::new(msg))); + futures.push(context.message_bus.publish(topic, Arc::new(msg))); } if let Some(ref topic) = publish_withdrawals_topic { @@ -408,7 +408,7 @@ impl TxUnpacker { }) )); - futures.push(context.message_bus.publish(&topic, Arc::new(msg))); + futures.push(context.message_bus.publish(topic, Arc::new(msg))); } if let Some(ref topic) = publish_certificates_topic { @@ -419,7 +419,7 @@ impl TxUnpacker { }) )); - futures.push(context.message_bus.publish(&topic, Arc::new(msg))); + futures.push(context.message_bus.publish(topic, Arc::new(msg))); } if let Some(ref topic) = publish_governance_procedures_topic { @@ -433,7 +433,7 @@ impl TxUnpacker { }) ))); - futures.push(context.message_bus.publish(&topic, + futures.push(context.message_bus.publish(topic, governance_msg.clone())); } @@ -447,7 +447,7 @@ impl TxUnpacker { }) )); - futures.push(context.message_bus.publish(&topic, Arc::new(msg))); + futures.push(context.message_bus.publish(topic, Arc::new(msg))); } join_all(futures) diff --git a/modules/tx_unpacker/src/utxo_registry.rs b/modules/tx_unpacker/src/utxo_registry.rs index d10de175..238f3d29 100644 --- a/modules/tx_unpacker/src/utxo_registry.rs +++ b/modules/tx_unpacker/src/utxo_registry.rs @@ -140,7 +140,7 @@ impl UTxORegistry { pub fn consume(&mut self, tx_ref: &TxOutRef) -> Result { match self.live_map.remove(tx_ref) { Some(id) => { - self.spent.add((tx_ref.clone(), id)); + self.spent.add((*tx_ref, id)); Ok(id) } None => Err(anyhow::anyhow!(