-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add legacy sigops counts to the zcash_script library API #5373
Conversation
@jvff What issue did you encounter that made this change necessary? Rust 2018 (which is the edition we use for the Rust code) explicitly allows both |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK modulo requested changes below, and my question above being addressed.
The issue is that not using mod.rs causes Cargo to look for sub-modules in the incorrect path. This is the error I get if I move
( |
Hmm, this seems like an issue related to the use of the |
Yes. I tried both with I'll add some more details below just to make sure there isn't a mistake I made and didn't see: janito:/project$ cat src/orchard_ffi.rs
include!("../depend/zcash/src/rust/src/orchard_ffi.rs");
janito:/project$ cat src/orchard_ffi/incremental_sinsemilla_tree_ffi.rs
include!("../../depend/zcash/src/rust/src/orchard_ffi/incremental_sinsemilla_tree_ffi.rs");
janito:/project$ cat src/incremental_sinsemilla_tree_ffi.rs
include!("../depend/zcash/src/rust/src/orchard_ffi/incremental_sinsemilla_tree_ffi.rs");
janito:/project$ cargo build
Compiling zcash_script v0.1.6-alpha.0 (/project)
error[E0583]: file not found for module `incremental_sinsemilla_tree_ffi`
--> src/../depend/zcash/src/rust/src/orchard_ffi.rs:22:1
|
22 | mod incremental_sinsemilla_tree_ffi;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: to create the module `incremental_sinsemilla_tree_ffi`, create file "src/../depend/zcash/src/rust/src/incremental_sinsemilla_tree_ffi.rs" or "src/../depend/zcash/src/rust/src/incremental_sinsemilla_tree_ffi/mod.rs"
For more information about this error, try `rustc --explain E0583`.
error: could not compile `zcash_script` due to previous error
janito:/project$ |
I found a Rust issue that describes this undocumented behaviour of Given that it's unlikely that issue will be resolved any time soon, I'm now -0 on altering our code to use 2015 edition module structure for this specific module. I'd prefer if |
Ideally, transparent script verification shouldn't need to pull in a C++ to Orchard FFI module.
We'd like to minimise (But we won't have time to remove any more dependencies for at least a month.) |
We need zcash/src/primitives/transaction.h Lines 329 to 386 in 5646dc7
We need zcash/src/script/interpreter.cpp Lines 1201 to 1224 in c4b2ef7
|
What about: mod ed25519;
mod history_ffi;
mod zip339_ffi;
mod test_harness_ffi; |
Hmm, actually it appears that the unnecessary structure is I think @nuttycom created this structure because it conceptually matches the |
Exposes
Only used by consensus code, not transaction parsing or Bitcoin script validation.
Only (going to be) used by wallet code.
Only used by |
Thanks, I've edited our dependency ticket. |
Don't compile it for `zcash_script`.
Co-authored-by: str4d <thestr4d@gmail.com>
Co-authored-by: str4d <thestr4d@gmail.com>
545e997
to
b96e266
Compare
Having this be a submodule of `orchard_ffi` while following Rust 2018 module structure made it impossible to use the `include!` macro on `orchard_ffi.rs`, which is exactly what the `zcash_script` crate does. See this comment for details: rust-lang/rust#50132 (comment) To resolve this, we restructure the FFI library crate to only have FFI methods in "leaf" module files.
b96e266
to
675e489
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
Just confirming that these changes work for Zebra: |
Purpose
This PR adds legacy sigops counts to the zcash_script library API.
This allows Zebra to check the
MAX_BLOCK_SIGOPS
consensus rule.This PR also splits
src/primitives/transaction.cpp
, to reducezcash_script
's dependencies.