Skip to content

Commit

Permalink
Unify construction of PlutusData objects from int + fields
Browse files Browse the repository at this point in the history
  • Loading branch information
nielstron authored and MicroProofs committed Jan 13, 2024
1 parent 742a728 commit cda1716
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions crates/uplc/src/machine/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ use std::{mem::size_of, ops::Deref, rc::Rc};
use num_bigint::BigInt;
use num_integer::Integer;
use once_cell::sync::Lazy;
use pallas_primitives::babbage::{Constr, Language, PlutusData};
use pallas_primitives::babbage::{Language, PlutusData};

use crate::{
ast::{Constant, Type},
ast::{Constant, Data, Type},
builtins::DefaultFunction,
plutus_data_to_bytes,
};
Expand Down Expand Up @@ -752,11 +752,7 @@ impl DefaultFunction {

let i: u64 = i.try_into().unwrap();

let constr_data = PlutusData::Constr(Constr {
tag: convert_constr_to_tag(i).unwrap_or(ANY_TAG),
any_constructor: convert_constr_to_tag(i).map_or(Some(i), |_| None),
fields: data_list,
});
let constr_data = Data::constr(i, data_list);

let value = Value::data(constr_data);

Expand Down

0 comments on commit cda1716

Please sign in to comment.