Skip to content

Commit

Permalink
channel bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Okm165 committed Dec 20, 2023
1 parent b994efa commit 0cd73e9
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/channel/channel.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ impl ChannelImpl of ChannelTrait {
let mut res = ArrayTrait::<felt252>::new();
loop {
if n != 0 {
res.append(self.random_felt_to_prover())
res.append(self.random_felt_to_prover());
n -= 1;
} else {
break;
}
Expand Down
7 changes: 5 additions & 2 deletions src/common/tests/test_math.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ fn test_mul_inverse_3() {
fn test_mul_inverse_4() {
let x = 3;
let inv_x = mul_inverse(x);
assert(inv_x == 1206167596222043737899107594365023368541035738443865566657697352045290673494, 'Invalid value');
assert(
inv_x == 1206167596222043737899107594365023368541035738443865566657697352045290673494,
'Invalid value'
);
assert(x * inv_x == 1, 'Invalid value');
}

Expand All @@ -73,4 +76,4 @@ fn test_mul_inverse_6() {
let x = 19345680409051406060084;
let inv_inv_x = mul_inverse(mul_inverse(x));
assert(x == inv_inv_x, 'Invalid value');
}
}
3 changes: 2 additions & 1 deletion src/lib.cairo
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const FIELD_GENERATOR: felt252 = 3;
const FIELD_GENERATOR_INV: felt252 = 1206167596222043737899107594365023368541035738443865566657697352045290673494;
const FIELD_GENERATOR_INV: felt252 =
1206167596222043737899107594365023368541035738443865566657697352045290673494;

mod channel;
mod common;
Expand Down
11 changes: 8 additions & 3 deletions src/table_commitment.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,27 @@
// these values from the channel.
#[derive(Drop, Copy)]
struct TableUnsentCommitment {
a: felt252, // dummy
// 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*,
}

#[derive(Drop, Copy)]
struct TableCommitmentConfig {
a: felt252, // dummy
// n_columns: felt,
// vector: VectorCommitmentConfig*,
}

fn table_commit(unsent_commitment: TableUnsentCommitment, config: TableCommitmentConfig) -> TableCommitment{
TableCommitment{}
}
fn table_commit(
unsent_commitment: TableUnsentCommitment, config: TableCommitmentConfig
) -> TableCommitment {
TableCommitment {a: 0}
}
3 changes: 3 additions & 0 deletions src/vector_commitment.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@
// values from the channel.
#[derive(Drop)]
struct VectorUnsentCommitment {
a: felt252, // dummy
// commitment_hash: ChannelUnsentFelt,
}

// Commitment for a vector of field elements.
#[derive(Drop)]
struct VectorCommitment {
a: felt252, // dummy
// config: VectorCommitmentConfig*,
// commitment_hash: ChannelSentFelt,
}

#[derive(Drop)]
struct VectorCommitmentConfig {
a: felt252, // dummy
// height: felt,
// n_verifier_friendly_commitment_layers: felt,
}

0 comments on commit 0cd73e9

Please sign in to comment.