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

ZIP-244: Create generic transaction id merkle tree #2049

Closed
1 task
teor2345 opened this issue Apr 21, 2021 · 1 comment
Closed
1 task

ZIP-244: Create generic transaction id merkle tree #2049

teor2345 opened this issue Apr 21, 2021 · 1 comment
Labels
A-consensus Area: Consensus rule updates A-rust Area: Updates to Rust code C-enhancement Category: This is an improvement NU-5 Network Upgrade: NU5 specific tasks

Comments

@teor2345
Copy link
Contributor

teor2345 commented Apr 21, 2021

Is your feature request related to a problem? Please describe.

ZIP-244 defines a new transaction digest algorithm currently planned to be applied from the NU5 network upgrade onward.

ZIP-244 creates non-malleable transaction identifiers that commit to all transaction data except for attestations to transaction validity. (That is, signatures and proofs.)

ZIP-244 also adds a transaction authorization hash, which is hash-chained to the block commitment (#1567) and placed in the block commitment fields.

Describe the solution you'd like

We should implement or integrate this new transaction digest algorithm in Zebra as per:

This will include:

Merkle tree

  • refactor our current transaction merkle tree to make it generic. The tree needs to be calculated over:
    • pre-NU5 transaction IDs (before NU5)
    • non-malleable transaction IDs + orchard changes (in NU5 for the block header transaction merkle root field) (TODO)

The transaction authorization hash uses a different merkle tree construction, so it is out of scope for this ticket.

The generic type should be bounded by a TransactionMerkleTree trait, which is implemented by the 3 hash types.

There does not need to be a dependency on the implementation of these types, because we can just define the new types as:

pub struct transaction::non_malleable::Id(pub [u8; 32]);
pub struct transaction::non_malleable::authorization::Hash(pub [u8; 32]);

Alternative Implementations

The ECC have implemented a version of this in Rust in the librustzcash library, we should be able to either port some of that code or learn from that code to implement the Zebra version.

@teor2345 teor2345 added A-consensus Area: Consensus rule updates A-rust Area: Updates to Rust code C-enhancement Category: This is an improvement S-needs-triage Status: A bug report needs triage NU-5 Network Upgrade: NU5 specific tasks P-Medium labels Apr 21, 2021
@teor2345 teor2345 added this to the 2021 Sprint 9 milestone Apr 21, 2021
@mpguerra mpguerra removed the S-needs-triage Status: A bug report needs triage label Apr 29, 2021
@teor2345 teor2345 changed the title ZIP-244: Create generic transaction hash merkle tree ZIP-244: Create generic transaction id merkle tree May 12, 2021
@teor2345
Copy link
Contributor Author

PR #2129 takes the non-malleable transaction id data from librustzcash, and puts it in Zebra's transaction::Hash type.

So the existing code will work without modification, because we are using the same type for v4 and v5 transaction ids. Therefore this ticket is obsolete.

(If we ever need to check if an id is non-malleable, we can check the transaction version.)

@teor2345 teor2345 removed this from the 2021 Sprint 10 milestone May 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-consensus Area: Consensus rule updates A-rust Area: Updates to Rust code C-enhancement Category: This is an improvement NU-5 Network Upgrade: NU5 specific tasks
Projects
None yet
Development

No branches or pull requests

2 participants