chore: change how we depend on pallas

This commit is contained in:
rvcas 2024-01-24 21:26:48 -05:00
parent 9d563612f3
commit 589bb9a4b3
No known key found for this signature in database
GPG Key ID: C09B64E263F7D68C
30 changed files with 163 additions and 152 deletions

73
Cargo.lock generated vendored
View File

@ -67,11 +67,7 @@ dependencies = [
"num-bigint", "num-bigint",
"ordinal", "ordinal",
"owo-colors", "owo-colors",
"pallas-addresses", "pallas",
"pallas-codec",
"pallas-crypto",
"pallas-primitives",
"pallas-traverse",
"regex", "regex",
"serde_json", "serde_json",
"thiserror", "thiserror",
@ -143,8 +139,6 @@ dependencies = [
"notify", "notify",
"owo-colors", "owo-colors",
"pallas", "pallas",
"pallas-codec",
"pallas-traverse",
"petgraph", "petgraph",
"pretty_assertions", "pretty_assertions",
"proptest", "proptest",
@ -171,9 +165,9 @@ checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5"
[[package]] [[package]]
name = "anstream" name = "anstream"
version = "0.6.9" version = "0.6.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fde6067df7359f2d6335ec1a50c1f8f825801687d10da0cc4c6b08e3f6afd15" checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5"
dependencies = [ dependencies = [
"anstyle", "anstyle",
"anstyle-parse", "anstyle-parse",
@ -562,9 +556,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "chrono" name = "chrono"
version = "0.4.31" version = "0.4.32"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" checksum = "41daef31d7a747c5c847246f36de49ced6f7403b4cdabc807a97b5cc184cda7a"
dependencies = [ dependencies = [
"num-traits", "num-traits",
] ]
@ -616,9 +610,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_complete" name = "clap_complete"
version = "4.4.7" version = "4.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfb0d4825b75ff281318c393e8e1b80c4da9fb75a6b1d98547d389d6fe1f48d2" checksum = "df631ae429f6613fcd3a7c1adbdb65f637271e561b03680adaa6573015dfb106"
dependencies = [ dependencies = [
"clap", "clap",
] ]
@ -1915,9 +1909,9 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]] [[package]]
name = "openssl" name = "openssl"
version = "0.10.62" version = "0.10.63"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8cde4d2d9200ad5909f8dac647e29482e07c3a35de8a13fce7c9c7747ad9f671" checksum = "15c9d69dd87a29568d4d017cfe8ec518706046a05184e5aea92d0af890b803c8"
dependencies = [ dependencies = [
"bitflags 2.4.2", "bitflags 2.4.2",
"cfg-if", "cfg-if",
@ -1947,9 +1941,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]] [[package]]
name = "openssl-sys" name = "openssl-sys"
version = "0.9.98" version = "0.9.99"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1665caf8ab2dc9aef43d1c0023bd904633a6a05cb30b0ad59bec2ae986e57a7" checksum = "22e1bf214306098e4832460f797824c05d25aacdf896f64a985fb0fd992454ae"
dependencies = [ dependencies = [
"cc", "cc",
"libc", "libc",
@ -1978,7 +1972,7 @@ dependencies = [
[[package]] [[package]]
name = "pallas" name = "pallas"
version = "0.21.0" version = "0.21.0"
source = "git+https://github.com/txpipe/pallas.git?rev=7cb1ffe100befaa6236f14c14081961c44d6ad21#7cb1ffe100befaa6236f14c14081961c44d6ad21" source = "git+https://github.com/txpipe/pallas?rev=7cb1ffe100befaa6236f14c14081961c44d6ad21#7cb1ffe100befaa6236f14c14081961c44d6ad21"
dependencies = [ dependencies = [
"pallas-addresses", "pallas-addresses",
"pallas-applying", "pallas-applying",
@ -1994,7 +1988,7 @@ dependencies = [
[[package]] [[package]]
name = "pallas-addresses" name = "pallas-addresses"
version = "0.21.0" version = "0.21.0"
source = "git+https://github.com/txpipe/pallas.git?rev=7cb1ffe100befaa6236f14c14081961c44d6ad21#7cb1ffe100befaa6236f14c14081961c44d6ad21" source = "git+https://github.com/txpipe/pallas?rev=7cb1ffe100befaa6236f14c14081961c44d6ad21#7cb1ffe100befaa6236f14c14081961c44d6ad21"
dependencies = [ dependencies = [
"base58", "base58",
"bech32", "bech32",
@ -2009,7 +2003,7 @@ dependencies = [
[[package]] [[package]]
name = "pallas-applying" name = "pallas-applying"
version = "0.21.0" version = "0.21.0"
source = "git+https://github.com/txpipe/pallas.git?rev=7cb1ffe100befaa6236f14c14081961c44d6ad21#7cb1ffe100befaa6236f14c14081961c44d6ad21" source = "git+https://github.com/txpipe/pallas?rev=7cb1ffe100befaa6236f14c14081961c44d6ad21#7cb1ffe100befaa6236f14c14081961c44d6ad21"
dependencies = [ dependencies = [
"pallas-addresses", "pallas-addresses",
"pallas-codec", "pallas-codec",
@ -2022,7 +2016,7 @@ dependencies = [
[[package]] [[package]]
name = "pallas-codec" name = "pallas-codec"
version = "0.21.0" version = "0.21.0"
source = "git+https://github.com/txpipe/pallas.git?rev=7cb1ffe100befaa6236f14c14081961c44d6ad21#7cb1ffe100befaa6236f14c14081961c44d6ad21" source = "git+https://github.com/txpipe/pallas?rev=7cb1ffe100befaa6236f14c14081961c44d6ad21#7cb1ffe100befaa6236f14c14081961c44d6ad21"
dependencies = [ dependencies = [
"hex", "hex",
"minicbor", "minicbor",
@ -2034,7 +2028,7 @@ dependencies = [
[[package]] [[package]]
name = "pallas-configs" name = "pallas-configs"
version = "0.21.0" version = "0.21.0"
source = "git+https://github.com/txpipe/pallas.git?rev=7cb1ffe100befaa6236f14c14081961c44d6ad21#7cb1ffe100befaa6236f14c14081961c44d6ad21" source = "git+https://github.com/txpipe/pallas?rev=7cb1ffe100befaa6236f14c14081961c44d6ad21#7cb1ffe100befaa6236f14c14081961c44d6ad21"
dependencies = [ dependencies = [
"base64 0.21.7", "base64 0.21.7",
"hex", "hex",
@ -2048,7 +2042,7 @@ dependencies = [
[[package]] [[package]]
name = "pallas-crypto" name = "pallas-crypto"
version = "0.21.0" version = "0.21.0"
source = "git+https://github.com/txpipe/pallas.git?rev=7cb1ffe100befaa6236f14c14081961c44d6ad21#7cb1ffe100befaa6236f14c14081961c44d6ad21" source = "git+https://github.com/txpipe/pallas?rev=7cb1ffe100befaa6236f14c14081961c44d6ad21#7cb1ffe100befaa6236f14c14081961c44d6ad21"
dependencies = [ dependencies = [
"cryptoxide", "cryptoxide",
"hex", "hex",
@ -2061,7 +2055,7 @@ dependencies = [
[[package]] [[package]]
name = "pallas-network" name = "pallas-network"
version = "0.21.0" version = "0.21.0"
source = "git+https://github.com/txpipe/pallas.git?rev=7cb1ffe100befaa6236f14c14081961c44d6ad21#7cb1ffe100befaa6236f14c14081961c44d6ad21" source = "git+https://github.com/txpipe/pallas?rev=7cb1ffe100befaa6236f14c14081961c44d6ad21#7cb1ffe100befaa6236f14c14081961c44d6ad21"
dependencies = [ dependencies = [
"byteorder", "byteorder",
"hex", "hex",
@ -2078,7 +2072,7 @@ dependencies = [
[[package]] [[package]]
name = "pallas-primitives" name = "pallas-primitives"
version = "0.21.0" version = "0.21.0"
source = "git+https://github.com/txpipe/pallas.git?rev=7cb1ffe100befaa6236f14c14081961c44d6ad21#7cb1ffe100befaa6236f14c14081961c44d6ad21" source = "git+https://github.com/txpipe/pallas?rev=7cb1ffe100befaa6236f14c14081961c44d6ad21#7cb1ffe100befaa6236f14c14081961c44d6ad21"
dependencies = [ dependencies = [
"base58", "base58",
"bech32", "bech32",
@ -2093,7 +2087,7 @@ dependencies = [
[[package]] [[package]]
name = "pallas-traverse" name = "pallas-traverse"
version = "0.21.0" version = "0.21.0"
source = "git+https://github.com/txpipe/pallas.git?rev=7cb1ffe100befaa6236f14c14081961c44d6ad21#7cb1ffe100befaa6236f14c14081961c44d6ad21" source = "git+https://github.com/txpipe/pallas?rev=7cb1ffe100befaa6236f14c14081961c44d6ad21#7cb1ffe100befaa6236f14c14081961c44d6ad21"
dependencies = [ dependencies = [
"hex", "hex",
"pallas-addresses", "pallas-addresses",
@ -2108,7 +2102,7 @@ dependencies = [
[[package]] [[package]]
name = "pallas-utxorpc" name = "pallas-utxorpc"
version = "0.21.0" version = "0.21.0"
source = "git+https://github.com/txpipe/pallas.git?rev=7cb1ffe100befaa6236f14c14081961c44d6ad21#7cb1ffe100befaa6236f14c14081961c44d6ad21" source = "git+https://github.com/txpipe/pallas?rev=7cb1ffe100befaa6236f14c14081961c44d6ad21#7cb1ffe100befaa6236f14c14081961c44d6ad21"
dependencies = [ dependencies = [
"pallas-codec", "pallas-codec",
"pallas-primitives", "pallas-primitives",
@ -2342,9 +2336,9 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.76" version = "1.0.78"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
@ -2539,9 +2533,9 @@ dependencies = [
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.10.2" version = "1.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
@ -2551,9 +2545,9 @@ dependencies = [
[[package]] [[package]]
name = "regex-automata" name = "regex-automata"
version = "0.4.3" version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" checksum = "3b7fa1134405e2ec9353fd416b17f8dacd46c473d7d3fd1cf202706a14eb792a"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
@ -2898,9 +2892,9 @@ dependencies = [
[[package]] [[package]]
name = "smallvec" name = "smallvec"
version = "1.12.0" version = "1.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2593d31f82ead8df961d8bd23a64c2ccf2eb5dd34b0a34bfb4dd54011c72009e" checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7"
[[package]] [[package]]
name = "smawk" name = "smawk"
@ -3012,9 +3006,9 @@ dependencies = [
[[package]] [[package]]
name = "supports-unicode" name = "supports-unicode"
version = "2.0.0" version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b6c2cb240ab5dd21ed4906895ee23fe5a48acdbd15a3ce388e7b62a9b66baf7" checksum = "f850c19edd184a205e883199a261ed44471c81e39bd95b1357f5febbef00e77a"
dependencies = [ dependencies = [
"is-terminal", "is-terminal",
] ]
@ -3463,11 +3457,8 @@ dependencies = [
"num-integer", "num-integer",
"num-traits", "num-traits",
"once_cell", "once_cell",
"pallas-addresses", "pallas",
"pallas-codec", "pallas-codec",
"pallas-crypto",
"pallas-primitives",
"pallas-traverse",
"peg", "peg",
"pretty", "pretty",
"pretty_assertions", "pretty_assertions",

View File

@ -11,6 +11,7 @@ tag-name = "v{{version}}"
[workspace.dependencies] [workspace.dependencies]
walkdir = "2.3.2" walkdir = "2.3.2"
pallas = { git = "https://github.com/txpipe/pallas", rev = "7cb1ffe100befaa6236f14c14081961c44d6ad21" }
insta = { version = "1.30.0", features = ["yaml", "json"] } insta = { version = "1.30.0", features = ["yaml", "json"] }
[profile.dev.package.insta] [profile.dev.package.insta]

View File

@ -27,9 +27,7 @@ itertools = "0.10.5"
miette = { version = "5.9.0", features = ["fancy"] } miette = { version = "5.9.0", features = ["fancy"] }
notify = "6.1.1" notify = "6.1.1"
owo-colors = { version = "3.5.0", features = ["supports-colors"] } owo-colors = { version = "3.5.0", features = ["supports-colors"] }
pallas = { git = "https://github.com/txpipe/pallas.git", rev = "7cb1ffe100befaa6236f14c14081961c44d6ad21" } # 0.21.0 patched pallas.workspace = true
pallas-traverse = { git = "https://github.com/txpipe/pallas.git", rev = "7cb1ffe100befaa6236f14c14081961c44d6ad21" } # 0.21.0 patched
pallas-codec = { git = "https://github.com/txpipe/pallas.git", rev = "7cb1ffe100befaa6236f14c14081961c44d6ad21" } # 0.21.0 patched
petgraph = "0.6.3" petgraph = "0.6.3"
pulldown-cmark = { version = "0.9.2", default-features = false } pulldown-cmark = { version = "0.9.2", default-features = false }
rayon = "1.7.0" rayon = "1.7.0"

View File

@ -5,7 +5,7 @@ use super::{
use aiken_lang::ast::Span; use aiken_lang::ast::Span;
use miette::{Diagnostic, NamedSource}; use miette::{Diagnostic, NamedSource};
use owo_colors::{OwoColorize, Stream::Stdout}; use owo_colors::{OwoColorize, Stream::Stdout};
use pallas_codec::minicbor as cbor; use pallas::codec::minicbor as cbor;
use std::fmt::Debug; use std::fmt::Debug;
use uplc::ast::Constant; use uplc::ast::Constant;

View File

@ -35,8 +35,9 @@ use package_name::PackageName;
use pallas::ledger::{ use pallas::ledger::{
addresses::{Address, Network, ShelleyAddress, ShelleyDelegationPart, StakePayload}, addresses::{Address, Network, ShelleyAddress, ShelleyDelegationPart, StakePayload},
primitives::babbage::{self as cardano, PolicyId}, primitives::babbage::{self as cardano, PolicyId},
traverse::ComputeHash,
}; };
use pallas_traverse::ComputeHash;
use script::{EvalHint, EvalInfo, Script}; use script::{EvalHint, EvalInfo, Script};
use std::{ use std::{
collections::HashMap, collections::HashMap,

View File

@ -26,11 +26,7 @@ ignore = "0.4.20"
indoc = "2.0" indoc = "2.0"
miette = { version = "5.5.0", features = ["fancy"] } miette = { version = "5.5.0", features = ["fancy"] }
owo-colors = { version = "3.5.0", features = ["supports-colors"] } owo-colors = { version = "3.5.0", features = ["supports-colors"] }
pallas-addresses = { git = "https://github.com/txpipe/pallas.git", rev = "7cb1ffe100befaa6236f14c14081961c44d6ad21" } # 0.21.0 patched pallas.workspace = true
pallas-codec = { git = "https://github.com/txpipe/pallas.git", rev = "7cb1ffe100befaa6236f14c14081961c44d6ad21", features = ["num-bigint"] } # 0.21.0 patched
pallas-crypto = { git = "https://github.com/txpipe/pallas.git", rev = "7cb1ffe100befaa6236f14c14081961c44d6ad21" } # 0.21.0 patched
pallas-primitives = { git = "https://github.com/txpipe/pallas.git", rev = "7cb1ffe100befaa6236f14c14081961c44d6ad21" } # 0.21.0 patched
pallas-traverse = { git = "https://github.com/txpipe/pallas.git", rev = "7cb1ffe100befaa6236f14c14081961c44d6ad21" } # 0.21.0 patched
regex = "1.7.1" regex = "1.7.1"
serde_json = "1.0.94" serde_json = "1.0.94"
thiserror = "1.0.39" thiserror = "1.0.39"

View File

@ -12,7 +12,7 @@ use inquire;
use num_bigint::BigInt; use num_bigint::BigInt;
use ordinal::Ordinal; use ordinal::Ordinal;
use owo_colors::{OwoColorize, Stream::Stderr}; use owo_colors::{OwoColorize, Stream::Stderr};
use pallas_primitives::alonzo::PlutusData; use pallas::ledger::primitives::alonzo::PlutusData;
use std::str::FromStr; use std::str::FromStr;
use std::{fs, path::PathBuf, process, rc::Rc}; use std::{fs, path::PathBuf, process, rc::Rc};
use uplc::ast::{Constant, Data as UplcData, DeBruijn, Term}; use uplc::ast::{Constant, Data as UplcData, DeBruijn, Term};

View File

@ -80,7 +80,8 @@ pub fn exec(
let mut double_cbor_bytes = Vec::new(); let mut double_cbor_bytes = Vec::new();
let mut cbor_encoder = pallas_codec::minicbor::Encoder::new(&mut double_cbor_bytes); let mut cbor_encoder =
pallas::codec::minicbor::Encoder::new(&mut double_cbor_bytes);
cbor_encoder.bytes(&cbor_bytes).unwrap(); cbor_encoder.bytes(&cbor_bytes).unwrap();

View File

@ -1,10 +1,13 @@
use miette::IntoDiagnostic; use miette::IntoDiagnostic;
use owo_colors::{OwoColorize, Stream::Stderr}; use owo_colors::{OwoColorize, Stream::Stderr};
use pallas_primitives::{ use pallas::ledger::{
primitives::{
babbage::{Redeemer, TransactionInput, TransactionOutput}, babbage::{Redeemer, TransactionInput, TransactionOutput},
Fragment, Fragment,
},
traverse::{Era, MultiEraTx},
}; };
use pallas_traverse::{Era, MultiEraTx};
use std::{fmt, fs, path::PathBuf, process}; use std::{fmt, fs, path::PathBuf, process};
use uplc::{ use uplc::{
machine::cost_model::ExBudget, machine::cost_model::ExBudget,

View File

@ -20,11 +20,10 @@ miette = "5.5.0"
num-bigint = "0.4.3" num-bigint = "0.4.3"
num-integer = "0.1.45" num-integer = "0.1.45"
num-traits = "0.2.15" num-traits = "0.2.15"
pallas-addresses = { git = "https://github.com/txpipe/pallas.git", rev = "7cb1ffe100befaa6236f14c14081961c44d6ad21" } # 0.21.0 patched pallas.workspace = true
pallas-codec = { git = "https://github.com/txpipe/pallas.git", rev = "7cb1ffe100befaa6236f14c14081961c44d6ad21", features = ["num-bigint"] } # 0.21.0 patched pallas-codec = { git = "https://github.com/txpipe/pallas", rev = "7cb1ffe100befaa6236f14c14081961c44d6ad21", features = [
pallas-crypto = { git = "https://github.com/txpipe/pallas.git", rev = "7cb1ffe100befaa6236f14c14081961c44d6ad21" } # 0.21.0 patched "num-bigint",
pallas-primitives = { git = "https://github.com/txpipe/pallas.git", rev = "7cb1ffe100befaa6236f14c14081961c44d6ad21" } # 0.21.0 patched ] }
pallas-traverse = { git = "https://github.com/txpipe/pallas.git", rev = "7cb1ffe100befaa6236f14c14081961c44d6ad21" } # 0.21.0 patched
peg = "0.8.1" peg = "0.8.1"
pretty = "0.11.3" pretty = "0.11.3"
pretty_assertions = "1.3.0" pretty_assertions = "1.3.0"

View File

@ -10,13 +10,15 @@ use crate::{
}; };
use num_bigint::BigInt; use num_bigint::BigInt;
use num_traits::ToPrimitive; use num_traits::ToPrimitive;
use pallas_addresses::{Network, ShelleyAddress, ShelleyDelegationPart, ShelleyPaymentPart}; use pallas::ledger::{
pub use pallas_primitives::babbage::Language; addresses::{Network, ShelleyAddress, ShelleyDelegationPart, ShelleyPaymentPart},
use pallas_primitives::{ primitives::{
alonzo::{self as pallas, Constr, PlutusData}, alonzo::{self, Constr, PlutusData},
babbage::{self as cardano}, babbage::{self, Language},
},
traverse::ComputeHash,
}; };
use pallas_traverse::ComputeHash;
use serde::{ use serde::{
self, self,
de::{self, Deserialize, Deserializer, MapAccess, Visitor}, de::{self, Deserialize, Deserializer, MapAccess, Visitor},
@ -98,7 +100,7 @@ impl Serialize for Program<DeBruijn> {
let cbor = self.to_cbor().unwrap(); let cbor = self.to_cbor().unwrap();
let mut s = serializer.serialize_struct("Program<DeBruijn>", 2)?; let mut s = serializer.serialize_struct("Program<DeBruijn>", 2)?;
s.serialize_field("compiledCode", &hex::encode(&cbor))?; s.serialize_field("compiledCode", &hex::encode(&cbor))?;
s.serialize_field("hash", &cardano::PlutusV2Script(cbor.into()).compute_hash())?; s.serialize_field("hash", &babbage::PlutusV2Script(cbor.into()).compute_hash())?;
s.end() s.end()
} }
} }
@ -159,7 +161,7 @@ impl<'a> Deserialize<'a> for Program<DeBruijn> {
impl Program<DeBruijn> { impl Program<DeBruijn> {
pub fn address(&self, network: Network, delegation: ShelleyDelegationPart) -> ShelleyAddress { pub fn address(&self, network: Network, delegation: ShelleyDelegationPart) -> ShelleyAddress {
let cbor = self.to_cbor().unwrap(); let cbor = self.to_cbor().unwrap();
let validator_hash = cardano::PlutusV2Script(cbor.into()).compute_hash(); let validator_hash = babbage::PlutusV2Script(cbor.into()).compute_hash();
ShelleyAddress::new( ShelleyAddress::new(
network, network,
ShelleyPaymentPart::Script(validator_hash), ShelleyPaymentPart::Script(validator_hash),
@ -273,21 +275,21 @@ pub struct Data {}
impl Data { impl Data {
pub fn to_hex(data: PlutusData) -> String { pub fn to_hex(data: PlutusData) -> String {
let mut bytes = Vec::new(); let mut bytes = Vec::new();
pallas_codec::minicbor::Encoder::new(&mut bytes) pallas::codec::minicbor::Encoder::new(&mut bytes)
.encode(data) .encode(data)
.expect("failed to encode Plutus Data as cbor?"); .expect("failed to encode Plutus Data as cbor?");
hex::encode(bytes) hex::encode(bytes)
} }
pub fn integer(i: BigInt) -> PlutusData { pub fn integer(i: BigInt) -> PlutusData {
match i.to_i64() { match i.to_i64() {
Some(i) => PlutusData::BigInt(pallas::BigInt::Int(i.into())), Some(i) => PlutusData::BigInt(alonzo::BigInt::Int(i.into())),
None => { None => {
let (sign, bytes) = i.to_bytes_be(); let (sign, bytes) = i.to_bytes_be();
match sign { match sign {
num_bigint::Sign::Minus => { num_bigint::Sign::Minus => {
PlutusData::BigInt(pallas::BigInt::BigNInt(bytes.into())) PlutusData::BigInt(alonzo::BigInt::BigNInt(bytes.into()))
} }
_ => PlutusData::BigInt(pallas::BigInt::BigUInt(bytes.into())), _ => PlutusData::BigInt(alonzo::BigInt::BigUInt(bytes.into())),
} }
} }
} }

View File

@ -2,7 +2,7 @@ use crate::{
ast::{Constant, Name, Term, Type}, ast::{Constant, Name, Term, Type},
builtins::DefaultFunction, builtins::DefaultFunction,
}; };
use pallas_primitives::alonzo::PlutusData; use pallas::ledger::primitives::alonzo::PlutusData;
pub const CONSTR_FIELDS_EXPOSER: &str = "__constr_fields_exposer"; pub const CONSTR_FIELDS_EXPOSER: &str = "__constr_fields_exposer";
pub const CONSTR_INDEX_EXPOSER: &str = "__constr_index_exposer"; pub const CONSTR_INDEX_EXPOSER: &str = "__constr_index_exposer";

View File

@ -1,6 +1,6 @@
use std::{fmt::Display, rc::Rc, str::FromStr}; use std::{fmt::Display, rc::Rc, str::FromStr};
use pallas_codec::flat::de; use pallas::codec::flat::de;
use strum_macros::EnumIter; use strum_macros::EnumIter;
use crate::ast::Term; use crate::ast::Term;

View File

@ -1,10 +1,13 @@
use num_bigint::BigInt; use num_bigint::BigInt;
use pallas_codec::flat::{ use pallas::{
codec::flat::{
de::{self, Decode, Decoder}, de::{self, Decode, Decoder},
en::{self, Encode, Encoder}, en::{self, Encode, Encoder},
Flat, Flat,
},
ledger::primitives::{babbage::PlutusData, Fragment},
}; };
use pallas_primitives::{babbage::PlutusData, Fragment};
use std::{collections::VecDeque, fmt::Debug, rc::Rc}; use std::{collections::VecDeque, fmt::Debug, rc::Rc};
use crate::{ use crate::{
@ -32,7 +35,7 @@ where
T: Binder<'b> + Debug, T: Binder<'b> + Debug,
{ {
pub fn from_cbor(bytes: &'b [u8], buffer: &'b mut Vec<u8>) -> Result<Self, de::Error> { pub fn from_cbor(bytes: &'b [u8], buffer: &'b mut Vec<u8>) -> Result<Self, de::Error> {
let mut cbor_decoder = pallas_codec::minicbor::Decoder::new(bytes); let mut cbor_decoder = pallas::codec::minicbor::Decoder::new(bytes);
let flat_bytes = cbor_decoder let flat_bytes = cbor_decoder
.bytes() .bytes()
@ -64,7 +67,7 @@ where
let mut bytes = Vec::new(); let mut bytes = Vec::new();
let mut cbor_encoder = pallas_codec::minicbor::Encoder::new(&mut bytes); let mut cbor_encoder = pallas::codec::minicbor::Encoder::new(&mut bytes);
cbor_encoder cbor_encoder
.bytes(&flat_bytes) .bytes(&flat_bytes)
@ -944,7 +947,7 @@ mod tests {
parser, parser,
}; };
use indoc::indoc; use indoc::indoc;
use pallas_codec::flat::Flat; use pallas::codec::flat::Flat;
#[test] #[test]
fn flat_encode_integer() { fn flat_encode_integer() {

View File

@ -9,15 +9,14 @@ pub mod parser;
mod pretty; mod pretty;
pub mod tx; pub mod tx;
pub use pallas_codec::utils::KeyValuePairs; pub use pallas::codec::utils::KeyValuePairs;
pub use pallas_crypto::hash::Hash; pub use pallas::crypto::hash::Hash;
pub use pallas_primitives::{ pub use pallas::ledger::primitives::{
alonzo::{BigInt, Constr, PlutusData}, alonzo::{BigInt, Constr, PlutusData},
babbage::{PostAlonzoTransactionOutput, TransactionInput, TransactionOutput, Value}, babbage::{PostAlonzoTransactionOutput, TransactionInput, TransactionOutput, Value},
Error, Fragment,
}; };
use pallas_primitives::{Error, Fragment};
pub fn plutus_data(bytes: &[u8]) -> Result<PlutusData, Error> { pub fn plutus_data(bytes: &[u8]) -> Result<PlutusData, Error> {
PlutusData::decode_fragment(bytes) PlutusData::decode_fragment(bytes)
} }

View File

@ -11,7 +11,7 @@ pub mod value;
use cost_model::{ExBudget, StepKind}; use cost_model::{ExBudget, StepKind};
pub use error::Error; pub use error::Error;
use pallas_primitives::babbage::Language; use pallas::ledger::primitives::babbage::Language;
use self::{ use self::{
cost_model::CostModel, cost_model::CostModel,

View File

@ -1,6 +1,6 @@
use std::collections::HashMap; use std::collections::HashMap;
use pallas_primitives::babbage::Language; use pallas::ledger::primitives::babbage::Language;
use crate::builtins::DefaultFunction; use crate::builtins::DefaultFunction;

View File

@ -3,7 +3,7 @@ use std::{mem::size_of, ops::Deref, rc::Rc};
use num_bigint::BigInt; use num_bigint::BigInt;
use num_integer::Integer; use num_integer::Integer;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use pallas_primitives::babbage::{Language, PlutusData}; use pallas::ledger::primitives::babbage::{Language, PlutusData};
use crate::{ use crate::{
ast::{Constant, Data, Type}, ast::{Constant, Data, Type},

View File

@ -2,7 +2,7 @@ use std::{collections::VecDeque, mem::size_of, ops::Deref, rc::Rc};
use num_bigint::BigInt; use num_bigint::BigInt;
use num_traits::{Signed, ToPrimitive}; use num_traits::{Signed, ToPrimitive};
use pallas_primitives::babbage::{self as pallas, PlutusData}; use pallas::ledger::primitives::babbage::{self, PlutusData};
use crate::{ use crate::{
ast::{Constant, NamedDeBruijn, Term, Type}, ast::{Constant, NamedDeBruijn, Term, Type},
@ -394,27 +394,29 @@ fn integer_log2(i: BigInt) -> i64 {
} }
} }
pub fn from_pallas_bigint(n: &pallas::BigInt) -> BigInt { pub fn from_pallas_bigint(n: &babbage::BigInt) -> BigInt {
match n { match n {
pallas::BigInt::Int(i) => i128::from(*i).into(), babbage::BigInt::Int(i) => i128::from(*i).into(),
pallas::BigInt::BigUInt(bytes) => BigInt::from_bytes_be(num_bigint::Sign::Plus, bytes), babbage::BigInt::BigUInt(bytes) => BigInt::from_bytes_be(num_bigint::Sign::Plus, bytes),
pallas::BigInt::BigNInt(bytes) => BigInt::from_bytes_be(num_bigint::Sign::Minus, bytes) - 1, babbage::BigInt::BigNInt(bytes) => {
BigInt::from_bytes_be(num_bigint::Sign::Minus, bytes) - 1
}
} }
} }
pub fn to_pallas_bigint(n: &BigInt) -> pallas::BigInt { pub fn to_pallas_bigint(n: &BigInt) -> babbage::BigInt {
if let Some(i) = n.to_i64() { if let Some(i) = n.to_i64() {
let pallas_int: pallas_codec::utils::Int = i.into(); let pallas_int: pallas::codec::utils::Int = i.into();
pallas::BigInt::Int(pallas_int) babbage::BigInt::Int(pallas_int)
} else if n.is_positive() { } else if n.is_positive() {
let (_, bytes) = n.to_bytes_be(); let (_, bytes) = n.to_bytes_be();
pallas::BigInt::BigUInt(bytes.into()) babbage::BigInt::BigUInt(bytes.into())
} else { } else {
// Note that this would break if n == 0 // Note that this would break if n == 0
// BUT n == 0 always fits into 64bits and hence would end up in the first branch. // BUT n == 0 always fits into 64bits and hence would end up in the first branch.
let n: BigInt = n + 1; let n: BigInt = n + 1;
let (_, bytes) = n.to_bytes_be(); let (_, bytes) = n.to_bytes_be();
pallas::BigInt::BigNInt(bytes.into()) babbage::BigInt::BigNInt(bytes.into())
} }
} }

View File

@ -3,7 +3,7 @@ use std::{rc::Rc, vec};
use indexmap::IndexMap; use indexmap::IndexMap;
use itertools::Itertools; use itertools::Itertools;
use pallas_primitives::babbage::{BigInt, PlutusData}; use pallas::ledger::primitives::babbage::{BigInt, PlutusData};
use crate::{ use crate::{
ast::{Constant, Data, Name, Program, Term, Type}, ast::{Constant, Data, Name, Program, Term, Type},
@ -676,7 +676,7 @@ fn replace_identity_usage(term: &Term<Name>, original: Rc<Name>) -> Term<Name> {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use pallas_primitives::babbage::{BigInt, PlutusData}; use pallas::ledger::primitives::babbage::{BigInt, PlutusData};
use pretty_assertions::assert_eq; use pretty_assertions::assert_eq;
use crate::{ use crate::{

View File

@ -9,7 +9,7 @@ use crate::{
use interner::Interner; use interner::Interner;
use num_bigint::BigInt; use num_bigint::BigInt;
use pallas_primitives::alonzo::PlutusData; use pallas::ledger::primitives::alonzo::PlutusData;
use peg::{error::ParseError, str::LineCol}; use peg::{error::ParseError, str::LineCol};
pub mod interner; pub mod interner;
@ -248,7 +248,7 @@ peg::parser! {
)) ))
} }
/ _* "Map" _+ kvps:plutus_key_value_pairs() { / _* "Map" _+ kvps:plutus_key_value_pairs() {
PlutusData::Map(pallas_codec::utils::KeyValuePairs::Def(kvps)) PlutusData::Map(pallas::codec::utils::KeyValuePairs::Def(kvps))
} }
/ _* "List" _+ ls:plutus_list() { PlutusData::Array(ls) } / _* "List" _+ ls:plutus_list() { PlutusData::Array(ls) }
/ _* "I" _+ n:big_number() { PlutusData::BigInt(to_pallas_bigint(&n)) } / _* "I" _+ n:big_number() { PlutusData::BigInt(to_pallas_bigint(&n)) }

View File

@ -4,7 +4,7 @@ use crate::{
machine::runtime::{convert_tag_to_constr, Compressable}, machine::runtime::{convert_tag_to_constr, Compressable},
machine::value::from_pallas_bigint, machine::value::from_pallas_bigint,
}; };
use pallas_primitives::babbage::{Constr, PlutusData}; use pallas::ledger::primitives::babbage::{Constr, PlutusData};
use pretty::RcDoc; use pretty::RcDoc;
use std::ascii::escape_default; use std::ascii::escape_default;

View File

@ -1,8 +1,8 @@
use pallas_primitives::{ use pallas::ledger::primitives::{
babbage::{CostMdls, MintedTx, Redeemer, TransactionInput, TransactionOutput}, babbage::{CostMdls, MintedTx, Redeemer, TransactionInput, TransactionOutput},
Fragment, Fragment,
}; };
use pallas_traverse::{Era, MultiEraTx}; use pallas::ledger::traverse::{Era, MultiEraTx};
use error::Error; use error::Error;
pub use phase_one::eval_phase_one; pub use phase_one::eval_phase_one;

View File

@ -3,13 +3,13 @@ use crate::machine::{self, cost_model::ExBudget};
#[derive(thiserror::Error, Debug, miette::Diagnostic)] #[derive(thiserror::Error, Debug, miette::Diagnostic)]
pub enum Error { pub enum Error {
#[error("{0}")] #[error("{0}")]
Address(#[from] pallas_addresses::Error), Address(#[from] pallas::ledger::addresses::Error),
#[error("Only shelley reward addresses can be a part of withdrawals")] #[error("Only shelley reward addresses can be a part of withdrawals")]
BadWithdrawalAddress, BadWithdrawalAddress,
#[error("{0}")] #[error("{0}")]
FlatDecode(#[from] pallas_codec::flat::de::Error), FlatDecode(#[from] pallas::codec::flat::de::Error),
#[error("{0}")] #[error("{0}")]
FragmentDecode(#[from] pallas_primitives::Error), FragmentDecode(#[from] pallas::ledger::primitives::Error),
#[error("{}\n\n{:#?}\n\n{}", .0, .1, .2.join("\n"))] #[error("{}\n\n{:#?}\n\n{}", .0, .1, .2.join("\n"))]
Machine(machine::Error, ExBudget, Vec<String>), Machine(machine::Error, ExBudget, Vec<String>),
#[error("Native script can't be executed in phase-two")] #[error("Native script can't be executed in phase-two")]
@ -32,7 +32,7 @@ pub enum Error {
#[error("PlutusV2 cost model not found.")] #[error("PlutusV2 cost model not found.")]
V2CostModelNotFound, V2CostModelNotFound,
#[error("Wrong era, Please use Babbage or Alonzo: {0}")] #[error("Wrong era, Please use Babbage or Alonzo: {0}")]
WrongEra(#[from] pallas_codec::minicbor::decode::Error), WrongEra(#[from] pallas::codec::minicbor::decode::Error),
#[error("Byron address not allowed in Plutus.")] #[error("Byron address not allowed in Plutus.")]
ByronAddressNotAllowed, ByronAddressNotAllowed,
#[error("Inline datum not allowed in PlutusV1.")] #[error("Inline datum not allowed in PlutusV1.")]

View File

@ -3,15 +3,21 @@ use crate::{
machine::cost_model::ExBudget, machine::cost_model::ExBudget,
PlutusData, PlutusData,
}; };
use pallas_addresses::{Address, ScriptHash, StakePayload}; use pallas::{
use pallas_codec::utils::{KeyValuePairs, MaybeIndefArray}; codec::utils::{KeyValuePairs, MaybeIndefArray},
use pallas_crypto::hash::Hash; crypto::hash::Hash,
use pallas_primitives::babbage::{ ledger::{
Certificate, CostMdls, DatumHash, DatumOption, ExUnits, Language, Mint, MintedTx, NativeScript, addresses::{Address, ScriptHash, StakePayload},
PlutusV1Script, PlutusV2Script, PolicyId, PseudoScript, Redeemer, RedeemerTag, RewardAccount, primitives::babbage::{
StakeCredential, TransactionInput, TransactionOutput, Value, Withdrawals, Certificate, CostMdls, DatumHash, DatumOption, ExUnits, Language, Mint, MintedTx,
NativeScript, PlutusV1Script, PlutusV2Script, PolicyId, PseudoScript, Redeemer,
RedeemerTag, RewardAccount, StakeCredential, TransactionInput, TransactionOutput,
Value, Withdrawals,
},
traverse::{ComputeHash, OriginalHash},
},
}; };
use pallas_traverse::{ComputeHash, OriginalHash};
use std::{cmp::Ordering, collections::HashMap, convert::TryInto, ops::Deref, vec}; use std::{cmp::Ordering, collections::HashMap, convert::TryInto, ops::Deref, vec};
use super::{ use super::{

View File

@ -1,9 +1,14 @@
use std::collections::HashMap; use std::collections::HashMap;
use pallas_addresses::{Address, ScriptHash, ShelleyPaymentPart, StakePayload}; use pallas::{
use pallas_codec::utils::{KeyValuePairs, MaybeIndefArray}; codec::utils::{KeyValuePairs, MaybeIndefArray},
use pallas_primitives::babbage::{ ledger::{
Certificate, MintedTx, PolicyId, RedeemerTag, RewardAccount, StakeCredential, TransactionOutput, addresses::{Address, ScriptHash, ShelleyPaymentPart, StakePayload},
primitives::babbage::{
Certificate, MintedTx, PolicyId, RedeemerTag, RewardAccount, StakeCredential,
TransactionOutput,
},
},
}; };
use super::{ use super::{

View File

@ -1,9 +1,13 @@
use pallas_addresses::Address; use pallas::{
use pallas_codec::utils::KeyValuePairs; codec::utils::KeyValuePairs,
use pallas_crypto::hash::Hash; crypto::hash::Hash,
use pallas_primitives::babbage::{ ledger::{
AddrKeyhash, Certificate, Coin, DatumHash, PlutusData, PolicyId, Redeemer, StakeCredential, addresses::Address,
TransactionInput, TransactionOutput, Value, primitives::babbage::{
AddrKeyhash, Certificate, Coin, DatumHash, PlutusData, PolicyId, Redeemer,
StakeCredential, TransactionInput, TransactionOutput, Value,
},
},
}; };
use super::to_plutus_data::MintValue; use super::to_plutus_data::MintValue;

View File

@ -1,9 +1,9 @@
use pallas_codec::utils::MaybeIndefArray; use pallas::codec::utils::MaybeIndefArray;
use pallas_primitives::{ use pallas::ledger::primitives::{
babbage::{CostMdls, TransactionInput, TransactionOutput}, babbage::{CostMdls, TransactionInput, TransactionOutput},
Fragment, Fragment,
}; };
use pallas_traverse::{Era, MultiEraTx}; use pallas::ledger::traverse::{Era, MultiEraTx};
use crate::machine::cost_model::ExBudget; use crate::machine::cost_model::ExBudget;

View File

@ -1,12 +1,12 @@
use pallas_addresses::{Address, ShelleyDelegationPart, ShelleyPaymentPart, StakePayload}; use pallas::codec::utils::{AnyUInt, Bytes, Int, KeyValuePairs};
use pallas_codec::utils::{AnyUInt, Bytes, Int, KeyValuePairs}; use pallas::crypto::hash::Hash;
use pallas_crypto::hash::Hash; use pallas::ledger::addresses::{Address, ShelleyDelegationPart, ShelleyPaymentPart, StakePayload};
use pallas_primitives::babbage::{AssetName, BigInt, Constr, Mint, PlutusData, ScriptRef}; use pallas::ledger::primitives::babbage::{AssetName, BigInt, Constr, Mint, PlutusData, ScriptRef};
use pallas_primitives::babbage::{ use pallas::ledger::primitives::babbage::{
Certificate, DatumOption, PseudoScript, Redeemer, StakeCredential, TransactionInput, Certificate, DatumOption, PseudoScript, Redeemer, StakeCredential, TransactionInput,
TransactionOutput, Value, TransactionOutput, Value,
}; };
use pallas_traverse::ComputeHash; use pallas::ledger::traverse::ComputeHash;
use crate::machine::runtime::{convert_constr_to_tag, ANY_TAG}; use crate::machine::runtime::{convert_constr_to_tag, ANY_TAG};

View File

@ -111,9 +111,9 @@ fn constant_data_constr() {
Constant::Data(PlutusData::Constr(Constr::<PlutusData> { Constant::Data(PlutusData::Constr(Constr::<PlutusData> {
tag: 122, tag: 122,
any_constructor: None, any_constructor: None,
fields: vec![PlutusData::BigInt(pallas_primitives::alonzo::BigInt::Int( fields: vec![PlutusData::BigInt(
2.into(), pallas::ledger::primitives::alonzo::BigInt::Int(2.into()),
))], )],
})) }))
.into(), .into(),
), ),
@ -127,11 +127,11 @@ fn constant_data_map() {
Term::<Name>::Constant( Term::<Name>::Constant(
Constant::Data(PlutusData::Map(uplc::KeyValuePairs::Def(vec![ Constant::Data(PlutusData::Map(uplc::KeyValuePairs::Def(vec![
( (
PlutusData::BigInt(pallas_primitives::alonzo::BigInt::Int(0.into())), PlutusData::BigInt(pallas::ledger::primitives::alonzo::BigInt::Int(0.into())),
PlutusData::BoundedBytes(vec![0x00].into()), PlutusData::BoundedBytes(vec![0x00].into()),
), ),
( (
PlutusData::BigInt(pallas_primitives::alonzo::BigInt::Int(1.into())), PlutusData::BigInt(pallas::ledger::primitives::alonzo::BigInt::Int(1.into())),
PlutusData::BoundedBytes(vec![0x0f].into()), PlutusData::BoundedBytes(vec![0x0f].into()),
), ),
]))) ])))
@ -146,8 +146,8 @@ fn constant_data_list() {
round_trip( round_trip(
Term::<Name>::Constant( Term::<Name>::Constant(
Constant::Data(PlutusData::Array(vec![ Constant::Data(PlutusData::Array(vec![
PlutusData::BigInt(pallas_primitives::alonzo::BigInt::Int(0.into())), PlutusData::BigInt(pallas::ledger::primitives::alonzo::BigInt::Int(0.into())),
PlutusData::BigInt(pallas_primitives::alonzo::BigInt::Int(1.into())), PlutusData::BigInt(pallas::ledger::primitives::alonzo::BigInt::Int(1.into())),
])) ]))
.into(), .into(),
), ),
@ -159,9 +159,9 @@ fn constant_data_list() {
fn constant_data_int() { fn constant_data_int() {
round_trip( round_trip(
Term::<Name>::Constant( Term::<Name>::Constant(
Constant::Data(PlutusData::BigInt(pallas_primitives::alonzo::BigInt::Int( Constant::Data(PlutusData::BigInt(
2.into(), pallas::ledger::primitives::alonzo::BigInt::Int(2.into()),
))) ))
.into(), .into(),
), ),
"(con data (I 2))", "(con data (I 2))",
@ -169,14 +169,14 @@ fn constant_data_int() {
let term = Term::<Name>::Constant( let term = Term::<Name>::Constant(
Constant::Data(PlutusData::BigInt( Constant::Data(PlutusData::BigInt(
pallas_primitives::alonzo::BigInt::BigUInt(vec![2, 3, 4].into()), pallas::ledger::primitives::alonzo::BigInt::BigUInt(vec![2, 3, 4].into()),
)) ))
.into(), .into(),
); );
assert_eq!(term.to_pretty(), "(con data (I 131844))"); assert_eq!(term.to_pretty(), "(con data (I 131844))");
let term = Term::<Name>::Constant( let term = Term::<Name>::Constant(
Constant::Data(PlutusData::BigInt( Constant::Data(PlutusData::BigInt(
pallas_primitives::alonzo::BigInt::BigNInt(vec![2, 3, 3].into()), pallas::ledger::primitives::alonzo::BigInt::BigNInt(vec![2, 3, 3].into()),
)) ))
.into(), .into(),
); );