Skip to content

Commit

Permalink
FriWitness
Browse files Browse the repository at this point in the history
  • Loading branch information
neotheprogramist committed Dec 31, 2023
1 parent d13b6b1 commit deddf85
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions runner/src/parser.lalrpop
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,23 @@ CairoParserOutputInner: Exprs = {
<n:Num> => Exprs(vec![Expr::Value(n)]),
"[" <n:Comma<CairoParserOutputInner>> "]" => Exprs(vec![Expr::Array(n.iter().flat_map(|x| x.iter().cloned()).collect())]),
StructName "()" => Exprs(Vec::new()),
"FriWitness" "(" "layers=" "[" <n:Comma<FriWitnessLayers>> "]" ")" => Exprs(vec![Expr::Array(n.iter().flat_map(|x| x.iter().cloned()).collect())]),
StructName "(" <n:Comma<Arg>> ")" => Exprs(n.iter().flat_map(|x| x.iter().cloned()).collect()),
};

Arg: Exprs = {
ArgName "=" <n:CairoParserOutputInner> => n,
};

FriWitnessLayers: Exprs = {
<n:Num> "," "[" <a:Comma<Num>> "]" => Exprs(vec![Expr::Value(n)].into_iter().chain(a.into_iter().map(|x| Expr::Value(x))).collect()),
StructName "(" ArgName "=" StructName "(" <n:FriWitnessLayersArgs> ")" ")" => n,
};

FriWitnessLayersArgs: Exprs = {
ArgName "=" <n:Num> "," ArgName "=" "[" <a:Comma<Num>> "]" => Exprs(vec![Expr::Value(n)].into_iter().chain(a.into_iter().map(|x| Expr::Value(x))).collect()),
};

Comma<T>: Vec<T> = {
<mut v:(<T> ",")*> <e:T?> => match e {
None => v,
Expand Down
3 changes: 2 additions & 1 deletion src/input_structs/stark_witness.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ struct StarkWitness {
interaction: TableCommitmentWitness,
composition_decommitment: TableDecommitment,
composition_witness: TableCommitmentWitness,
fri_witness: FriWitness,
}

#[derive(Drop, Serde)]
Expand Down Expand Up @@ -37,5 +38,5 @@ struct VectorCommitmentWitness {

#[derive(Drop, Serde)]
struct FriWitness {
layers: Array<Array<felt252>>,
layers: Array<felt252>,
}

0 comments on commit deddf85

Please sign in to comment.