trezor-firmware icon indicating copy to clipboard operation
trezor-firmware copied to clipboard

Add support for Zcash unified addresses - memory optimized

Open krnak opened this issue 2 years ago • 11 comments

specification: https://zips.z.cash/zip-0316 optimization: f4jumble now uses C blake2b module

krnak avatar Jul 23 '22 06:07 krnak

This PR is ready for review @andrewkozlik . I don't understand why CI core fw btconly build fails. There is no error message.

krnak avatar Jul 25 '22 15:07 krnak

I don't understand why CI core fw btconly build fails. There is no error message.

At the end of the log you can see

o%trezor/enums/ZcashReceiverTypecode.py
trezor/enums/ZcashReceiverTypecode.py

This is the output of tools/check-bitcoin-only. We should clarify the error message.

If you run the following commands you will get the same result.

BITCOIN_ONLY=1 make build_firmware
strings core/build/firmware/firmware.bin | grep Zcash

I think what you need to do is look at SConscript.firmware and SConscript.unix and exclude trezor/enums/Zcash*.py from the Bitcoin-only build.

andrewkozlik avatar Jul 25 '22 16:07 andrewkozlik

Thank you for clarification Andrew. I'm removing trezor/enums/Zcash*.py from btconly build in the fixup https://github.com/trezor/trezor-firmware/pull/2398/commits/2a18731b99d1ea9d8c30404f1efc95f629bb6c10 .

krnak avatar Jul 25 '22 19:07 krnak

may I squash and merge , or waiting for another review ? @andrewkozlik

krnak avatar Aug 02 '22 07:08 krnak

may I squash and merge , or waiting for another review ?

I will try to review today.

do we want to add this to the upcoming release?

Is there any reason not to?

andrewkozlik avatar Aug 02 '22 09:08 andrewkozlik

Is there any reason not to?

the freeze is today; my question is, are you as the main reviewer confident enough in this code to include it?

matejcik avatar Aug 02 '22 09:08 matejcik

the freeze is today; my question is, are you as the main reviewer confident enough in this code to include it?

I don't think we need to force this into the release, since Suite integration of unified addresses is not on the roadmap yet. So I am not sure this could be used in production by anyone in the nearest future.

On the other hand if we happen to merge this today somehow, then it's fine to include this in the freeze. (My apologies for not getting this reviewed earlier. I had a lot on my plate.)

andrewkozlik avatar Aug 02 '22 15:08 andrewkozlik

Let's merge after the freeze if there is no strong reason to merge it before.

prusnak avatar Aug 02 '22 15:08 prusnak

looks like this has all the approval it needs please squash the fixups, rebase on current master, and fix the UI fixtures conflict

matejcik avatar Aug 08 '22 10:08 matejcik

core fw regular debug build:

region `FLASH2' overflowed by 1024 bytes

:cry:

krnak avatar Aug 09 '22 07:08 krnak

Also, the address in test_unified_address has Invalid receivers order.

region `FLASH2' overflowed by 1024 bytes

Strange, I still have 4 kB left when I build with PYOPT=0 poetry run make -C core build_firmware on my machine.

code_length: 1696256
-rw-rw-r-- 1 andrew andrew  1699840 Aug  9 10:14 firmware.bin
-rwxrwxr-x 1 andrew andrew   786432 Aug  9 10:14 firmware.bin.p1
-rwxrwxr-x 1 andrew andrew   913408 Aug  9 10:14 firmware.bin.p2

andrewkozlik avatar Aug 09 '22 08:08 andrewkozlik

I rebased over the current master branch, which has ECMULT_GEN_PREC_BITS reduced from 4 to 2 to decrease the size of the precomputed tables for secp256k1-zkp, leaving more space in the flash memory.

andrewkozlik avatar Aug 30 '22 14:08 andrewkozlik