Skip to content

Commit 931b8f3

Browse files
committed
Commit error for JBR corrrected
1 parent 5af322a commit 931b8f3

File tree

8 files changed

+65
-41
lines changed

8 files changed

+65
-41
lines changed

results.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ How to read this report:
2222
- Grinding (bits): 0
2323
- Field: Goldilocks³
2424
- Rate (ρ): 0.5
25-
- Trace length (H): $2^{22}$
25+
- Trace length (H): $2^{16}$
2626
- FRI folding factor: 16
2727
- FRI early stop degree: 32
2828
- Batching: Powers
2929

30-
**Proof Size Estimate:** 992 KiB, where 1 KiB = 1024 bytes
30+
**Proof Size Estimate:** 24678 KiB, where 1 KiB = 1024 bytes
3131

32-
| regime | total | ALI | DEEP | FRI batching round | FRI commit rounds (×5) | FRI query phase |
33-
| --- | --- | --- | --- | --- | --- | --- |
34-
| UDR | 53 | 185 | 167 | 162 | 165 | 53 |
35-
| JBR | 58 | 181 | 163 | 142 | 159 | 58 |
36-
| best attack | 128 ||||||
32+
| regime | total | ALI | DEEP | FRI batching round | FRI commit round 1 | FRI commit round 2 | FRI commit round 3 | FRI query phase |
33+
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
34+
| UDR | 53 | 180 | 173 | 163 | 171 | 171 | 171 | 53 |
35+
| JBR | 58 | 175 | 169 | 141 | 153 | 157 | 161 | 58 |
36+
| best attack | 128 ||||||||
3737

3838
## Miden
3939

@@ -51,11 +51,11 @@ How to read this report:
5151

5252
**Proof Size Estimate:** 175 KiB, where 1 KiB = 1024 bytes
5353

54-
| regime | total | ALI | DEEP | FRI batching round | FRI commit rounds (×7) | FRI query phase |
55-
| --- | --- | --- | --- | --- | --- | --- |
56-
| UDR | 38 | 121 | 106 | 100 | 105 | 38 |
57-
| JBR | 55 | 115 | 101 | 77 | 98 | 55 |
58-
| best attack | 96 ||||||
54+
| regime | total | ALI | DEEP | FRI batching round | FRI commit round 1 | FRI commit round 2 | FRI commit round 3 | FRI commit round 4 | FRI commit round 5 | FRI commit round 6 | FRI commit round 7 | FRI query phase |
55+
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
56+
| UDR | 38 | 121 | 106 | 100 | 105 | 105 | 105 | 105 | 105 | 105 | 105 | 38 |
57+
| JBR | 55 | 115 | 101 | 76 | 83 | 85 | 87 | 89 | 91 | 93 | 95 | 55 |
58+
| best attack | 96 ||||||||||||
5959

6060
## RISC0
6161

@@ -73,11 +73,11 @@ How to read this report:
7373

7474
**Proof Size Estimate:** 576 KiB, where 1 KiB = 1024 bytes
7575

76-
| regime | total | ALI | DEEP | FRI batching round | FRI commit rounds (×4) | FRI query phase |
77-
| --- | --- | --- | --- | --- | --- | --- |
78-
| UDR | 33 | 115 | 100 | 92 | 96 | 33 |
79-
| JBR | 47 | 110 | 95 | 70 | 90 | 47 |
80-
| best attack | 99 ||||||
76+
| regime | total | ALI | DEEP | FRI batching round | FRI commit round 1 | FRI commit round 2 | FRI commit round 3 | FRI commit round 4 | FRI query phase |
77+
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
78+
| UDR | 33 | 115 | 100 | 92 | 96 | 96 | 96 | 96 | 33 |
79+
| JBR | 47 | 110 | 95 | 69 | 78 | 82 | 86 | 90 | 47 |
80+
| best attack | 99 |||||||||
8181

8282
## DummyWHIR
8383

soundcalc/__main__.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
from __future__ import annotations
2+
import argparse
23

34
from .main import main
45

5-
66
if __name__ == "__main__":
7-
main()
7+
parser = argparse.ArgumentParser(
8+
description="soundcalc - Analyze zkVM security levels"
9+
)
10+
parser.add_argument(
11+
"--print-only",
12+
nargs="+",
13+
help="Only print specified zkVMs to console (e.g., --print-only ZisK Miden)",
14+
default=None,
15+
)
16+
17+
args = parser.parse_args()
18+
main(print_only=args.print_only)
819

920

1021

soundcalc/main.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def print_summary_for_zkvm(zkvm: zkVM, security_levels: dict | None = None) -> N
4646
print("")
4747
print("")
4848

49-
def main() -> None:
49+
def main(print_only: list[str] | None = None) -> None:
5050
"""
5151
Main entry point for soundcalc
5252
@@ -67,7 +67,10 @@ def main() -> None:
6767
# Analyze each zkVM
6868
for zkvm in zkvms:
6969
security_levels = zkvm.get_security_levels()
70-
print_summary_for_zkvm(zkvm, security_levels)
70+
71+
if print_only is None or zkvm.get_name() in print_only:
72+
print_summary_for_zkvm(zkvm, security_levels)
73+
7174
sections[zkvm.get_name()] = (zkvm, security_levels)
7275

7376
# Generate and save markdown report

soundcalc/regimes/capacity_bound.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def get_batching_error(self, params: FRIParameters) -> float:
8181
error *= params.num_functions ** C2
8282
return error
8383

84-
def get_commit_phase_error(self, params: FRIParameters) -> float:
84+
def get_commit_phase_error(self, params: FRIParameters, round_idx: int) -> float:
8585
"""
8686
Returns the error for the FRI commit phase for this regime.
8787
"""

soundcalc/regimes/fri_regime.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def get_batching_error(self, params: FRIParameters) -> float:
6464
"""
6565
raise NotImplementedError
6666

67-
def get_commit_phase_error(self, params: FRIParameters) -> float:
67+
def get_commit_phase_error(self, params: FRIParameters, round_idx: int) -> float:
6868
"""
6969
Returns the error for the FRI commit phase for this regime.
7070
"""
@@ -85,7 +85,7 @@ def get_rbr_levels(self, params: FRIParameters) -> dict[str, int]:
8585
# Compute FRI error for folding / commit phase
8686
FRI_rounds = params.FRI_rounds_n
8787
for i in range(FRI_rounds):
88-
bits[f"FRI commit round {i+1}"] = get_bits_of_security_from_error(self.get_commit_phase_error(params))
88+
bits[f"FRI commit round {i+1}"] = get_bits_of_security_from_error(self.get_commit_phase_error(params, i))
8989

9090
# Compute FRI error for query phase
9191
theta = self.get_theta(params)

soundcalc/regimes/johnson_bound.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ def get_theta(self, params: FRIParameters) -> float:
4949
"""
5050
Returns the theta for the query phase error.
5151
"""
52+
53+
# This is a number in the range [(1 - ρ)/2, 1 - √ρ)
54+
5255
m = self._get_m()
5356
alpha, theta = self._get_alpha_and_theta(params.rho, m)
5457
return theta
@@ -74,27 +77,38 @@ def get_batching_error(self, params: FRIParameters) -> float:
7477
#
7578
# Then easiest way to see the difference is to compare Theorems 1.5 and 1.6.
7679

80+
# See Theorem 4.2 of BCHKS25.
81+
7782
m = self._get_m()
7883
rho = params.rho
7984
error = ((2*(m + 0.5) ** 5 + 3*(m + 0.5)*rho)) / (3 * rho * math.sqrt(rho)) * (params.D) / params.F
8085
if params.power_batching:
8186
error *= params.num_functions
8287
return error
8388

84-
def get_commit_phase_error(self, params: FRIParameters) -> float:
89+
def get_commit_phase_error(self, params: FRIParameters, round_idx: int) -> float:
8590
"""
8691
Returns the error for the FRI commit phase for this regime.
8792
"""
8893

89-
# See Theorem 8.3 of BCIKS20.
90-
# Also, seen in Theorem 2 of Ha22, and Theorem 1 of eSTARK paper.
94+
# The same as the batching error, but with the domain adjusted to each folding round.
95+
# In particular, if we let 𝜀 be the batching error we can obtain the commit error as:
96+
# 𝜀 * (folding_factorᵢ - 1) / Π folding_factors
9197

9298
# Note: This function is also used by CBR, but there is no good foundation for it yet.
9399
# TODO Find a better formula for CBR.
94100

95-
# TODO: check this formula carefully
96101
m = self._get_m()
97-
error = (2 * m + 1) * (params.D + 1) * params.folding_factor / (math.sqrt(params.rho) * params.F)
102+
rho = params.rho
103+
error = ((2*(m + 0.5) ** 5 + 3*(m + 0.5)*rho)) / (3 * rho * math.sqrt(rho)) * (params.D) / params.F
104+
105+
# Compute accumulated folding factor up to round_idx
106+
# TODO: This assumes all folding factors are the same. Generalize!!
107+
acc_folding_factor = 1
108+
for i in range(round_idx + 1):
109+
acc_folding_factor *= params.folding_factor
110+
111+
error *= (params.folding_factor - 1) / acc_folding_factor
98112
return error
99113

100114

@@ -123,6 +137,6 @@ def _get_minimal_m_plus(self, r_plus: float, alpha: float) -> int:
123137
# let m_plus = 1.0 / (params.biggest_combo * (alpha / rho_plus.sqrt() - 1.0));
124138
return math.ceil(1 / (2 * (alpha / math.sqrt(r_plus) - 1)))
125139

126-
def _get_m(self):
140+
def _get_m(self) -> int:
127141
m = get_johnson_parameter_m() # TODO DK: it is not clear if this is the right m to use. To investigate.
128142
return m

soundcalc/regimes/unique_decoding.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def get_batching_error(self, params: FRIParameters) -> float:
5353
error *= params.num_functions
5454
return error
5555

56-
def get_commit_phase_error(self, params: FRIParameters) -> float:
56+
def get_commit_phase_error(self, params: FRIParameters, round_idx: int) -> float:
5757
"""
5858
Returns the error for the FRI commit phase for this regime.
5959
"""

soundcalc/zkvms/zisk.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ def default() -> "ZiskPreset":
1818
https://eprint.iacr.org/2023/474
1919
"""
2020

21-
field = GOLDILOCKS_3
22-
2321
# We generate a STARK proof of different traces with different parameters.
2422
# Therefore, in what follows, I put the parameters for our worst-case trace in terms of area.
2523

@@ -30,9 +28,9 @@ def default() -> "ZiskPreset":
3028
blowup_factor = 2
3129
rho = 1 / blowup_factor
3230

33-
trace_length = 1 << 22
34-
num_columns = 66
35-
batch_size = num_columns + 2 # +2 for the composition polynomials
31+
trace_length = 1 << 16
32+
num_columns = 3022
33+
batch_size = 4065
3634

3735
num_queries = 128 // int(math.log2(blowup_factor))
3836

@@ -41,16 +39,14 @@ def default() -> "ZiskPreset":
4139
FRI_folding_factor = 2**4
4240
FRI_early_stop_degree = 2**5
4341

44-
max_combo = 3
45-
46-
hash_size_bits = 256 # TODO: check if that is actually true
42+
max_combo = 2
4743

4844
cfg = FRIBasedVMConfig(
4945
name="ZisK",
50-
hash_size_bits=hash_size_bits,
46+
hash_size_bits=256,
5147
rho=rho,
5248
trace_length=trace_length,
53-
field=field,
49+
field=GOLDILOCKS_3,
5450
num_columns=num_columns,
5551
batch_size=batch_size,
5652
power_batching=True,

0 commit comments

Comments
 (0)