Skip to main content

PixSpec

Trait PixSpec 

Source
pub trait PixSpec:
    Send
    + Sync
    + 'static
where PixScalar<Self>: PrimeField + Reduce<Array<u8, <Self::Curve as Curve>::FieldBytesSize>>, PixGroup<Self>: Group<Scalar = PixScalar<Self>> + GroupEncoding + Default + CofactorGroup, PixGroupRepr<Self>: Debug + PartialEq + Eq, <PixDigest<Self> as OutputSizeUser>::OutputSize: IsLess<U256> + IsLessOrEqual<<PixDigest<Self> as BlockSizeUser>::BlockSize, Output = True> + IsGreaterOrEqual<Prod<<Self::Curve as MapToCurve>::SecurityLevel, U2>, Output = True>, <Self::Curve as Curve>::FieldBytesSize: Add<SsaPolyIndexPrefixSize> + NonZero, <<Self::Curve as Curve>::FieldBytesSize as Add<SsaPolyIndexPrefixSize>>::Output: ArraySize, <<Self::Curve as MapToCurve>::SecurityLevel as Mul<U2>>::Output: Sized, <Self::Curve as MapToCurve>::SecurityLevel: Mul<U2>,
{ type Curve: PrimeCurve + CurveArithmetic + GroupDigest; type Digest: BlockSizeUser + FixedOutput + Debug + Default + HashMarker; type Pseudonym: Pseudonym + Debug + Copy + Send + Sync + 'static; type Cipher: StreamCipher + KeyIvInit; type DepositAddress: Copy + for<'a> From<&'a Self::AddressPrivateKey> + Send + Sync + 'static; type AddressPrivateKey: Clone + Send + Sync + 'static; const HASH_TO_SCALAR_SUITE_ID: &'static [u8]; const PIX_SUITE: PixSuite; const KEY_DERIVATION_CONTEXT: &'static str = "HASH_SSA_POLY_SHARE"; const HASH_SCALAR_DERIVATION_CONTEXT: &'static str = "HASH_SSA_POLY_SHARE_SCALAR"; const HASH_COMMITMENT_PROOF_CONTEXT: &'static str = "HASH_SSA_COMMITMENT_PROOF"; // Required methods fn group_to_deposit_address( group: PixGroup<Self>, ) -> Option<Self::DepositAddress>; fn scalar_to_private_key( scalar: PixScalar<Self>, ) -> Option<Self::AddressPrivateKey>; // Provided methods fn msg_to_scalar( spi: &SsaPolynomialId<Self::Pseudonym>, msg: impl AsRef<[u8]>, ) -> Result<PixScalar<Self>, Self::Pseudonym> where Self: Sized { ... } fn commitment_proof_challenge( ssa_id: &SsaId<Self::Pseudonym>, ssa_commitment: &PixGroup<Self>, nonce_commitment: &PixGroup<Self>, ) -> Result<PixScalar<Self>, Self::Pseudonym> where Self: Sized { ... } }
Expand description

Specification of the Protocol for Incentivization of eXits (PIX) instantiation.

Required Associated Constants§

Source

const HASH_TO_SCALAR_SUITE_ID: &'static [u8]

Stable, protocol-versioned hash-to-scalar suite identifier used for domain separation. This must be a fixed string — deriving it dynamically from Debug output would break wire compatibility when dependency versions change formatting.

Source

const PIX_SUITE: PixSuite

Which curve this spec instantiates, as announced to the peer in PixParams.

Deliberately has no default. It must name the same curve as Curve, and a default would let a new spec inherit a wrong answer silently — the failure it exists to prevent is precisely two peers disagreeing about a curve neither of them states.

Provided Associated Constants§

Source

const KEY_DERIVATION_CONTEXT: &'static str = "HASH_SSA_POLY_SHARE"

Context data used to derive the SSA encryption key.

Source

const HASH_SCALAR_DERIVATION_CONTEXT: &'static str = "HASH_SSA_POLY_SHARE_SCALAR"

Domain separator used to derive the X value of a share.

Source

const HASH_COMMITMENT_PROOF_CONTEXT: &'static str = "HASH_SSA_COMMITMENT_PROOF"

Domain separator used to derive the Fiat–Shamir challenge of an SsaCommitmentProof.

Required Associated Types§

Source

type Curve: PrimeCurve + CurveArithmetic + GroupDigest

Prime order elliptic curve use for commitments.

Source

type Digest: BlockSizeUser + FixedOutput + Debug + Default + HashMarker

Digest used for hashing operations.

Source

type Pseudonym: Pseudonym + Debug + Copy + Send + Sync + 'static

Pseudonym used to identify groups of SURBs.

Source

type Cipher: StreamCipher + KeyIvInit

Stream cipher used to encrypt the SSA shares.

Source

type DepositAddress: Copy + for<'a> From<&'a Self::AddressPrivateKey> + Send + Sync + 'static

Deposit address type.

Source

type AddressPrivateKey: Clone + Send + Sync + 'static

Private key type.

Required Methods§

Source

fn group_to_deposit_address( group: PixGroup<Self>, ) -> Option<Self::DepositAddress>

Converts PixGroup to an address that can be deposited to.

Returns None if the conversion is not possible.

Source

fn scalar_to_private_key( scalar: PixScalar<Self>, ) -> Option<Self::AddressPrivateKey>

Convert PixScalar to a private key of a deposit address.

Returns None if the conversion is not possible.

Provided Methods§

Source

fn msg_to_scalar( spi: &SsaPolynomialId<Self::Pseudonym>, msg: impl AsRef<[u8]>, ) -> Result<PixScalar<Self>, Self::Pseudonym>
where Self: Sized,

Performs conversion of the given spi and msg into PixScalar of this spec.

Source

fn commitment_proof_challenge( ssa_id: &SsaId<Self::Pseudonym>, ssa_commitment: &PixGroup<Self>, nonce_commitment: &PixGroup<Self>, ) -> Result<PixScalar<Self>, Self::Pseudonym>
where Self: Sized,

Derives the Fiat–Shamir challenge of an SsaCommitmentProof over the client’s ssa_commitment and the prover’s nonce_commitment.

ssa_id is bound in so that a proof cannot be replayed onto a different SSA index or a different Session’s pseudonym.

The Exit’s own commitment is deliberately not bound in. The statement being proven is knowledge of dlog(ssa_commitment) alone, and the deposit is protected because the Exit’s secret is what separates that from dlog(ssa_commitment + exit_commitment) — which holds regardless of what the challenge hashes. Binding it would only prevent reusing one proof for the same ssa_commitment against two different Exits, and an Entry that reuses its commitment does know its discrete log, so that case is honest (reuse is a linkability concern, not an exploit).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§