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
@@ -1,6 +1,6 @@
[workspace.package]
version = "1.0.0-alpha.6"
edition = "2021"
edition = "2024"
rust-version = "1.88"
license = "Apache-2.0"
repository = "https://github.com/txpipe/pallas"
Expand Down
2 changes: 1 addition & 1 deletion examples/block-decode/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "byron-decoder"
version = "0.1.0"
edition = "2021"
edition.workspace = true
rust-version.workspace = true
publish = false

Expand Down
2 changes: 1 addition & 1 deletion examples/block-download/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "block-download"
version = "0.1.0"
edition = "2021"
edition.workspace = true
rust-version.workspace = true
publish = false

Expand Down
2 changes: 1 addition & 1 deletion examples/block-download/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use pallas::network::{
facades::PeerClient,
miniprotocols::{Point, MAINNET_MAGIC},
miniprotocols::{MAINNET_MAGIC, Point},
};

#[tokio::main]
Expand Down
2 changes: 1 addition & 1 deletion examples/crawler/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "crawler"
version = "0.1.0"
edition = "2021"
edition.workspace = true
rust-version.workspace = true
publish = false

Expand Down
2 changes: 1 addition & 1 deletion examples/crawler/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use pallas::{
ledger::traverse::{MultiEraBlock, MultiEraTx},
network::{
facades::NodeClient,
miniprotocols::{chainsync::NextResponse, Point},
miniprotocols::{Point, chainsync::NextResponse},
},
};

Expand Down
2 changes: 1 addition & 1 deletion examples/n2c-miniprotocols/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "n2c-miniprotocols"
version = "0.1.0"
edition = "2021"
edition.workspace = true
rust-version.workspace = true
publish = false

Expand Down
3 changes: 1 addition & 2 deletions examples/n2c-miniprotocols/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ use pallas::{
network::{
facades::NodeClient,
miniprotocols::{
chainsync,
PRE_PRODUCTION_MAGIC, Point, chainsync,
localstate::queries_v16::{
self, Addr, Addrs, Coin, Credential, DRep, Either, GovActionId, StakeAddr,
TransactionInput,
},
localtxsubmission::SMaybe,
Point, PRE_PRODUCTION_MAGIC,
},
},
};
Expand Down
2 changes: 1 addition & 1 deletion examples/n2n-miniprotocols/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "n2n-miniprotocols"
version = "0.1.0"
edition = "2021"
edition.workspace = true
rust-version.workspace = true
publish = false

Expand Down
2 changes: 1 addition & 1 deletion examples/n2n-miniprotocols/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use pallas::{
ledger::traverse::MultiEraHeader,
network::{
facades::PeerClient,
miniprotocols::{blockfetch, chainsync, keepalive, Point, MAINNET_MAGIC},
miniprotocols::{MAINNET_MAGIC, Point, blockfetch, chainsync, keepalive},
},
};

Expand Down
2 changes: 1 addition & 1 deletion examples/p2p-discovery/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "p2p-discovery"
version = "0.1.0"
edition = "2021"
edition.workspace = true
rust-version.workspace = true
publish = false

Expand Down
4 changes: 2 additions & 2 deletions examples/p2p-discovery/src/node.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
use std::{collections::HashSet, time::Duration};

use pallas_network2::{
Interface, Manager,
behavior::{
AnyMessage, InitiatorBehavior, InitiatorCommand, InitiatorEvent, PromotionBehavior,
},
protocol::{blockfetch::Body, chainsync::HeaderContent},
Interface, Manager,
};

pub use pallas_network2::PeerId;
pub use pallas_network2::behavior::PromotionConfig;
pub use pallas_network2::protocol::Point;
pub use pallas_network2::PeerId;

use pallas_crypto::hash::Hash;
use pallas_traverse::MultiEraBlock;
Expand Down
2 changes: 1 addition & 1 deletion examples/p2p-discovery/src/otel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ use opentelemetry_appender_tracing::layer::OpenTelemetryTracingBridge;
use opentelemetry_otlp::{
LogExporter, MetricExporter, Protocol, SpanExporter, WithExportConfig as _,
};
use opentelemetry_sdk::Resource;
use opentelemetry_sdk::logs::SdkLoggerProvider;
use opentelemetry_sdk::metrics::{PeriodicReader, SdkMeterProvider};
use opentelemetry_sdk::trace::SdkTracerProvider;
use opentelemetry_sdk::Resource;
use std::sync::OnceLock;
use std::time::Duration;
use tracing_subscriber::layer::SubscriberExt as _;
Expand Down
2 changes: 1 addition & 1 deletion examples/p2p-initiator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "p2p-initiator"
version = "0.1.0"
edition = "2021"
edition.workspace = true
rust-version.workspace = true
publish = false

Expand Down
5 changes: 3 additions & 2 deletions examples/p2p-initiator/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
use std::time::Duration;

use pallas_network2::{
Manager,
behavior::{
initiator::{InitiatorBehavior, InitiatorCommand, InitiatorEvent},
AnyMessage,
initiator::{InitiatorBehavior, InitiatorCommand, InitiatorEvent},
},
interface::TcpInterface,
protocol as proto, Manager,
protocol as proto,
};
use tokio::{select, time::Interval};

Expand Down
2 changes: 1 addition & 1 deletion examples/p2p-responder/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "p2p-responder"
version = "0.1.0"
edition = "2021"
edition.workspace = true
rust-version.workspace = true
publish = false

Expand Down
6 changes: 3 additions & 3 deletions examples/p2p-responder/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ mod otel;
use std::{net::Ipv4Addr, time::Duration};

use pallas_network2::{
Manager,
behavior::{
AnyMessage,
responder::{
connection::{ConnectionResponder, ConnectionResponderConfig},
ResponderBehavior, ResponderCommand, ResponderEvent,
connection::{ConnectionResponder, ConnectionResponderConfig},
},
AnyMessage,
},
interface::TcpListenerInterface,
protocol::{self as proto, chainsync, peersharing},
Manager,
};
use tokio::{select, time::Interval};

Expand Down
2 changes: 1 addition & 1 deletion examples/p2p-responder/src/otel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ use opentelemetry_appender_tracing::layer::OpenTelemetryTracingBridge;
use opentelemetry_otlp::{
LogExporter, MetricExporter, Protocol, SpanExporter, WithExportConfig as _,
};
use opentelemetry_sdk::Resource;
use opentelemetry_sdk::logs::SdkLoggerProvider;
use opentelemetry_sdk::metrics::{PeriodicReader, SdkMeterProvider};
use opentelemetry_sdk::trace::SdkTracerProvider;
use opentelemetry_sdk::Resource;
use std::sync::OnceLock;
use std::time::Duration;
use tracing_subscriber::layer::SubscriberExt as _;
Expand Down
2 changes: 1 addition & 1 deletion examples/wallet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "pallas-wallet"
description = "Cardano wallet utilities such as key generation"
version = "1.0.0-alpha.1"
edition = "2021"
edition.workspace = true
repository = "https://github.com/txpipe/pallas"
homepage = "https://github.com/txpipe/pallas"
documentation = "https://docs.rs/pallas"
Expand Down
2 changes: 1 addition & 1 deletion pallas-addresses/src/byron.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use pallas_codec::{
minicbor::{self, bytes::ByteVec, Decode, Encode},
minicbor::{self, Decode, Encode, bytes::ByteVec},
utils::{OrderPreservingProperties, TagWrap},
};

Expand Down
63 changes: 50 additions & 13 deletions pallas-addresses/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -865,17 +865,50 @@ mod tests {
use super::*;

const MAINNET_TEST_VECTORS: &[(&str, u8)] = &[
("addr1qx2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzer3n0d3vllmyqwsx5wktcd8cc3sq835lu7drv2xwl2wywfgse35a3x", 0u8),
("addr1z8phkx6acpnf78fuvxn0mkew3l0fd058hzquvz7w36x4gten0d3vllmyqwsx5wktcd8cc3sq835lu7drv2xwl2wywfgs9yc0hh", 1u8),
("addr1yx2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzerkr0vd4msrxnuwnccdxlhdjar77j6lg0wypcc9uar5d2shs2z78ve", 2u8),
("addr1x8phkx6acpnf78fuvxn0mkew3l0fd058hzquvz7w36x4gt7r0vd4msrxnuwnccdxlhdjar77j6lg0wypcc9uar5d2shskhj42g", 3u8),
("addr1gx2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzer5pnz75xxcrzqf96k", 4u8),
("addr128phkx6acpnf78fuvxn0mkew3l0fd058hzquvz7w36x4gtupnz75xxcrtw79hu", 5u8),
("addr1vx2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzers66hrl8", 6u8),
("addr1w8phkx6acpnf78fuvxn0mkew3l0fd058hzquvz7w36x4gtcyjy7wx", 7u8),
("stake1uyehkck0lajq8gr28t9uxnuvgcqrc6070x3k9r8048z8y5gh6ffgw", 14u8),
("stake178phkx6acpnf78fuvxn0mkew3l0fd058hzquvz7w36x4gtcccycj5", 15u8),
("37btjrVyb4KDXBNC4haBVPCrro8AQPHwvCMp3RFhhSVWwfFmZ6wwzSK6JK1hY6wHNmtrpTf1kdbva8TCneM2YsiXT7mrzT21EacHnPpz5YyUdj64na", 8u8),
(
"addr1qx2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzer3n0d3vllmyqwsx5wktcd8cc3sq835lu7drv2xwl2wywfgse35a3x",
0u8,
),
(
"addr1z8phkx6acpnf78fuvxn0mkew3l0fd058hzquvz7w36x4gten0d3vllmyqwsx5wktcd8cc3sq835lu7drv2xwl2wywfgs9yc0hh",
1u8,
),
(
"addr1yx2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzerkr0vd4msrxnuwnccdxlhdjar77j6lg0wypcc9uar5d2shs2z78ve",
2u8,
),
(
"addr1x8phkx6acpnf78fuvxn0mkew3l0fd058hzquvz7w36x4gt7r0vd4msrxnuwnccdxlhdjar77j6lg0wypcc9uar5d2shskhj42g",
3u8,
),
(
"addr1gx2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzer5pnz75xxcrzqf96k",
4u8,
),
(
"addr128phkx6acpnf78fuvxn0mkew3l0fd058hzquvz7w36x4gtupnz75xxcrtw79hu",
5u8,
),
(
"addr1vx2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzers66hrl8",
6u8,
),
(
"addr1w8phkx6acpnf78fuvxn0mkew3l0fd058hzquvz7w36x4gtcyjy7wx",
7u8,
),
(
"stake1uyehkck0lajq8gr28t9uxnuvgcqrc6070x3k9r8048z8y5gh6ffgw",
14u8,
),
(
"stake178phkx6acpnf78fuvxn0mkew3l0fd058hzquvz7w36x4gtcccycj5",
15u8,
),
(
"37btjrVyb4KDXBNC4haBVPCrro8AQPHwvCMp3RFhhSVWwfFmZ6wwzSK6JK1hY6wHNmtrpTf1kdbva8TCneM2YsiXT7mrzT21EacHnPpz5YyUdj64na",
8u8,
),
];

const PAYMENT_PUBLIC_KEY: &str =
Expand Down Expand Up @@ -1009,7 +1042,9 @@ mod tests {

#[test]
fn test_minted_invalid_pointed_address() {
let addr = Address::from_hex("40C19D7D05E90EEB6394B53313FE79D47077DE33068C6B813BBE5C9D5681FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7F81FFFFFFFFFFFFFFFF7F81FFFFFFFFFFFFFFFF7F");
let addr = Address::from_hex(
"40C19D7D05E90EEB6394B53313FE79D47077DE33068C6B813BBE5C9D5681FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7F81FFFFFFFFFFFFFFFF7F81FFFFFFFFFFFFFFFF7F",
);
assert!(matches!(addr, Ok(Address::Shelley(_))));
}

Expand All @@ -1032,7 +1067,9 @@ mod tests {

#[test]
fn test_minted_extra_bytes_base_address() {
let addr = Address::from_hex("015bad085057ac10ecc7060f7ac41edd6f63068d8963ef7d86ca58669e5ecf2d283418a60be5a848a2380eb721000da1e0bbf39733134beca4cb57afb0b35fc89c63061c9914e055001a518c7516");
let addr = Address::from_hex(
"015bad085057ac10ecc7060f7ac41edd6f63068d8963ef7d86ca58669e5ecf2d283418a60be5a848a2380eb721000da1e0bbf39733134beca4cb57afb0b35fc89c63061c9914e055001a518c7516",
);
assert!(matches!(addr, Ok(Address::Shelley(_))));
}
}
2 changes: 1 addition & 1 deletion pallas-bech32/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "pallas-bech32"
version = "0.1.0"
edition = "2021"
edition.workspace = true
repository = "https://github.com/txpipe/pallas"
homepage = "https://github.com/txpipe/pallas"
license = "Apache-2.0"
Expand Down
4 changes: 3 additions & 1 deletion pallas-codec/src/flat/decode/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ pub enum Error {
DecodeChar(u32),
#[error("{0}")]
Message(String),
#[error("Unknown term constructor tag: {0}.\n\nHere are the buffer bytes ({1} preceding) {2}\n\nBuffer position is {3} and buffer length is {4}")]
#[error(
"Unknown term constructor tag: {0}.\n\nHere are the buffer bytes ({1} preceding) {2}\n\nBuffer position is {3} and buffer length is {4}"
)]
UnknownTermConstructor(u8, usize, String, usize, usize),
}
2 changes: 1 addition & 1 deletion pallas-codec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ macro_rules! codec_by_datatype {

#[cfg(test)]
mod tests {
use super::minicbor::{self, decode, encode, Decode, Encode};
use super::minicbor::{self, Decode, Encode, decode, encode};

#[derive(Clone, Debug)]
enum Thing {
Expand Down
8 changes: 2 additions & 6 deletions pallas-codec/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use minicbor::{
Decode, Encode,
data::{IanaTag, Tag, Type},
decode::Error,
Decode, Encode,
};
use serde::{Deserialize, Serialize};
use std::{borrow::Cow, str::FromStr};
Expand Down Expand Up @@ -798,11 +798,7 @@ impl<T> NonEmptySet<T> {
}

pub fn from_vec(x: Vec<T>) -> Option<Self> {
if x.is_empty() {
None
} else {
Some(Self(x))
}
if x.is_empty() { None } else { Some(Self(x)) }
}
}

Expand Down
8 changes: 4 additions & 4 deletions pallas-configs/src/alonzo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ impl CostModel {
if i >= values.len() {
break;
}
if let serde_json::Value::Number(num) = v {
if let Some(int_val) = num.as_i64() {
values[i] = int_val;
}
if let serde_json::Value::Number(num) = v
&& let Some(int_val) = num.as_i64()
{
values[i] = int_val;
}
}

Expand Down
2 changes: 1 addition & 1 deletion pallas-configs/src/byron.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
use pallas_addresses::ByronAddress;
use pallas_crypto::hash::Hash;
use serde::Deserialize;
use serde_with::serde_as;
use serde_with::DisplayFromStr;
use serde_with::serde_as;
use std::collections::HashMap;

#[derive(Debug, Deserialize, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion pallas-crypto/src/hash/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl<'de, const BYTES: usize> Deserialize<'de> for Hash<BYTES> {

#[cfg(test)]
mod tests {
use serde_test::{assert_de_tokens_error, assert_tokens, Token};
use serde_test::{Token, assert_de_tokens_error, assert_tokens};

use super::*;

Expand Down
6 changes: 3 additions & 3 deletions pallas-crypto/src/kes/single_kes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ use std::convert::TryInto;
use crate::kes::common::{PublicKey, Seed};
use crate::kes::errors::Error;
use crate::kes::traits::{KesCompactSig, KesSig, KesSk};
pub use ed25519_dalek::{PUBLIC_KEY_LENGTH, SECRET_KEY_LENGTH};
use ed25519_dalek::{
Signature as EdSignature, Signer, SigningKey as EdSigningKey, VerifyingKey as EdPublicKey,
SIGNATURE_LENGTH,
SIGNATURE_LENGTH, Signature as EdSignature, Signer, SigningKey as EdSigningKey,
VerifyingKey as EdPublicKey,
};
pub use ed25519_dalek::{PUBLIC_KEY_LENGTH, SECRET_KEY_LENGTH};
use serde::{Deserialize, Serialize};
use serde_with::serde_as;

Expand Down
Loading
Loading