Skip to content

feat(discovery-core): add hash primitives and outgoing channel storage slots - #456

Merged
m-kus merged 1 commit into
mainfrom
pr-split/02-hash-primitives
Feb 11, 2026
Merged

m-kus merged 1 commit into
mainfrom
pr-split/02-hash-primitives

Conversation

@m-kus

@m-kus m-kus commented Feb 9, 2026 •

Copy link
Copy Markdown

Add Privacy Pool Cryptographic Primitives

This PR adds several cryptographic primitives needed for the privacy pool implementation:

  1. Adds new domain separation tags for:

    • Nullifier derivation
    • Channel key derivation
    • Channel and subchannel marker derivation
    • Outgoing channel ID derivation
    • Encrypted recipient address
  2. Implements hash functions for:

    • Computing nullifiers
    • Deriving channel keys
    • Computing channel and subchannel markers
    • Computing outgoing channel IDs
    • Encrypting recipient addresses
  3. Adds storage slot computation for encrypted outgoing channel information

  4. Adds a utility function felt_hex() for formatting field elements as readable hex strings


This change is Reviewable

m-kus commented Feb 9, 2026 •

Copy link
Copy Markdown
Author

@Yoni-Starkware Yoni-Starkware left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

:lgtm:

@Yoni-Starkware reviewed 4 files and all commit messages, and made 3 comments.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @m-kus).


crates/discovery-core/src/privacy_pool/hashes.rs line 3 at r1 (raw file):

//! Hash functions and domain separation tags.
//!
//! TODO: rename primitives to match smart contract terminology

Still relevant?

Code quote:

//! TODO: rename primitives to match smart contract terminology

crates/discovery-core/src/privacy_pool/hashes.rs line 136 at r1 (raw file):

/// Computes the nullifier for a note.
///
/// `nullifier = hash(NULLIFIER_TAG, channel_key, token, index, 0, decryption_key)`

Unnecessary, it just repeats the impl (in all these funcs)

@m-kus
m-kus force-pushed the pr-split/02-hash-primitives branch 2 times, most recently from b444378 to cdf0400 Compare February 11, 2026 14:34
@m-kus
m-kus force-pushed the pr-split/01-claude-meta branch from 1aba5e9 to 75115c6 Compare February 11, 2026 14:34

@m-kus m-kus left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@m-kus made 1 comment and resolved 1 discussion.
Reviewable status: 3 of 4 files reviewed, 1 unresolved discussion (waiting on @Yoni-Starkware).


crates/discovery-core/src/privacy_pool/hashes.rs line 3 at r1 (raw file):

Previously, Yoni-Starkware (Yoni) wrote…

Still relevant?

Resolved

@Yoni-Starkware Yoni-Starkware left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

:lgtm:

@Yoni-Starkware reviewed 4 files and all commit messages, made 1 comment, and resolved 1 discussion.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @m-kus).

@m-kus
m-kus changed the base branch from pr-split/01-claude-meta to graphite-base/456 February 11, 2026 18:31
@m-kus
m-kus force-pushed the graphite-base/456 branch from c61ac2d to 304b302 Compare February 11, 2026 18:36
@m-kus
m-kus force-pushed the pr-split/02-hash-primitives branch from f2a60f2 to 014e336 Compare February 11, 2026 18:36
@m-kus
m-kus changed the base branch from graphite-base/456 to main February 11, 2026 18:37
@m-kus
m-kus force-pushed the pr-split/02-hash-primitives branch from 014e336 to 1f898f6 Compare February 11, 2026 18:38
@m-kus
m-kus merged commit 269dbcc into main Feb 11, 2026
6 checks passed
@m-kus
m-kus deleted the pr-split/02-hash-primitives branch February 11, 2026 18:42
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