diff --git a/crates/aiken-lang/src/builder.rs b/crates/aiken-lang/src/builder.rs index 04f32ff7..a5322170 100644 --- a/crates/aiken-lang/src/builder.rs +++ b/crates/aiken-lang/src/builder.rs @@ -4,10 +4,7 @@ use indexmap::{IndexMap, IndexSet}; use itertools::Itertools; use uplc::{ ast::{ - builder::{ - apply_wrap, constr_index_exposer, delayed_choose_list, delayed_if_else, if_else, - CONSTR_FIELDS_EXPOSER, - }, + builder::{CONSTR_FIELDS_EXPOSER, CONSTR_INDEX_EXPOSER}, Constant as UplcConstant, Name, Term, Type as UplcType, }, builtins::DefaultFunction, @@ -191,79 +188,39 @@ impl ClauseProperties { pub fn convert_type_to_data(term: Term, field_type: &Arc) -> Term { if field_type.is_bytearray() { - apply_wrap(DefaultFunction::BData.into(), term) + Term::b_data().apply(term) } else if field_type.is_int() { - apply_wrap(DefaultFunction::IData.into(), term) + Term::i_data().apply(term) } else if field_type.is_void() { - apply_wrap( - apply_wrap(Term::Builtin(DefaultFunction::ChooseUnit).force(), term), - Term::Constant( - UplcConstant::Data(PlutusData::Constr(Constr { - tag: convert_constr_to_tag(0).unwrap(), - any_constructor: None, - fields: vec![], - })) - .into(), - ), - ) + term.choose_unit(Term::Constant( + UplcConstant::Data(PlutusData::Constr(Constr { + tag: convert_constr_to_tag(0).unwrap(), + any_constructor: None, + fields: vec![], + })) + .into(), + )) } else if field_type.is_map() { - apply_wrap(DefaultFunction::MapData.into(), term) + Term::map_data().apply(term) } else if field_type.is_string() { - apply_wrap( - DefaultFunction::BData.into(), - apply_wrap(DefaultFunction::EncodeUtf8.into(), term), - ) + Term::b_data().apply(Term::Builtin(DefaultFunction::EncodeUtf8).apply(term)) } else if field_type.is_tuple() && matches!(field_type.get_uplc_type(), UplcType::Pair(_, _)) { - apply_wrap( - Term::Lambda { - parameter_name: Name { - text: "__pair".to_string(), - unique: 0.into(), - } - .into(), - body: apply_wrap( - DefaultFunction::ListData.into(), - apply_wrap( - apply_wrap( - Term::Builtin(DefaultFunction::MkCons).force(), - apply_wrap( - Term::Builtin(DefaultFunction::FstPair).force().force(), - Term::Var( - Name { - text: "__pair".to_string(), - unique: 0.into(), - } - .into(), - ), - ), - ), - apply_wrap( - apply_wrap( - Term::Builtin(DefaultFunction::MkCons).force(), - apply_wrap( - Term::Builtin(DefaultFunction::SndPair).force().force(), - Term::Var( - Name { - text: "__pair".to_string(), - unique: 0.into(), - } - .into(), - ), - ), - ), - Term::Constant(UplcConstant::ProtoList(UplcType::Data, vec![]).into()), - ), + Term::list_data() + .apply( + Term::mk_cons() + .apply(Term::fst_pair().apply(Term::var("__pair".to_string()))) + .apply( + Term::mk_cons() + .apply(Term::snd_pair().apply(Term::var("__pair".to_string()))) + .apply(Term::empty_list()), ), - ) - .into(), - }, - term, - ) + ) + .lambda("__pair".to_string()) + .apply(term) } else if field_type.is_list() || field_type.is_tuple() { - apply_wrap(DefaultFunction::ListData.into(), term) + Term::list_data().apply(term) } else if field_type.is_bool() { - if_else( - term, + term.if_else( Term::Constant( UplcConstant::Data(PlutusData::Constr(Constr { tag: convert_constr_to_tag(1).unwrap(), @@ -288,101 +245,32 @@ pub fn convert_type_to_data(term: Term, field_type: &Arc) -> Term, field_type: &Arc) -> Term { if field_type.is_int() { - apply_wrap(DefaultFunction::UnIData.into(), term) + Term::un_i_data().apply(term) } else if field_type.is_bytearray() { - apply_wrap(DefaultFunction::UnBData.into(), term) + Term::un_b_data().apply(term) } else if field_type.is_void() { - delayed_if_else( - apply_wrap( - apply_wrap( - DefaultFunction::EqualsInteger.into(), - Term::Constant(UplcConstant::Integer(0.into()).into()), - ), - apply_wrap( - Term::Builtin(DefaultFunction::FstPair).force().force(), - apply_wrap(DefaultFunction::UnConstrData.into(), term), - ), - ), - Term::Constant(UplcConstant::Unit.into()), - Term::Error, - ) + Term::equals_integer() + .apply(Term::integer(0.into())) + .apply(Term::fst_pair().apply(Term::unconstr_data().apply(term))) + .delayed_if_else(Term::unit(), Term::Error) } else if field_type.is_map() { - apply_wrap(DefaultFunction::UnMapData.into(), term) + Term::unmap_data().apply(term) } else if field_type.is_string() { - apply_wrap( - DefaultFunction::DecodeUtf8.into(), - apply_wrap(DefaultFunction::UnBData.into(), term), - ) + Term::Builtin(DefaultFunction::DecodeUtf8).apply(Term::un_b_data().apply(term)) } else if field_type.is_tuple() && matches!(field_type.get_uplc_type(), UplcType::Pair(_, _)) { - apply_wrap( - Term::Lambda { - parameter_name: Name { - text: "__list_data".to_string(), - unique: 0.into(), - } - .into(), - body: apply_wrap( - Term::Lambda { - parameter_name: Name { - text: "__tail".to_string(), - unique: 0.into(), - } - .into(), - body: apply_wrap( - apply_wrap( - Term::Builtin(DefaultFunction::MkPairData), - apply_wrap( - Term::Builtin(DefaultFunction::HeadList).force(), - Term::Var( - Name { - text: "__list_data".to_string(), - unique: 0.into(), - } - .into(), - ), - ), - ), - apply_wrap( - Term::Builtin(DefaultFunction::HeadList).force(), - Term::Var( - Name { - text: "__tail".to_string(), - unique: 0.into(), - } - .into(), - ), - ), - ) - .into(), - }, - apply_wrap( - Term::Builtin(DefaultFunction::TailList).force(), - Term::Var( - Name { - text: "__list_data".to_string(), - unique: 0.into(), - } - .into(), - ), - ), - ) - .into(), - }, - apply_wrap(Term::Builtin(DefaultFunction::UnListData), term), - ) + Term::mk_pair_data() + .apply(Term::head_list().apply(Term::var("__list_data"))) + .apply(Term::head_list().apply(Term::var("__tail".to_string()))) + .lambda("__tail".to_string()) + .apply(Term::tail_list().apply(Term::var("__list_data"))) + .lambda("__list_data") + .apply(Term::unlist_data().apply(term)) } else if field_type.is_list() || field_type.is_tuple() { - apply_wrap(DefaultFunction::UnListData.into(), term) + Term::unlist_data().apply(term) } else if field_type.is_bool() { - apply_wrap( - apply_wrap( - DefaultFunction::EqualsInteger.into(), - Term::Constant(UplcConstant::Integer(1.into()).into()), - ), - apply_wrap( - Term::Builtin(DefaultFunction::FstPair).force().force(), - apply_wrap(DefaultFunction::UnConstrData.into(), term), - ), - ) + Term::equals_integer() + .apply(Term::integer(1.into())) + .apply(Term::fst_pair().apply(Term::unconstr_data().apply(term))) } else { term } @@ -564,246 +452,97 @@ pub fn list_access_to_uplc( if let Some((first, names)) = names.split_first() { let (current_tipo, tipos) = tipos.split_first().unwrap(); - let head_list = if matches!(current_tipo.get_uplc_type(), UplcType::Pair(_, _)) - && is_list_accessor - { - apply_wrap( - Term::Builtin(DefaultFunction::HeadList).force(), - Term::Var( - Name { - text: format!("tail_index_{}_{}", current_index, id_list[current_index]), - unique: 0.into(), - } - .into(), - ), - ) - } else { - convert_data_to_type( - apply_wrap( - Term::Builtin(DefaultFunction::HeadList).force(), - Term::Var( - Name { - text: format!( - "tail_index_{}_{}", - current_index, id_list[current_index] - ), - unique: 0.into(), - } - .into(), - ), - ), - ¤t_tipo.to_owned(), - ) - }; + let head_list = + if matches!(current_tipo.get_uplc_type(), UplcType::Pair(_, _)) && is_list_accessor { + Term::head_list().apply(Term::var(format!( + "tail_index_{}_{}", + current_index, id_list[current_index] + ))) + } else { + convert_data_to_type( + Term::head_list().apply(Term::var(format!( + "tail_index_{}_{}", + current_index, id_list[current_index] + ))), + ¤t_tipo.to_owned(), + ) + }; if names.len() == 1 && tail { if first == "_" && names[0] == "_" { - Term::Lambda { - parameter_name: Name { - text: "_".to_string(), - unique: 0.into(), - } - .into(), - body: term.into(), - } + term.lambda("_".to_string()) } else if first == "_" { - Term::Lambda { - parameter_name: Name { - text: format!("tail_index_{}_{}", current_index, id_list[current_index]), - unique: 0.into(), - } - .into(), - body: apply_wrap( - Term::Lambda { - parameter_name: Name { - text: names[0].clone(), - unique: 0.into(), - } - .into(), - body: term.into(), - }, - apply_wrap( - Term::Builtin(DefaultFunction::TailList).force(), - Term::Var( - Name { - text: format!( - "tail_index_{}_{}", - current_index, id_list[current_index] - ), - unique: 0.into(), - } - .into(), - ), - ), - ) - .into(), - } + term.lambda(names[0].clone()) + .apply(Term::tail_list().apply(Term::var(format!( + "tail_index_{}_{}", + current_index, id_list[current_index] + )))) + .lambda(format!( + "tail_index_{}_{}", + current_index, id_list[current_index] + )) } else if names[0] == "_" { - Term::Lambda { - parameter_name: Name { - text: format!("tail_index_{}_{}", current_index, id_list[current_index]), - unique: 0.into(), - } - .into(), - body: apply_wrap( - Term::Lambda { - parameter_name: Name { - text: first.clone(), - unique: 0.into(), - } - .into(), - body: term.into(), - }, - head_list, - ) - .into(), - } + term.lambda(first.clone()).apply(head_list).lambda(format!( + "tail_index_{}_{}", + current_index, id_list[current_index] + )) } else { - Term::Lambda { - parameter_name: Name { - text: format!("tail_index_{}_{}", current_index, id_list[current_index]), - unique: 0.into(), - } - .into(), - body: apply_wrap( - Term::Lambda { - parameter_name: Name { - text: first.clone(), - unique: 0.into(), - } - .into(), - body: apply_wrap( - Term::Lambda { - parameter_name: Name { - text: names[0].clone(), - unique: 0.into(), - } - .into(), - body: term.into(), - }, - apply_wrap( - Term::Builtin(DefaultFunction::TailList).force(), - Term::Var( - Name { - text: format!( - "tail_index_{}_{}", - current_index, id_list[current_index] - ), - unique: 0.into(), - } - .into(), - ), - ), - ) - .into(), - }, - head_list, - ) - .into(), - } + term.lambda(names[0].clone()) + .apply(Term::tail_list().apply(Term::var(format!( + "tail_index_{}_{}", + current_index, id_list[current_index] + )))) + .lambda(first.clone()) + .apply(head_list) + .lambda(format!( + "tail_index_{}_{}", + current_index, id_list[current_index] + )) } } else if names.is_empty() { if first == "_" { - Term::Lambda { - parameter_name: Name { - text: if check_last_item { - format!("tail_index_{}_{}", current_index, id_list[current_index]) - } else { - "_".to_string() - }, - unique: 0.into(), - } - .into(), - body: if check_last_item { - delayed_choose_list( - apply_wrap( - Term::Builtin(DefaultFunction::TailList).force(), - Term::Var( - Name { - text: format!( - "tail_index_{}_{}", - current_index, id_list[current_index] - ), - unique: 0.into(), - } - .into(), - ), - ), + if check_last_item { + Term::tail_list() + .apply(Term::var(format!( + "tail_index_{}_{}", + current_index, id_list[current_index] + ))) + .delayed_choose_list( term, - apply_wrap( - apply_wrap( - Term::Builtin(DefaultFunction::Trace).force(), - Term::Constant( - UplcConstant::String( - "List/Tuple/Constr contains more items than expected" - .to_string(), - ) - .into(), - ), - ), - Term::Delay(Term::Error.into()), - ) - .force(), + Term::Error.trace( + "List/Tuple/Constr contains more items than expected".to_string(), + ), ) - .into() - } else { - term.into() - }, + } else { + term } + .lambda(if check_last_item { + format!("tail_index_{}_{}", current_index, id_list[current_index]) + } else { + "_".to_string() + }) } else { - Term::Lambda { - parameter_name: Name { - text: format!("tail_index_{}_{}", current_index, id_list[current_index]), - unique: 0.into(), + if check_last_item { + Term::tail_list() + .apply(Term::var(format!( + "tail_index_{}_{}", + current_index, id_list[current_index] + ))) + .delayed_choose_list( + term, + Term::Error.trace( + "List/Tuple/Constr contains more items than expected".to_string(), + ), + ) + } else { + term } - .into(), - body: apply_wrap( - Term::Lambda { - parameter_name: Name { - text: first.clone(), - unique: 0.into(), - } - .into(), - body: if check_last_item { - delayed_choose_list( - apply_wrap( - Term::Builtin(DefaultFunction::TailList).force(), - Term::Var( - Name { - text: format!( - "tail_index_{}_{}", - current_index, id_list[current_index] - ), - unique: 0.into(), - } - .into(), - ), - ), - term, - apply_wrap( - apply_wrap( - Term::Builtin(DefaultFunction::Trace).force(), - Term::Constant( - UplcConstant::String( - "List/Tuple/Constr contains more items than it expected" - .to_string(), - ) - .into(), - ), - ), - Term::Delay(Term::Error.into()), - ) - .force(), - ) - .into() - } else { - term.into() - }, - }, - head_list, - ) - .into(), - } + .lambda(first.clone()) + .apply(head_list) + .lambda(format!( + "tail_index_{}_{}", + current_index, id_list[current_index] + )) } } else if first == "_" { let mut list_access_inner = list_access_to_uplc( @@ -825,33 +564,15 @@ pub fn list_access_to_uplc( if ¶meter_name.text == "_" { body.as_ref().clone() } else { - Term::Lambda { - parameter_name: Name { - text: format!( - "tail_index_{}_{}", - current_index, id_list[current_index] - ), - unique: 0.into(), - } - .into(), - body: apply_wrap( - list_access_inner, - apply_wrap( - Term::Builtin(DefaultFunction::TailList).force(), - Term::Var( - Name { - text: format!( - "tail_index_{}_{}", - current_index, id_list[current_index] - ), - unique: 0.into(), - } - .into(), - ), - ), - ) - .into(), - } + list_access_inner + .apply(Term::tail_list().apply(Term::var(format!( + "tail_index_{}_{}", + current_index, id_list[current_index] + )))) + .lambda(format!( + "tail_index_{}_{}", + current_index, id_list[current_index] + )) } } _ => list_access_inner, @@ -859,14 +580,7 @@ pub fn list_access_to_uplc( match &list_access_inner { Term::Lambda { .. } => list_access_inner, - _ => Term::Lambda { - parameter_name: Name { - text: "_".to_string(), - unique: 0.into(), - } - .into(), - body: list_access_inner.into(), - }, + _ => list_access_inner.lambda("_".to_string()), } } else { let mut list_access_inner = list_access_to_uplc( @@ -886,88 +600,35 @@ pub fn list_access_to_uplc( body, } => { if ¶meter_name.text == "_" { - Term::Lambda { - parameter_name: Name { - text: format!( - "tail_index_{}_{}", - current_index, id_list[current_index] - ), - unique: 0.into(), - } - .into(), - body: apply_wrap( - Term::Lambda { - parameter_name: Name { - text: first.clone(), - unique: 0.into(), - } - .into(), - body: body.as_ref().clone().into(), - }, - head_list, - ) - .into(), - } + body.as_ref() + .clone() + .lambda(first.clone()) + .apply(head_list) + .lambda(format!( + "tail_index_{}_{}", + current_index, id_list[current_index] + )) } else { - Term::Lambda { - parameter_name: Name { - text: format!( - "tail_index_{}_{}", - current_index, id_list[current_index] - ), - unique: 0.into(), - } - .into(), - body: apply_wrap( - Term::Lambda { - parameter_name: Name { - text: first.clone(), - unique: 0.into(), - } - .into(), - body: apply_wrap( - list_access_inner, - apply_wrap( - Term::Builtin(DefaultFunction::TailList).force(), - Term::Var( - Name { - text: format!( - "tail_index_{}_{}", - current_index, id_list[current_index] - ), - unique: 0.into(), - } - .into(), - ), - ), - ) - .into(), - }, - head_list, - ) - .into(), - } + list_access_inner + .apply(Term::tail_list().apply(Term::var(format!( + "tail_index_{}_{}", + current_index, id_list[current_index] + )))) + .lambda(first.clone()) + .apply(head_list) + .lambda(format!( + "tail_index_{}_{}", + current_index, id_list[current_index] + )) } } - _ => Term::Lambda { - parameter_name: Name { - text: format!("tail_index_{}_{}", current_index, id_list[current_index]), - unique: 0.into(), - } - .into(), - body: apply_wrap( - Term::Lambda { - parameter_name: Name { - text: first.clone(), - unique: 0.into(), - } - .into(), - body: list_access_inner.into(), - }, - head_list, - ) - .into(), - }, + _ => list_access_inner + .lambda(first.clone()) + .apply(head_list) + .lambda(format!( + "tail_index_{}_{}", + current_index, id_list[current_index] + )), }; list_access_inner } @@ -1316,36 +977,15 @@ pub fn wrap_validator_args(term: Term, arguments: &[TypedArg]) -> Term, arguments: &[TypedArg]) -> Term, mint: Term) -> Term { Term::equals_integer() .apply(Term::integer(0.into())) - .apply(constr_index_exposer(Term::var("__second_arg"))) + .apply(Term::var(CONSTR_INDEX_EXPOSER).apply(Term::var("__second_arg"))) .delayed_if_else( mint.apply(Term::var("__first_arg")) .apply(Term::var("__second_arg")), diff --git a/crates/aiken-lang/src/uplc.rs b/crates/aiken-lang/src/uplc.rs index 0924bc98..8dd76485 100644 --- a/crates/aiken-lang/src/uplc.rs +++ b/crates/aiken-lang/src/uplc.rs @@ -5,8 +5,8 @@ use itertools::Itertools; use uplc::{ ast::{ builder::{ - self, apply_wrap, assert_on_list, constr_index_exposer, final_wrapper, - repeat_tail_list, ASSERT_ON_LIST, CONSTR_FIELDS_EXPOSER, CONSTR_GET_FIELD, + self, assert_on_list, final_wrapper, repeat_tail_list, ASSERT_ON_LIST, + CONSTR_FIELDS_EXPOSER, CONSTR_GET_FIELD, CONSTR_INDEX_EXPOSER, }, Constant as UplcConstant, Name, NamedDeBruijn, Program, Term, Type as UplcType, }, @@ -97,12 +97,6 @@ impl<'a> CodeGenerator<'a> { let mut term = self.uplc_code_gen(&mut ir_stack); - if self.needs_field_access { - term = builder::constr_get_field(term); - - term = builder::constr_fields_exposer(term); - } - // Wrap the validator body if ifThenElse term unit error term = final_wrapper(term); @@ -134,9 +128,7 @@ impl<'a> CodeGenerator<'a> { }; term = wrap_as_multi_validator(spend, mint); - term = builder::constr_get_field(term); - - term = builder::constr_fields_exposer(term); + self.needs_field_access = true; } term = wrap_validator_args(term, params); @@ -154,24 +146,26 @@ impl<'a> CodeGenerator<'a> { self.convert_opaque_type_to_inner_ir(&mut ir_stack); - let mut term = self.uplc_code_gen(&mut ir_stack); - - if self.needs_field_access { - term = builder::constr_get_field(term); - - term = builder::constr_fields_exposer(term); - } + let term = self.uplc_code_gen(&mut ir_stack); self.finalize(term, false) } fn finalize(&mut self, term: Term, wrap_as_validator: bool) -> Program { - let term = if wrap_as_validator || self.used_data_assert_on_list { + let mut term = if wrap_as_validator || self.used_data_assert_on_list { assert_on_list(term) } else { term }; + if self.needs_field_access { + term = builder::constr_get_field(term); + + term = builder::constr_fields_exposer(term); + + term = builder::constr_index_exposer(term); + } + let mut program = Program { version: (1, 0, 0), term, @@ -708,8 +702,6 @@ impl<'a> CodeGenerator<'a> { tipo, .. } => { - self.needs_field_access = true; - ir_stack.push(Air::RecordAccess { scope: scope.clone(), record_index: *index, @@ -4508,41 +4500,31 @@ impl<'a> CodeGenerator<'a> { .apply(right) .if_else(Term::bool(false), Term::bool(true)) } - BinOp::LtInt => apply_wrap( - apply_wrap(DefaultFunction::LessThanInteger.into(), left), - right, - ), - - BinOp::LtEqInt => apply_wrap( - apply_wrap(DefaultFunction::LessThanEqualsInteger.into(), left), - right, - ), - BinOp::GtEqInt => apply_wrap( - apply_wrap(DefaultFunction::LessThanEqualsInteger.into(), right), - left, - ), - BinOp::GtInt => apply_wrap( - apply_wrap(DefaultFunction::LessThanInteger.into(), right), - left, - ), - BinOp::AddInt => { - apply_wrap(apply_wrap(DefaultFunction::AddInteger.into(), left), right) - } - BinOp::SubInt => apply_wrap( - apply_wrap(DefaultFunction::SubtractInteger.into(), left), - right, - ), - BinOp::MultInt => apply_wrap( - apply_wrap(DefaultFunction::MultiplyInteger.into(), left), - right, - ), - BinOp::DivInt => apply_wrap( - apply_wrap(DefaultFunction::DivideInteger.into(), left), - right, - ), - BinOp::ModInt => { - apply_wrap(apply_wrap(DefaultFunction::ModInteger.into(), left), right) - } + BinOp::LtInt => Term::Builtin(DefaultFunction::LessThanInteger) + .apply(left) + .apply(right), + BinOp::LtEqInt => Term::Builtin(DefaultFunction::LessThanEqualsInteger) + .apply(left) + .apply(right), + BinOp::GtEqInt => Term::Builtin(DefaultFunction::LessThanEqualsInteger) + .apply(right) + .apply(left), + BinOp::GtInt => Term::Builtin(DefaultFunction::LessThanInteger) + .apply(right) + .apply(left), + BinOp::AddInt => Term::add_integer().apply(left).apply(right), + BinOp::SubInt => Term::Builtin(DefaultFunction::SubtractInteger) + .apply(left) + .apply(right), + BinOp::MultInt => Term::Builtin(DefaultFunction::MultiplyInteger) + .apply(left) + .apply(right), + BinOp::DivInt => Term::Builtin(DefaultFunction::DivideInteger) + .apply(left) + .apply(right), + BinOp::ModInt => Term::Builtin(DefaultFunction::ModInteger) + .apply(left) + .apply(right), }; arg_stack.push(term); } @@ -4607,6 +4589,7 @@ impl<'a> CodeGenerator<'a> { arg_stack.push(term); } Air::AssertConstr { constr_index, .. } => { + self.needs_field_access = true; let constr = arg_stack.pop().unwrap(); let mut term = arg_stack.pop().unwrap(); @@ -4616,7 +4599,7 @@ impl<'a> CodeGenerator<'a> { term = Term::equals_integer() .apply(Term::integer(constr_index.into())) - .apply(constr_index_exposer(constr)) + .apply(Term::var(CONSTR_INDEX_EXPOSER.to_string()).apply(constr)) .delayed_if_else(term, error_term); arg_stack.push(term); @@ -4638,6 +4621,7 @@ impl<'a> CodeGenerator<'a> { Air::When { subject_name, tipo, .. } => { + self.needs_field_access = true; let subject = arg_stack.pop().unwrap(); let subject = if tipo.is_int() @@ -4649,7 +4633,7 @@ impl<'a> CodeGenerator<'a> { { subject } else { - constr_index_exposer(subject) + Term::var(CONSTR_INDEX_EXPOSER).apply(subject) }; let mut term = arg_stack.pop().unwrap(); @@ -4813,7 +4797,7 @@ impl<'a> CodeGenerator<'a> { } else { Term::equals_integer() .apply(checker) - .apply(constr_index_exposer(Term::var(subject_name))) + .apply(Term::var(CONSTR_INDEX_EXPOSER).apply(Term::var(subject_name))) }; let term = condition @@ -5031,6 +5015,7 @@ impl<'a> CodeGenerator<'a> { indices, .. } => { + self.needs_field_access = true; let tail_name_prefix = "__tail_index".to_string(); let record = arg_stack.pop().unwrap(); @@ -5105,7 +5090,6 @@ impl<'a> CodeGenerator<'a> { term = term.lambda(tail_name).apply(tail_list); } - self.needs_field_access = true; term = term .lambda(prev_tail_name) .apply(Term::var(CONSTR_FIELDS_EXPOSER.to_string()).apply(record)); diff --git a/crates/uplc/src/ast/builder.rs b/crates/uplc/src/ast/builder.rs index 27f858e2..be2b7ad1 100644 --- a/crates/uplc/src/ast/builder.rs +++ b/crates/uplc/src/ast/builder.rs @@ -50,6 +50,10 @@ impl Term { Term::Constant(Constant::Bool(b).into()) } + pub fn unit() -> Self { + Term::Constant(Constant::Unit.into()) + } + pub fn empty_list() -> Self { Term::Constant(Constant::ProtoList(Type::Data, vec![]).into()) } @@ -80,6 +84,26 @@ impl Term { Term::Builtin(DefaultFunction::IData) } + pub fn unconstr_data() -> Self { + Term::Builtin(DefaultFunction::UnConstrData) + } + + pub fn un_i_data() -> Self { + Term::Builtin(DefaultFunction::UnIData) + } + + pub fn un_b_data() -> Self { + Term::Builtin(DefaultFunction::UnBData) + } + + pub fn unmap_data() -> Self { + Term::Builtin(DefaultFunction::UnMapData) + } + + pub fn unlist_data() -> Self { + Term::Builtin(DefaultFunction::UnListData) + } + pub fn equals_integer() -> Self { Term::Builtin(DefaultFunction::EqualsInteger) } @@ -145,6 +169,21 @@ impl Term { .apply(else_term) } + pub fn choose_unit(self, then_term: Self) -> Self { + Term::Builtin(DefaultFunction::ChooseUnit) + .force() + .apply(self) + .apply(then_term) + } + + pub fn delayed_choose_unit(self, then_term: Self) -> Self { + Term::Builtin(DefaultFunction::ChooseUnit) + .force() + .apply(self) + .apply(then_term.delay()) + .force() + } + pub fn delayed_if_else(self, then_term: Self, else_term: Self) -> Self { Term::Builtin(DefaultFunction::IfThenElse) .force() @@ -173,540 +212,93 @@ impl Term { } } -pub fn apply_wrap(function: Term, arg: Term) -> Term { - Term::Apply { - function: function.into(), - argument: arg.into(), - } -} - pub fn final_wrapper(term: Term) -> Term { - Term::Force( - Term::Apply { - function: Term::Apply { - function: Term::Apply { - function: Term::Force(Term::Builtin(DefaultFunction::IfThenElse).into()).into(), - argument: term.into(), - } - .into(), - argument: Term::Delay(Term::Constant(Constant::Unit.into()).into()).into(), - } - .into(), - argument: Term::Delay(Term::Error.into()).into(), - } - .into(), - ) + term.delayed_if_else(Term::unit(), Term::Error) } pub fn assert_on_list(term: Term) -> Term { - apply_wrap( - Term::Lambda { - parameter_name: Name { - text: ASSERT_ON_LIST.to_string(), - unique: 0.into(), - } - .into(), - body: apply_wrap( - Term::Lambda { - parameter_name: Name { - text: ASSERT_ON_LIST.to_string(), - unique: 0.into(), - } - .into(), - body: term.into(), - }, - apply_wrap( - Term::Var( - Name { - text: ASSERT_ON_LIST.to_string(), - unique: 0.into(), - } - .into(), - ), - Term::Var( - Name { - text: ASSERT_ON_LIST.to_string(), - unique: 0.into(), - } - .into(), - ), - ), - ) - .into(), - }, - Term::Lambda { - parameter_name: Name { - text: ASSERT_ON_LIST.to_string(), - unique: 0.into(), - } - .into(), - body: Term::Lambda { - parameter_name: Name { - text: "list_to_check".to_string(), - unique: 0.into(), - } - .into(), - body: Term::Lambda { - parameter_name: Name { - text: "check_with".to_string(), - unique: 0.into(), - } - .into(), - body: delayed_choose_list( - Term::Var( - Name { - text: "list_to_check".to_string(), - unique: 0.into(), - } - .into(), + term.lambda(ASSERT_ON_LIST.to_string()) + .apply(Term::var(ASSERT_ON_LIST.to_string()).apply(Term::var(ASSERT_ON_LIST.to_string()))) + .lambda(ASSERT_ON_LIST.to_string()) + .apply( + Term::var("__list_to_check".to_string()) + .delayed_choose_list( + Term::unit(), + Term::var("__check_with".to_string()) + .apply(Term::head_list().apply(Term::var("__list_to_check".to_string()))) + .choose_unit( + Term::var(ASSERT_ON_LIST.to_string()) + .apply(Term::var(ASSERT_ON_LIST.to_string())) + .apply( + Term::tail_list() + .apply(Term::var("__list_to_check".to_string())), + ) + .apply(Term::var("__check_with".to_string())), ), - Term::Constant(Constant::Unit.into()), - apply_wrap( - apply_wrap( - Term::Builtin(DefaultFunction::ChooseUnit).force(), - apply_wrap( - Term::Var( - Name { - text: "check_with".to_string(), - unique: 0.into(), - } - .into(), - ), - apply_wrap( - Term::Builtin(DefaultFunction::HeadList).force(), - Term::Var( - Name { - text: "list_to_check".to_string(), - unique: 0.into(), - } - .into(), - ), - ), - ), - ), - apply_wrap( - apply_wrap( - apply_wrap( - Term::Var( - Name { - text: ASSERT_ON_LIST.to_string(), - unique: 0.into(), - } - .into(), - ), - Term::Var( - Name { - text: ASSERT_ON_LIST.to_string(), - unique: 0.into(), - } - .into(), - ), - ), - apply_wrap( - Term::Builtin(DefaultFunction::TailList).force(), - Term::Var( - Name { - text: "list_to_check".to_string(), - unique: 0.into(), - } - .into(), - ), - ), - ), - Term::Var( - Name { - text: "check_with".to_string(), - unique: 0.into(), - } - .into(), - ), - ), - ), - ) - .into(), - } - .into(), - } - .into(), - }, - ) + ) + .lambda("__check_with".to_string()) + .lambda("__list_to_check".to_string()) + .lambda(ASSERT_ON_LIST), + ) } pub fn constr_fields_exposer(term: Term) -> Term { - Term::Apply { - function: Term::Lambda { - parameter_name: Name { - text: CONSTR_FIELDS_EXPOSER.to_string(), - unique: 0.into(), - } - .into(), - body: term.into(), - } - .into(), - argument: Term::Lambda { - parameter_name: Name { - text: "__constr_var".to_string(), - unique: 0.into(), - } - .into(), - body: Term::Apply { - function: Term::Force( - Term::Force(Term::Builtin(DefaultFunction::SndPair).into()).into(), - ) - .into(), - argument: Term::Apply { - function: Term::Builtin(DefaultFunction::UnConstrData).into(), - argument: Term::Var( - Name { - text: "__constr_var".to_string(), - unique: 0.into(), - } - .into(), - ) - .into(), - } - .into(), - } - .into(), - } - .into(), - } + term.lambda(CONSTR_FIELDS_EXPOSER.to_string()).apply( + Term::snd_pair() + .apply(Term::unconstr_data().apply(Term::var("__constr_var".to_string()))) + .lambda("__constr_var"), + ) } pub fn constr_index_exposer(term: Term) -> Term { - Term::Apply { - function: Term::Force(Term::Force(Term::Builtin(DefaultFunction::FstPair).into()).into()) - .into(), - argument: Term::Apply { - function: Term::Builtin(DefaultFunction::UnConstrData).into(), - argument: term.into(), - } - .into(), - } + term.lambda(CONSTR_INDEX_EXPOSER.to_string()).apply( + Term::fst_pair() + .apply(Term::unconstr_data().apply(Term::var("__constr_var".to_string()))) + .lambda("__constr_var".to_string()), + ) } pub fn constr_get_field(term: Term) -> Term { - Term::Apply { - function: Term::Lambda { - parameter_name: Name { - text: CONSTR_GET_FIELD.to_string(), - unique: 0.into(), - } - .into(), - body: term.into(), - } - .into(), - argument: Term::Lambda { - parameter_name: Name { - text: "__constr_list".to_string(), - unique: 0.into(), - } - .into(), - body: Term::Lambda { - parameter_name: Name { - text: "__arg_number".to_string(), - unique: 0.into(), - } - .into(), - body: Term::Apply { - function: Term::Lambda { - parameter_name: Name { - text: "__recurse".to_string(), - unique: 0.into(), - } - .into(), - body: Term::Apply { - function: Term::Apply { - function: Term::Apply { - function: Term::Var( - Name { - text: "__recurse".to_string(), - unique: 0.into(), - } - .into(), - ) - .into(), - argument: Term::Var( - Name { - text: "__recurse".to_string(), - unique: 0.into(), - } - .into(), - ) - .into(), - } - .into(), - - // Start recursive with index 0 of list - argument: Term::Constant(Constant::Integer(0.into()).into()).into(), - } - .into(), - argument: Term::Var( - Name { - text: "__constr_list".to_string(), - unique: 0.into(), - } - .into(), - ) - .into(), - } - .into(), - } - .into(), - - argument: Term::Lambda { - parameter_name: Name { - text: "__self_recursor".to_string(), - unique: 0.into(), - } - .into(), - body: Term::Lambda { - parameter_name: Name { - text: "__current_arg_number".to_string(), - unique: 0.into(), - } - .into(), - body: Term::Lambda { - parameter_name: Name { - text: "__list_of_constr_args".to_string(), - unique: 0.into(), - } - .into(), - body: Term::Apply { - function: Term::Apply { - function: Term::Apply { - function: Term::Apply { - function: Term::Force( - Term::Builtin(DefaultFunction::IfThenElse) - .into(), - ) - .into(), - argument: Term::Apply { - function: Term::Apply { - function: Term::Builtin( - DefaultFunction::EqualsInteger, - ) - .into(), - argument: Term::Var( - Name { - text: "__arg_number".to_string(), - unique: 0.into(), - } - .into(), - ) - .into(), - } - .into(), - argument: Term::Var( - Name { - text: "__current_arg_number" - .to_string(), - unique: 0.into(), - } - .into(), - ) - .into(), - } - .into(), - } - .into(), - argument: Term::Force( - Term::Builtin(DefaultFunction::HeadList).into(), - ) - .into(), - } - .into(), - argument: Term::Lambda { - parameter_name: Name { - text: "__current_list_of_constr_args".to_string(), - unique: 0.into(), - } - .into(), - body: Term::Apply { - function: Term::Apply { - function: Term::Apply { - function: Term::Var( - Name { - text: "__self_recursor".to_string(), - unique: 0.into(), - } - .into(), - ) - .into(), - argument: Term::Var( - Name { - text: "__self_recursor".to_string(), - unique: 0.into(), - } - .into(), - ) - .into(), - } - .into(), - - argument: Term::Apply { - function: Term::Apply { - function: Term::Builtin( - DefaultFunction::AddInteger, - ) - .into(), - argument: Term::Var( - Name { - text: "__current_arg_number" - .to_string(), - unique: 0.into(), - } - .into(), - ) - .into(), - } - .into(), - argument: Term::Constant( - Constant::Integer(1.into()).into(), - ) - .into(), - } - .into(), - } - .into(), - - argument: Term::Apply { - function: Term::Force( - Term::Builtin(DefaultFunction::TailList) - .into(), - ) - .into(), - - argument: Term::Var( - Name { - text: "__current_list_of_constr_args" - .to_string(), - unique: 0.into(), - } - .into(), - ) - .into(), - } - .into(), - } - .into(), - } - .into(), - } - .into(), - argument: Term::Var( - Name { - text: "__list_of_constr_args".to_string(), - unique: 0.into(), - } - .into(), - ) - .into(), - } - .into(), - } - .into(), - } - .into(), - } - .into(), - } - .into(), - } - .into(), - } - .into(), - } -} - -pub fn delayed_if_else( - condition: Term, - then_term: Term, - else_term: Term, -) -> Term { - Term::Apply { - function: Term::Apply { - function: Term::Apply { - function: Term::Builtin(DefaultFunction::IfThenElse).force().into(), - argument: condition.into(), - } - .into(), - argument: Term::Delay(then_term.into()).into(), - } - .into(), - argument: Term::Delay(else_term.into()).into(), - } - .force() -} - -pub fn if_else(condition: Term, then_term: Term, else_term: Term) -> Term { - Term::Apply { - function: Term::Apply { - function: Term::Apply { - function: Term::Builtin(DefaultFunction::IfThenElse).force().into(), - argument: condition.into(), - } - .into(), - argument: then_term.into(), - } - .into(), - argument: else_term.into(), - } -} - -pub fn delayed_choose_list( - list: Term, - empty_list_term: Term, - else_term: Term, -) -> Term { - Term::Apply { - function: Term::Apply { - function: Term::Apply { - function: Term::Builtin(DefaultFunction::ChooseList) - .force() - .force() - .into(), - argument: list.into(), - } - .into(), - argument: Term::Delay(empty_list_term.into()).into(), - } - .into(), - argument: Term::Delay(else_term.into()).into(), - } - .force() -} - -pub fn choose_list( - list: Term, - empty_list_term: Term, - else_term: Term, -) -> Term { - Term::Apply { - function: Term::Apply { - function: Term::Apply { - function: Term::Builtin(DefaultFunction::ChooseList) - .force() - .force() - .into(), - argument: list.into(), - } - .into(), - argument: empty_list_term.into(), - } - .into(), - argument: else_term.into(), - } + term.lambda(CONSTR_GET_FIELD.to_string()) + .apply( + Term::var(CONSTR_GET_FIELD.to_string()) + .apply(Term::var(CONSTR_GET_FIELD.to_string())) + .apply(Term::integer(0.into())), + ) + .lambda(CONSTR_GET_FIELD) + .apply( + Term::equals_integer() + .apply(Term::var("__wanted_arg".to_string())) + .apply(Term::var("__current_arg_number".to_string())) + .if_else( + Term::head_list(), + Term::var(CONSTR_GET_FIELD) + .apply(Term::var(CONSTR_GET_FIELD)) + .apply( + Term::add_integer() + .apply(Term::var("__current_arg_number".to_string())) + .apply(Term::integer(1.into())), + ) + .apply( + Term::tail_list() + .apply(Term::var("__current_list_of_constr_args".to_string())), + ) + .apply(Term::var("__wanted_arg")) + .lambda("__current_list_of_constr_args".to_string()), + ) + .apply(Term::var("__list_of_constr_args".to_string())) + .lambda("__wanted_arg".to_string()) + .lambda("__list_of_constr_args") + .lambda("__current_arg_number".to_string()) + .lambda(CONSTR_GET_FIELD.to_string()), + ) } pub fn repeat_tail_list(term: Term, repeat: usize) -> Term { let mut term = term; for _ in 0..repeat { - term = Term::Apply { - function: Term::Builtin(DefaultFunction::TailList).force().into(), - argument: term.into(), - }; + term = Term::tail_list().apply(term); } term } diff --git a/crates/uplc/src/optimize/shrinker.rs b/crates/uplc/src/optimize/shrinker.rs index 38b18f85..8bcc6a8c 100644 --- a/crates/uplc/src/optimize/shrinker.rs +++ b/crates/uplc/src/optimize/shrinker.rs @@ -4,7 +4,7 @@ use indexmap::IndexMap; use itertools::Itertools; use crate::{ - ast::{builder::apply_wrap, Name, Program, Term}, + ast::{Name, Program, Term}, builtins::DefaultFunction, }; // use crate::builtins::{DefaultFunction}; @@ -33,21 +33,13 @@ impl Program { for default_func_index in builtin_map.keys().sorted().cloned() { let default_func: DefaultFunction = default_func_index.try_into().unwrap(); - term = apply_wrap( - Term::Lambda { - parameter_name: Name { - text: format!("__{}_wrapped", default_func.aiken_name()), - unique: 0.into(), - } - .into(), - body: term.into(), - }, - if default_func.force_count() == 1 { + term = term + .lambda(format!("__{}_wrapped", default_func.aiken_name())) + .apply(if default_func.force_count() == 1 { Term::Builtin(default_func).force() } else { Term::Builtin(default_func).force().force() - }, - ); + }); } Program { diff --git a/examples/acceptance_tests/036/plutus.json b/examples/acceptance_tests/036/plutus.json index 0779011c..356a8b79 100644 --- a/examples/acceptance_tests/036/plutus.json +++ b/examples/acceptance_tests/036/plutus.json @@ -21,8 +21,8 @@ } } ], - "compiledCode": "58e301000032323232323232323232222533300632323232533300a3370e9000000899251300400214a060166ea8004c8c8cc004dd6198019802198019802002a40009000119baf33004300500148000020c0040048894ccc03c0084cdd2a400497ae013232533300d300300213374a90001980900125eb804ccc01401400400cc04c00cc04400888c8ccc0040052000003222333300c3370e008004024466600800866e0000d200230140010012300a37540022930b180080091129998040010a4c26600a600260140046660060066016004002ae695cdaab9d5573caae7d5d02ba157441", - "hash": "bc602ee0cfd14a415cdd83dd746ae6260507ffec1827cf1bddc77893" + "compiledCode": "58e50100003232323232323232323232323222253330093232533300b3370e9000000899251300a00214a064601a6ea8004004c8c8cc004dd6198041805198041805001a40009000119baf33009300b00148000018c0040048894ccc0400084cdd2a400497ae013232533300e300300213374a90001980980125eb804ccc01401400400cc05000cc048008526163001001222533300b00214984cc020c004c034008ccc00c00cc038008004cc0040052000222233330063370e0020060184666600a00a66e000112002300e001002002230053754002ae695cdaab9d5573caae7d5d02ba157441", + "hash": "67da7558138818e07b4615b50e849829f0f5f9859a60cd817aff942e" }, { "title": "spend.spend", @@ -38,8 +38,8 @@ "$ref": "#/definitions/Data" } }, - "compiledCode": "59015f010000323232323232323232322225333006323232323233001003232323322323232323330140014a0944004c94ccc05c0045288a5000133223233223253330173370e90010008801099190009bab301e00130110033018375400400297adef6c6033223300800200100200100100237566601260140049001001a441050000000000003001001222533301300213374a900125eb804c8c8c8c94ccc04ccdc7802800899ba548000cc060dd300125eb804ccc01c01c00c014dd7180a0019bab3014002301700330150023001001222533301000214a026464a66601c600600429444ccc01401400400cc05000cc048008dd6198009801198009801001a400090021119199800800a4000006444666601866e1c0100080488ccc010010cdc0001a40046028002002460146ea8004526163001001222533300800214984cc014c004c028008ccc00c00cc02c0080055cd2b9b5573aaae7955cfaba05742ae89", - "hash": "6eeaf674bce0a9f818f396839364850e4b4bfb36efc13b61456ff630" + "compiledCode": "59016101000032323232323232323232323232222533300932323233001003232323322323232323330150014a0944004c94ccc0600045288a5000133223233223253330183370e90010008801099190009bab301f001301700332301a375400200400297adef6c6033223300800200100200100100237566601c60200049001001a45050000000000003001001222533301400213374a900125eb804c8c8c8c94ccc050cdc7802800899ba548000cc064dd300125eb804ccc01c01c00c014dd7180a8019bab3015002301800330160023001001222533301100214a026464a66601e600600429444ccc01401400400cc05400cc04c008dd6198031804198031804000a400090020a4c2c6002002444a66601600429309980418009806801199801801980700100099800800a40004444666600c66e1c00400c0308cccc014014cdc000224004601c0020040044600a6ea80055cd2b9b5573aaae7955cfaba05742ae881", + "hash": "f8437a12347bff5782bd8ca695a3cce1e2375bb5e7358e3dd5163527" } ], "definitions": { diff --git a/examples/acceptance_tests/071/plutus.json b/examples/acceptance_tests/071/plutus.json index 6a614b8b..ea17eb5f 100644 --- a/examples/acceptance_tests/071/plutus.json +++ b/examples/acceptance_tests/071/plutus.json @@ -19,8 +19,8 @@ "$ref": "#/definitions/spend~1PoolRedeemer" } }, - "compiledCode": "59030501000032323232323232323232322225333006323232323232323232533300f3370e900000089925130090021533300f3370e9001000899191919299980999b87480080044c8c8cccc8888c8c8c8c8c9289812000980b19299980e99b8748000c080dd500088008a9980fa492a4578706563746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e0016330120070033022001301432533301b3370e9000180f1baa0011001153301d49012a4578706563746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e00163300f005001300d48901ff00010001012005301b001300d00214a0602a6ea8004cc028c02c03120023017001300900213232323253330133370e9001000899191999911119191919192513024001301632533301d3370e900018101baa0011001153301f49012a4578706563746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e0016330120070033022001301432533301b3370e9000180f1baa0011001153301d49012a4578706563746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e00163300f005001300d48901ff00010001012005301b001300d00214a0602a6ea8004cc028c02c031200230170013009002301137540026600c600e0129000119ba548000cc04ccdd2a4004660266ea40052f5c06602666e9520024bd7025eb8088cc010dd6198031803998031803801240009002119baf3300730080014800000888cc00cdd6198029803198029803001240009000119baf3300630073300630070014800920000023001001222533301000213374a900125eb804c8c94ccc034c00c0084cdd2a40006602600497ae013330050050010033014003301200222323330010014800000c888cccc030cdc3802001009919980200219b8000348008c0540040048c02cdd50008a4c2c6002002444a666012004293099802980098058011998018019806001000ab9a5736ae7155ceaab9e5573eae815d0aba201", - "hash": "5ed31a0590509ea818c80fdb4a1cc25a72e7b24a5c28115739ec38d3" + "compiledCode": "5902fe010000323232323232323232323232323232222533300a3232323232323253330113370e9000000899251300f002153330113370e9001000899191919299980a99b87480080044c8c8cccc8888c8c8c8c8c9289813000980e19299980f99b8748000c078004400454cc08524012a4578706563746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e0016330120070033024001301a32533301d3370e9000180e00088008a9980fa4812a4578706563746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e00163300f005001300d48901ff0000e001010005301d001301300214a060260026601e60220149001180c8009807801099191919299980a99b87480080044c8c8cccc8888c8c8c8c8c9289813000980e19299980f99b8748000c078004400454cc0852412a4578706563746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e0016330120070033024001301a32533301d3370e9000180e00088008a9980fa4812a4578706563746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e00163300f005001300d48901ff0000e001010005301d001301300214a060260026601e60220149001180c80098078011807800998059806803a4000466e952000330153374a90011980a9ba90014bd701980a99ba5480092f5c097ae02233004375866016601a66016601a004900024008466ebccc030c038005200000222330033758660146018660146018004900024000466ebccc02cc034cc02cc034005200248000008c0040048894ccc0480084cdd2a400497ae013232533300f300300213374a90001980a80125eb804ccc01401400400cc05800cc050008526163001001222533300d00214984cc024c004c03c008ccc00c00cc040008004cc0040052000222233330073370e00200601c4666600a00a66e00011200230100010020022300737540024600a6ea80055cd2b9b5738aae7555cf2ab9f5740ae855d11", + "hash": "0ffbb7961d9eadaed5dce11d1b06289daa8e1837bb4c6580990385da" } ], "definitions": { diff --git a/examples/acceptance_tests/077/plutus.json b/examples/acceptance_tests/077/plutus.json index 6cca144b..7090c395 100644 --- a/examples/acceptance_tests/077/plutus.json +++ b/examples/acceptance_tests/077/plutus.json @@ -19,8 +19,8 @@ "$ref": "#/definitions/Void" } }, - "compiledCode": "5904a1010000323232323232323232323222253330063232323232323232323232323232323232323232323232323375e6e98008dd300099980a1bac33016301733016301701848001200422533301f3375e66030603200490000020998061bab3301830190024800800440052f5bded8c06660266eb0cc054c058cc054c05805d200048000894ccc078cdd79980b980c1980b980c0012400490000018998059bab33017301833017301800248009200200110014bd6f7b6301980a180a800a4000604200260420026024002603c002602064a66602e66e1d2000301a375400220022a660329212a4578706563746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e00163232330013758660226024660226024026900024000466ebccc048c04c00520000043001001222533301e00213374a900125eb804c8c94ccc06cc00c0084cdd2a40006604200497ae0133300500500100330220033020002301c001300e3253330153370e9001180c1baa001100115330174912a4578706563746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e00163300d300e00f4800888c8004cccc8888cccc03001000c008004008004888c94ccc064c94ccc07c0045288a5000113374a900125eb804cdd2a40006603e6e980052f5c066664444666601600800600400200400244464a66603866e1c005200013374a900125eb804cdd2a4000660446ea00052f5c066e0000800401800c894ccc050cdc8001000899ba5480012f5c02a66602866e3c0080044cdd2a400497ae013374a900225eb80c004004888894ccc068010400c4c8c8c8c8ccccc02402400cccccc02801c004008018014018014dd7180d8019bad301b002301e005301c0043001001222222533301900513301a337606ea4010dd4001a5eb7bdb1804c8c8c8c94ccc060cdd79980280400099ba5480012f5c026603c66ec0dd48041ba8007009153330183371e01000226464a66603466e1d20000011323233022337606ea4030dd40008039bad302200130140021005301c375400266600c01000e00426603c66ec0dd48009ba800233333300a00a003008007006005375c60340066eb4c068008c074018c06c014c004004888894ccc058010400c4c8c8c8c8ccccc02402400cccccc02801c004008018014018014dd7180b8019bab3017002301a005301800430010012222225333015005133016337606ea4010dd3001a5eb7bdb1804c8c8c8c94ccc050cdd79980280400099ba5480012f5c026603466ec0dd48041ba6007009153330143371e01000226464a66602c66e1d2000001132323301e337606ea4030dd30008039bab301e001301000210053018375400266600c01000e00426603466ec0dd48009ba600233333300a00a003008007006005375c602c0066eacc058008c064018c05c014c00400488894ccc04400c40044c8c8cc010008cccc01801800401000cc054010c04c00c88c8ccc0040052000003222333300c3370e008004026466600800866e0000d200230150010012300b37540022930b180080091129998048010a4c26600a600260160046660060066018004002ae695cdab9c5573aaae7955cfaba05742ae881", - "hash": "df1c2d58a2a6a0002c4f4d3d9be395b5bb39290a62b70959970e06c3" + "compiledCode": "59049f010000323232323232323232323232323232222533300a323232323232323232323232323232323232323232323375e6e98008dd300099980a1bac3301b301d3301b301d0164800120042253330213375e6603a603e00490000020998061bab3301d301f0024800800440052f5bded8c06660266eb0cc068c070cc068c070055200048000894ccc080cdd79980e180f1980e180f0012400490000018998059bab3301c301e3301c301e00248009200200110014bd6f7b6301980c980d800a40006046002604600260300026040002602c64a66603266e1d200030180011001153301b4912a4578706563746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e001632323300137586602c60306602c6030022900024000466ebccc05cc06400520000043001001222533302000213374a900125eb804c8c94ccc074c00c0084cdd2a40006604600497ae0133300500500100330240033022002301e00130143253330173370e9001180b00088008a9980ca492a4578706563746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e001633012301400d4800888c8004cccc8888cccc03001000c008004008004888c94ccc06cc94ccc0840045288a5000113374a900125eb804cdd2a4000660426e980052f5c066664444666601600800600400200400244464a66603c66e1c005200013374a900125eb804cdd2a4000660486ea00052f5c066e0000800401800c894ccc058cdc8001000899ba5480012f5c02a66602c66e3c0080044cdd2a400497ae013374a900225eb80c004004888894ccc070010400c4c8c8c8c8ccccc02402400cccccc02801c004008018014018014dd7180e8019bad301d0023020005301e0043001001222222533301b00513301c337606ea4010dd4001a5eb7bdb1804c8c8c8c94ccc068cdd79980280400099ba5480012f5c026604066ec0dd48041ba80070091533301a3371e01000226464a66603866e1d20000011323233024337606ea4030dd40008039bad3024001301a0021005301a001333006008007002133020337606ea4004dd40011999998050050018040038030029bae301c003375a6038004603e00c603a00a600200244444a6660300082006264646464666660120120066666601400e00200400c00a00c00a6eb8c06400cdd5980c801180e002980d0021800800911111299980b80289980c19bb037520086e9800d2f5bded8c0264646464a66602c66ebccc014020004cdd2a400097ae013301c337606ea4020dd30038048a99980b19b8f0080011323253330183370e9000000899191981019bb037520186e9800401cdd59810000980b0010802980b00099980300400380109980e19bb037520026e98008cccccc02802800c02001c018014dd7180c0019bab3018002301b006301900530010012222533301300310011323233004002333300600600100400330170043015003149858c0040048894ccc0340085261330093001300f002333003003301000200133001001480008888cccc01ccdc38008018071199980280299b8000448008c0400040080088c01cdd5000918029baa0015734ae6d5ce2ab9d5573caae7d5d02ba15745", + "hash": "88abe485cde26d7ab6bbbf8cfdc8b628f57621dd3c236a35920bc7d8" }, { "title": "spend2.backtrace", @@ -36,8 +36,8 @@ "$ref": "#/definitions/Void" } }, - "compiledCode": "590109010000323232323232323232323222253330063232324a2600464a66601266e1d2000300c375400220022a660169212a4578706563746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e0016323233001375866006600866006600800a9000240084944c0040048894ccc0400084cdd2a400497ae013232533300d300300213374a90001980980125eb804ccc01401400400cc05000cc04800888c8ccc0040052000003222333300c3370e008004026466600800866e0000d200230150010012300b37540022930b180080091129998048010a4c26600a600260160046660060066018004002ae695cdab9c5573aaae7955cfaba05742ae881", - "hash": "a48c257b952e82673f9832cba28bf43833fddb1b02ec0aeabe25e338" + "compiledCode": "59010b01000032323232323232323232323232322225333009324a2601064a66601466e1d200032300e375400200220022a6601892012a4578706563746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e001632323300137586601060146601060140069000240084944c0040048894ccc0440084cdd2a400497ae013232533300e300300213374a90001980a00125eb804ccc01401400400cc05400cc04c008526163001001222533300c00214984cc020c004c038008ccc00c00cc03c008004cc0040052000222233330063370e00200601a4666600a00a66e000112002300f001002002230063754002ae695cdab9c5573aaae7955cfaba05742ae89", + "hash": "ce1eb9a3b54205ca539e1b3260a1f2c3b71512621d3ab6ccf53edf85" } ], "definitions": { diff --git a/examples/acceptance_tests/078/lib/tests.ak b/examples/acceptance_tests/078/lib/tests.ak index 4302864b..a8a6bad3 100644 --- a/examples/acceptance_tests/078/lib/tests.ak +++ b/examples/acceptance_tests/078/lib/tests.ak @@ -10,10 +10,8 @@ type DayOfTheWeek { fn is_work(day: DayOfTheWeek) { when day is { - Tuesday | Wednesday | Thursday | Friday | Saturday -> - True - _ -> - False + Tuesday | Wednesday | Thursday | Friday | Saturday -> True + _ -> False } } @@ -27,12 +25,10 @@ test is_work_2() { fn is_happy_hour(day: DayOfTheWeek, current_time: Int) { when day is { - Monday | Sunday -> - True + Monday | Sunday -> True Tuesday | Wednesday | Thursday | Friday | Saturday if current_time > 18 -> True - _ -> - False + _ -> False } } diff --git a/examples/acceptance_tests/079/plutus.json b/examples/acceptance_tests/079/plutus.json index 17aa6d48..9c0a3e46 100644 --- a/examples/acceptance_tests/079/plutus.json +++ b/examples/acceptance_tests/079/plutus.json @@ -19,8 +19,8 @@ "$ref": "#/definitions/RedeemerWrapper$Int" } }, - "compiledCode": "58a7010000323232323232323232322253330063370e900018041baa0011332253330083370e004902a0a4c2c6eb40080044cc88c894ccc028cdc399b800040024815052616375a0026eb4008c02cc8c028dd50008009119199800800a4000006444666601066e1c0100080348ccc010010cdc0001a4004601e0020026002002444a666010004293099802980098048011998018019805001000ab9a5736aae7555cf2ab9f5742ae89", - "hash": "d5e5d02c9a5b71045eb8a0cfabd036d3a89bc3a403491bbff65a9621" + "compiledCode": "58a901000032323232323232323232322253330073370e90001918051baa0010011332253330093370e004902a0a4c2c6eb40080044cc88c894ccc02ccdc399b800040024815052616375a0026eb4008c030c8c02cdd5000800980080091129998050010a4c26600e6002601600466600600660180040026600200290001111199980299b8700100300a2333300500533700008900118060008010012b9a5736aae7555cf2ab9f5742ae89", + "hash": "d6fb9dd55ea4830d0cb22eab55b4c9b15520da39ea32dafa134e77d7" }, { "title": "foo.mint", @@ -30,8 +30,8 @@ "$ref": "#/definitions/Int" } }, - "compiledCode": "58a7010000323232323232323232322253330063370e900018041baa0011332253330083370e004902a0a4c2c6eb40080044cc88c894ccc028cdc399b800040024815052616375a0026eb4008c02cc8c028dd50008009119199800800a4000006444666601066e1c0100080348ccc010010cdc0001a4004601e0020026002002444a666010004293099802980098048011998018019805001000ab9a5736aae7555cf2ab9f5742ae89", - "hash": "d5e5d02c9a5b71045eb8a0cfabd036d3a89bc3a403491bbff65a9621" + "compiledCode": "58a901000032323232323232323232322253330073370e90001918051baa0010011332253330093370e004902a0a4c2c6eb40080044cc88c894ccc02ccdc399b800040024815052616375a0026eb4008c030c8c02cdd5000800980080091129998050010a4c26600e6002601600466600600660180040026600200290001111199980299b8700100300a2333300500533700008900118060008010012b9a5736aae7555cf2ab9f5742ae89", + "hash": "d6fb9dd55ea4830d0cb22eab55b4c9b15520da39ea32dafa134e77d7" } ], "definitions": { diff --git a/examples/acceptance_tests/script_context/plutus.json b/examples/acceptance_tests/script_context/plutus.json index 5fc7d062..bed3b3ef 100644 --- a/examples/acceptance_tests/script_context/plutus.json +++ b/examples/acceptance_tests/script_context/plutus.json @@ -19,8 +19,8 @@ "$ref": "#/definitions/Void" } }, - "compiledCode": "59046f0100003232323232323232323222253330063232323232300200132323232323233015333010323330113375e660146016002900b26126d8799f58200000000000000000000000000000000000000000000000000000000000000000ff004a0944cc024c02802d20004c0103d87a80004c0103d879800033015333010323253330123370e900100089919299980a19baf3300d300e00148001300126d8799f58200000000000000000000000000000000000000000000000000000000000000000ff0013370e6eb4cc034c038005200248000528180c80098060010b18099baa00133009300a00b48009300103d87a80004c0103d8798000330153330103232533301600116132533301700113232300c001330193330143375e6e98dd5998069807000a40046e98c0152080a8d6b9074c0103d87a80004c0103d8798000330193330143375e6601a601c6601a601c002900024000980122d8799f581c11111111111111111111111111111111111111111111111111111111ff004c0103d87a80004c0103d879800033019333014323253330163370e9000000899250301000214a2602e6ea8004cc034c038cc034c038005200048009300103d87a80004c0103d8798000330193330143375e6601a601c002900219ba5480012f5c098103d87a80004c0103d8798000330193330143375e6601a601c002900319ba5480092f5c098103d87a80004c0103d87980004bd70180c8010b180c8009bac3300a300b00148010cc024c02802d20004c0103d87a80004c0103d879800033015333010323375e6e98dd5998051805800a400c6e98c009205433009300a00b4800130103d87a80004c0103d87980004bd701199911299980999b870014800052f5bded8c02646400266664444666601400800600400297adef6c6000400100833332222333300c0040030020014bd6f7b630001000803a45004881000013001001222225333016004133017337606ea400cdd300125eb7bdb1804c8c8c8c94ccc058cdd79980280380099ba5480012f5c026603666ec0dd48039ba6006008153330163371e00e00226603666ec0dd48039ba600600313301b337606ea4004dd3001199998048048018038030029bae30170033756602e004603400a603000844a66601c66e400080044cdd2a400097ae01533300e3371e004002266e9520024bd70099ba5480112f5c0600200244444a66602600826602866ec0dd48019ba80024bd6f7b630099191919299980999baf330050070013374a900025eb804cc060cdd81ba9007375000c0102a66602666e3c01c0044cc060cdd81ba9007375000c00626603066ec0dd48009ba800233333009009003007006005375c60280066eb4c050008c05c014c054010c004004894ccc0380045288991929998060010998020020008a5030120023370e900118061baa301000122323330010014800000c888cccc030cdc3802001009119980200219b8000348008c0500040048c028dd50008a4c2c6002002444a666010004293099802980098050011998018019805801000ab9a5736aae7555cf2ab9f5740ae855d101", - "hash": "1b19d9e3de3e442bfc49be1d4465f9e86268bd085d3b12d926cf5368" + "compiledCode": "5904710100003232323232323232323232323232222533300a323232300200132323232323233017333012323330133375e6601e6022002900b26126d8799f58200000000000000000000000000000000000000000000000000000000000000000ff004a0944cc038c04002520004c0103d87a80004c0103d879800033017333012323253330143370e900100089919299980b19baf33012301400148001300126d8799f58200000000000000000000000000000000000000000000000000000000000000000ff0013370e6eb4cc048c050005200248000528180d80098090010b1809000998071808004a4004980103d87a80004c0103d8798000330173330123232533301800116132533301900113232300c0013301b3330163375e6e98dd599809180a000a40046e98c0152080a8d6b9074c0103d87a80004c0103d87980003301b3330163375e660246028660246028002900024000980122d8799f581c11111111111111111111111111111111111111111111111111111111ff004c0103d87a80004c0103d87980003301b333016323253330183370e9000000899250301600214a2602c002660246028660246028002900024004980103d87a80004c0103d87980003301b3330163375e660246028002900219ba5480012f5c098103d87a80004c0103d87980003301b3330163375e660246028002900319ba5480092f5c098103d87a80004c0103d87980004bd70180d8010b180d8009bac3300f301100148010cc038c04002520004c0103d87a80004c0103d879800033017333012323375e6e98dd5998079808800a400c6e98c00920543300e30100094800130103d87a80004c0103d87980004bd701199911299980a99b870014800052f5bded8c02646400266664444666601400800600400297adef6c6000400100833332222333300c0040030020014bd6f7b630001000803a45004881000013001001222225333018004133019337606ea400cdd300125eb7bdb1804c8c8c8c94ccc060cdd79980280380099ba5480012f5c026603a66ec0dd48039ba6006008153330183371e00e00226603a66ec0dd48039ba600600313301d337606ea4004dd3001199998048048018038030029bae301900337566032004603800a603400844a66602066e400080044cdd2a400097ae0153330103371e004002266e9520024bd70099ba5480112f5c0600200244444a66602a00826602c66ec0dd48019ba80024bd6f7b630099191919299980a99baf330050070013374a900025eb804cc068cdd81ba9007375000c0102a66602a66e3c01c0044cc068cdd81ba9007375000c00626603466ec0dd48009ba800233333009009003007006005375c602c0066eb4c058008c064014c05c010c004004894ccc0400045288991929998070010998020020008a5030140023370e900118071baa3012001149858c0040048894ccc0300085261330093001300e002333003003300f00200133001001480008888cccc01ccdc38008018069199980280299b8000448008c03c0040080088c018dd5000918021baa0015734ae6d55ceaab9e5573eae815d0aba21", + "hash": "eaf94df11baeb5cffea5f5e0a2428162ee93809520ca112fbad0b0ab" }, { "title": "deploy.spend", @@ -36,8 +36,8 @@ "$ref": "#/definitions/Data" } }, - "compiledCode": "5903f001000032323232323232323232322225333006323232323230020013301033300a32323375e0040026601893260103d87980000074c103d87a80004c0103d87980003301033300a32323232323232330123253330123370e900000089919299980c980e0010a4c2a6602c921364c6973742f5475706c652f436f6e73747220636f6e7461696e73206d6f7265206974656d73207468616e2069742065787065637465640016375a603400260180042a660289213a28636f6e20737472696e672022436f6e73747220696e64657820646964206e6f74206d6174636820616e7920747970652076617269616e742229001630143754002a66602266ebd30106d8799f182aff0000113370e64600a00200690020a50301700130093253330103370e900018099baa0011001153301249012a4578706563746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e00163322330060020010013237280026ecd30106d8799f182aff0037566600e60106600e6010012900024028600200244a6660260022900009919b8048008cc00c00c004c058004c0040048894ccc0480084cdd2a400497ae013232323253330113371e00a002266e952000330170024bd7009998038038018029bae30130033013002301600330140024c0103d87a80004c0103d87980003301033300a32533301000116132533301100116132323232533301032323009001330173330113375e660146016002900226126d87a9f5820fcaa61fb85676101d9e3398a484674e71c45c3fd41b492682f3b0054f4cf3273ff004c0103d87a80004c0103d8798000330173330113375e6601460160029003260122d8799f581ce37db487fbd58c45d059bcbf5cd6b1604d3bec16cf888f1395a4ebc4ff004c0103d87a80004c0103d87980004bd700010991918048009980b99980899baf3300a300b3300a300b0014800120024c012ad8799fd8799fd8799f581c66666666666666666666666666666666666666666666666666666666ffffff004c0103d87a80004c0103d879800033017333011323253330133370e9002000899251300d00216301537540026601460160029002260103d87a80004c0103d87980004bd700008a50301600430150041630140013013001375866006600866006600800a900024008980103d87a80004c0103d87980004bd7018008009129998078008a5113232533300c00213300400400114a0602600466e1d2002300d3754602200244646660020029000001911199980619b870040020132333004004337000069001180a800800918059baa001149858c0040048894ccc0240085261330053001300b002333003003300c0020015734ae6d5ce2ab9d5573caae7d5d02ba15745", - "hash": "918ab345c2babf62b5fc5c319d41b4bd72648bdbeb73dcd17f17db63" + "compiledCode": "5903ee010000323232323232323232323232323232222533300a32323230020013301233300c32323375e0040026601c93260103d87980000054c103d87a80004c0103d87980003301233300c32323232323232330143253330143370e900000089919299980d980f0010a4c2a66030921334c6973742f5475706c652f436f6e73747220636f6e7461696e73206d6f7265206974656d73207468616e2065787065637465640016375a603800260240042a6602c9213a28636f6e20737472696e672022436f6e73747220696e64657820646964206e6f74206d6174636820616e7920747970652076617269616e7422290016301200153330133375e98106d8799f182aff0000113370e64600a00200690020a503019001300f3253330123370e9000180880088008a9980a24812a4578706563746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e00163322330060020010013237280026ecd30106d8799f182aff00375666018601c66018601c00e900024028600200244a66602a0022900009919b8048008cc00c00c004c060004c0040048894ccc0500084cdd2a400497ae013232323253330133371e00a002266e952000330190024bd7009998038038018029bae30150033015002301800330160024c0103d87a80004c0103d87980003301233300c32533301200116132533301300116132323232533301232323009001330193330133375e6601e6022002900226126d87a9f5820fcaa61fb85676101d9e3398a484674e71c45c3fd41b492682f3b0054f4cf3273ff004c0103d87a80004c0103d8798000330193330133375e6601e60220029003260122d8799f581ce37db487fbd58c45d059bcbf5cd6b1604d3bec16cf888f1395a4ebc4ff004c0103d87a80004c0103d87980004bd700010991918048009980c99980999baf3300f30113300f30110014800120024c012ad8799fd8799fd8799f581c66666666666666666666666666666666666666666666666666666666ffffff004c0103d87a80004c0103d879800033019333013323253330153370e900200089925130130021630130013300f30110014801130103d87a80004c0103d87980004bd700008a503018004301700416301600130150013758660106014660106014006900024008980103d87a80004c0103d87980004bd7018008009129998088008a5113232533300e00213300400400114a0602a00466e1d2002300f375460260022930b180080091129998068010a4c2660126002601e00466600600660200040026600200290001111199980399b8700100300e233330050053370000890011808000801001118039baa001230053754002ae695cdab9c5573aaae7955cfaba05742ae881", + "hash": "9e256628a3020d60ff765f9761b896c8be331ae383631f3d7038bee8" }, { "title": "mint.mint", @@ -47,8 +47,8 @@ "$ref": "#/definitions/Data" } }, - "compiledCode": "590488010000323232323232323232323222533300532323232323001003300100122533300f00114a226464a6660180042660080080022940c04c008cdc3a4004601a6ea8c044004cc034ccc01cc8c8c8c8c8c8c94ccc04cc0580084c8c8cdc78018009bae3016001300932533300f3370e900018091baa0011001153301149012a4578706563746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e00163300830090034800854cc0412401364c6973742f5475706c652f436f6e73747220636f6e7461696e73206d6f7265206974656d73207468616e2069742065787065637465640016375c602800264646464600c00200200264640026644660100040020029110000137566600c600e6600c600e00290002401000e600200244a666020002297ae01323232323301537520026600c00c0066eb8c04400cdd59808801180a0011809000980080091129998078010a5eb7bdb1804c8c8c8c94ccc038cdc7802800880189980a19bb037520026e98008ccc01c01c00c014dd718080019bab3010002301300330110024c103d87a80004c0103d87980003300d333007323232323322323232323253330123370e90010008b0991919b87001483c850dd6980d0009806801180a1baa001332233008002001001488103666f6f0033223233223253330153370e90010008801099190009bab301d00130100033017375400400297adef6c6033223300b002001002001375666012601400690040009bae30150013008533300d3370e900018081baa0021002153300f49012a4578706563746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e001633005300600748008cc014c01801d20003001001222533301100213374a900125eb804c8c8c8c94ccc040cdc7802800899ba548000cc058dd400125eb804ccc01c01c00c014dd718090019bad3012002301500330130023001001222533300f00213374a900125eb804c8c8c8c94ccc038cdc7802800899ba548000cc050dd300125eb804ccc01c01c00c014dd718080019bab3010002301300330110024c103d87a80004c0103d87980003300d3330073232323233223232533300f3375e006002266e1cc8c018004dd5998049805198049805002240009009240042940c054004c020c94ccc038cdc3a400060226ea8004400454cc0412412a4578706563746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e001633223300700200137566600e60106600e60100049000240246600e6010004900100380418008009129998080008a400026466e0120023300300300130130013001001222533300f00213374a900125eb804c8c8c8c94ccc038cdd7802800899ba548000cc0500092f5c0266600e00e00600a6020006602000460260066022004980103d87a80004c0103d87980004bd701119199800800a4000006444666601666e1c0100080488ccc010010cdc0001a40046028002002460146ea8004526163001001222533300900214984cc014c004c02c008ccc00c00cc0300080055cd2b9b5738aae7555cf2ab9f5740ae855d11", - "hash": "4713fb6d48ba86a228f79b958ae5ef137cdb08e02a9c2f72052bf5e5" + "compiledCode": "5904820100003232323232323232323232323232322253330093232323001003300100122533301100114a226464a66601c0042660080080022940c054008cdc3a4004601e6ea8c04c004cc03cccc024c8c8c8c8c8c8c94ccc054c0600084c8c8cdc78018009bae3018001300e3253330113370e9000180800088008a99809a4812a4578706563746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e00163300c300e0034800854cc0492401334c6973742f5475706c652f436f6e73747220636f6e7461696e73206d6f7265206974656d73207468616e2065787065637465640016375c602c00264646464600c002002002646400266446601000400200291100001375666014601866014601800290002401000a600200244a666024002297ae01323232323301737520026600c00c0066eb8c04c00cdd59809801180b001180a000980080091129998088010a5eb7bdb1804c8c8c8c94ccc040cdc7802800880189980b19bb037520026e98008ccc01c01c00c014dd718090019bab3012002301500330130024c103d87a80004c0103d87980003300f333009323232323322323232323253330143370e90010008b0991919b87001483c850dd6980e00098090011809000999119804001000800a44103666f6f0033223233223253330173370e90010008801099190009bab301f001301500330150020014bd6f7b6301991198058010008010009bab3300d300f00348020004dd7180b8009806a99980799b8748000c038008400854cc0452412a4578706563746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e001633009300b00548008cc024c02c01520003001001222533301300213374a900125eb804c8c8c8c94ccc048cdc7802800899ba548000cc060dd400125eb804ccc01c01c00c014dd7180a0019bad3014002301700330150023001001222533301100213374a900125eb804c8c8c8c94ccc040cdc7802800899ba548000cc058dd300125eb804ccc01c01c00c014dd718090019bab3012002301500330130024c103d87a80004c0103d87980003300f333009323232323322323253330113375e006002266e1cc8c018004dd5998069807998069807802240009009240042940c05c004c034c94ccc040cdc3a4000601e00220022a660249212a4578706563746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e0016332233007002001375666016601a66016601a00490002402466016601a004900100280318008009129998090008a400026466e0120023300300300130150013001001222533301100213374a900125eb804c8c8c8c94ccc040cdd7802800899ba548000cc0580092f5c0266600e00e00600a60240066024004602a0066026004980103d87a80004c0103d87980004bd700a4c2c6002002444a66601a00429309980498009807801199801801980800100099800800a40004444666600e66e1c00400c0388cccc014014cdc00022400460200020040044600e6ea80048c014dd5000ab9a5736ae7155ceaab9e5573eae815d0aba201", + "hash": "bfb5300db2017d35da65921fe782672da77ff7039831b23c59e57908" }, { "title": "withdrawals.spend", @@ -64,8 +64,8 @@ "$ref": "#/definitions/Void" } }, - "compiledCode": "59029101000032323232323232323232222533300632323232323001003300100122533300f00114a226464a66601a0042660080080022940c04c008cdc3a4004601a6ea8c044004c8c8c8cc040ccc02cc8c94ccc034cdc3a40040022c2646466e1c0052054375a6028002600e004601c6ea8004cc004dd5998021802998021802803240009006260126d8799fd8799f581c22222222222222222222222222222222222222222222222222222222ffff004c0103d87a80004c0103d87980003301033300b3232533300d3370e90010008b0991919b8700148070dd6980a000980380118071baa00133001375666008600a66008600a00c90002401898126d8799fd87a9f581cafddc16c18e7d8de379fb9aad39b3d1b5afd27603e5ebac818432a72ffff004c0103d87a80004c0103d87980003301033300b3375e6e9cc8c8c8c008004dd599803180399803180380424000900618008009129998088008a5eb804c8c8c8c8cc058004cc01801800cc04800cdd69809001180a80118098009ba7330104c0126d8799fd8799f581c22222222222222222222222222222222222222222222222222222222ffff00330104c126d8799fd87a9f581cafddc16c18e7d8de379fb9aad39b3d1b5afd27603e5ebac818432a72ffff004bd7026103d87a80004c0103d87980004bd70111980180100098008009112999807801099ba5480092f5c0264646464a66601e66ebc0140044cdd2a4000660286ea00092f5c0266600e00e00600a60200066eb4c040008c04c00cc04400888c8ccc0040052000003222333300c3370e008004024466600800866e0000d200230140010012300a37540022930b180080091129998040010a4c26600a600260140046660060066016004002ae695cdaab9d5573caae7d5d02ba15745", - "hash": "8926bce06966e878646861478d817460794aeaddb9d7440446b07e0f" + "compiledCode": "5902940100003232323232323232323232323232222533300a3232323001003300100122533301100114a226464a66601e0042660080080022940c054008cdc3a4004601e6ea8c04c004c8c8c8cc048ccc034c8c94ccc03ccdc3a40040022c2646466e1c0052054375a602c002601a004601a002660026eaccc024c02ccc024c02c01120004803130126d8799fd8799f581c22222222222222222222222222222222222222222222222222222222ffff004c0103d87a80004c0103d87980003301233300d3232533300f3370e90010008b0991919b8700148070dd6980b00098068011806800998009bab33009300b33009300b00448001200c4c126d8799fd87a9f581cafddc16c18e7d8de379fb9aad39b3d1b5afd27603e5ebac818432a72ffff004c0103d87a80004c0103d87980003301233300d3375e6e9cc8c8c8c008004dd599805980699805980680324000900618008009129998098008a5eb804c8c8c8c8cc060004cc01801800cc05000cdd6980a001180b801180a8009ba7330124c0126d8799fd8799f581c22222222222222222222222222222222222222222222222222222222ffff00330124c126d8799fd87a9f581cafddc16c18e7d8de379fb9aad39b3d1b5afd27603e5ebac818432a72ffff004bd7026103d87a80004c0103d87980004bd70111980180100098008009112999808801099ba5480092f5c0264646464a66602266ebc0140044cdd2a40006602c6ea00092f5c0266600e00e00600a60240066eb4c048008c05400cc04c008526163001001222533300c00214984cc024c004c038008ccc00c00cc03c008004cc0040052000222233330073370e00200601a4666600a00a66e000112002300f001002002230063754002460086ea80055cd2b9b5573aaae7955cfaba05742ae881", + "hash": "d36e5d8c48a95c1cb550e607be407603a8a2d89a553bc8d6c6aee915" } ], "definitions": {