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

Design: treestate (note commitment trees and nullifier sets) #958

Closed
1 task
dconnolly opened this issue Aug 28, 2020 · 0 comments · Fixed by #983
Closed
1 task

Design: treestate (note commitment trees and nullifier sets) #958

dconnolly opened this issue Aug 28, 2020 · 0 comments · Fixed by #983
Assignees
Labels
A-docs Area: Documentation C-design Category: Software design work C-research Category: Engineering notes in support of design choices NU Sprout Network Upgrade: Sprout specific tasks (before Overwinter) NU-1 Sapling Network Upgrade: Sapling specific tasks S-needs-design Status: Needs a design decision
Milestone

Comments

@dconnolly
Copy link
Contributor

dconnolly commented Aug 28, 2020

Todo:

  • Update treestate RFC for Orchard

Design

  • figuring out what data exactly we need to store to check consistency with note commitment trees
  • figuring out what interface we should have for the NCT implementation
  • writing down the process for checking transactions in a block against whatever data we have (from first two points)

Each Sapling spend specifies the anchor of the tree it should be verified against.
That must be a valid anchor in the parent chain of the block the transaction is mined in, but it could be from anywhere in that chain.

Because the anchor is included in the spend, we can do a nice split between semantic and contextual verification. In semantic verification, we can check the proofs against the provided anchor, and in contextual verification, we can check the anchor against ???

the spec points out that the anchor identifies the nullifier set
but my guess is that we don’t want to have that linkage
since updates to the nullifier set are additive, we can maintain a single nullifier set and check membership while doing contextual validation in the state system

this is talking only about the finalized part of the chain
we would need per block nullifier sets for the in memory part, and potentially we would want to have a single container holding all the nullifiers of the current best chain so that in the happy path we don’t have to do 100 set queries

you want to check a transaction against the latest nullifier set, but the likely-historic anchor

for checking the anchor, i guess we need to check that the transaction was valid against some previous anchor
so perhaps we could have a tree of (anchor, height)
and check that for all spend anchors, the corresponding height exists (known anchor) and is less than the current block height
maybe we don't need the height check, if the tree only has prior anchors

for each block hash, we need the root of the sprout or sapling note commitment tree

for each proof, it includes an anchor that it was made with (it's view of the tree); during semantic validation, we check that the proof is valid, during contextual, we check that the anchor for the transaction is actually an anchor for a previous block (that is has previously existed). Then for block validations, we construct our note commitment tree from our transactions and get its root, then we check that the proofs we have validated are consistent with the chain state, including that the nullifiers have never been seen/revealed (as necessary). This reduces treestate management to a nullifier set and a seen anchor root set.

When we see a purported anchor, when we look it up, it will probably be one of the most recent blocks (of the chain, the 'unfinalized' part that hasn't been saved down to zebra-state).

@dconnolly dconnolly added A-docs Area: Documentation C-design Category: Software design work C-research Category: Engineering notes in support of design choices E-med NU-1 Sapling Network Upgrade: Sapling specific tasks NU Sprout Network Upgrade: Sprout specific tasks (before Overwinter) S-needs-design Status: Needs a design decision labels Aug 28, 2020
@dconnolly dconnolly added this to the Validate transactions. milestone Aug 28, 2020
@dconnolly dconnolly self-assigned this Aug 28, 2020
@dconnolly dconnolly added this to To Do in 🦓 via automation Aug 28, 2020
@dconnolly dconnolly moved this from To Do to In progress in 🦓 Aug 28, 2020
@dconnolly dconnolly linked a pull request Sep 3, 2020 that will close this issue
1 task
@dconnolly dconnolly moved this from No Estimate to M - 5 in Effort Affinity Grouping Dec 17, 2020
@mpguerra mpguerra removed this from the Transaction Validation milestone Jan 5, 2021
@dconnolly dconnolly added this to the 2021 Sprint 1 milestone Jan 11, 2021
@mpguerra mpguerra modified the milestones: 2021 Sprint 1, 2021 Sprint 3 Jan 25, 2021
@mpguerra mpguerra modified the milestones: 2021 Sprint 3, 2021 Sprint 4 Feb 22, 2021
@mpguerra mpguerra removed this from the 2021 Sprint 4 milestone Mar 8, 2021
@teor2345 teor2345 mentioned this issue Mar 16, 2021
53 tasks
@mpguerra mpguerra removed the E-med label Mar 23, 2021
🦓 automation moved this from In progress to Done Apr 15, 2021
Effort Affinity Grouping automation moved this from M - 5 to Done Apr 15, 2021
@mpguerra mpguerra added this to the 2021 Sprint 7 milestone Apr 16, 2021
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 NU Sprout Network Upgrade: Sprout specific tasks (before Overwinter) NU-1 Sapling Network Upgrade: Sapling specific tasks S-needs-design Status: Needs a design decision
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants