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

feat: commitment proofs #6463

Open
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

AaronFeickert
Copy link
Collaborator

@AaronFeickert AaronFeickert commented Aug 12, 2024

Description

Adds commitment proofs, which prove knowledge of the opening of a commitment with an optional minimum value assertion.

Closes #6282. Supersedes #6348.

Motivation and Context

This PR adds commitment proofs. These proofs show that the prover knows the opening of a given commitment, optionally shows that the commitment binds to at least a specified minimum value, and bind to an arbitrary message to mitigate replay attacks.

Notably, they do not necessarily assert spend authority.

How Has This Been Tested?

This needs to be tested manually.

What process can a PR reviewer use to test or verify this change?

Test proof verification succeeds against valid values. Test proof verification fails against different commitments, minimum values, and messages.

@AaronFeickert AaronFeickert requested a review from a team as a code owner August 12, 2024 00:23
@ghpbot-tari-project ghpbot-tari-project added P-acks_required Process - Requires more ACKs or utACKs P-reviews_required Process - Requires a review from a lead maintainer to be merged labels Aug 12, 2024
Copy link

Test Results (CI)

    3 files    123 suites   39m 40s ⏱️
1 301 tests 1 301 ✅ 0 💤 0 ❌
3 895 runs  3 895 ✅ 0 💤 0 ❌

Results for commit 54f290c.

Copy link

Test Results (Integration tests)

 2 files  + 2   1 errors  9 suites  +9   11m 33s ⏱️ + 11m 33s
19 tests +19  18 ✅ +18  0 💤 ±0  1 ❌ +1 
20 runs  +20  19 ✅ +19  0 💤 ±0  1 ❌ +1 

For more details on these parsing errors and failures, see this check.

Results for commit 54f290c. ± Comparison against base commit 310a470.

Copy link
Collaborator

@SWvheerden SWvheerden left a comment

Choose a reason for hiding this comment

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

This looks good as a proof of view access. Not necessarily proof of ownership.
We need to move the proof generation to inside the key manager. The services should not work with the private keys. There is a lot of complexity there and it should be kept there.

The ownership proof will only currently work for your own wallet as it searches only your own wallet for utxos.

}
},
VerifyCommitmentProof(args) => {
match output_service.get_unspent_outputs().await {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this will only allow you to verify your own commitments

Copy link
Collaborator

Choose a reason for hiding this comment

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

If you want to verify any output you probably need a new method that will get that from a base node

@@ -130,7 +133,7 @@ impl<TBackend, TWalletConnectivity, TKeyManagerInterface>
where
TBackend: OutputManagerBackend + 'static,
TWalletConnectivity: WalletConnectivityInterface,
TKeyManagerInterface: TransactionKeyManagerInterface,
TKeyManagerInterface: SecretTransactionKeyManagerInterface,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
TKeyManagerInterface: SecretTransactionKeyManagerInterface,
TKeyManagerInterface: TransactionKeyManagerInterface,

Dont include this trait. You are not suppose to expose the private keys here

}
}

async fn create_commitment_proof(
Copy link
Collaborator

Choose a reason for hiding this comment

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

ship most of the work to the key manager.
Its the only place where we should work with private keys.

@AaronFeickert
Copy link
Collaborator Author

@SWvheerden thanks for the review! This was originally based on the design in #6240, but certainly looks like it needs to be changed to be properly useful.

Copy link
Contributor

@hansieodendaal hansieodendaal left a comment

Choose a reason for hiding this comment

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

Looks nice, and I agree that we should keep the secret keys in the key manager.

I initially thought that we should guard against someone just pulling an existing range proof from the blockchain and present it as an ownership proof, but then realized that the transcript is unique.

What is interesting, is that we could create this proof even if the actual output may have a revealed value proof.

@AaronFeickert
Copy link
Collaborator Author

then realized that the transcript is unique

Yep, this was very intentional. It's not possible to collide a commitment proof with a range proof. This is the case even in the "other direction", where an adversary tricks a user into including a malicious message in a commitment proof in an attempt to produce a valid range proof.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-acks_required Process - Requires more ACKs or utACKs P-reviews_required Process - Requires a review from a lead maintainer to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add commitment opening proofs
4 participants