From ebc7d89d5d7f6b569edb7adeb6ba0c6f2ed3a9db Mon Sep 17 00:00:00 2001 From: microproofs Date: Sun, 8 Dec 2024 14:29:58 +0700 Subject: [PATCH] Comment out ExpModInteger since it's not live on testnets yet --- crates/aiken-lang/src/builtins.rs | 9 +++-- crates/uplc/src/builtins.rs | 8 ++--- crates/uplc/src/machine/cost_model.rs | 48 +++++++++++++-------------- crates/uplc/src/machine/runtime.rs | 11 +++--- 4 files changed, 37 insertions(+), 39 deletions(-) diff --git a/crates/aiken-lang/src/builtins.rs b/crates/aiken-lang/src/builtins.rs index 5c841b71f..c3b6f3894 100644 --- a/crates/aiken-lang/src/builtins.rs +++ b/crates/aiken-lang/src/builtins.rs @@ -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( diff --git a/crates/uplc/src/builtins.rs b/crates/uplc/src/builtins.rs index 8ac00744b..2fca416f6 100644 --- a/crates/uplc/src/builtins.rs +++ b/crates/uplc/src/builtins.rs @@ -119,7 +119,7 @@ pub enum DefaultFunction { FindFirstSetBit = 85, // Ripemd_160 Ripemd_160 = 86, - ExpModInteger = 87, + // ExpModInteger = 87, // Match // CaseList = 88, // CaseData = 89, @@ -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}")), @@ -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"), } @@ -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", } diff --git a/crates/uplc/src/machine/cost_model.rs b/crates/uplc/src/machine/cost_model.rs index c115956a3..e025fd64c 100644 --- a/crates/uplc/src/machine/cost_model.rs +++ b/crates/uplc/src/machine/cost_model.rs @@ -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; @@ -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, + // ), + // } + // } }) } } diff --git a/crates/uplc/src/machine/runtime.rs b/crates/uplc/src/machine/runtime.rs index faeef8d46..5745a356b 100644 --- a/crates/uplc/src/machine/runtime.rs +++ b/crates/uplc/src/machine/runtime.rs @@ -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 } @@ -287,7 +287,7 @@ impl DefaultFunction { DefaultFunction::CountSetBits => 1, DefaultFunction::FindFirstSetBit => 1, DefaultFunction::Ripemd_160 => 1, - DefaultFunction::ExpModInteger => 3, + // DefaultFunction::ExpModInteger => 3, } } @@ -380,7 +380,7 @@ impl DefaultFunction { DefaultFunction::CountSetBits => 0, DefaultFunction::FindFirstSetBit => 0, DefaultFunction::Ripemd_160 => 0, - DefaultFunction::ExpModInteger => 0, + // DefaultFunction::ExpModInteger => 0, } } @@ -1761,8 +1761,7 @@ impl DefaultFunction { let value = Value::byte_string(bytes); Ok(value) - } - DefaultFunction::ExpModInteger => todo!(), + } // DefaultFunction::ExpModInteger => todo!(), } } }