From fcbaf4ed97a287b439fec34872371cc82602cfb7 Mon Sep 17 00:00:00 2001 From: Santiago Carmuega Date: Mon, 4 Dec 2023 09:22:56 -0300 Subject: [PATCH] fix: fix unable to build and sign txs (#345) --- pallas-txbuilder/src/transaction/model.rs | 6 +++--- pallas-wallet/Cargo.toml | 1 - pallas-wallet/src/lib.rs | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pallas-txbuilder/src/transaction/model.rs b/pallas-txbuilder/src/transaction/model.rs index f8e8988..adc0e60 100644 --- a/pallas-txbuilder/src/transaction/model.rs +++ b/pallas-txbuilder/src/transaction/model.rs @@ -626,7 +626,7 @@ impl BuiltTransaction { self.signatures = Some(new_sigs); // TODO: chance for serialisation round trip issues? - let mut tx = babbage::Tx::decode_fragment(&self.tx_hash.0) + let mut tx = babbage::Tx::decode_fragment(&self.tx_bytes.0) .map_err(|_| TxBuilderError::CorruptedTxBytes)?; let mut vkey_witnesses = tx.transaction_witness_set.vkeywitness.unwrap_or_default(); @@ -667,7 +667,7 @@ impl BuiltTransaction { self.signatures = Some(new_sigs); // TODO: chance for serialisation round trip issues? - let mut tx = babbage::Tx::decode_fragment(&self.tx_hash.0) + let mut tx = babbage::Tx::decode_fragment(&self.tx_bytes.0) .map_err(|_| TxBuilderError::CorruptedTxBytes)?; let mut vkey_witnesses = tx.transaction_witness_set.vkeywitness.unwrap_or_default(); @@ -703,7 +703,7 @@ impl BuiltTransaction { self.signatures = Some(new_sigs); // TODO: chance for serialisation round trip issues? - let mut tx = babbage::Tx::decode_fragment(&self.tx_hash.0) + let mut tx = babbage::Tx::decode_fragment(&self.tx_bytes.0) .map_err(|_| TxBuilderError::CorruptedTxBytes)?; let mut vkey_witnesses = tx.transaction_witness_set.vkeywitness.unwrap_or_default(); diff --git a/pallas-wallet/Cargo.toml b/pallas-wallet/Cargo.toml index f19aa05..a3fa7d3 100644 --- a/pallas-wallet/Cargo.toml +++ b/pallas-wallet/Cargo.toml @@ -13,7 +13,6 @@ authors = ["Santiago Carmuega "] thiserror = "1.0.49" pallas-crypto = { version = "=0.20.0", path = "../pallas-crypto" } ed25519-bip32 = "0.4.1" -rand = "0.8.5" bip39 = { version = "2.0.0", features = ["rand_core"] } cryptoxide = "0.4.4" bech32 = "0.9.1" diff --git a/pallas-wallet/src/lib.rs b/pallas-wallet/src/lib.rs index 9a673cb..a5a899f 100644 --- a/pallas-wallet/src/lib.rs +++ b/pallas-wallet/src/lib.rs @@ -1,9 +1,9 @@ use bech32::{FromBase32, ToBase32}; +use bip39::rand_core::{CryptoRng, RngCore}; use bip39::{Language, Mnemonic}; use cryptoxide::{hmac::Hmac, pbkdf2::pbkdf2, sha2::Sha512}; use ed25519_bip32::{self, XPrv, XPub, XPRV_SIZE}; use pallas_crypto::key::ed25519::{self}; -use rand::{CryptoRng, RngCore}; use thiserror::Error; #[derive(Error, Debug)] @@ -178,7 +178,7 @@ impl Bip32PublicKey { #[cfg(test)] mod test { - use rand::rngs::OsRng; + use bip39::rand_core::OsRng; use crate::{Bip32PrivateKey, Bip32PublicKey};