Skip to content
Snippets Groups Projects
  1. Aug 06, 2024
    • STEVAN Antoine's avatar
      fix feature dependencies and imports (dragoon/komodo!164) · 15184312
      STEVAN Antoine authored
      in dragoon/komodo!162 and dragoon/komodo!163, i did only run `cargo ... --all-features` without checking the individual features...
      
      this MR adds some `cargo check --features ...` to the `Makefile` and makes sure the imports make sense when compiling a single feature.
      
      >  **Important**
      >
      > the other notable change here is that `kzg::commit` has been moved to `zk::ark_commit` and is re-exported from `kzg` as `kzg::commit`.
      15184312
    • STEVAN Antoine's avatar
      add aPlonK (dragoon/komodo!163) · 5782d4dc
      STEVAN Antoine authored
      this adds the aPlonK cryptographic method alongside Semi-AVID and KZG+.
      
      ## changelog
      - new feature `aplonk`:
        - the `algebra` module is compiled when either `kzg` or `aplonk` features are enabled
        - `algebra::scalar_product_polynomial` compiles only with `kzg`
        - the other `algebra::*` functions compile with `aplonk`
      - `u32_to_u8_vec` has been moved to new `conversions` module which compiles when either `kzg` or `aplonk` features are enabled
      - new `aplonk` module which compiles only when the `aplonk` feature is enabled
        - public structures
          - `Block`
          - `Commitment`
          - `SetupParams`
          - `VerifierKey`
        - public functions
          - `setup`
          - `commit`
          - `prove`
          - `verify`
        - internals
          - `ipa::Params`
          - `ipa::Proof`
          - `ipa::prove`
          - `ipa::verify`
          - `polynomial::compute_g`
          - `transcript::initialize`
          - `transcript::reset`
          - `transcript::hash`
      5782d4dc
    • STEVAN Antoine's avatar
      add KZG+ (dragoon/komodo!162) · 1d527542
      STEVAN Antoine authored
      this adds the KZG+ cryptographic method alongside Semi-AVID.
      
      ## changelog
      - the Makefile now uses `--all-features` to compile everything
      - a new module `algebra` has been added, with tests for all functions
        - `algebra::scalar_product_polynomial` computes a linear combination of polynomials $(P_i)$
        - `algebra::powers_of` computes $n$ successive powers of a number $r$
      - a new function `zk::trim` has been added from [`gitlab.isae-supaero.fr:a.stevan/poly-commit@19fc0d4a/src/kzg10/mod.rs#L513-L538`](https://gitlab.isae-supaero.fr/a.stevan/poly-commit/-/blob/19fc0d4ad2bcff7df030c952d09649918dba7ddb/src/kzg10/mod.rs#L513-L538)
      - a new feature `kzg` has been added, with an optional dependency on [`gitlab.isae-supaero.fr:a.stevan/poly-commit@19fc0d4a`](https://gitlab.isae-supaero.fr/a.stevan/poly-commit/-/tree/19fc0d4ad2bcff7df030c952d09649918dba7ddb)
      - a new module `kzg` has been added and exposes the following publicly
        - structures
            - `Block`
        - functions
          - `commit`
          - `prove`
          - `verify`
          - `batch_verify`
        - tests when block are left as-is and when one of them is corrupted
      1d527542
  2. Aug 01, 2024
    • STEVAN Antoine's avatar
      refactor repo architecture (!161) · 3608e95a
      STEVAN Antoine authored
      ## changelog
      - `src/main.rs` has been moved to a new crate: `bins/saclin` which stands for **S**emi-**A**VID **CLI** in **N**ushell
      - dependencies of `komodo` have been fixed
      - Nushell and Rust tests have been split in the Makefile: by default, only Rust tests will run locally and Nushell tests and examples can be run manually if desired. The CI will still run everything.
      - the README has been updated
      - test images have been moved to `assets/`
      - the majority of the old `./nu-utils/` module have been moved to internals of `./benchmarks/` and imports have been fixed
      - `cargo.nu` has been moved to `./bins/` and a new `./bins/README.md` mentions it
      - `./bins/saclin/` has been created and should be a self-contained Rust crate + Nushell module
      3608e95a
  3. Jun 07, 2024
  4. Jun 06, 2024
    • STEVAN Antoine's avatar
      complete the FEC and "linear algebra" tests (dragoon/komodo!145) · 7b0eae24
      STEVAN Antoine authored
      - `komodo::linalg::Matrix::random` is tested
      - `komodo::linalg::Matrix::inverse` is tested on more matrix sizes, from $1$ to $20$ random matrices
      - `komodo::field` tests have been double-checked
      - pure "recoding" tests from `komodo::fec` have been double-checked
      - `end_to_end` and `end_to_end_with_recoding` now runs for $k \in [3, 5]$ and $\rho \in [\frac{1}{2}, \frac{1}{3}]$ with $n = \lfloor \frac{k}{\rho} \rfloor$
      - all "_$k$ among $n + t$_" combinations are tested with `try_all_decoding_combinations`, possibly with some removals in case recoding is involved with `is_inside`
      
      >  **Important**  
      > on my machine, `make test` goes from less than 8sec on latest `main` to around 40sec with this MR
      7b0eae24
    • STEVAN Antoine's avatar
      remove `rng` and `curves` from `bins/` (dragoon/komodo!144) · e55fc269
      STEVAN Antoine authored
      they have been moved to [dragoon/binaries](https://gitlab.isae-supaero.fr/dragoon/binaries).
      e55fc269
  5. May 28, 2024
    • STEVAN Antoine's avatar
      split `examples/` into `benchmarks/` and `bins/` (dragoon/komodo!117) · bb626120
      STEVAN Antoine authored
      ## new structure for the repository
      - benchmarks are in `./benchmarks/` and can be run with either `cargo run --package benchmarks --bin <bench>` or the commands in `./benchmarks/README.md`
      ```
      ├── Cargo.toml
      ├── README.md
      └── src
          └── bin
              ├── commit.rs
              ├── fec.rs
              ├── linalg.rs
              ├── operations
              │   ├── curve_group.rs
              │   └── field.rs
              ├── recoding.rs
              ├── setup.rs
              └── setup_size.rs
      ```
      
      - examples are now in `./bins/` as standalone binaries and can be run either with `cargo run --package <pkg>` or with the help of the `cargo bin` command from `.nushell/cargo.nu`
      ```
      ├── curves
      │   ├── Cargo.toml
      │   ├── README.md
      │   └── src
      │       └── main.rs
      ├── inbreeding
      │   ├── build.nu
      │   ├── Cargo.toml
      │   ├── consts.nu
      │   ├── mod.nu
      │   ├── plot.nu
      │   ├── README.md
      │   ├── run.nu
      │   └── src
      │       ├── environment.rs
      │       ├── main.rs
      │       └── strategy.rs
      ├── rank
      │   ├── Cargo.toml
      │   └── src
      │       └── main.rs
      └── rng
          ├── Cargo.toml
          └── src
              └── main.rs
      ```
      
      - Nushell modules are now located in `./.nushell/`
      
      ## changelog
      apart from the changes to the general structure of the repo:
      - `binary.nu` -> `.nushell/binary.nu`
      - new `cargo bin` command from `.nushell/cargo.nu`
      - `error throw` is now defined in `.nushell/error.nu`
      - main TOML has been greatly simplified because the dependencies of "examples" have been moved to the associated crates
      - the rest is basically the same but in the new structure
      bb626120
  6. May 24, 2024
  7. May 23, 2024
    • STEVAN Antoine's avatar
      define more complex inbreeding strategies (dragoon/komodo!103) · 61a2320e
      STEVAN Antoine authored
      this MR:
      - refactors the "inbreeding" example into `examples/inbreeding/`
      - adds `--strategy` and `--environment`
        - `Strategy::draw` will draw the number of shards to keep for recoding
        - `Environment::update` will update the pool of shards by losing some of them
      61a2320e
  8. May 02, 2024
    • STEVAN Antoine's avatar
      add an example to study the _recoding inbreeding_ phenomenon (dragoon/komodo!97) · 7d5fca82
      STEVAN Antoine authored
      this MR adds `examples/inbreeding.rs` which allows to do two things
      - _naive recoding_: in order to generate a new random shard, we first $k$-decode the whole data and then $1$-encode a single shard
      - _true recoding_: to achieve the same goal, we directly $k$-recode shards into a new one
      
      ## the scenario
      regardless of the _recoding strategy_, the scenario is the same
      1. data is split into $k$ shards and $n$ original shards are generated
      2. for a given number of steps $s$, $k$ shards are drawn randomly with replacement and we count the number of successful decoding, given a measure of the _diversity_, $$\delta = \frac{\#success}{\#attempts}$$
      3. create a new _recoded shard_ and add it to the $n$ previous ones, i.e. $n$ increases by one
      4. repeat steps 2. and 3. as long as you want
       
      ## results
      ![inbreeding](/uploads/b81614abcae01b7c915435aa87ccaec0/inbreeding.png)
      7d5fca82
  9. Apr 26, 2024
    • STEVAN Antoine's avatar
      add a "fec" bench (dragoon/komodo!93) · 392f640a
      STEVAN Antoine authored
      this MR adds
      - `examples/benches/bench_fec.rs` to the list of example benches
      - instructions on how to run the new benchmark and plot the results
      
      ## results
      ![encoding](/uploads/d474aa6f39ea20c6b346fb17d2e7ecdc/encoding.png)
      ![decoding](/uploads/061944e49f02541ea93ac0de9547ce37/decoding.png)
      ![e2e](/uploads/bb27f4bb6290c4697a65faa59a0ac4e0/e2e.png)
      392f640a
    • STEVAN Antoine's avatar
      migrate recoding benchmark to PLNK (dragoon/komodo!89) · 22f7943d
      STEVAN Antoine authored
      this MR
      - moves the last "recoding" benchmark to `examples/benches/`
      - moves the README, which is now all alone, to `examples/benches/`
      - adds a mention to `examples/benches/README.md` in `README.md`
      - some minor improvements to the bench README
      
      ## TODO
      - [x] find a way to plot the "recoding" results (thanks to !90)
      22f7943d
  10. Apr 25, 2024
    • STEVAN Antoine's avatar
      migrate criterion benchmarks to PLNK (dragoon/komodo!87) · eaa8acbd
      STEVAN Antoine authored
      ## changelog
      - benchmarks
        - _commit_ has been removed in favor of `examples/benches/commit.rs`
        - _linalg_ has been migrated to `examples/benches/` as `bench_linalg`
        - _setup_ has been migrated to `examples/benches/` as `bench_setup`
      - `read-atomic-ops` command has been moved to `scripts/parse.nu` module
      - `scripts/plot/bench_commit.py` has been made more general and renamed to `scripts/plot/plot.py`
      - `scripts/plot/benches.py` has been removed because it's not required anymore => `plot.py` and `multi_bar.py` are general enough
      eaa8acbd
    • STEVAN Antoine's avatar
      bump PLNK to 0.6.0 (dragoon/komodo!85) · 4b193d97
      STEVAN Antoine authored
      this MR
      - bumps PLNK to 0.6.0
      - update all existing code
      - uses the PLNK lib in `examples/benches/commit.rs`
      - fixes the y label of the plot in `scripts/plot/bench_commit.py`: was _ns_, should be _ms_
      4b193d97
  11. Apr 24, 2024
    • STEVAN Antoine's avatar
      use PLNK instead of duplicating "bench" framework (dragoon/komodo!84) · a4ef3e2a
      STEVAN Antoine authored
      i've basically refactored the whole "bench" framework that was inlined in  `examples/benches/operations/field.rs` and `examples/benches/operations/curve_group.rs` into a new repo called [PLNK](https://gitlab.isae-supaero.fr/a.stevan/plnk).
      
      nothing effectively changes on the side of Komodo but now the code is much simpler here :)
      a4ef3e2a
    • STEVAN Antoine's avatar
      write manual atomic benchmarks (dragoon/komodo!82) · 10acafb1
      STEVAN Antoine authored
      this idea is to not use `criterion` and measure exactly what we want
      
      ## results
      ![simple_field](/uploads/c114cee9ef4b0e56e9ab290d1cbbab2e/simple_field.png)
      ![complex_field](/uploads/7bc8ea613793718f6460438f1df6fd24/complex_field.png)
      ![simple_curve_group](/uploads/a9f8642fc1f1fa558c2bee366622646f/simple_curve_group.png)
      ![complex_curve_group](/uploads/76a3fbe2430959e20150070beeb196a5/complex_curve_group.png)
      10acafb1
  12. Apr 23, 2024
  13. Apr 22, 2024
    • STEVAN Antoine's avatar
      measure atomic operations of curve groups and prime fields (dragoon/komodo!78) · 4dcfdfb0
      STEVAN Antoine authored
      this MR adds two now benchmarks:
      - `field_operations` in `benches/operations/field.rs`
      - `curve_group_operations` in `benches/operations/curve_group.rs`
      
      as well as `scripts/plot/multi_bar.py` to plot the results, see `benches/README.md` for the commands to run.
      
      ## results
      ![curve_group](/uploads/0a27dcdc7965090b0429867e1822a40c/curve_group.png)
      
      ![field](/uploads/461455568a0a637f78f9c2b6d1a68f59/field.png)
      4dcfdfb0
  14. Apr 12, 2024
    • STEVAN Antoine's avatar
      update the API (dragoon/komodo!71) · 6f6647cd
      STEVAN Antoine authored
      ## changelog
      - rename the `encode` function to `prove` and have it take _shards_ instead of an _encoding matrix_: this is to isolate the "encoding" process inside the `fec` module and leave the main `komodo::prove` only compute the "proof", i.e. the commits of the data
      
      from
      ```rust
      fn encode<F, G, P>(
          bytes: &[u8],
          encoding_mat: &Matrix<F>,
          powers: &Powers<F, G>,
      ) -> Result<Vec<Block<F, G>>, KomodoError>
      ```
      to
      ```rust
      fn prove<F, G, P>(
          bytes: &[u8],
          powers: &Powers<F, G>,
          k: usize,
      ) -> Result<Vec<Commitment<F, G>>, KomodoError>
      ```
      - rename `fec::Shard.combine` to `fec::Shard.recode_with` to get rid of "combine"
      - rename `fec::recode` to `fec::recode_with_coeffs` to show that this version takes a list of coefficients
      - rename `Block.commit` to `Block.proof`: "commit" should be "commits" and it's usually refered to as "proof"
      - split `prove` further into `prove` and `build`: `prove` now outputs a `Vec<Commitment<F>>`, `build` simply takes a `Vec<Shard<F>>` and a `Vec<Commitment<F>>` and outputs a `Vec<Block<F>>`
      - add `fec::recode_random` that does the "shard" part of `recode` to wrap around `fec::recode_with_coeffs`
      - remove `R: RngCore` from the signature of `zk::setup`, to avoid having to pass a generic `_` annotation everywhere `zk::setup` is used, same change has been applied to `recode` and the `generate_random_powers` in `main.rs`
      
      from
      ```rust
      fn setup<R: RngCore, F: PrimeField, G: CurveGroup<ScalarField = F>>(
          max_degree: usize,
          rng: &mut R,
      ) -> Result<Powers<F, G>, KomodoError> {
      ```
      to
      ```rust
      fn setup<F: PrimeField, G: CurveGroup<ScalarField = F>>(
          max_degree: usize,
          rng: &mut impl RngCore,
      ) -> Result<Powers<F, G>, KomodoError> {
      ```
      
      ### some extra minor changes
      - remove some useles generic type annotations, e.g. `prove::<F, G, P>` can become a simpler `prove` most of the time, i.e. when there is at least one generic annotation somewhere in the scope
  15. Apr 10, 2024
  16. Apr 09, 2024
  17. Apr 08, 2024
    • STEVAN Antoine's avatar
      benchmark commit step and ark counterparts (dragoon/komodo!63) · 0ed49a36
      STEVAN Antoine authored
      this MR adds a benchmark for
      - the KZG10 trusted setup creating of `ark-poly-commit`
      - the KZG10 commit of `ark-poly-commit`
      - our own implement of the commit in `zk::commit`
      
      there is also a slight improvement to the previous benchmarking of our `zk::setup`: the degree of the _trusted setup_ is now computed once and for all before the benchmarking loop starts, because it's not what is of interest, let's not benchmark it.
      0ed49a36
  18. Apr 04, 2024
    • STEVAN Antoine's avatar
      dd8da0bc
    • STEVAN Antoine's avatar
      remove requirements on _pairing_ and `ark-poly-commit` (dragoon/komodo!54) · 3c91ef12
      STEVAN Antoine authored
      ## changelog
      - remove `ark-poly-commit` from the dependencies
      - remove the old `setup.rs`
      - add temporary `foo.rs` which define (some details are ommited for brevity)
        - `struct Powers<F, G>` 
        - `struct Commitment<F, G>`
        - `fn build_powers<F, G>(...) -> Powers<F, G>`
        - `fn commit<F, G, P>(powers: &Powers<F, G>, polynomial: &P) -> Commitment<F, G>`
        - tests
      - `foo.rs` is then renamed to `setup.rs`
      - two new `KomodoError` variants have been created to replace `ark_poly_commit::Error`
        - `DegreeIsZero`
        - `TooFewPowersInTrustedSetup(usize, usize)`
      - finally, all the past mentions to `E: Pairing` and `setup::random` have been replaced with `F, G` and `setup::build_powers` respectively
      3c91ef12
  19. Apr 02, 2024
    • STEVAN Antoine's avatar
      add a benchmark for the _trusted setup_ (dragoon/komodo!52) · 4273d869
      STEVAN Antoine authored
      as per title
      
      ## changelog
      - add a `setup.rs` benchmark which measures
        - the creation of a random setup
        - the serialization of a setup
        - the deserialization of a setup
      - refactor `plot.py` a bit to
        - use `argparse`
        - take `--bench` to plot either _linalg_ or _setup_ results
        - write a complete `plot_setup` function
        - add a bit of documentation here and there
      
      ## example results
      ![Figure_1](/uploads/ea4bddc5c0c426d0824bad55e2e2e5aa/Figure_1.png)
      4273d869
  20. Mar 26, 2024
    • DISSOUBRAY Nathan's avatar
      Move functions defined in the main to the lib (dragoon/komodo!47) · b567b1bd
      DISSOUBRAY Nathan authored and STEVAN Antoine's avatar STEVAN Antoine committed
      ## Description
      
      Those functions in the main could be useful later as they are operations that an external user might actually want to do directly (instead of just rewriting the functions in the main).
      
      ## List of changes
      - Create a dump function (to be be used by both dump_blocks and generate_powers as they write to disk)
      - Created a fs mod for actions related to writing on disk
      - moved functions into their relevant module (though some might be up to discussion, as noted in some commits)
      - Use anyhow to be able to return Result from functions with multiple error types (since before they just threw errors in the main)
      
      ## Additional notes
      
      Should I include the example that I was working on (ie writing blocks of files recursively), which was the thing that prompted me to actually move the functions from the main to the lib (as I noticed I was rewriting what was in the main to be able to do that) ?
      b567b1bd
    • STEVAN Antoine's avatar
      benchmark the `linalg` module (dragoon/komodo!43) · 5d1cb661
      STEVAN Antoine authored
      this MR
      - adds `criterion` as a dependency
      - creates a `linalg.rs` benchmark file
      - makes the following function `pub`lic
        - `Matrix::transpose`
        - `Matrix::invert`
        - `Matrix::mul`
      - creates a new `benches/` directory containing
        - a README with commands
        - a `plot.py` file to plot results
        - a `linalg.rs` file with the benchmarks
      
      ## example results
      ![Figure_1](/uploads/f352a6f411662361fa9ca381710271d5/Figure_1.png)
      5d1cb661
    • STEVAN Antoine's avatar
      benchmark the recoding process (dragoon/komodo!44) · 9be9b007
      STEVAN Antoine authored
      this MR
      - adds `criterion` as a dependency
      - creates a new `benches/recoding.rs` benchmark file
      - makes the following `pub`lic
        - `fec::combine`
        - `field` and `field::split_data_into_field_elements`
      
      ## example results
      | bytes   | shards | k  | mean (us) |
      | ------- | ------ | -- | --------- |
      | 1       | 2      | 2  | 0.127     |
      | 1       | 2      | 4  | 0.179     |
      | 1       | 2      | 8  | 0.283     |
      | 1       | 2      | 16 | 0.504     |
      | 1       | 4      | 2  | 0.346     |
      | 1       | 4      | 4  | 0.506     |
      | 1       | 4      | 8  | 0.823     |
      | 1       | 4      | 16 | 1.451     |
      | 1       | 8      | 2  | 0.789     |
      | 1       | 8      | 4  | 1.155     |
      | 1       | 8      | 8  | 1.89      |
      | 1       | 8      | 16 | 3.383     |
      | 1       | 16     | 2  | 1.669     |
      | 1       | 16     | 4  | 2.478     |
      | 1       | 16     | 8  | 4.023     |
      | 1       | 16     | 16 | 7.147     |
      | 1024    | 2      | 2  | 1.02      |
      | 1024    | 2      | 4  | 1.076     |
      | 1024    | 2      | 8  | 1.172     |
      | 1024    | 2      | 16 | 1.395     |
      | 1024    | 4      | 2  | 2.981     |
      | 1024    | 4      | 4  | 3.15      |
      | 1024    | 4      | 8  | 3.453     |
      | 1024    | 4      | 16 | 4.089     |
      | 1024    | 8      | 2  | 6.907     |
      | 1024    | 8      | 4  | 7.244     |
      | 1024    | 8      | 8  | 7.969     |
      | 1024    | 8      | 16 | 9.452     |
      | 1024    | 16     | 2  | 15.169    |
      | 1024    | 16     | 4  | 16.14     |
      | 1024    | 16     | 8  | 17.086    |
      | 1024    | 16     | 16 | 20.266    |
      | 1048576 | 2      | 2  | 1470.966  |
      | 1048576 | 2      | 4  | 1097.899  |
      | 1048576 | 2      | 8  | 1091.298  |
      | 1048576 | 2      | 16 | 1091.544  |
      | 1048576 | 4      | 2  | 3274.852  |
      | 1048576 | 4      | 4  | 3272.68   |
      | 1048576 | 4      | 8  | 3251.877  |
      | 1048576 | 4      | 16 | 3272.872  |
      | 1048576 | 8      | 2  | 7582.074  |
      | 1048576 | 8      | 4  | 7599.012  |
      | 1048576 | 8      | 8  | 7584.59   |
      | 1048576 | 8      | 16 | 7569.575  |
      | 1048576 | 16     | 2  | 16274.986 |
      | 1048576 | 16     | 4  | 16303.905 |
      | 1048576 | 16     | 8  | 16313.429 |
      | 1048576 | 16     | 16 | 16310.305 |
      9be9b007
  21. Jan 16, 2024
  22. Dec 06, 2023
    • STEVAN Antoine's avatar
      replace `reed-solomon-erasure` dependency by `linalg` module (!2) · f3d915a4
      STEVAN Antoine authored
      # changelog
      - add a `one_less` argument to `field::merge_elements_into_bytes` to mirror the `one_more` from `field::split_data_into_field_elements`
      - add a `linalg` module which defines
        - a `pub LinalgError` enum
        - a `pub(super) Matrix` structure implement for any `ark_ff::Field`, e.g. `<Bls12_381 as Pairing>::ScalarField`
        - `pub(super) Matrix::vandermonde`
        - `pub(super) Matrix::from_vec_vec`
        - `pub(super) Matrix::invert`
        - `pub(super) Matrix::mul`
        - `pub(super) Matrix::transpose`
        - everything is tested extensively
      - modify `fec.rs` to use `linalg::Matrix` instead of `reed-solomon-erasure` => tests still pass
      - remove the dependency to [`reed-solomon-erasure`](https://github.com/jdetchart/reed-solomon-erasure) completely
      f3d915a4
  23. Nov 30, 2023
Loading