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

Zcash shielded transactions #2472

Draft
wants to merge 74 commits into
base: zcash-rust-primitives
Choose a base branch
from
Draft

Conversation

@krnak krnak requested review from matejcik and prusnak as code owners August 26, 2022 19:48
@krnak krnak marked this pull request as draft August 26, 2022 19:49
@krnak krnak mentioned this pull request Aug 26, 2022
43 tasks
@krnak krnak force-pushed the zcash-orchard branch 2 times, most recently from 080d13c to f544513 Compare September 20, 2022 12:42
@krnak krnak marked this pull request as ready for review September 20, 2022 12:45
@krnak krnak changed the title Zcash Shielded Payments Zcash shielded transactions Oct 11, 2022
Copy link
Contributor

@matejcik matejcik left a comment

Choose a reason for hiding this comment

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

Partial review only.

I did not review the cryptography. Engineering side, PR is looking good, and we can address outstanding code quality issues. In particular, it will be necessary for us to take over so that we can make this play nicely with some upcoming PRs.

common/protob/messages-zcash.proto Outdated Show resolved Hide resolved
common/protob/messages-binance.proto Outdated Show resolved Hide resolved
common/protob/messages-bitcoin.proto Outdated Show resolved Hide resolved
common/protob/messages-bitcoin.proto Outdated Show resolved Hide resolved
common/protob/messages-zcash.proto Outdated Show resolved Hide resolved
core/src/trezor/crypto/curve.py Outdated Show resolved Hide resolved
core/src/trezor/crypto/pallas.py Outdated Show resolved Hide resolved
python/src/trezorlib/cli/zcash.py Outdated Show resolved Hide resolved
python/src/trezorlib/cli/zcash.py Outdated Show resolved Hide resolved
python/src/trezorlib/zcash.py Outdated Show resolved Hide resolved
Copy link
Contributor

@matejcik matejcik left a comment

Choose a reason for hiding this comment

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

This is a full review of the core code. I still haven't looked at tests, and I haven't looked in full at the trezorlib code.

"More tests" are missing, in particular tests for ZcashGetAddress and ZcashGetViewingKey

in a lot of places there are missing type annotations. I have noted some, I'll try to figure out how to make the typechecker report them.

Feel free to squash the fixups up to now before continuing -- or not, up to you.
Ideally please rebase this on top of the current Rust PR state, and set the target branch to the Rust PR, so that it's clearer which commits belong to the Python part.

common/protob/messages.proto Outdated Show resolved Hide resolved
core/embed/firmware/memory_T.ld Outdated Show resolved Hide resolved
core/src/apps/bitcoin/sign_tx/progress.py Show resolved Hide resolved
core/src/apps/zcash/unified.py Outdated Show resolved Hide resolved
core/src/apps/zcash/unified.py Outdated Show resolved Hide resolved
core/src/apps/zcash/orchard/crypto/keys.py Outdated Show resolved Hide resolved
core/src/apps/zcash/orchard/crypto/ff1.py Outdated Show resolved Hide resolved
core/src/apps/zcash/orchard/crypto/ff1.py Outdated Show resolved Hide resolved
core/src/apps/zcash/orchard/crypto/ff1.py Outdated Show resolved Hide resolved
core/src/apps/zcash/orchard/crypto/ff1.py Outdated Show resolved Hide resolved
@krnak
Copy link
Contributor Author

krnak commented Nov 17, 2022

rebased to actual Rust PR

@krnak krnak changed the base branch from master to zcash-rust-primitives November 17, 2022 05:49
if not (msg.t_address_n or msg.z_address_n):
raise wire.DataError("t-address or z-address path expected")

coin = by_name(msg.coin_name)
Copy link
Contributor

Choose a reason for hiding this comment

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

ah, one thing I didn't notice before: this code is not actually showing the path warnings.

both get_raw_transparent and get_raw_orchard should contain code like this:

if msg.show_display:
    await paths.validate_path(ctx, keychain, address_n)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

async def get_viewing_key(
ctx: Context, msg: ZcashGetViewingKey, keychain: OrchardKeychain
) -> ZcashViewingKey:
await require_confirm_export_viewing_key(ctx, msg)
Copy link
Contributor

Choose a reason for hiding this comment

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

please add await paths.validate_path(ctx, keychain, msg.z_address_n) before this line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

self.rng = None

async def process_inputs(self) -> None:
await self.check_orchard_inputs_count()
Copy link
Contributor

Choose a reason for hiding this comment

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

please add something like:

if not SCHEMA_ZIP32.match(self.params.address_n):
    await helpers.confirm_foreign_path(self.params.address_n)

(see also BasicApprover.add_internal_input)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@krnak
Copy link
Contributor Author

krnak commented Dec 27, 2022

device tests finished

@Hannsek Hannsek marked this pull request as draft April 14, 2023 11:51
@Hannsek Hannsek added the blocked Blocked by external force. Third party inputs required. label Apr 14, 2023
@matejcik
Copy link
Contributor

(converted to draft during PR cleanup. the status indicates that this is not ready for review / merging, but still needs additional work from our side)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Blocked by external force. Third party inputs required.
Projects
Status: 🏃‍♀️ In progress
Development

Successfully merging this pull request may close these issues.

3 participants