diff --git a/src/classic/clvm_tools/cmds.rs b/src/classic/clvm_tools/cmds.rs index af507310..9811c19a 100644 --- a/src/classic/clvm_tools/cmds.rs +++ b/src/classic/clvm_tools/cmds.rs @@ -1575,6 +1575,7 @@ pub fn launch_tool(stdout: &mut Stream, args: &[String], tool_name: &str, defaul Some(max_cost as u64) }, pre_eval_f, + new_operators: false, strict: parsed_args .get("strict") .map(|_| true) diff --git a/src/classic/clvm_tools/stages/stage_0.rs b/src/classic/clvm_tools/stages/stage_0.rs index f99ee3f6..4bd73e60 100644 --- a/src/classic/clvm_tools/stages/stage_0.rs +++ b/src/classic/clvm_tools/stages/stage_0.rs @@ -5,10 +5,12 @@ use clvm_rs::reduction::Response; use clvm_rs::run_program::{run_program_with_pre_eval, PreEval}; +#[derive(Default)] pub struct RunProgramOption { pub max_cost: Option, pub pre_eval_f: Option, pub strict: bool, + pub new_operators: bool, } pub trait TRunProgram { @@ -44,10 +46,11 @@ impl TRunProgram for DefaultProgramRunner { option: Option, ) -> Response { let max_cost = option.as_ref().and_then(|o| o.max_cost).unwrap_or(0); + let new_operators = option.as_ref().map(|o| o.new_operators).unwrap_or_default(); run_program_with_pre_eval( allocator, - &ChiaDialect::new(NO_UNKNOWN_OPS | ENABLE_BLS_OPS_OUTSIDE_GUARD), + &ChiaDialect::new(NO_UNKNOWN_OPS | ((new_operators as u32) * ENABLE_BLS_OPS_OUTSIDE_GUARD)), program, args, max_cost, diff --git a/src/compiler/clvm.rs b/src/compiler/clvm.rs index 41a8b4cb..d38cd677 100644 --- a/src/compiler/clvm.rs +++ b/src/compiler/clvm.rs @@ -13,7 +13,7 @@ use sha2::Digest; use sha2::Sha256; use crate::classic::clvm::__type_compatibility__::{bi_one, bi_zero}; -use crate::classic::clvm_tools::stages::stage_0::TRunProgram; +use crate::classic::clvm_tools::stages::stage_0::{TRunProgram, RunProgramOption}; use crate::compiler::prims; use crate::compiler::runtypes::RunFailure; @@ -396,7 +396,10 @@ fn apply_op( let converted_args = convert_to_clvm_rs(allocator, wrapped_args.clone())?; runner - .run_program(allocator, converted_app, converted_args, None) + .run_program(allocator, converted_app, converted_args, Some(RunProgramOption { + new_operators: true, + .. RunProgramOption::default() + })) .map_err(|e| { RunFailure::RunErr( head.loc(), diff --git a/src/tests/classic/run.rs b/src/tests/classic/run.rs index 4c3f687b..ec6a31f2 100644 --- a/src/tests/classic/run.rs +++ b/src/tests/classic/run.rs @@ -2543,15 +2543,3 @@ fn test_include_bin_should_not_be_parsed() { let result = do_basic_brun(&vec!["brun".to_string(), program]); assert_eq!(result.trim(), "\"'test\""); } - -#[test] -fn test_coinid_outside_guard() { - let result = do_basic_run(&vec![ - "run".to_string(), - "(coinid (sha256 3) (sha256 3) 4)".to_string(), - ]); - assert_eq!( - result.trim(), - "0x9f7f12b86a583805a4442879b7b5b531469e45c7e753e5fd431058e90bf3fbec" - ); -} diff --git a/src/tests/compiler/optimizer/output.rs b/src/tests/compiler/optimizer/output.rs index 6ac41c88..90b01aef 100644 --- a/src/tests/compiler/optimizer/output.rs +++ b/src/tests/compiler/optimizer/output.rs @@ -47,8 +47,7 @@ fn run_with_cost( as_classic_env, Some(RunProgramOption { max_cost: Some(MAX_RUN_COST), - pre_eval_f: None, - strict: false, + .. RunProgramOption::default() }), ) .map_err(|e| RunFailure::RunErr(sexp.loc(), format!("{} in {} {}", e.1, sexp, env)))