Skip to content

sigma_protocol_statement - [devnet]

use 0x1::ristretto255;

Constants

When creating a Statement, the # of points must match the # of compressed points.

const E_MISMATCHED_NUMBER_OF_COMPRESSED_POINTS: u64 = 1;

Structs

Statement

A public statement consists of:

  • a points vector of n1n_1 group elements
  • a compressed_points vector of n1n_1 compressed group elements (redundant, for faster Fiat-Shamir)
  • a scalars vector of n2n_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>

Functions

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 }
}

get_point

Returns the iith 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]
}

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
}

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
}

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
}