Following from https://github.com/ZcashFoundation/zebra/pull/105#issue-342371155:
- Many of the types in the structures that make up a
Transactionneed to be refined to assign them semantic meaning. The complete list can be found by runningrg 'XXX refine' -A 2inzebra/zebra-chain/src. Fleshing out many of these types will require further work – for instance, theZcash-flavored Ed25519 pubkeyin the JoinSplit data requires #109.
This issue should be closed when there are no more refinements left to do. Once #105 is merged, I will replace this description with a checklist of types to refine.
Amount type (#126)zebra-chain/src/transaction.rs
81: // XXX refine this to an Amount type.
82- value_balance: i64,
zebra-chain/src/transaction/joinsplit.rs
54: /// XXX refine to an Amount
55- vpub_old: u64,
--
59: /// XXX refine to an Amount
60- vpub_new: u64,
zebra-chain/src/transaction/transparent.rs
51: // XXX refine to Amount ?
52- pub value: u64,
53-
zebra-chain/src/transaction/joinsplit.rs
16: /// XXX refine type
17- pub nullifier: [u8; 32],
zebra-chain/src/transaction/shielded_data.rs
17: /// XXX refine to a specific type.
18- pub nullifier: [u8; 32],
One of these is a nullifier for Sprout, while the other is for Sapling – should these be the same type or different types?
zebra-chain/src/transaction/joinsplit.rs
20: /// XXX refine type
21- pub vmac: [u8; 32],
zebra-chain/src/transaction/joinsplit.rs
37: /// XXX refine type
38- pub commitment: [u8; 32],
zebra-chain/src/transaction/joinsplit.rs
41: /// XXX refine type
42- /// XXX this should be a [u8; 601] but we need trait impls.
43- pub enc_ciphertext: Vec<u8>,
zebra-chain/src/transaction/joinsplit.rs
65: /// XXX refine type
66- anchor: [u8; 32],
zebra-chain/src/transaction/joinsplit.rs
69: /// XXX refine to an x25519-dalek type?
70- ephemeral_key: [u8; 32],
zebra-chain/src/transaction/joinsplit.rs
88: // XXX refine to a Zcash-flavored Ed25519 pubkey.
89- pub pub_key: [u8; 32],
90- /// The JoinSplit signature.
91: // XXX refine to a Zcash-flavored Ed25519 signature.
92- // for now it's [u64; 8] rather than [u8; 64] to get trait impls
93- pub sig: [u64; 8],
zebra-chain/src/transaction/shielded_data.rs
11: /// XXX refine to a specific type.
12- pub cv: [u8; 32],
21: /// XXX refine to a specific type.
22- pub rk: [u8; 32],
23- /// The ZK spend proof.
--
30: /// XXX refine to a specific type: redjubjub signature?
31- /// XXX for now it's [u64; 8] instead of [u8; 64] to get trait impls
32- pub spend_auth_sig: [u64; 8],
--
77: // XXX refine this type to a RedJubjub signature.
78- // for now it's [u64; 8] rather than [u8; 64] to get trait impls
79- pub binding_sig: [u64; 8],
zebra-chain/src/transaction/shielded_data.rs
50: /// XXX refine to a specific type.
51- pub ephemeral_key: [u8; 32],
zebra-chain/src/transaction/shielded_data.rs
46: /// XXX refine to a specific type.
47- pub cmu: [u8; 32],
zebra-chain/src/transaction/shielded_data.rs
54: /// XXX refine to a specific type.
55- /// XXX this is a Vec<u8> rather than a [u8; 580] to get trait impls
56- pub enc_ciphertext: Vec<u8>,
--
59: /// XXX refine to a specific type.
60- /// XXX this is a [u64; 10] rather than a [u8; 80] to get trait impls
61- pub out_ciphertext: [u64; 10],
--
Requires #125.
Requires #126.
Updated the issue description to include a full list of types.
The ed25519-zebra crate will expose these types and can be refined when it is published: https://github.com/ZcashFoundation/ed25519-zebra
types related to note encryption (sprout):
This will be done better than existing when the proptest branch is merged in (they are basically dumb stub types for now but they are better than just Vec<u8>).
note encryption (sapling):
Same here.
Ticked the Ed25519 box; I think that the key agreement types should probably be part of the note encryption implementation.
As part of our Sprout key/address work, we're bringing in x25519_dalek and using *Secret and PublicKey types; the joinsplit ephemeral key type here should probably a x25519_dalek::PublicKey
Also taking over the rest of this issue @dconnolly
Most helpful comment
This will be done better than existing when the proptest branch is merged in (they are basically dumb stub types for now but they are better than just
Vec<u8>).Same here.