Comment out ExpModInteger since it's not live on testnets yet

This commit is contained in:
microproofs 2024-12-08 14:29:58 +07:00
parent 1105dbf3c6
commit ebc7d89d5d
No known key found for this signature in database
GPG Key ID: 14F93C84DE6AFD17
4 changed files with 37 additions and 39 deletions

View File

@ -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()); let tipo = Type::function(vec![Type::byte_array()], Type::byte_array());
(tipo, 1) (tipo, 1)
} } // DefaultFunction::ExpModInteger => {
DefaultFunction::ExpModInteger => { // let tipo = Type::function(vec![Type::int(), Type::int(), Type::int()], Type::int());
let tipo = Type::function(vec![Type::int(), Type::int(), Type::int()], Type::int());
(tipo, 3) // (tipo, 3)
} // }
}; };
ValueConstructor::public( ValueConstructor::public(

View File

@ -119,7 +119,7 @@ pub enum DefaultFunction {
FindFirstSetBit = 85, FindFirstSetBit = 85,
// Ripemd_160 // Ripemd_160
Ripemd_160 = 86, Ripemd_160 = 86,
ExpModInteger = 87, // ExpModInteger = 87,
// Match // Match
// CaseList = 88, // CaseList = 88,
// CaseData = 89, // CaseData = 89,
@ -395,7 +395,7 @@ impl FromStr for DefaultFunction {
"countSetBits" => Ok(CountSetBits), "countSetBits" => Ok(CountSetBits),
"findFirstSetBit" => Ok(FindFirstSetBit), "findFirstSetBit" => Ok(FindFirstSetBit),
"ripemd_160" => Ok(Ripemd_160), "ripemd_160" => Ok(Ripemd_160),
"expModInteger" => Ok(ExpModInteger), // "expModInteger" => Ok(ExpModInteger),
// "caseList" => Ok(CaseList), // "caseList" => Ok(CaseList),
// "caseData" => Ok(CaseData), // "caseData" => Ok(CaseData),
rest => Err(format!("Default Function not found - {rest}")), rest => Err(format!("Default Function not found - {rest}")),
@ -495,7 +495,7 @@ impl Display for DefaultFunction {
CountSetBits => write!(f, "countSetBits"), CountSetBits => write!(f, "countSetBits"),
FindFirstSetBit => write!(f, "findFirstSetBit"), FindFirstSetBit => write!(f, "findFirstSetBit"),
Ripemd_160 => write!(f, "ripemd_160"), Ripemd_160 => write!(f, "ripemd_160"),
ExpModInteger => write!(f, "expModInteger"), // ExpModInteger => write!(f, "expModInteger"),
// CaseList => write!(f, "caseList"), // CaseList => write!(f, "caseList"),
// CaseData => write!(f, "caseData"), // CaseData => write!(f, "caseData"),
} }
@ -594,7 +594,7 @@ impl DefaultFunction {
CountSetBits => "count_set_bits", CountSetBits => "count_set_bits",
FindFirstSetBit => "find_first_set_bit", FindFirstSetBit => "find_first_set_bit",
Ripemd_160 => "ripemd_160", Ripemd_160 => "ripemd_160",
ExpModInteger => "exp_mod_integer", // ExpModInteger => "exp_mod_integer",
// CaseList => "case_list", // CaseList => "case_list",
// CaseData => "case_data", // CaseData => "case_data",
} }

View File

@ -1,4 +1,4 @@
use super::{value::integer_log2, Error, Value}; use super::{Error, Value};
use crate::builtins::DefaultFunction; use crate::builtins::DefaultFunction;
use num_traits::Signed; use num_traits::Signed;
use pallas_primitives::conway::Language; use pallas_primitives::conway::Language;
@ -2676,31 +2676,31 @@ impl BuiltinCosts {
mem: self.ripemd_160.mem.cost(args[0].to_ex_mem()), mem: self.ripemd_160.mem.cost(args[0].to_ex_mem()),
cpu: self.ripemd_160.cpu.cost(args[0].to_ex_mem()), cpu: self.ripemd_160.cpu.cost(args[0].to_ex_mem()),
}, },
DefaultFunction::ExpModInteger => { // DefaultFunction::ExpModInteger => {
let arg3 = args[2].unwrap_integer()?; // let arg3 = args[2].unwrap_integer()?;
if arg3.lt(&(0.into())) { // if arg3.lt(&(0.into())) {
return Err(Error::OutsideNaturalBounds(arg3.clone())); // return Err(Error::OutsideNaturalBounds(arg3.clone()));
} // }
let arg3_exmem = if *arg3 == 0.into() { // let arg3_exmem = if *arg3 == 0.into() {
1 // 1
} else { // } else {
(integer_log2(arg3.abs()) / 64) + 1 // (integer_log2(arg3.abs()) / 64) + 1
}; // };
ExBudget { // ExBudget {
mem: self.exp_mod_int.mem.cost( // mem: self.exp_mod_int.mem.cost(
args[0].to_ex_mem(), // args[0].to_ex_mem(),
args[1].to_ex_mem(), // args[1].to_ex_mem(),
arg3_exmem, // arg3_exmem,
), // ),
cpu: self.exp_mod_int.cpu.cost( // cpu: self.exp_mod_int.cpu.cost(
args[0].to_ex_mem(), // args[0].to_ex_mem(),
args[1].to_ex_mem(), // args[1].to_ex_mem(),
arg3_exmem, // arg3_exmem,
), // ),
} // }
} // }
}) })
} }
} }

View File

@ -191,8 +191,8 @@ impl DefaultFunction {
| DefaultFunction::RotateByteString | DefaultFunction::RotateByteString
| DefaultFunction::CountSetBits | DefaultFunction::CountSetBits
| DefaultFunction::FindFirstSetBit | DefaultFunction::FindFirstSetBit
| DefaultFunction::Ripemd_160 | DefaultFunction::Ripemd_160 => false,
| DefaultFunction::ExpModInteger => false, // | DefaultFunction::ExpModInteger
// | DefaultFunction::CaseList // | DefaultFunction::CaseList
// | DefaultFunction::CaseData // | DefaultFunction::CaseData
} }
@ -287,7 +287,7 @@ impl DefaultFunction {
DefaultFunction::CountSetBits => 1, DefaultFunction::CountSetBits => 1,
DefaultFunction::FindFirstSetBit => 1, DefaultFunction::FindFirstSetBit => 1,
DefaultFunction::Ripemd_160 => 1, DefaultFunction::Ripemd_160 => 1,
DefaultFunction::ExpModInteger => 3, // DefaultFunction::ExpModInteger => 3,
} }
} }
@ -380,7 +380,7 @@ impl DefaultFunction {
DefaultFunction::CountSetBits => 0, DefaultFunction::CountSetBits => 0,
DefaultFunction::FindFirstSetBit => 0, DefaultFunction::FindFirstSetBit => 0,
DefaultFunction::Ripemd_160 => 0, DefaultFunction::Ripemd_160 => 0,
DefaultFunction::ExpModInteger => 0, // DefaultFunction::ExpModInteger => 0,
} }
} }
@ -1761,8 +1761,7 @@ impl DefaultFunction {
let value = Value::byte_string(bytes); let value = Value::byte_string(bytes);
Ok(value) Ok(value)
} } // DefaultFunction::ExpModInteger => todo!(),
DefaultFunction::ExpModInteger => todo!(),
} }
} }
} }