Skip to content
Snippets Groups Projects
  1. May 27, 2024
    • STEVAN Antoine's avatar
      mix colors for hybrid recoding strategies (dragoon/komodo!112) · 9d6e6e7a
      STEVAN Antoine authored
      - define `scripts/color.nu` to manipulate RGB colors, especially mix two colors together
      - compute the color of _hybrid recoding strategies_ as a weighted sum of the two _simple recoding strategies_ involved, e.g. if the strategy is "10% of the time recode 2 shards and 90% of the time recode 3", then the color of that curve will be 10% the color of the simple strategy recoding 2 shards and 90% the color of the other simple strategy recoding 3 shards
      - make the _hybrid_ curves transparent and dashed
      
      ## example
      ![foo](/uploads/71afca07a87fc38e3fa005cebfab4e50/foo.png)
      9d6e6e7a
    • STEVAN Antoine's avatar
      add timestamp to measurements and delay start (dragoon/komodo!111) · 1f16e7e2
      STEVAN Antoine authored
      - add a timestamp to all the measurements of the _diversity_ from `inbreeding/mod.rs`
      - allow to delay the measurement starts with `--measurement-schedule-start`, to help completing already existing measurements
      
      > :exclamation: **Important**  
      > existing measurement files will have to change shape from
      > ```
      > table<strategy: string, diversity: list<float>>
      > ```
      > to
      > ```
      > table<strategy: string, diversity: table<t: int, diversity: float>>
      > ```
      1f16e7e2
    • STEVAN Antoine's avatar
      fix decoding on empty shards and when less than $k$ (dragoon/komodo!110) · d039128d
      STEVAN Antoine authored
      makes sure
      - "inbreeding" experiment quits when there are less than $k$ shards
      - `fec::decode` returns `KomodoError::TooFewShards` when no shards are provided
      d039128d
  2. May 24, 2024
    • STEVAN Antoine's avatar
      make "inbreeding" scripts a module (dragoon/komodo!109) · d594d917
      STEVAN Antoine authored
      just a small QoL improvement
      d594d917
    • STEVAN Antoine's avatar
      measure "inbreeding" for multiple recoding scenarii (dragoon/komodo!108) · 11cd2cdc
      STEVAN Antoine authored
      this MR is two-fold
      - refactor `run.nu` and `plot.nu` from `scripts/inbreeding/` into Nushell modules with `--options` as argument instead of `options.nu` (a7cebb95, 6b72191f and 5f1c4963)
      - introduce another level of depth to the measurements (a0e52e95)
      
      > :bulb: **Note**  
      > in the table below
      > - $s$ is the number of recoding scenarii averages together
      > - $m$ is the number of measurements per point
      > - two iterations of the same experiment are shown side by side for comparison
      
      s   |    m | . | .
      :--:|:----:|:-------------------------:|:-------------------------:
      1   | 10   | ![inbreeding_1_10.1](/uploads/c593393edb3513c9d77b0fe134c27fd7/inbreeding_1_10.1.png) | ![inbreeding_1_10.2](/uploads/97c85b36833112de51a2b756ade53479/inbreeding_1_10.2.png)
      1   | 100  | ![inbreeding_1_100.1](/uploads/af4da1d7cf76ef43fb39c2a3a529b7cd/inbreeding_1_100.1.png) | ![inbreeding_1_100.2](/uploads/e187298709d524437dea503be6ac555f/inbreeding_1_100.2.png)
      1   | 1000 | ![inbreeding_1_1000.1](/uploads/394821777baeff9fec589440ba4c554c/inbreeding_1_1000.1.png) | ![inbreeding_1_1000.2](/uploads/1d592b791075f204f8a0ebdd739403dd/inbreeding_1_1000.2.png)
      10  | 100  | ![inbreeding_10_100.1](/uploads/3c822e7669e9f0b4d97919e5a3bd4bca/inbreeding_10_100.1.png) | ![inbreeding_10_100.2](/uploads/aa6b54ec64f82ca386dae4e262dcd0b6/inbreeding_10_100.2.png)
      100 | 10   | ![inbreeding_100_10.1](/uploads/7ef383143d981717b0ad01dee0359eb0/inbreeding_100_10.1.png) | ![inbreeding_100_10.2](/uploads/ce71a32a7f6e9ba3c4dae563aeefd856/inbreeding_100_10.2.png)
      100 | 100  | ![inbreeding_100_100.1](/uploads/e2038273051f959d8be69fef9ba7a493/inbreeding_100_100.1.png) | ![inbreeding_100_100.2](/uploads/0ef30735597e1a6812484d1cac4d34ca/inbreeding_100_100.2.png)
      
      we can see that
      - the smaller the $s$, the more different the two figures are on each line -> this is likely due to the fact that, if only one recoding scenario is used, then repeating the same experiment will result in very different results and measurements. Running the same experiment $s$ times and averaging helps reducing the variance along this axis
      - the smaller the $m$, the more noisy the measures of each points -> this is simply because, when $m$ is small, the variance of the empirical means measured for each point is higher
      
      ## final results
      ![inbreeding](/uploads/e561f4e4acad8eedbb3ccf1a4666c302/inbreeding.png)
      ![inbreeding_100_100_1](/uploads/37ab0eacb5159137595579dfbb20250c/inbreeding_100_100_1.png)
      11cd2cdc
    • STEVAN Antoine's avatar
    • STEVAN Antoine's avatar
      bump PLNK to 0.7.0 (dragoon/komodo!106) · ff9eb848
      STEVAN Antoine authored
      this will use PLNK version 0.7.0 with prettier progress bars.
      ff9eb848
  3. May 23, 2024
    • STEVAN Antoine's avatar
      better check for empty input (dragoon/komodo!105) · 9f7dd2d5
      STEVAN Antoine authored
      check for empty inputs in the `run.nu` scripts
      9f7dd2d5
    • STEVAN Antoine's avatar
      dont' hardcode curves in the benchmarks (dragoon/komodo!99) · d7e84161
      STEVAN Antoine authored
      up until now, elliptic curves have been hardcoded in the benchmarks, forcing to run them on all supported curves...
      
      this MR makes it possible to use only a subset of curves.
      
      > :bulb: **Note**  
      > when running the same commands from !104, minus the "inbreeding" ones which are not affected by this MR, the time goes from 12min 33sec to 4min 28sec :tada: 
      
      
      ## TODO
      - [x] setup
      - [x] commit
      - [x] recoding
      - [x] fec
      - [ ] linalg
      - [ ] setup size
      - [ ] field operations
      - [ ] group operations
      
      > :bulb: **Note**  
      > because all the unticked bullet points above are far from critical to the paper and do require to measure all curves, i won't change these for now
      d7e84161
    • STEVAN Antoine's avatar
      Refactor plot commands (dragoon/komodo!104) · 0f43be24
      STEVAN Antoine authored
      this MR moves run and plot commands from `examples/benches/README.md` to
      - `scripts/setup/`: `run.nu` and `plot.nu`
      - `scripts/commit/`: `run.nu` and `plot.nu`
      - `scripts/recoding/`: `run.nu` and `plot.nu`
      - `scripts/fec/`: `run.nu` and `plot.nu`
      - `scripts/inbreeding/`: `build.nu`, `run.nu` and `plot.nu`
      
      to generate all the figures at once
      ```bash
      use scripts/setup/run.nu; seq 0 13 | each { 2 ** $in } | run --output data/setup.ndjson
      use ./scripts/setup/plot.nu; plot data/setup.ndjson --save ~/setup.pdf
      
      use scripts/commit/run.nu; seq 0 13 | each { 2 ** $in } | run --output data/commit.ndjson
      use ./scripts/commit/plot.nu; plot data/commit.ndjson --save ~/commit.pdf
      
      use scripts/recoding/run.nu; seq 0 18 | each { 512 * 2 ** $in } | run --ks [2, 4, 8, 16] --output data/recoding.ndjson
      use ./scripts/recoding/plot.nu; plot data/recoding.ndjson --save ~/recoding.pdf
      
      use scripts/fec/run.nu; seq 0 18 | each { 512 * 2 ** $in } | run --ks [2, 4, 8, 16] --output data/fec.ndjson
      use ./scripts/fec/plot.nu; plot encoding data/fec.ndjson --save ~/encoding.pdf
      use ./scripts/fec/plot.nu; plot decoding data/fec.ndjson --save ~/decoding.pdf
      use ./scripts/fec/plot.nu; plot e2e data/fec.ndjson --save ~/e2e.pdf
      
      use ./scripts/fec/plot.nu; plot combined data/fec.ndjson --recoding data/recoding.ndjson --save ~/comparison.pdf
      use ./scripts/fec/plot.nu; plot ratio data/fec.ndjson --recoding data/recoding.ndjson --save ~/ratio.pdf
      
      ./scripts/inbreeding/build.nu
      ./scripts/inbreeding/run.nu --output data/inbreeding.nuon
      ./scripts/inbreeding/plot.nu data/inbreeding.nuon --save ~/inbreeding.pdf
      ```
      
      > :bulb: **Note**  
      > this took around 27min 18sec in total on my machine with 14min 45sec for the inbreeding section only and 12min 33sec for the rest
      0f43be24
    • 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
  4. May 21, 2024
  5. May 13, 2024
    • STEVAN Antoine's avatar
      make figures better (dragoon/komodo!98) · b4e53ac6
      STEVAN Antoine authored
      this MR makes the plot a bit nicer.
      
      ## new figures
      ![setup](/uploads/e6a7ac4e7460d8ff7015906216f9d30b/setup.png)
      ![commit](/uploads/a40700913594771cefeba45a44b2370b/commit.png)
      ![recoding](/uploads/1f3e86763c897dcf034e4b01ba858ada/recoding.png)
      ![decoding](/uploads/dd703ba4af59b4043ae5bb966f8b55ae/decoding.png)
      ![encoding](/uploads/6dbc077bbfe8086357074a0e18c8b530/encoding.png)
      ![e2e](/uploads/9eb92dbb8dc013ef803bde70f3e04f02/e2e.png)
      ![inbreeding](/uploads/9f7dac6a48c24e97448e92a69a506d2f/inbreeding.png)
      b4e53ac6
  6. 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
  7. Apr 29, 2024
  8. 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
      add some minor fixes around the benches (dragoon/komodo!92) · 89c6377d
      STEVAN Antoine authored
      - fix the path to the "bench" readme and remove it from the plot scripts
      - "BLS-12-381" to "BLS12-381" for consistency
      89c6377d
    • STEVAN Antoine's avatar
      use better names in `plot.py` (dragoon/komodo!91) · 2e6398e8
      STEVAN Antoine authored
      this MR goes from
      ```rust
      let xs = seq 0 5 | each { 2 ** $in } | wrap x
      let twice = $xs | insert measurement { 2 * $in.x } | insert error { 0.1 + 0.5 * $in.x }
      let square = $xs | insert measurement { $in.x ** 2 } | insert error { 1 + 1.5 * $in.x }
      
      python scripts/plot/plot.py --title title --x-label x --y-label y --fullscreen ([
          { group: "x ^ 2", items: $square },
          { group: "2 * x", items: $twice }
      ] | to json)
      ```
      to
      ```rust
      let xs = seq 0 5 | each { 2 ** $in }
      let twice = $xs | wrap x | insert y { 2 * $in.x } | insert e { 0.1 + 0.5 * $in.x }
      let square = $xs | wrap x | insert y { $in.x ** 2 } | insert e { 1 + 1.5 * $in.x }
      
      python scripts/plot/plot.py --title title --x-label x --y-label y --fullscreen ([
          { name: "x ^ 2", points: $square },
          { name: "2 * x", points: $twice }
      ] | to json)
      ```
      updates the "bench" README and adds type annotations to the `plot.py` script.
      2e6398e8
    • 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
    • STEVAN Antoine's avatar
      add support for _custom style_ in `plot.py` (dragoon/komodo!90) · b3449155
      STEVAN Antoine authored
      > :bulb: **Note**  
      > - in the following examples, any part of the `$.style` specification is optional and can either be ommitted or set to `null`
      > - the default values for `$.style` are given in `plot.py --help`
      
      ```rust
      let xs = seq 0 5 | each { 2 ** $in } | wrap x
      let twice = $xs | insert measurement { 2 * $in.x } | insert error { 0.1 + 0.5 * $in.x }
      let square = $xs | insert measurement { $in.x ** 2 } | insert error { 1 + 1.5 * $in.x }
      ```
      and try
      ```rust
      python scripts/plot/plot.py --title title --x-label x --y-label y --fullscreen ([
          { group: "x ^ 2", items: $square },
          { group: "2 * x", items: $twice }
      ] | to json)
      ```
      vs
      ```rust
      python scripts/plot/plot.py --title title --x-label x --y-label y --fullscreen ([
          {
              group: "x ^ 2",
              items: $square,
              style: {
                  color: "red",
                  alpha: 0.5,
                  line: {
                      marker: 's',
                      width: 2,
                      type: "dashed",
                  },
              }
          },
          {
              group: "2 * x",
              items: $twice,
              style: {
                  color: "purple",
                  alpha: 0.1,
                  line: {
                      marker: 'o',
                      width: 5,
                      type: "dotted",
                  },
              }
          }
      ] | to json)
      ```
      b3449155
  9. Apr 25, 2024
    • STEVAN Antoine's avatar
      make plot scripts more powerful and minor tweaks (dragoon/komodo!88) · 72f3cd8a
      STEVAN Antoine authored
      ## changelog
      - use `out> *.ndjson` in the README to simplify running the benchmarks
      - create a `scripts/math.nu` module with `ns-to-ms` and `compute-stats` to refactor some of the most common operations
      - add `--fullscreen` to `plot.py` and `multi_bar.py`
      - add `--x-scale` and `--y-scale` to `plot.py`
      72f3cd8a
    • 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
  10. Apr 24, 2024
  11. Apr 23, 2024
  12. Apr 22, 2024
    • STEVAN Antoine's avatar
      improve the _atomic_ benchmark plots (dragoon/komodo!79) · ed16b5d8
      STEVAN Antoine authored
      this MR improves the "_atomic_" script in `benches/README.md` to allow filtering _species_ to show in the _multibar_ plot.
      
      in addition to this, the warmup time and the number of samples of Criterion have been increased back to 3sec and 100 respectively.
      
      > **Note**  
      > the benchmarks take 15min on my machine, i.e. by running the following two commands in Nushell
      > ```bash
      > cargo criterion --output-format verbose --message-format json --bench field_operations out> field.ndjson
      > cargo criterion --output-format verbose --message-format json --bench curve_group_operations out> curve.ndjson
      > ```
      
      ## results
      ![foo](/uploads/5cdc5af344f4ad0510b3d1993c09389f/foo.png)
      ![bar](/uploads/2563b465727d85b886f77c5574ae616d/bar.png)
      ![baz](/uploads/7a485c61d218c8e065afdd880171a12b/baz.png)
      ed16b5d8
    • 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
    • STEVAN Antoine's avatar
      measure Arkworks commit in the benchmark (dragoon/komodo!77) · 7c6f46dc
      STEVAN Antoine authored
      this MR
      - adds an Arkworks bench oneshot function to the `bench_commit` example
      - adapts the `measure!` macro to pass a _pairing-friendly_ curve
      - give different linestyle to curves in the Python script
      
      ## example measurements
      ![Figure_1](/uploads/4b7f52eb3a8c894317cc34057652020f/Figure_1.png)
      7c6f46dc
  13. Apr 15, 2024
    • STEVAN Antoine's avatar
      add "unchecked" versions of `Matrix::{vandermonde,from_vec_vec}` and test both... · 5dc7dd2c
      STEVAN Antoine authored
      add "unchecked" versions of `Matrix::{vandermonde,from_vec_vec}` and test both matrices (dragoon/komodo!75)
      
      ## changelog
      - replace `Matrix::vandermonde` with `Matrix::vandermonde_unchecked`
      - add a new `Matrix::vandermonde` which calls `Matrix::vandermonde_unchecked` after checking the seed points are distinct, otherwise, gives a `KomodoError::InvalidVandermonde` error
      - same with `Matrix::from_vec_vec` and `Matrix::from_vec_vec_unchecked`
      - add documentation tests for the two "checked" functions
      - run the main lib tests on both a random and a Vandermond matrix, just to be sure we do not take advantage of the Vandermonde structure
      5dc7dd2c
  14. Apr 12, 2024
    • STEVAN Antoine's avatar
    • STEVAN Antoine's avatar
      update the API (!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 11, 2024
  16. Apr 10, 2024
Loading