From 2d835f6bc6337404b7e68efb1ed551d636d2f7bb Mon Sep 17 00:00:00 2001 From: Greg Pfeil Date: Tue, 25 Feb 2025 00:05:38 -0700 Subject: [PATCH] Address additional comments on #174 --- src/interpreter.rs | 3 ++- src/lib.rs | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/interpreter.rs b/src/interpreter.rs index a8203b74f..148cf055b 100644 --- a/src/interpreter.rs +++ b/src/interpreter.rs @@ -859,7 +859,7 @@ pub fn eval_script( return set_error(ScriptError::InvalidStackOperation); } let bn = ScriptNum::try_from(stack.top(-1)?.len()) - .map_err(|_| ScriptError::PushSize)?; + .expect("stack element size fits in ScriptNum"); stack.push_back(bn.getvch()) } @@ -1073,6 +1073,7 @@ pub fn eval_script( if keys_count > 20 { return set_error(ScriptError::PubKeyCount); }; + assert!(op_count <= 201); op_count += keys_count; if op_count > 201 { return set_error(ScriptError::OpCount); diff --git a/src/lib.rs b/src/lib.rs index 75addd300..e03dbe302 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -288,8 +288,7 @@ impl ZcashScript for CxxRustComparisonInterpreter { ); if rust.map_err(normalize_error) != cxx { // probably want to distinguish between - // - C++ succeeding when Rust fails (bad), - // - Rust succeeding when C++ fails (worse), and + // - one succeeding when the other fails (bad), and // - differing error codes (maybe not bad). warn!( "The Rust Zcash Script interpreter had a different result ({:?}) from the C++ one ({:?}).",