Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(traverse): introduce small QoL improvements #567

Merged
merged 1 commit into from
Dec 29, 2024
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
12 changes: 12 additions & 0 deletions pallas-traverse/src/redeemers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ impl<'b> MultiEraRedeemer<'b> {
}
}

pub fn into_conway_deprecated(&self) -> Option<conway::Redeemer> {
match self {
Self::AlonzoCompatible(_) => None,
Self::Conway(x, y) => Some(conway::Redeemer {
tag: x.tag,
index: x.index,
data: y.data.clone(),
ex_units: y.ex_units,
}),
}
}

pub fn from_alonzo_compatible(redeemer: &'b alonzo::Redeemer) -> Self {
Self::AlonzoCompatible(Box::new(Cow::Borrowed(redeemer)))
}
Expand Down
6 changes: 3 additions & 3 deletions pallas-traverse/src/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ impl<'b> MultiEraTx<'b> {

/// Return inputs as expected for processing
///
/// To process inputs we need a set (no duplicated) and lexicographical
/// order (hash#idx). This function will take the raw inputs and apply the
/// aforementioned cleanup changes.
/// To process inputs we need a set (no duplicates) and lexicographical
/// order (hash#idx). This function will take the raw inputs and apply a
/// sort following these requirements.
pub fn inputs_sorted_set(&self) -> Vec<MultiEraInput> {
let mut raw = self.inputs();
raw.sort_by_key(|x| x.lexicographical_key());
Expand Down
2 changes: 1 addition & 1 deletion pallas-traverse/src/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub type DRepVotingThresholds = conway::DRepVotingThresholds;
use crate::{Era, MultiEraUpdate};

impl<'b> MultiEraUpdate<'b> {
pub fn decode_for_era(era: Era, cbor: &'b [u8]) -> Result<Self, minicbor::decode::Error> {
pub fn decode_for_era(era: Era, cbor: &[u8]) -> Result<Self, minicbor::decode::Error> {
match era {
Era::Byron => {
let (epoch, up) = minicbor::decode(cbor)?;
Expand Down
Loading