Skip to content

Commit

Permalink
Merge pull request #16 from ZcashFoundation/jane/precompute
Browse files Browse the repository at this point in the history
Prior to this PR the zcash script verification logic in zebra has had an issue with quadratic serialization of transactions when verifying scripts. In the script verification API each input is verified individually. This would be fine, except for the fact that we also have to deal with FFI to another language with a different representation for transactions, which requires that we serialize and deserialize each transaction for each call into c++ code.

This PR solves this problem by exporting the newly setup "precomputed transaction" API, which lets us serialize our transaction once, pass it over, have zcash_script deserialize it once, and then pass us a `void*` pointer to the data they'd need for future function calls to verify individual transaction inputs. We then hold onto this pointer and pass it back into the C++ code for each input we verify, which prevents us from needing to do any more serialization for the duration of that transaction verification.
  • Loading branch information
yaahc committed Dec 10, 2020
2 parents 848eb05 + 3d0b6b7 commit 7c1a797
Show file tree
Hide file tree
Showing 598 changed files with 15,666 additions and 17,544 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased] - ReleaseDate

## [0.1.5] - 2020-12-09
### Changed
- Updated `depend/zcash` to new version including a precompute API

## [0.1.4] - 2020-11-17
### Changed
- switched from bindgen `0.55` to bindgen `0.54` to avoid a dependency
Expand All @@ -33,7 +37,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Updated `bindgen` to a non yanked version

<!-- next-url -->
[Unreleased]: https://github.com/ZcashFoundation/zcash_script/compare/v0.1.4...HEAD
[Unreleased]: https://github.com/ZcashFoundation/zcash_script/compare/v0.1.5...HEAD
[0.1.5]: https://github.com/ZcashFoundation/zcash_script/compare/v0.1.4...v0.1.5
[0.1.4]: https://github.com/ZcashFoundation/zcash_script/compare/v0.1.3...v0.1.4
[0.1.3]: https://github.com/ZcashFoundation/zcash_script/compare/v0.1.2...v0.1.3
[0.1.2]: https://github.com/ZcashFoundation/zcash_script/compare/v0.1.1...v0.1.2
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zcash_script"
version = "0.1.5-alpha.0"
version = "0.1.6-alpha.0"
authors = ["Tamas Blummer <tamas.blummer@gmail.com>", "Zcash Foundation <zebra@zfnd.org>"]
license = "Apache-2.0"
readme = "README.md"
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,11 @@
[docs-url]: https://docs.rs/zcash_script

Rust bindings to the ECC's `zcash_script` c++ library.

### Updating `depend/zcash`

To pull in recent changes from the upstream repo run the following:

```console
git subtree pull -P depend/zcash <repo> <branch> --squash
```
2 changes: 2 additions & 0 deletions depend/zcash/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ src/zcash-cli
src/zcash-gtest
src/zcash-tx
src/test/test_bitcoin
zcutil/bin/

*zcashTest.pk
*zcashTest.vk
Expand Down Expand Up @@ -116,5 +117,6 @@ libzcash_script.pc
contrib/debian/files
contrib/debian/substvars

src/fuzzing/*/input
src/fuzzing/*/output
src/fuzz.cpp
5 changes: 0 additions & 5 deletions depend/zcash/COPYING
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ source code is not considered a derived work of these Autoconf macros or of the
dependencies. For further details see 'contrib/debian/copyright'.


This product includes software developed by the OpenSSL Project for use in the
OpenSSL Toolkit (https://www.openssl.org/). This product includes cryptographic
software written by Eric Young (eay@cryptsoft.com).


Although almost all of the Zcash code is licensed under "permissive" open source
licenses, users and distributors should note that when built using the default
build options, Zcash depends on Oracle Berkeley DB 6.2.x, which is licensed
Expand Down
Loading

0 comments on commit 7c1a797

Please sign in to comment.