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

Use zcash_script’s new Script trait #8751

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

sellout
Copy link

@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
Author

sellout commented Aug 8, 2024

This depends on ZcashFoundation/zcash_script#171.

zebra-script/src/lib.rs Outdated Show resolved Hide resolved
@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.

zebra-script/src/lib.rs Show resolved Hide resolved
zebra-script/src/lib.rs Outdated Show resolved Hide resolved
zebra-script/src/lib.rs Outdated Show resolved Hide resolved
@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
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
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.

sellout added a commit to sellout/zcash_script that referenced this pull request Sep 27, 2024
Notably, `HashType` has changed incompatibly, so
ZcashFoundation/zebra#8751 will need to be updated.
sellout added a commit to sellout/zcash_script that referenced this pull request Sep 27, 2024
Notably, `HashType` has changed incompatibly, so
ZcashFoundation/zebra#8751 will need to be updated.
sellout added a commit to sellout/zebra that referenced this pull request Sep 29, 2024
Show that ZcashFoundation#8751 would work with a new zcash_script release.
sellout added a commit to sellout/zebra that referenced this pull request Sep 30, 2024
Show that ZcashFoundation#8751 would work with a new zcash_script release.
@sellout sellout requested a review from a team as a code owner September 30, 2024 00:29
@sellout
Copy link
Author

sellout commented Sep 30, 2024

You can simply change Cargo.toml in this PR to point zcash_script to a specific commit in its repo (i.e. the one corresponding to its current main), which I think would also make CI pass here.

Ok, this now points at the zcash_script master branch. I also made a PR (#8896, to be discarded) that shows that the current Zebra main branch (without this PR) will also work with the new zcash_script.

@mpguerra
Copy link
Contributor

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.

I guess @sellout has done this already in #8896?

@conradoplg shall we do the zcash_script release and merge this?

@sellout
Copy link
Author

sellout commented Oct 24, 2024

I should have ZcashFoundation/zcash_script#175 merged today, which is effectively an addendum to ZcashFoundation/zcash_script#171, so it’s probably worth getting that in before the release … and I think it will involve at least a small change to this PR as a consequence.

conradoplg pushed a commit to ZcashFoundation/zcash_script that referenced this pull request Oct 24, 2024
* Address Str4d’s comments on #171

Notably, `HashType` has changed incompatibly, so
ZcashFoundation/zebra#8751 will need to be updated.

* Apply suggestions from code review

Co-authored-by: Jack Grigg <[email protected]>

* Restrict bitflags used for `HashType` in v5 tx

---------

Co-authored-by: Jack Grigg <[email protected]>
@arya2 arya2 removed the do-not-merge Tells Mergify not to merge this PR label Dec 7, 2024
@mpguerra mpguerra added the no-review-reminders Turn off review reminders label Jan 13, 2025
@mpguerra mpguerra requested review from conradoplg and removed request for upbqdn and a team January 17, 2025 09:34
@mpguerra mpguerra removed the request for review from arya2 January 27, 2025 13:15
sellout and others added 3 commits January 29, 2025 19:42
This is a precursor to testing the Rust implementation of Zcash Script.
Show that ZcashFoundation#8751 would work with a new zcash_script release.
@github-actions github-actions bot added the C-trivial Category: A trivial change that is not worth mentioning in the CHANGELOG label Jan 30, 2025
@conradoplg
Copy link
Collaborator

I went ahead and updated this for the latest zcash_script which should be now working.

CI should fail only the cargo deny sources check since it's pointing to zcash_script master branch.

@sellout
Copy link
Author

sellout commented Jan 30, 2025

I wonder if the ZcashScript instance that’s used should be handled by a feature flag? I intended the CxxRustComparisonInterpreter to be mostly for testing, expecting one or the other to be in the release.

@conradoplg
Copy link
Collaborator

I wonder if the ZcashScript instance that’s used should be handled by a feature flag? I intended the CxxRustComparisonInterpreter to be mostly for testing, expecting one or the other to be in the release.

A feature flag sounds good. I seem to recall that the plan was to run both together for a while until we have assurance that the Rust one is equivalent, and then switch to the Rust one and get rid of the C++ one.

@nuttycom
Copy link

I wonder if the ZcashScript instance that’s used should be handled by a feature flag? I intended the CxxRustComparisonInterpreter to be mostly for testing, expecting one or the other to be in the release.

A feature flag sounds good. I seem to recall that the plan was to run both together for a while until we have assurance that the Rust one is equivalent, and then switch to the Rust one and get rid of the C++ one.

Yeah, I think it's important for some nodes to be running both simultaneously, taking the results from the C++ interpreter but loudly announcing any divergences. Probably even halting if there's a divergence, so that the node is left in a state where it's debuggable.

@oxarbitrage oxarbitrage added the do-not-merge Tells Mergify not to merge this PR label Feb 3, 2025
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 do-not-merge Tells Mergify not to merge this PR no-review-reminders Turn off review reminders P-Medium ⚡ rust Pull requests that update Rust code S-blocked Status: Blocked on other tasks
Projects
Status: Review/QA
Development

Successfully merging this pull request may close these issues.

6 participants