Skip to content

Commit

Permalink
Address additional comments on ZcashFoundation#174
Browse files Browse the repository at this point in the history
  • Loading branch information
sellout committed Feb 25, 2025
1 parent cdf9fb7 commit 2d835f6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}

Expand Down Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ({:?}).",
Expand Down

0 comments on commit 2d835f6

Please sign in to comment.