Skip to content

Commit

Permalink
Comment out ExpModInteger since it's not live on testnets yet
Browse files Browse the repository at this point in the history
  • Loading branch information
MicroProofs committed Dec 8, 2024
1 parent 1105dbf commit ebc7d89
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 39 deletions.
9 changes: 4 additions & 5 deletions crates/aiken-lang/src/builtins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -982,12 +982,11 @@ pub fn from_default_function(builtin: DefaultFunction, id_gen: &IdGenerator) ->
let tipo = Type::function(vec![Type::byte_array()], Type::byte_array());

(tipo, 1)
}
DefaultFunction::ExpModInteger => {
let tipo = Type::function(vec![Type::int(), Type::int(), Type::int()], Type::int());
} // DefaultFunction::ExpModInteger => {
// let tipo = Type::function(vec![Type::int(), Type::int(), Type::int()], Type::int());

(tipo, 3)
}
// (tipo, 3)
// }
};

ValueConstructor::public(
Expand Down
8 changes: 4 additions & 4 deletions crates/uplc/src/builtins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ pub enum DefaultFunction {
FindFirstSetBit = 85,
// Ripemd_160
Ripemd_160 = 86,
ExpModInteger = 87,
// ExpModInteger = 87,
// Match
// CaseList = 88,
// CaseData = 89,
Expand Down Expand Up @@ -395,7 +395,7 @@ impl FromStr for DefaultFunction {
"countSetBits" => Ok(CountSetBits),
"findFirstSetBit" => Ok(FindFirstSetBit),
"ripemd_160" => Ok(Ripemd_160),
"expModInteger" => Ok(ExpModInteger),
// "expModInteger" => Ok(ExpModInteger),
// "caseList" => Ok(CaseList),
// "caseData" => Ok(CaseData),
rest => Err(format!("Default Function not found - {rest}")),
Expand Down Expand Up @@ -495,7 +495,7 @@ impl Display for DefaultFunction {
CountSetBits => write!(f, "countSetBits"),
FindFirstSetBit => write!(f, "findFirstSetBit"),
Ripemd_160 => write!(f, "ripemd_160"),
ExpModInteger => write!(f, "expModInteger"),
// ExpModInteger => write!(f, "expModInteger"),
// CaseList => write!(f, "caseList"),
// CaseData => write!(f, "caseData"),
}
Expand Down Expand Up @@ -594,7 +594,7 @@ impl DefaultFunction {
CountSetBits => "count_set_bits",
FindFirstSetBit => "find_first_set_bit",
Ripemd_160 => "ripemd_160",
ExpModInteger => "exp_mod_integer",
// ExpModInteger => "exp_mod_integer",
// CaseList => "case_list",
// CaseData => "case_data",
}
Expand Down
48 changes: 24 additions & 24 deletions crates/uplc/src/machine/cost_model.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::{value::integer_log2, Error, Value};
use super::{Error, Value};
use crate::builtins::DefaultFunction;
use num_traits::Signed;
use pallas_primitives::conway::Language;
Expand Down Expand Up @@ -2676,31 +2676,31 @@ impl BuiltinCosts {
mem: self.ripemd_160.mem.cost(args[0].to_ex_mem()),
cpu: self.ripemd_160.cpu.cost(args[0].to_ex_mem()),
},
DefaultFunction::ExpModInteger => {
let arg3 = args[2].unwrap_integer()?;
if arg3.lt(&(0.into())) {
return Err(Error::OutsideNaturalBounds(arg3.clone()));
}
// DefaultFunction::ExpModInteger => {
// let arg3 = args[2].unwrap_integer()?;
// if arg3.lt(&(0.into())) {
// return Err(Error::OutsideNaturalBounds(arg3.clone()));
// }

let arg3_exmem = if *arg3 == 0.into() {
1
} else {
(integer_log2(arg3.abs()) / 64) + 1
};
// let arg3_exmem = if *arg3 == 0.into() {
// 1
// } else {
// (integer_log2(arg3.abs()) / 64) + 1
// };

ExBudget {
mem: self.exp_mod_int.mem.cost(
args[0].to_ex_mem(),
args[1].to_ex_mem(),
arg3_exmem,
),
cpu: self.exp_mod_int.cpu.cost(
args[0].to_ex_mem(),
args[1].to_ex_mem(),
arg3_exmem,
),
}
}
// ExBudget {
// mem: self.exp_mod_int.mem.cost(
// args[0].to_ex_mem(),
// args[1].to_ex_mem(),
// arg3_exmem,
// ),
// cpu: self.exp_mod_int.cpu.cost(
// args[0].to_ex_mem(),
// args[1].to_ex_mem(),
// arg3_exmem,
// ),
// }
// }
})
}
}
Expand Down
11 changes: 5 additions & 6 deletions crates/uplc/src/machine/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ impl DefaultFunction {
| DefaultFunction::RotateByteString
| DefaultFunction::CountSetBits
| DefaultFunction::FindFirstSetBit
| DefaultFunction::Ripemd_160
| DefaultFunction::ExpModInteger => false,
| DefaultFunction::Ripemd_160 => false,
// | DefaultFunction::ExpModInteger
// | DefaultFunction::CaseList
// | DefaultFunction::CaseData
}
Expand Down Expand Up @@ -287,7 +287,7 @@ impl DefaultFunction {
DefaultFunction::CountSetBits => 1,
DefaultFunction::FindFirstSetBit => 1,
DefaultFunction::Ripemd_160 => 1,
DefaultFunction::ExpModInteger => 3,
// DefaultFunction::ExpModInteger => 3,
}
}

Expand Down Expand Up @@ -380,7 +380,7 @@ impl DefaultFunction {
DefaultFunction::CountSetBits => 0,
DefaultFunction::FindFirstSetBit => 0,
DefaultFunction::Ripemd_160 => 0,
DefaultFunction::ExpModInteger => 0,
// DefaultFunction::ExpModInteger => 0,
}
}

Expand Down Expand Up @@ -1761,8 +1761,7 @@ impl DefaultFunction {
let value = Value::byte_string(bytes);

Ok(value)
}
DefaultFunction::ExpModInteger => todo!(),
} // DefaultFunction::ExpModInteger => todo!(),
}
}
}
Expand Down

0 comments on commit ebc7d89

Please sign in to comment.