diff --git a/examples/block-download/src/main.rs b/examples/block-download/src/main.rs index 4af3ff2..ac848f6 100644 --- a/examples/block-download/src/main.rs +++ b/examples/block-download/src/main.rs @@ -2,7 +2,7 @@ use pallas::network::{ miniprotocols::{ blockfetch, handshake::{self, n2n::VersionTable}, - Point, PROTOCOL_N2N_BLOCK_FETCH, PROTOCOL_N2N_HANDSHAKE, TESTNET_MAGIC, + Point, MAINNET_MAGIC, PROTOCOL_N2N_BLOCK_FETCH, PROTOCOL_N2N_HANDSHAKE, }, multiplexer::{bearers::Bearer, StdPlexer}, }; @@ -10,7 +10,7 @@ use pallas::network::{ fn main() { env_logger::init(); - let bearer = Bearer::connect_tcp("relays-new.cardano-testnet.iohkdev.io:3001").unwrap(); + let bearer = Bearer::connect_tcp("relays-new.cardano-mainnet.iohk.io:3001").unwrap(); let mut plexer = StdPlexer::new(bearer); let handshake = plexer.use_client_channel(PROTOCOL_N2N_HANDSHAKE); @@ -19,15 +19,15 @@ fn main() { plexer.muxer.spawn(); plexer.demuxer.spawn(); - let versions = VersionTable::v4_and_above(TESTNET_MAGIC); + let versions = VersionTable::v4_and_above(MAINNET_MAGIC); let mut hs_client = handshake::N2NClient::new(handshake); let handshake = hs_client.handshake(versions).unwrap(); assert!(matches!(handshake, handshake::Confirmation::Accepted(..))); let point = Point::Specific( - 63528597, - hex::decode("3f3d81c7b88f0fa28867541c5fea8794125cccf6d6c9ee0037a1dbb064130dfd").unwrap(), + 49159253, + hex::decode("d034a2d0e4c3076f57368ed59319010c265718f0923057f8ff914a3b6bfd1314").unwrap(), ); let mut bf_client = blockfetch::Client::new(blockfetch); diff --git a/pallas-addresses/src/lib.rs b/pallas-addresses/src/lib.rs index 129046b..ca3520b 100644 --- a/pallas-addresses/src/lib.rs +++ b/pallas-addresses/src/lib.rs @@ -734,17 +734,17 @@ mod tests { use super::*; const MAINNET_TEST_VECTORS: &[(&str, u8)] = &[ - ("addr1qx2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzer3n0d3vllmyqwsx5wktcd8cc3sq835lu7drv2xwl2wywfgse35a3x", 00u8), - ("addr1z8phkx6acpnf78fuvxn0mkew3l0fd058hzquvz7w36x4gten0d3vllmyqwsx5wktcd8cc3sq835lu7drv2xwl2wywfgs9yc0hh", 01u8), - ("addr1yx2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzerkr0vd4msrxnuwnccdxlhdjar77j6lg0wypcc9uar5d2shs2z78ve", 02u8), - ("addr1x8phkx6acpnf78fuvxn0mkew3l0fd058hzquvz7w36x4gt7r0vd4msrxnuwnccdxlhdjar77j6lg0wypcc9uar5d2shskhj42g", 03u8), - ("addr1gx2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzer5pnz75xxcrzqf96k", 04u8), - ("addr128phkx6acpnf78fuvxn0mkew3l0fd058hzquvz7w36x4gtupnz75xxcrtw79hu", 05u8), - ("addr1vx2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzers66hrl8", 06u8), - ("addr1w8phkx6acpnf78fuvxn0mkew3l0fd058hzquvz7w36x4gtcyjy7wx", 07u8), + ("addr1qx2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzer3n0d3vllmyqwsx5wktcd8cc3sq835lu7drv2xwl2wywfgse35a3x", 0u8), + ("addr1z8phkx6acpnf78fuvxn0mkew3l0fd058hzquvz7w36x4gten0d3vllmyqwsx5wktcd8cc3sq835lu7drv2xwl2wywfgs9yc0hh", 1u8), + ("addr1yx2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzerkr0vd4msrxnuwnccdxlhdjar77j6lg0wypcc9uar5d2shs2z78ve", 2u8), + ("addr1x8phkx6acpnf78fuvxn0mkew3l0fd058hzquvz7w36x4gt7r0vd4msrxnuwnccdxlhdjar77j6lg0wypcc9uar5d2shskhj42g", 3u8), + ("addr1gx2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzer5pnz75xxcrzqf96k", 4u8), + ("addr128phkx6acpnf78fuvxn0mkew3l0fd058hzquvz7w36x4gtupnz75xxcrtw79hu", 5u8), + ("addr1vx2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzers66hrl8", 6u8), + ("addr1w8phkx6acpnf78fuvxn0mkew3l0fd058hzquvz7w36x4gtcyjy7wx", 7u8), ("stake1uyehkck0lajq8gr28t9uxnuvgcqrc6070x3k9r8048z8y5gh6ffgw", 14u8), ("stake178phkx6acpnf78fuvxn0mkew3l0fd058hzquvz7w36x4gtcccycj5", 15u8), - ("37btjrVyb4KDXBNC4haBVPCrro8AQPHwvCMp3RFhhSVWwfFmZ6wwzSK6JK1hY6wHNmtrpTf1kdbva8TCneM2YsiXT7mrzT21EacHnPpz5YyUdj64na", 08u8), + ("37btjrVyb4KDXBNC4haBVPCrro8AQPHwvCMp3RFhhSVWwfFmZ6wwzSK6JK1hY6wHNmtrpTf1kdbva8TCneM2YsiXT7mrzT21EacHnPpz5YyUdj64na", 8u8), ]; const PAYMENT_PUBLIC_KEY: &str = @@ -820,7 +820,7 @@ mod tests { } ShelleyPaymentPart::Script(hash) => { let (_, expected) = &decode_bech32(SCRIPT_HASH).unwrap(); - let expected = &Hash::<28>::from_str(&hex::encode(&expected)).unwrap(); + let expected = &Hash::<28>::from_str(&hex::encode(expected)).unwrap(); assert_eq!(hash, expected); } }; @@ -832,7 +832,7 @@ mod tests { } ShelleyDelegationPart::Script(hash) => { let (_, expected) = &decode_bech32(SCRIPT_HASH).unwrap(); - let expected = &Hash::<28>::from_str(&hex::encode(&expected)).unwrap(); + let expected = &Hash::<28>::from_str(&hex::encode(expected)).unwrap(); assert_eq!(hash, expected); } ShelleyDelegationPart::Pointer(ptr) => { @@ -850,13 +850,12 @@ mod tests { } StakePayload::Script(hash) => { let (_, expected) = &decode_bech32(SCRIPT_HASH).unwrap(); - let expected = &Hash::<28>::from_str(&hex::encode(&expected)).unwrap(); + let expected = &Hash::<28>::from_str(&hex::encode(expected)).unwrap(); assert_eq!(hash, expected); } }, Address::Byron(_) => { // byron has it's own payload tests - () } }; } diff --git a/pallas-bech32/src/cip14.rs b/pallas-bech32/src/cip14.rs index aa8b60e..220ffcc 100644 --- a/pallas-bech32/src/cip14.rs +++ b/pallas-bech32/src/cip14.rs @@ -1,17 +1,16 @@ -use blake2::Blake2bVar; +use bech32::{self, Error, ToBase32, Variant}; use blake2::digest::{Update, VariableOutput}; -use bech32 :: {self, Variant, Error, ToBase32}; +use blake2::Blake2bVar; use hex::{self}; use std::error::Error as Err; const DATA: &str = "asset"; pub struct AssetFingerprint { - hash_buf : [u8;20] + hash_buf: [u8; 20], } impl AssetFingerprint { - pub fn from_parts(policy_id: &str, asset_name: &str) -> Result> { let mut hasher = Blake2bVar::new(20).unwrap(); let c = format!("{policy_id}{asset_name}"); @@ -20,12 +19,11 @@ impl AssetFingerprint { let mut buf = [0u8; 20]; hasher.finalize_variable(&mut buf)?; - Ok(AssetFingerprint { hash_buf : buf }) + Ok(AssetFingerprint { hash_buf: buf }) } - pub fn finger_print(&self) -> Result { - - bech32::encode(DATA, self.hash_buf.to_base32(), Variant::Bech32) + pub fn finger_print(&self) -> Result { + bech32::encode(DATA, self.hash_buf.to_base32(), Variant::Bech32) } } @@ -35,17 +33,23 @@ mod tests { #[test] fn finger_print_test1() { - let af = AssetFingerprint::from_parts("7eae28af2208be856f7a119668ae52a49b73725e326dc16579dcc373", "").unwrap(); + let af = AssetFingerprint::from_parts( + "7eae28af2208be856f7a119668ae52a49b73725e326dc16579dcc373", + "", + ) + .unwrap(); let result = af.finger_print().unwrap(); assert_eq!(result, "asset1rjklcrnsdzqp65wjgrg55sy9723kw09mlgvlc3"); } - #[test] fn finger_print_test2() { - let af = AssetFingerprint::from_parts("1e349c9bdea19fd6c147626a5260bc44b71635f398b67c59881df209", "504154415445").unwrap(); + let af = AssetFingerprint::from_parts( + "1e349c9bdea19fd6c147626a5260bc44b71635f398b67c59881df209", + "504154415445", + ) + .unwrap(); let result = af.finger_print().unwrap(); assert_eq!(result, "asset1hv4p5tv2a837mzqrst04d0dcptdjmluqvdx9k3"); } - -} \ No newline at end of file +} diff --git a/pallas-miniprotocols/src/chainsync/client.rs b/pallas-miniprotocols/src/chainsync/client.rs index 5d6e609..ec2f01f 100644 --- a/pallas-miniprotocols/src/chainsync/client.rs +++ b/pallas-miniprotocols/src/chainsync/client.rs @@ -2,7 +2,7 @@ use pallas_codec::Fragment; use pallas_multiplexer::agents::{Channel, ChannelBuffer, ChannelError}; use std::marker::PhantomData; use thiserror::Error; -use tracing::{debug, instrument}; +use tracing::debug; use crate::common::Point; diff --git a/pallas-miniprotocols/tests/integration.rs b/pallas-miniprotocols/tests/integration.rs index 2724b11..fcbd567 100644 --- a/pallas-miniprotocols/tests/integration.rs +++ b/pallas-miniprotocols/tests/integration.rs @@ -2,7 +2,7 @@ use pallas_miniprotocols::{ blockfetch, chainsync::{self, NextResponse}, handshake::{self, Confirmation}, - txsubmission::{self, EraTxBody, EraTxId, Reply, Server, TxIdAndSize}, + txsubmission::{self, EraTxId, Reply, TxIdAndSize}, Point, PROTOCOL_N2N_BLOCK_FETCH, PROTOCOL_N2N_CHAIN_SYNC, PROTOCOL_N2N_HANDSHAKE, PROTOCOL_N2N_TX_SUBMISSION, }; @@ -62,14 +62,14 @@ pub fn chainsync_history_happy_path() { assert!(matches!(client.state(), chainsync::State::Idle)); match point { - Some(point) => assert_eq!(point, known_point.clone()), + Some(point) => assert_eq!(point, known_point), None => panic!("expected point"), } let next = client.request_next().unwrap(); match next { - NextResponse::RollBackward(point, _) => assert_eq!(point, known_point.clone()), + NextResponse::RollBackward(point, _) => assert_eq!(point, known_point), _ => panic!("expected rollback"), } @@ -142,7 +142,7 @@ pub fn blockfetch_happy_path() { let mut client = blockfetch::Client::new(blockfetch); - let range_ok = client.request_range((known_point.clone(), known_point.clone())); + let range_ok = client.request_range((known_point.clone(), known_point)); assert!(matches!(client.state(), blockfetch::State::Streaming)); @@ -227,8 +227,8 @@ pub fn txsubmission_server_happy_path() { )); match server.receive_next_reply() { - Ok(Reply::Done) => return, // Server aint havin none of our sh*t + Ok(Reply::Done) => (), // Server aint havin none of our sh*t Ok(Reply::TxIds(tx_ids)) => assert_eq!(tx_ids.len(), 3), - Ok(_) | Err(_) => assert!(false), + Ok(_) | Err(_) => unreachable!(), } } diff --git a/pallas-multiplexer/tests/integration.rs b/pallas-multiplexer/tests/integration.rs index bfec2b8..d64d210 100644 --- a/pallas-multiplexer/tests/integration.rs +++ b/pallas-multiplexer/tests/integration.rs @@ -50,7 +50,7 @@ fn one_way_small_sequence_of_payloads() { active_plexer.muxer.spawn(); passive_plexer.demuxer.spawn(); - for _ in [0..100] { + for _ in 0..100 { let payload = random_payload(50); sender_channel.enqueue_chunk(payload.clone()).unwrap(); let received_payload = receiver_channel.dequeue_chunk().unwrap(); diff --git a/pallas-primitives/src/alonzo/json.rs b/pallas-primitives/src/alonzo/json.rs index a1fc05d..3f2c2e6 100644 --- a/pallas-primitives/src/alonzo/json.rs +++ b/pallas-primitives/src/alonzo/json.rs @@ -96,10 +96,10 @@ mod tests { for (idx, (block_str, jsonl_str)) in test_blocks.iter().enumerate() { println!("decoding json block {}", idx + 1); - let bytes = hex::decode(block_str).expect(&format!("bad block file {idx}")); + let bytes = hex::decode(block_str).unwrap_or_else(|_| panic!("bad block file {idx}")); - let (_, block): BlockWrapper = - minicbor::decode(&bytes[..]).expect(&format!("error decoding cbor for file {idx}")); + let (_, block): BlockWrapper = minicbor::decode(&bytes[..]) + .unwrap_or_else(|_| panic!("error decoding cbor for file {idx}")); let mut datums = jsonl_str.lines(); @@ -126,10 +126,10 @@ mod tests { for (idx, (block_str, jsonl_str)) in test_blocks.iter().enumerate() { println!("decoding json block {}", idx + 1); - let bytes = hex::decode(block_str).expect(&format!("bad block file {idx}")); + let bytes = hex::decode(block_str).unwrap_or_else(|_| panic!("bad block file {idx}")); - let (_, block): BlockWrapper = - minicbor::decode(&bytes[..]).expect(&format!("error decoding cbor for file {idx}")); + let (_, block): BlockWrapper = minicbor::decode(&bytes[..]) + .unwrap_or_else(|_| panic!("error decoding cbor for file {idx}")); let mut scripts = jsonl_str.lines(); diff --git a/pallas-primitives/src/alonzo/model.rs b/pallas-primitives/src/alonzo/model.rs index 0e30ba6..e4550cf 100644 --- a/pallas-primitives/src/alonzo/model.rs +++ b/pallas-primitives/src/alonzo/model.rs @@ -1623,12 +1623,13 @@ mod tests { for (idx, block_str) in test_blocks.iter().enumerate() { println!("decoding test block {}", idx + 1); - let bytes = hex::decode(block_str).expect(&format!("bad block file {idx}")); + let bytes = hex::decode(block_str).unwrap_or_else(|_| panic!("bad block file {idx}")); - let block: BlockWrapper = - minicbor::decode(&bytes[..]).expect(&format!("error decoding cbor for file {idx}")); + let block: BlockWrapper = minicbor::decode(&bytes[..]) + .unwrap_or_else(|_| panic!("error decoding cbor for file {idx}")); - let bytes2 = to_vec(block).expect(&format!("error encoding block cbor for file {idx}")); + let bytes2 = to_vec(block) + .unwrap_or_else(|_| panic!("error encoding block cbor for file {idx}")); assert!(bytes.eq(&bytes2), "re-encoded bytes didn't match original"); } @@ -1643,13 +1644,13 @@ mod tests { for (idx, header_str) in test_headers.iter().enumerate() { println!("decoding test header {}", idx + 1); - let bytes = hex::decode(header_str).expect(&format!("bad header file {idx}")); + let bytes = hex::decode(header_str).unwrap_or_else(|_| panic!("bad header file {idx}")); - let header: Header = - minicbor::decode(&bytes[..]).expect(&format!("error decoding cbor for file {idx}")); + let header: Header = minicbor::decode(&bytes[..]) + .unwrap_or_else(|_| panic!("error decoding cbor for file {idx}")); - let bytes2 = - to_vec(header).expect(&format!("error encoding header cbor for file {idx}")); + let bytes2 = to_vec(header) + .unwrap_or_else(|_| panic!("error encoding header cbor for file {idx}")); assert!(bytes.eq(&bytes2), "re-encoded bytes didn't match original"); } diff --git a/pallas-primitives/src/babbage/model.rs b/pallas-primitives/src/babbage/model.rs index ccc3708..909212a 100644 --- a/pallas-primitives/src/babbage/model.rs +++ b/pallas-primitives/src/babbage/model.rs @@ -764,13 +764,13 @@ mod tests { for (idx, block_str) in test_blocks.iter().enumerate() { println!("decoding test block {}", idx + 1); - let bytes = hex::decode(block_str).expect(&format!("bad block file {idx}")); + let bytes = hex::decode(block_str).unwrap_or_else(|_| panic!("bad block file {idx}")); - let block: BlockWrapper = - minicbor::decode(&bytes[..]).expect(&format!("error decoding cbor for file {idx}")); + let block: BlockWrapper = minicbor::decode(&bytes[..]) + .unwrap_or_else(|_| panic!("error decoding cbor for file {idx}")); let bytes2 = minicbor::to_vec(block) - .expect(&format!("error encoding block cbor for file {idx}")); + .unwrap_or_else(|_| panic!("error encoding block cbor for file {idx}")); assert!(bytes.eq(&bytes2), "re-encoded bytes didn't match original"); } diff --git a/pallas-primitives/src/byron/model.rs b/pallas-primitives/src/byron/model.rs index aeb4464..68db4ab 100644 --- a/pallas-primitives/src/byron/model.rs +++ b/pallas-primitives/src/byron/model.rs @@ -833,12 +833,13 @@ mod tests { for (idx, block_str) in test_blocks.iter().enumerate() { println!("decoding test block {}", idx + 1); - let bytes = hex::decode(block_str).expect(&format!("bad block file {idx}")); + let bytes = hex::decode(block_str).unwrap_or_else(|_| panic!("bad block file {idx}")); - let block: BlockWrapper = - minicbor::decode(&bytes[..]).expect(&format!("error decoding cbor for file {idx}")); + let block: BlockWrapper = minicbor::decode(&bytes[..]) + .unwrap_or_else(|_| panic!("error decoding cbor for file {idx}")); - let bytes2 = to_vec(block).expect(&format!("error encoding block cbor for file {idx}")); + let bytes2 = to_vec(block) + .unwrap_or_else(|_| panic!("error encoding block cbor for file {idx}")); assert_eq!(hex::encode(bytes), hex::encode(bytes2)); } @@ -861,12 +862,13 @@ mod tests { for (idx, block_str) in test_blocks.iter().enumerate() { println!("decoding test block {}", idx + 1); - let bytes = hex::decode(block_str).expect(&format!("bad block file {idx}")); + let bytes = hex::decode(block_str).unwrap_or_else(|_| panic!("bad block file {idx}")); - let block: BlockWrapper = - minicbor::decode(&bytes[..]).expect(&format!("error decoding cbor for file {idx}")); + let block: BlockWrapper = minicbor::decode(&bytes[..]) + .unwrap_or_else(|_| panic!("error decoding cbor for file {idx}")); - let bytes2 = to_vec(block).expect(&format!("error encoding block cbor for file {idx}")); + let bytes2 = to_vec(block) + .unwrap_or_else(|_| panic!("error encoding block cbor for file {idx}")); assert_eq!(hex::encode(bytes), hex::encode(bytes2)); } @@ -878,13 +880,13 @@ mod tests { for (idx, str) in subjects.iter().enumerate() { println!("decoding test header {}", idx + 1); - let bytes = hex::decode(str).expect(&format!("bad header file {idx}")); + let bytes = hex::decode(str).unwrap_or_else(|_| panic!("bad header file {idx}")); let block: BlockHead = minicbor::decode(&bytes[..]) - .expect(&format!("error decoding cbor for file {}", idx)); + .unwrap_or_else(|_| panic!("error decoding cbor for file {idx}")); - let bytes2 = - to_vec(block).expect(&format!("error encoding header cbor for file {idx}")); + let bytes2 = to_vec(block) + .unwrap_or_else(|_| panic!("error encoding header cbor for file {idx}")); assert_eq!(bytes, bytes2); } diff --git a/pallas-traverse/src/fees.rs b/pallas-traverse/src/fees.rs index 5e3e033..d625f9c 100644 --- a/pallas-traverse/src/fees.rs +++ b/pallas-traverse/src/fees.rs @@ -44,19 +44,18 @@ mod tests { #[test] fn known_fee_matches() { // TODO: expand this test to include more test blocks - let block_idx = 1; let block_str = include_str!("../../test_data/byron4.block"); - let block_bytes = hex::decode(block_str).expect(&format!("bad block file {block_idx}")); + let block_bytes = hex::decode(block_str).expect("bad block file"); let block = crate::MultiEraBlock::decode_byron(&block_bytes).unwrap(); let txs = block.txs(); // don't want to pass if we don't have tx in the block - assert!(txs.len() > 0); + assert!(!txs.is_empty()); for tx in txs.iter().take(1) { let byron = tx.as_byron().unwrap(); - let fee = compute_byron_fee(&byron, None); + let fee = compute_byron_fee(byron, None); assert_eq!(fee, 171070); } } diff --git a/pallas-traverse/src/hashes.rs b/pallas-traverse/src/hashes.rs index ccf50dd..044abf9 100644 --- a/pallas-traverse/src/hashes.rs +++ b/pallas-traverse/src/hashes.rs @@ -144,7 +144,7 @@ impl ComputeHash<32> for babbage::DatumOption { #[cfg(test)] mod tests { - use crate::{Era, MultiEraBlock, MultiEraTx}; + use crate::{Era, MultiEraTx}; use super::{ComputeHash, OriginalHash}; use pallas_codec::utils::Int; @@ -159,12 +159,11 @@ mod tests { type BlockWrapper<'b> = (u16, byron::MintedBlock<'b>); // TODO: expand this test to include more test blocks - let block_idx = 1; let block_str = include_str!("../../test_data/byron1.block"); - let block_bytes = hex::decode(block_str).expect(&format!("bad block file {block_idx}")); - let (_, block_model): BlockWrapper = minicbor::decode(&block_bytes[..]) - .expect(&format!("error decoding cbor for file {block_idx}")); + let block_bytes = hex::decode(block_str).expect("bad block file"); + let (_, block_model): BlockWrapper = + minicbor::decode(&block_bytes[..]).expect("error decoding cbor for file"); let computed_hash = block_model.header.original_hash(); @@ -179,12 +178,11 @@ mod tests { type BlockWrapper<'b> = (u16, alonzo::MintedBlock<'b>); // TODO: expand this test to include more test blocks - let block_idx = 1; let block_str = include_str!("../../test_data/alonzo1.block"); - let block_bytes = hex::decode(block_str).expect(&format!("bad block file {block_idx}")); - let (_, block_model): BlockWrapper = minicbor::decode(&block_bytes[..]) - .expect(&format!("error decoding cbor for file {block_idx}")); + let block_bytes = hex::decode(block_str).expect("bad block file"); + let (_, block_model): BlockWrapper = + minicbor::decode(&block_bytes[..]).expect("error decoding cbor for file"); let valid_hashes = vec![ "8ae0cd531635579a9b52b954a840782d12235251fb1451e5c699e864c677514a", @@ -209,9 +207,10 @@ mod tests { let block_idx = 1; let block_str = include_str!("../../test_data/babbage1.block"); - let block_bytes = hex::decode(block_str).expect(&format!("bad block file {block_idx}")); + let block_bytes = + hex::decode(block_str).unwrap_or_else(|_| panic!("bad block file {block_idx}")); let (_, block_model): BlockWrapper = minicbor::decode(&block_bytes[..]) - .expect(&format!("error decoding cbor for file {block_idx}")); + .unwrap_or_else(|_| panic!("error decoding cbor for file {block_idx}")); let valid_hashes = vec!["3fad302595665b004971a6b76909854a39a0a7ecdbff3692f37b77ae37dbe882"]; diff --git a/pallas-traverse/src/lib.rs b/pallas-traverse/src/lib.rs index 9ad288d..6d9191a 100644 --- a/pallas-traverse/src/lib.rs +++ b/pallas-traverse/src/lib.rs @@ -103,11 +103,12 @@ pub enum MultiEraCert<'b> { AlonzoCompatible(Box>), } -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Default)] #[non_exhaustive] pub enum MultiEraMeta<'b> { - NotApplicable, + #[default] Empty, + NotApplicable, AlonzoCompatible(&'b alonzo::Metadata), } diff --git a/pallas-traverse/src/meta.rs b/pallas-traverse/src/meta.rs index 6537e1c..574b6d9 100644 --- a/pallas-traverse/src/meta.rs +++ b/pallas-traverse/src/meta.rs @@ -2,12 +2,6 @@ use pallas_primitives::alonzo; use crate::MultiEraMeta; -impl Default for MultiEraMeta<'_> { - fn default() -> Self { - MultiEraMeta::Empty - } -} - impl<'b> MultiEraMeta<'b> { pub fn as_alonzo(&self) -> Option<&alonzo::Metadata> { match self { diff --git a/pallas-upstream/src/framework.rs b/pallas-upstream/src/framework.rs index dcccaba..17bc5c3 100644 --- a/pallas-upstream/src/framework.rs +++ b/pallas-upstream/src/framework.rs @@ -97,7 +97,7 @@ impl Error { } pub fn custom(error: Box) -> Error { - Error::Custom(format!("{}", error)) + Error::Custom(format!("{error}")) } }