Compare commits

...

10 Commits

Author SHA1 Message Date
waalge 5a8ef1aef0 add: template from docs 2024-11-23 17:05:42 +00:00
Matthias Benkort 94ff20253b
Merge pull request #1059 from waalge/waalge/bump-flake-1-82-0
bump flake deps
2024-11-20 11:05:38 +01:00
waalge 57311d123c bump flake deps 2024-11-20 09:45:28 +00:00
KtorZ e2fb28b4ce
chore: Release 2024-11-19 15:55:23 +01:00
KtorZ 66e39898a1
Fix release date in CHANGELOG. 2024-11-19 15:54:24 +01:00
KtorZ e12d7e807d
Move JSON-schema help for check behind dedicated flag
1. A new option `show_json_schema` which, when enabled, will print the JSON schema of the command output if the target isn't an ANSI-capable terminal.
   2. Some modifications to the help message and error handling for the new option `show_json_schema`.

   This is now done to avoid flooding the help screen with an entire
   JSON schema. Plus, it makes the schema more easily exportable as an
   actual JSON schema.
2024-11-19 15:48:39 +01:00
KtorZ 7a93c55d0b
Minor fixes on the telemetry output for terminal. 2024-11-19 15:00:03 +01:00
KtorZ b5047d623a
Update to pallas=0.31.0 2024-11-19 14:53:36 +01:00
KtorZ c740e4639f
Update CHANGELOG 2024-11-19 13:20:24 +01:00
microproofs eec08fcbd9
Fix scoped path for list with tail cases only plus wild card fallback 2024-11-18 12:22:08 -05:00
37 changed files with 13307 additions and 11814 deletions

View File

@ -1,5 +1,13 @@
# Changelog
## v1.1.7 - 2024-11-19
### Changed
- **aiken**: Move JSON schema help for `check` under a new dedicated flag `--show-json-schema`. @KtorZ
- **aiken-lang**: Fix pattern-matching on list wildcard sometimes causing compiler crash following the new _decision trees_ approach. @MicroProofs
- **uplc**, **aiken**, **aiken-lang**: Update internal dependencies to pallas-0.31.0. @KtorZ
## v1.1.6 - 2024-11-13
### Added

754
Cargo.lock generated vendored

File diff suppressed because it is too large Load Diff

View File

@ -52,11 +52,11 @@ x86_64-unknown-linux-musl = "ubuntu-22.04"
walkdir = "2.3.2"
insta = { version = "1.30.0", features = ["yaml", "json", "redactions"] }
miette = { version = "7.2.0" }
pallas-addresses = "0.30.1"
pallas-codec = { version = "0.30.1", features = ["num-bigint"] }
pallas-crypto = "0.30.1"
pallas-primitives = "0.30.1"
pallas-traverse = "0.30.1"
pallas-addresses = "0.31.0"
pallas-codec = { version = "0.31.0", features = ["num-bigint"] }
pallas-crypto = "0.31.0"
pallas-primitives = "0.31.0"
pallas-traverse = "0.31.0"
[profile.dev.package.insta]
opt-level = 3

View File

@ -1,7 +1,7 @@
[package]
name = "aiken-lang"
description = "The Aiken compiler"
version = "1.1.6"
version = "1.1.7"
edition = "2021"
repository = "https://github.com/aiken-lang/aiken"
homepage = "https://github.com/aiken-lang/aiken"
@ -32,7 +32,7 @@ pretty = "0.12.3"
serde = { version = "1.0.197", features = ["derive", "rc"] }
strum = "0.24.1"
thiserror = "1.0.39"
uplc = { path = '../uplc', version = "1.1.6" }
uplc = { path = '../uplc', version = "1.1.7" }
vec1 = "1.10.1"
[target.'cfg(not(target_family="wasm"))'.dependencies]

View File

@ -1007,6 +1007,7 @@ impl UntypedExpr {
PlutusData::Array(elems) => UntypedExpr::List {
location: Span::empty(),
elements: elems
.to_vec()
.into_iter()
.map(UntypedExpr::reify_blind)
.collect::<Vec<_>>(),
@ -1041,6 +1042,7 @@ impl UntypedExpr {
let ix = convert_tag_to_constr(tag).or(any_constructor).unwrap() as usize;
let fields = fields
.to_vec()
.into_iter()
.map(|field| CallArg {
location: Span::empty(),
@ -1127,6 +1129,7 @@ impl UntypedExpr {
Ok(UntypedExpr::List {
location: Span::empty(),
elements: args
.to_vec()
.into_iter()
.map(|arg| {
UntypedExpr::do_reify_data(generics, data_types, arg, inner)
@ -1144,6 +1147,7 @@ impl UntypedExpr {
Type::Tuple { elems, .. } => Ok(UntypedExpr::Tuple {
location: Span::empty(),
elems: args
.to_vec()
.into_iter()
.zip(elems)
.map(|(arg, arg_type)| {
@ -1153,6 +1157,7 @@ impl UntypedExpr {
}),
Type::Pair { fst, snd, .. } => {
let mut elems = args
.to_vec()
.into_iter()
.zip([fst, snd])
.map(|(arg, arg_type)| {
@ -1213,6 +1218,7 @@ impl UntypedExpr {
} else {
let arguments =
fields
.to_vec()
.into_iter()
.zip(constructor.arguments.iter())
.map(
@ -1264,9 +1270,9 @@ impl UntypedExpr {
UntypedExpr::do_reify_data(
generics,
data_types,
PlutusData::Array(
Data::list(
kvs.into_iter()
.map(|(k, v)| PlutusData::Array(vec![k, v]))
.map(|(k, v)| Data::list(vec![k, v]))
.collect(),
),
tipo,

View File

@ -18,14 +18,11 @@ use indexmap::IndexMap;
use itertools::{Itertools, Position};
use std::{ops::Deref, rc::Rc};
use uplc::{
ast::{Constant as UplcConstant, Name, Term, Type as UplcType},
ast::{Constant as UplcConstant, Data, Name, Term, Type as UplcType},
builder::{CONSTR_FIELDS_EXPOSER, CONSTR_INDEX_EXPOSER},
builtins::DefaultFunction,
machine::{
runtime::{convert_constr_to_tag, Compressable, ANY_TAG},
value::to_pallas_bigint,
},
Constr, KeyValuePairs, PlutusData,
machine::{runtime::Compressable, value::to_pallas_bigint},
KeyValuePairs, PlutusData,
};
pub type Variant = String;
@ -637,12 +634,7 @@ pub fn convert_constants_to_data(constants: Vec<Rc<UplcConstant>>) -> Vec<UplcCo
UplcConstant::Data(PlutusData::BoundedBytes(s.as_bytes().to_vec().into()))
}
UplcConstant::Bool(b) => UplcConstant::Data(PlutusData::Constr(Constr {
tag: convert_constr_to_tag((*b).into()).unwrap_or(ANY_TAG),
any_constructor: convert_constr_to_tag((*b).into())
.map_or(Some((*b).into()), |_| None),
fields: vec![],
})),
UplcConstant::Bool(b) => UplcConstant::Data(Data::constr((*b).into(), vec![])),
UplcConstant::ProtoList(list_type, constants) => {
if matches!(list_type, UplcType::Pair(_, _)) {
let inner_constants = constants
@ -675,7 +667,7 @@ pub fn convert_constants_to_data(constants: Vec<Rc<UplcConstant>>) -> Vec<UplcCo
})
.collect_vec();
UplcConstant::Data(PlutusData::Array(inner_constants))
UplcConstant::Data(Data::list(inner_constants))
}
}
UplcConstant::ProtoPair(_, _, left, right) => {
@ -688,17 +680,13 @@ pub fn convert_constants_to_data(constants: Vec<Rc<UplcConstant>>) -> Vec<UplcCo
})
.collect_vec();
UplcConstant::Data(PlutusData::Array(vec![
UplcConstant::Data(Data::list(vec![
inner_constants[0].clone(),
inner_constants[1].clone(),
]))
}
d @ UplcConstant::Data(_) => d.clone(),
UplcConstant::Unit => UplcConstant::Data(PlutusData::Constr(Constr {
tag: convert_constr_to_tag(0).unwrap(),
any_constructor: None,
fields: vec![],
})),
UplcConstant::Unit => UplcConstant::Data(Data::constr(0, vec![])),
UplcConstant::Bls12_381G1Element(b) => UplcConstant::Data(PlutusData::BoundedBytes(
b.deref().clone().compress().into(),
)),
@ -741,33 +729,12 @@ pub fn convert_type_to_data(term: Term<Name>, field_type: &Rc<Type>) -> Term<Nam
)
.lambda("__pair")
.apply(term),
Some(UplcType::Unit) => Term::Constant(
UplcConstant::Data(PlutusData::Constr(Constr {
tag: convert_constr_to_tag(0).unwrap(),
any_constructor: None,
fields: vec![],
}))
.into(),
)
Some(UplcType::Unit) => Term::Constant(UplcConstant::Data(Data::constr(0, vec![])).into())
.lambda("_")
.apply(term),
Some(UplcType::Bool) => term.if_then_else(
Term::Constant(
UplcConstant::Data(PlutusData::Constr(Constr {
tag: convert_constr_to_tag(1).unwrap(),
any_constructor: None,
fields: vec![],
}))
.into(),
),
Term::Constant(
UplcConstant::Data(PlutusData::Constr(Constr {
tag: convert_constr_to_tag(0).unwrap(),
any_constructor: None,
fields: vec![],
}))
.into(),
),
Term::Constant(UplcConstant::Data(Data::constr(1, vec![])).into()),
Term::Constant(UplcConstant::Data(Data::constr(0, vec![])).into()),
),
Some(UplcType::Data) | None => term,

View File

@ -428,10 +428,17 @@ impl<'a> DecisionTree<'a> {
.enumerate()
.rev()
.for_each(|(index, (_, detree))| {
if index + cases.len() == 0 {
prev.push(Marker::Push(
ScopePath::Case(index + cases.len()),
detree,
));
} else {
prev.push(Marker::PopPush(
ScopePath::Case(index + cases.len()),
detree,
));
}
});
cases

View File

@ -559,16 +559,15 @@ impl Prng {
{
return Prng::Seeded {
choices: choices.to_vec(),
uplc: PlutusData::Constr(Constr {
tag: 121 + Prng::SEEDED,
fields: vec![
uplc: Data::constr(
Prng::SEEDED,
vec![
PlutusData::BoundedBytes(bytes.to_owned()),
// Clear choices between seeded runs, to not
// accumulate ALL choices ever made.
PlutusData::BoundedBytes(vec![].into()),
],
any_constructor: None,
}),
),
};
}
}

View File

@ -1,6 +1,6 @@
[package]
name = "aiken-lsp"
version = "1.1.6"
version = "1.1.7"
edition = "2021"
description = "Cardano smart contract language and toolchain"
repository = "https://github.com/aiken-lang/aiken"
@ -24,5 +24,5 @@ tracing = "0.1.37"
url = "2.3.1"
urlencoding = "2.1.2"
aiken-lang = { path = '../aiken-lang', version = "1.1.6" }
aiken-project = { path = '../aiken-project', version = "1.1.6" }
aiken-lang = { path = '../aiken-lang', version = "1.1.7" }
aiken-project = { path = '../aiken-project', version = "1.1.7" }

View File

@ -1,7 +1,7 @@
[package]
name = "aiken-project"
description = "Aiken project utilities"
version = "1.1.6"
version = "1.1.7"
edition = "2021"
repository = "https://github.com/aiken-lang/aiken"
homepage = "https://github.com/aiken-lang/aiken"
@ -15,7 +15,7 @@ rust-version = "1.70.0"
build = "build.rs"
[dependencies]
aiken-lang = { path = "../aiken-lang", version = "1.1.6" }
aiken-lang = { path = "../aiken-lang", version = "1.1.7" }
askama = { version = "0.12.0", features = ["urlencode"] }
camino = "1.1.9"
ciborium = "0.2.2"
@ -49,7 +49,7 @@ strip-ansi-escapes = "0.1.1"
thiserror = "1.0.39"
tokio = { version = "1.26.0", features = ["full"] }
toml = "0.7.2"
uplc = { path = '../uplc', version = "1.1.6" }
uplc = { path = '../uplc', version = "1.1.7" }
vec1 = "1.10.1"
walkdir.workspace = true
zip = "0.6.4"

View File

@ -2,7 +2,7 @@ use aiken_lang::{
expr::UntypedExpr,
test_framework::{PropertyTestResult, TestResult, UnitTestResult},
};
pub use json::Json;
pub use json::{json_schema, Json};
use std::{
collections::BTreeMap,
fmt::Display,

View File

@ -137,3 +137,137 @@ where
.filter(|t| matches!(t, TestResult::PropertyTestResult { .. }))
.count()
}
pub fn json_schema() -> serde_json::Value {
let definitions = json!({
"Summary": {
"type": "object",
"required": ["total", "passed", "failed", "kind"],
"properties": {
"total": { "type": "integer" },
"passed": { "type": "integer" },
"failed": { "type": "integer" },
"kind": {
"type": "object",
"required": ["unit", "property"],
"properties": {
"unit": { "type": "integer" },
"property": { "type": "integer" }
}
}
}
},
"Status": {
"type": "string",
"enum": [ "pass", "fail" ]
},
"OnFailure": {
"type": "string",
"enum": [
"fail_immediately",
"succeed_immediately",
"succeed_eventually"
]
}
});
let unit_test = json!({
"type": "object",
"required": [
"kind",
"title",
"status",
"on_failure",
"execution_units"
],
"properties": {
"kind": {
"type": "string",
"enum": [ "unit" ]
},
"title": { "type": "string" },
"status": { "$ref": "#/properties/definitions/Status" },
"on_failure": { "$ref": "#/properties/definitions/OnFailure" },
"execution_units": {
"type": "object",
"properties": {
"mem": { "type": "integer" },
"cpu": { "type": "integer" }
}
},
"assertion": { "type": "string" },
}
});
let property_test = json!({
"type": "object",
"required": [
"kind",
"title",
"status",
"on_failure",
"iterations",
"counterexample"
],
"properties": {
"kind": {
"type": "string",
"enum": [ "property" ]
},
"title": { "type": "string" },
"status": { "$ref": "#/properties/definitions/Status" },
"on_failure": { "$ref": "#/properties/definitions/OnFailure" },
"iterations": { "type": "integer" },
"labels": {
"type": "object",
"additionalProperties": { "type": "integer" }
},
"counterexample": {
"oneOf": [
{ "type": "string" },
{ "type": "null" },
{
"type": "object",
"properties": {
"error": { "type": "string" }
}
}
]
}
}
});
json!({
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$vocabulary": {
"https://json-schema.org/draft/2020-12/vocab/core": true,
"https://json-schema.org/draft/2020-12/vocab/applicator": true,
"https://json-schema.org/draft/2020-12/vocab/validation": true
},
"title": "Aiken CLI JSON Schema",
"type": "object",
"properties": {
"command[check]": {
"seed": { "type": "integer" },
"summary": { "$ref": "#/properties/definitions/Summary" },
"modules": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": { "type": "string" },
"summary": { "$ref": "#/properties/definitions/Summary" },
"test": {
"type": "array",
"items": {
"oneOf": [ unit_test, property_test ]
}
}
}
}
}
},
"definitions": definitions
}
})
}

View File

@ -109,7 +109,7 @@ impl EventListener for Terminal {
}
Event::RunningTests => {
eprintln!(
"{} {}\n",
"{} {}",
" Testing"
.if_supports_color(Stderr, |s| s.bold())
.if_supports_color(Stderr, |s| s.purple()),
@ -144,6 +144,10 @@ impl EventListener for Terminal {
String::new()
};
if !tests.is_empty() {
println!();
}
let summary = format!("{}{}", seed_info, fmt_test_summary(results, true));
println!(
"{}\n",
@ -204,10 +208,11 @@ impl EventListener for Terminal {
}
Event::ResolvingVersions => {
eprintln!(
"{}",
" Resolving dependencies"
"{} {}",
" Resolving"
.if_supports_color(Stderr, |s| s.bold())
.if_supports_color(Stderr, |s| s.purple()),
"dependencies".if_supports_color(Stderr, |s| s.bold())
)
}
}

View File

@ -1,7 +1,7 @@
[package]
name = "aiken"
description = "Cardano smart contract language and toolchain"
version = "1.1.6"
version = "1.1.7"
edition = "2021"
repository = "https://github.com/aiken-lang/aiken"
homepage = "https://github.com/aiken-lang/aiken"
@ -20,9 +20,9 @@ license = false
eula = false
[dependencies]
aiken-lang = { path = "../aiken-lang", version = "1.1.6" }
aiken-lsp = { path = "../aiken-lsp", version = "1.1.6" }
aiken-project = { path = '../aiken-project', version = "1.1.6" }
aiken-lang = { path = "../aiken-lang", version = "1.1.7" }
aiken-lsp = { path = "../aiken-lsp", version = "1.1.7" }
aiken-project = { path = '../aiken-project', version = "1.1.7" }
clap = { version = "4.1.8", features = [
"derive",
"wrap_help",
@ -46,7 +46,7 @@ rand = "0.8.5"
regex = "1.7.1"
serde_json = "1.0.94"
thiserror = "1.0.39"
uplc = { path = '../uplc', version = "1.1.6" }
uplc = { path = '../uplc', version = "1.1.7" }
[target.'cfg(not(windows))'.dependencies]
xdg = "2.5.2"

View File

@ -3,7 +3,10 @@ use aiken_lang::{
ast::{TraceLevel, Tracing},
test_framework::PropertyTest,
};
use aiken_project::watch::{self, watch_project, with_project};
use aiken_project::{
telemetry::json_schema,
watch::{self, watch_project, with_project},
};
use rand::prelude::*;
use std::{
io::{self, IsTerminal},
@ -19,92 +22,9 @@ Type-check an Aiken project and run any tests found.
Test results are printed as stylized outputs when `stdout` is a TTY-capable terminal. If it
isn't, (e.g. because you are redirecting the output to a file), test results are printed as
a JSON structured object. Use `--help` to see the whole schema.
a JSON structured object. Use `--show-json-schema` to see the whole schema.
"#),
after_long_help = color_print::cstr!(r#"<bold><underline>Output JSON schema:</underline></bold>
<bold>type</bold>: object
<bold>properties</bold>:
<bold>seed</bold>: <cyan>&type_integer</cyan>
<bold>type</bold>: integer
<bold>summary</bold>:
<bold>type</bold>: object
<bold>properties</bold>: <cyan>&type_summary</cyan>
<bold>total</bold>: *type_integer
<bold>passed</bold>: *type_integer
<bold>failed</bold>: *type_integer
<bold>kind</bold>:
<bold>type</bold>: object
<bold>properties</bold>:
<bold>unit</bold>: *type_integer
<bold>property</bold>: *type_integer
<bold>modules</bold>:
<bold>type</bold>: array
<bold>items</bold>:
<bold>type</bold>: object
<bold>properties</bold>:
<bold>name</bold>: <cyan>&type_string</cyan>
<bold>type</bold>: string
<bold>summary</bold>: *type_summary
<bold>test</bold>:
<bold>type</bold>: array
<bold>items</bold>:
<bold>oneOf</bold>:
- <bold>type</bold>: object
<bold>required</bold>:
- kind
- title
- status
- on_failure
- execution_units
<bold>properties</bold>:
<bold>kind</bold>
<bold>type</bold>: string
<bold>enum</bold>: [ "unit" ]
<bold>title</bold>: *type_string
<bold>status</bold>: <cyan>&type_status</cyan>
<bold>type</bold>: string
<bold>enum</bold>: [ "pass", "fail" ]
<bold>on_failure</bold>: <cyan>&type_on_failure</cyan>
<bold>type</bold>: string
<bold>enum</bold>:
- fail_immediately
- succeed_immediately
- succeed_eventually
<bold>execution_units</bold>:
<bold>type</bold>: object
<bold>properties</bold>:
<bold>mem</bold>: *type_integer
<bold>cpu</bold>: *type_integer
<bold>assertion</bold>: *type_string
- <bold>type</bold>: object
<bold>required</bold>:
- kind
- title
- status
- on_failure
- iterations
- counterexample
<bold>properties</bold>:
<bold>kind</bold>
<bold>type</bold>: string
<bold>enum</bold>: [ "property" ]
<bold>title</bold>: *type_string
<bold>status</bold>: *type_status
<bold>on_failure</bold>: *type_on_failure
<bold>iterations</bold>: *type_integer
<bold>labels</bold>:
<bold>type</bold>: object
<bold>additionalProperties</bold>: *type_integer
<bold>counterexample</bold>:
<bold>oneOf</bold>:
- *type_string
- <bold>type</bold>: "null"
- <bold>type</bold>: object
<bold>properties</bold>:
<bold>error</bold>: *type_string
<bold><underline>Note:</underline></bold>
You are seeing the extended help. Use `-h` instead of `--help` for a more compact view.
after_long_help = color_print::cstr!(r#"You are seeing the extended help. Use `-h` instead of `--help` for a more compact view.
"#
))]
pub struct Args {
@ -123,6 +43,11 @@ pub struct Args {
#[clap(long)]
debug: bool,
/// When enabled, print-out the JSON-schema of the command output when the target isn't an
/// ANSI-capable terminal
#[clap(long, required = false)]
show_json_schema: bool,
/// When enabled, re-run the command on file changes instead of exiting
#[clap(long)]
watch: bool,
@ -185,6 +110,7 @@ pub fn exec(
deny,
skip_tests,
debug,
show_json_schema,
match_tests,
exact_match,
watch,
@ -195,6 +121,11 @@ pub fn exec(
env,
}: Args,
) -> miette::Result<()> {
if show_json_schema {
println!("{}", serde_json::to_string_pretty(&json_schema()).unwrap());
std::process::exit(0);
}
let mut rng = rand::thread_rng();
let seed = seed.unwrap_or_else(|| rng.gen());

View File

@ -42,6 +42,7 @@ fn create_project(args: Args, package_name: &PackageName) -> miette::Result<()>
if !args.lib {
create_env(&root)?;
create_validators(&root)?;
create_validator(&root)?;
}
readme(&root, &package_name.repo)?;
@ -110,6 +111,48 @@ fn create_validators(root: &Path) -> miette::Result<()> {
fs::create_dir_all(validators).into_diagnostic()
}
fn create_validator(root: &Path) -> miette::Result<()> {
let validators = root.join("validators");
fs::write(
validators.join("hello.ak"),
indoc! {
r#"
use cardano/address.{{Credential}}
use cardano/assets.{{PolicyId}}
use cardano/certificate.{{Certificate}}
use cardano/governance.{{ProposalProcedure, Voter}}
use cardano/transaction.{{Transaction, OutputReference}}
validator my_script {{
mint(redeemer: MyMintRedeemer, policy_id: PolicyId, self: Transaction) {{
todo @"mint logic goes here"
}}
spend(datum: Option<MyDatum>, redeemer: MySpendRedeemer, utxo: OutputReference, self: Transaction) {{
todo @"spend logic goes here"
}}
withdraw(redeemer: MyWithdrawRedeemer, account: Credential, self: Transaction) {{
todo @"withdraw logic goes here"
}}
publish(redeemer: MyPublishRedeemer, certificate: Certificate, self: Transaction) {{
todo @"publish logic goes here"
}}
vote(redeemer: MyVoteRedeemer, voter: Voter, self: Transaction) {{
todo @"vote logic goes here"
}}
propose(redeemer: MyProposeRedeemer, proposal: ProposalProcedure, self: Transaction) {{
todo @"propose logic goes here"
}}
}}
"#,
},
).into_diagnostic()
}
fn readme(root: &Path, project_name: &str) -> miette::Result<()> {
fs::write(
root.join("README.md"),

View File

@ -1,7 +1,7 @@
[package]
name = "uplc"
description = "Utilities for working with Untyped Plutus Core"
version = "1.1.6"
version = "1.1.7"
edition = "2021"
repository = "https://github.com/aiken-lang/aiken"
homepage = "https://github.com/aiken-lang/aiken"

View File

@ -149,21 +149,21 @@ impl SerializableProgram {
PlutusV1Program(pgrm) => {
let cbor = pgrm.to_cbor().unwrap();
let compiled_code = hex::encode(&cbor);
let hash = conway::PlutusV1Script(cbor.into()).compute_hash();
let hash = conway::PlutusScript::<1>(cbor.into()).compute_hash();
(compiled_code, hash)
}
PlutusV2Program(pgrm) => {
let cbor = pgrm.to_cbor().unwrap();
let compiled_code = hex::encode(&cbor);
let hash = conway::PlutusV2Script(cbor.into()).compute_hash();
let hash = conway::PlutusScript::<2>(cbor.into()).compute_hash();
(compiled_code, hash)
}
PlutusV3Program(pgrm) => {
let cbor = pgrm.to_cbor().unwrap();
let compiled_code = hex::encode(&cbor);
let hash = conway::PlutusV3Script(cbor.into()).compute_hash();
let hash = conway::PlutusScript::<3>(cbor.into()).compute_hash();
(compiled_code, hash)
}
}
@ -239,15 +239,15 @@ impl<'a> Deserialize<'a> for SerializableProgram {
.and_then(|program| {
let cbor = || program.to_cbor().unwrap().into();
if conway::PlutusV3Script(cbor()).compute_hash().to_string() == hash {
if conway::PlutusScript::<1>(cbor()).compute_hash().to_string() == hash {
return Ok(SerializableProgram::PlutusV3Program(program));
}
if conway::PlutusV2Script(cbor()).compute_hash().to_string() == hash {
if conway::PlutusScript::<2>(cbor()).compute_hash().to_string() == hash {
return Ok(SerializableProgram::PlutusV2Program(program));
}
if conway::PlutusV1Script(cbor()).compute_hash().to_string() == hash {
if conway::PlutusScript::<3>(cbor()).compute_hash().to_string() == hash {
return Ok(SerializableProgram::PlutusV1Program(program));
}
@ -273,9 +273,9 @@ impl Program<DeBruijn> {
let cbor = self.to_cbor().unwrap();
let validator_hash = match plutus_version {
Language::PlutusV1 => conway::PlutusV1Script(cbor.into()).compute_hash(),
Language::PlutusV2 => conway::PlutusV2Script(cbor.into()).compute_hash(),
Language::PlutusV3 => conway::PlutusV3Script(cbor.into()).compute_hash(),
Language::PlutusV1 => conway::PlutusScript::<1>(cbor.into()).compute_hash(),
Language::PlutusV2 => conway::PlutusScript::<2>(cbor.into()).compute_hash(),
Language::PlutusV3 => conway::PlutusScript::<3>(cbor.into()).compute_hash(),
};
ShelleyAddress::new(
@ -420,10 +420,20 @@ impl Data {
}
pub fn list(xs: Vec<PlutusData>) -> PlutusData {
PlutusData::Array(xs)
PlutusData::Array(if xs.is_empty() {
conway::MaybeIndefArray::Def(xs)
} else {
conway::MaybeIndefArray::Indef(xs)
})
}
pub fn constr(ix: u64, fields: Vec<PlutusData>) -> PlutusData {
let fields = if fields.is_empty() {
conway::MaybeIndefArray::Def(fields)
} else {
conway::MaybeIndefArray::Indef(fields)
};
// NOTE: see https://github.com/input-output-hk/plutus/blob/9538fc9829426b2ecb0628d352e2d7af96ec8204/plutus-core/plutus-core/src/PlutusCore/Data.hs#L139-L155
if ix < 7 {
PlutusData::Constr(Constr {

View File

@ -881,7 +881,7 @@ impl DefaultFunction {
})
.collect();
let value = Value::data(PlutusData::Array(data_list));
let value = Value::data(Data::list(data_list));
Ok(value)
}

View File

@ -1,5 +1,5 @@
use crate::{
ast::{Constant, Name, Program, Term, Type},
ast::{Constant, Data, Name, Program, Term, Type},
builtins::DefaultFunction,
machine::{runtime::Compressable, value::to_pallas_bigint},
};
@ -239,7 +239,7 @@ peg::parser! {
rule data() -> PlutusData
= _* "Constr" _+ t:decimal() _+ fs:plutus_list() {?
Ok(crate::ast::Data::constr(
Ok(Data::constr(
u64::try_from(t).or(Err("tag"))?,
fs,
))
@ -247,7 +247,7 @@ peg::parser! {
/ _* "Map" _+ kvps:plutus_key_value_pairs() {
PlutusData::Map(pallas_codec::utils::KeyValuePairs::Def(kvps))
}
/ _* "List" _+ ls:plutus_list() { PlutusData::Array(ls) }
/ _* "List" _+ ls:plutus_list() { Data::list(ls) }
/ _* "I" _+ n:big_number() { PlutusData::BigInt(to_pallas_bigint(&n)) }
/ _* "B" _+ "#" i:ident()* {?
Ok(PlutusData::BoundedBytes(

View File

@ -5,7 +5,10 @@ use crate::{
};
use error::Error;
use pallas_primitives::{
conway::{CostMdls, MintedTx, Redeemer, TransactionInput, TransactionOutput},
conway::{
CostModels, ExUnits, MintedTx, Redeemer, Redeemers, RedeemersKey, TransactionInput,
TransactionOutput,
},
Fragment,
};
use pallas_traverse::{Era, MultiEraTx};
@ -28,7 +31,7 @@ pub mod to_plutus_data;
pub fn eval_phase_two(
tx: &MintedTx,
utxos: &[ResolvedInput],
cost_mdls: Option<&CostMdls>,
cost_mdls: Option<&CostModels>,
initial_budget: Option<&ExBudget>,
slot_config: &SlotConfig,
run_phase_one: bool,
@ -49,12 +52,12 @@ pub fn eval_phase_two(
let mut remaining_budget = *initial_budget.unwrap_or(&ExBudget::default());
for (redeemer_key, redeemer_value) in rs.iter() {
for (key, data, ex_units) in iter_redeemers(rs) {
let redeemer = Redeemer {
tag: redeemer_key.tag,
index: redeemer_key.index,
data: redeemer_value.data.clone(),
ex_units: redeemer_value.ex_units,
tag: key.tag,
index: key.index,
data: data.clone(),
ex_units,
};
with_redeemer(&redeemer);
@ -100,7 +103,9 @@ pub fn eval_phase_two_raw(
.or_else(|_| MultiEraTx::decode_for_era(Era::Babbage, tx_bytes))
.or_else(|_| MultiEraTx::decode_for_era(Era::Alonzo, tx_bytes))?;
let cost_mdls = cost_mdls_bytes.map(CostMdls::decode_fragment).transpose()?;
let cost_mdls = cost_mdls_bytes
.map(CostModels::decode_fragment)
.transpose()?;
let budget = ExBudget {
cpu: initial_budget.0 as i64,
@ -161,7 +166,7 @@ pub fn apply_params_to_script(
let mut buffer = Vec::new();
let mut program = Program::<DeBruijn>::from_cbor(plutus_script_bytes, &mut buffer)?;
for param in params {
for param in params.to_vec() {
program = program.apply_data(param);
}
@ -170,3 +175,31 @@ pub fn apply_params_to_script(
Err(_) => Err(Error::ApplyParamsError),
}
}
pub fn iter_redeemers(
redeemers: &Redeemers,
) -> impl Iterator<Item = (RedeemersKey, &PlutusData, ExUnits)> {
match redeemers {
Redeemers::List(rs) => Box::new(rs.iter().map(|r| {
(
RedeemersKey {
tag: r.tag,
index: r.index,
},
&r.data,
r.ex_units,
)
})),
Redeemers::Map(kv) => Box::new(kv.iter().map(|(k, v)| {
(
RedeemersKey {
tag: k.tag,
index: k.index,
},
&v.data,
v.ex_units,
)
}))
as Box<dyn Iterator<Item = (RedeemersKey, &PlutusData, ExUnits)>>,
}
}

View File

@ -13,7 +13,7 @@ use crate::{
PlutusData,
};
use pallas_codec::utils::Bytes;
use pallas_primitives::conway::{CostMdls, CostModel, ExUnits, Language, MintedTx, Redeemer};
use pallas_primitives::conway::{CostModel, CostModels, ExUnits, Language, MintedTx, Redeemer};
pub fn eval_redeemer(
tx: &MintedTx,
@ -21,7 +21,7 @@ pub fn eval_redeemer(
slot_config: &SlotConfig,
redeemer: &Redeemer,
lookup_table: &DataLookupTable,
cost_mdls_opt: Option<&CostMdls>,
cost_mdls_opt: Option<&CostModels>,
initial_budget: &ExBudget,
) -> Result<Redeemer, Error> {
fn do_eval_redeemer(

View File

@ -7,8 +7,8 @@ use itertools::Itertools;
use pallas_addresses::{Address, ScriptHash, ShelleyPaymentPart, StakePayload};
use pallas_codec::utils::Nullable;
use pallas_primitives::conway::{
Certificate, GovAction, MintedTx, PolicyId, RedeemerTag, RedeemersKey, RewardAccount,
StakeCredential, TransactionOutput, Voter,
Certificate, GovAction, MintedTx, PolicyId, RedeemerTag, Redeemers, RedeemersKey,
RewardAccount, StakeCredential, TransactionOutput, Voter,
};
use std::collections::HashMap;
@ -92,7 +92,7 @@ pub fn scripts_needed(tx: &MintedTx, utxos: &[ResolvedInput]) -> Result<ScriptsN
if let Address::Stake(a) = address {
if let StakePayload::Script(h) = a.payload() {
let cred = StakeCredential::Scripthash(*h);
let cred = StakeCredential::ScriptHash(*h);
return Some((ScriptPurpose::Rewarding(cred), *h));
}
}
@ -110,19 +110,19 @@ pub fn scripts_needed(tx: &MintedTx, utxos: &[ResolvedInput]) -> Result<ScriptsN
m.iter()
.enumerate()
.filter_map(|(ix, cert)| match cert {
Certificate::StakeDeregistration(StakeCredential::Scripthash(h))
| Certificate::UnReg(StakeCredential::Scripthash(h), _)
| Certificate::VoteDeleg(StakeCredential::Scripthash(h), _)
| Certificate::VoteRegDeleg(StakeCredential::Scripthash(h), _, _)
| Certificate::StakeVoteDeleg(StakeCredential::Scripthash(h), _, _)
| Certificate::StakeRegDeleg(StakeCredential::Scripthash(h), _, _)
| Certificate::StakeVoteRegDeleg(StakeCredential::Scripthash(h), _, _, _)
| Certificate::RegDRepCert(StakeCredential::Scripthash(h), _, _)
| Certificate::UnRegDRepCert(StakeCredential::Scripthash(h), _)
| Certificate::UpdateDRepCert(StakeCredential::Scripthash(h), _)
| Certificate::AuthCommitteeHot(StakeCredential::Scripthash(h), _)
| Certificate::ResignCommitteeCold(StakeCredential::Scripthash(h), _)
| Certificate::StakeDelegation(StakeCredential::Scripthash(h), _) => {
Certificate::StakeDeregistration(StakeCredential::ScriptHash(h))
| Certificate::UnReg(StakeCredential::ScriptHash(h), _)
| Certificate::VoteDeleg(StakeCredential::ScriptHash(h), _)
| Certificate::VoteRegDeleg(StakeCredential::ScriptHash(h), _, _)
| Certificate::StakeVoteDeleg(StakeCredential::ScriptHash(h), _, _)
| Certificate::StakeRegDeleg(StakeCredential::ScriptHash(h), _, _)
| Certificate::StakeVoteRegDeleg(StakeCredential::ScriptHash(h), _, _, _)
| Certificate::RegDRepCert(StakeCredential::ScriptHash(h), _, _)
| Certificate::UnRegDRepCert(StakeCredential::ScriptHash(h), _)
| Certificate::UpdateDRepCert(StakeCredential::ScriptHash(h), _)
| Certificate::AuthCommitteeHot(StakeCredential::ScriptHash(h), _)
| Certificate::ResignCommitteeCold(StakeCredential::ScriptHash(h), _)
| Certificate::StakeDelegation(StakeCredential::ScriptHash(h), _) => {
Some((ScriptPurpose::Certifying(ix, cert.clone()), *h))
}
@ -222,11 +222,26 @@ pub fn has_exact_set_of_redeemers(
}
}
let wits_redeemer_keys: Vec<&RedeemersKey> = tx
let wits_redeemer_keys: Vec<RedeemersKey> = tx
.transaction_witness_set
.redeemer
.as_deref()
.map(|m| m.iter().map(|(k, _)| k).collect())
.map(|m| match m {
Redeemers::List(rs) => rs
.iter()
.map(|r| RedeemersKey {
index: r.index,
tag: r.tag,
})
.collect(),
Redeemers::Map(kv) => kv
.iter()
.map(|(k, _)| RedeemersKey {
index: k.index,
tag: k.tag,
})
.collect(),
})
.unwrap_or_default();
let needed_redeemer_keys: Vec<RedeemersKey> =
@ -234,7 +249,7 @@ pub fn has_exact_set_of_redeemers(
let missing: Vec<_> = redeemers_needed
.into_iter()
.filter(|x| !wits_redeemer_keys.contains(&&x.0))
.filter(|x| !wits_redeemer_keys.contains(&x.0))
.map(|x| {
format!(
"{}[{:?}] -> {}",
@ -321,7 +336,7 @@ fn build_redeemer_key(
for (idx, x) in reward_accounts.iter().enumerate() {
let cred = match Address::from_bytes(x).unwrap() {
Address::Stake(a) => match a.payload() {
StakePayload::Script(sh) => Some(StakeCredential::Scripthash(*sh)),
StakePayload::Script(sh) => Some(StakeCredential::ScriptHash(*sh)),
StakePayload::Stake(_) => None,
},
_ => return Err(Error::BadWithdrawalAddress),

View File

@ -1,4 +1,5 @@
use super::{to_plutus_data::MintValue, Error};
use crate::tx::iter_redeemers;
use itertools::Itertools;
use pallas_addresses::{Address, Network, StakePayload};
use pallas_codec::utils::{
@ -10,10 +11,10 @@ use pallas_primitives::{
conway::{
AddrKeyhash, Certificate, Coin, DatumHash, DatumOption, GovAction, GovActionId, Mint,
MintedTransactionBody, MintedTransactionOutput, MintedTx, MintedWitnessSet, NativeScript,
PlutusData, PlutusV1Script, PlutusV2Script, PlutusV3Script, PolicyId,
PostAlonzoTransactionOutput, ProposalProcedure, PseudoDatumOption, PseudoScript, Redeemer,
RedeemerTag, RedeemersKey, RequiredSigners, RewardAccount, ScriptHash, StakeCredential,
TransactionInput, TransactionOutput, Value, Voter, VotingProcedure,
PlutusData, PlutusScript, PolicyId, PostAlonzoTransactionOutput, ProposalProcedure,
PseudoDatumOption, PseudoScript, Redeemer, RedeemerTag, RedeemersKey, RequiredSigners,
RewardAccount, ScriptHash, StakeCredential, TransactionInput, TransactionOutput, Value,
Voter, VotingProcedure,
},
};
use pallas_traverse::{ComputeHash, OriginalHash};
@ -77,9 +78,9 @@ impl ScriptPurpose {
#[derive(Debug, PartialEq, Clone)]
pub enum ScriptVersion {
Native(NativeScript),
V1(PlutusV1Script),
V2(PlutusV2Script),
V3(PlutusV3Script),
V1(PlutusScript<1>),
V2(PlutusScript<2>),
V3(PlutusScript<3>),
}
pub struct DataLookupTable {
@ -400,7 +401,7 @@ impl TxInfo {
| TxInfo::V2(TxInfoV2 { ref redeemers, .. }) => redeemers
.iter()
.find_map(move |(purpose, some_redeemer)| {
if redeemer == some_redeemer {
if redeemer.tag == some_redeemer.tag && redeemer.index == some_redeemer.index {
Some(purpose.clone())
} else {
None
@ -414,7 +415,7 @@ impl TxInfo {
TxInfo::V3(TxInfoV3 { ref redeemers, .. }) => redeemers
.iter()
.find_map(move |(purpose, some_redeemer)| {
if redeemer == some_redeemer {
if redeemer.tag == some_redeemer.tag && redeemer.index == some_redeemer.index {
Some(purpose.clone())
} else {
None
@ -702,24 +703,24 @@ pub fn get_data_info(witness_set: &MintedWitnessSet) -> Vec<(DatumHash, PlutusDa
pub fn get_redeemers_info<'a>(
witness_set: &'a MintedWitnessSet,
to_script_purpose: impl Fn(&'a RedeemersKey) -> Result<ScriptPurpose, Error>,
to_script_purpose: impl Fn(RedeemersKey) -> Result<ScriptPurpose, Error> + 'a,
) -> Result<KeyValuePairs<ScriptPurpose, Redeemer>, Error> {
Ok(KeyValuePairs::from(
witness_set
.redeemer
.as_deref()
.map(|m| {
m.iter()
.sorted_by(|a, b| sort_redeemers(&a.0, &b.0))
.map(|(redeemer_key, redeemer_value)| {
iter_redeemers(m)
.sorted_by(|(a, _, _), (b, _, _)| sort_redeemers(a, b))
.map(|(key, data, ex_units)| {
let redeemer = Redeemer {
tag: redeemer_key.tag,
index: redeemer_key.index,
data: redeemer_value.data.clone(),
ex_units: redeemer_value.ex_units,
tag: key.tag,
index: key.index,
data: data.clone(),
ex_units,
};
to_script_purpose(redeemer_key).map(|purpose| (purpose, redeemer))
to_script_purpose(key).map(|purpose| (purpose, redeemer))
})
.collect::<Result<Vec<_>, _>>()
})
@ -766,8 +767,8 @@ fn script_purpose_builder<'a>(
withdrawals: &'a KeyValuePairs<Address, Coin>,
proposal_procedures: &'a [ProposalProcedure],
votes: &'a [&'a Voter],
) -> impl Fn(&'a RedeemersKey) -> Result<ScriptPurpose, Error> {
move |redeemer: &'a RedeemersKey| {
) -> impl Fn(RedeemersKey) -> Result<ScriptPurpose, Error> + 'a {
move |redeemer: RedeemersKey| {
let tag = redeemer.tag;
let index = redeemer.index as usize;
@ -793,7 +794,7 @@ fn script_purpose_builder<'a>(
.map(|(address, _)| match address {
Address::Stake(stake_address) => match stake_address.payload() {
StakePayload::Script(script_hash) => Ok(ScriptPurpose::Rewarding(
StakeCredential::Scripthash(*script_hash),
StakeCredential::ScriptHash(*script_hash),
)),
StakePayload::Stake(_) => Err(Error::NonScriptWithdrawal),
},
@ -885,7 +886,7 @@ pub fn find_script(
| Certificate::AuthCommitteeHot(stake_credential, _)
| Certificate::ResignCommitteeCold(stake_credential, _)
| Certificate::StakeDelegation(stake_credential, _) => match stake_credential {
StakeCredential::Scripthash(hash) => Ok(hash),
StakeCredential::ScriptHash(hash) => Ok(hash),
_ => Err(Error::NonScriptStakeCredential),
},
Certificate::StakeRegistration { .. }

View File

@ -6,24 +6,29 @@ Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
Array(
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Array(
Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -73,23 +78,27 @@ Constr(
),
),
],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -125,16 +134,20 @@ Constr(
),
),
],
),
},
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
],
),
},
),
Map(
@ -177,36 +190,46 @@ Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
],
),
},
),
],
),
},
),
],
),
),
Array(
Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -256,23 +279,27 @@ Constr(
),
),
],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -308,16 +335,20 @@ Constr(
),
),
],
),
},
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
],
),
},
),
Map(
@ -360,41 +391,52 @@ Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
],
),
},
),
],
),
},
),
],
),
),
Array(
Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -430,16 +472,20 @@ Constr(
),
),
],
),
},
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
],
),
},
),
Map(
@ -482,7 +528,8 @@ Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -522,33 +569,40 @@ Constr(
),
),
],
),
},
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -584,23 +638,27 @@ Constr(
),
),
],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -636,15 +694,19 @@ Constr(
),
),
],
),
},
),
],
),
},
),
],
),
},
),
],
),
},
),
Map(
@ -816,34 +878,42 @@ Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -879,23 +949,27 @@ Constr(
),
),
],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -931,15 +1005,19 @@ Constr(
),
),
],
),
},
),
],
),
},
),
],
),
},
),
],
),
},
),
Map(
@ -1049,14 +1127,17 @@ Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -1092,13 +1173,16 @@ Constr(
),
),
],
),
},
),
],
),
},
),
],
),
),
BigInt(
Int(
Int(
@ -1270,8 +1354,10 @@ Constr(
),
),
Array(
Def(
[],
),
),
Map(
Def(
[],
@ -1281,57 +1367,73 @@ Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 123,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
],
),
},
),
],
),
},
),
Array(
Def(
[],
),
),
Map(
Def(
[
@ -1340,7 +1442,8 @@ Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -1376,13 +1479,16 @@ Constr(
),
),
],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
),
@ -1391,7 +1497,8 @@ Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -1427,6 +1534,7 @@ Constr(
),
),
],
),
},
),
BigInt(
@ -1489,7 +1597,9 @@ Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
),
@ -1540,23 +1650,30 @@ Constr(
),
),
Array(
Def(
[],
),
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
],
),
},
),
BigInt(
@ -1573,7 +1690,8 @@ Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -1609,8 +1727,10 @@ Constr(
),
),
],
),
},
),
],
),
},
)

View File

@ -6,24 +6,29 @@ Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
Array(
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Array(
Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -73,23 +78,27 @@ Constr(
),
),
],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -125,16 +134,20 @@ Constr(
),
),
],
),
},
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
],
),
},
),
Map(
@ -177,97 +190,116 @@ Constr(
Constr {
tag: 123,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [],
},
),
],
},
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [],
},
),
],
},
),
],
},
),
],
),
Array(
fields: Def(
[],
),
Array(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
BoundedBytes(
BoundedBytes(
[
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
],
),
},
),
],
),
},
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
],
),
},
),
],
),
},
),
],
),
),
Array(
Def(
[],
),
),
Array(
Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
],
),
),
],
),
},
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: Def(
[],
),
},
),
],
),
},
),
Map(
@ -310,21 +342,27 @@ Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
],
),
},
),
],
),
),
BigInt(
Int(
Int(
@ -341,8 +379,10 @@ Constr(
),
),
Array(
Def(
[],
),
),
Map(
Def(
[],
@ -352,57 +392,73 @@ Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 123,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
],
),
},
),
],
),
},
),
Array(
Def(
[],
),
),
Map(
Def(
[
@ -411,12 +467,14 @@ Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -466,16 +524,20 @@ Constr(
),
),
],
),
},
),
],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
),
@ -531,42 +593,53 @@ Constr(
),
),
Array(
Def(
[],
),
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -616,26 +689,33 @@ Constr(
),
),
],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
],
),
},
),
],
),
},
),
],
),
},
)

View File

@ -6,24 +6,29 @@ Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
Array(
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Array(
Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -73,23 +78,27 @@ Constr(
),
),
],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -125,16 +134,20 @@ Constr(
),
),
],
),
},
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
],
),
},
),
Map(
@ -177,30 +190,41 @@ Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [],
},
),
],
},
),
],
},
),
],
),
Array(
fields: Def(
[],
),
},
),
],
),
},
),
],
),
},
),
],
),
),
Array(
Def(
[],
),
),
Array(
Def(
[],
),
),
BigInt(
Int(
Int(
@ -217,8 +241,10 @@ Constr(
),
),
Array(
Def(
[],
),
),
Map(
Def(
[],
@ -228,57 +254,73 @@ Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 123,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
],
),
},
),
],
),
},
),
Array(
Def(
[],
),
),
Map(
Def(
[
@ -287,17 +329,20 @@ Constr(
Constr {
tag: 125,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -333,19 +378,23 @@ Constr(
),
),
],
),
},
),
],
),
},
),
],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Def(
[
BigInt(
Int(
Int(
@ -357,6 +406,7 @@ Constr(
),
),
],
),
},
),
),
@ -365,17 +415,20 @@ Constr(
Constr {
tag: 125,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -411,19 +464,24 @@ Constr(
),
),
],
),
},
),
],
),
},
),
],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
),
@ -481,12 +539,14 @@ Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -522,9 +582,11 @@ Constr(
),
),
],
),
},
),
],
),
},
),
Map(
@ -535,7 +597,8 @@ Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -585,13 +648,16 @@ Constr(
),
),
],
),
},
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
),
@ -604,12 +670,14 @@ Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -645,9 +713,11 @@ Constr(
),
),
],
),
},
),
],
),
},
),
Map(
@ -658,7 +728,8 @@ Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -708,13 +779,16 @@ Constr(
),
),
],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
),
@ -727,12 +801,14 @@ Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -768,9 +844,11 @@ Constr(
),
),
],
),
},
),
],
),
},
),
Map(
@ -781,7 +859,8 @@ Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -831,13 +910,16 @@ Constr(
),
),
],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
),
@ -850,12 +932,14 @@ Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -891,9 +975,11 @@ Constr(
),
),
],
),
},
),
],
),
},
),
Map(
@ -904,7 +990,8 @@ Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -954,13 +1041,16 @@ Constr(
),
),
],
),
},
),
Constr(
Constr {
tag: 123,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
),
@ -969,7 +1059,8 @@ Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -1019,13 +1110,16 @@ Constr(
),
),
],
),
},
),
Constr(
Constr {
tag: 123,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
),
@ -1034,7 +1128,8 @@ Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -1084,13 +1179,16 @@ Constr(
),
),
],
),
},
),
Constr(
Constr {
tag: 123,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
),
@ -1103,7 +1201,8 @@ Constr(
Constr {
tag: 123,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -1139,6 +1238,7 @@ Constr(
),
),
],
),
},
),
Map(
@ -1149,7 +1249,8 @@ Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -1199,13 +1300,16 @@ Constr(
),
),
],
),
},
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
),
@ -1217,30 +1321,38 @@ Constr(
),
),
Array(
Def(
[],
),
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
BigInt(
Int(
Int(
@ -1252,23 +1364,27 @@ Constr(
),
),
],
),
},
),
Constr(
Constr {
tag: 125,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -1304,14 +1420,18 @@ Constr(
),
),
],
),
},
),
],
),
},
),
],
),
},
),
],
),
},
)

View File

@ -6,24 +6,29 @@ Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
Array(
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Array(
Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -73,23 +78,27 @@ Constr(
),
),
],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -125,23 +134,27 @@ Constr(
),
),
],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -177,15 +190,19 @@ Constr(
),
),
],
),
},
),
],
),
},
),
],
),
},
),
],
),
},
),
Map(
@ -228,22 +245,27 @@ Constr(
Constr {
tag: 123,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -279,36 +301,46 @@ Constr(
),
),
],
),
},
),
],
),
},
),
],
),
},
),
],
),
),
Array(
Def(
[],
),
),
Array(
Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -344,23 +376,27 @@ Constr(
),
),
],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -396,15 +432,19 @@ Constr(
),
),
],
),
},
),
],
),
},
),
],
),
},
),
],
),
},
),
Map(
@ -447,34 +487,42 @@ Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -510,18 +558,21 @@ Constr(
),
),
],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [
fields: Indef(
[
BigInt(
Int(
Int(
@ -553,12 +604,15 @@ Constr(
),
),
],
),
},
),
],
),
},
),
],
),
},
),
Map(
@ -601,34 +655,42 @@ Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -664,18 +726,21 @@ Constr(
),
),
],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [
fields: Indef(
[
BigInt(
Int(
Int(
@ -707,12 +772,15 @@ Constr(
),
),
],
),
},
),
],
),
},
),
],
),
},
),
Map(
@ -755,21 +823,27 @@ Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
],
),
},
),
],
),
),
BigInt(
Int(
Int(
@ -786,8 +860,10 @@ Constr(
),
),
Array(
Def(
[],
),
),
Map(
Def(
[
@ -796,7 +872,8 @@ Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -832,6 +909,7 @@ Constr(
),
),
],
),
},
),
BigInt(
@ -852,39 +930,48 @@ Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [
fields: Indef(
[
BigInt(
Int(
Int(
@ -896,22 +983,28 @@ Constr(
),
),
],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
],
),
},
),
],
),
},
),
Array(
Indef(
[
BoundedBytes(
BoundedBytes(
@ -949,6 +1042,7 @@ Constr(
),
],
),
),
Map(
Def(
[
@ -957,12 +1051,14 @@ Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -1012,24 +1108,30 @@ Constr(
),
),
],
),
},
),
],
),
},
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [
fields: Def(
[
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
],
),
},
),
),
@ -1038,12 +1140,14 @@ Constr(
Constr {
tag: 123,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -1079,16 +1183,20 @@ Constr(
),
),
],
),
},
),
],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
),
@ -1144,20 +1252,25 @@ Constr(
),
),
Array(
Def(
[],
),
),
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [
fields: Indef(
[
BigInt(
Int(
Int(
@ -1169,28 +1282,34 @@ Constr(
),
),
],
),
},
),
],
),
},
),
Constr(
Constr {
tag: 121,
any_constructor: None,
fields: [],
fields: Def(
[],
),
},
),
Constr(
Constr {
tag: 123,
any_constructor: None,
fields: [
fields: Indef(
[
Constr(
Constr {
tag: 122,
any_constructor: None,
fields: [
fields: Indef(
[
BoundedBytes(
BoundedBytes(
[
@ -1226,11 +1345,14 @@ Constr(
),
),
],
),
},
),
],
),
},
),
],
),
},
)

View File

@ -2,7 +2,7 @@ use super::{eval_phase_two, ResolvedInput, SlotConfig};
use crate::machine::cost_model::ExBudget;
use pallas_codec::utils::MaybeIndefArray;
use pallas_primitives::{
conway::{CostMdls, TransactionInput, TransactionOutput},
conway::{CostModels, TransactionInput, TransactionOutput},
Fragment,
};
use pallas_traverse::{Era, MultiEraTx};
@ -222,7 +222,7 @@ fn test_eval_0() {
20000000000,
];
let cost_mdl = CostMdls {
let cost_mdl = CostModels {
plutus_v1: None,
plutus_v2: Some(costs),
plutus_v3: None,
@ -494,7 +494,7 @@ fn test_eval_1() {
20000000000,
];
let cost_mdl = CostMdls {
let cost_mdl = CostModels {
plutus_v1: None,
plutus_v2: Some(costs),
plutus_v3: None,
@ -606,7 +606,7 @@ fn test_eval_2() {
31220, 32, 32696, 32, 43357, 32, 32247, 32, 38314, 32, 9462713, 1021, 10,
];
let cost_mdl = CostMdls {
let cost_mdl = CostModels {
plutus_v1: Some(costs),
plutus_v2: None,
plutus_v3: None,
@ -876,7 +876,7 @@ fn test_eval_3() {
20000000000,
];
let cost_mdl = CostMdls {
let cost_mdl = CostModels {
plutus_v1: None,
plutus_v2: Some(costs),
plutus_v3: None,
@ -984,7 +984,7 @@ fn test_eval_4() {
31220, 32, 32696, 32, 43357, 32, 32247, 32, 38314, 32, 9462713, 1021, 10,
];
let cost_mdl = CostMdls {
let cost_mdl = CostModels {
plutus_v1: Some(costs),
plutus_v2: None,
plutus_v3: None,
@ -1069,7 +1069,7 @@ fn test_eval_5() {
31220, 32, 32696, 32, 43357, 32, 32247, 32, 38314, 32, 9462713, 1021, 10,
];
let cost_mdl = CostMdls {
let cost_mdl = CostModels {
plutus_v1: Some(costs),
plutus_v2: None,
plutus_v3: None,
@ -1179,7 +1179,7 @@ fn test_eval_6() {
3345831, 1, 1,
];
let cost_mdl = CostMdls {
let cost_mdl = CostModels {
plutus_v1: Some(costs),
plutus_v2: None,
plutus_v3: None,
@ -1289,7 +1289,7 @@ fn test_eval_7() {
3345831, 1, 1,
];
let cost_mdl = CostMdls {
let cost_mdl = CostModels {
plutus_v1: Some(costs),
plutus_v2: None,
plutus_v3: None,
@ -1550,7 +1550,7 @@ fn test_eval_8() {
20000000000,
];
let cost_mdl = CostMdls {
let cost_mdl = CostModels {
plutus_v1: None,
plutus_v2: Some(costs),
plutus_v3: None,
@ -1656,7 +1656,7 @@ fn eval_missing_redeemer() {
31220, 32, 32696, 32, 43357, 32, 32247, 32, 38314, 32, 9462713, 1021, 10,
];
let cost_mdl = CostMdls {
let cost_mdl = CostModels {
plutus_v1: Some(costs),
plutus_v2: None,
plutus_v3: None,
@ -1739,7 +1739,7 @@ fn eval_extraneous_redeemer() {
31220, 32, 32696, 32, 43357, 32, 32247, 32, 38314, 32, 9462713, 1021, 10,
];
let cost_mdl = CostMdls {
let cost_mdl = CostModels {
plutus_v1: Some(costs),
plutus_v2: None,
plutus_v3: None,

View File

@ -11,7 +11,8 @@ use pallas_addresses::{
Address, ShelleyDelegationPart, ShelleyPaymentPart, StakeAddress, StakePayload,
};
use pallas_codec::utils::{
AnyUInt, Bytes, Int, KeyValuePairs, NonEmptyKeyValuePairs, Nullable, PositiveCoin,
AnyUInt, Bytes, Int, KeyValuePairs, MaybeIndefArray, NonEmptyKeyValuePairs, Nullable,
PositiveCoin,
};
use pallas_crypto::hash::Hash;
use pallas_primitives::conway::{
@ -28,7 +29,11 @@ fn wrap_multiple_with_constr(index: u64, data: Vec<PlutusData>) -> PlutusData {
PlutusData::Constr(Constr {
tag: converted.unwrap_or(ANY_TAG),
any_constructor: converted.map_or(Some(index), |_| None),
fields: data,
fields: if data.is_empty() {
MaybeIndefArray::Def(data)
} else {
MaybeIndefArray::Indef(data)
},
})
}
@ -104,7 +109,7 @@ impl ToPlutusData for Address {
.to_plutus_data(),
ShelleyDelegationPart::Script(script_hash) => Some(wrap_with_constr(
0,
StakeCredential::Scripthash(*script_hash).to_plutus_data(),
StakeCredential::ScriptHash(*script_hash).to_plutus_data(),
))
.to_plutus_data(),
ShelleyDelegationPart::Pointer(pointer) => Some(wrap_multiple_with_constr(
@ -174,7 +179,7 @@ where
A: ToPlutusData,
{
fn to_plutus_data(&self) -> PlutusData {
PlutusData::Array(self.iter().map(|p| p.to_plutus_data()).collect())
Data::list(self.iter().map(|p| p.to_plutus_data()).collect())
}
}
@ -414,7 +419,7 @@ impl ToPlutusData for ScriptRef {
impl<'a> ToPlutusData for WithOptionDatum<'a, WithZeroAdaAsset<'a, Vec<TransactionOutput>>> {
fn to_plutus_data(&self) -> PlutusData {
PlutusData::Array(
Data::list(
self.0
.0
.iter()
@ -426,7 +431,7 @@ impl<'a> ToPlutusData for WithOptionDatum<'a, WithZeroAdaAsset<'a, Vec<Transacti
impl<'a> ToPlutusData for WithZeroAdaAsset<'a, Vec<TransactionOutput>> {
fn to_plutus_data(&self) -> PlutusData {
PlutusData::Array(
Data::list(
self.0
.iter()
.map(|p| WithZeroAdaAsset(p).to_plutus_data())
@ -516,7 +521,7 @@ impl ToPlutusData for StakeCredential {
StakeCredential::AddrKeyhash(addr_keyhas) => {
wrap_with_constr(0, addr_keyhas.to_plutus_data())
}
StakeCredential::Scripthash(script_hash) => {
StakeCredential::ScriptHash(script_hash) => {
wrap_with_constr(1, script_hash.to_plutus_data())
}
}
@ -741,7 +746,7 @@ impl ToPlutusData for DRep {
wrap_with_constr(0, StakeCredential::AddrKeyhash(*hash).to_plutus_data())
}
DRep::Script(hash) => {
wrap_with_constr(0, StakeCredential::Scripthash(*hash).to_plutus_data())
wrap_with_constr(0, StakeCredential::ScriptHash(*hash).to_plutus_data())
}
DRep::Abstain => empty_constr(1),
DRep::NoConfidence => empty_constr(2),
@ -798,7 +803,7 @@ impl<'a> ToPlutusData
for WithOptionDatum<'a, WithZeroAdaAsset<'a, WithWrappedTransactionId<'a, Vec<TxInInfo>>>>
{
fn to_plutus_data(&self) -> PlutusData {
PlutusData::Array(
Data::list(
self.0
.0
.0
@ -814,7 +819,7 @@ impl<'a> ToPlutusData
impl<'a> ToPlutusData for WithZeroAdaAsset<'a, WithWrappedTransactionId<'a, Vec<TxInInfo>>> {
fn to_plutus_data(&self) -> PlutusData {
PlutusData::Array(
Data::list(
self.0
.0
.iter()
@ -1254,13 +1259,13 @@ impl ToPlutusData for Voter {
fn to_plutus_data(&self) -> PlutusData {
match self {
Voter::ConstitutionalCommitteeScript(hash) => {
wrap_with_constr(0, StakeCredential::Scripthash(*hash).to_plutus_data())
wrap_with_constr(0, StakeCredential::ScriptHash(*hash).to_plutus_data())
}
Voter::ConstitutionalCommitteeKey(hash) => {
wrap_with_constr(0, StakeCredential::AddrKeyhash(*hash).to_plutus_data())
}
Voter::DRepScript(hash) => {
wrap_with_constr(1, StakeCredential::Scripthash(*hash).to_plutus_data())
wrap_with_constr(1, StakeCredential::ScriptHash(*hash).to_plutus_data())
}
Voter::DRepKey(hash) => {
wrap_with_constr(1, StakeCredential::AddrKeyhash(*hash).to_plutus_data())

View File

@ -1,4 +1,5 @@
use num_bigint::ToBigInt;
use pallas_codec::utils::MaybeIndefArray;
use uplc::{
ast::{Constant, Name, Term, Type},
parser::term,
@ -111,9 +112,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: MaybeIndefArray::Indef(vec![PlutusData::BigInt(
pallas_primitives::alonzo::BigInt::Int(2.into()),
)]),
}))
.into(),
),
@ -145,10 +146,10 @@ fn constant_data_map() {
fn constant_data_list() {
round_trip(
Term::<Name>::Constant(
Constant::Data(PlutusData::Array(vec![
Constant::Data(PlutusData::Array(MaybeIndefArray::Indef(vec![
PlutusData::BigInt(pallas_primitives::alonzo::BigInt::Int(0.into())),
PlutusData::BigInt(pallas_primitives::alonzo::BigInt::Int(1.into())),
]))
])))
.into(),
),
"(con data (List [I 0, I 1]))",

View File

@ -0,0 +1,2 @@
name = "aiken-lang/acceptance_test_006"
version = "0.0.0"

View File

@ -0,0 +1,20 @@
test baz() {
let assets =
[
("PolicyId1", [("AssetName", 20)]),
("PolicyId2", [("AssetName1", 300), ("AssetName2", 4_000)]),
("PolicyId3", []),
]
let is_empty_or_contains_policyid2 =
when assets is {
[] -> True
[_head, (p, [_, (a, q), ..] as tokens), ..] -> and {
tokens == [("AssetName1", 300), ("AssetName2", 4000)],
p == "PolicyId2",
a == "AssetName2",
q >= 4_000,
}
_ -> False
}
is_empty_or_contains_policyid2
}

24
flake.lock generated vendored
View File

@ -5,11 +5,11 @@
"systems": "systems"
},
"locked": {
"lastModified": 1689068808,
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
@ -20,11 +20,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1725103162,
"narHash": "sha256-Ym04C5+qovuQDYL/rKWSR+WESseQBbNAe5DsXNx5trY=",
"lastModified": 1731676054,
"narHash": "sha256-OZiZ3m8SCMfh3B6bfGC/Bm4x3qc1m2SVEAlkV6iY7Yg=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "12228ff1752d7b7624a54e9c1af4b222b3c1073b",
"rev": "5e4fbfb6b3de1aa2872b76d49fafc942626e2add",
"type": "github"
},
"original": {
@ -36,11 +36,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1718428119,
"narHash": "sha256-WdWDpNaq6u1IPtxtYHHWpl5BmabtpmLnMAx0RdJ/vo8=",
"lastModified": 1728538411,
"narHash": "sha256-f0SBJz1eZ2yOuKUr5CA9BHULGXVSn6miBuUWdTyhUhU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e6cea36f83499eb4e9cd184c8a8e823296b50ad5",
"rev": "b69de56fac8c2b6f8fd27f2eca01dcda8e0a4221",
"type": "github"
},
"original": {
@ -62,11 +62,11 @@
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1725330199,
"narHash": "sha256-oUkdPJIxP3r3YyVOBLkDVLIJiQV9YlrVqA+jNcdpCvM=",
"lastModified": 1732069891,
"narHash": "sha256-moKx8AVJrViCSdA0e0nSsG8b1dAsObI4sRAtbqbvBY8=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "a562172c72d00350f9f2ff830e6515b6e7bee6d5",
"rev": "8509a51241c407d583b1963d5079585a992506e8",
"type": "github"
},
"original": {