Skip to content

Commit d2f3318

Browse files
zlangleyjonathanpwang
authored andcommitted
feat: update to provable params (#2301)
Syncs with openvm-org/stark-backend#202 closes INT-5601 --------- Co-authored-by: Jonathan Wang <31040440+jonathanpwang@users.noreply.github.com>
1 parent 841a59d commit d2f3318

File tree

17 files changed

+85
-80
lines changed

17 files changed

+85
-80
lines changed

.github/workflows/sdk.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
tests:
2727
strategy:
2828
matrix:
29-
ignored: [true, false]
29+
mode: ["default", "ignored", "aot"]
3030

3131
runs-on:
3232
- runs-on=${{ github.run_id }}-sdk-${{ github.run_attempt }}-${{ strategy.job-index }}/family=m7a.24xlarge/image=ubuntu24-full-x64/disk=large/extras=s3-cache
@@ -58,15 +58,15 @@ jobs:
5858
bash ../../extensions/native/recursion/trusted_setup_s3.sh
5959
6060
- name: Run openvm-sdk contracts/ tests
61-
if: ${{ matrix.ignored == false }}
61+
if: ${{ matrix.mode == 'default' }}
6262
working-directory: crates/sdk/contracts
6363
run: |
6464
forge fmt --check
6565
forge build --sizes
6666
forge test
6767
6868
- name: Check IOpenVmHalo2Verifier.sol abi correctness
69-
if: ${{ matrix.ignored == false }}
69+
if: ${{ matrix.mode == 'default' }}
7070
working-directory: crates/sdk/contracts
7171
run: |
7272
forge build
@@ -75,16 +75,23 @@ jobs:
7575
diff -u expected_abi_sorted.json compiled_abi.json
7676
7777
- name: Run openvm-sdk crate tests
78-
if: ${{ matrix.ignored == false }}
78+
if: ${{ matrix.mode == 'default' }}
7979
working-directory: crates/sdk
8080
run: |
8181
export RUST_BACKTRACE=1
8282
export RUST_MIN_STACK=8388608
8383
CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS=true cargo nextest run --release --features parallel,evm-verify
84+
85+
- name: Run openvm-sdk crate tests (AOT)
86+
if: ${{ matrix.mode == 'aot' }}
87+
working-directory: crates/sdk
88+
run: |
89+
export RUST_BACKTRACE=1
90+
export RUST_MIN_STACK=8388608
8491
CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS=true cargo nextest run --release --features parallel,evm-verify,aot
8592
8693
- name: Run ignored tests
87-
if: ${{ matrix.ignored == true }}
94+
if: ${{ matrix.mode == 'ignored' }}
8895
working-directory: crates/sdk
8996
# if: ${{ github.event_name == 'push' }}
9097
run: |

Cargo.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

benchmarks/guest/kitchen-sink/openvm.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
[app_vm_config.modular]
99
supported_moduli = [
10-
"1000000000000000003",
1110
# secp256k1
1211
"115792089237316195423570985008687907853269984665640564039457584007908834671663", # coordinate
1312
"115792089237316195423570985008687907852837564279074904382605163141518161494337", # scalar
@@ -22,7 +21,6 @@ supported_moduli = [
2221
"52435875175126190479447740508185965837690552500527637822603658699938581184513", # scalar
2322
# 2^61 - 1
2423
"2305843009213693951",
25-
"7",
2624
]
2725

2826
[app_vm_config.fp2]
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// This file is automatically generated by cargo openvm. Do not rename or edit.
2-
openvm_algebra_guest::moduli_macros::moduli_init! { "1000000000000000003", "115792089237316195423570985008687907853269984665640564039457584007908834671663", "115792089237316195423570985008687907852837564279074904382605163141518161494337", "115792089210356248762697446949407573530086143415290314195533631308867097853951", "115792089210356248762697446949407573529996955224135760342422259061068512044369", "21888242871839275222246405745257275088696311157297823662689037894645226208583", "21888242871839275222246405745257275088548364400416034343698204186575808495617", "4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787", "52435875175126190479447740508185965837690552500527637822603658699938581184513", "2305843009213693951", "7" }
3-
openvm_algebra_guest::complex_macros::complex_init! { "Bn254Fp2" { mod_idx = 5 }, "Bls12_381Fp2" { mod_idx = 7 } }
2+
openvm_algebra_guest::moduli_macros::moduli_init! { "115792089237316195423570985008687907853269984665640564039457584007908834671663", "115792089237316195423570985008687907852837564279074904382605163141518161494337", "115792089210356248762697446949407573530086143415290314195533631308867097853951", "115792089210356248762697446949407573529996955224135760342422259061068512044369", "21888242871839275222246405745257275088696311157297823662689037894645226208583", "21888242871839275222246405745257275088548364400416034343698204186575808495617", "4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787", "52435875175126190479447740508185965837690552500527637822603658699938581184513", "2305843009213693951" }
3+
openvm_algebra_guest::complex_macros::complex_init! { "Bn254Fp2" { mod_idx = 4 }, "Bls12_381Fp2" { mod_idx = 6 } }
44
openvm_ecc_guest::sw_macros::sw_init! { "Secp256k1Point", "P256Point", "Bn254G1Affine", "Bls12_381G1Affine" }

benchmarks/guest/kitchen-sink/src/main.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ use {
2323

2424
// Note: these will all currently be represented as bytes32 even though they could be smaller
2525
openvm_algebra_guest::moduli_macros::moduli_declare! {
26-
Seven { modulus = "7" },
27-
Mod1e18 { modulus = "1000000000000000003" },
2826
Mersenne61 { modulus = "0x1fffffffffffffff" },
2927
}
3028

@@ -67,7 +65,6 @@ fn materialize_ecc_chip<T: WeierstrassPoint + CyclicGroup>() {
6765
pub fn main() {
6866
// Since we don't explicitly call setup functions anymore, we must ensure every declared modulus
6967
// and curve chip is materialized.
70-
materialize_modular_chip::<Mod1e18>();
7168
materialize_modular_chip::<Secp256k1Coord>();
7269
materialize_modular_chip::<Secp256k1Scalar>();
7370
materialize_modular_chip::<P256Coord>();
@@ -77,7 +74,6 @@ pub fn main() {
7774
materialize_modular_chip::<Bls12_381Fp>();
7875
materialize_modular_chip::<Bls12_381Scalar>();
7976
materialize_modular_chip::<Mersenne61>();
80-
materialize_modular_chip::<Seven>();
8177

8278
materialize_complex_chip!(Bn254Fp2, Bn254Fp);
8379
materialize_complex_chip!(Bls12_381Fp2, Bls12_381Fp);
@@ -87,14 +83,6 @@ pub fn main() {
8783
materialize_ecc_chip::<Bn254G1Affine>();
8884
materialize_ecc_chip::<Bls12_381G1Affine>();
8985

90-
let [one, six] = [1, 6].map(Seven::from_u32);
91-
assert_eq!(one + six, Seven::ZERO);
92-
93-
let y = Mod1e18::from_u32(100);
94-
let y = (&y * &y) * &y;
95-
let y = y.clone() * y.clone() * y.clone();
96-
assert_eq!(y + Mod1e18::from_u32(3), Mod1e18::ZERO);
97-
9886
let mut bytes = [0u8; 32];
9987
bytes[7] = 1 << 5; // 2^61 = modulus + 1
10088
let mut res = Mersenne61::from_le_bytes_unchecked(&bytes); // No need to start from reduced representation

benchmarks/prove/src/bin/verify_fibair.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fn main() -> Result<()> {
3737

3838
let n = 1 << 15; // STARK to calculate (2 ** 15)th Fibonacci number.
3939
let fib_chip = FibonacciChip::new(0, 1, n);
40-
let engine = Poseidon2Engine::new(FriParameters::standard_with_100_bits_conjectured_security(
40+
let engine = Poseidon2Engine::new(FriParameters::standard_with_100_bits_security(
4141
app_log_blowup,
4242
));
4343

@@ -52,8 +52,7 @@ fn main() -> Result<()> {
5252
let fib_ctx = fib_ctx.into_iter().map(cpu_proving_ctx_to_gpu).collect();
5353
let vdata = engine.run_test(fib_air, fib_ctx).unwrap();
5454
// Unlike other apps, this "app" does not have continuations enabled.
55-
let app_fri_params =
56-
FriParameters::standard_with_100_bits_conjectured_security(leaf_log_blowup);
55+
let app_fri_params = FriParameters::standard_with_100_bits_security(leaf_log_blowup);
5756
let mut app_vm_config = NativeConfig::aggregation(
5857
DEFAULT_MAX_NUM_PUBLIC_VALUES,
5958
app_fri_params.max_constraint_degree().min(7),

benchmarks/prove/src/util.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,9 @@ impl BenchmarkCli {
9999
app_vm_config.as_mut().segmentation_limits.max_cells = max_cells;
100100
}
101101
AppConfig {
102-
app_fri_params: FriParameters::standard_with_100_bits_conjectured_security(
103-
app_log_blowup,
104-
)
105-
.into(),
102+
app_fri_params: FriParameters::standard_with_100_bits_security(app_log_blowup).into(),
106103
app_vm_config,
107-
leaf_fri_params: FriParameters::standard_with_100_bits_conjectured_security(
108-
leaf_log_blowup,
109-
)
110-
.into(),
104+
leaf_fri_params: FriParameters::standard_with_100_bits_security(leaf_log_blowup).into(),
111105
compiler_options: CompilerOptions {
112106
enable_cycle_tracker: self.profiling,
113107
..Default::default()
@@ -124,7 +118,7 @@ impl BenchmarkCli {
124118

125119
let [leaf_fri_params, internal_fri_params, root_fri_params] =
126120
[leaf_log_blowup, internal_log_blowup, root_log_blowup]
127-
.map(FriParameters::standard_with_100_bits_conjectured_security);
121+
.map(FriParameters::standard_with_100_bits_security);
128122

129123
AggregationConfig {
130124
leaf_fri_params,

ci/benchmark-config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"e2e_bench": true,
7878
"run_params": [
7979
{
80-
"instance_type": "g6.2xlarge",
80+
"instance_type": "g6e.4xlarge",
8181
"memory_allocator": "jemalloc",
8282
"app_log_blowup": 1,
8383
"leaf_log_blowup": 1,
@@ -105,4 +105,4 @@
105105
]
106106
}
107107
]
108-
}
108+
}

crates/circuits/poseidon2-air/src/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use openvm_stark_backend::{
77
use openvm_stark_sdk::{
88
config::{
99
baby_bear_poseidon2::BabyBearPoseidon2Engine,
10-
fri_params::standard_fri_params_with_100_bits_conjectured_security,
10+
fri_params::standard_fri_params_with_100_bits_security,
1111
},
1212
engine::StarkFriEngine,
1313
p3_baby_bear::BabyBear,
@@ -41,7 +41,7 @@ fn run_poseidon2_subchip_test(subchip: Arc<Poseidon2SubChip<BabyBear, 0>>, rng:
4141
.collect();
4242
let mut poseidon2_trace = subchip.generate_trace(states.clone());
4343

44-
let fri_params = standard_fri_params_with_100_bits_conjectured_security(3); // max constraint degree = 7 requires log blowup = 3
44+
let fri_params = standard_fri_params_with_100_bits_security(3); // max constraint degree = 7 requires log blowup = 3
4545
let engine = BabyBearPoseidon2Engine::new(fri_params);
4646

4747
// positive test

crates/cli/src/default.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,16 @@ pub fn default_evm_halo2_verifier_path() -> String {
3434

3535
pub fn default_app_config() -> AppConfig<SdkVmConfig> {
3636
AppConfig {
37-
app_fri_params: FriParameters::standard_with_100_bits_conjectured_security(
38-
DEFAULT_APP_LOG_BLOWUP,
39-
)
40-
.into(),
37+
app_fri_params: FriParameters::standard_with_100_bits_security(DEFAULT_APP_LOG_BLOWUP)
38+
.into(),
4139
app_vm_config: SdkVmConfig::builder()
4240
.system(Default::default())
4341
.rv32i(Default::default())
4442
.rv32m(Default::default())
4543
.io(Default::default())
4644
.build(),
47-
leaf_fri_params: FriParameters::standard_with_100_bits_conjectured_security(
48-
DEFAULT_LEAF_LOG_BLOWUP,
49-
)
50-
.into(),
45+
leaf_fri_params: FriParameters::standard_with_100_bits_security(DEFAULT_LEAF_LOG_BLOWUP)
46+
.into(),
5147
compiler_options: Default::default(),
5248
}
5349
}

0 commit comments

Comments
 (0)