Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ futures-util = "0.3.31"
gasket = { git = "https://github.com/construkts/gasket-rs.git", features = ["derive"] }
hex = "0.4.3"
itertools = "0.14.0"
pallas = { git = "https://github.com/txpipe/pallas.git", features = ["phase2", "wallet"] }
pallas = { version = "1.0.0-alpha.1", features = ["phase2", "wallet"] }
protoc-wkt = "1.0.0"
serde = { version = "1.0.217", features = ["derive"] }
thiserror = "2.0.11"
Expand Down
8 changes: 4 additions & 4 deletions src/ledger/relay/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl RelayDataAdapter for MockRelayDataAdapter {

impl MockRelayDataAdapter {
pub fn new() -> Self {
Self {
Self {
mock_relays: vec![
"109.205.181.113:7900".to_string(),
"194.163.149.210:6000".to_string(),
Expand All @@ -30,8 +30,8 @@ impl MockRelayDataAdapter {
"preview.leadstakepool.com:3002".to_string(),
"relay.preview.cardanostakehouse.com:11000".to_string(),
"130.162.231.122:6001".to_string(),
]
}
],
}
}
}

Expand All @@ -41,7 +41,7 @@ mod tests {
use tokio::test;

/// A mock provider that returns a pre-defined list of string addresses, e.g., ["relay1:3001", "relay2:3002"].

#[test]
async fn it_returns_mock_relays() {
let provider = MockRelayDataAdapter {
Expand Down
36 changes: 18 additions & 18 deletions src/network/mock_ouroboros_tx_submit_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,14 @@ impl MockOuroborosTxSubmitPeerServer {
mod broadcast_tests {

use pallas::{
codec::minicbor,
crypto::hash::Hash,
ledger::primitives::{
conway::{
PostAlonzoTransactionOutput, PseudoTransactionOutput, TransactionBody, Tx, Value,
PostAlonzoTransactionOutput, TransactionBody, TransactionOutput, Tx, Value,
WitnessSet,
},
Fragment, TransactionInput,
TransactionInput,
},
};
use tracing::info;
Expand Down Expand Up @@ -354,12 +355,15 @@ mod broadcast_tests {
index: i as u64,
};

let output = PseudoTransactionOutput::PostAlonzo(PostAlonzoTransactionOutput {
address: vec![100 + i as u8; 28].into(),
value: Value::Coin((i as u64 + 1) * 1_000_000),
datum_option: None,
script_ref: None,
});
let output = TransactionOutput::PostAlonzo(
PostAlonzoTransactionOutput {
address: vec![100 + i as u8; 28].into(),
value: Value::Coin((i as u64 + 1) * 1_000_000),
datum_option: None,
script_ref: None,
}
.into(),
);

let tx = Tx {
transaction_body: TransactionBody {
Expand All @@ -383,7 +387,8 @@ mod broadcast_tests {
proposal_procedures: None,
treasury_value: None,
donation: None,
},
}
.into(),
transaction_witness_set: WitnessSet {
vkeywitness: None,
native_script: None,
Expand All @@ -393,20 +398,15 @@ mod broadcast_tests {
plutus_v3_script: None,
plutus_data: None,
redeemer: None,
},
}
.into(),
success: true,
auxiliary_data: None.into(),
};

// Serialize the transaction to CBOR bytes
match tx.encode_fragment() {
Ok(bytes) => sample_txs.push(bytes),
Err(e) => {
// Log error but continue with other transactions
tracing::error!("Failed to serialize transaction: {:?}", e);
continue;
}
}
let payload = minicbor::to_vec(tx).unwrap();
sample_txs.push(payload);
}

sample_txs
Expand Down
4 changes: 2 additions & 2 deletions src/network/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub mod mempool;
pub mod peer_manager;
pub mod mock_ouroboros_tx_submit_server;
pub mod peer;
pub mod mock_ouroboros_tx_submit_server;
pub mod peer_manager;
8 changes: 7 additions & 1 deletion src/pipeline/peer_discovery/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ use thiserror::Error;
use tokio::time::sleep;
use tracing::info;

use crate::{ledger::relay::RelayDataAdapter, network::{peer::PeerError, peer_manager::{PeerManager, PeerManagerConfig, PeerManagerError}}};
use crate::{
ledger::relay::RelayDataAdapter,
network::{
peer::PeerError,
peer_manager::{PeerManager, PeerManagerConfig, PeerManagerError},
},
};

#[derive(Error, Debug)]
pub enum FanoutError {
Expand Down
6 changes: 5 additions & 1 deletion src/signing/key/sign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use bip39::Mnemonic;
use pallas::{
ledger::traverse::MultiEraTx,
txbuilder::{BuildConway, BuiltTransaction, Bytes, Bytes32, StagingTransaction},
wallet::keystore::PrivateKey,
};

use super::derive::get_ed25519_keypair;
Expand All @@ -22,7 +23,10 @@ pub fn to_built_transaction(tx: &MultiEraTx) -> BuiltTransaction {

pub fn sign_transaction(built_tx: BuiltTransaction, mnemonic: &Mnemonic) -> BuiltTransaction {
let (signing_key, _) = get_ed25519_keypair(mnemonic);
let signed_tx = built_tx.sign(signing_key);
let signed_tx = match signing_key {
PrivateKey::Normal(secret_key) => built_tx.sign(&secret_key),
PrivateKey::Extended(secret_key_extended) => built_tx.sign(&secret_key_extended),
};
match signed_tx {
Ok(tx) => tx,
_ => panic!("Failed to sign transaction"),
Expand Down