Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addressing post-hoc PR feedback on #174 #197

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

sellout
Copy link
Collaborator

@sellout sellout commented Feb 3, 2025

No description provided.

sellout and others added 4 commits January 30, 2025 14:14
There is a bug in the C++ side where the error is not set correctly on a
“high s” signature. The Rust side had mirrored this bug, but this
eliminates the bug in the Rust.
This doesn’t seem to have any effect on the semantics, as the DER-formatted signature includes
lengths that ensure it will ignore extra bytes, but the C++ code removes the extra byte, so the Rust
should as well.
Co-authored-by: Daira-Emma Hopwood <[email protected]>
nuttycom
nuttycom previously approved these changes Feb 6, 2025
Copy link
Collaborator

@nuttycom nuttycom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 9ab8426

Copy link
Contributor

@conradoplg conradoplg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good but I think that @daira's latest comments on #174 haven't been addressed yet. Also needs solving conflicts.

src/interpreter.rs Outdated Show resolved Hide resolved
@sellout sellout marked this pull request as ready for review February 13, 2025 22:25
@sellout
Copy link
Collaborator Author

sellout commented Feb 13, 2025

This is looking good but I think that @daira's latest comments on #174 haven't been addressed yet. Also needs solving conflicts.

Just finished both of those – and moved this out of draft.

Copy link
Contributor

@conradoplg conradoplg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; I'll wait for @daira's review before merging

Copy link
Collaborator

@nuttycom nuttycom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 9ab8426

Comment on lines -1132 to -1136
while {
let res = i > 1;
i -= 1;
res
} {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What a weird construction that was. Like, why not just decrement i in the body of the loop, at least?

@@ -595,10 +547,11 @@ impl Script<'_> {
let mut pc = self.0;
let mut last_opcode = Opcode::Operation(OP_INVALIDOPCODE);
while !pc.is_empty() {
let opcode = match Self::get_op(&mut pc) {
let (opcode, new_pc) = match Self::get_op(pc) {
Ok(o) => o,
Err(_) => break,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nonblocking: It's annoying that the error case here is ignored in the original C++ code. It will probably be worth a comment here, since once we transition fully to the Rust implementation this behavior will be puzzling.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah … I can only guess that this is done to prevent someone from creating script that’s too expensive, but then doing something invalid at the end to prevent this check from catching it. But

  1. the interpreter also tracks op_count, so it at least wouldn’t get past 201 no matter what; and
  2. if this did error, then we’d know not to bother running the script. 🤷🏼

So, should the comment just be something like “TODO: Err is ignored to match the C++ behavior. In future, allow this operation to fail.”?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Review/QA
Development

Successfully merging this pull request may close these issues.

3 participants