Skip to content

Add versioned signature#8

Closed
ConstanceBeguier wants to merge 9 commits intozsa1from
sighash_version
Closed

Add versioned signature#8
ConstanceBeguier wants to merge 9 commits intozsa1from
sighash_version

Conversation

@ConstanceBeguier
Copy link

@ConstanceBeguier ConstanceBeguier commented Aug 18, 2025

Add SighashInfo (version and associated data) to

  • Sapling binding signatures, and
  • Sapling authorizing signatures.

@ConstanceBeguier ConstanceBeguier marked this pull request as draft August 18, 2025 14:02
@ConstanceBeguier ConstanceBeguier changed the title Add sighash version Add versioned signature Sep 8, 2025
@ConstanceBeguier ConstanceBeguier marked this pull request as ready for review September 29, 2025 15:14
Copy link

@PaulLaux PaulLaux left a comment

Choose a reason for hiding this comment

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

Added questions,

Also, I'm concerned that this is not connected to the test-vectors we produce. Is there a simple way to connect to the test-vectors?


/// No version (used for Sapling and TXv5 compatibility).
/// TXv5 does not require the sighash versioning bytes.
NoVersion = u8::MAX,
Copy link

@PaulLaux PaulLaux Oct 6, 2025

Choose a reason for hiding this comment

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

this looks unused.

Also, can you brifly explain the backward compatibility stratagy here?

Copy link
Author

Choose a reason for hiding this comment

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

The NoVersion is used in librustzcash when we read V3/V4/V5 transactions.

The backward compatibility strategy is only done in librustzcash.
In sapling repo, all signatures (spend auth and binding) have a version.
In librustzcash, we manage backward compatibility by

  • not writing signature version only for V6 transactions
  • filling the version with NoVersion when reading signatures in V3/V4/V5 transactions

Comment on lines +88 to +96
let spend_auth_sig = spend_auth_sig
.as_ref()
.map(|(version, sig)| {
let version = sapling_sighash_version_from_u8(*version)
.ok_or(ParseError::InvalidSighashVersion)?;
let sig = redjubjub::Signature::from(*sig);
Ok(VerSpendAuthSig::new(version, sig))
})
.transpose()?;
Copy link

Choose a reason for hiding this comment

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

is this backward compatible? If not, let's discuss

Copy link
Author

Choose a reason for hiding this comment

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

It is not backward compatible because we add the version for every spend auth signature in PCZT

@ConstanceBeguier
Copy link
Author

We will only modify librustzcash repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants