chore: change how we depend on pallas
This commit is contained in:
parent
9d563612f3
commit
589bb9a4b3
|
@ -67,11 +67,7 @@ dependencies = [
|
|||
"num-bigint",
|
||||
"ordinal",
|
||||
"owo-colors",
|
||||
"pallas-addresses",
|
||||
"pallas-codec",
|
||||
"pallas-crypto",
|
||||
"pallas-primitives",
|
||||
"pallas-traverse",
|
||||
"pallas",
|
||||
"regex",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
|
@ -143,8 +139,6 @@ dependencies = [
|
|||
"notify",
|
||||
"owo-colors",
|
||||
"pallas",
|
||||
"pallas-codec",
|
||||
"pallas-traverse",
|
||||
"petgraph",
|
||||
"pretty_assertions",
|
||||
"proptest",
|
||||
|
@ -171,9 +165,9 @@ checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5"
|
|||
|
||||
[[package]]
|
||||
name = "anstream"
|
||||
version = "0.6.9"
|
||||
version = "0.6.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3fde6067df7359f2d6335ec1a50c1f8f825801687d10da0cc4c6b08e3f6afd15"
|
||||
checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"anstyle-parse",
|
||||
|
@ -562,9 +556,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.31"
|
||||
version = "0.4.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38"
|
||||
checksum = "41daef31d7a747c5c847246f36de49ced6f7403b4cdabc807a97b5cc184cda7a"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
@ -616,9 +610,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "clap_complete"
|
||||
version = "4.4.7"
|
||||
version = "4.4.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dfb0d4825b75ff281318c393e8e1b80c4da9fb75a6b1d98547d389d6fe1f48d2"
|
||||
checksum = "df631ae429f6613fcd3a7c1adbdb65f637271e561b03680adaa6573015dfb106"
|
||||
dependencies = [
|
||||
"clap",
|
||||
]
|
||||
|
@ -1915,9 +1909,9 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
|
|||
|
||||
[[package]]
|
||||
name = "openssl"
|
||||
version = "0.10.62"
|
||||
version = "0.10.63"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8cde4d2d9200ad5909f8dac647e29482e07c3a35de8a13fce7c9c7747ad9f671"
|
||||
checksum = "15c9d69dd87a29568d4d017cfe8ec518706046a05184e5aea92d0af890b803c8"
|
||||
dependencies = [
|
||||
"bitflags 2.4.2",
|
||||
"cfg-if",
|
||||
|
@ -1947,9 +1941,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
|
|||
|
||||
[[package]]
|
||||
name = "openssl-sys"
|
||||
version = "0.9.98"
|
||||
version = "0.9.99"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1665caf8ab2dc9aef43d1c0023bd904633a6a05cb30b0ad59bec2ae986e57a7"
|
||||
checksum = "22e1bf214306098e4832460f797824c05d25aacdf896f64a985fb0fd992454ae"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
|
@ -1978,7 +1972,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "pallas"
|
||||
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 = [
|
||||
"pallas-addresses",
|
||||
"pallas-applying",
|
||||
|
@ -1994,7 +1988,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "pallas-addresses"
|
||||
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 = [
|
||||
"base58",
|
||||
"bech32",
|
||||
|
@ -2009,7 +2003,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "pallas-applying"
|
||||
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 = [
|
||||
"pallas-addresses",
|
||||
"pallas-codec",
|
||||
|
@ -2022,7 +2016,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "pallas-codec"
|
||||
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 = [
|
||||
"hex",
|
||||
"minicbor",
|
||||
|
@ -2034,7 +2028,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "pallas-configs"
|
||||
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 = [
|
||||
"base64 0.21.7",
|
||||
"hex",
|
||||
|
@ -2048,7 +2042,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "pallas-crypto"
|
||||
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 = [
|
||||
"cryptoxide",
|
||||
"hex",
|
||||
|
@ -2061,7 +2055,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "pallas-network"
|
||||
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 = [
|
||||
"byteorder",
|
||||
"hex",
|
||||
|
@ -2078,7 +2072,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "pallas-primitives"
|
||||
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 = [
|
||||
"base58",
|
||||
"bech32",
|
||||
|
@ -2093,7 +2087,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "pallas-traverse"
|
||||
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 = [
|
||||
"hex",
|
||||
"pallas-addresses",
|
||||
|
@ -2108,7 +2102,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "pallas-utxorpc"
|
||||
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 = [
|
||||
"pallas-codec",
|
||||
"pallas-primitives",
|
||||
|
@ -2342,9 +2336,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.76"
|
||||
version = "1.0.78"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c"
|
||||
checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
@ -2539,9 +2533,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.10.2"
|
||||
version = "1.10.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343"
|
||||
checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
|
@ -2551,9 +2545,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.4.3"
|
||||
version = "0.4.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f"
|
||||
checksum = "3b7fa1134405e2ec9353fd416b17f8dacd46c473d7d3fd1cf202706a14eb792a"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
|
@ -2898,9 +2892,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.12.0"
|
||||
version = "1.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2593d31f82ead8df961d8bd23a64c2ccf2eb5dd34b0a34bfb4dd54011c72009e"
|
||||
checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7"
|
||||
|
||||
[[package]]
|
||||
name = "smawk"
|
||||
|
@ -3012,9 +3006,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "supports-unicode"
|
||||
version = "2.0.0"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4b6c2cb240ab5dd21ed4906895ee23fe5a48acdbd15a3ce388e7b62a9b66baf7"
|
||||
checksum = "f850c19edd184a205e883199a261ed44471c81e39bd95b1357f5febbef00e77a"
|
||||
dependencies = [
|
||||
"is-terminal",
|
||||
]
|
||||
|
@ -3463,11 +3457,8 @@ dependencies = [
|
|||
"num-integer",
|
||||
"num-traits",
|
||||
"once_cell",
|
||||
"pallas-addresses",
|
||||
"pallas",
|
||||
"pallas-codec",
|
||||
"pallas-crypto",
|
||||
"pallas-primitives",
|
||||
"pallas-traverse",
|
||||
"peg",
|
||||
"pretty",
|
||||
"pretty_assertions",
|
||||
|
|
|
@ -11,6 +11,7 @@ tag-name = "v{{version}}"
|
|||
|
||||
[workspace.dependencies]
|
||||
walkdir = "2.3.2"
|
||||
pallas = { git = "https://github.com/txpipe/pallas", rev = "7cb1ffe100befaa6236f14c14081961c44d6ad21" }
|
||||
insta = { version = "1.30.0", features = ["yaml", "json"] }
|
||||
|
||||
[profile.dev.package.insta]
|
||||
|
|
|
@ -27,9 +27,7 @@ itertools = "0.10.5"
|
|||
miette = { version = "5.9.0", features = ["fancy"] }
|
||||
notify = "6.1.1"
|
||||
owo-colors = { version = "3.5.0", features = ["supports-colors"] }
|
||||
pallas = { 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
|
||||
pallas-codec = { git = "https://github.com/txpipe/pallas.git", rev = "7cb1ffe100befaa6236f14c14081961c44d6ad21" } # 0.21.0 patched
|
||||
pallas.workspace = true
|
||||
petgraph = "0.6.3"
|
||||
pulldown-cmark = { version = "0.9.2", default-features = false }
|
||||
rayon = "1.7.0"
|
||||
|
|
|
@ -5,7 +5,7 @@ use super::{
|
|||
use aiken_lang::ast::Span;
|
||||
use miette::{Diagnostic, NamedSource};
|
||||
use owo_colors::{OwoColorize, Stream::Stdout};
|
||||
use pallas_codec::minicbor as cbor;
|
||||
use pallas::codec::minicbor as cbor;
|
||||
use std::fmt::Debug;
|
||||
use uplc::ast::Constant;
|
||||
|
||||
|
|
|
@ -35,8 +35,9 @@ use package_name::PackageName;
|
|||
use pallas::ledger::{
|
||||
addresses::{Address, Network, ShelleyAddress, ShelleyDelegationPart, StakePayload},
|
||||
primitives::babbage::{self as cardano, PolicyId},
|
||||
traverse::ComputeHash,
|
||||
};
|
||||
use pallas_traverse::ComputeHash;
|
||||
|
||||
use script::{EvalHint, EvalInfo, Script};
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
|
|
|
@ -26,11 +26,7 @@ ignore = "0.4.20"
|
|||
indoc = "2.0"
|
||||
miette = { version = "5.5.0", features = ["fancy"] }
|
||||
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-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
|
||||
pallas.workspace = true
|
||||
regex = "1.7.1"
|
||||
serde_json = "1.0.94"
|
||||
thiserror = "1.0.39"
|
||||
|
|
|
@ -12,7 +12,7 @@ use inquire;
|
|||
use num_bigint::BigInt;
|
||||
use ordinal::Ordinal;
|
||||
use owo_colors::{OwoColorize, Stream::Stderr};
|
||||
use pallas_primitives::alonzo::PlutusData;
|
||||
use pallas::ledger::primitives::alonzo::PlutusData;
|
||||
use std::str::FromStr;
|
||||
use std::{fs, path::PathBuf, process, rc::Rc};
|
||||
use uplc::ast::{Constant, Data as UplcData, DeBruijn, Term};
|
||||
|
|
|
@ -80,7 +80,8 @@ pub fn exec(
|
|||
|
||||
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();
|
||||
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
use miette::IntoDiagnostic;
|
||||
use owo_colors::{OwoColorize, Stream::Stderr};
|
||||
use pallas_primitives::{
|
||||
babbage::{Redeemer, TransactionInput, TransactionOutput},
|
||||
Fragment,
|
||||
use pallas::ledger::{
|
||||
primitives::{
|
||||
babbage::{Redeemer, TransactionInput, TransactionOutput},
|
||||
Fragment,
|
||||
},
|
||||
traverse::{Era, MultiEraTx},
|
||||
};
|
||||
use pallas_traverse::{Era, MultiEraTx};
|
||||
|
||||
use std::{fmt, fs, path::PathBuf, process};
|
||||
use uplc::{
|
||||
machine::cost_model::ExBudget,
|
||||
|
|
|
@ -20,11 +20,10 @@ miette = "5.5.0"
|
|||
num-bigint = "0.4.3"
|
||||
num-integer = "0.1.45"
|
||||
num-traits = "0.2.15"
|
||||
pallas-addresses = { git = "https://github.com/txpipe/pallas.git", rev = "7cb1ffe100befaa6236f14c14081961c44d6ad21" } # 0.21.0 patched
|
||||
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
|
||||
pallas.workspace = true
|
||||
pallas-codec = { git = "https://github.com/txpipe/pallas", rev = "7cb1ffe100befaa6236f14c14081961c44d6ad21", features = [
|
||||
"num-bigint",
|
||||
] }
|
||||
peg = "0.8.1"
|
||||
pretty = "0.11.3"
|
||||
pretty_assertions = "1.3.0"
|
||||
|
|
|
@ -10,13 +10,15 @@ use crate::{
|
|||
};
|
||||
use num_bigint::BigInt;
|
||||
use num_traits::ToPrimitive;
|
||||
use pallas_addresses::{Network, ShelleyAddress, ShelleyDelegationPart, ShelleyPaymentPart};
|
||||
pub use pallas_primitives::babbage::Language;
|
||||
use pallas_primitives::{
|
||||
alonzo::{self as pallas, Constr, PlutusData},
|
||||
babbage::{self as cardano},
|
||||
use pallas::ledger::{
|
||||
addresses::{Network, ShelleyAddress, ShelleyDelegationPart, ShelleyPaymentPart},
|
||||
primitives::{
|
||||
alonzo::{self, Constr, PlutusData},
|
||||
babbage::{self, Language},
|
||||
},
|
||||
traverse::ComputeHash,
|
||||
};
|
||||
use pallas_traverse::ComputeHash;
|
||||
|
||||
use serde::{
|
||||
self,
|
||||
de::{self, Deserialize, Deserializer, MapAccess, Visitor},
|
||||
|
@ -98,7 +100,7 @@ impl Serialize for Program<DeBruijn> {
|
|||
let cbor = self.to_cbor().unwrap();
|
||||
let mut s = serializer.serialize_struct("Program<DeBruijn>", 2)?;
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
@ -159,7 +161,7 @@ impl<'a> Deserialize<'a> for Program<DeBruijn> {
|
|||
impl Program<DeBruijn> {
|
||||
pub fn address(&self, network: Network, delegation: ShelleyDelegationPart) -> ShelleyAddress {
|
||||
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(
|
||||
network,
|
||||
ShelleyPaymentPart::Script(validator_hash),
|
||||
|
@ -273,21 +275,21 @@ pub struct Data {}
|
|||
impl Data {
|
||||
pub fn to_hex(data: PlutusData) -> String {
|
||||
let mut bytes = Vec::new();
|
||||
pallas_codec::minicbor::Encoder::new(&mut bytes)
|
||||
pallas::codec::minicbor::Encoder::new(&mut bytes)
|
||||
.encode(data)
|
||||
.expect("failed to encode Plutus Data as cbor?");
|
||||
hex::encode(bytes)
|
||||
}
|
||||
pub fn integer(i: BigInt) -> PlutusData {
|
||||
match i.to_i64() {
|
||||
Some(i) => PlutusData::BigInt(pallas::BigInt::Int(i.into())),
|
||||
Some(i) => PlutusData::BigInt(alonzo::BigInt::Int(i.into())),
|
||||
None => {
|
||||
let (sign, bytes) = i.to_bytes_be();
|
||||
match sign {
|
||||
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())),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ use crate::{
|
|||
ast::{Constant, Name, Term, Type},
|
||||
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_INDEX_EXPOSER: &str = "__constr_index_exposer";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::{fmt::Display, rc::Rc, str::FromStr};
|
||||
|
||||
use pallas_codec::flat::de;
|
||||
use pallas::codec::flat::de;
|
||||
use strum_macros::EnumIter;
|
||||
|
||||
use crate::ast::Term;
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
use num_bigint::BigInt;
|
||||
use pallas_codec::flat::{
|
||||
de::{self, Decode, Decoder},
|
||||
en::{self, Encode, Encoder},
|
||||
Flat,
|
||||
use pallas::{
|
||||
codec::flat::{
|
||||
de::{self, Decode, Decoder},
|
||||
en::{self, Encode, Encoder},
|
||||
Flat,
|
||||
},
|
||||
ledger::primitives::{babbage::PlutusData, Fragment},
|
||||
};
|
||||
use pallas_primitives::{babbage::PlutusData, Fragment};
|
||||
|
||||
use std::{collections::VecDeque, fmt::Debug, rc::Rc};
|
||||
|
||||
use crate::{
|
||||
|
@ -32,7 +35,7 @@ where
|
|||
T: Binder<'b> + Debug,
|
||||
{
|
||||
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
|
||||
.bytes()
|
||||
|
@ -64,7 +67,7 @@ where
|
|||
|
||||
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
|
||||
.bytes(&flat_bytes)
|
||||
|
@ -944,7 +947,7 @@ mod tests {
|
|||
parser,
|
||||
};
|
||||
use indoc::indoc;
|
||||
use pallas_codec::flat::Flat;
|
||||
use pallas::codec::flat::Flat;
|
||||
|
||||
#[test]
|
||||
fn flat_encode_integer() {
|
||||
|
|
|
@ -9,15 +9,14 @@ pub mod parser;
|
|||
mod pretty;
|
||||
pub mod tx;
|
||||
|
||||
pub use pallas_codec::utils::KeyValuePairs;
|
||||
pub use pallas_crypto::hash::Hash;
|
||||
pub use pallas_primitives::{
|
||||
pub use pallas::codec::utils::KeyValuePairs;
|
||||
pub use pallas::crypto::hash::Hash;
|
||||
pub use pallas::ledger::primitives::{
|
||||
alonzo::{BigInt, Constr, PlutusData},
|
||||
babbage::{PostAlonzoTransactionOutput, TransactionInput, TransactionOutput, Value},
|
||||
Error, Fragment,
|
||||
};
|
||||
|
||||
use pallas_primitives::{Error, Fragment};
|
||||
|
||||
pub fn plutus_data(bytes: &[u8]) -> Result<PlutusData, Error> {
|
||||
PlutusData::decode_fragment(bytes)
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ pub mod value;
|
|||
|
||||
use cost_model::{ExBudget, StepKind};
|
||||
pub use error::Error;
|
||||
use pallas_primitives::babbage::Language;
|
||||
use pallas::ledger::primitives::babbage::Language;
|
||||
|
||||
use self::{
|
||||
cost_model::CostModel,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use pallas_primitives::babbage::Language;
|
||||
use pallas::ledger::primitives::babbage::Language;
|
||||
|
||||
use crate::builtins::DefaultFunction;
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::{mem::size_of, ops::Deref, rc::Rc};
|
|||
use num_bigint::BigInt;
|
||||
use num_integer::Integer;
|
||||
use once_cell::sync::Lazy;
|
||||
use pallas_primitives::babbage::{Language, PlutusData};
|
||||
use pallas::ledger::primitives::babbage::{Language, PlutusData};
|
||||
|
||||
use crate::{
|
||||
ast::{Constant, Data, Type},
|
||||
|
|
|
@ -2,7 +2,7 @@ use std::{collections::VecDeque, mem::size_of, ops::Deref, rc::Rc};
|
|||
|
||||
use num_bigint::BigInt;
|
||||
use num_traits::{Signed, ToPrimitive};
|
||||
use pallas_primitives::babbage::{self as pallas, PlutusData};
|
||||
use pallas::ledger::primitives::babbage::{self, PlutusData};
|
||||
|
||||
use crate::{
|
||||
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 {
|
||||
pallas::BigInt::Int(i) => i128::from(*i).into(),
|
||||
pallas::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::Int(i) => i128::from(*i).into(),
|
||||
babbage::BigInt::BigUInt(bytes) => BigInt::from_bytes_be(num_bigint::Sign::Plus, bytes),
|
||||
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() {
|
||||
let pallas_int: pallas_codec::utils::Int = i.into();
|
||||
pallas::BigInt::Int(pallas_int)
|
||||
let pallas_int: pallas::codec::utils::Int = i.into();
|
||||
babbage::BigInt::Int(pallas_int)
|
||||
} else if n.is_positive() {
|
||||
let (_, bytes) = n.to_bytes_be();
|
||||
pallas::BigInt::BigUInt(bytes.into())
|
||||
babbage::BigInt::BigUInt(bytes.into())
|
||||
} else {
|
||||
// Note that this would break if n == 0
|
||||
// BUT n == 0 always fits into 64bits and hence would end up in the first branch.
|
||||
let n: BigInt = n + 1;
|
||||
let (_, bytes) = n.to_bytes_be();
|
||||
pallas::BigInt::BigNInt(bytes.into())
|
||||
babbage::BigInt::BigNInt(bytes.into())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::{rc::Rc, vec};
|
|||
use indexmap::IndexMap;
|
||||
use itertools::Itertools;
|
||||
|
||||
use pallas_primitives::babbage::{BigInt, PlutusData};
|
||||
use pallas::ledger::primitives::babbage::{BigInt, PlutusData};
|
||||
|
||||
use crate::{
|
||||
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)]
|
||||
mod tests {
|
||||
|
||||
use pallas_primitives::babbage::{BigInt, PlutusData};
|
||||
use pallas::ledger::primitives::babbage::{BigInt, PlutusData};
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use crate::{
|
||||
|
|
|
@ -9,7 +9,7 @@ use crate::{
|
|||
|
||||
use interner::Interner;
|
||||
use num_bigint::BigInt;
|
||||
use pallas_primitives::alonzo::PlutusData;
|
||||
use pallas::ledger::primitives::alonzo::PlutusData;
|
||||
use peg::{error::ParseError, str::LineCol};
|
||||
|
||||
pub mod interner;
|
||||
|
@ -248,7 +248,7 @@ peg::parser! {
|
|||
))
|
||||
}
|
||||
/ _* "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) }
|
||||
/ _* "I" _+ n:big_number() { PlutusData::BigInt(to_pallas_bigint(&n)) }
|
||||
|
|
|
@ -4,7 +4,7 @@ use crate::{
|
|||
machine::runtime::{convert_tag_to_constr, Compressable},
|
||||
machine::value::from_pallas_bigint,
|
||||
};
|
||||
use pallas_primitives::babbage::{Constr, PlutusData};
|
||||
use pallas::ledger::primitives::babbage::{Constr, PlutusData};
|
||||
use pretty::RcDoc;
|
||||
use std::ascii::escape_default;
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use pallas_primitives::{
|
||||
use pallas::ledger::primitives::{
|
||||
babbage::{CostMdls, MintedTx, Redeemer, TransactionInput, TransactionOutput},
|
||||
Fragment,
|
||||
};
|
||||
use pallas_traverse::{Era, MultiEraTx};
|
||||
use pallas::ledger::traverse::{Era, MultiEraTx};
|
||||
|
||||
use error::Error;
|
||||
pub use phase_one::eval_phase_one;
|
||||
|
|
|
@ -3,13 +3,13 @@ use crate::machine::{self, cost_model::ExBudget};
|
|||
#[derive(thiserror::Error, Debug, miette::Diagnostic)]
|
||||
pub enum Error {
|
||||
#[error("{0}")]
|
||||
Address(#[from] pallas_addresses::Error),
|
||||
Address(#[from] pallas::ledger::addresses::Error),
|
||||
#[error("Only shelley reward addresses can be a part of withdrawals")]
|
||||
BadWithdrawalAddress,
|
||||
#[error("{0}")]
|
||||
FlatDecode(#[from] pallas_codec::flat::de::Error),
|
||||
FlatDecode(#[from] pallas::codec::flat::de::Error),
|
||||
#[error("{0}")]
|
||||
FragmentDecode(#[from] pallas_primitives::Error),
|
||||
FragmentDecode(#[from] pallas::ledger::primitives::Error),
|
||||
#[error("{}\n\n{:#?}\n\n{}", .0, .1, .2.join("\n"))]
|
||||
Machine(machine::Error, ExBudget, Vec<String>),
|
||||
#[error("Native script can't be executed in phase-two")]
|
||||
|
@ -32,7 +32,7 @@ pub enum Error {
|
|||
#[error("PlutusV2 cost model not found.")]
|
||||
V2CostModelNotFound,
|
||||
#[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.")]
|
||||
ByronAddressNotAllowed,
|
||||
#[error("Inline datum not allowed in PlutusV1.")]
|
||||
|
|
|
@ -3,15 +3,21 @@ use crate::{
|
|||
machine::cost_model::ExBudget,
|
||||
PlutusData,
|
||||
};
|
||||
use pallas_addresses::{Address, ScriptHash, StakePayload};
|
||||
use pallas_codec::utils::{KeyValuePairs, MaybeIndefArray};
|
||||
use pallas_crypto::hash::Hash;
|
||||
use pallas_primitives::babbage::{
|
||||
Certificate, CostMdls, DatumHash, DatumOption, ExUnits, Language, Mint, MintedTx, NativeScript,
|
||||
PlutusV1Script, PlutusV2Script, PolicyId, PseudoScript, Redeemer, RedeemerTag, RewardAccount,
|
||||
StakeCredential, TransactionInput, TransactionOutput, Value, Withdrawals,
|
||||
use pallas::{
|
||||
codec::utils::{KeyValuePairs, MaybeIndefArray},
|
||||
crypto::hash::Hash,
|
||||
ledger::{
|
||||
addresses::{Address, ScriptHash, StakePayload},
|
||||
primitives::babbage::{
|
||||
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 super::{
|
||||
|
|
|
@ -1,9 +1,14 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use pallas_addresses::{Address, ScriptHash, ShelleyPaymentPart, StakePayload};
|
||||
use pallas_codec::utils::{KeyValuePairs, MaybeIndefArray};
|
||||
use pallas_primitives::babbage::{
|
||||
Certificate, MintedTx, PolicyId, RedeemerTag, RewardAccount, StakeCredential, TransactionOutput,
|
||||
use pallas::{
|
||||
codec::utils::{KeyValuePairs, MaybeIndefArray},
|
||||
ledger::{
|
||||
addresses::{Address, ScriptHash, ShelleyPaymentPart, StakePayload},
|
||||
primitives::babbage::{
|
||||
Certificate, MintedTx, PolicyId, RedeemerTag, RewardAccount, StakeCredential,
|
||||
TransactionOutput,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
use super::{
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
use pallas_addresses::Address;
|
||||
use pallas_codec::utils::KeyValuePairs;
|
||||
use pallas_crypto::hash::Hash;
|
||||
use pallas_primitives::babbage::{
|
||||
AddrKeyhash, Certificate, Coin, DatumHash, PlutusData, PolicyId, Redeemer, StakeCredential,
|
||||
TransactionInput, TransactionOutput, Value,
|
||||
use pallas::{
|
||||
codec::utils::KeyValuePairs,
|
||||
crypto::hash::Hash,
|
||||
ledger::{
|
||||
addresses::Address,
|
||||
primitives::babbage::{
|
||||
AddrKeyhash, Certificate, Coin, DatumHash, PlutusData, PolicyId, Redeemer,
|
||||
StakeCredential, TransactionInput, TransactionOutput, Value,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
use super::to_plutus_data::MintValue;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use pallas_codec::utils::MaybeIndefArray;
|
||||
use pallas_primitives::{
|
||||
use pallas::codec::utils::MaybeIndefArray;
|
||||
use pallas::ledger::primitives::{
|
||||
babbage::{CostMdls, TransactionInput, TransactionOutput},
|
||||
Fragment,
|
||||
};
|
||||
use pallas_traverse::{Era, MultiEraTx};
|
||||
use pallas::ledger::traverse::{Era, MultiEraTx};
|
||||
|
||||
use crate::machine::cost_model::ExBudget;
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
use pallas_addresses::{Address, ShelleyDelegationPart, ShelleyPaymentPart, StakePayload};
|
||||
use pallas_codec::utils::{AnyUInt, Bytes, Int, KeyValuePairs};
|
||||
use pallas_crypto::hash::Hash;
|
||||
use pallas_primitives::babbage::{AssetName, BigInt, Constr, Mint, PlutusData, ScriptRef};
|
||||
use pallas_primitives::babbage::{
|
||||
use pallas::codec::utils::{AnyUInt, Bytes, Int, KeyValuePairs};
|
||||
use pallas::crypto::hash::Hash;
|
||||
use pallas::ledger::addresses::{Address, ShelleyDelegationPart, ShelleyPaymentPart, StakePayload};
|
||||
use pallas::ledger::primitives::babbage::{AssetName, BigInt, Constr, Mint, PlutusData, ScriptRef};
|
||||
use pallas::ledger::primitives::babbage::{
|
||||
Certificate, DatumOption, PseudoScript, Redeemer, StakeCredential, TransactionInput,
|
||||
TransactionOutput, Value,
|
||||
};
|
||||
use pallas_traverse::ComputeHash;
|
||||
use pallas::ledger::traverse::ComputeHash;
|
||||
|
||||
use crate::machine::runtime::{convert_constr_to_tag, ANY_TAG};
|
||||
|
||||
|
|
|
@ -111,9 +111,9 @@ fn constant_data_constr() {
|
|||
Constant::Data(PlutusData::Constr(Constr::<PlutusData> {
|
||||
tag: 122,
|
||||
any_constructor: None,
|
||||
fields: vec![PlutusData::BigInt(pallas_primitives::alonzo::BigInt::Int(
|
||||
2.into(),
|
||||
))],
|
||||
fields: vec![PlutusData::BigInt(
|
||||
pallas::ledger::primitives::alonzo::BigInt::Int(2.into()),
|
||||
)],
|
||||
}))
|
||||
.into(),
|
||||
),
|
||||
|
@ -127,11 +127,11 @@ fn constant_data_map() {
|
|||
Term::<Name>::Constant(
|
||||
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::BigInt(pallas_primitives::alonzo::BigInt::Int(1.into())),
|
||||
PlutusData::BigInt(pallas::ledger::primitives::alonzo::BigInt::Int(1.into())),
|
||||
PlutusData::BoundedBytes(vec![0x0f].into()),
|
||||
),
|
||||
])))
|
||||
|
@ -146,8 +146,8 @@ fn constant_data_list() {
|
|||
round_trip(
|
||||
Term::<Name>::Constant(
|
||||
Constant::Data(PlutusData::Array(vec![
|
||||
PlutusData::BigInt(pallas_primitives::alonzo::BigInt::Int(0.into())),
|
||||
PlutusData::BigInt(pallas_primitives::alonzo::BigInt::Int(1.into())),
|
||||
PlutusData::BigInt(pallas::ledger::primitives::alonzo::BigInt::Int(0.into())),
|
||||
PlutusData::BigInt(pallas::ledger::primitives::alonzo::BigInt::Int(1.into())),
|
||||
]))
|
||||
.into(),
|
||||
),
|
||||
|
@ -159,9 +159,9 @@ fn constant_data_list() {
|
|||
fn constant_data_int() {
|
||||
round_trip(
|
||||
Term::<Name>::Constant(
|
||||
Constant::Data(PlutusData::BigInt(pallas_primitives::alonzo::BigInt::Int(
|
||||
2.into(),
|
||||
)))
|
||||
Constant::Data(PlutusData::BigInt(
|
||||
pallas::ledger::primitives::alonzo::BigInt::Int(2.into()),
|
||||
))
|
||||
.into(),
|
||||
),
|
||||
"(con data (I 2))",
|
||||
|
@ -169,14 +169,14 @@ fn constant_data_int() {
|
|||
|
||||
let term = Term::<Name>::Constant(
|
||||
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(),
|
||||
);
|
||||
assert_eq!(term.to_pretty(), "(con data (I 131844))");
|
||||
let term = Term::<Name>::Constant(
|
||||
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(),
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue