Merge pull request #949 from hadelive/minimal-pallas-deps
Minimal pallas dependencies
This commit is contained in:
commit
4c1bee5091
|
@ -3535,8 +3535,11 @@ dependencies = [
|
|||
"num-integer",
|
||||
"num-traits",
|
||||
"once_cell",
|
||||
"pallas",
|
||||
"pallas-addresses",
|
||||
"pallas-codec",
|
||||
"pallas-crypto",
|
||||
"pallas-primitives",
|
||||
"pallas-traverse",
|
||||
"peg",
|
||||
"pretty",
|
||||
"pretty_assertions",
|
||||
|
|
|
@ -19,8 +19,11 @@ miette = "5.5.0"
|
|||
num-bigint = "0.4.3"
|
||||
num-integer = "0.1.45"
|
||||
num-traits = "0.2.15"
|
||||
pallas.workspace = true
|
||||
pallas-crypto = "0.22.0"
|
||||
pallas-primitives = "0.22.0"
|
||||
pallas-addresses = "0.22.0"
|
||||
pallas-codec = { version = "0.22.0", features = ["num-bigint"] }
|
||||
pallas-traverse = "0.22.0"
|
||||
peg = "0.8.1"
|
||||
pretty = "0.11.3"
|
||||
serde = { version = "1.0.152", features = ["derive"] }
|
||||
|
|
|
@ -11,14 +11,12 @@ use crate::{
|
|||
};
|
||||
use num_bigint::BigInt;
|
||||
use num_traits::ToPrimitive;
|
||||
use pallas::ledger::{
|
||||
addresses::{Network, ShelleyAddress, ShelleyDelegationPart, ShelleyPaymentPart},
|
||||
primitives::{
|
||||
alonzo::{self, Constr, PlutusData},
|
||||
conway::{self, Language},
|
||||
},
|
||||
traverse::ComputeHash,
|
||||
use pallas_addresses::{Network, ShelleyAddress, ShelleyDelegationPart, ShelleyPaymentPart};
|
||||
use pallas_primitives::{
|
||||
alonzo::{self, Constr, PlutusData},
|
||||
conway::{self, Language},
|
||||
};
|
||||
use pallas_traverse::ComputeHash;
|
||||
use serde::{
|
||||
self,
|
||||
de::{self, Deserialize, Deserializer, MapAccess, Visitor},
|
||||
|
@ -304,7 +302,7 @@ 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)
|
||||
|
|
|
@ -2,7 +2,7 @@ use crate::{
|
|||
ast::{Constant, Name, Term, Type},
|
||||
builtins::DefaultFunction,
|
||||
};
|
||||
use pallas::ledger::primitives::alonzo::PlutusData;
|
||||
use pallas_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,12 +1,10 @@
|
|||
use num_bigint::BigInt;
|
||||
use pallas::{
|
||||
codec::flat::{
|
||||
de::{self, Decode, Decoder},
|
||||
en::{self, Encode, Encoder},
|
||||
Flat,
|
||||
},
|
||||
ledger::primitives::{babbage::PlutusData, Fragment},
|
||||
use pallas_codec::flat::{
|
||||
de::{self, Decode, Decoder},
|
||||
en::{self, Encode, Encoder},
|
||||
Flat,
|
||||
};
|
||||
use pallas_primitives::{babbage::PlutusData, Fragment};
|
||||
|
||||
use std::{collections::VecDeque, fmt::Debug, rc::Rc};
|
||||
|
||||
|
@ -35,7 +33,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()
|
||||
|
@ -88,7 +86,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)
|
||||
|
@ -1006,7 +1004,7 @@ mod tests {
|
|||
parser,
|
||||
};
|
||||
use indoc::indoc;
|
||||
use pallas::codec::flat::Flat;
|
||||
use pallas_codec::flat::Flat;
|
||||
|
||||
#[test]
|
||||
fn flat_encode_integer() {
|
||||
|
|
|
@ -9,9 +9,9 @@ pub mod parser;
|
|||
mod pretty;
|
||||
pub mod tx;
|
||||
|
||||
pub use pallas::codec::utils::KeyValuePairs;
|
||||
pub use pallas::crypto::hash::Hash;
|
||||
pub use pallas::ledger::primitives::{
|
||||
pub use pallas_codec::utils::KeyValuePairs;
|
||||
pub use pallas_crypto::hash::Hash;
|
||||
pub use pallas_primitives::{
|
||||
alonzo::{BigInt, Constr, PlutusData},
|
||||
babbage::{PostAlonzoTransactionOutput, TransactionInput, TransactionOutput, Value},
|
||||
Error, Fragment,
|
||||
|
|
|
@ -11,7 +11,7 @@ pub mod value;
|
|||
|
||||
use cost_model::{ExBudget, StepKind};
|
||||
pub use error::Error;
|
||||
use pallas::ledger::primitives::conway::Language;
|
||||
use pallas_primitives::conway::Language;
|
||||
|
||||
use self::{
|
||||
cost_model::CostModel,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use pallas::ledger::primitives::conway::Language;
|
||||
use pallas_primitives::conway::Language;
|
||||
|
||||
use crate::builtins::DefaultFunction;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ use num_bigint::BigInt;
|
|||
use num_integer::Integer;
|
||||
use num_traits::{Signed, Zero};
|
||||
use once_cell::sync::Lazy;
|
||||
use pallas::ledger::primitives::conway::{Language, PlutusData};
|
||||
use pallas_primitives::conway::{Language, PlutusData};
|
||||
|
||||
use crate::{
|
||||
ast::{Constant, Data, Type},
|
||||
|
|
|
@ -6,7 +6,7 @@ use crate::{
|
|||
};
|
||||
use num_bigint::BigInt;
|
||||
use num_traits::{Signed, ToPrimitive, Zero};
|
||||
use pallas::ledger::primitives::babbage::{self, PlutusData};
|
||||
use pallas_primitives::babbage::{self, PlutusData};
|
||||
|
||||
use super::{runtime::BuiltinRuntime, Error};
|
||||
|
||||
|
@ -411,7 +411,7 @@ pub fn from_pallas_bigint(n: &babbage::BigInt) -> BigInt {
|
|||
pub fn to_pallas_bigint(n: &BigInt) -> babbage::BigInt {
|
||||
if let Some(i) = n.to_i128() {
|
||||
if let Ok(i) = i.try_into() {
|
||||
let pallas_int: pallas::codec::utils::Int = i;
|
||||
let pallas_int: pallas_codec::utils::Int = i;
|
||||
return babbage::BigInt::Int(pallas_int);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::{cmp::Ordering, iter, ops::Neg, rc::Rc, vec};
|
|||
use indexmap::IndexMap;
|
||||
use itertools::Itertools;
|
||||
|
||||
use pallas::ledger::primitives::babbage::{BigInt, PlutusData};
|
||||
use pallas_primitives::babbage::{BigInt, PlutusData};
|
||||
|
||||
use crate::{
|
||||
ast::{Constant, Data, Name, NamedDeBruijn, Program, Term, Type},
|
||||
|
@ -1907,7 +1907,7 @@ fn pop_lambdas_and_get_names(term: &Term<Name>) -> (Vec<Rc<Name>>, &Term<Name>)
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
use pallas::ledger::primitives::babbage::{BigInt, PlutusData};
|
||||
use pallas_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::ledger::primitives::alonzo::PlutusData;
|
||||
use pallas_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::ledger::primitives::babbage::{Constr, PlutusData};
|
||||
use pallas_primitives::babbage::{Constr, PlutusData};
|
||||
use pretty::RcDoc;
|
||||
use std::ascii::escape_default;
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use pallas::ledger::primitives::{
|
||||
use pallas_primitives::{
|
||||
babbage::{CostMdls, MintedTx, Redeemer, TransactionInput, TransactionOutput},
|
||||
Fragment,
|
||||
};
|
||||
use pallas::ledger::traverse::{Era, MultiEraTx};
|
||||
use pallas_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::ledger::addresses::Error),
|
||||
Address(#[from] pallas_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::ledger::primitives::Error),
|
||||
FragmentDecode(#[from] pallas_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,22 +3,17 @@ use crate::{
|
|||
machine::cost_model::ExBudget,
|
||||
PlutusData,
|
||||
};
|
||||
use pallas::{
|
||||
codec::utils::{KeyValuePairs, MaybeIndefArray},
|
||||
crypto::hash::Hash,
|
||||
ledger::{
|
||||
addresses::{Address, ScriptHash, StakePayload},
|
||||
primitives::babbage::{
|
||||
Certificate, CostMdls, DatumHash, DatumOption, ExUnits, Mint, MintedTx, NativeScript,
|
||||
PlutusV1Script, PlutusV2Script, PolicyId, PseudoScript, Redeemer, RedeemerTag,
|
||||
RewardAccount, StakeCredential, TransactionInput, TransactionOutput, Value,
|
||||
Withdrawals,
|
||||
},
|
||||
traverse::{ComputeHash, OriginalHash},
|
||||
},
|
||||
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, Mint, MintedTx, NativeScript,
|
||||
PlutusV1Script, PlutusV2Script, PolicyId, PseudoScript, Redeemer, RedeemerTag, RewardAccount,
|
||||
StakeCredential, TransactionInput, TransactionOutput, Value, Withdrawals,
|
||||
};
|
||||
use pallas_traverse::{ComputeHash, OriginalHash};
|
||||
|
||||
use pallas::ledger::primitives::conway::Language;
|
||||
use pallas_primitives::conway::Language;
|
||||
|
||||
use std::{cmp::Ordering, collections::HashMap, convert::TryInto, ops::Deref, vec};
|
||||
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use pallas::{
|
||||
codec::utils::{KeyValuePairs, MaybeIndefArray},
|
||||
ledger::{
|
||||
addresses::{Address, ScriptHash, ShelleyPaymentPart, StakePayload},
|
||||
primitives::babbage::{
|
||||
Certificate, MintedTx, PolicyId, RedeemerTag, RewardAccount, StakeCredential,
|
||||
TransactionOutput,
|
||||
},
|
||||
},
|
||||
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 super::{
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
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 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 super::to_plutus_data::MintValue;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use pallas::codec::utils::MaybeIndefArray;
|
||||
use pallas::ledger::primitives::{
|
||||
use pallas_codec::utils::MaybeIndefArray;
|
||||
use pallas_primitives::{
|
||||
babbage::{CostMdls, TransactionInput, TransactionOutput},
|
||||
Fragment,
|
||||
};
|
||||
use pallas::ledger::traverse::{Era, MultiEraTx};
|
||||
use pallas_traverse::{Era, MultiEraTx};
|
||||
|
||||
use crate::machine::cost_model::ExBudget;
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
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::{
|
||||
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::{
|
||||
Certificate, DatumOption, PseudoScript, Redeemer, StakeCredential, TransactionInput,
|
||||
TransactionOutput, Value,
|
||||
};
|
||||
use pallas::ledger::traverse::ComputeHash;
|
||||
use pallas_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::ledger::primitives::alonzo::BigInt::Int(2.into()),
|
||||
)],
|
||||
fields: vec![PlutusData::BigInt(pallas_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::ledger::primitives::alonzo::BigInt::Int(0.into())),
|
||||
PlutusData::BigInt(pallas_primitives::alonzo::BigInt::Int(0.into())),
|
||||
PlutusData::BoundedBytes(vec![0x00].into()),
|
||||
),
|
||||
(
|
||||
PlutusData::BigInt(pallas::ledger::primitives::alonzo::BigInt::Int(1.into())),
|
||||
PlutusData::BigInt(pallas_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::ledger::primitives::alonzo::BigInt::Int(0.into())),
|
||||
PlutusData::BigInt(pallas::ledger::primitives::alonzo::BigInt::Int(1.into())),
|
||||
PlutusData::BigInt(pallas_primitives::alonzo::BigInt::Int(0.into())),
|
||||
PlutusData::BigInt(pallas_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::ledger::primitives::alonzo::BigInt::Int(2.into()),
|
||||
))
|
||||
Constant::Data(PlutusData::BigInt(pallas_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::ledger::primitives::alonzo::BigInt::BigUInt(vec![2, 3, 4].into()),
|
||||
pallas_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::ledger::primitives::alonzo::BigInt::BigNInt(vec![2, 3, 3].into()),
|
||||
pallas_primitives::alonzo::BigInt::BigNInt(vec![2, 3, 3].into()),
|
||||
))
|
||||
.into(),
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue