Skip to content

Commit

Permalink
Merge pull request #51 from iosis-tech/fix/swiftness_air/stack
Browse files Browse the repository at this point in the history
swiftness_air stack size guard
  • Loading branch information
Okm165 authored Dec 18, 2024
2 parents ccb89e8 + e068a5b commit fa1b7c6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/air/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repository.workspace = true
version.workspace = true

[features]
default = ["std", "dynamic", "keccak_160_lsb", "stone5"]
default = ["std", "recursive", "keccak_160_lsb", "stone5"]
std = [
"dep:thiserror",
"swiftness_commitment/std",
Expand Down
25 changes: 25 additions & 0 deletions crates/air/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
fn main() {
if cfg!(feature = "dynamic") {
/*
MIN_STACK_SIZE:
8 MB: 8388608
16 MB: 16777216
32 MB: 33554432
64 MB: 67108864
*/
const MIN_STACK_SIZE: usize = 16_777_216;
println!("cargo:rerun-if-env-changed=RUST_MIN_STACK");

let rust_min_stack: usize = std::env::var("RUST_MIN_STACK")
.expect("Environment variable RUST_MIN_STACK must be set. Set it to at least 16777216.")
.parse()
.expect("RUST_MIN_STACK must be a valid integer.");

if rust_min_stack < MIN_STACK_SIZE {
panic!(
"RUST_MIN_STACK must be at least {}. Current value: {}.",
MIN_STACK_SIZE, rust_min_stack
);
}
}
}

0 comments on commit fa1b7c6

Please sign in to comment.