Skip to content

Use zcash_script’s new Script trait #8751

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

Merged
merged 14 commits into from
Jun 12, 2025

Conversation

sellout
Copy link
Contributor

@sellout sellout commented Aug 8, 2024

Motivation

This is a precursor to testing the Rust implementation of Zcash Script.

Blocked-On: ZcashFoundation/zcash_script#171 and publishing a new version of zcash_script with those changes.

Solution

This uses a trait that wraps the C++ Zcash Script implementation. As we progress toward cutting over to a Rust implementation, this trait will additionally have impls for the Rust version and a variant that runs both C++ & Rust, comparing the results.

Additionally, this eliminates a few cases from zebra_script::Error that can never be produced.

Tests

The tests are the same as the previous zebra_script tests – there should be no change in behavior.

Follow-up Work

This is blocked on a release of zcash_script containing ZcashFoundation/zcash_script#171.

PR Author's Checklist

  • The PR name will make sense to users.
  • The PR provides a CHANGELOG summary.
  • The solution is tested.
  • The documentation is up to date.
  • The PR has a priority label.

PR Reviewer's Checklist

  • The PR Author's checklist is complete.
  • The PR resolves the issue.

@sellout
Copy link
Contributor Author

sellout commented Aug 8, 2024

This depends on ZcashFoundation/zcash_script#171.

@sellout sellout force-pushed the rusty-zcash_script branch 2 times, most recently from 38617ec to f80b392 Compare August 9, 2024 06:01
@mpguerra
Copy link
Contributor

mpguerra commented Aug 9, 2024

Thank you for your PR! We're focusing on changes for NU6 testnet activation at the moment so we won't be able to prioritise this review for another week or two.

@arya2 arya2 added do-not-merge Tells Mergify not to merge this PR and removed do-not-merge Tells Mergify not to merge this PR labels Aug 27, 2024
@sellout sellout force-pushed the rusty-zcash_script branch 2 times, most recently from 9d931b0 to 8449878 Compare August 30, 2024 20:09
@sellout sellout marked this pull request as ready for review August 30, 2024 20:19
@sellout sellout requested a review from a team as a code owner August 30, 2024 20:19
@sellout sellout requested review from arya2 and upbqdn and removed request for a team August 30, 2024 20:19
@sellout
Copy link
Contributor Author

sellout commented Aug 30, 2024

Re: the unchecked checkboxes

  • there are no visible changes to add to the CHANGELOG and
  • I don’t have permissions to add labels.

@arya2 arya2 added C-enhancement Category: This is an improvement A-script Area: Script handling P-Medium ⚡ rust Pull requests that update Rust code do-not-merge Tells Mergify not to merge this PR labels Aug 30, 2024
@arya2
Copy link
Contributor

arya2 commented Aug 30, 2024

Re: the unchecked checkboxes

  • there are no visible changes to add to the CHANGELOG and

We usually check boxes if they don't apply to the PR.

  • I don’t have permissions to add labels.

Added a priority label.

Added a do-not-merge label as well, we should wait until the changes in zcash_script have been published before merging this PR.

@arya2 arya2 added the S-blocked Status: Blocked on other tasks label Aug 30, 2024
@mpguerra
Copy link
Contributor

Added a do-not-merge label as well, we should wait until the changes in zcash_script have been published before merging this PR.

What's next here? I see ZcashFoundation/zcash_script#171 has merged

@conradoplg
Copy link
Collaborator

What's next here? I see ZcashFoundation/zcash_script#171 has merged

We should double check this PR works with zcash_script main branch, and then I can make a zcash_script release and we point to that instead.

@sellout
Copy link
Contributor Author

sellout commented Sep 23, 2024

We should double check this PR works with zcash_script main branch, and then I can make a zcash_script release and we point to that instead.

I can do this, but wondering how to show that it’s successful – should I put up a temporary PR that just fetches zcash_script from GH instead of the crate registry and shows that everything still passes? And we’ll just close it afterward?

Also, I’m happy for there to be a zcash_script release now, but I figured it would be fine to leave it until the next PR or two land on zcash_script, which contain the actual Rust implementation.

@conradoplg
Copy link
Collaborator

I fixed conflicts and tried to update the existing code but Rust is not happy the change from SighashCalculator to &SighashCalculator (to be honest I never understood why it even worked before). I'm not sure what the proper fix is or if it might require changing the zcash_script API.

This didn't turn up in zcash_script tests because there it always passes a regular function and not a closure.

@sellout is this something you can look into, or would you like for us to investigate?

@sellout
Copy link
Contributor Author

sellout commented May 15, 2025

This didn't turn up in zcash_script tests because there it always passes a regular function and not a closure.

@sellout is this something you can look into, or would you like for us to investigate?

Yeah, I’ll look at this. I’m making other changes in zcash_script now, so I’ll add a test with a closure and make sure that’s working.

@sellout
Copy link
Contributor Author

sellout commented May 15, 2025

@conradoplg I put up ZcashFoundation/zcash_script#216. I tried it against this branch (with some additional changes here) and it worked.

I think that counts as a bugfix release, as it doesn’t affect the cases that already worked. But there are changes in ZcashFoundation/zcash_script#209 (and others coming) that do affect the interface (although in fairly minor ways – like the set of Error variants).

@conradoplg conradoplg force-pushed the rusty-zcash_script branch from 8c61024 to 21e8eeb Compare May 16, 2025 23:01
@conradoplg conradoplg requested a review from a team as a code owner May 16, 2025 23:01
@conradoplg conradoplg force-pushed the rusty-zcash_script branch from 21e8eeb to d0f565f Compare May 16, 2025 23:12
@conradoplg
Copy link
Collaborator

This should be good to go. I did the simplest thing and just added a comparison-interpreter feature that enables the comparison interpreter.

I tested by manually pointing to my local copy of zcash_script, and adding a warning there just before the comparison check, regardless of the result, and confirmed the warning appeared if and only if the feature was enabled.

@conradoplg conradoplg removed the S-blocked Status: Blocked on other tasks label May 21, 2025
@conradoplg conradoplg removed their request for review May 21, 2025 22:51
@oxarbitrage oxarbitrage self-requested a review June 9, 2025 14:29
oxarbitrage
oxarbitrage previously approved these changes Jun 11, 2025
Copy link
Contributor

@oxarbitrage oxarbitrage left a comment

Choose a reason for hiding this comment

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

please fix conflicts.

@conradoplg
Copy link
Collaborator

please fix conflicts.

Oops, done

@conradoplg
Copy link
Collaborator

conradoplg commented Jun 12, 2025

I'm admin-merging this, because there is some CI issue making some jobs to be forever pending. We'll investigate the issue later with a external PR of our own. (My guess is some patch job issue)

@conradoplg conradoplg merged commit 8860770 into ZcashFoundation:main Jun 12, 2025
115 checks passed
@github-project-automation github-project-automation bot moved this from Review/QA to Done in Zebra Jun 12, 2025
@sellout sellout deleted the rusty-zcash_script branch June 12, 2025 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-script Area: Script handling C-enhancement Category: This is an improvement C-trivial Category: A trivial change that is not worth mentioning in the CHANGELOG no-review-reminders Turn off review reminders P-Medium ⚡ rust Pull requests that update Rust code
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants