pub trait PixSpec:
Send
+ Sync
+ 'staticwhere
<Self::Curve as CurveArithmetic>::Scalar: PrimeField + Reduce<Array<u8, <Self::Curve as Curve>::FieldBytesSize>>,
<Self::Curve as CurveArithmetic>::ProjectivePoint: Group<Scalar = <Self::Curve as CurveArithmetic>::Scalar> + GroupEncoding + Default + CofactorGroup,
<<Self::Curve as CurveArithmetic>::ProjectivePoint as GroupEncoding>::Repr: Debug + PartialEq + Eq,
<Self::Digest as OutputSizeUser>::OutputSize: IsLess<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, B0>, B0>> + IsLessOrEqual<<Self::Digest as BlockSizeUser>::BlockSize, Output = B1> + IsGreaterOrEqual<<<Self::Curve as MapToCurve>::SecurityLevel as Mul<UInt<UInt<UTerm, B1>, B0>>>::Output, Output = B1>,
<Self::Curve as Curve>::FieldBytesSize: Add<<<Const<hopr_protocol_pix::::types::SsaPolyIndexPrefixSize::{constant#0}> as ToUInt>::Output as Add<<Const<hopr_protocol_pix::::types::SsaPolyIndexPrefixSize::{constant#1}> as ToUInt>::Output>>::Output> + NonZero,
<<Self::Curve as Curve>::FieldBytesSize as Add<<<Const<hopr_protocol_pix::::types::SsaPolyIndexPrefixSize::{constant#0}> as ToUInt>::Output as Add<<Const<hopr_protocol_pix::::types::SsaPolyIndexPrefixSize::{constant#1}> as ToUInt>::Output>>::Output>>::Output: ArraySize,
<<Self::Curve as MapToCurve>::SecurityLevel as Mul<UInt<UInt<UTerm, B1>, B0>>>::Output: Sized,
<Self::Curve as MapToCurve>::SecurityLevel: Mul<UInt<UInt<UTerm, B1>, B0>>,{
type Curve: PrimeCurve + CurveArithmetic + GroupDigest
where <Self::Curve as CurveArithmetic>::Scalar: PrimeField + Reduce<Array<u8, <Self::Curve as Curve>::FieldBytesSize>>,
<Self::Curve as CurveArithmetic>::ProjectivePoint: Group<Scalar = <Self::Curve as CurveArithmetic>::Scalar> + GroupEncoding + Default + CofactorGroup,
<<Self::Curve as CurveArithmetic>::ProjectivePoint as GroupEncoding>::Repr: Debug + PartialEq + Eq,
<Self::Curve as Curve>::FieldBytesSize: Add<<<Const<hopr_protocol_pix::::types::SsaPolyIndexPrefixSize::{constant#0}> as ToUInt>::Output as Add<<Const<hopr_protocol_pix::::types::SsaPolyIndexPrefixSize::{constant#1}> as ToUInt>::Output>>::Output> + NonZero,
<<Self::Curve as Curve>::FieldBytesSize as Add<<<Const<hopr_protocol_pix::::types::SsaPolyIndexPrefixSize::{constant#0}> as ToUInt>::Output as Add<<Const<hopr_protocol_pix::::types::SsaPolyIndexPrefixSize::{constant#1}> as ToUInt>::Output>>::Output>>::Output: ArraySize,
<<Self::Curve as MapToCurve>::SecurityLevel as Mul<UInt<UInt<UTerm, B1>, B0>>>::Output: Sized,
<Self::Curve as MapToCurve>::SecurityLevel: Mul<UInt<UInt<UTerm, B1>, B0>>;
type Digest: BlockSizeUser + FixedOutput + Debug + Default + HashMarker
where <Self::Digest as OutputSizeUser>::OutputSize: IsLess<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, B0>, B0>> + IsLessOrEqual<<Self::Digest as BlockSizeUser>::BlockSize, Output = B1> + IsGreaterOrEqual<<<Self::Curve as MapToCurve>::SecurityLevel as Mul<UInt<UInt<UTerm, B1>, B0>>>::Output, Output = B1>;
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: <Self::Curve as CurveArithmetic>::ProjectivePoint,
) -> Option<Self::DepositAddress>;
fn scalar_to_private_key(
scalar: <Self::Curve as CurveArithmetic>::Scalar,
) -> Option<Self::AddressPrivateKey>;
// Provided methods
fn msg_to_scalar(
spi: &SsaPolynomialId<Self::Pseudonym>,
msg: impl AsRef<[u8]>,
) -> Result<<Self::Curve as CurveArithmetic>::Scalar, PixError<Self::Pseudonym>>
where Self: Sized { ... }
fn commitment_proof_challenge(
ssa_id: &SsaId<Self::Pseudonym>,
ssa_commitment: &<Self::Curve as CurveArithmetic>::ProjectivePoint,
nonce_commitment: &<Self::Curve as CurveArithmetic>::ProjectivePoint,
) -> Result<<Self::Curve as CurveArithmetic>::Scalar, PixError<Self::Pseudonym>>
where Self: Sized { ... }
}Expand description
Re-exported so a consumer can name <HoprPixSpec as PixSpec>::DepositAddress and assert at
compile time that it is the variant it can actually settle. Which instantiation is in play is
a feature-graph outcome rather than a local decision, and getting it wrong is otherwise silent
until deposits stop happening at runtime.
Specification of the Protocol for Incentivization of eXits (PIX) instantiation.
Required Associated Constants§
Sourceconst HASH_TO_SCALAR_SUITE_ID: &'static [u8]
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.
Sourceconst PIX_SUITE: PixSuite
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§
Sourceconst KEY_DERIVATION_CONTEXT: &'static str = "HASH_SSA_POLY_SHARE"
const KEY_DERIVATION_CONTEXT: &'static str = "HASH_SSA_POLY_SHARE"
Context data used to derive the SSA encryption key.
Sourceconst HASH_SCALAR_DERIVATION_CONTEXT: &'static str = "HASH_SSA_POLY_SHARE_SCALAR"
const HASH_SCALAR_DERIVATION_CONTEXT: &'static str = "HASH_SSA_POLY_SHARE_SCALAR"
Domain separator used to derive the X value of a share.
Sourceconst HASH_COMMITMENT_PROOF_CONTEXT: &'static str = "HASH_SSA_COMMITMENT_PROOF"
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§
Sourcetype Curve: PrimeCurve + CurveArithmetic + GroupDigest
where
<Self::Curve as CurveArithmetic>::Scalar: PrimeField + Reduce<Array<u8, <Self::Curve as Curve>::FieldBytesSize>>,
<Self::Curve as CurveArithmetic>::ProjectivePoint: Group<Scalar = <Self::Curve as CurveArithmetic>::Scalar> + GroupEncoding + Default + CofactorGroup,
<<Self::Curve as CurveArithmetic>::ProjectivePoint as GroupEncoding>::Repr: Debug + PartialEq + Eq,
<Self::Curve as Curve>::FieldBytesSize: Add<<<Const<hopr_protocol_pix::::types::SsaPolyIndexPrefixSize::{constant#0}> as ToUInt>::Output as Add<<Const<hopr_protocol_pix::::types::SsaPolyIndexPrefixSize::{constant#1}> as ToUInt>::Output>>::Output> + NonZero,
<<Self::Curve as Curve>::FieldBytesSize as Add<<<Const<hopr_protocol_pix::::types::SsaPolyIndexPrefixSize::{constant#0}> as ToUInt>::Output as Add<<Const<hopr_protocol_pix::::types::SsaPolyIndexPrefixSize::{constant#1}> as ToUInt>::Output>>::Output>>::Output: ArraySize,
<<Self::Curve as MapToCurve>::SecurityLevel as Mul<UInt<UInt<UTerm, B1>, B0>>>::Output: Sized,
<Self::Curve as MapToCurve>::SecurityLevel: Mul<UInt<UInt<UTerm, B1>, B0>>
type Curve: PrimeCurve + CurveArithmetic + GroupDigest where <Self::Curve as CurveArithmetic>::Scalar: PrimeField + Reduce<Array<u8, <Self::Curve as Curve>::FieldBytesSize>>, <Self::Curve as CurveArithmetic>::ProjectivePoint: Group<Scalar = <Self::Curve as CurveArithmetic>::Scalar> + GroupEncoding + Default + CofactorGroup, <<Self::Curve as CurveArithmetic>::ProjectivePoint as GroupEncoding>::Repr: Debug + PartialEq + Eq, <Self::Curve as Curve>::FieldBytesSize: Add<<<Const<hopr_protocol_pix::::types::SsaPolyIndexPrefixSize::{constant#0}> as ToUInt>::Output as Add<<Const<hopr_protocol_pix::::types::SsaPolyIndexPrefixSize::{constant#1}> as ToUInt>::Output>>::Output> + NonZero, <<Self::Curve as Curve>::FieldBytesSize as Add<<<Const<hopr_protocol_pix::::types::SsaPolyIndexPrefixSize::{constant#0}> as ToUInt>::Output as Add<<Const<hopr_protocol_pix::::types::SsaPolyIndexPrefixSize::{constant#1}> as ToUInt>::Output>>::Output>>::Output: ArraySize, <<Self::Curve as MapToCurve>::SecurityLevel as Mul<UInt<UInt<UTerm, B1>, B0>>>::Output: Sized, <Self::Curve as MapToCurve>::SecurityLevel: Mul<UInt<UInt<UTerm, B1>, B0>>
Prime order elliptic curve use for commitments.
Sourcetype Digest: BlockSizeUser + FixedOutput + Debug + Default + HashMarker
where
<Self::Digest as OutputSizeUser>::OutputSize: IsLess<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, B0>, B0>> + IsLessOrEqual<<Self::Digest as BlockSizeUser>::BlockSize, Output = B1> + IsGreaterOrEqual<<<Self::Curve as MapToCurve>::SecurityLevel as Mul<UInt<UInt<UTerm, B1>, B0>>>::Output, Output = B1>
type Digest: BlockSizeUser + FixedOutput + Debug + Default + HashMarker where <Self::Digest as OutputSizeUser>::OutputSize: IsLess<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, B0>, B0>> + IsLessOrEqual<<Self::Digest as BlockSizeUser>::BlockSize, Output = B1> + IsGreaterOrEqual<<<Self::Curve as MapToCurve>::SecurityLevel as Mul<UInt<UInt<UTerm, B1>, B0>>>::Output, Output = B1>
Digest used for hashing operations.
Sourcetype Pseudonym: Pseudonym + Debug + Copy + Send + Sync + 'static
type Pseudonym: Pseudonym + Debug + Copy + Send + Sync + 'static
Pseudonym used to identify groups of SURBs.
Sourcetype DepositAddress: Copy + for<'a> From<&'a Self::AddressPrivateKey> + Send + Sync + 'static
type DepositAddress: Copy + for<'a> From<&'a Self::AddressPrivateKey> + Send + Sync + 'static
Deposit address type.
Sourcetype AddressPrivateKey: Clone + Send + Sync + 'static
type AddressPrivateKey: Clone + Send + Sync + 'static
Private key type.
Required Methods§
Sourcefn group_to_deposit_address(
group: <Self::Curve as CurveArithmetic>::ProjectivePoint,
) -> Option<Self::DepositAddress>
fn group_to_deposit_address( group: <Self::Curve as CurveArithmetic>::ProjectivePoint, ) -> Option<Self::DepositAddress>
Converts PixGroup to an address that can be deposited to.
Returns None if the conversion is not possible.
Sourcefn scalar_to_private_key(
scalar: <Self::Curve as CurveArithmetic>::Scalar,
) -> Option<Self::AddressPrivateKey>
fn scalar_to_private_key( scalar: <Self::Curve as CurveArithmetic>::Scalar, ) -> Option<Self::AddressPrivateKey>
Convert PixScalar to a private key of a deposit address.
Returns None if the conversion is not possible.
Provided Methods§
Sourcefn msg_to_scalar(
spi: &SsaPolynomialId<Self::Pseudonym>,
msg: impl AsRef<[u8]>,
) -> Result<<Self::Curve as CurveArithmetic>::Scalar, PixError<Self::Pseudonym>>where
Self: Sized,
fn msg_to_scalar(
spi: &SsaPolynomialId<Self::Pseudonym>,
msg: impl AsRef<[u8]>,
) -> Result<<Self::Curve as CurveArithmetic>::Scalar, PixError<Self::Pseudonym>>where
Self: Sized,
Performs conversion of the given spi and msg into PixScalar of this spec.
Sourcefn commitment_proof_challenge(
ssa_id: &SsaId<Self::Pseudonym>,
ssa_commitment: &<Self::Curve as CurveArithmetic>::ProjectivePoint,
nonce_commitment: &<Self::Curve as CurveArithmetic>::ProjectivePoint,
) -> Result<<Self::Curve as CurveArithmetic>::Scalar, PixError<Self::Pseudonym>>where
Self: Sized,
fn commitment_proof_challenge(
ssa_id: &SsaId<Self::Pseudonym>,
ssa_commitment: &<Self::Curve as CurveArithmetic>::ProjectivePoint,
nonce_commitment: &<Self::Curve as CurveArithmetic>::ProjectivePoint,
) -> Result<<Self::Curve as CurveArithmetic>::Scalar, PixError<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§
Source§impl PixSpec for HoprPixSpec
Available on crate feature pix-bjj and non-crate feature pix-secp256k1 only.
impl PixSpec for HoprPixSpec
pix-bjj and non-crate feature pix-secp256k1 only.