-
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
1 parent
ffb6739
commit fb69e46
Showing
8 changed files
with
161 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,22 @@ | ||
target | ||
.snfoundry_cache/ | ||
|
||
# Generated by Cargo | ||
# will have compiled files and executables | ||
**/debug/ | ||
**/target/ | ||
|
||
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries | ||
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html | ||
**/Cargo.lock | ||
|
||
# These are backup files generated by rustfmt | ||
**/*.rs.bk | ||
|
||
# MSVC Windows builds of rustc generate these, which store debugging information | ||
*.pdb | ||
|
||
# Scarb | ||
**/Scarb.lock | ||
|
||
# vscode | ||
**/.vscode/ |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[package] | ||
name = "runner" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
anyhow = "1.0.76" | ||
clap = { version = "4.4.11", features = ["derive"] } | ||
serde = { version = "1.0.193", features = ["derive"] } | ||
serde_json = "1.0.108" |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[ | ||
[ | ||
[ | ||
[ | ||
12, | ||
[ | ||
24, | ||
9 | ||
] | ||
], | ||
[ | ||
3, | ||
[ | ||
24, | ||
9 | ||
] | ||
] | ||
] | ||
] | ||
] |
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use std::fs::File; | ||
use std::io::BufReader; | ||
|
||
use clap::Parser; | ||
use serde_json::Value; | ||
|
||
#[derive(Parser)] | ||
#[command(author, version, about, long_about = None)] | ||
struct Cli { | ||
/// Path to the input file | ||
#[clap(default_value = "resources/input.json")] | ||
path: String, | ||
} | ||
|
||
fn main() -> anyhow::Result<()> { | ||
let args = Cli::parse(); | ||
let file = File::open(args.path)?; | ||
let reader = BufReader::new(file); | ||
|
||
let v: Value = serde_json::from_reader(reader)?; | ||
|
||
let flattened = flatten_recursively(&v); | ||
|
||
println!("{:?}", flattened.collect::<Vec<u64>>()); | ||
|
||
Ok(()) | ||
} | ||
|
||
fn flatten_recursively(v: &Value) -> Box<dyn Iterator<Item = u64> + '_> { | ||
match v { | ||
Value::Array(array) => Box::new(array.iter().flat_map(flatten_recursively)), | ||
Value::Number(v) => Box::new(std::iter::once(v.as_u64().unwrap())), | ||
_ => Box::new(std::iter::empty()), | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
mod stark_config; | ||
mod stark_proof; |
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#[derive(Drop)] | ||
struct StarkConfig { | ||
traces: TracesConfig, | ||
// composition: TableCommitmentConfig, | ||
// fri: FriConfig, | ||
// proof_of_work: ProofOfWorkConfig, | ||
// // Log2 of the trace domain size. | ||
// log_trace_domain_size: felt252, | ||
// // Number of queries to the last component, FRI. | ||
// n_queries: felt252, | ||
// // Log2 of the number of cosets composing the evaluation domain, where the coset size is the | ||
// // trace length. | ||
// log_n_cosets: felt252, | ||
// // Number of layers that use a verifier friendly hash in each commitment. | ||
// n_verifier_friendly_commitment_layers: felt252, | ||
} | ||
|
||
#[derive(Drop)] | ||
struct TracesConfig { | ||
original: TableCommitmentConfig, | ||
interaction: TableCommitmentConfig, | ||
} | ||
|
||
#[derive(Drop)] | ||
struct TableCommitmentConfig { | ||
columns: felt252, | ||
vector: VectorCommitmentConfig | ||
} | ||
|
||
#[derive(Drop)] | ||
struct VectorCommitmentConfig { | ||
height: felt252, | ||
verifier_friendly_commitment_layers: felt252, | ||
} | ||
|
||
#[derive(Drop)] | ||
struct FriConfig { | ||
// Log2 of the size of the input layer to FRI. | ||
log_input_size: felt252, | ||
// Number of layers in the FRI. Inner + last layer. | ||
n_layers: felt252, | ||
// Array of size n_layers - 1, each entry is a configuration of a table commitment for the | ||
// corresponding inner layer. | ||
inner_layers: TableCommitmentConfig, | ||
// Array of size n_layers, each entry represents the FRI step size, | ||
// i.e. the number of FRI-foldings between layer i and i+1. | ||
fri_step_sizes: felt252, | ||
log_last_layer_degree_bound: felt252, | ||
} | ||
|
||
#[derive(Drop)] | ||
struct ProofOfWorkConfig { | ||
// Proof of work difficulty (number of bits required to be 0). | ||
n_bits: felt252, | ||
} |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use cairo_verifier::input_structs::stark_config::StarkConfig; | ||
|
||
#[derive(Drop)] | ||
struct StarkProof { | ||
config: StarkConfig, | ||
// public_input: PublicInput, | ||
// unsent_commitment: StarkUnsentCommitment, | ||
// witness: StarkWitness, | ||
} |
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,3 +1,10 @@ | ||
mod channel; | ||
mod common; | ||
mod input_structs; | ||
mod structs; | ||
|
||
use cairo_verifier::input_structs::stark_proof::StarkProof; | ||
|
||
fn main(stark_proof: StarkProof) -> (felt252, felt252) { | ||
(stark_proof.config.traces.original.columns, stark_proof.config.traces.interaction.columns) | ||
} |