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

Finish refining all primitive types brought in by Transaction data. #123

Closed
13 tasks done
hdevalence opened this issue Nov 28, 2019 · 8 comments · Fixed by #596
Closed
13 tasks done

Finish refining all primitive types brought in by Transaction data. #123

hdevalence opened this issue Nov 28, 2019 · 8 comments · Fixed by #596
Assignees
Labels
A-dependencies Area: Dependency file updates A-rust Area: Updates to Rust code
Projects

Comments

@hdevalence
Copy link
Contributor

hdevalence commented Nov 28, 2019

Following from #105 (comment):

  1. Many of the types in the structures that make up a Transaction need to be refined to assign them semantic meaning. The complete list can be found by running rg 'XXX refine' -A 2 in zebra/zebra-chain/src. Fleshing out many of these types will require further work – for instance, the Zcash-flavored Ed25519 pubkey in the JoinSplit data requires Zcash-flavored Ed25519 #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.

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?

  • a MAC type
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],
  • types related to note encryption (sprout):
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],
  • a sapling value commitment type:
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],
  • note encryption (sapling):
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],
--
@hdevalence
Copy link
Contributor Author

Requires #125.

@hdevalence
Copy link
Contributor Author

Requires #126.

@hdevalence
Copy link
Contributor Author

Updated the issue description to include a full list of types.

@dconnolly dconnolly moved this from To Do to In progress in 🦓 Dec 12, 2019
@dconnolly
Copy link
Contributor

The ed25519-zebra crate will expose these types and can be refined when it is published: https://github.com/ZcashFoundation/ed25519-zebra

@dconnolly
Copy link
Contributor

dconnolly commented Jan 23, 2020

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.

@dconnolly dconnolly self-assigned this Jan 30, 2020
@hdevalence
Copy link
Contributor Author

Ticked the Ed25519 box; I think that the key agreement types should probably be part of the note encryption implementation.

@dconnolly
Copy link
Contributor

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

@dconnolly dconnolly added A-dependencies Area: Dependency file updates A-rust Area: Updates to Rust code labels Jun 4, 2020
@yaahc
Copy link
Contributor

yaahc commented Jun 26, 2020

Also taking over the rest of this issue @dconnolly

@yaahc yaahc self-assigned this Jun 26, 2020
@dconnolly dconnolly linked a pull request Jul 23, 2020 that will close this issue
4 tasks
🦓 automation moved this from In progress to Done Aug 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-dependencies Area: Dependency file updates A-rust Area: Updates to Rust code
Projects
No open projects
🦓
  
Done
Development

Successfully merging a pull request may close this issue.

4 participants