Commit Graph

219 Commits

Author SHA1 Message Date
Deirdre Connolly e057e120bb Impl Display/FromStr/ZcashSerialize/ZcashDeserialize for Sprout SpendingKey
Includes new  field because the raw and Base58Check encoding depends on it.
2020-04-15 03:22:48 -04:00
Deirdre Connolly 6dc0830ea6 Impl Default for Network, as Mainnet 2020-04-15 03:22:48 -04:00
Deirdre Connolly e83cddf4c6 Impl Display/FromStr/ZcashSerialize/ZcashDeserialize for Sprout IncomingViewingKeys
To match the raw and Base58Check encodings as in
https://zips.z.cash/protocol/protocol.pdf#sproutinviewingkeyencoding
2020-04-15 03:22:48 -04:00
Deirdre Connolly 05ca1c0c8a Refine JoinSplit ephemeral keys to be x25519_dalek::PublicKey
Impls PartialEq and Eq and Arbitrary on JoinSplit because PublicKey
does not impl them and we can't do it directly.

Resolves #313
2020-04-13 15:32:04 -04:00
Deirdre Connolly 955a4ebc3c Rename SpendDescription to Spend, OutputDescription to Output 2020-04-09 17:17:21 -04:00
Deirdre Connolly 2a7838d8e5 Clear up doc comments on SpendingKey 2020-03-28 02:42:13 -04:00
Deirdre Connolly 760edf9271 Tidy *serialize for TransparentAddress with match on network 2020-03-28 02:42:13 -04:00
Deirdre Connolly a6d511eb71 s/weird/invalid/ 2020-03-28 02:42:13 -04:00
Deirdre Connolly 2e063998fb Add a new() and impl From<[u8; 32]> for SpendingKey
Currently fills/receives 32 random bytes and forces the top 4 bits to
zero, ala clamping. If there is a nicer way to csprng'ly fill 252 bits
without clamping, that would be nicer, less bias.
2020-03-28 02:42:13 -04:00
Deirdre Connolly 5f7f851481 Add an explicit test for Display trait on SproutShieldedAddress 2020-03-28 02:42:13 -04:00
Deirdre Connolly ba25817943 Impl FromStr, tidy Debug for SproutShieldedAddress 2020-03-28 02:42:13 -04:00
Deirdre Connolly 2bd0f53647 Impl FromStr, tidy Debug and Display impls for TransparentAddress 2020-03-28 02:42:13 -04:00
Deirdre Connolly 6e4c80c6f3 Make a note to update to the crates.io version of sha2 when available 2020-03-28 02:42:13 -04:00
Deirdre Connolly fa1fa60531 Use a match on network inside SproutShieldedAddress::zcash_serialize() 2020-03-28 02:42:13 -04:00
Deirdre Connolly afccdc3af6 Fix typos and doc comments 2020-03-28 02:42:13 -04:00
Deirdre Connolly 34f4bf05cd Tidy 2020-03-28 02:42:13 -04:00
Deirdre Connolly 9a20b20070 Better doc comment for IncomingViewingKey 2020-03-28 02:42:13 -04:00
Deirdre Connolly 3bad5304b2 Explicitly use sha2::compress256 2020-03-28 02:42:13 -04:00
Deirdre Connolly ffac1a33d7 Impl Debug for PayingKey 2020-03-28 02:42:13 -04:00
Deirdre Connolly 2fa566a35f Impl Debug and Display for SproutShieldedAddress 2020-03-28 02:42:13 -04:00
Deirdre Connolly caa06c901d Update zebra-chain/src/addresses/sprout.rs doc comment
Co-Authored-By: Daira Hopwood <daira@jacaranda.org>
2020-03-28 02:42:13 -04:00
Deirdre Connolly 66b33172e4 Impl Arbitrary for SproutShieldedAddress and add roundtrip test 2020-03-28 02:42:13 -04:00
Deirdre Connolly fae9da7dd9 Impl PartialEq and Eq for SproutShieldedAddress 2020-03-28 02:42:13 -04:00
Deirdre Connolly a7e5d37296 Use updated RustCrypto/hashes source of sha2 2020-03-28 02:42:13 -04:00
Deirdre Connolly 720a507ba3 Use compress feature flag with hashes crate and re-exported compress256 2020-03-28 02:42:13 -04:00
Deirdre Connolly 48dbcab00e Clippy tidy 2020-03-28 02:42:13 -04:00
Deirdre Connolly a241cb536a Add a TODO comment 2020-03-28 02:42:13 -04:00
Deirdre Connolly f84a8c682a Derive PayingKey's from SpendingKey's
And test that we can still derive TransmissionKey's from PayingKey's,
as they are aliases for x25519_dalek PublicKey/StaticSecret types that already
impl From<_> for each other.
2020-03-28 02:42:13 -04:00
Deirdre Connolly ee32de2b86 Derive Sprout ReceivingKey's from SpendingKey's via SHA256Compress
Test is incomplete, also the type aliases block us from impl'ing Debug or Display.
2020-03-28 02:42:13 -04:00
Deirdre Connolly bba58807bb Pull in fork of sha2 that exposes compress256 round function 2020-03-28 02:42:13 -04:00
Deirdre Connolly ecbd1bf825 Make ReceivingKey a type alias for x25519_dalek::StaticSecret
Plus some doc comments
2020-03-28 02:42:13 -04:00
Deirdre Connolly c836dcf3b6 Docs 2020-03-28 02:42:13 -04:00
Deirdre Connolly c3700c1a37 Update SproutShieldedAddress types
Use magics module.
Stub out key types, including a TransmissionKey alias for x25519_dalek::PublicKey
2020-03-28 02:42:13 -04:00
Deirdre Connolly 01afa09575 Move magic bytes to nested private modules for t-addrs 2020-03-28 02:42:13 -04:00
Deirdre Connolly 1e71793357 Filling out Sprout and Sapling Shielded Addresses 2020-03-28 02:42:13 -04:00
Deirdre Connolly 7af9b80f3b Add the beginnings of Sprout and Sapling key types 2020-03-28 02:42:13 -04:00
Deirdre Connolly b4832ab7cb Add x25519-dalek as dependency 2020-03-28 02:42:13 -04:00
Deirdre Connolly b03d70090f Module-level doc comments 2020-03-28 02:42:13 -04:00
Deirdre Connolly ea773c7a4b Add module-level doc comment for keys/transparent.rs 2020-03-28 02:42:13 -04:00
Deirdre Connolly 532bbaf460 Impl zcash_deserialize for secp256k1::PublicKey 2020-03-28 02:42:13 -04:00
Deirdre Connolly 3fbfd10f2c Finish migration of TransparentAddress out of addresses.rs 2020-03-28 02:42:13 -04:00
Deirdre Connolly 7ea39fbdce Use secp256k1 serde flag to make keys serializable 2020-03-28 02:42:13 -04:00
Deirdre Connolly bd247067ae Move TransparentAddress stuff to its own module 2020-03-28 02:42:13 -04:00
Henry de Valence 824193eeeb Add block 434873 with a bad version field. 2020-03-18 21:34:02 -04:00
Henry de Valence 6ec934a8d7 impl FromStr for BlockHeaderHash
This is very convenient for putting block hashes in the source code.
2020-03-18 21:34:02 -04:00
Henry de Valence dd8ba287bf Correct block version parsing. 2020-03-18 21:34:02 -04:00
Deirdre Connolly 2a155cadfc Fix some clippy lints 2020-03-12 22:02:17 -04:00
Deirdre Connolly b9240971fd Add impl Arbitrary for TransparentAddress and a roundtrip proptest
addresses.rs is now large with just transparent stuff, i am already planning to break this up
further in the addresses/ module.
2020-03-12 22:02:17 -04:00
Deirdre Connolly 4b53c2eac3 Remove AddressPayloadHash, move hashing to TransparentAddress method 2020-03-12 22:02:17 -04:00
Deirdre Connolly a5f4db7528 Move just the Network enum to -chain, keep everything else in -network 2020-03-12 22:02:17 -04:00