chore: fix new lint warnings (#400)
This commit is contained in:
parent
ae796b4a01
commit
90432bf556
10 changed files with 163 additions and 182 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
pub mod common;
|
pub mod common;
|
||||||
|
|
||||||
use common::*;
|
use common::*;
|
||||||
use hex;
|
|
||||||
use pallas_addresses::{Address, Network, ShelleyAddress, ShelleyPaymentPart};
|
use pallas_addresses::{Address, Network, ShelleyAddress, ShelleyPaymentPart};
|
||||||
use pallas_applying::{
|
use pallas_applying::{
|
||||||
utils::{
|
utils::{
|
||||||
|
|
@ -65,7 +65,7 @@ mod alonzo_tests {
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => (),
|
Ok(()) => (),
|
||||||
Err(err) => assert!(false, "Unexpected error ({:?})", err),
|
Err(err) => panic!("Unexpected error ({:?})", err),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -179,7 +179,7 @@ mod alonzo_tests {
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => (),
|
Ok(()) => (),
|
||||||
Err(err) => assert!(false, "Unexpected error ({:?})", err),
|
Err(err) => panic!("Unexpected error ({:?})", err),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -220,7 +220,7 @@ mod alonzo_tests {
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => (),
|
Ok(()) => (),
|
||||||
Err(err) => assert!(false, "Unexpected error ({:?})", err),
|
Err(err) => panic!("Unexpected error ({:?})", err),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -261,7 +261,7 @@ mod alonzo_tests {
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => (),
|
Ok(()) => (),
|
||||||
Err(err) => assert!(false, "Unexpected error ({:?})", err),
|
Err(err) => panic!("Unexpected error ({:?})", err),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -283,7 +283,7 @@ mod alonzo_tests {
|
||||||
let mut tx_buf: Vec<u8> = Vec::new();
|
let mut tx_buf: Vec<u8> = Vec::new();
|
||||||
let _ = encode(tx_body, &mut tx_buf);
|
let _ = encode(tx_body, &mut tx_buf);
|
||||||
mtx.transaction_body =
|
mtx.transaction_body =
|
||||||
Decode::decode(&mut Decoder::new(&tx_buf.as_slice()), &mut ()).unwrap();
|
Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
|
||||||
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
||||||
let env: Environment = Environment {
|
let env: Environment = Environment {
|
||||||
prot_params: MultiEraProtParams::Alonzo(AlonzoProtParams {
|
prot_params: MultiEraProtParams::Alonzo(AlonzoProtParams {
|
||||||
|
|
@ -306,10 +306,10 @@ mod alonzo_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Inputs set should not be empty"),
|
Ok(()) => panic!("Inputs set should not be empty"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Alonzo(AlonzoError::TxInsEmpty) => (),
|
Alonzo(AlonzoError::TxInsEmpty) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -343,10 +343,10 @@ mod alonzo_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "All inputs should be within the UTxO set"),
|
Ok(()) => panic!("All inputs should be within the UTxO set"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Alonzo(AlonzoError::InputNotInUTxO) => (),
|
Alonzo(AlonzoError::InputNotInUTxO) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -370,7 +370,7 @@ mod alonzo_tests {
|
||||||
let mut tx_buf: Vec<u8> = Vec::new();
|
let mut tx_buf: Vec<u8> = Vec::new();
|
||||||
let _ = encode(tx_body, &mut tx_buf);
|
let _ = encode(tx_body, &mut tx_buf);
|
||||||
mtx.transaction_body =
|
mtx.transaction_body =
|
||||||
Decode::decode(&mut Decoder::new(&tx_buf.as_slice()), &mut ()).unwrap();
|
Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
|
||||||
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
||||||
let env: Environment = Environment {
|
let env: Environment = Environment {
|
||||||
prot_params: MultiEraProtParams::Alonzo(AlonzoProtParams {
|
prot_params: MultiEraProtParams::Alonzo(AlonzoProtParams {
|
||||||
|
|
@ -393,13 +393,10 @@ mod alonzo_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(
|
Ok(()) => panic!("Validity interval lower bound should have been reached",),
|
||||||
false,
|
|
||||||
"Validity interval lower bound should have been reached",
|
|
||||||
),
|
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Alonzo(AlonzoError::BlockPrecedesValInt) => (),
|
Alonzo(AlonzoError::BlockPrecedesValInt) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -423,7 +420,7 @@ mod alonzo_tests {
|
||||||
let mut tx_buf: Vec<u8> = Vec::new();
|
let mut tx_buf: Vec<u8> = Vec::new();
|
||||||
let _ = encode(tx_body, &mut tx_buf);
|
let _ = encode(tx_body, &mut tx_buf);
|
||||||
mtx.transaction_body =
|
mtx.transaction_body =
|
||||||
Decode::decode(&mut Decoder::new(&tx_buf.as_slice()), &mut ()).unwrap();
|
Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
|
||||||
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
||||||
let env: Environment = Environment {
|
let env: Environment = Environment {
|
||||||
prot_params: MultiEraProtParams::Alonzo(AlonzoProtParams {
|
prot_params: MultiEraProtParams::Alonzo(AlonzoProtParams {
|
||||||
|
|
@ -446,13 +443,10 @@ mod alonzo_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(
|
Ok(()) => panic!("Validity interval upper bound should not have been surpassed",),
|
||||||
false,
|
|
||||||
"Validity interval upper bound should not have been surpassed",
|
|
||||||
),
|
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Alonzo(AlonzoError::BlockExceedsValInt) => (),
|
Alonzo(AlonzoError::BlockExceedsValInt) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -493,10 +487,10 @@ mod alonzo_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Fee should not be below minimum"),
|
Ok(()) => panic!("Fee should not be below minimum"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Alonzo(AlonzoError::FeeBelowMin) => (),
|
Alonzo(AlonzoError::FeeBelowMin) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -593,7 +587,7 @@ mod alonzo_tests {
|
||||||
let mut tx_buf: Vec<u8> = Vec::new();
|
let mut tx_buf: Vec<u8> = Vec::new();
|
||||||
let _ = encode(tx_body, &mut tx_buf);
|
let _ = encode(tx_body, &mut tx_buf);
|
||||||
mtx.transaction_body =
|
mtx.transaction_body =
|
||||||
Decode::decode(&mut Decoder::new(&tx_buf.as_slice()), &mut ()).unwrap();
|
Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
|
||||||
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
||||||
let env: Environment = Environment {
|
let env: Environment = Environment {
|
||||||
prot_params: MultiEraProtParams::Alonzo(AlonzoProtParams {
|
prot_params: MultiEraProtParams::Alonzo(AlonzoProtParams {
|
||||||
|
|
@ -616,10 +610,10 @@ mod alonzo_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "No collateral inputs"),
|
Ok(()) => panic!("No collateral inputs"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Alonzo(AlonzoError::CollateralMissing) => (),
|
Alonzo(AlonzoError::CollateralMissing) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -734,10 +728,10 @@ mod alonzo_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Number of collateral inputs should be within limits"),
|
Ok(()) => panic!("Number of collateral inputs should be within limits"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Alonzo(AlonzoError::TooManyCollaterals) => (),
|
Alonzo(AlonzoError::TooManyCollaterals) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -832,7 +826,7 @@ mod alonzo_tests {
|
||||||
};
|
};
|
||||||
let altered_address: ShelleyAddress = ShelleyAddress::new(
|
let altered_address: ShelleyAddress = ShelleyAddress::new(
|
||||||
old_shelley_address.network(),
|
old_shelley_address.network(),
|
||||||
ShelleyPaymentPart::Script(old_shelley_address.payment().as_hash().clone()),
|
ShelleyPaymentPart::Script(*old_shelley_address.payment().as_hash()),
|
||||||
old_shelley_address.delegation().clone(),
|
old_shelley_address.delegation().clone(),
|
||||||
);
|
);
|
||||||
let tx_in = mtx
|
let tx_in = mtx
|
||||||
|
|
@ -873,10 +867,10 @@ mod alonzo_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Collateral inputs should be verification-key locked"),
|
Ok(()) => panic!("Collateral inputs should be verification-key locked"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Alonzo(AlonzoError::CollateralNotVKeyLocked) => (),
|
Alonzo(AlonzoError::CollateralNotVKeyLocked) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1001,10 +995,10 @@ mod alonzo_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Collateral inputs should contain only lovelace"),
|
Ok(()) => panic!("Collateral inputs should contain only lovelace"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Alonzo(AlonzoError::NonLovelaceCollateral) => (),
|
Alonzo(AlonzoError::NonLovelaceCollateral) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1118,13 +1112,10 @@ mod alonzo_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(
|
Ok(()) => panic!("Collateral inputs should contain the minimum lovelace"),
|
||||||
false,
|
|
||||||
"Collateral inputs should contain the minimum lovelace"
|
|
||||||
),
|
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Alonzo(AlonzoError::CollateralMinLovelace) => (),
|
Alonzo(AlonzoError::CollateralMinLovelace) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1144,11 +1135,11 @@ mod alonzo_tests {
|
||||||
)],
|
)],
|
||||||
);
|
);
|
||||||
let mut tx_body: TransactionBody = (*mtx.transaction_body).clone();
|
let mut tx_body: TransactionBody = (*mtx.transaction_body).clone();
|
||||||
tx_body.fee = tx_body.fee - 1;
|
tx_body.fee -= 1;
|
||||||
let mut tx_buf: Vec<u8> = Vec::new();
|
let mut tx_buf: Vec<u8> = Vec::new();
|
||||||
let _ = encode(tx_body, &mut tx_buf);
|
let _ = encode(tx_body, &mut tx_buf);
|
||||||
mtx.transaction_body =
|
mtx.transaction_body =
|
||||||
Decode::decode(&mut Decoder::new(&tx_buf.as_slice()), &mut ()).unwrap();
|
Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
|
||||||
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
||||||
let env: Environment = Environment {
|
let env: Environment = Environment {
|
||||||
prot_params: MultiEraProtParams::Alonzo(AlonzoProtParams {
|
prot_params: MultiEraProtParams::Alonzo(AlonzoProtParams {
|
||||||
|
|
@ -1171,10 +1162,10 @@ mod alonzo_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Preservation of value doesn't hold"),
|
Ok(()) => panic!("Preservation of value doesn't hold"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Alonzo(AlonzoError::PreservationOfValue) => (),
|
Alonzo(AlonzoError::PreservationOfValue) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1187,7 +1178,7 @@ mod alonzo_tests {
|
||||||
let mut mtx: MintedTx = minted_tx_from_cbor(&cbor_bytes);
|
let mut mtx: MintedTx = minted_tx_from_cbor(&cbor_bytes);
|
||||||
let mut tx_body: TransactionBody = (*mtx.transaction_body).clone();
|
let mut tx_body: TransactionBody = (*mtx.transaction_body).clone();
|
||||||
let (first_output, rest): (&TransactionOutput, &[TransactionOutput]) =
|
let (first_output, rest): (&TransactionOutput, &[TransactionOutput]) =
|
||||||
(&tx_body.outputs).split_first().unwrap();
|
tx_body.outputs.split_first().unwrap();
|
||||||
let addr: ShelleyAddress =
|
let addr: ShelleyAddress =
|
||||||
match Address::from_bytes(&Vec::<u8>::from(first_output.address.clone())) {
|
match Address::from_bytes(&Vec::<u8>::from(first_output.address.clone())) {
|
||||||
Ok(Address::Shelley(sa)) => sa,
|
Ok(Address::Shelley(sa)) => sa,
|
||||||
|
|
@ -1210,7 +1201,7 @@ mod alonzo_tests {
|
||||||
let mut tx_buf: Vec<u8> = Vec::new();
|
let mut tx_buf: Vec<u8> = Vec::new();
|
||||||
let _ = encode(tx_body, &mut tx_buf);
|
let _ = encode(tx_body, &mut tx_buf);
|
||||||
mtx.transaction_body =
|
mtx.transaction_body =
|
||||||
Decode::decode(&mut Decoder::new(&tx_buf.as_slice()), &mut ()).unwrap();
|
Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
|
||||||
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
||||||
let utxos: UTxOs = mk_utxo_for_alonzo_compatible_tx(
|
let utxos: UTxOs = mk_utxo_for_alonzo_compatible_tx(
|
||||||
&mtx.transaction_body,
|
&mtx.transaction_body,
|
||||||
|
|
@ -1241,13 +1232,10 @@ mod alonzo_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(
|
Ok(()) => panic!("Transaction network ID should match environment network_id"),
|
||||||
false,
|
|
||||||
"Transaction network ID should match environment network_id"
|
|
||||||
),
|
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Alonzo(AlonzoError::OutputWrongNetworkID) => (),
|
Alonzo(AlonzoError::OutputWrongNetworkID) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1263,7 +1251,7 @@ mod alonzo_tests {
|
||||||
let mut tx_buf: Vec<u8> = Vec::new();
|
let mut tx_buf: Vec<u8> = Vec::new();
|
||||||
let _ = encode(tx_body, &mut tx_buf);
|
let _ = encode(tx_body, &mut tx_buf);
|
||||||
mtx.transaction_body =
|
mtx.transaction_body =
|
||||||
Decode::decode(&mut Decoder::new(&tx_buf.as_slice()), &mut ()).unwrap();
|
Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
|
||||||
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
||||||
let utxos: UTxOs = mk_utxo_for_alonzo_compatible_tx(
|
let utxos: UTxOs = mk_utxo_for_alonzo_compatible_tx(
|
||||||
&mtx.transaction_body,
|
&mtx.transaction_body,
|
||||||
|
|
@ -1294,13 +1282,10 @@ mod alonzo_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(
|
Ok(()) => panic!("Transaction network ID should match environment network_id"),
|
||||||
false,
|
|
||||||
"Transaction network ID should match environment network_id"
|
|
||||||
),
|
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Alonzo(AlonzoError::TxWrongNetworkID) => (),
|
Alonzo(AlonzoError::TxWrongNetworkID) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1414,10 +1399,10 @@ mod alonzo_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Transaction ex units should be below maximum"),
|
Ok(()) => panic!("Transaction ex units should be below maximum"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Alonzo(AlonzoError::TxExUnitsExceeded) => (),
|
Alonzo(AlonzoError::TxExUnitsExceeded) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1459,13 +1444,12 @@ mod alonzo_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(
|
Ok(()) => panic!(
|
||||||
false,
|
|
||||||
"Transaction size should not exceed the maximum allowed by the protocol parameter"
|
"Transaction size should not exceed the maximum allowed by the protocol parameter"
|
||||||
),
|
),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Alonzo(AlonzoError::MaxTxSizeExceeded) => (),
|
Alonzo(AlonzoError::MaxTxSizeExceeded) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1568,7 +1552,7 @@ mod alonzo_tests {
|
||||||
let mut tx_buf: Vec<u8> = Vec::new();
|
let mut tx_buf: Vec<u8> = Vec::new();
|
||||||
let _ = encode(tx_body, &mut tx_buf);
|
let _ = encode(tx_body, &mut tx_buf);
|
||||||
mtx.transaction_body =
|
mtx.transaction_body =
|
||||||
Decode::decode(&mut Decoder::new(&tx_buf.as_slice()), &mut ()).unwrap();
|
Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
|
||||||
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
||||||
let env: Environment = Environment {
|
let env: Environment = Environment {
|
||||||
prot_params: MultiEraProtParams::Alonzo(AlonzoProtParams {
|
prot_params: MultiEraProtParams::Alonzo(AlonzoProtParams {
|
||||||
|
|
@ -1591,13 +1575,10 @@ mod alonzo_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(
|
Ok(()) => panic!("All required signers should have signed the transaction"),
|
||||||
false,
|
|
||||||
"All required signers should have signed the transaction"
|
|
||||||
),
|
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Alonzo(AlonzoError::ReqSignerMissing) => (),
|
Alonzo(AlonzoError::ReqSignerMissing) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1621,7 +1602,7 @@ mod alonzo_tests {
|
||||||
let mut tx_buf: Vec<u8> = Vec::new();
|
let mut tx_buf: Vec<u8> = Vec::new();
|
||||||
let _ = encode(tx_wits, &mut tx_buf);
|
let _ = encode(tx_wits, &mut tx_buf);
|
||||||
mtx.transaction_witness_set =
|
mtx.transaction_witness_set =
|
||||||
Decode::decode(&mut Decoder::new(&tx_buf.as_slice()), &mut ()).unwrap();
|
Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
|
||||||
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
||||||
let env: Environment = Environment {
|
let env: Environment = Environment {
|
||||||
prot_params: MultiEraProtParams::Alonzo(AlonzoProtParams {
|
prot_params: MultiEraProtParams::Alonzo(AlonzoProtParams {
|
||||||
|
|
@ -1644,10 +1625,10 @@ mod alonzo_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Missing verification key witness"),
|
Ok(()) => panic!("Missing verification key witness"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Alonzo(AlonzoError::VKWitnessMissing) => (),
|
Alonzo(AlonzoError::VKWitnessMissing) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1678,7 +1659,7 @@ mod alonzo_tests {
|
||||||
let mut tx_buf: Vec<u8> = Vec::new();
|
let mut tx_buf: Vec<u8> = Vec::new();
|
||||||
let _ = encode(tx_wits, &mut tx_buf);
|
let _ = encode(tx_wits, &mut tx_buf);
|
||||||
mtx.transaction_witness_set =
|
mtx.transaction_witness_set =
|
||||||
Decode::decode(&mut Decoder::new(&tx_buf.as_slice()), &mut ()).unwrap();
|
Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
|
||||||
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
||||||
let env: Environment = Environment {
|
let env: Environment = Environment {
|
||||||
prot_params: MultiEraProtParams::Alonzo(AlonzoProtParams {
|
prot_params: MultiEraProtParams::Alonzo(AlonzoProtParams {
|
||||||
|
|
@ -1701,10 +1682,10 @@ mod alonzo_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Witness signature should verify the transaction"),
|
Ok(()) => panic!("Witness signature should verify the transaction"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Alonzo(AlonzoError::VKWrongSignature) => (),
|
Alonzo(AlonzoError::VKWrongSignature) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1801,7 +1782,7 @@ mod alonzo_tests {
|
||||||
let mut tx_buf: Vec<u8> = Vec::new();
|
let mut tx_buf: Vec<u8> = Vec::new();
|
||||||
let _ = encode(tx_wits, &mut tx_buf);
|
let _ = encode(tx_wits, &mut tx_buf);
|
||||||
mtx.transaction_witness_set =
|
mtx.transaction_witness_set =
|
||||||
Decode::decode(&mut Decoder::new(&tx_buf.as_slice()), &mut ()).unwrap();
|
Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
|
||||||
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
||||||
let env: Environment = Environment {
|
let env: Environment = Environment {
|
||||||
prot_params: MultiEraProtParams::Alonzo(AlonzoProtParams {
|
prot_params: MultiEraProtParams::Alonzo(AlonzoProtParams {
|
||||||
|
|
@ -1824,10 +1805,10 @@ mod alonzo_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Missing Plutus script"),
|
Ok(()) => panic!("Missing Plutus script"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Alonzo(AlonzoError::ScriptWitnessMissing) => (),
|
Alonzo(AlonzoError::ScriptWitnessMissing) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1924,7 +1905,7 @@ mod alonzo_tests {
|
||||||
let mut encode_native_script_buf: Vec<u8> = Vec::new();
|
let mut encode_native_script_buf: Vec<u8> = Vec::new();
|
||||||
let _ = encode(native_script, &mut encode_native_script_buf);
|
let _ = encode(native_script, &mut encode_native_script_buf);
|
||||||
let keep_raw_native_script: KeepRaw<NativeScript> = Decode::decode(
|
let keep_raw_native_script: KeepRaw<NativeScript> = Decode::decode(
|
||||||
&mut Decoder::new(&encode_native_script_buf.as_slice()),
|
&mut Decoder::new(encode_native_script_buf.as_slice()),
|
||||||
&mut (),
|
&mut (),
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
@ -1932,7 +1913,7 @@ mod alonzo_tests {
|
||||||
let mut tx_buf: Vec<u8> = Vec::new();
|
let mut tx_buf: Vec<u8> = Vec::new();
|
||||||
let _ = encode(tx_wits, &mut tx_buf);
|
let _ = encode(tx_wits, &mut tx_buf);
|
||||||
mtx.transaction_witness_set =
|
mtx.transaction_witness_set =
|
||||||
Decode::decode(&mut Decoder::new(&tx_buf.as_slice()), &mut ()).unwrap();
|
Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
|
||||||
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
||||||
let env: Environment = Environment {
|
let env: Environment = Environment {
|
||||||
prot_params: MultiEraProtParams::Alonzo(AlonzoProtParams {
|
prot_params: MultiEraProtParams::Alonzo(AlonzoProtParams {
|
||||||
|
|
@ -1955,10 +1936,10 @@ mod alonzo_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Unneeded Plutus script"),
|
Ok(()) => panic!("Unneeded Plutus script"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Alonzo(AlonzoError::UnneededNativeScript) => (),
|
Alonzo(AlonzoError::UnneededNativeScript) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1982,7 +1963,7 @@ mod alonzo_tests {
|
||||||
let mut tx_buf: Vec<u8> = Vec::new();
|
let mut tx_buf: Vec<u8> = Vec::new();
|
||||||
let _ = encode(tx_wits, &mut tx_buf);
|
let _ = encode(tx_wits, &mut tx_buf);
|
||||||
mtx.transaction_witness_set =
|
mtx.transaction_witness_set =
|
||||||
Decode::decode(&mut Decoder::new(&tx_buf.as_slice()), &mut ()).unwrap();
|
Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
|
||||||
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
||||||
let env: Environment = Environment {
|
let env: Environment = Environment {
|
||||||
prot_params: MultiEraProtParams::Alonzo(AlonzoProtParams {
|
prot_params: MultiEraProtParams::Alonzo(AlonzoProtParams {
|
||||||
|
|
@ -2005,10 +1986,10 @@ mod alonzo_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Minting policy is not supported by native script"),
|
Ok(()) => panic!("Minting policy is not supported by native script"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Alonzo(AlonzoError::MintingLacksPolicy) => (),
|
Alonzo(AlonzoError::MintingLacksPolicy) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2105,7 +2086,7 @@ mod alonzo_tests {
|
||||||
let mut tx_buf: Vec<u8> = Vec::new();
|
let mut tx_buf: Vec<u8> = Vec::new();
|
||||||
let _ = encode(tx_wits, &mut tx_buf);
|
let _ = encode(tx_wits, &mut tx_buf);
|
||||||
mtx.transaction_witness_set =
|
mtx.transaction_witness_set =
|
||||||
Decode::decode(&mut Decoder::new(&tx_buf.as_slice()), &mut ()).unwrap();
|
Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
|
||||||
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
||||||
let env: Environment = Environment {
|
let env: Environment = Environment {
|
||||||
prot_params: MultiEraProtParams::Alonzo(AlonzoProtParams {
|
prot_params: MultiEraProtParams::Alonzo(AlonzoProtParams {
|
||||||
|
|
@ -2128,10 +2109,10 @@ mod alonzo_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Missing datum"),
|
Ok(()) => panic!("Missing datum"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Alonzo(AlonzoError::DatumMissing) => (),
|
Alonzo(AlonzoError::DatumMissing) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2229,12 +2210,12 @@ mod alonzo_tests {
|
||||||
let mut new_datum_buf: Vec<u8> = Vec::new();
|
let mut new_datum_buf: Vec<u8> = Vec::new();
|
||||||
let _ = encode(new_datum, &mut new_datum_buf);
|
let _ = encode(new_datum, &mut new_datum_buf);
|
||||||
let keep_raw_new_datum: KeepRaw<PlutusData> =
|
let keep_raw_new_datum: KeepRaw<PlutusData> =
|
||||||
Decode::decode(&mut Decoder::new(&new_datum_buf.as_slice()), &mut ()).unwrap();
|
Decode::decode(&mut Decoder::new(new_datum_buf.as_slice()), &mut ()).unwrap();
|
||||||
tx_wits.plutus_data = Some(vec![old_datum, keep_raw_new_datum]);
|
tx_wits.plutus_data = Some(vec![old_datum, keep_raw_new_datum]);
|
||||||
let mut tx_buf: Vec<u8> = Vec::new();
|
let mut tx_buf: Vec<u8> = Vec::new();
|
||||||
let _ = encode(tx_wits, &mut tx_buf);
|
let _ = encode(tx_wits, &mut tx_buf);
|
||||||
mtx.transaction_witness_set =
|
mtx.transaction_witness_set =
|
||||||
Decode::decode(&mut Decoder::new(&tx_buf.as_slice()), &mut ()).unwrap();
|
Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
|
||||||
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
||||||
let env: Environment = Environment {
|
let env: Environment = Environment {
|
||||||
prot_params: MultiEraProtParams::Alonzo(AlonzoProtParams {
|
prot_params: MultiEraProtParams::Alonzo(AlonzoProtParams {
|
||||||
|
|
@ -2257,10 +2238,10 @@ mod alonzo_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Unneeded datum"),
|
Ok(()) => panic!("Unneeded datum"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Alonzo(AlonzoError::UnneededDatum) => (),
|
Alonzo(AlonzoError::UnneededDatum) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2364,7 +2345,7 @@ mod alonzo_tests {
|
||||||
let mut tx_buf: Vec<u8> = Vec::new();
|
let mut tx_buf: Vec<u8> = Vec::new();
|
||||||
let _ = encode(tx_wits, &mut tx_buf);
|
let _ = encode(tx_wits, &mut tx_buf);
|
||||||
mtx.transaction_witness_set =
|
mtx.transaction_witness_set =
|
||||||
Decode::decode(&mut Decoder::new(&tx_buf.as_slice()), &mut ()).unwrap();
|
Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
|
||||||
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
||||||
let env: Environment = Environment {
|
let env: Environment = Environment {
|
||||||
prot_params: MultiEraProtParams::Alonzo(AlonzoProtParams {
|
prot_params: MultiEraProtParams::Alonzo(AlonzoProtParams {
|
||||||
|
|
@ -2387,10 +2368,10 @@ mod alonzo_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Unneeded redeemer"),
|
Ok(()) => panic!("Unneeded redeemer"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Alonzo(AlonzoError::UnneededRedeemer) => (),
|
Alonzo(AlonzoError::UnneededRedeemer) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2487,7 +2468,7 @@ mod alonzo_tests {
|
||||||
let mut tx_buf: Vec<u8> = Vec::new();
|
let mut tx_buf: Vec<u8> = Vec::new();
|
||||||
let _ = encode(tx_wits, &mut tx_buf);
|
let _ = encode(tx_wits, &mut tx_buf);
|
||||||
mtx.transaction_witness_set =
|
mtx.transaction_witness_set =
|
||||||
Decode::decode(&mut Decoder::new(&tx_buf.as_slice()), &mut ()).unwrap();
|
Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
|
||||||
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
||||||
let env: Environment = Environment {
|
let env: Environment = Environment {
|
||||||
prot_params: MultiEraProtParams::Alonzo(AlonzoProtParams {
|
prot_params: MultiEraProtParams::Alonzo(AlonzoProtParams {
|
||||||
|
|
@ -2510,10 +2491,10 @@ mod alonzo_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Unneeded redeemer"),
|
Ok(()) => panic!("Unneeded redeemer"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Alonzo(AlonzoError::RedeemerMissing) => (),
|
Alonzo(AlonzoError::RedeemerMissing) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2555,10 +2536,10 @@ mod alonzo_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Unneeded redeemer"),
|
Ok(()) => panic!("Unneeded redeemer"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Alonzo(AlonzoError::MetadataHash) => (),
|
Alonzo(AlonzoError::MetadataHash) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2599,10 +2580,10 @@ mod alonzo_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Unneeded redeemer"),
|
Ok(()) => panic!("Unneeded redeemer"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Alonzo(AlonzoError::MinLovelaceUnreached) => (),
|
Alonzo(AlonzoError::MinLovelaceUnreached) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2643,10 +2624,10 @@ mod alonzo_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Unneeded redeemer"),
|
Ok(()) => panic!("Unneeded redeemer"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Alonzo(AlonzoError::MaxValSizeExceeded) => (),
|
Alonzo(AlonzoError::MaxValSizeExceeded) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2747,7 +2728,7 @@ mod alonzo_tests {
|
||||||
let mut tx_witness_set_buf: Vec<u8> = Vec::new();
|
let mut tx_witness_set_buf: Vec<u8> = Vec::new();
|
||||||
let _ = encode(tx_witness_set, &mut tx_witness_set_buf);
|
let _ = encode(tx_witness_set, &mut tx_witness_set_buf);
|
||||||
mtx.transaction_witness_set =
|
mtx.transaction_witness_set =
|
||||||
Decode::decode(&mut Decoder::new(&tx_witness_set_buf.as_slice()), &mut ()).unwrap();
|
Decode::decode(&mut Decoder::new(tx_witness_set_buf.as_slice()), &mut ()).unwrap();
|
||||||
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Alonzo);
|
||||||
let env: Environment = Environment {
|
let env: Environment = Environment {
|
||||||
prot_params: MultiEraProtParams::Alonzo(AlonzoProtParams {
|
prot_params: MultiEraProtParams::Alonzo(AlonzoProtParams {
|
||||||
|
|
@ -2770,10 +2751,10 @@ mod alonzo_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Wrong script integrity hash"),
|
Ok(()) => panic!("Wrong script integrity hash"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Alonzo(AlonzoError::ScriptIntegrityHash) => (),
|
Alonzo(AlonzoError::ScriptIntegrityHash) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ mod byron_tests {
|
||||||
Ok(_) => (),
|
Ok(_) => (),
|
||||||
Err(err) => panic!("Unable to encode Tx ({:?})", err),
|
Err(err) => panic!("Unable to encode Tx ({:?})", err),
|
||||||
};
|
};
|
||||||
mtxp.transaction = Decode::decode(&mut Decoder::new(&tx_buf.as_slice()), &mut ()).unwrap();
|
mtxp.transaction = Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
|
||||||
let metx: MultiEraTx = MultiEraTx::from_byron(&mtxp);
|
let metx: MultiEraTx = MultiEraTx::from_byron(&mtxp);
|
||||||
let env: Environment = Environment {
|
let env: Environment = Environment {
|
||||||
prot_params: MultiEraProtParams::Byron(ByronProtParams {
|
prot_params: MultiEraProtParams::Byron(ByronProtParams {
|
||||||
|
|
@ -122,7 +122,7 @@ mod byron_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Inputs set should not be empty"),
|
Ok(()) => panic!("Inputs set should not be empty"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Byron(ByronError::TxInsEmpty) => (),
|
Byron(ByronError::TxInsEmpty) => (),
|
||||||
_ => panic!("Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
|
|
@ -143,7 +143,7 @@ mod byron_tests {
|
||||||
Ok(_) => (),
|
Ok(_) => (),
|
||||||
Err(err) => panic!("Unable to encode Tx ({:?})", err),
|
Err(err) => panic!("Unable to encode Tx ({:?})", err),
|
||||||
};
|
};
|
||||||
mtxp.transaction = Decode::decode(&mut Decoder::new(&tx_buf.as_slice()), &mut ()).unwrap();
|
mtxp.transaction = Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
|
||||||
let metx: MultiEraTx = MultiEraTx::from_byron(&mtxp);
|
let metx: MultiEraTx = MultiEraTx::from_byron(&mtxp);
|
||||||
let utxos: UTxOs = mk_utxo_for_byron_tx(
|
let utxos: UTxOs = mk_utxo_for_byron_tx(
|
||||||
&mtxp.transaction,
|
&mtxp.transaction,
|
||||||
|
|
@ -165,7 +165,7 @@ mod byron_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Outputs set should not be empty"),
|
Ok(()) => panic!("Outputs set should not be empty"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Byron(ByronError::TxOutsEmpty) => (),
|
Byron(ByronError::TxOutsEmpty) => (),
|
||||||
_ => panic!("Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
|
|
@ -193,7 +193,7 @@ mod byron_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "All inputs must be within the UTxO set"),
|
Ok(()) => panic!("All inputs must be within the UTxO set"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Byron(ByronError::InputNotInUTxO) => (),
|
Byron(ByronError::InputNotInUTxO) => (),
|
||||||
_ => panic!("Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
|
|
@ -220,7 +220,7 @@ mod byron_tests {
|
||||||
Ok(_) => (),
|
Ok(_) => (),
|
||||||
Err(err) => panic!("Unable to encode Tx ({:?})", err),
|
Err(err) => panic!("Unable to encode Tx ({:?})", err),
|
||||||
};
|
};
|
||||||
mtxp.transaction = Decode::decode(&mut Decoder::new(&tx_buf.as_slice()), &mut ()).unwrap();
|
mtxp.transaction = Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
|
||||||
let metx: MultiEraTx = MultiEraTx::from_byron(&mtxp);
|
let metx: MultiEraTx = MultiEraTx::from_byron(&mtxp);
|
||||||
let utxos: UTxOs = mk_utxo_for_byron_tx(
|
let utxos: UTxOs = mk_utxo_for_byron_tx(
|
||||||
&mtxp.transaction,
|
&mtxp.transaction,
|
||||||
|
|
@ -242,7 +242,7 @@ mod byron_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "All outputs must contain lovelace"),
|
Ok(()) => panic!("All outputs must contain lovelace"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Byron(ByronError::OutputWithoutLovelace) => (),
|
Byron(ByronError::OutputWithoutLovelace) => (),
|
||||||
_ => panic!("Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
|
|
@ -276,7 +276,7 @@ mod byron_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Fees should not be below minimum"),
|
Ok(()) => panic!("Fees should not be below minimum"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Byron(ByronError::FeesBelowMin) => (),
|
Byron(ByronError::FeesBelowMin) => (),
|
||||||
_ => panic!("Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
|
|
@ -310,7 +310,7 @@ mod byron_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Transaction size cannot exceed protocol limit"),
|
Ok(()) => panic!("Transaction size cannot exceed protocol limit"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Byron(ByronError::MaxTxSizeExceeded) => (),
|
Byron(ByronError::MaxTxSizeExceeded) => (),
|
||||||
_ => panic!("Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
|
|
@ -330,7 +330,7 @@ mod byron_tests {
|
||||||
Ok(_) => (),
|
Ok(_) => (),
|
||||||
Err(err) => panic!("Unable to encode Tx ({:?})", err),
|
Err(err) => panic!("Unable to encode Tx ({:?})", err),
|
||||||
};
|
};
|
||||||
mtxp.witness = Decode::decode(&mut Decoder::new(&tx_buf.as_slice()), &mut ()).unwrap();
|
mtxp.witness = Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
|
||||||
let metx: MultiEraTx = MultiEraTx::from_byron(&mtxp);
|
let metx: MultiEraTx = MultiEraTx::from_byron(&mtxp);
|
||||||
let utxos: UTxOs = mk_utxo_for_byron_tx(
|
let utxos: UTxOs = mk_utxo_for_byron_tx(
|
||||||
&mtxp.transaction,
|
&mtxp.transaction,
|
||||||
|
|
@ -352,7 +352,7 @@ mod byron_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "All inputs must have a witness signature"),
|
Ok(()) => panic!("All inputs must have a witness signature"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Byron(ByronError::MissingWitness) => (),
|
Byron(ByronError::MissingWitness) => (),
|
||||||
_ => panic!("Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
|
|
@ -381,7 +381,7 @@ mod byron_tests {
|
||||||
Ok(_) => (),
|
Ok(_) => (),
|
||||||
Err(err) => panic!("Unable to encode Tx ({:?})", err),
|
Err(err) => panic!("Unable to encode Tx ({:?})", err),
|
||||||
};
|
};
|
||||||
mtxp.witness = Decode::decode(&mut Decoder::new(&tx_buf.as_slice()), &mut ()).unwrap();
|
mtxp.witness = Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
|
||||||
let metx: MultiEraTx = MultiEraTx::from_byron(&mtxp);
|
let metx: MultiEraTx = MultiEraTx::from_byron(&mtxp);
|
||||||
let utxos: UTxOs = mk_utxo_for_byron_tx(
|
let utxos: UTxOs = mk_utxo_for_byron_tx(
|
||||||
&mtxp.transaction,
|
&mtxp.transaction,
|
||||||
|
|
@ -403,7 +403,7 @@ mod byron_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Witness signature should verify the transaction"),
|
Ok(()) => panic!("Witness signature should verify the transaction"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Byron(ByronError::WrongSignature) => (),
|
Byron(ByronError::WrongSignature) => (),
|
||||||
_ => panic!("Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,12 @@ pub fn cbor_to_bytes(input: &str) -> Vec<u8> {
|
||||||
hex::decode(input).unwrap()
|
hex::decode(input).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn minted_tx_from_cbor<'a>(tx_cbor: &'a Vec<u8>) -> MintedTx<'a> {
|
pub fn minted_tx_from_cbor(tx_cbor: &[u8]) -> MintedTx<'_> {
|
||||||
pallas_codec::minicbor::decode::<MintedTx>(&tx_cbor[..]).unwrap()
|
pallas_codec::minicbor::decode::<MintedTx>(tx_cbor).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn minted_tx_payload_from_cbor<'a>(tx_cbor: &'a Vec<u8>) -> MintedTxPayload<'a> {
|
pub fn minted_tx_payload_from_cbor(tx_cbor: &[u8]) -> MintedTxPayload<'_> {
|
||||||
pallas_codec::minicbor::decode::<MintedTxPayload>(&tx_cbor[..]).unwrap()
|
pallas_codec::minicbor::decode::<MintedTxPayload>(tx_cbor).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mk_utxo_for_byron_tx<'a>(tx: &Tx, tx_outs_info: &[(String, u64)]) -> UTxOs<'a> {
|
pub fn mk_utxo_for_byron_tx<'a>(tx: &Tx, tx_outs_info: &[(String, u64)]) -> UTxOs<'a> {
|
||||||
|
|
@ -34,7 +34,7 @@ pub fn mk_utxo_for_byron_tx<'a>(tx: &Tx, tx_outs_info: &[(String, u64)]) -> UTxO
|
||||||
};
|
};
|
||||||
let tx_out: TxOut = TxOut {
|
let tx_out: TxOut = TxOut {
|
||||||
address: input_tx_out_addr,
|
address: input_tx_out_addr,
|
||||||
amount: amount.clone(),
|
amount: *amount,
|
||||||
};
|
};
|
||||||
let multi_era_in: MultiEraInput = MultiEraInput::Byron(Box::new(Cow::Owned(tx_in)));
|
let multi_era_in: MultiEraInput = MultiEraInput::Byron(Box::new(Cow::Owned(tx_in)));
|
||||||
let multi_era_out: MultiEraOutput = MultiEraOutput::Byron(Box::new(Cow::Owned(tx_out)));
|
let multi_era_out: MultiEraOutput = MultiEraOutput::Byron(Box::new(Cow::Owned(tx_out)));
|
||||||
|
|
@ -56,7 +56,7 @@ pub fn mk_utxo_for_alonzo_compatible_tx<'a>(
|
||||||
let tx_out: TransactionOutput = TransactionOutput {
|
let tx_out: TransactionOutput = TransactionOutput {
|
||||||
address: address_bytes,
|
address: address_bytes,
|
||||||
amount: amount.clone(),
|
amount: amount.clone(),
|
||||||
datum_hash: datum_hash.clone(),
|
datum_hash: *datum_hash,
|
||||||
};
|
};
|
||||||
let multi_era_in: MultiEraInput =
|
let multi_era_in: MultiEraInput =
|
||||||
MultiEraInput::AlonzoCompatible(Box::new(Cow::Owned(tx_in)));
|
MultiEraInput::AlonzoCompatible(Box::new(Cow::Owned(tx_in)));
|
||||||
|
|
@ -67,9 +67,9 @@ pub fn mk_utxo_for_alonzo_compatible_tx<'a>(
|
||||||
utxos
|
utxos
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_collateral<'a>(
|
pub fn add_collateral(
|
||||||
tx_body: &TransactionBody,
|
tx_body: &TransactionBody,
|
||||||
utxos: &mut UTxOs<'a>,
|
utxos: &mut UTxOs<'_>,
|
||||||
collateral_info: &[(String, Value, Option<Hash<32>>)],
|
collateral_info: &[(String, Value, Option<Hash<32>>)],
|
||||||
) {
|
) {
|
||||||
match &tx_body.collateral {
|
match &tx_body.collateral {
|
||||||
|
|
@ -82,7 +82,7 @@ pub fn add_collateral<'a>(
|
||||||
let tx_out: TransactionOutput = TransactionOutput {
|
let tx_out: TransactionOutput = TransactionOutput {
|
||||||
address: address_bytes,
|
address: address_bytes,
|
||||||
amount: amount.clone(),
|
amount: amount.clone(),
|
||||||
datum_hash: datum_hash.clone(),
|
datum_hash: *datum_hash,
|
||||||
};
|
};
|
||||||
let multi_era_in: MultiEraInput =
|
let multi_era_in: MultiEraInput =
|
||||||
MultiEraInput::AlonzoCompatible(Box::new(Cow::Owned(tx_in.clone())));
|
MultiEraInput::AlonzoCompatible(Box::new(Cow::Owned(tx_in.clone())));
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ mod shelley_ma_tests {
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => (),
|
Ok(()) => (),
|
||||||
Err(err) => assert!(false, "Unexpected error ({:?})", err),
|
Err(err) => panic!("Unexpected error ({:?})", err),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -89,7 +89,7 @@ mod shelley_ma_tests {
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => (),
|
Ok(()) => (),
|
||||||
Err(err) => assert!(false, "Unexpected error ({:?})", err),
|
Err(err) => panic!("Unexpected error ({:?})", err),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -123,7 +123,7 @@ mod shelley_ma_tests {
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => (),
|
Ok(()) => (),
|
||||||
Err(err) => assert!(false, "Unexpected error ({:?})", err),
|
Err(err) => panic!("Unexpected error ({:?})", err),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -157,7 +157,7 @@ mod shelley_ma_tests {
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => (),
|
Ok(()) => (),
|
||||||
Err(err) => assert!(false, "Unexpected error ({:?})", err),
|
Err(err) => panic!("Unexpected error ({:?})", err),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -180,10 +180,10 @@ mod shelley_ma_tests {
|
||||||
let mut tx_buf: Vec<u8> = Vec::new();
|
let mut tx_buf: Vec<u8> = Vec::new();
|
||||||
match encode(tx_body, &mut tx_buf) {
|
match encode(tx_body, &mut tx_buf) {
|
||||||
Ok(_) => (),
|
Ok(_) => (),
|
||||||
Err(err) => assert!(false, "Unable to encode Tx ({:?})", err),
|
Err(err) => panic!("Unable to encode Tx ({:?})", err),
|
||||||
};
|
};
|
||||||
mtx.transaction_body =
|
mtx.transaction_body =
|
||||||
Decode::decode(&mut Decoder::new(&tx_buf.as_slice()), &mut ()).unwrap();
|
Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
|
||||||
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Shelley);
|
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Shelley);
|
||||||
let env: Environment = Environment {
|
let env: Environment = Environment {
|
||||||
prot_params: MultiEraProtParams::Shelley(ShelleyProtParams {
|
prot_params: MultiEraProtParams::Shelley(ShelleyProtParams {
|
||||||
|
|
@ -199,10 +199,10 @@ mod shelley_ma_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Inputs set should not be empty"),
|
Ok(()) => panic!("Inputs set should not be empty"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
ShelleyMA(ShelleyMAError::TxInsEmpty) => (),
|
ShelleyMA(ShelleyMAError::TxInsEmpty) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -228,10 +228,10 @@ mod shelley_ma_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "All inputs must be within the UTxO set"),
|
Ok(()) => panic!("All inputs must be within the UTxO set"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
ShelleyMA(ShelleyMAError::InputNotInUTxO) => (),
|
ShelleyMA(ShelleyMAError::InputNotInUTxO) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -254,10 +254,10 @@ mod shelley_ma_tests {
|
||||||
let mut tx_buf: Vec<u8> = Vec::new();
|
let mut tx_buf: Vec<u8> = Vec::new();
|
||||||
match encode(tx_body, &mut tx_buf) {
|
match encode(tx_body, &mut tx_buf) {
|
||||||
Ok(_) => (),
|
Ok(_) => (),
|
||||||
Err(err) => assert!(false, "Unable to encode Tx ({:?})", err),
|
Err(err) => panic!("Unable to encode Tx ({:?})", err),
|
||||||
};
|
};
|
||||||
mtx.transaction_body =
|
mtx.transaction_body =
|
||||||
Decode::decode(&mut Decoder::new(&tx_buf.as_slice()), &mut ()).unwrap();
|
Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
|
||||||
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Shelley);
|
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Shelley);
|
||||||
let env: Environment = Environment {
|
let env: Environment = Environment {
|
||||||
prot_params: MultiEraProtParams::Shelley(ShelleyProtParams {
|
prot_params: MultiEraProtParams::Shelley(ShelleyProtParams {
|
||||||
|
|
@ -273,10 +273,10 @@ mod shelley_ma_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "TTL must always be present in Shelley transactions"),
|
Ok(()) => panic!("TTL must always be present in Shelley transactions"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
ShelleyMA(ShelleyMAError::AlonzoCompNotShelley) => (),
|
ShelleyMA(ShelleyMAError::AlonzoCompNotShelley) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -309,10 +309,10 @@ mod shelley_ma_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "TTL cannot be exceeded"),
|
Ok(()) => panic!("TTL cannot be exceeded"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
ShelleyMA(ShelleyMAError::TTLExceeded) => (),
|
ShelleyMA(ShelleyMAError::TTLExceeded) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -345,10 +345,10 @@ mod shelley_ma_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Tx size exceeds max limit"),
|
Ok(()) => panic!("Tx size exceeds max limit"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
ShelleyMA(ShelleyMAError::MaxTxSizeExceeded) => (),
|
ShelleyMA(ShelleyMAError::MaxTxSizeExceeded) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -382,10 +382,10 @@ mod shelley_ma_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Output amount must be above min lovelace value"),
|
Ok(()) => panic!("Output amount must be above min lovelace value"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
ShelleyMA(ShelleyMAError::MinLovelaceUnreached) => (),
|
ShelleyMA(ShelleyMAError::MinLovelaceUnreached) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -397,14 +397,14 @@ mod shelley_ma_tests {
|
||||||
let cbor_bytes: Vec<u8> = cbor_to_bytes(include_str!("../../test_data/shelley1.tx"));
|
let cbor_bytes: Vec<u8> = cbor_to_bytes(include_str!("../../test_data/shelley1.tx"));
|
||||||
let mut mtx: MintedTx = minted_tx_from_cbor(&cbor_bytes);
|
let mut mtx: MintedTx = minted_tx_from_cbor(&cbor_bytes);
|
||||||
let mut tx_body: TransactionBody = mtx.transaction_body.unwrap().clone();
|
let mut tx_body: TransactionBody = mtx.transaction_body.unwrap().clone();
|
||||||
tx_body.fee = tx_body.fee - 1;
|
tx_body.fee -= 1;
|
||||||
let mut tx_buf: Vec<u8> = Vec::new();
|
let mut tx_buf: Vec<u8> = Vec::new();
|
||||||
match encode(tx_body, &mut tx_buf) {
|
match encode(tx_body, &mut tx_buf) {
|
||||||
Ok(_) => (),
|
Ok(_) => (),
|
||||||
Err(err) => assert!(false, "Unable to encode Tx ({:?})", err),
|
Err(err) => panic!("Unable to encode Tx ({:?})", err),
|
||||||
};
|
};
|
||||||
mtx.transaction_body =
|
mtx.transaction_body =
|
||||||
Decode::decode(&mut Decoder::new(&tx_buf.as_slice()), &mut ()).unwrap();
|
Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
|
||||||
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Shelley);
|
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Shelley);
|
||||||
let utxos: UTxOs = mk_utxo_for_alonzo_compatible_tx(
|
let utxos: UTxOs = mk_utxo_for_alonzo_compatible_tx(
|
||||||
&mtx.transaction_body,
|
&mtx.transaction_body,
|
||||||
|
|
@ -428,10 +428,10 @@ mod shelley_ma_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Preservation of value property doesn't hold"),
|
Ok(()) => panic!("Preservation of value property doesn't hold"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
ShelleyMA(ShelleyMAError::PreservationOfValue) => (),
|
ShelleyMA(ShelleyMAError::PreservationOfValue) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -464,10 +464,10 @@ mod shelley_ma_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Fee should not be below minimum"),
|
Ok(()) => panic!("Fee should not be below minimum"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
ShelleyMA(ShelleyMAError::FeesBelowMin) => (),
|
ShelleyMA(ShelleyMAError::FeesBelowMin) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -481,7 +481,7 @@ mod shelley_ma_tests {
|
||||||
// Modify the first output address.
|
// Modify the first output address.
|
||||||
let mut tx_body: TransactionBody = mtx.transaction_body.unwrap().clone();
|
let mut tx_body: TransactionBody = mtx.transaction_body.unwrap().clone();
|
||||||
let (first_output, rest): (&TransactionOutput, &[TransactionOutput]) =
|
let (first_output, rest): (&TransactionOutput, &[TransactionOutput]) =
|
||||||
(&tx_body.outputs).split_first().unwrap();
|
(tx_body.outputs).split_first().unwrap();
|
||||||
let addr: ShelleyAddress =
|
let addr: ShelleyAddress =
|
||||||
match Address::from_bytes(&Vec::<u8>::from(first_output.address.clone())) {
|
match Address::from_bytes(&Vec::<u8>::from(first_output.address.clone())) {
|
||||||
Ok(Address::Shelley(sa)) => sa,
|
Ok(Address::Shelley(sa)) => sa,
|
||||||
|
|
@ -504,10 +504,10 @@ mod shelley_ma_tests {
|
||||||
let mut tx_buf: Vec<u8> = Vec::new();
|
let mut tx_buf: Vec<u8> = Vec::new();
|
||||||
match encode(tx_body, &mut tx_buf) {
|
match encode(tx_body, &mut tx_buf) {
|
||||||
Ok(_) => (),
|
Ok(_) => (),
|
||||||
Err(err) => assert!(false, "Unable to encode Tx ({:?})", err),
|
Err(err) => panic!("Unable to encode Tx ({:?})", err),
|
||||||
};
|
};
|
||||||
mtx.transaction_body =
|
mtx.transaction_body =
|
||||||
Decode::decode(&mut Decoder::new(&tx_buf.as_slice()), &mut ()).unwrap();
|
Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
|
||||||
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Shelley);
|
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Shelley);
|
||||||
let env: Environment = Environment {
|
let env: Environment = Environment {
|
||||||
prot_params: MultiEraProtParams::Shelley(ShelleyProtParams {
|
prot_params: MultiEraProtParams::Shelley(ShelleyProtParams {
|
||||||
|
|
@ -531,10 +531,10 @@ mod shelley_ma_tests {
|
||||||
)],
|
)],
|
||||||
);
|
);
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Output with wrong network ID should be rejected"),
|
Ok(()) => panic!("Output with wrong network ID should be rejected"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
ShelleyMA(ShelleyMAError::WrongNetworkID) => (),
|
ShelleyMA(ShelleyMAError::WrongNetworkID) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -570,10 +570,10 @@ mod shelley_ma_tests {
|
||||||
network_id: 1,
|
network_id: 1,
|
||||||
};
|
};
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Output with wrong network ID should be rejected"),
|
Ok(()) => panic!("Output with wrong network ID should be rejected"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
ShelleyMA(ShelleyMAError::MetadataHash) => (),
|
ShelleyMA(ShelleyMAError::MetadataHash) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -591,10 +591,10 @@ mod shelley_ma_tests {
|
||||||
let mut tx_buf: Vec<u8> = Vec::new();
|
let mut tx_buf: Vec<u8> = Vec::new();
|
||||||
match encode(tx_wits, &mut tx_buf) {
|
match encode(tx_wits, &mut tx_buf) {
|
||||||
Ok(_) => (),
|
Ok(_) => (),
|
||||||
Err(err) => assert!(false, "Unable to encode Tx ({:?})", err),
|
Err(err) => panic!("Unable to encode Tx ({:?})", err),
|
||||||
};
|
};
|
||||||
mtx.transaction_witness_set =
|
mtx.transaction_witness_set =
|
||||||
Decode::decode(&mut Decoder::new(&tx_buf.as_slice()), &mut ()).unwrap();
|
Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
|
||||||
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Shelley);
|
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Shelley);
|
||||||
let env: Environment = Environment {
|
let env: Environment = Environment {
|
||||||
prot_params: MultiEraProtParams::Shelley(ShelleyProtParams {
|
prot_params: MultiEraProtParams::Shelley(ShelleyProtParams {
|
||||||
|
|
@ -618,10 +618,10 @@ mod shelley_ma_tests {
|
||||||
)],
|
)],
|
||||||
);
|
);
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Missing verification key witness"),
|
Ok(()) => panic!("Missing verification key witness"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
ShelleyMA(ShelleyMAError::MissingVKWitness) => (),
|
ShelleyMA(ShelleyMAError::MissingVKWitness) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -644,10 +644,10 @@ mod shelley_ma_tests {
|
||||||
let mut tx_buf: Vec<u8> = Vec::new();
|
let mut tx_buf: Vec<u8> = Vec::new();
|
||||||
match encode(tx_wits, &mut tx_buf) {
|
match encode(tx_wits, &mut tx_buf) {
|
||||||
Ok(_) => (),
|
Ok(_) => (),
|
||||||
Err(err) => assert!(false, "Unable to encode Tx ({:?})", err),
|
Err(err) => panic!("Unable to encode Tx ({:?})", err),
|
||||||
};
|
};
|
||||||
mtx.transaction_witness_set =
|
mtx.transaction_witness_set =
|
||||||
Decode::decode(&mut Decoder::new(&tx_buf.as_slice()), &mut ()).unwrap();
|
Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
|
||||||
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Shelley);
|
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Shelley);
|
||||||
let env: Environment = Environment {
|
let env: Environment = Environment {
|
||||||
prot_params: MultiEraProtParams::Shelley(ShelleyProtParams {
|
prot_params: MultiEraProtParams::Shelley(ShelleyProtParams {
|
||||||
|
|
@ -671,10 +671,10 @@ mod shelley_ma_tests {
|
||||||
)],
|
)],
|
||||||
);
|
);
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Missing verification key witness"),
|
Ok(()) => panic!("Missing verification key witness"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
ShelleyMA(ShelleyMAError::WrongSignature) => (),
|
ShelleyMA(ShelleyMAError::WrongSignature) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -692,10 +692,10 @@ mod shelley_ma_tests {
|
||||||
let mut tx_buf: Vec<u8> = Vec::new();
|
let mut tx_buf: Vec<u8> = Vec::new();
|
||||||
match encode(tx_wits, &mut tx_buf) {
|
match encode(tx_wits, &mut tx_buf) {
|
||||||
Ok(_) => (),
|
Ok(_) => (),
|
||||||
Err(err) => assert!(false, "Unable to encode Tx ({:?})", err),
|
Err(err) => panic!("Unable to encode Tx ({:?})", err),
|
||||||
};
|
};
|
||||||
mtx.transaction_witness_set =
|
mtx.transaction_witness_set =
|
||||||
Decode::decode(&mut Decoder::new(&tx_buf.as_slice()), &mut ()).unwrap();
|
Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
|
||||||
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Shelley);
|
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Shelley);
|
||||||
let env: Environment = Environment {
|
let env: Environment = Environment {
|
||||||
prot_params: MultiEraProtParams::Shelley(ShelleyProtParams {
|
prot_params: MultiEraProtParams::Shelley(ShelleyProtParams {
|
||||||
|
|
@ -719,10 +719,10 @@ mod shelley_ma_tests {
|
||||||
)],
|
)],
|
||||||
);
|
);
|
||||||
match validate(&metx, &utxos, &env) {
|
match validate(&metx, &utxos, &env) {
|
||||||
Ok(()) => assert!(false, "Missing native script witness"),
|
Ok(()) => panic!("Missing native script witness"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
ShelleyMA(ShelleyMAError::MissingScriptWitness) => (),
|
ShelleyMA(ShelleyMAError::MissingScriptWitness) => (),
|
||||||
_ => assert!(false, "Unexpected error ({:?})", err),
|
_ => panic!("Unexpected error ({:?})", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,7 @@ impl<'b> Decoder<'b> {
|
||||||
#[cfg(feature = "num-bigint")]
|
#[cfg(feature = "num-bigint")]
|
||||||
pub fn big_word(&mut self) -> Result<BigUint, Error> {
|
pub fn big_word(&mut self) -> Result<BigUint, Error> {
|
||||||
let mut leading_bit = 1;
|
let mut leading_bit = 1;
|
||||||
let mut final_word: BigUint = (0 as u8).into();
|
let mut final_word: BigUint = (0_u8).into();
|
||||||
let mut shl: u128 = 0;
|
let mut shl: u128 = 0;
|
||||||
// continue looping if lead bit is 1 which is 128 as a u8 otherwise exit
|
// continue looping if lead bit is 1 which is 128 as a u8 otherwise exit
|
||||||
while leading_bit > 0 {
|
while leading_bit > 0 {
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ impl Decode<'_> for isize {
|
||||||
#[cfg(feature = "num-bigint")]
|
#[cfg(feature = "num-bigint")]
|
||||||
impl Decode<'_> for BigInt {
|
impl Decode<'_> for BigInt {
|
||||||
fn decode(d: &mut Decoder) -> Result<Self, Error> {
|
fn decode(d: &mut Decoder) -> Result<Self, Error> {
|
||||||
Ok(d.big_integer()?.into())
|
d.big_integer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,7 @@ impl Encoder {
|
||||||
#[cfg(feature = "num-bigint")]
|
#[cfg(feature = "num-bigint")]
|
||||||
pub fn big_word(&mut self, c: BigUint) -> &mut Self {
|
pub fn big_word(&mut self, c: BigUint) -> &mut Self {
|
||||||
let mut d = c;
|
let mut d = c;
|
||||||
let zero = (0 as u8).into();
|
let zero = (0_u8).into();
|
||||||
loop {
|
loop {
|
||||||
let m: usize = 127;
|
let m: usize = 127;
|
||||||
let mut w = (d.clone() & <usize as Into<BigUint>>::into(m))
|
let mut w = (d.clone() & <usize as Into<BigUint>>::into(m))
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ pub enum Error {
|
||||||
/// inside `cmp` function you will compare the first element of the chunk e.g.
|
/// inside `cmp` function you will compare the first element of the chunk e.g.
|
||||||
/// `let cmp = |chunk: &Vec<i32>, point: &i32| chunk[0].cmp(point)`.
|
/// `let cmp = |chunk: &Vec<i32>, point: &i32| chunk[0].cmp(point)`.
|
||||||
fn chunk_binary_search<ChunkT, PointT>(
|
fn chunk_binary_search<ChunkT, PointT>(
|
||||||
chunks: &Vec<ChunkT>,
|
chunks: &[ChunkT],
|
||||||
point: &PointT,
|
point: &PointT,
|
||||||
cmp: impl Fn(&ChunkT, &PointT) -> Result<Ordering, Box<dyn std::error::Error>>,
|
cmp: impl Fn(&ChunkT, &PointT) -> Result<Ordering, Box<dyn std::error::Error>>,
|
||||||
) -> Result<Option<usize>, Box<dyn std::error::Error>> {
|
) -> Result<Option<usize>, Box<dyn std::error::Error>> {
|
||||||
|
|
|
||||||
|
|
@ -364,7 +364,7 @@ mod tests {
|
||||||
|
|
||||||
let generated = tx
|
let generated = tx
|
||||||
.plutus_v1_scripts()
|
.plutus_v1_scripts()
|
||||||
.get(0)
|
.first()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.compute_hash()
|
.compute_hash()
|
||||||
.to_string();
|
.to_string();
|
||||||
|
|
|
||||||
|
|
@ -266,8 +266,8 @@ impl<'b> MultiEraTx<'b> {
|
||||||
|
|
||||||
pub fn mints(&self) -> Vec<MultiEraPolicyAssets> {
|
pub fn mints(&self) -> Vec<MultiEraPolicyAssets> {
|
||||||
match self {
|
match self {
|
||||||
MultiEraTx::Byron(_) => vec![],
|
MultiEraTx::Byron(_) => vec![],
|
||||||
MultiEraTx::AlonzoCompatible(x, _) => x
|
MultiEraTx::AlonzoCompatible(x, _) => x
|
||||||
.transaction_body
|
.transaction_body
|
||||||
.mint
|
.mint
|
||||||
.iter()
|
.iter()
|
||||||
|
|
@ -298,7 +298,7 @@ impl<'b> MultiEraTx<'b> {
|
||||||
/// https://github.com/input-output-hk/cardano-ledger/commit/a342b74f5db3d3a75eae3e2abe358a169701b1e7
|
/// https://github.com/input-output-hk/cardano-ledger/commit/a342b74f5db3d3a75eae3e2abe358a169701b1e7
|
||||||
pub fn collateral(&self) -> Vec<MultiEraInput> {
|
pub fn collateral(&self) -> Vec<MultiEraInput> {
|
||||||
match self {
|
match self {
|
||||||
MultiEraTx::Byron(_) => vec![],
|
MultiEraTx::Byron(_) => vec![],
|
||||||
MultiEraTx::AlonzoCompatible(x, _) => x
|
MultiEraTx::AlonzoCompatible(x, _) => x
|
||||||
.transaction_body
|
.transaction_body
|
||||||
.collateral
|
.collateral
|
||||||
|
|
@ -342,7 +342,7 @@ impl<'b> MultiEraTx<'b> {
|
||||||
pub fn total_collateral(&self) -> Option<u64> {
|
pub fn total_collateral(&self) -> Option<u64> {
|
||||||
match self {
|
match self {
|
||||||
MultiEraTx::Babbage(x) => x.transaction_body.total_collateral,
|
MultiEraTx::Babbage(x) => x.transaction_body.total_collateral,
|
||||||
MultiEraTx::Conway(x) => x.transaction_body.total_collateral,
|
MultiEraTx::Conway(x) => x.transaction_body.total_collateral,
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue