chore: apply new lint warnings from latest clippy (#561)
This commit is contained in:
parent
106d8676b6
commit
3a614d2c91
23 changed files with 185 additions and 171 deletions
|
|
@ -1,7 +1,6 @@
|
|||
pub mod common;
|
||||
|
||||
use common::*;
|
||||
use hex;
|
||||
use pallas_addresses::{Address, Network, ShelleyAddress, ShelleyPaymentPart};
|
||||
use pallas_applying::{
|
||||
utils::{
|
||||
|
|
@ -598,7 +597,7 @@ mod babbage_tests {
|
|||
let mut tx_buf: Vec<u8> = Vec::new();
|
||||
let _ = encode(tx_body, &mut tx_buf);
|
||||
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_babbage(&mtx);
|
||||
let acnt = AccountState {
|
||||
treasury: 261_254_564_000_000,
|
||||
|
|
@ -675,7 +674,7 @@ mod babbage_tests {
|
|||
let mut tx_buf: Vec<u8> = Vec::new();
|
||||
let _ = encode(tx_body, &mut tx_buf);
|
||||
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_babbage(&mtx);
|
||||
let acnt = AccountState {
|
||||
treasury: 261_254_564_000_000,
|
||||
|
|
@ -725,7 +724,7 @@ mod babbage_tests {
|
|||
let mut tx_buf: Vec<u8> = Vec::new();
|
||||
let _ = encode(tx_body, &mut tx_buf);
|
||||
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_babbage(&mtx);
|
||||
let acnt = AccountState {
|
||||
treasury: 261_254_564_000_000,
|
||||
|
|
@ -857,7 +856,7 @@ mod babbage_tests {
|
|||
let mut tx_buf: Vec<u8> = Vec::new();
|
||||
let _ = encode(tx_body, &mut tx_buf);
|
||||
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_babbage(&mtx);
|
||||
let acnt = AccountState {
|
||||
treasury: 261_254_564_000_000,
|
||||
|
|
@ -1019,7 +1018,7 @@ mod babbage_tests {
|
|||
};
|
||||
let altered_address: ShelleyAddress = ShelleyAddress::new(
|
||||
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(),
|
||||
);
|
||||
let tx_in = mtx
|
||||
|
|
@ -1303,7 +1302,7 @@ mod babbage_tests {
|
|||
let mut tx_buf: Vec<u8> = Vec::new();
|
||||
let _ = encode(tx_body, &mut tx_buf);
|
||||
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_babbage(&mtx);
|
||||
let acnt = AccountState {
|
||||
treasury: 261_254_564_000_000,
|
||||
|
|
@ -1346,11 +1345,11 @@ mod babbage_tests {
|
|||
)];
|
||||
let utxos: UTxOs = mk_utxo_for_babbage_tx(&mtx.transaction_body, tx_outs_info);
|
||||
let mut tx_body: MintedTransactionBody = (*mtx.transaction_body).clone();
|
||||
tx_body.fee = tx_body.fee - 1;
|
||||
tx_body.fee -= 1;
|
||||
let mut tx_buf: Vec<u8> = Vec::new();
|
||||
let _ = encode(tx_body, &mut tx_buf);
|
||||
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_babbage(&mtx);
|
||||
let acnt = AccountState {
|
||||
treasury: 261_254_564_000_000,
|
||||
|
|
@ -1480,7 +1479,7 @@ mod babbage_tests {
|
|||
let utxos: UTxOs = mk_utxo_for_babbage_tx(&mtx.transaction_body, tx_outs_info);
|
||||
let mut tx_body: MintedTransactionBody = (*mtx.transaction_body).clone();
|
||||
let (first_output, rest): (&MintedTransactionOutput, &[MintedTransactionOutput]) =
|
||||
(&tx_body.outputs).split_first().unwrap();
|
||||
tx_body.outputs.split_first().unwrap();
|
||||
let (address_bytes, val): (Bytes, Value) = match first_output {
|
||||
PseudoTransactionOutput::Legacy(output) => {
|
||||
(output.address.clone(), output.amount.clone())
|
||||
|
|
@ -1511,7 +1510,7 @@ mod babbage_tests {
|
|||
let mut tx_buf: Vec<u8> = Vec::new();
|
||||
let _ = encode(tx_body, &mut tx_buf);
|
||||
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_babbage(&mtx);
|
||||
let acnt = AccountState {
|
||||
treasury: 261_254_564_000_000,
|
||||
|
|
@ -1561,7 +1560,7 @@ mod babbage_tests {
|
|||
let mut tx_buf: Vec<u8> = Vec::new();
|
||||
let _ = encode(tx_body, &mut tx_buf);
|
||||
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_babbage(&mtx);
|
||||
let acnt = AccountState {
|
||||
treasury: 261_254_564_000_000,
|
||||
|
|
@ -1809,7 +1808,7 @@ mod babbage_tests {
|
|||
let mut tx_buf: Vec<u8> = Vec::new();
|
||||
let _ = encode(tx_wits, &mut tx_buf);
|
||||
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_babbage(&mtx);
|
||||
let acnt = AccountState {
|
||||
treasury: 261_254_564_000_000,
|
||||
|
|
@ -1977,7 +1976,7 @@ mod babbage_tests {
|
|||
let mut tx_buf: Vec<u8> = Vec::new();
|
||||
let _ = encode(tx_wits, &mut tx_buf);
|
||||
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_babbage(&mtx);
|
||||
let acnt = AccountState {
|
||||
treasury: 261_254_564_000_000,
|
||||
|
|
@ -2066,7 +2065,7 @@ mod babbage_tests {
|
|||
let mut tx_buf: Vec<u8> = Vec::new();
|
||||
let _ = encode(tx_wits, &mut tx_buf);
|
||||
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_babbage(&mtx);
|
||||
let acnt = AccountState {
|
||||
treasury: 261_254_564_000_000,
|
||||
|
|
@ -2156,12 +2155,12 @@ mod babbage_tests {
|
|||
let mut new_datum_buf: Vec<u8> = Vec::new();
|
||||
let _ = encode(new_datum, &mut new_datum_buf);
|
||||
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]);
|
||||
let mut tx_buf: Vec<u8> = Vec::new();
|
||||
let _ = encode(tx_wits, &mut tx_buf);
|
||||
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_babbage(&mtx);
|
||||
let acnt = AccountState {
|
||||
treasury: 261_254_564_000_000,
|
||||
|
|
@ -2254,7 +2253,7 @@ mod babbage_tests {
|
|||
let mut tx_buf: Vec<u8> = Vec::new();
|
||||
let _ = encode(tx_wits, &mut tx_buf);
|
||||
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_babbage(&mtx);
|
||||
let acnt = AccountState {
|
||||
treasury: 261_254_564_000_000,
|
||||
|
|
@ -2344,7 +2343,7 @@ mod babbage_tests {
|
|||
let mut tx_witness_set_buf: Vec<u8> = Vec::new();
|
||||
let _ = encode(tx_witness_set, &mut tx_witness_set_buf);
|
||||
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_babbage(&mtx);
|
||||
let acnt = AccountState {
|
||||
treasury: 261_254_564_000_000,
|
||||
|
|
|
|||
|
|
@ -24,11 +24,11 @@ pub fn minted_tx_from_cbor(tx_cbor: &[u8]) -> MintedTx<'_> {
|
|||
}
|
||||
|
||||
pub fn babbage_minted_tx_from_cbor(tx_cbor: &[u8]) -> BabbageMintedTx<'_> {
|
||||
pallas_codec::minicbor::decode::<BabbageMintedTx>(&tx_cbor[..]).unwrap()
|
||||
pallas_codec::minicbor::decode::<BabbageMintedTx>(tx_cbor).unwrap()
|
||||
}
|
||||
|
||||
pub fn minted_tx_payload_from_cbor<'a>(tx_cbor: &'a Vec<u8>) -> MintedTxPayload<'a> {
|
||||
pallas_codec::minicbor::decode::<MintedTxPayload>(&tx_cbor[..]).unwrap()
|
||||
pub fn minted_tx_payload_from_cbor(tx_cbor: &[u8]) -> MintedTxPayload<'_> {
|
||||
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> {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ pub struct Decoder<'b> {
|
|||
}
|
||||
|
||||
impl<'b> Decoder<'b> {
|
||||
pub fn new(bytes: &'b [u8]) -> Decoder {
|
||||
pub fn new(bytes: &'b [u8]) -> Decoder<'b> {
|
||||
Decoder {
|
||||
buffer: bytes,
|
||||
pos: 0,
|
||||
|
|
|
|||
|
|
@ -1120,7 +1120,7 @@ impl<'b, T> KeepRaw<'b, T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'b, T> Deref for KeepRaw<'b, T> {
|
||||
impl<T> Deref for KeepRaw<'_, T> {
|
||||
type Target = T;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ impl<const BITS: usize> Write for Hasher<BITS> {
|
|||
}
|
||||
*/
|
||||
|
||||
impl<'a, const BITS: usize> minicbor::encode::Write for &'a mut Hasher<BITS> {
|
||||
impl<const BITS: usize> minicbor::encode::Write for &mut Hasher<BITS> {
|
||||
type Error = std::convert::Infallible;
|
||||
|
||||
#[inline]
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ impl<const BYTES: usize> Serialize for Hash<BYTES> {
|
|||
|
||||
struct HashVisitor<const BYTES: usize> {}
|
||||
|
||||
impl<'de, const BYTES: usize> Visitor<'de> for HashVisitor<BYTES> {
|
||||
impl<const BYTES: usize> Visitor<'_> for HashVisitor<BYTES> {
|
||||
type Value = Hash<BYTES>;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
|
|
|
|||
|
|
@ -48,13 +48,13 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_epoch_nonce() {
|
||||
let nc_values = vec![
|
||||
let nc_values = [
|
||||
hex::decode("e86e133bd48ff5e79bec43af1ac3e348b539172f33e502d2c96735e8c51bd04d")
|
||||
.unwrap(),
|
||||
hex::decode("d1340a9c1491f0face38d41fd5c82953d0eb48320d65e952414a0c5ebaf87587")
|
||||
.unwrap(),
|
||||
];
|
||||
let nh_values = vec![
|
||||
let nh_values = [
|
||||
hex::decode("d7a1ff2a365abed59c9ae346cba842b6d3df06d055dba79a113e0704b44cc3e9")
|
||||
.unwrap(),
|
||||
hex::decode("ee91d679b0a6ce3015b894c575c799e971efac35c7a8cbdc2b3f579005e69abd")
|
||||
|
|
@ -63,7 +63,7 @@ mod tests {
|
|||
let ee = hex::decode("d982e06fd33e7440b43cefad529b7ecafbaa255e38178ad4189a37e4ce9bf1fa")
|
||||
.unwrap();
|
||||
let extra_entropy_values: Vec<Option<&[u8]>> = vec![None, Some(&ee)];
|
||||
let expected_epoch_nonces = vec![
|
||||
let expected_epoch_nonces = [
|
||||
hex::decode("e536a0081ddd6d19786e9d708a85819a5c3492c0da7349f59c8ad3e17e4acd98")
|
||||
.unwrap(),
|
||||
hex::decode("0022cfa563a5328c4fb5c8017121329e964c26ade5d167b1bd9b2ec967772b60")
|
||||
|
|
|
|||
|
|
@ -565,7 +565,7 @@ mod tests {
|
|||
}
|
||||
|
||||
fn read_full_snapshot(path: &Path) {
|
||||
let reader = super::read_blocks(&path).unwrap();
|
||||
let reader = super::read_blocks(path).unwrap();
|
||||
|
||||
let mut count = 0;
|
||||
let mut last_slot = None;
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ impl Neg for Decimal {
|
|||
}
|
||||
|
||||
// Implement Neg for a reference to Decimal
|
||||
impl<'a> Neg for &'a Decimal {
|
||||
impl Neg for &Decimal {
|
||||
type Output = Decimal;
|
||||
|
||||
fn neg(self) -> Self::Output {
|
||||
|
|
@ -138,7 +138,7 @@ impl Abs for Decimal {
|
|||
}
|
||||
|
||||
// Implement Abs for a reference to Decimal
|
||||
impl<'a> Abs for &'a Decimal {
|
||||
impl Abs for &Decimal {
|
||||
type Output = Decimal;
|
||||
|
||||
fn abs(self) -> Self::Output {
|
||||
|
|
@ -167,7 +167,7 @@ impl MulAssign for Decimal {
|
|||
}
|
||||
|
||||
// Implement Mul for a reference to Decimal
|
||||
impl<'a, 'b> Mul<&'b Decimal> for &'a Decimal {
|
||||
impl<'b> Mul<&'b Decimal> for &Decimal {
|
||||
type Output = Decimal;
|
||||
|
||||
fn mul(self, rhs: &'b Decimal) -> Self::Output {
|
||||
|
|
@ -178,7 +178,7 @@ impl<'a, 'b> Mul<&'b Decimal> for &'a Decimal {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, 'b> MulAssign<&'b Decimal> for &'a mut Decimal {
|
||||
impl<'b> MulAssign<&'b Decimal> for &mut Decimal {
|
||||
fn mul_assign(&mut self, rhs: &'b Decimal) {
|
||||
self.data *= &rhs.data;
|
||||
scale(&mut self.data);
|
||||
|
|
@ -203,7 +203,7 @@ impl DivAssign for Decimal {
|
|||
}
|
||||
|
||||
// Implement Div for a reference to Decimal
|
||||
impl<'a, 'b> Div<&'b Decimal> for &'a Decimal {
|
||||
impl<'b> Div<&'b Decimal> for &Decimal {
|
||||
type Output = Decimal;
|
||||
|
||||
fn div(self, rhs: &'b Decimal) -> Self::Output {
|
||||
|
|
@ -213,7 +213,7 @@ impl<'a, 'b> Div<&'b Decimal> for &'a Decimal {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, 'b> DivAssign<&'b Decimal> for &'a mut Decimal {
|
||||
impl<'b> DivAssign<&'b Decimal> for &mut Decimal {
|
||||
fn div_assign(&mut self, rhs: &'b Decimal) {
|
||||
let temp = self.data.clone();
|
||||
div(&mut self.data, &temp, &rhs.data);
|
||||
|
|
@ -237,7 +237,7 @@ impl SubAssign for Decimal {
|
|||
}
|
||||
|
||||
// Implement Sub for a reference to Decimal
|
||||
impl<'a, 'b> Sub<&'b Decimal> for &'a Decimal {
|
||||
impl<'b> Sub<&'b Decimal> for &Decimal {
|
||||
type Output = Decimal;
|
||||
|
||||
fn sub(self, rhs: &'b Decimal) -> Self::Output {
|
||||
|
|
@ -247,7 +247,7 @@ impl<'a, 'b> Sub<&'b Decimal> for &'a Decimal {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, 'b> SubAssign<&'b Decimal> for &'a mut Decimal {
|
||||
impl<'b> SubAssign<&'b Decimal> for &mut Decimal {
|
||||
fn sub_assign(&mut self, rhs: &'b Decimal) {
|
||||
self.data -= &rhs.data;
|
||||
}
|
||||
|
|
@ -270,7 +270,7 @@ impl AddAssign for Decimal {
|
|||
}
|
||||
|
||||
// Implement Add for a reference to Decimal
|
||||
impl<'a, 'b> Add<&'b Decimal> for &'a Decimal {
|
||||
impl<'b> Add<&'b Decimal> for &Decimal {
|
||||
type Output = Decimal;
|
||||
|
||||
fn add(self, rhs: &'b Decimal) -> Self::Output {
|
||||
|
|
@ -280,7 +280,7 @@ impl<'a, 'b> Add<&'b Decimal> for &'a Decimal {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, 'b> AddAssign<&'b Decimal> for &'a mut Decimal {
|
||||
impl<'b> AddAssign<&'b Decimal> for &mut Decimal {
|
||||
fn add_assign(&mut self, rhs: &'b Decimal) {
|
||||
self.data += &rhs.data;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -267,9 +267,7 @@ pub type UTxOByTxin = UTxOByAddress;
|
|||
pub type Datum = (Era, TagWrap<Bytes, 24>);
|
||||
|
||||
// From `pallas-primitives`, with fewer `derive`s
|
||||
#[derive(
|
||||
Encode, Decode, Debug, PartialEq, Eq, PartialOrd, Ord, Clone,
|
||||
)]
|
||||
#[derive(Encode, Decode, Debug, PartialEq, Eq, PartialOrd, Ord, Clone)]
|
||||
pub struct TransactionInput {
|
||||
#[n(0)]
|
||||
pub transaction_id: Hash<32>,
|
||||
|
|
|
|||
|
|
@ -1,28 +1,34 @@
|
|||
use std::{
|
||||
fs, collections::BTreeSet, net::{Ipv4Addr, SocketAddrV4},
|
||||
time::Duration, path::Path
|
||||
};
|
||||
use hex::FromHex;
|
||||
use pallas_codec::utils::{AnyCbor, AnyUInt, Bytes, KeyValuePairs, TagWrap};
|
||||
use pallas_crypto::hash::Hash;
|
||||
use pallas_network::miniprotocols::localstate::queries_v16::{
|
||||
self, Addr, Addrs, ChainBlockNumber, Fraction, GenesisConfig, RationalNumber, Snapshots,
|
||||
StakeAddr, Stakes, SystemStart, UnitInterval, Value,
|
||||
};
|
||||
use pallas_network::{
|
||||
facades::{NodeClient, PeerClient, PeerServer},
|
||||
multiplexer::{Bearer, Plexer},
|
||||
miniprotocols::{
|
||||
blockfetch,
|
||||
blockfetch::BlockRequest,
|
||||
chainsync::{ClientRequest, HeaderContent, Tip},
|
||||
handshake::n2n::VersionData,
|
||||
chainsync::{self, NextResponse},
|
||||
txsubmission::{EraTxBody, TxIdAndSize},
|
||||
chainsync::{ClientRequest, HeaderContent, Tip},
|
||||
handshake,
|
||||
handshake::n2n::VersionData,
|
||||
localstate,
|
||||
localstate::ClientQueryRequest,
|
||||
handshake, localstate, txsubmission, MAINNET_MAGIC, blockfetch,
|
||||
Point,
|
||||
txsubmission,
|
||||
txsubmission::{EraTxBody, TxIdAndSize},
|
||||
Point, MAINNET_MAGIC,
|
||||
},
|
||||
multiplexer::{Bearer, Plexer},
|
||||
};
|
||||
use pallas_network::miniprotocols::localstate::queries_v16::{
|
||||
self, Addr, Addrs, ChainBlockNumber, Fraction, GenesisConfig, Snapshots, Stakes,
|
||||
SystemStart, UnitInterval, Value, StakeAddr, RationalNumber,
|
||||
use std::{
|
||||
collections::BTreeSet,
|
||||
fs,
|
||||
net::{Ipv4Addr, SocketAddrV4},
|
||||
path::Path,
|
||||
time::Duration,
|
||||
};
|
||||
use hex::FromHex;
|
||||
|
||||
use tokio::net::TcpListener;
|
||||
|
||||
|
|
@ -494,8 +500,10 @@ pub async fn local_state_query_server_and_client_happy_path() {
|
|||
let query: queries_v16::Request =
|
||||
match server.statequery().recv_while_acquired().await.unwrap() {
|
||||
ClientQueryRequest::Query(q) => q.into_decode().unwrap(),
|
||||
x => panic!("(While expecting `GetSystemStart`) \
|
||||
Unexpected message from client: {x:?}"),
|
||||
x => panic!(
|
||||
"(While expecting `GetSystemStart`) \
|
||||
Unexpected message from client: {x:?}"
|
||||
),
|
||||
};
|
||||
|
||||
assert_eq!(query, queries_v16::Request::GetSystemStart);
|
||||
|
|
@ -515,8 +523,10 @@ pub async fn local_state_query_server_and_client_happy_path() {
|
|||
let query: queries_v16::Request =
|
||||
match server.statequery().recv_while_acquired().await.unwrap() {
|
||||
ClientQueryRequest::Query(q) => q.into_decode().unwrap(),
|
||||
x => panic!("(While expecting `GetChainBlockNo`) \
|
||||
Unexpected message from client: {x:?}"),
|
||||
x => panic!(
|
||||
"(While expecting `GetChainBlockNo`) \
|
||||
Unexpected message from client: {x:?}"
|
||||
),
|
||||
};
|
||||
|
||||
assert_eq!(query, queries_v16::Request::GetChainBlockNo);
|
||||
|
|
@ -536,22 +546,25 @@ pub async fn local_state_query_server_and_client_happy_path() {
|
|||
let query: queries_v16::Request =
|
||||
match server.statequery().recv_while_acquired().await.unwrap() {
|
||||
ClientQueryRequest::Query(q) => q.into_decode().unwrap(),
|
||||
x => panic!("(While expecting `GetStakeDistribution`) \
|
||||
Unexpected message from client: {x:?}"),
|
||||
x => panic!(
|
||||
"(While expecting `GetStakeDistribution`) \
|
||||
Unexpected message from client: {x:?}"
|
||||
),
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
query,
|
||||
queries_v16::Request::LedgerQuery(
|
||||
queries_v16::LedgerQuery::BlockQuery(
|
||||
5,
|
||||
queries_v16::BlockQuery::GetStakeDistribution,
|
||||
),
|
||||
)
|
||||
queries_v16::Request::LedgerQuery(queries_v16::LedgerQuery::BlockQuery(
|
||||
5,
|
||||
queries_v16::BlockQuery::GetStakeDistribution,
|
||||
),)
|
||||
);
|
||||
assert_eq!(*server.statequery().state(), localstate::State::Querying);
|
||||
|
||||
let rational = RationalNumber { numerator: 10, denominator: 20 };
|
||||
let rational = RationalNumber {
|
||||
numerator: 10,
|
||||
denominator: 20,
|
||||
};
|
||||
let pool = localstate::queries_v16::Pool {
|
||||
stakes: rational.clone(),
|
||||
hashes: b"pool1qv4qgv62s3ha74p0643nexee9zvcdydcyahqqnavhj90zheuykz"
|
||||
|
|
@ -576,8 +589,10 @@ pub async fn local_state_query_server_and_client_happy_path() {
|
|||
let query: queries_v16::Request =
|
||||
match server.statequery().recv_while_acquired().await.unwrap() {
|
||||
ClientQueryRequest::Query(q) => q.into_decode().unwrap(),
|
||||
x => panic!("(While expecting `GetUTxOByAddress`) \
|
||||
Unexpected message from client: {x:?}"),
|
||||
x => panic!(
|
||||
"(While expecting `GetUTxOByAddress`) \
|
||||
Unexpected message from client: {x:?}"
|
||||
),
|
||||
};
|
||||
|
||||
let addr_hex =
|
||||
|
|
@ -589,12 +604,10 @@ pub async fn local_state_query_server_and_client_happy_path() {
|
|||
|
||||
assert_eq!(
|
||||
query,
|
||||
queries_v16::Request::LedgerQuery(
|
||||
queries_v16::LedgerQuery::BlockQuery(
|
||||
5,
|
||||
queries_v16::BlockQuery::GetUTxOByAddress(addrs),
|
||||
),
|
||||
)
|
||||
queries_v16::Request::LedgerQuery(queries_v16::LedgerQuery::BlockQuery(
|
||||
5,
|
||||
queries_v16::BlockQuery::GetUTxOByAddress(addrs),
|
||||
),)
|
||||
);
|
||||
|
||||
assert_eq!(*server.statequery().state(), localstate::State::Querying);
|
||||
|
|
@ -608,16 +621,15 @@ pub async fn local_state_query_server_and_client_happy_path() {
|
|||
let datum = hex::decode(hex_datum).unwrap().into();
|
||||
let tag = TagWrap::<_, 24>::new(datum);
|
||||
let inline_datum = Some((1_u16, tag));
|
||||
let values = queries_v16::TransactionOutput::Current(
|
||||
queries_v16::PostAlonsoTransactionOutput {
|
||||
let values =
|
||||
queries_v16::TransactionOutput::Current(queries_v16::PostAlonsoTransactionOutput {
|
||||
address: b"addr_test1vr80076l3x5uw6n94nwhgmv7ssgy6muzf47ugn6z0l92rhg2mgtu0"
|
||||
.to_vec()
|
||||
.into(),
|
||||
amount: Value::Coin(lovelace),
|
||||
inline_datum,
|
||||
script_ref: None,
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
let utxo = KeyValuePairs::from(vec![(
|
||||
queries_v16::UTxO {
|
||||
|
|
@ -635,17 +647,17 @@ pub async fn local_state_query_server_and_client_happy_path() {
|
|||
let query: queries_v16::Request =
|
||||
match server.statequery().recv_while_acquired().await.unwrap() {
|
||||
ClientQueryRequest::Query(q) => q.into_decode().unwrap(),
|
||||
x => panic!("(While expecting `GetCurrentPParams`) \
|
||||
Unexpected message from client: {x:?}"),
|
||||
x => panic!(
|
||||
"(While expecting `GetCurrentPParams`) \
|
||||
Unexpected message from client: {x:?}"
|
||||
),
|
||||
};
|
||||
assert_eq!(
|
||||
query,
|
||||
queries_v16::Request::LedgerQuery(
|
||||
queries_v16::LedgerQuery::BlockQuery(
|
||||
5,
|
||||
queries_v16::BlockQuery::GetCurrentPParams,
|
||||
),
|
||||
)
|
||||
queries_v16::Request::LedgerQuery(queries_v16::LedgerQuery::BlockQuery(
|
||||
5,
|
||||
queries_v16::BlockQuery::GetCurrentPParams,
|
||||
),)
|
||||
);
|
||||
assert_eq!(*server.statequery().state(), localstate::State::Querying);
|
||||
|
||||
|
|
@ -671,7 +683,7 @@ pub async fn local_state_query_server_and_client_happy_path() {
|
|||
numerator: 3,
|
||||
denominator: 1000000,
|
||||
}),
|
||||
protocol_version: Some((5,0)),
|
||||
protocol_version: Some((5, 0)),
|
||||
min_pool_cost: Some(AnyUInt::U32(340000000)),
|
||||
ada_per_utxo_byte: Some(AnyUInt::U16(44)),
|
||||
cost_models_for_script_languages: None,
|
||||
|
|
@ -690,18 +702,18 @@ pub async fn local_state_query_server_and_client_happy_path() {
|
|||
let query: queries_v16::Request =
|
||||
match server.statequery().recv_while_acquired().await.unwrap() {
|
||||
ClientQueryRequest::Query(q) => q.into_decode().unwrap(),
|
||||
x => panic!("(While expecting `GetStakeSnapshots`) \
|
||||
Unexpected message from client: {x:?}"),
|
||||
x => panic!(
|
||||
"(While expecting `GetStakeSnapshots`) \
|
||||
Unexpected message from client: {x:?}"
|
||||
),
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
query,
|
||||
queries_v16::Request::LedgerQuery(
|
||||
queries_v16::LedgerQuery::BlockQuery(
|
||||
5,
|
||||
queries_v16::BlockQuery::GetStakeSnapshots(BTreeSet::new()),
|
||||
),
|
||||
)
|
||||
queries_v16::Request::LedgerQuery(queries_v16::LedgerQuery::BlockQuery(
|
||||
5,
|
||||
queries_v16::BlockQuery::GetStakeSnapshots(BTreeSet::new()),
|
||||
),)
|
||||
);
|
||||
|
||||
assert_eq!(*server.statequery().state(), localstate::State::Querying);
|
||||
|
|
@ -734,18 +746,18 @@ pub async fn local_state_query_server_and_client_happy_path() {
|
|||
let query: queries_v16::Request =
|
||||
match server.statequery().recv_while_acquired().await.unwrap() {
|
||||
ClientQueryRequest::Query(q) => q.into_decode().unwrap(),
|
||||
x => panic!("(While expecting `GetGenesisConfig`) \
|
||||
Unexpected message from client: {x:?}"),
|
||||
x => panic!(
|
||||
"(While expecting `GetGenesisConfig`) \
|
||||
Unexpected message from client: {x:?}"
|
||||
),
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
query,
|
||||
queries_v16::Request::LedgerQuery(
|
||||
queries_v16::LedgerQuery::BlockQuery(
|
||||
5,
|
||||
queries_v16::BlockQuery::GetGenesisConfig,
|
||||
),
|
||||
)
|
||||
queries_v16::Request::LedgerQuery(queries_v16::LedgerQuery::BlockQuery(
|
||||
5,
|
||||
queries_v16::BlockQuery::GetGenesisConfig,
|
||||
),)
|
||||
);
|
||||
|
||||
assert_eq!(*server.statequery().state(), localstate::State::Querying);
|
||||
|
|
@ -777,8 +789,10 @@ pub async fn local_state_query_server_and_client_happy_path() {
|
|||
|
||||
let maybe_point = match server.statequery().recv_while_acquired().await.unwrap() {
|
||||
ClientQueryRequest::ReAcquire(p) => p,
|
||||
x => panic!("(While expecting `ReAcquire`) \
|
||||
Unexpected message from client: {x:?}"),
|
||||
x => panic!(
|
||||
"(While expecting `ReAcquire`) \
|
||||
Unexpected message from client: {x:?}"
|
||||
),
|
||||
};
|
||||
|
||||
assert_eq!(maybe_point, Some(Point::Specific(1337, vec![1, 2, 3])));
|
||||
|
|
@ -787,28 +801,33 @@ pub async fn local_state_query_server_and_client_happy_path() {
|
|||
server.statequery().send_acquired().await.unwrap();
|
||||
|
||||
// server receives query from client
|
||||
let query: Vec<u8> =
|
||||
match server.statequery().recv_while_acquired().await.unwrap() {
|
||||
ClientQueryRequest::Query(q) => q.unwrap(),
|
||||
x => panic!("(While expecting `GetFilteredDeleg...`) \
|
||||
Unexpected message from client: {x:?}"),
|
||||
};
|
||||
let query: Vec<u8> = match server.statequery().recv_while_acquired().await.unwrap() {
|
||||
ClientQueryRequest::Query(q) => q.unwrap(),
|
||||
x => panic!(
|
||||
"(While expecting `GetFilteredDeleg...`) \
|
||||
Unexpected message from client: {x:?}"
|
||||
),
|
||||
};
|
||||
|
||||
let addr: Addr = <[u8; 28]>::from_hex(
|
||||
"1218F563E4E10958FDABBDFB470B2F9D386215763CC89273D9BDFFFA"
|
||||
).unwrap().to_vec().into();
|
||||
let addr: Addr =
|
||||
<[u8; 28]>::from_hex("1218F563E4E10958FDABBDFB470B2F9D386215763CC89273D9BDFFFA")
|
||||
.unwrap()
|
||||
.to_vec()
|
||||
.into();
|
||||
// CBOR got from preprod node. Mind the stripped `8203`.
|
||||
let cbor_query = Vec::<u8>::from_hex(
|
||||
"820082008206820a818200581c1218f563e4e10958fdabbdfb470b2f9d386215763cc89273d9bdfffa"
|
||||
).unwrap();
|
||||
|
||||
|
||||
assert_eq!(query, cbor_query);
|
||||
assert_eq!(*server.statequery().state(), localstate::State::Querying);
|
||||
|
||||
let pool_addr: Addr = <[u8; 28]>::from_hex(
|
||||
"1E3105F23F2AC91B3FB4C35FA4FE301421028E356E114944E902005B"
|
||||
).unwrap().to_vec().into();
|
||||
|
||||
let pool_addr: Addr =
|
||||
<[u8; 28]>::from_hex("1E3105F23F2AC91B3FB4C35FA4FE301421028E356E114944E902005B")
|
||||
.unwrap()
|
||||
.to_vec()
|
||||
.into();
|
||||
|
||||
let delegs = KeyValuePairs::from(vec![(StakeAddr::from((0, addr.clone())), pool_addr)]);
|
||||
let rewards = KeyValuePairs::from(vec![(StakeAddr::from((0, addr)), 250526523)]);
|
||||
let delegs_rewards = queries_v16::FilteredDelegsRewards { delegs, rewards };
|
||||
|
|
@ -893,10 +912,7 @@ pub async fn local_state_query_server_and_client_happy_path() {
|
|||
);
|
||||
|
||||
let request = AnyCbor::from_encode(queries_v16::Request::LedgerQuery(
|
||||
queries_v16::LedgerQuery::BlockQuery(
|
||||
5,
|
||||
queries_v16::BlockQuery::GetStakeDistribution,
|
||||
),
|
||||
queries_v16::LedgerQuery::BlockQuery(5, queries_v16::BlockQuery::GetStakeDistribution),
|
||||
));
|
||||
|
||||
client.statequery().send_query(request).await.unwrap();
|
||||
|
|
@ -909,7 +925,10 @@ pub async fn local_state_query_server_and_client_happy_path() {
|
|||
.into_decode()
|
||||
.unwrap();
|
||||
|
||||
let rational = RationalNumber { numerator: 10, denominator: 20 };
|
||||
let rational = RationalNumber {
|
||||
numerator: 10,
|
||||
denominator: 20,
|
||||
};
|
||||
let pool = localstate::queries_v16::Pool {
|
||||
stakes: rational.clone(),
|
||||
hashes: b"pool1qv4qgv62s3ha74p0643nexee9zvcdydcyahqqnavhj90zheuykz"
|
||||
|
|
@ -961,16 +980,15 @@ pub async fn local_state_query_server_and_client_happy_path() {
|
|||
let datum = hex::decode(hex_datum).unwrap().into();
|
||||
let tag = TagWrap::<_, 24>::new(datum);
|
||||
let inline_datum = Some((1_u16, tag));
|
||||
let values = queries_v16::TransactionOutput::Current(
|
||||
queries_v16::PostAlonsoTransactionOutput {
|
||||
let values =
|
||||
queries_v16::TransactionOutput::Current(queries_v16::PostAlonsoTransactionOutput {
|
||||
address: b"addr_test1vr80076l3x5uw6n94nwhgmv7ssgy6muzf47ugn6z0l92rhg2mgtu0"
|
||||
.to_vec()
|
||||
.into(),
|
||||
amount: Value::Coin(lovelace),
|
||||
inline_datum,
|
||||
script_ref: None,
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
let utxo = KeyValuePairs::from(vec![(
|
||||
queries_v16::UTxO {
|
||||
|
|
@ -983,10 +1001,7 @@ pub async fn local_state_query_server_and_client_happy_path() {
|
|||
assert_eq!(result, queries_v16::UTxOByAddress { utxo });
|
||||
|
||||
let request = AnyCbor::from_encode(queries_v16::Request::LedgerQuery(
|
||||
queries_v16::LedgerQuery::BlockQuery(
|
||||
5,
|
||||
queries_v16::BlockQuery::GetCurrentPParams,
|
||||
),
|
||||
queries_v16::LedgerQuery::BlockQuery(5, queries_v16::BlockQuery::GetCurrentPParams),
|
||||
));
|
||||
|
||||
client.statequery().send_query(request).await.unwrap();
|
||||
|
|
@ -1023,7 +1038,7 @@ pub async fn local_state_query_server_and_client_happy_path() {
|
|||
numerator: 3,
|
||||
denominator: 1000000,
|
||||
}),
|
||||
protocol_version: Some((5,0)),
|
||||
protocol_version: Some((5, 0)),
|
||||
min_pool_cost: Some(AnyUInt::U32(340000000)),
|
||||
ada_per_utxo_byte: Some(AnyUInt::U16(44)),
|
||||
cost_models_for_script_languages: None,
|
||||
|
|
@ -1077,10 +1092,7 @@ pub async fn local_state_query_server_and_client_happy_path() {
|
|||
assert_eq!(result, queries_v16::StakeSnapshot { snapshots });
|
||||
|
||||
let request = AnyCbor::from_encode(queries_v16::Request::LedgerQuery(
|
||||
queries_v16::LedgerQuery::BlockQuery(
|
||||
5,
|
||||
queries_v16::BlockQuery::GetGenesisConfig,
|
||||
),
|
||||
queries_v16::LedgerQuery::BlockQuery(5, queries_v16::BlockQuery::GetGenesisConfig),
|
||||
));
|
||||
|
||||
client.statequery().send_query(request).await.unwrap();
|
||||
|
|
@ -1119,15 +1131,17 @@ pub async fn local_state_query_server_and_client_happy_path() {
|
|||
.send_reacquire(Some(Point::Specific(1337, vec![1, 2, 3])))
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
||||
client.statequery().recv_while_acquiring().await.unwrap();
|
||||
|
||||
let addr: Addr = <[u8; 28]>::from_hex(
|
||||
"1218F563E4E10958FDABBDFB470B2F9D386215763CC89273D9BDFFFA"
|
||||
).unwrap().to_vec().into();
|
||||
let addr: Addr =
|
||||
<[u8; 28]>::from_hex("1218F563E4E10958FDABBDFB470B2F9D386215763CC89273D9BDFFFA")
|
||||
.unwrap()
|
||||
.to_vec()
|
||||
.into();
|
||||
let mut addrs = BTreeSet::new();
|
||||
addrs.insert(StakeAddr::from((0x00, addr.clone())));
|
||||
|
||||
|
||||
let request = AnyCbor::from_encode(queries_v16::Request::LedgerQuery(
|
||||
queries_v16::LedgerQuery::BlockQuery(
|
||||
6,
|
||||
|
|
@ -1135,7 +1149,7 @@ pub async fn local_state_query_server_and_client_happy_path() {
|
|||
),
|
||||
));
|
||||
client.statequery().send_query(request).await.unwrap();
|
||||
|
||||
|
||||
let result: Vec<u8> = client
|
||||
.statequery()
|
||||
.recv_while_querying()
|
||||
|
|
@ -1147,8 +1161,9 @@ pub async fn local_state_query_server_and_client_happy_path() {
|
|||
"8182a18200581c1218f563e4e10958fdabbdfb470b2f9d386215763cc89273d9bd\
|
||||
fffa581c1e3105f23f2ac91b3fb4c35fa4fe301421028e356e114944e902005ba1\
|
||||
8200581c1218f563e4e10958fdabbdfb470b2f9d386215763cc89273d9bdfffa1a\
|
||||
0eeebb3b"
|
||||
).unwrap();
|
||||
0eeebb3b",
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(result, delegs_rewards_cbor);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use pallas_crypto::hash::Hash;
|
|||
|
||||
use crate::{MultiEraAsset, MultiEraPolicyAssets};
|
||||
|
||||
impl<'b> MultiEraPolicyAssets<'b> {
|
||||
impl MultiEraPolicyAssets<'_> {
|
||||
pub fn policy(&self) -> &Hash<28> {
|
||||
match self {
|
||||
MultiEraPolicyAssets::AlonzoCompatibleMint(x, _) => x,
|
||||
|
|
@ -74,7 +74,7 @@ impl<'b> MultiEraPolicyAssets<'b> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'b> MultiEraAsset<'b> {
|
||||
impl MultiEraAsset<'_> {
|
||||
pub fn policy(&self) -> &Hash<28> {
|
||||
match self {
|
||||
MultiEraAsset::AlonzoCompatibleMint(x, ..) => x,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use pallas_primitives::alonzo;
|
|||
|
||||
use crate::MultiEraTx;
|
||||
|
||||
impl<'b> MultiEraTx<'b> {
|
||||
impl MultiEraTx<'_> {
|
||||
pub fn aux_plutus_v1_scripts(&self) -> &[alonzo::PlutusScript<1>] {
|
||||
if let Some(aux_data) = self.aux_data() {
|
||||
if let alonzo::AuxiliaryData::PostAlonzo(x) = aux_data.deref() {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use pallas_primitives::{alonzo, conway};
|
|||
|
||||
use crate::MultiEraCert;
|
||||
|
||||
impl<'b> MultiEraCert<'b> {
|
||||
impl MultiEraCert<'_> {
|
||||
pub fn as_alonzo(&self) -> Option<&alonzo::Certificate> {
|
||||
match self {
|
||||
MultiEraCert::AlonzoCompatible(x) => Some(x),
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use pallas_primitives::alonzo;
|
|||
|
||||
use crate::MultiEraMeta;
|
||||
|
||||
impl<'b> MultiEraMeta<'b> {
|
||||
impl MultiEraMeta<'_> {
|
||||
pub fn as_alonzo(&self) -> Option<&alonzo::Metadata> {
|
||||
match self {
|
||||
Self::AlonzoCompatible(x) => Some(x),
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ impl Default for MultiEraSigners<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'b> MultiEraSigners<'b> {
|
||||
impl MultiEraSigners<'_> {
|
||||
pub fn as_alonzo(&self) -> Option<&alonzo::RequiredSigners> {
|
||||
match self {
|
||||
Self::AlonzoCompatible(x) => Some(x),
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use pallas_codec::utils::Nullable;
|
|||
|
||||
use crate::{MultiEraBlock, MultiEraTx};
|
||||
|
||||
impl<'b> MultiEraTx<'b> {
|
||||
impl MultiEraTx<'_> {
|
||||
fn aux_data_size(&self) -> usize {
|
||||
match self {
|
||||
MultiEraTx::AlonzoCompatible(x, _) => match &x.auxiliary_data {
|
||||
|
|
@ -44,7 +44,7 @@ impl<'b> MultiEraTx<'b> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'b> MultiEraBlock<'b> {
|
||||
impl MultiEraBlock<'_> {
|
||||
pub fn body_size(&self) -> Option<usize> {
|
||||
match self {
|
||||
MultiEraBlock::AlonzoCompatible(x, _) => {
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ impl GenesisValues {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> MultiEraBlock<'a> {
|
||||
impl MultiEraBlock<'_> {
|
||||
pub fn epoch(&self, genesis: &GenesisValues) -> (Epoch, SubSlot) {
|
||||
match self {
|
||||
MultiEraBlock::EpochBoundary(x) => (x.header.consensus_data.epoch_id, 0),
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use pallas_primitives::alonzo;
|
|||
|
||||
use crate::MultiEraWithdrawals;
|
||||
|
||||
impl<'b> MultiEraWithdrawals<'b> {
|
||||
impl MultiEraWithdrawals<'_> {
|
||||
pub fn as_alonzo(&self) -> Option<&alonzo::Withdrawals> {
|
||||
match self {
|
||||
Self::AlonzoCompatible(x) => Some(x),
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ mod tests {
|
|||
});
|
||||
|
||||
fn assert_script_data_hash_matches(bytes: &[u8], language_view: &LanguageView) {
|
||||
let tx = MultiEraTx::decode(&bytes).unwrap();
|
||||
let tx = MultiEraTx::decode(bytes).unwrap();
|
||||
let tx = tx.as_conway().unwrap();
|
||||
|
||||
let witness = conway::WitnessSet::from(tx.transaction_witness_set.clone().unwrap());
|
||||
|
|
|
|||
|
|
@ -696,7 +696,8 @@ impl BuiltTransaction {
|
|||
signature: Vec::from(signature.as_ref()).into(),
|
||||
});
|
||||
|
||||
tx.transaction_witness_set.vkeywitness = Some(NonEmptySet::from_vec(vkey_witnesses).unwrap());
|
||||
tx.transaction_witness_set.vkeywitness =
|
||||
Some(NonEmptySet::from_vec(vkey_witnesses).unwrap());
|
||||
|
||||
self.tx_bytes = tx.encode_fragment().unwrap().into();
|
||||
}
|
||||
|
|
@ -726,7 +727,7 @@ impl BuiltTransaction {
|
|||
let mut tx = conway::Tx::decode_fragment(&self.tx_bytes.0)
|
||||
.map_err(|_| TxBuilderError::CorruptedTxBytes)?;
|
||||
|
||||
let mut vkey_witnesses = tx
|
||||
let mut vkey_witnesses = tx
|
||||
.transaction_witness_set
|
||||
.vkeywitness
|
||||
.map(|x| x.to_vec())
|
||||
|
|
@ -734,7 +735,8 @@ impl BuiltTransaction {
|
|||
|
||||
vkey_witnesses.retain(|x| *x.vkey != pk.0.to_vec());
|
||||
|
||||
tx.transaction_witness_set.vkeywitness = Some(NonEmptySet::from_vec(vkey_witnesses).unwrap());
|
||||
tx.transaction_witness_set.vkeywitness =
|
||||
Some(NonEmptySet::from_vec(vkey_witnesses).unwrap());
|
||||
|
||||
self.tx_bytes = tx.encode_fragment().unwrap().into();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ impl<'de> Deserialize<'de> for Bytes32 {
|
|||
|
||||
struct Bytes32Visitor;
|
||||
|
||||
impl<'de> Visitor<'de> for Bytes32Visitor {
|
||||
impl Visitor<'_> for Bytes32Visitor {
|
||||
type Value = Bytes32;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
|
|
@ -73,7 +73,7 @@ impl<'de> Deserialize<'de> for Hash28 {
|
|||
|
||||
struct Hash28Visitor;
|
||||
|
||||
impl<'de> Visitor<'de> for Hash28Visitor {
|
||||
impl Visitor<'_> for Hash28Visitor {
|
||||
type Value = Hash28;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
|
|
@ -113,7 +113,7 @@ impl<'de> Deserialize<'de> for Bytes {
|
|||
|
||||
struct BytesVisitor;
|
||||
|
||||
impl<'de> Visitor<'de> for BytesVisitor {
|
||||
impl Visitor<'_> for BytesVisitor {
|
||||
type Value = Bytes;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
|
|
@ -265,7 +265,7 @@ impl<'de> Deserialize<'de> for RedeemerPurpose {
|
|||
|
||||
struct RedeemerPurposeVisitor;
|
||||
|
||||
impl<'de> Visitor<'de> for RedeemerPurposeVisitor {
|
||||
impl Visitor<'_> for RedeemerPurposeVisitor {
|
||||
type Value = RedeemerPurpose;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
|
|
@ -333,7 +333,7 @@ impl<'de> Deserialize<'de> for Address {
|
|||
|
||||
struct AddressVisitor;
|
||||
|
||||
impl<'de> Visitor<'de> for AddressVisitor {
|
||||
impl Visitor<'_> for AddressVisitor {
|
||||
type Value = Address;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
|
|
@ -370,7 +370,7 @@ impl<'de> Deserialize<'de> for Bytes64 {
|
|||
|
||||
struct Bytes64Visitor;
|
||||
|
||||
impl<'de> Visitor<'de> for Bytes64Visitor {
|
||||
impl Visitor<'_> for Bytes64Visitor {
|
||||
type Value = Bytes64;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ impl<C: LedgerContext> Mapper<C> {
|
|||
u5c::Redeemer {
|
||||
purpose: self.map_purpose(&x.tag()).into(),
|
||||
payload: self.map_plutus_datum(x.data()).into(),
|
||||
index: x.index().into(),
|
||||
index: x.index(),
|
||||
ex_units: Some(u5c::ExUnits {
|
||||
steps: x.ex_units().steps,
|
||||
memory: x.ex_units().mem,
|
||||
|
|
@ -613,7 +613,7 @@ mod tests {
|
|||
// )
|
||||
// .unwrap();
|
||||
|
||||
let expected: serde_json::Value = serde_json::from_str(&json_str).unwrap();
|
||||
let expected: serde_json::Value = serde_json::from_str(json_str).unwrap();
|
||||
|
||||
assert_eq!(expected, current)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue