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

Planning: parse out Orchard spec updates, halo2/orchard crates, and zcashd updates into Zebra work items #1742

Closed
dconnolly opened this issue Feb 15, 2021 · 10 comments
Assignees
Labels
A-docs Area: Documentation C-design Category: Software design work C-research Category: Engineering notes in support of design choices C-tracking-issue Category: This is a tracking issue for other tasks NU-5 Network Upgrade: NU5 specific tasks
Milestone

Comments

@dconnolly
Copy link
Contributor

dconnolly commented Feb 15, 2021

We need to digest the current:

to suss out what tasks we need to do in Zebra to have it validate Orchard compatibly, as the spec evolves.

To start with, we need to go through the spec and suss out the high level things to implement, and then if they don't have a straightforward equivalent in Zebra to model off of, designate the 'needs design' parts. From there, we need to see if there any glaring 'unknowns' that need to be fleshed out or answered in order to decide how to design them or how to prioritize them in project-planning order.

Result:

a zenhub epic (#1598) populated with issues and a vague dependency graph of work to support Orchard

  • the enumerated Orchard parts of the draft spec
  • checklist of ZIPs in all the NUs
  • bucket of tasks that Zebra needs to do, not reliant on the spec or ZIPs, to gracefully handle the network upgrade
@dconnolly dconnolly added A-docs Area: Documentation C-design Category: Software design work C-research Category: Engineering notes in support of design choices spec-readthrough C-tracking-issue Category: This is a tracking issue for other tasks NU-5 Network Upgrade: NU5 specific tasks labels Feb 15, 2021
@mpguerra mpguerra added this to the 2021 Sprint 4 milestone Feb 22, 2021
@yaahc
Copy link
Contributor

yaahc commented Feb 23, 2021

I've done an initial call with @str4d and @daira to discuss the Orchard API

We have a shared doc for notes from the meeting and future meetings (just a few action items for now): https://hackmd.io/@2aetCAHHS5yPrDQIgqGo2Q/B1ogq6MMu

Overall the API looks good. Care has clearly been taken to make sure the API is consistent with our sapling module in zebra-chain and we can generally think of the orchard crate as equivalent to those sapling/sprout modules within zebra-chain. The AuthorizedBundle (name subject to change) type is equivalent to ShieldedData.

The main concerns that we ran into revolve around batching and constructing transactions. We don't currently construct transactions anywhere within zebra, so it is harder for them to predict what constraints we might have, but we're mostly confident that a builder api + trait based hooks solution for constructing each individual transaction format should work best with both codebases.

For batching they said we will initially not be able to batch proofs from separate transactions, I think largely because of the recursive proving, but that this isn't a fundamental hurdle and so we should be able to support fully batched proving down the line. For now though the protocol itself batches proofs within each transaction by design, so we will hopefully not have any performance issues even initially without the optimal batching implementation.

@teor2345
Copy link
Contributor

For batching they said we will initially not be able to batch proofs from separate transactions, I think largely because of the recursive proving, but that this isn't a fundamental hurdle and so we should be able to support fully batched proving down the line. For now though the protocol itself batches proofs within each transaction by design, so we will hopefully not have any performance issues even initially without the optimal batching implementation.

For performance testing, we should construct blocks with:

  • lots of transactions
  • a transaction with lots of inputs
  • a transaction with lots of outputs
  • a transaction with lots of inputs and outputs

We should be able to share this work and the test data with the zcashd team.

Note that mainnet actually contains some of these kinds of transactions, due to miner and funding stream outputs, transfers, and collection.

@teor2345
Copy link
Contributor

It might also be helpful to pass data through the batcher with a batch size of 1, to make sure that the API is compatible with batching. (For example, the changes we needed to make to the script(?) API to support efficient caching of transaction data during batching.)

We probably won't implement that design until later, but it might be helpful to change the API now.

@teor2345
Copy link
Contributor

I updated the links in the ticked description to the latest versions of everything

@dconnolly
Copy link
Contributor Author

dconnolly commented Feb 26, 2021

OK from looking at the spec updates, it looks like a lot of the work we have to do for Orchard is

  • wrap halo2 crate call in a new Halo2Verifier async service, like we do for Groth16, no fancy batch math
  • New Txv5
  • Keep track of Orchard note commitment tree anchors and nullifiers in state
  • A few new things to check in the existing TransactionVerifier (like new binding signature checks from value commitments with the new curves / RedDSA/ RedPallas, mostly implemented in orchard crate, which we’ll help a bit with to make code nice
    • RedPallas async verifier?
  • Maybe the tweaks to TxID generation and stuff

@mpguerra
Copy link
Contributor

Result: a zenhub epic populated with issues and a vague dependency graph of work to support Orchard

FWIW, the Epic was already created here: #1598 we just need to keep adding issues to it :)

@mpguerra
Copy link
Contributor

mpguerra commented Mar 8, 2021

I'll finish this one off and close it in the next few days. This involves creating and filling in the following epics:

@mpguerra
Copy link
Contributor

mpguerra commented Mar 9, 2021

* [ ]  ZIPs active in Canopy or NU5, which Zebra hasn't implemented yet - #1854

This one is almost done, pending an answer on whether we need to create an issue for ZIP-209

@mpguerra
Copy link
Contributor

I've finished going through the NU5 spec and adding items to #1856. This issue will need a second and third pair of eyes to help me identify potentially missing issues and mistakes.

@mpguerra
Copy link
Contributor

Going to close this for now as I think this is a good first pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: Documentation C-design Category: Software design work C-research Category: Engineering notes in support of design choices C-tracking-issue Category: This is a tracking issue for other tasks NU-5 Network Upgrade: NU5 specific tasks
Projects
None yet
Development

No branches or pull requests

5 participants