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

Add transaction version 5 #1824

Merged
merged 29 commits into from
Mar 3, 2021
Merged

Conversation

oxarbitrage
Copy link
Contributor

@oxarbitrage oxarbitrage commented Feb 27, 2021

Motivation

Start the work in the next network upgrade transaction.

Solution

Add the V5 transaction to the enum and add some common fields that we know are going to be there. The "rest" of the transaction is represented in as Vec<u8> in a rest field.

The prop tests are blocked on #1823

The code in this pull request has:

  • Documentation Comments
  • Unit Tests and Property Tests

Review

Related Issues

Closes #1822
Closes #1826

Follow Up Work

@oxarbitrage oxarbitrage added S-blocked Status: Blocked on other tasks NU-5 Network Upgrade: NU5 specific tasks labels Feb 27, 2021
Copy link
Contributor

@teor2345 teor2345 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a good start, but needs some fixes.

Here's what I checked:

  • version group id
  • other consensus rules
  • serialization and deserialization
  • all instances of V4 in the codebase, to make sure we added a matching V5

Here's what I suggested:

  • the specific change and ZIP for each unimplemented!()
  • add unimplemented!() instead of re-using v1-v3 code

Here's what I committed to your branch:

  • update comment for V5 transactions 0ac10e2
  • add V5 transactions to non_finalized_state 5269c2e
  • add ZIPs to unimplemented messages c1af4a6

Here's what we still need to do:

  • Make the version group id match the draft spec (typo)
  • Add zcash_deserialize implementation for version 5
  • Make Transaction::sprout_nullifiers explicitly return empty for V1 and V5
  • Add a V5 case to Transaction::sapling_nullifiers
  • Double-check all instances of V4 in the codebase

Here are the follow-up tasks we should do:

Here is a low-priority optional follow-up:

zebra-chain/src/parameters/transaction.rs Outdated Show resolved Hide resolved
zebra-chain/src/parameters/transaction.rs Outdated Show resolved Hide resolved
zebra-chain/src/transaction.rs Outdated Show resolved Hide resolved
zebra-chain/src/parameters/transaction.rs Outdated Show resolved Hide resolved
zebra-chain/src/transaction.rs Outdated Show resolved Hide resolved
zebra-consensus/src/transaction.rs Outdated Show resolved Hide resolved
zebra-consensus/src/transaction/check.rs Outdated Show resolved Hide resolved
zebra-consensus/src/transaction/check.rs Outdated Show resolved Hide resolved
zebra-chain/src/transaction/sighash.rs Outdated Show resolved Hide resolved
zebra-state/src/service/non_finalized_state/chain.rs Outdated Show resolved Hide resolved
@teor2345
Copy link
Contributor

teor2345 commented Mar 1, 2021

Now that we've split off the Arbitrary impl into #1826, this PR doesn't depend on NU5 (#1823) any more.

@oxarbitrage oxarbitrage marked this pull request as ready for review March 2, 2021 13:44
@oxarbitrage oxarbitrage changed the title [WIP] - Add transaction version 5 Add transaction version 5 Mar 2, 2021
Copy link
Contributor

@teor2345 teor2345 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check any copied code against the draft NU5/Orchard specs.

There are a lot of small changes to field orders, constants, and other protocol features.

zebra-chain/src/transaction/serialize.rs Show resolved Hide resolved
if id != TX_V5_VERSION_GROUP_ID {
return Err(SerializationError::Parse("expected TX_V5_VERSION_GROUP_ID"));
}
let inputs = Vec::zcash_deserialize(&mut reader)?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, the order of these fields should match the draft v5 transaction spec.

Copy link
Contributor

@teor2345 teor2345 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, we just need to:

  • update the field order in v5_strategy, to avoid a nightly clippy lint
  • double-check all instances of V4 in the codebase

zebra-chain/src/transaction/arbitrary.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@teor2345 teor2345 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @oxarbitrage we're almost there.

I made the following changes:

  • We're still deciding if V5 transactions support Sprout, so I changed all the V5 sprout match arms to unimplemented!()
    • This part of the spec is still changing
  • I found another match without a V5 arm, looks like we both missed that one

I just need you to:

  • Check the changes I just pushed
  • Double-check all instances of V4 in the codebase, to make sure they have a matching V5
    • Unfortunately, IP addresses also have a V4 variant - we don't need to fix those

Copy link
Contributor Author

@oxarbitrage oxarbitrage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last changes are all ok. Double checked V4/V5 instances, they are all good after 48fb77e

@teor2345 teor2345 merged commit 8883543 into ZcashFoundation:main Mar 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NU-5 Network Upgrade: NU5 specific tasks S-blocked Status: Blocked on other tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use v5_strategy in Arbitrary for Transaction Add v5 transaction stubs
3 participants