Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation - Centralized Telescope: Parameters #103

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
6 changes: 6 additions & 0 deletions docs/rustdoc/centralized_telescope/intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Telescope - Construction with Bounded DFS

In scenarios where $n_p$ is small, the parameters given for prehashed construction (relative to the security parameter, $\lambda$) are not optimal, resulting in a reduced probability of constructing a valid proof in a single attempt.
For large $n_p$, the rapid growth in potential proof tuples ensures valid ones can be found efficiently, allowing the prehashed construction to work seamlessly.
In contrast, small $n_p$ limits the search space, making the previous parameters inadequate.
To address this, the **construction with bounded DFS** expands on the prehashed version with *retries*, *prehashing randomization*, and *bounding* the DFS.
7 changes: 0 additions & 7 deletions docs/rustdoc/centralized_telescope/main.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# Telescope - Construction with Bounded DFS

In scenarios where $n_p$ is small, the parameters given for prehashed construction (relative to the security parameter, $\lambda$) are not optimal, resulting in a reduced probability of constructing a valid proof in a single attempt.
For large $n_p$, the rapid growth in potential proof tuples ensures valid ones can be found efficiently, allowing the prehashed construction to work seamlessly.
In contrast, small $n_p$ limits the search space, making the previous parameters inadequate.
To address this, the **construction with bounded DFS** expands on the prehashed version with *retries*, *prehashing randomization*, and *bounding* the DFS.

## Overview
- When $n_p$ is large, the rapid increase in potential proof tuples enhances the chances of finding a valid proof, simplifying the construction process.
- For small $n_p$, the element distribution across bins is more likely to be skewed, some bins may contain multiple elements while others remain empty.
Expand Down
3 changes: 0 additions & 3 deletions docs/rustdoc/centralized_telescope/params.md

This file was deleted.

5 changes: 5 additions & 0 deletions docs/rustdoc/centralized_telescope/params/overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Centralized Telescope - Parameter Setup

The parameter setup ensures that the **DFS (Depth-First Search) algorithm** completes in a reasonable number of steps, even when the number of elements, $n_p$, is small.
- The scheme must handle both large and small $n_p$ efficiently while keeping proof generation practical.
- The goal is to **balance the prover's workload and the reliability of the proof**.
89 changes: 89 additions & 0 deletions docs/rustdoc/centralized_telescope/params/setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
## Parameter generation protocol
### Initialization
1. Set the proof size $u$:

$$
u \coloneqq \left\lceil \frac{\lambda_{\text{sec}} + \log \lambda_{\text{rel}} + 5 - \log \log e}{\log \left(\frac{n_p}{n_f}\right)} \right\rceil
$$

2. Set the check values $s_1$ and $s_2$:

$$
ratio \coloneqq \frac{9 n_p \log e}{(17u)^2}
$$

$$
s_1 \coloneqq ratio - 7, \quad s_2 \coloneqq ratio - 2.
$$

3. Set the values of $\lambda_{rel}^{(1)}$ and $\lambda_{rel}^{(2)}$:
- If $s_1 < 1 \implies \lambda_{rel}^{(1)} \coloneqq \bot$, else $\implies \lambda_{rel}^{(1)} \coloneqq \mathsf{min}(\lambda_{rel}, s_1)$
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
- If $s_2 < 1 \implies \lambda_{rel}^{(2)} \coloneqq \bot$, else $\implies \lambda_{rel}^{(2)} \coloneqq \mathsf{min}(\lambda_{rel}, s_2)$

### Cases
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cases here don't really correspond to small, intermediate and high cases that you outlined in strategy.md. The intermediate case there implies the number of repetitions r > 1, but cases 2 and 3 in this file can in principle set r = 1. So, cases 2 and 3 here really cover both intermediate and high cases but in different ways, depending on how u and lam_rel^(2) compare. Suggest changing wording.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@curiecrypt Just precise here that we use a different comparison for the intermediary and high cases instead of lambda^2 <= u < lambda^3 and u >= lambda^3

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the documentation should provide a bridging content between the code and the theory. I tried to create an intermediate-level text for someone who looks at the code first. Matching structure with code is more convenient to understand the content of the paper, I guess.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the biggest issue right now that prevent me from LGTMing.

#### Small case
If ($s_1 < 1$ or $s_2 < 1$) $\implies$ SMALL CASE, $\quad n_p \leq \lambda^2$.

$$
r \coloneqq \lceil \lambda_{rel} \rceil, \quad d \coloneqq \lceil 32\cdot \ln(12)\cdot u \rceil,
$$

$$
q \coloneqq \frac{2 \cdot \ln(12)}{d}, \quad b \coloneqq \Big\lfloor \frac{8 \cdot (u + 1) \cdot d}{\ln(12)} \Big\rfloor.
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
$$

---
#### Mid case
If $s_2 \ge 1$, we know that $\lambda_{rel}^{(2)} = \mathsf{min}(\lambda_{rel}, s_2)$.
In this case, if ($u \ge \lambda_{rel}^{(2)}$) $\implies$ MID CASE, $\quad \lambda^3 > n_p > \lambda^2$.

First, we set $\lambda_{rel}^{(1)}$, and compute $\overline{\lambda_{rel}}$ and $d$:
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved

$$
\lambda_{rel}^{(1)} \coloneqq \mathsf{min}(\lambda_{rel}, s_1 )
$$

$$
\overline{\lambda_{rel}} \coloneqq \frac{\lambda_{rel}^{(1)} + 7}{\log{e}}, \quad d \coloneqq \lceil 16 \cdot u \cdot \overline{\lambda_{rel}}\rceil
$$

Then, we check the prover's set size.
If $n_p \geq \frac{d^2}{9 \cdot \bar{\lambda}}$, we abort the process.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As in the "Cases", I wanted to adopt a similar structure as the code.

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. But this would abort only in debug mode.

Otherwise, we compute $w$, $r$, $q$, $b$ as follows:

$$
w \coloneqq \mathsf{min}\Big\\{w: w \in \mathbb{N} \wedge w \geq u \wedge \frac{14 \cdot w^2 \cdot (w + 2) \cdot e^\frac{w+1}{w}} {e \cdot (w + 2 - e^{1/w}) \cdot (w + 1)!} \le 2^{-\lambda_{rel}^{(1)}}\Big\\}
$$

For realistic values of $\lambda_{rel}^{(1)}$, $w = u$ can be used.

$$
r \coloneqq \Big\lceil\frac{\lambda_{rel}}{\lambda_{rel}^{(1)}}\Big\rceil, \quad q \coloneqq 2 \cdot \frac{\overline{\lambda_{rel}}}{d}
$$

$$
b \coloneqq \Bigg\lfloor\Big(\frac{w \overline{\lambda_{rel}}}{d} + 1\Big) \cdot \mathsf{exp}\Big(\frac{2 u w \overline{\lambda_{rel}}}{n_p} + \frac{7 u}{w}\Big)d u + d \Bigg\rfloor
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
$$

---
#### High case
Since $s_2 > 1$, $\lambda_{rel}^{(2)} = \mathsf{min}(\lambda_{rel}, s_2)$.
If ($u < \lambda_{rel}^{(2)}$) $\implies$ HIGH CASE, $\quad n_p \geq \lambda^3$.

First, we compute $d$:

$$
d \coloneqq \Bigg\lceil \frac{16 \cdot u \cdot (\lambda_{rel}^{(2)} + 2)}{\log{e}} \Bigg\rceil.
$$

Then, we check the prover's set size.
If $n_p \geq \frac{d^2 \cdot \log{e}}{9 \cdot (\lambda_{rel}^{(2)} + 2)}$, we abort the process.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similarly, why this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are assumptions in the paper from theorem 13/14 for the soundness and completeness bounds to be valid. We added them in code as we noticed that Case 1/2/3 and Small/Intermediary/High did not necessarily respect these. @curiecrypt must have added them here for exhaustivity

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly.

Otherwise, we compute $r$, $q$, $b$ as follows:

$$
r \coloneqq \Big\lceil \frac{\lambda_{rel}}{\lambda_{rel}^{(2)}} \Big\rceil, \quad q \coloneqq \frac{2 \cdot (\lambda_{rel}^{(2)} + 2)}{d \cdot \log{e}}
$$

$$
b \coloneqq \Bigg\lfloor\frac{\lambda_{rel}^{(2)} + 2 + \log{u}} {\lambda_{rel}^{(2)} + 2}\cdot \Big(3 \cdot u \cdot \frac{d}{4}\Big) + d + u\Bigg\rfloor
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
$$
20 changes: 20 additions & 0 deletions docs/rustdoc/centralized_telescope/params/strategy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## Parameter selection strategy
- When $n_p$ is large:
- If $n_p$ is at least $\lambda^3$, proof generation is straightforward.
- The prover can find a valid proof in roughly the time it takes to process all elements.
- The worst case, where the prover needs extra work, still remains within a manageable margin.
- When $n_p$ is small:
- If $n_p < \lambda^2$, the standard approach no longer guarantees that the prover finds a valid proof quickly.
- To fix this, we allow the prover to retry multiple times, increasing the chances of success without overwhelming computational cost.
- Extra retries increase reliability, but they must be controlled to avoid unnecessary work.
- Handling intermediate cases ($\lambda^2 < n_p < \lambda^3$):
- A hybrid strategy balances efficiency and reliability.
- The prover makes more retries than in the large $n_p$ case but fewer than in the small $n_p$ case.
- This keeps the average workload low while ensuring the proof remains trustworthy and compact.
- Keeping proof size practical:
- The number of elements included in the proof remains almost unchanged, ensuring that verification remains efficient.
- Security adjustments are made to prevent the prover from taking shortcuts that might compromise reliability.
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
- Preventing unbounded search:
- Without restrictions, DFS could explore too many possibilities before finding a valid proof.
- We limit the depth of the search, forcing it to stop early.
- This ensures that even in the worst case, the prover finishes within a predictable time frame.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## Parameters
- <a id="params-u">$u$</a> : Proof size $\implies$ `proof_size`
- <a id="params-d">$d$</a> : Maximum number of subtrees to search to find a proof $\implies$ `search_width`
- <a id="params-q">$q$</a> : Probability that a tuple of element is a valid proof $\implies$ `valid_proof_probability`
- <a id="params-r">$r$</a> : Maximum number of retries to find a proof $\implies$ `max_retries`
- <a id="params-b">$b$</a> : Maximum number of DFS calls permitted to find a proof $\implies$ `dfs_bound`
Empty file.
Empty file.
4 changes: 3 additions & 1 deletion src/centralized_telescope/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
//! ALBA's bounded DFS scheme using Blake2b as hash function.
//! (c.f. Section 3.2.2 of Alba paper)

#![doc = include_str!("../../docs/rustdoc/centralized_telescope/main.md")]
#![doc = include_str!("../../docs/rustdoc/centralized_telescope/intro.md")]
//!
//! See full documentation: [Telescope - Construction with Bounded DFS][crate::docs::centralized]

pub mod params;

Expand Down
10 changes: 9 additions & 1 deletion src/centralized_telescope/params.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
//! Centralized Telescope's `Params` structure comprising the internal parameters
#![doc = include_str!("../../docs/rustdoc/centralized_telescope/params/overview.md")]
//!
//! See full documentation: [Parameter Setup - Centralized Telescope][crate::docs::centralized::params].

use std::f64::consts::LOG2_E;

/// Internal parameters
///
/// See the documentation: [Internal parameters of centralized
/// telescope][crate::docs::centralized::params#parameters]
#[derive(Debug, Clone, Copy)]
pub struct Params {
/// Number of prover set's elements
Expand All @@ -16,7 +22,9 @@ pub struct Params {
/// Maximum number of DFS calls permitted to find a proof
pub dfs_bound: u64,
}

/// See the documentation:
/// - [Parameter selection strategy][crate::docs::centralized::params#parameter-selection-strategy]
/// - [Parameter generation protocol][crate::docs::centralized::params#parameter-generation-protocol]
impl Params {
/// Returns a `Params` structure from user parameters
///
Expand Down
6 changes: 5 additions & 1 deletion src/docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ pub mod basic {}
#[doc = include_str!("../docs/rustdoc/prehashing.md")]
pub mod prehashing {}

#[doc = include_str!("../docs/rustdoc/centralized_telescope/intro.md")]
#[doc = include_str!("../docs/rustdoc/centralized_telescope/main.md")]
pub mod centralized {
#[doc = include_str!("../docs/rustdoc/centralized_telescope/params.md")]
#[doc = include_str!("../docs/rustdoc/centralized_telescope/params/overview.md")]
#[doc = include_str!("../docs/rustdoc/centralized_telescope/params/strategy.md")]
#[doc = include_str!("../docs/rustdoc/centralized_telescope/structures/struct_params.md")]
#[doc = include_str!("../docs/rustdoc/centralized_telescope/params/setup.md")]
pub mod params {}

#[doc = include_str!("../docs/rustdoc/centralized_telescope/proof.md")]
Expand Down
Loading