Module 0x1::sigma_protocol_statement
- Struct
Statement - Constants
- Function
new_statement - Function
get_point - Function
get_scalars - Function
get_points - Function
get_compressed_points
use 0x1::error;
use 0x1::ristretto255;
Struct Statement
A public statement consists of:
- a
pointsvector of $n_1$ group elements - a
compressed_pointsvector of $n_1$ compressed group elements (redundant, for faster Fiat-Shamir) - a
scalarsvector of $n_2$ scalars
The phantom type parameter P tags the statement with a specific protocol marker type
(e.g., Registration, KeyRotation, etc.) for compile-time safety.
struct Statement<P> has drop
Fields
-
points: vector<ristretto255::RistrettoPoint> -
compressed_points: vector<ristretto255::CompressedRistretto> -
scalars: vector<ristretto255::Scalar>
Constants
When creating a Statement, the # of points must match the # of compressed points.
const E_MISMATCHED_NUMBER_OF_COMPRESSED_POINTS: u64 = 1;
Function new_statement
public(friend) fun new_statement<P>(points: vector<ristretto255::RistrettoPoint>, compressed_points: vector<ristretto255::CompressedRistretto>, scalars: vector<ristretto255::Scalar>): sigma_protocol_statement::Statement<P>
Implementation
public(friend) fun new_statement<P>(
points: vector<RistrettoPoint>,
compressed_points: vector<CompressedRistretto>,
scalars: vector<Scalar>
): Statement<P> {
assert!(points.length() == compressed_points.length(), error::invalid_argument(E_MISMATCHED_NUMBER_OF_COMPRESSED_POINTS));
Statement { points, compressed_points, scalars }
}
Function get_point
Returns the $i$th elliptic curve point in the public statement.
public(friend) fun get_point<P>(self: &sigma_protocol_statement::Statement<P>, i: u64): &ristretto255::RistrettoPoint
Implementation
public(friend) fun get_point<P>(self: &Statement<P>, i: u64): &RistrettoPoint {
&self.points[i]
}
Function get_scalars
Returns all the scalars in the statement. (Needed to feed in the statement in the Fiat-Shamir transform.)
public(friend) fun get_scalars<P>(self: &sigma_protocol_statement::Statement<P>): &vector<ristretto255::Scalar>
Implementation
public(friend) fun get_scalars<P>(self: &Statement<P>): &vector<Scalar> {
&self.scalars
}
Function get_points
Returns all the elliptic curve points in the statement.
public(friend) fun get_points<P>(self: &sigma_protocol_statement::Statement<P>): &vector<ristretto255::RistrettoPoint>
Implementation
public(friend) fun get_points<P>(self: &Statement<P>): &vector<RistrettoPoint> {
&self.points
}
Function get_compressed_points
Returns all the compressed elliptic curve points in the statement. (Needed to feed in the statement in the Fiat-Shamir transform.)
public(friend) fun get_compressed_points<P>(self: &sigma_protocol_statement::Statement<P>): &vector<ristretto255::CompressedRistretto>
Implementation
public(friend) fun get_compressed_points<P>(self: &Statement<P>): &vector<CompressedRistretto> {
&self.compressed_points
}