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

Compute the tx SIGHASH only once per tx verification #9165

Open
upbqdn opened this issue Jan 24, 2025 · 2 comments
Open

Compute the tx SIGHASH only once per tx verification #9165

upbqdn opened this issue Jan 24, 2025 · 2 comments
Labels
I-slow Problems with performance or responsiveness P-Optional ✨

Comments

@upbqdn
Copy link
Member

upbqdn commented Jan 24, 2025

The tx SIGHASH is currently computed twice per tx verification:

It is currently not possible to compute the SIGHASH only once because the transparent data verification is done over FFI, and the FFI API doesn't allow passing a precomputed SIGHASH. Once we have the new transparent script engine implemented in Rust, it would be beneficial to be able to pass a precomputed SIGHASH to it, and refactor Zebra's code so that the SIGHASH is computed only once.

@conradoplg
Copy link
Collaborator

It is currently not possible to compute the SIGHASH only once because the transparent data verification is done over FFI, and the FFI API doesn't allow passing a precomputed SIGHASH.

It does! After the last refactoring, zcash_script takes the same sighash context that we use in Rust, because the sighash is computed by the caller via a callback. I noticed that too but forgot to create an issue about it.

@upbqdn
Copy link
Member Author

upbqdn commented Jan 30, 2025

Great! I didn't look thoroughly enough. I think this is worth doing some time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-slow Problems with performance or responsiveness P-Optional ✨
Projects
Status: New
Development

No branches or pull requests

2 participants