Deirdre Connolly
42999b2112
Remove FromStr impls for orchard keys for now, pending Unifed versions of those
...
Also modify the string encoding/decoding rountrip proptest to be just an exerciser of the keygen
for now.
2021-04-30 00:48:23 -04:00
Deirdre Connolly
6d4ecff24b
Pin halo2 commit and update usage of pasta_curves accordingly
2021-04-30 00:48:23 -04:00
Deirdre Connolly
9b6339bb9c
Add link to funty pin removal issue
2021-04-30 00:48:23 -04:00
Deirdre Connolly
f5206af470
Rename all Orchard spec references to nu5.pdf
2021-04-30 00:48:23 -04:00
Deirdre Connolly
26fc6b1908
Doing math in u16 collector obviates passing of Bit(Slice/Vector)
...
But I added a max 10-bit value check in S() on j.
2021-04-30 00:48:23 -04:00
Deirdre Connolly
af32851aa1
Add TODO to fill in the Sinsemilla test vectors from zcash-hackworks
2021-04-30 00:48:23 -04:00
Deirdre Connolly
aa81876e32
Move Value Commitment generator points into static via lazy_static
2021-04-30 00:48:23 -04:00
Deirdre Connolly
39b8e9859f
Do not derive Hash for orchard::Nullifier as pallas::Base doesn't have it
...
If we need Hash, we may need to replace the inner type with bytes.
2021-04-30 00:48:23 -04:00
Deirdre Connolly
70bf4f80fb
Add TODO for Poseidon hash implementation
2021-04-30 00:48:23 -04:00
Deirdre Connolly
d7d8986849
Tidy up network handling for Orchard keys/addresses
2021-04-30 00:48:23 -04:00
Deirdre Connolly
ee2c3af937
Remove Copy on ZkSnarkProof trait
2021-04-30 00:48:23 -04:00
Deirdre Connolly
a1a59a7f76
Clean up orchard::tree tests for now
2021-04-30 00:48:23 -04:00
Deirdre Connolly
6efe558675
Clean up Arbitray impl for Halo2Proof
2021-04-30 00:48:23 -04:00
Deirdre Connolly
32480ab3d9
Add redpallas TODO
2021-04-30 00:48:23 -04:00
Deirdre Connolly
86c3b69720
IncomingViewingKey inherits network when derived from FullViewingKey
2021-04-30 00:48:23 -04:00
Deirdre Connolly
5159046578
Add link to redpallas follow-up
2021-04-30 00:48:23 -04:00
Deirdre Connolly
d33947b331
Impl FullViewingKey::from_spending_key(SpendingKey, Network)
...
Remove From impl
2021-04-30 00:48:23 -04:00
Deirdre Connolly
4fd98f6eb1
Link to redpallas TODO
2021-04-30 00:48:23 -04:00
Deirdre Connolly
1ff84c3d43
Refer to const generics issue
2021-04-30 00:48:23 -04:00
Deirdre Connolly
d8d25d1a82
Add TODO
2021-04-30 00:48:23 -04:00
Deirdre Connolly
698f9620da
Clippy +nightly
2021-04-30 00:48:23 -04:00
Deirdre Connolly
4ee12d1170
Clippy lint to align order of members of redpallas::VerificationKey
2021-04-30 00:48:23 -04:00
Deirdre Connolly
48674a9749
Remove standalone Orchard address Display, FromStr impls and related parts
...
NU5 proposes Unified Addresses, which would supplant any classic standalone pool address for Orchard.
https://github.com/ZcashFoundation/zebra/pull/1885#discussion_r607000460
2021-04-30 00:48:23 -04:00
Deirdre Connolly
72491df4ff
orchard: move IncomingViewingKey::from([u8; 32]) to a ::from_bytes([u8; 32], Newtwork)
2021-04-30 00:48:23 -04:00
Deirdre Connolly
8d357faf73
Tried and discarded lazy_static! of value commitment generator points
2021-04-30 00:48:23 -04:00
Deirdre Connolly
638ff8d7f8
Bump redjubjub
2021-04-30 00:48:23 -04:00
Deirdre Connolly
81038e0fcb
orchard: ValueCommit ops implementation tests
2021-04-30 00:48:23 -04:00
Deirdre Connolly
db8f9cb81a
orchard: Better Debug impls for some keys
2021-04-30 00:48:23 -04:00
Deirdre Connolly
eb68caf14c
Orchard: update Debug impl for commitments
2021-04-30 00:48:23 -04:00
Deirdre Connolly
cc2e58fade
Remove done TODO
2021-04-30 00:48:23 -04:00
Deirdre Connolly
376603d4c0
Flesh out Orchard note and nullifier derivation
2021-04-30 00:48:23 -04:00
Deirdre Connolly
37c32e9c94
Apply docstring suggestions from code review
...
Co-authored-by: teor <teor@riseup.net>
2021-04-30 00:48:23 -04:00
Deirdre Connolly
195d3f106c
Revert making sapling::note::Nullifier inner value private
2021-04-30 00:48:23 -04:00
Deirdre Connolly
44966326c1
Orchard: turns out you can't store 10 bits in a u8
2021-04-30 00:48:23 -04:00
Deirdre Connolly
5e95d11fd9
Orchard: fix typos
2021-04-30 00:48:23 -04:00
Deirdre Connolly
34fe78bd0c
Fix str match for key and addr decoding
2021-04-30 00:48:23 -04:00
Deirdre Connolly
ec5d3a647f
Remove commented out orchard::Address FromStr/Display test vector test for now
2021-04-30 00:48:23 -04:00
Deirdre Connolly
f067a25d50
Update zebra-chain/src/orchard/address.rs
...
Co-authored-by: teor <teor@riseup.net>
2021-04-30 00:48:23 -04:00
Deirdre Connolly
f577cb8eb4
Update zebra-chain/src/orchard/address.rs
...
Co-authored-by: teor <teor@riseup.net>
2021-04-30 00:48:23 -04:00
Deirdre Connolly
b23093ca66
Update zebra-chain/src/orchard/keys.rs
...
Co-authored-by: teor <teor@riseup.net>
2021-04-30 00:48:23 -04:00
Deirdre Connolly
bbb6b341ae
Update zebra-chain/src/orchard/keys.rs
...
Co-authored-by: teor <teor@riseup.net>
2021-04-30 00:48:23 -04:00
Deirdre Connolly
a73914a838
Update zebra-chain/src/orchard/keys.rs
...
Co-authored-by: teor <teor@riseup.net>
2021-04-30 00:48:23 -04:00
Deirdre Connolly
bba99098f3
Update zebra-chain/src/orchard/keys.rs
...
Co-authored-by: teor <teor@riseup.net>
2021-04-30 00:48:23 -04:00
Deirdre Connolly
e2989e3edf
Update zebra-chain/src/orchard/keys.rs
...
Co-authored-by: teor <teor@riseup.net>
2021-04-30 00:48:23 -04:00
Deirdre Connolly
e4fe8bb320
Update zebra-chain/src/orchard/note/nullifiers.rs
...
Co-authored-by: teor <teor@riseup.net>
2021-04-30 00:48:23 -04:00
Deirdre Connolly
81da8363a8
Update zebra-chain/src/orchard/sinsemilla.rs
...
Co-authored-by: teor <teor@riseup.net>
2021-04-30 00:48:23 -04:00
Deirdre Connolly
dbd2ce6dd8
Update zebra-chain/src/orchard/sinsemilla.rs
...
Co-authored-by: teor <teor@riseup.net>
2021-04-30 00:48:23 -04:00
Deirdre Connolly
ebe0c002a9
Update zebra-chain/src/orchard/sinsemilla.rs
...
Co-authored-by: teor <teor@riseup.net>
2021-04-30 00:48:23 -04:00
Deirdre Connolly
8461c2153e
Update diversify_hash and its use to match spec updates
2021-04-30 00:48:23 -04:00
Deirdre Connolly
73e0f4f98a
Orchard: fix some tests, etc
2021-04-30 00:48:23 -04:00
Deirdre Connolly
87f65b8b01
Orchard: update merkle_crh_orchard to use the appropriate l=10 bits, not 6
2021-04-30 00:48:23 -04:00
Deirdre Connolly
1ff8874b8d
Orchard: remove unused imports, more warn(missing_docs) lint to orchard for now
2021-04-30 00:48:23 -04:00
Deirdre Connolly
5ede33b231
Orchard: update nullifiers
2021-04-30 00:48:23 -04:00
Deirdre Connolly
c892b93f61
Orchard: update merkle_crh_orchard correctly
2021-04-30 00:48:23 -04:00
Deirdre Connolly
218bb9b7c2
Orchard: remove unused imports
2021-04-30 00:48:23 -04:00
Deirdre Connolly
f3501333b7
Orchard: tidy
2021-04-30 00:48:23 -04:00
Deirdre Connolly
1c903cab0f
Orchard: fix into() call inside extract_x
2021-04-30 00:48:23 -04:00
Deirdre Connolly
94edc90975
Orchard: derive serde::{Deserialize, Serialize} by default on redpallas::VerificationKeyBytes
2021-04-30 00:48:23 -04:00
Deirdre Connolly
d11a4419ac
Orchard: add a serde helper for pallas::Base
2021-04-30 00:48:23 -04:00
Deirdre Connolly
41a41db923
Sapling: use try_from turbofish inside prf_ock
2021-04-30 00:48:23 -04:00
Deirdre Connolly
0351e6481d
Orchard: tidy keys
2021-04-30 00:48:23 -04:00
Deirdre Connolly
e85359c756
Orchard: tidy
2021-04-30 00:48:23 -04:00
Deirdre Connolly
d3f0b226e6
Orchard: tidy nullifiers
2021-04-30 00:48:23 -04:00
Deirdre Connolly
b93a71c779
Orchard: borrow local.bytes for pallas::Affine serde helper
2021-04-30 00:48:23 -04:00
Deirdre Connolly
009e1dd37e
Orchard: some Action (de)serialization fixes
2021-04-30 00:48:23 -04:00
Deirdre Connolly
f3cf6966a5
Orchard: tidy commitments etc
2021-04-30 00:48:23 -04:00
Deirdre Connolly
cb9d6956d7
Orchard: Fix trait imports and Arbitrary for Action
2021-04-30 00:48:23 -04:00
Deirdre Connolly
981080f049
Orchard: Tidy Debug impl's for keys, cast a pallas::Base into a pallas::Scalar
2021-04-30 00:48:23 -04:00
Deirdre Connolly
6e51671c93
Tidy prf's
2021-04-30 00:48:23 -04:00
Deirdre Connolly
120b065a94
Action should use VerificationKeyBytes
2021-04-30 00:48:23 -04:00
Deirdre Connolly
570ad6e914
Add redpallas::signing_key::SigningKey stub
2021-04-30 00:48:23 -04:00
Deirdre Connolly
01fed3e0f3
Tidy impl From<SpendingKey> for IvkCommitRandomness
2021-04-30 00:48:23 -04:00
Deirdre Connolly
bd4e5e1f38
Cleanup
2021-04-30 00:48:23 -04:00
Deirdre Connolly
df1ecc72b1
Most things are filled in, including a guess at Pallas-based Mixing Pedersen Hash
2021-04-30 00:48:23 -04:00
Deirdre Connolly
23e391894b
Tidy
2021-04-30 00:48:23 -04:00
Deirdre Connolly
de051c727c
orchard: DiversifierKey is a newtype refinement of 32 bytes
2021-04-30 00:48:23 -04:00
Deirdre Connolly
fd29708ecc
orchard: derive IncomingViewingKey from FullViewingKey
...
Includes sinsemilla commit and short commit
2021-04-30 00:48:23 -04:00
Deirdre Connolly
6e1d2f1fb1
orchard: impl From<SpendingKey> for NullifierDerivingKey
2021-04-30 00:48:23 -04:00
Deirdre Connolly
f50d8697d4
impl orchard SpendingKey::new()
2021-04-30 00:48:23 -04:00
Deirdre Connolly
20abeda04b
Add sapling prf_ock and generate_trapdoor
2021-04-30 00:48:23 -04:00
Deirdre Connolly
c3e40d73cf
Bunch more work implementing orchard, porting from sapling where applicable
2021-04-30 00:48:23 -04:00
Deirdre Connolly
40383b2741
Partway done with typing out Orchard chain types
2021-04-30 00:48:23 -04:00
teor
b52fbae30f
Fix a bad merge in #2075 ( #2085 )
...
Also tweak a constant name, an import, and a comment.
2021-04-29 17:47:10 +10:00
Alfredo Garcia
9fc2388fbc
Parse ConsensusBranchId into NetworkUpgrade for transaction v5 ( #2075 )
...
* add consensus_branch_id field to transaction v5
* clippy
* rustfmt
* replace consensus_branch_id with network_upgrade
* remove unintended test files
* change method name
* some clanups
* add network_upgrade as a constant in tests
* use std in created function
* add comment to manual arbitrary impl
* create custom strategy to deal with NetworkUpgrade
* Add a missing TODO comment
Co-authored-by: teor <teor@riseup.net>
2021-04-29 01:55:29 +00:00
Alfredo Garcia
75d29aca24
Add V5 transparent and sapling to transaction::check, add missing coinbase PrevOut check ( #2070 )
...
* validate sapling v5 tx
* Make itertools dependency optional
We only need itertools when the `proptest-impl` feature is enabled.
* Check if V4 and V5 coinbase transactions contain PrevOut transparent inputs
This is a bugfix on V4 transaction validation. The PrevOut consensus
rule was not explicitly stated in the Zcash spec until April 2021.
(But it was implied by Bitcoin, and partially implemented by Zebra.)
Also do the shielded sapling input check for V5 transactions.
* Add spec and orchard TODOs to has_inputs_and_outputs
Also make the variable names match the spec.
* Sort transaction functions to match v5 data order
* Simplify transaction input and output checks
Move counts or iterators into `Transaction` methods, so we can remove
duplicate code, and make the consensus rule logic clearer.
* Update sapling_balances_match for Transaction v5
- Quote from the spec
- Explain why the function is redunant for v5
- Rename the function so it's clear that it is sapling-specific
Co-authored-by: teor <teor@riseup.net>
2021-04-28 10:43:00 +10:00
teor
247620320e
Rename shielded_data to sapling_shielded_data as needed ( #2072 )
...
This change help avoid bugs that confuse sapling with orchard (or sprout).
```sh
fastmod shielded_data sapling_shielded_data
```
2021-04-27 10:37:53 -03:00
teor
1f40498fcf
Clippy nightly: disable owned cmp, stop comparing bool using assert_eq ( #2073 )
...
* Disable clippy warnings about comparing a newly created struct
In Sapling, we compare canonical JubJub bytes with a supplied byte array.
Since we need to perform calculations to get it into canonical form, we
need to create a newly owned object.
* Clippy: use assert rather than assert_eq on a bool
2021-04-27 09:57:45 -03:00
Alfredo Garcia
a49b9d44f6
Enable more Transaction v5 tests ( #2063 )
...
* Use NU5 and Transaction v5 in most proptests
* Stop skipping post-Canopy blocks in the block subsidy tests
Co-authored-by: teor <teor@riseup.net>
2021-04-26 08:32:21 +10:00
teor
0d8ffc367e
Move LedgerState into the block module
2021-04-23 09:34:13 -04:00
teor
9b3d56db0c
Update network_upgrade.rs ( #2058 )
2021-04-23 10:23:43 -03:00
Pili Guerra
ea1446ee92
Update version strings for Zebra v1.0.0-alpha.7 release ( #2056 )
...
* Update version strings for Zebra v1.0.0-alpha.7 release
2021-04-23 12:56:25 +00:00
Alfredo Garcia
e730e84a09
remove the `rest` field of v5 transaction ( #2057 )
2021-04-23 16:25:44 +10:00
teor
7b13d5573a
Make String Zcash serialization consistent with deserialization
...
After recent changes, serialization was `write_string`, but
deserialization was `zcash_deserialize`.
2021-04-21 23:58:48 -04:00
teor
96b3c94dbc
Add the new commit count and git hash to the version ( #2038 )
...
* Use the git version + new commit count + hash for the app version
This helps diagnose bugs in versions of Zebra built from git branches,
rather than git version tags.
* Fill in assert
* Also log semver string
* Fix syntax
* Handle vergen using the cargo package version or raw git tag
* s/Semver/SemVer/
Co-authored-by: Deirdre Connolly <durumcrustulum@gmail.com>
2021-04-21 22:14:36 +00:00
teor
d3836e6fd8
Move spends_per_anchor to TransferData
...
And update its docs for ZIP-244
2021-04-21 01:32:00 -04:00
teor
53779d2a3c
Redesign Sapling data model for V5 shared anchor and spends ( #2021 )
...
* Redesign Sapling data model for V5 shared anchor and spends
The shared anchor is only present if there are any spends.
As part of this change, delete the manual PartialEq impl and its tests,
because we can derive PartialEq now.
* Stop creating a temporary Vec for the spend and output iterators
* Rename TransferData variants
Interactive rename using the following commands:
```sh
fastmod Spends SpendsAndMaybeOutputs
fastmod NoSpends JustOutputs
```
* Refactor out common sprout nullifier code
* Implement the AtLeastOne constrained vector type
This vector wrapper ensures that it always contains at least one element.
* Simplify Sapling TransferData using AtLeastOne
Also update the RFC to use AtLeastOne for Orchard.
2021-04-20 16:22:25 +10:00
Kirill Fomichev
43e792b9a4
Update to vergen 5, add branch, commit time, and build target to the panic metadata, automatically update app version from crate version ( #2029 )
...
* build(deps): bump vergen from 3.2.0 to 5.1.1
* fix hardcoded version for Tracing struct
* add additional metadata
* remove extra allocations for metadata
* Remove zebrad code version from release checklist
The zebrad code automatically uses the crate version now.
* Sort panic metadata into rough categories
Co-authored-by: teor <teor@riseup.net>
2021-04-20 06:48:14 +10:00
Kirill Fomichev
b636cf8ac1
Benchmark Block struct serialization code ( #2018 )
...
* Benchmark Block struct serialization code
* benchmark generated block
* add deserialize benchmark
* Fix block/tests.rs conditional module imports
* add large_single_transaction_block
* Fix name for deserialise benchmark
Co-authored-by: teor <teor@riseup.net>
2021-04-19 12:15:02 +00:00
Kirill Fomichev
5f36be7223
build(deps): bump ripemd160 from 0.8.0 to 0.9.1 ( #2027 )
2021-04-19 20:43:38 +10:00
teor
b9ac221ad4
Implement Sapling serialization in Transaction V5 ( #2020 )
...
* serialize/deserialize spaling shielded data in v5 transaction
* fix serialize/deserialize fields order according to spec
* remove extra clone calls
* more serialize fixes
* clippy: fix empty array
* tidy comments
* Add v4 and v5 transaction tests
Also make sure that serialized bytes match if structs match.
* Test fake v5 blocks made out of pre-NU5 block test vectors
* Add outputs-only tests for v5 shared anchor serialization
* Refactor sapling::ShieldedData V5 serialization into its own impl
* Fix spec name typos
* Simplify sapling shielded data parsing
* Delete redundant V5 transaction wrappers in tests
And split out sapling ShieldedData serialization.
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
2021-04-19 08:09:57 +10:00