-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
158 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,78 @@ | ||
use cairo_verifier::vector_commitment::VectorCommitmentConfig; | ||
use cairo_verifier::vector_commitment::{VectorCommitmentConfig, VectorUnsentCommitment, VectorCommitment, VectorCommitmentWitness}; | ||
use cairo_verifier::channel::channel::ChannelSentFelt; | ||
|
||
// Commitment values for a table commitment protocol. Used to generate a commitment by "reading" | ||
// these values from the channel. | ||
#[derive(Drop, Copy)] | ||
struct TableUnsentCommitment { | ||
a: felt252, // dummy | ||
// vector: VectorUnsentCommitment, | ||
vector: VectorUnsentCommitment, | ||
} | ||
|
||
// Commitment for a table (n_rows x n_columns) of field elements in montgomery form. | ||
#[derive(Drop, Copy)] | ||
struct TableCommitment { | ||
a: felt252, // dummy | ||
// config: TableCommitmentConfig*, | ||
// vector_commitment: VectorCommitment*, | ||
config: TableCommitmentConfig, | ||
vector_commitment: VectorCommitment, | ||
} | ||
|
||
#[derive(Drop, Copy)] | ||
struct TableCommitmentConfig { | ||
columns: felt252, | ||
vector: VectorCommitmentConfig | ||
n_columns: felt252, | ||
vector: VectorCommitmentConfig, | ||
} | ||
|
||
// Responses for queries to the table commitment. | ||
// Each query corresponds to a full row of the table. | ||
#[derive(Drop, Copy)] | ||
struct TableDecommitment { | ||
// n_columns * n_queries values to decommit. | ||
n_values: felt252, | ||
values: Span<felt252>, | ||
} | ||
|
||
// Witness for a decommitment over queries. | ||
#[derive(Drop, Copy)] | ||
struct TableCommitmentWitness { | ||
vector: VectorCommitmentWitness, | ||
} | ||
|
||
fn table_commit( | ||
unsent_commitment: TableUnsentCommitment, config: TableCommitmentConfig | ||
) -> TableCommitment { | ||
TableCommitment { a: 0 } | ||
TableCommitment { | ||
config: TableCommitmentConfig { | ||
n_columns: 0, | ||
vector: VectorCommitmentConfig { | ||
height: 0, | ||
n_verifier_friendly_commitment_layers: 0, | ||
} | ||
}, | ||
vector_commitment: VectorCommitment { | ||
config: VectorCommitmentConfig { | ||
height: 0, | ||
n_verifier_friendly_commitment_layers: 0, | ||
}, | ||
commitment_hash: ChannelSentFelt { | ||
value: 0, | ||
} | ||
} | ||
} | ||
} | ||
|
||
// Decommits a TableCommitment at multiple indices. | ||
// rows must be sorted and unique. | ||
// Args: | ||
// commitment - the table commitment. | ||
// n_queries - number of queries to decommit. | ||
// queries - the claimed indices. | ||
// decommitment - the claimed values at those indices. | ||
// witness - the decommitment witness. | ||
fn table_decommit( | ||
commitment: TableCommitment, | ||
n_queries: felt252, | ||
queries: felt252, | ||
decommitment: TableDecommitment, | ||
witness: TableCommitmentWitness, | ||
) { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters