Skip to content

Commit

Permalink
feat(validate): introduce new crate with phase-1 and phase-2 validati…
Browse files Browse the repository at this point in the history
…on (#607)
  • Loading branch information
Mercurial authored Feb 27, 2025
1 parent 2ddb5b0 commit d9d71fb
Show file tree
Hide file tree
Showing 37 changed files with 6,863 additions and 465 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[workspace]
resolver = "2"
members = [
"pallas-applying",
"pallas-codec",
"pallas-addresses",
"pallas-network",
Expand All @@ -14,6 +13,7 @@ members = [
"pallas-hardano",
"pallas-wallet",
"pallas-math",
"pallas-validate",
"pallas",
"examples/block-download",
"examples/block-decode",
Expand Down
225 changes: 0 additions & 225 deletions pallas-applying/tests/common.rs

This file was deleted.

4 changes: 4 additions & 0 deletions pallas-traverse/src/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ impl<'b> MultiEraTx<'b> {
Self::Babbage(Box::new(Cow::Borrowed(tx)))
}

pub fn from_conway(tx: &'b conway::MintedTx<'b>) -> Self {
Self::Conway(Box::new(Cow::Borrowed(tx)))
}

pub fn encode(&self) -> Vec<u8> {
// to_vec is infallible
match self {
Expand Down
4 changes: 1 addition & 3 deletions pallas-utxorpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ pallas-primitives = { version = "=0.32.0", path = "../pallas-primitives" }
pallas-codec = { version = "=0.32.0", path = "../pallas-codec" }
pallas-crypto = { version = "=0.32.0", path = "../pallas-crypto" }
prost-types = "0.13.1"

# TODO: remove this dep once we have multiera params in traverse
pallas-applying = { version = "=0.32.0", path = "../pallas-applying" }
pallas-validate = { version = "=0.32.0", path = "../pallas-validate" }

[dev-dependencies]
hex = "0.4.3"
Expand Down
2 changes: 1 addition & 1 deletion pallas-utxorpc/src/params.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use pallas_applying::MultiEraProtocolParameters;
use pallas_primitives::conway;
use pallas_validate::utils::MultiEraProtocolParameters;
use utxorpc_spec::utxorpc::v1alpha::cardano as u5c;

use crate::{rational_number_to_u5c, LedgerContext, Mapper};
Expand Down
23 changes: 11 additions & 12 deletions pallas-applying/Cargo.toml → pallas-validate/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
[package]
name = "pallas-applying"
description = "Logic for validating and applying new blocks and txs to the chain state"
name = "pallas-validate"
version = "0.32.0"
edition = "2021"
repository = "/~https://github.com/MaicoLeberle/pallas"
homepage = "/~https://github.com/MaicoLeberle/pallas"
license = "Apache-2.0"
readme = "README.md"
authors = ["Maico Leberle <maico.leberle@gmail.com>"]

[lib]
doctest = false

[dependencies]
pallas-addresses = { version = "=0.32.0", path = "../pallas-addresses" }
Expand All @@ -22,6 +13,14 @@ rand = "0.8"
hex = "0.4"
chrono = "0.4.39"
thiserror = "1.0.49"
serde = { version = "1.0.136", features = ["derive"] }
serde_json = "1.0.122"
itertools = "0.14.0"
tracing = "0.1.41"

[dev-dependencies]
hex = "0.4"
# phase2 dependencies
uplc = { git = "/~https://github.com/pragma-org/uplc.git", optional = true}
rug = { version = "1.26.1", optional = true}

[features]
phase_two = ["uplc", "rug"]
2 changes: 1 addition & 1 deletion pallas-applying/README.md → pallas-validate/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Pallas Applying
# Pallas Validate

Crate for performing transaction validation according to the Cardano protocol. Generally speaking, this crate is structured in multiple modules, each one handling a specific Cardano era. These eras are: Byron, ShelleyMA, Alonzo and Babbage.

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions pallas-validate/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pub mod utils;
pub mod phase_one;

#[cfg(feature = "phase_two")]
pub mod phase_two;

#[cfg(feature = "phase_two")]
pub mod uplc;
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit d9d71fb

Please sign in to comment.