Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • dragoon/komodo
  • a.stevan/komodo
  • c.heme/komodo
3 results
Show changes
Commits on Source (49)
  • STEVAN Antoine's avatar
    improve setup and commit plots (!152) · 4bd3943c
    STEVAN Antoine authored
    - show the log of the degree for high values
    - don't show the "time" Y label because the units are in the times
      values
    - don't rotate the X tick labels
    
    ## results
    ![setup](/uploads/75dfd2033801a88e446e0ce8cae24167/setup.png)
    ![commit](/uploads/cca5bdfabb8f4242d21bf68079a5566a/commit.png)
    4bd3943c
  • STEVAN Antoine's avatar
    add `.env.nu` to load Nushell modules (!154) · 6b9af3df
    STEVAN Antoine authored
    adds a `.env.nu` file to load Nushell modules automatically thanks to the `nuenv` hook from the `nu-hooks` package.
    6b9af3df
  • STEVAN Antoine's avatar
    add more curves to setup and commit (!155) · eb6d1677
    STEVAN Antoine authored
    ## results
    ![setup](/uploads/4db08ea6e0f34717137b655604381ea7/setup.png)
    ![commit](/uploads/4542097789129beafc1deb3319da5198/commit.png)
    eb6d1677
  • STEVAN Antoine's avatar
    improve linalg benchmarks (!153) · 1395283f
    STEVAN Antoine authored
    this adds a new custom field to the `benchmarks::fields` new module and fixes the "linalg" commands to run the benchmarks
    
    ## results
    > 💡 **Note**
    >
    > using the data from !156
    
    ![inverse](/uploads/9368bc1b23a8f8772a05b8c8bab85b96/inverse.png)
    ![mul](/uploads/62b9633f47360c01ffbc92fdf15afcbe/mul.png)
    ![transpose](/uploads/c6892261d27306037a0a2a614f93d584/transpose.png)
    1395283f
  • STEVAN Antoine's avatar
    add more curves to linalg benchmarks (!156) · 75cba071
    STEVAN Antoine authored
    ## results
    > 💡 **Note**
    >
    > using the improved plots from !153
    
    ![inverse](/uploads/9368bc1b23a8f8772a05b8c8bab85b96/inverse.png)
    ![mul](/uploads/62b9633f47360c01ffbc92fdf15afcbe/mul.png)
    ![transpose](/uploads/c6892261d27306037a0a2a614f93d584/transpose.png)
    75cba071
  • STEVAN Antoine's avatar
    bump to Nushell 0.95.0 (!149) · 35f94037
    STEVAN Antoine authored
    see the changelogs of
    - [Nushell `0.94.0`](https://www.nushell.sh/blog/2024-05-28-nushell_0_94_0.html)
    - [Nushell `0.94.1`](https://www.nushell.sh/blog/2024-05-30-nushell_0_94_1.html)
    - [Nushell `0.94.2`](https://www.nushell.sh/blog/2024-06-03-nushell_0_94_2.html)
    
    i also removed the `bytes encode` and `bytes decode` commands from `.nushell/binary.nu` because... well they did not work anymore and they were not used anywhere 👀
    35f94037
  • STEVAN Antoine's avatar
    fix colors and markers for elliptic curves in plots (!157) · 8853e01b
    STEVAN Antoine authored
    ## results
    ![setup](/uploads/1f3a383689d3c8fd5a3f1331deabdec0/setup.png)
    ![commit](/uploads/bcf3bfdd991725abb97cbe4f8890840b/commit.png)
    ![inverse](/uploads/35316c887c6b2347baa86c4db119f762/inverse.png)
    ![mul](/uploads/262c27e99d7f2b5c8fb45761607a8717/mul.png)
    ![transpose](/uploads/2378460cb687d0a9320a24a840ed2eef/transpose.png)
    8853e01b
  • STEVAN Antoine's avatar
    refactor the Nushell modules (!158) · dad69f2c
    STEVAN Antoine authored
    this MR is two-fold
    - it restructures the two main Nushell modules so that they are easier to read and use
    - it improves the "run" and "plot" modules for the benchmarks
    
    ## changelog
    - `.nushell/` is now renamed to `nu-utils/`
    - `benchmarks/` is now a valid Nushell module which exports a bunch of modules
      - `benchmarks linalg`: measure and plot linear algebra operations
      - `benchmarks setup`: measure and plot trusted setup building
      - `benchmarks commit`: measure and plot crafting commitments
      - `benchmarks recoding`: measure and plot the recoding of shards
      - `benchmarks fec`: measure and plot FEC operations, such as encoding and recoding, and allow combining these results with the pure recoding ones
    - the submodules of `benchmarks` typically have a `run` and a `plot` command, whith the exception of `benchmarks fec` which has a `run` module and multiple "plot" commands in `benchmarks fec plot`
    - the "run" commands will create a random temp file by default and ask for confirmation otherwise if the output file already exists, unless `--force` is used
    - snippetds in `benchmarks/README.md` have been updated
    dad69f2c
  • STEVAN Antoine's avatar
    add some more documentation (!159) · 5465143a
    STEVAN Antoine authored
    - 1c9077f6 add documentation to the errors
    - c388cbbb better FEC doc
    - 8d58278d doc of `zk.nb_elements_in_setup`
    5465143a
  • STEVAN Antoine's avatar
    isolate Semi-AVID (!160) · 0977677f
    STEVAN Antoine authored
    this is a refactor to prepare the addition of other cryptographic methods.
    
    ## changelog
    - moves Semi-AVID code from `lib.rs` to `semi_avid.rs`
    0977677f
  • STEVAN Antoine's avatar
    refactor repo architecture (dragoon/komodo!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
  • STEVAN Antoine's avatar
    add KZG+ (!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
  • STEVAN Antoine's avatar
    add aPlonK (!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
    fix feature dependencies and imports (!164) · 15184312
    STEVAN Antoine authored
    in !162 and !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
    refactor algebra module (!165) · 8c07220b
    STEVAN Antoine authored
    `algebra`, `field` and `linalg` were doing extremely similar things before...
    
    this MR merges them into a single module `algebra`
    - old `algebra` and `field` are at the root of the new `algebra`
    - old `linalg` is now `algebra::linalg`
    
    all references to these have been fixed in the rest of the codebase and the features have been tuned to work fine.
    8c07220b
  • STEVAN Antoine's avatar
    add examples and complete the documentation (dragoon/komodo!166) · 8be768bb
    STEVAN Antoine authored
    ## changelog
    - _semi\_avid_, _kzg_ and _aplonk_ examples have been added
    - the `fs` module has been hidden behind an `fs` feature
    - the `conversions` module has been properly hidden behind the `test` config feature
    - the documentation has been completed
    - some error messages have been improved
    
    > **Note**
    >
    > the documentation of aPlonK has been left as-is for now
    8be768bb
  • STEVAN Antoine's avatar
    77b6b91f
  • STEVAN Antoine's avatar
    add license (!168) · 90e7d99e
    STEVAN Antoine authored
    90e7d99e
  • STEVAN Antoine's avatar
    mention contributors (!171) · 2fa866de
    STEVAN Antoine authored
    2fa866de
  • STEVAN Antoine's avatar
    bump to 1.0.0 (dragoon/komodo!170) · 8532264c
    STEVAN Antoine authored
    8532264c
  • DETCHART Jonathan's avatar
    enable kzg and aplonk by default (!172) · f84c0ae6
    DETCHART Jonathan authored
    This MR enables by default `kzg` and `aplonk`. By doing that, both modules should be visible in the doc.
    f84c0ae6
  • DETCHART Jonathan's avatar
    Bump to 1.0.1 (!173) · 020b9213
    DETCHART Jonathan authored
    020b9213
  • STEVAN Antoine's avatar
    ignore some IDE files (!174) · 13af3b28
    STEVAN Antoine authored and DETCHART Jonathan's avatar DETCHART Jonathan committed
    13af3b28
  • DETCHART Jonathan's avatar
    Adding a Github workflow (!177) · 36714bef
    DETCHART Jonathan authored
    36714bef
  • STEVAN Antoine's avatar
    add badges for the latest release and the CIs (!178) · 385270c0
    STEVAN Antoine authored
    this adds three badges to the README:
    - the latest release (links to the [release page](https://gitlab.isae-supaero.fr/dragoon/komodo/-/releases))
    - the GitLab CI status (links to the [GitLab pipeline dashboard](https://gitlab.isae-supaero.fr/dragoon/komodo/-/pipelines))
    - the GitHub CI status (links to the [GitHub workflow runs dashboard](https://github.com/dragoon-rs/komodo/actions))
    385270c0
  • STEVAN Antoine's avatar
    add badges for crates.io and docs.rs (!179) · f711147d
    STEVAN Antoine authored
    this MR adds two new badges to the README
    - the crate (links to the [Komodo crate](https://crates.io/crates/komodo))
    - the documentation (links to the [doc](https://docs.rs/komodo/latest/komodo/))
    f711147d
  • STEVAN Antoine's avatar
  • STEVAN Antoine's avatar
    add FRI (dragoon/komodo!175) · 202d8bcc
    STEVAN Antoine authored
    FRI protocol from [`dragoon/fri`](https://gitlab.isae-supaero.fr/dragoon/fri)
    
    ## changelog
    - add binary assets to be used as inputs
    - add `fri` and `fri_test_utils` as local dependencies until [`dragoon/fri`](https://gitlab.isae-supaero.fr/dragoon/fri) becomes public
    - add `fri` feature and module (see section below for the public definitions)
    - fix bug in 32bd6566
    - bump Rust in e7a2c244
    - add a versatile example
    - add Nushell pipeline to run benchmarks and plot results
    - add some tests
    
    ## `fri` module API
    ```rust
    struct Block<F: PrimeField, H: Hasher>
    ```
    
    ```rust
    fn evaluate<F: PrimeField>(bytes: &[u8], k: usize, n: usize) -> Vec<Vec<F>>
    ```
    
    ```rust
    fn encode<F: PrimeField>(
        bytes: &[u8],
        evaluations: Vec<Vec<F>>,
        k: usize,
    ) -> Vec<fec::Shard<F>>
    ```
    
    ```rust
    fn prove<const N: usize, F: PrimeField, H: Hasher, P>(
        evaluations: Vec<Vec<F>>,
        shards: Vec<fec::Shard<F>>,
        blowup_factor: usize,
        remainder_plus_one: usize,
        nb_queries: usize,
    ) -> Result<Vec<Block<F, H>>, KomodoError>
    where
        P: DenseUVPolynomial<F>,
        for<'a, 'b> &'a P: Div<&'b P, Output = P>,
        <H as rs_merkle::Hasher>::Hash: AsRef<[u8]>,
    ```
    
    ```rust
    fn verify<const N: usize, F: PrimeField, H: Hasher, P>(
        block: Block<F, H>,
        domain_size: usize,
        nb_queries: usize,
    ) -> Result<(), KomodoError>
    where
        P: DenseUVPolynomial<F>,
        for<'a, 'b> &'a P: Div<&'b P, Output = P>,
        <H as rs_merkle::Hasher>::Hash: AsRef<[u8]>,
    ```
    
    ```rust
    fn decode<F: PrimeField, H: Hasher>(blocks: Vec<Block<F, H>>, n: usize) -> Vec<u8>
    ```
    
    ## results
    
    ### times
    
    ![evaluating](/uploads/69607a2f987e26c23dd172d469c682c5/evaluating.png)
    ![encoding](/uploads/540ac15c21ba7500ad34b068c5d9d7dc/encoding.png)
    ![proving](/uploads/a694525c7d1277fe0b53dd87b6443900/proving.png)
    ![verifying_single](/uploads/8f03a3a0abca329eea396f3ba8b76512/verifying_single.png)
    ![decoding](/uploads/ba2cb0aa54f2ecff16340333121f16ca/decoding.png)
    
    ### sizes
    
    ![commits_single](/uploads/59a96661482fb1d918efc098e060cd45/commits_single.png)
    ![commits_single_normalized](/uploads/11398ed3f37ab4917b717cb717c9070d/commits_single_normalized.png)
    ![proofs](/uploads/17da07f4ef4ee637236deba7835cc022/proofs.png)
    ![proofs_normalized](/uploads/b2aae9491c56767ad1bf5674cf980361/proofs_normalized.png)
    202d8bcc
  • DETCHART Jonathan's avatar
    Add fft and interpolation method for RS coding benchmarks (!185) · 702cd5eb
    DETCHART Jonathan authored and STEVAN Antoine's avatar STEVAN Antoine committed
    This MR adds an option to perform erasure coding using FFT rather than using a matrix. It also adds the field FP128 in the list of curves
    
    Note that there is a redundant function `random_loss` into benchmarks/bin/fec.rs and examples/fec.rs
    702cd5eb
  • STEVAN Antoine's avatar
    check more args in the benchmarks (!187) · 57a96c02
    STEVAN Antoine authored
    this replaces the "_nothing to do_" messages from Nushell commands with more explicite errors.
    57a96c02
  • STEVAN Antoine's avatar
    update benchmarks readme (!176) · 07602875
    STEVAN Antoine authored
    ## changelog
    - add more snippets and instructions
    - add missing imports
    - update the "atomic operations" section
    - add a table of contents
    07602875
  • STEVAN Antoine's avatar
    check Nushell files in the CI (!137) · f2a76fbb
    STEVAN Antoine authored
    in order to help catch issues with the various Nushell scripts and modules in the source base, i propose to add a CI script that will check them all.
    
    below is an example error, e.g. when introducing a syntax error in `.env.nu`:
    ```
    Error:   × Failed to parse content:
      │     file: .env.nu
      │     err:  Expected keyword.
    ```
    f2a76fbb
  • STEVAN Antoine's avatar
    add rust-analyzer to the toolchain (!188) · 11a5b59d
    STEVAN Antoine authored
    this should avoid the following error when trying to rust the LSP in a toolchain which does not have the `rust-analyzer` component and without running `rustup component add rust-analyzer` manually:
    ```
    error: Unknown binary 'rust-analyzer' in official toolchain 'stable-x86_64-unknown-linux-gnu'.
    ```
    11a5b59d
  • STEVAN Antoine's avatar
    fix typos and improve algebra/semi_avid tests (!189) · cc412625
    STEVAN Antoine authored
    mainly fixes a few typos and improves `algebra` and `semi_avid` tests
    
    ## changelog
    - fix some typos and notes in the documentation
    - test more cases for `algebra::split_data_into_field_elements` and `algebra::merge_elements_into_bytes`, more data lengths and more modulus respectively
    - remove a useless `::<Vec<_>>` on a `collect` in `fec`
    - `semi_avid::tests`
      - refactor `bls12-381` into a constant
      - write an "_attack_" function to alter a particular block, `attack<F, G>(block: Block<F, G>, c: usize, base: u128, pow: u64) -> Block<F, G>`
      - pass a list of attacks, i.e. `attacks: Vec<(usize, usize, u128, u64)>`, to `verify_with_errors_template`, use the same as the previous hardcoded one
      - pass a list of "_recodings_", i.e. `recodings: Vec<Vec<usize>>`, to `verify_recoding_template` and assert the number of blocks, e.g. `vec![vec![2, 3], vec![3, 5]]` means that recoding 2 and 3 together should verify, and same with 3 and 5, and also that there must be at least 6 blocks
      - pass a list of "_recodings_", i.e. `recodings: Vec<(Vec<Vec<usize>>, bool)>`, to `end_to_end_with_recoding_template` and assert the number of blocks and the number of source shards, e.g. `vec![(vec![vec![0, 1], vec![2], vec![3]], true)]` means that trying to decode with blocks 2, 3 and a recoded block from 0 and 1 should work, and also that there must be at least 4 blocks and at most 3 source shards
      - pass `k` and `n` to `run_template`
    cc412625
  • STEVAN Antoine's avatar
    refactor CI and Makefile for Nushell installation (!192) · 5511404f
    STEVAN Antoine authored
    the idea is to make the installation of Nushell easier to maintain, especially regarding versions, currently pinned to `0.95.0`
    
    > successful run on GitHub: [13032726635](https://github.com/dragoon-rs/komodo/actions/runs/13032726635)
    
    this is also to allow easier testing locally with the same Nushell version as in the CI, e.g.
    ```bash
    # install in `~/.local/bin/` and have multiple versions
    make install-nu
    
    hash=$(/tmp/nu --no-config-file --commands 'version | get commit_hash')
    nu_bin=$"$HOME/.local/bin/nu-$hash"
    cp /tmp/nu $nu_bin
    
    make NU=$nu_bin show test
    ```
    or
    ```bash
    # install in the repo and overwrite each time
    make NU_DEST=. install-nu
    make NU=./nu show test
    ```
    
    # changelog
    - Makefile
      - split the global `.PHONY` rule into _atomic_ rules next to each _phony_ rule
      - define `NU` and `NU_FLAGS` to allow changing which and how Nushell runs
      - define `NU_ARCH`, `NU_VERSION`, `NU_BUILD` and `NU_DEST` for Nushell installation
      - tweak the output of `make show` a bit
      - add `print-%` rules to print `Makefile` variables, e.g. `make print-NU_FLAGS` would print `--no-config-file`
      - add `make install-nu` to replace the ones from the CIs
    - GitLab CI
      - use `make install-nu`
      - export `PATH` with `make print-NU_DEST`
    - GitHub CI 
      - use `make install-nu` instead of [github.com:hustcer/setup-nu](https://github.com/hustcer/setup-nu)
      - export `PATH` with `make print-NU_DEST` and `GITHUB_ENV`
    5511404f
  • STEVAN Antoine's avatar
    rework benchmarks: script and output format (!193) · ab0d9a8b
    STEVAN Antoine authored
    this is an attempt at making benchmarks easier to work with
    - `benchmarks run` will read benchmarks from NUON data and run them
    - `benchmarks plot` will plot benchmark results
    - the output format will be something 
      - a directory whose name is the hash of the CPU spec and the Komodo commit hash
      - contains `cpu.json` with the CPU info
      - contains `komodo.txt` with the Komodo commit hash
      - contains NDJSON result files
    
    > 💡 **Note**
    >
    > results will typically be uploaded to https://gitlab.isae-supaero.fr/dragoon/komodo-benchmark-results
    
    > 💡 **Note**
    >
    > this MR goes alongside the [`komodo-benchmark-results@restart`](https://gitlab.isae-supaero.fr/dragoon/komodo-benchmark-results/-/compare/main...restart) branch
    
    ## changelog
    - bump Nushell to 0.101.0
      - parallel `$in` => remove useless `let input = $in` when possible, e.g. still required when using the function's `$in` in a `for` loop
      - `group-by` changed => `group-by x --to-table` will now produce a table with columns `x` and `items` instead of `group` and `items` as in 0.95.0
    - add link to results repo
    - the Nushell benchmarks lib
      - rename `--force` to `--no-confirm (-y)`
      - add `--append` 
      - reject columns that GPLT will complain about, e.g. `$.points.k` for the FRI plots
      - add `--save` to the FRI plot
    - move the "field" and "curve group" benchmarks from `benchmarks/src/bin/operations/` to `benchmarks/src/bin/`
    - remove `benchmarks/params/fri.nu` because it's been uniformized with the other methods
    - rewrite the README
    - add main function to `benchmarks/` that runs the benchmarks from a NUON record specification
    - simplify the output of FRI run
    
    ## TODO
    - [x] fix "_atomic operations_" (done in 4f69a1d6)
    - [x] check that _plotting_ still works
    
    ## images
    
    ### Field
    ![complex_curve_group_operations](/uploads/57b36926cce041cf405a9b44f190b8b8/complex_curve_group_operations.png)
    ![complex_field_operations](/uploads/0747c85dbaff8980561aa9d922fcd5e7/complex_field_operations.png)
    ![simple_curve_group_operations](/uploads/974cf70fed68f8d8ac898d54be3f27be/simple_curve_group_operations.png)
    ![simple_field_operations](/uploads/a3d4d0dcdeb35d4c434eaa38fb51e7b5/simple_field_operations.png)
    
    ### Linear algebra
    ![linalg-inverse](/uploads/bc290ffa39459ce0f9bbd393b50b7b98/linalg-inverse.png)
    ![linalg-mul](/uploads/96d8c2a63ed48d6a0d3508b4a948153b/linalg-mul.png)
    ![linalg-transpose](/uploads/128e35eca91497d8aadb0130c05aeee3/linalg-transpose.png)
    
    ### FEC
    ![encoding](/uploads/405c4d3ef9ec5135ebdd7ce2e6c96bfe/encoding.png)
    ![decoding](/uploads/d793234d44e9fc6f34f0c2a9372863cd/decoding.png)
    ![recoding](/uploads/413021de997c86d45b1287fcfe7804c7/recoding.png)
    ![combined](/uploads/6d1c3ae6d3bf5547434ca29ae80b5536/combined.png)
    ![ratio](/uploads/6cebd7a0bcef57d1b1256bc3941c1b0a/ratio.png)
    
    ### ZK
    ![setup](/uploads/1feb169452aa3274dc924edf772c9a5b/setup.png)
    ![commit](/uploads/0a2775c2116ca7d3fa7b956b934d1565/commit.png)
    
    ### FRI
    ![commits_single](/uploads/4602725e551a025d42815183a61d11b2/commits_single.png)
    ![commits_single_normalized](/uploads/2ffebea940af1cbbe9bd64499343e0e9/commits_single_normalized.png)
    ![end_to_end](/uploads/46917abd2f5976dfa6d3039cc0ab2c0e/end_to_end.png)
    ![evaluating](/uploads/cf4dc496cd5144615bf5f9b06d27dccd/evaluating.png)
    ![proofs](/uploads/b0828bfa62c2226c8d63c9ecd387049f/proofs.png)
    ![proofs_normalized](/uploads/8fbf0d713884e2e147c62313a001f379/proofs_normalized.png)
    ![proving](/uploads/161539dc412330be1878cdda82c3d966/proving.png)
    ![verifying_single](/uploads/2df7e777481d7789478386f8e83e0783/verifying_single.png)
    ab0d9a8b
  • STEVAN Antoine's avatar
    fix the Rust toolchain in the CI (!195) · 3c8afac4
    STEVAN Antoine authored
    this is to avoid having to change the toolchain in the CI everytime.
    
    `rust-toolchain.toml` and `.gitlab-ci.yml` will have to be updated in pairs when bumping / changing the Rust toolchain.
    3c8afac4
  • HEME Clement's avatar
    Added Latex support for doc (!197) · b5381fda
    HEME Clement authored and STEVAN Antoine's avatar STEVAN Antoine committed
    Added a html header files, an added metadata line in Cargo.toml and some formatting changes in the doc to have Latex formulas in docs.rs. It works locally, should work online
    b5381fda
  • STEVAN Antoine's avatar
    add a script to check the GitHub mirror (!199) · b7e2d99d
    STEVAN Antoine authored
    ## usage
    ```bash
    nu scripts/check-mirror.nu ...[
        https://gitlab.isae-supaero.fr/dragoon/komodo
        https://github.com/dragoon-rs/komodo
        main
    ]
    ```
    will
    - check the Nushell version and throw a warning if mismatch
    - add temporary remotes with random names
    - fetch the temporary remotes
    - get the revision of the `$branch` for both temporary remotes
    - clean the temporary remotes
    - show a message if the two revisions are not the same and how many commits they are different
    
    > **Note**
    >
    > this does not conflict with #17
    b7e2d99d
  • STEVAN Antoine's avatar
    remove nushell from ci (!200) · 0d7a5cd6
    STEVAN Antoine authored
    this should close #17.
    
    SACLIN has been moved to [`gitlab.isae-supaero.fr:dragoon/komodo.nu`](https://gitlab.isae-supaero.fr/dragoon/komodo.nu).
    0d7a5cd6
  • STEVAN Antoine's avatar
    use gh-cli to pull mirror run information (!201) · 1519af49
    STEVAN Antoine authored
    This is to complete the `check-mirror.nu` script with information about the CI runs.
    
    The current output of
    ```bash
    nu scripts/check-mirror.nu ...[
        https://gitlab.isae-supaero.fr/dragoon/komodo
        https://github.com/dragoon-rs/komodo
        main
    ]
    ```
    is
    ```
    [INF] adding remotes
    [INF] fetching
    [INF] cleaning
    [ OK] mirror is up to date
    [INF] pulling mirror runs
    #─┬────id─────┬────────────────head_sha────────────────┬─status──┬conclusion┬run_started_at
    0 │11950217125│de4266c0│completed│success   │4 months ago
    1 │11950604920│202d8bcc│completed│success   │4 months ago
    2 │11950873603│702cd5eb│completed│success   │4 months ago
    3 │12028360471│57a96c02│completed│success   │4 months ago
    4 │12028432364│07602875│completed│success   │4 months ago
    5 │12028781541│f2a76fbb│completed│success   │4 months ago
    6 │12631165433│11a5b59d│completed│success   │2 months ago
    7 │13008608156│cc412625│completed│success   │2 months ago
    8 │13033206333│5511404f│completed│success   │2 months ago
    9 │13113244065│ab0d9a8b│completed│success   │2 months ago
    10│13679188387│3c8afac4│completed│success   │3 weeks ago
    11│14191103891│b5381fda│completed│success   │a day ago
    12│14214853530│b7e2d99d│completed│success   │an hour ago
    13│14215431531│0d7a5cd6│completed│success   │32 minutes ago
    ──┴───────────┴────────────────────────────────────────┴─────────┴──────────┴──────────────
    ```
    1519af49
  • STEVAN Antoine's avatar
    use `gitlab.isae-supaero.fr:a.stevan/nob.rs` to build (!202) · 4962757c
    STEVAN Antoine authored
    that's an attempt at using Rust to build itself.
    
    this is using [`gitlab.isae-supaero.fr:a.stevan/nob.rs@e4b03cdd`](a.stevan/nob.rs@e4b03cdd).
    
    > 💡 **Note**
    >
    > to be honest, this is not a 100% replacement of the `Makefile`...
    >
    > `make.rs` does a lot more and provides a full CLI with easy-to-use options, e.g. instead of `make fmt` and `make fmt-check`, we now have `./make.rs fmt` and `./make.rs fmt --check`
    >
    > (see the API below)
    
    ## the API
    ```
    Usage: make [OPTIONS] [COMMAND]
    
    Commands:
      fmt      Formats the code
      check    Checks the code
      clippy   Runs Clippy
      test     Runs the tests
      version  Shows the version of all the tools used,
      doc      Builds the documentation
      help     Print this message or the help of the given subcommand(s)
    
    Options:
      -h, --help      Print help
      -V, --version   Print version
    ```
    ```
    Usage: make fmt [OPTIONS]
    
    Options:
      -c, --check  Only checks instead of really formatting
    ```
    ```
    Usage: make check
    ```
    ```
    Usage: make clippy
    ```
    ```
    Usage: make test [OPTIONS]
    
    Options:
      -v, --verbose   Be extra verbose with the output of the tests
      -e, --examples  Run the examples instead of regular tests
    ```
    ```
    Usage: make version
    ```
    ```
    Usage: make doc [OPTIONS]
    
    Options:
      -o, --open      Open the documentation in the browser
      -p, --private   Document private items
      -f, --features  Document all features
    ```
    
    ## running the pipeline in the GitHub mirror
    ```bash
    const GH_API_OPTIONS = [
        -H "Accept: application/vnd.github+json"
        -H "X-GitHub-Api-Version: 2022-11-28"
    ]
    let res = gh api ...$GH_API_OPTIONS /repos/dragoon-rs/komodo/actions/runs | from json
    ```
    ```bash
    let runs = $res.workflow_runs
        | where head_branch == "use-nob-to-build"
        | select id head_sha status conclusion run_started_at
        | into datetime run_started_at
        | sort-by run_started_at
    ```
    ```bash
    $runs
        | update id { $"[`($in)`]\(https://github.com/($GITHUB_MIRROR)/actions/runs/($in)\)" }
        | update run_started_at { format date "%Y-%m-%dT%H:%M:%S" }
        | to md --pretty
    ```
    | id                                                                             | head_sha                                 | status    | conclusion | run_started_at      |
    | ------------------------------------------------------------------------------ | ---------------------------------------- | --------- | ---------- | ------------------- |
    | [`14237650542`](https://github.com/dragoon-rs/komodo/actions/runs/14237650542) | d67f1cfd | completed | success    | 2025-04-03T07:44:14 |
    | [`14237741570`](https://github.com/dragoon-rs/komodo/actions/runs/14237741570) | 9ef598a1 | completed | success    | 2025-04-03T07:49:40 |
    | [`14238086977`](https://github.com/dragoon-rs/komodo/actions/runs/14238086977) | 0a79edf3 | completed | success    | 2025-04-03T08:09:13 |
    | [`14238175174`](https://github.com/dragoon-rs/komodo/actions/runs/14238175174) | a84b2b12 | completed | success    | 2025-04-03T08:13:52 |
    | [`14239395984`](https://github.com/dragoon-rs/komodo/actions/runs/14239395984) | 8594c9bf | completed | success    | 2025-04-03T09:16:00 |
    4962757c
  • STEVAN Antoine's avatar
    remove `check-nushell-files` (!204) · 4b53a261
    STEVAN Antoine authored
    this removes the `check-nushell-files.nu` script i left in !200.
    4b53a261
  • STEVAN Antoine's avatar
    run the pipeline on any push in the GitHub mirror (!203) · c462679e
    STEVAN Antoine authored
    This should close #19.
    
    ## changelog
    - triggers pipeline in the GitHub mirror on each push
    - add `./scripts/get-mirror-pipelines.nu`
    
    ## the pipelines
    >  **Important**
    >
    > i just had to add `run-mirror-pipeline-everytime` to the list of protected branches and trigger the push with an empty commit and it runs
    >
    > and then a single call to `nu scripts/get-mirror-pipelines.nu "run-mirror-pipeline-everytime"` gives the table below
    
    | id                                                                             | head_sha                                 | status    | conclusion | run_started_at      |
    | ------------------------------------------------------------------------------ | ---------------------------------------- | --------- | ---------- | ------------------- |
    | [`14238533729`](https://github.com/dragoon-rs/komodo/actions/runs/14238533729) | 2f32ee59 | completed | success    | 2025-04-03T08:32:31 |
    | [`14238724666`](https://github.com/dragoon-rs/komodo/actions/runs/14238724666) | e7587675 | completed | success    | 2025-04-03T08:42:19 |
    | [`14240494187`](https://github.com/dragoon-rs/komodo/actions/runs/14240494187) | 3c223dd6 | completed | success    | 2025-04-03T10:13:02 |
    | [`14240642763`](https://github.com/dragoon-rs/komodo/actions/runs/14240642763) | cbc1f7f9 | completed | success    | 2025-04-03T10:21:04 |
    | [`14240848529`](https://github.com/dragoon-rs/komodo/actions/runs/14240848529) | 7b34fc8a | completed | success    | 2025-04-03T10:32:06 |
    c462679e
  • STEVAN Antoine's avatar
    build the pipelines image from Dockerfile (!205) · 34062030
    STEVAN Antoine authored
    This adds a Dockerfile to build an image for the pipelines, once and for all, until we decide to bump the Rust toolchain.
    
    ## changelog
    - add `.gitlab-ci.dockerfile` which
      - uses `rust:latest` as a base (it appears using `alpine:latest` is both bigger and slower 🤷)
      - installs basic system dependencies
      - uses `rust-toolchain.toml` to install the toolchain of the project
      - installs `cargo-script`
    - use [`gitlab-registry.isae-supaero.fr/dragoon/komodo:bcb0e6b5`](https://gitlab.isae-supaero.fr/dragoon/komodo/container_registry/42) in the GitLab pipelines and [`ghcr.io/dragoon-rs/dragoon/komodo:bcb0e6b5`](https://github.com/orgs/dragoon-rs/packages/container/dragoon%2Fkomodo/388672772?tag=bcb0e6b5f73420762f6208700a43291e0066c2c3) in the GitHub pipelines and remove the "manual" dependency installation
    - add `./make.rs container`, `./make.rs container --login` and `./make.rs container --push`
      - uses `nob.rs@7ea6be8` to capture output of commands with `+` syntax
      - get the current Git SHA as the tag of the image
    - instructions have been added to the `README.md` for later reference
    
    ## mirror
    | id                                                                             | head_sha                                                                                                                           | status    | conclusion | run_started_at        |
    | ------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------- | --------- | ---------- | --------------------- |
    | [`14262324842`](https://github.com/dragoon-rs/komodo/actions/runs/14262324842) | [`c93d9c87`](https://github.com/dragoon-rs/komodo/commit/c93d9c87928964aa20f347c1302757a06d2da628) | completed | success    | `2025-04-04T11:28:30` |
    | [`14262372440`](https://github.com/dragoon-rs/komodo/actions/runs/14262372440) | [`f905e576`](https://github.com/dragoon-rs/komodo/commit/f905e57633f5e3dc7b1c38faa463daf54fb674bb) | completed | cancelled  | `2025-04-04T11:31:12` |
    | [`14262477396`](https://github.com/dragoon-rs/komodo/actions/runs/14262477396) | [`21b26efd`](https://github.com/dragoon-rs/komodo/commit/21b26efd988b2d8d7159d24cae37341135cfb1b9) | completed | success    | `2025-04-04T11:36:59` |
    | [`14263257396`](https://github.com/dragoon-rs/komodo/actions/runs/14263257396) | [`5bdca8cd`](https://github.com/dragoon-rs/komodo/commit/5bdca8cdb96e6ac2c25035513721485bcb08645d) | completed | success    | `2025-04-04T12:22:10` |
    | [`14263314072`](https://github.com/dragoon-rs/komodo/actions/runs/14263314072) | [`bcb0e6b5`](https://github.com/dragoon-rs/komodo/commit/bcb0e6b5f73420762f6208700a43291e0066c2c3) | completed | success    | `2025-04-04T12:25:27` |
    | [`14263368772`](https://github.com/dragoon-rs/komodo/actions/runs/14263368772) | [`ddd4a2a9`](https://github.com/dragoon-rs/komodo/commit/ddd4a2a9c1c28f4502814065de6aeca00b8b7a2f) | completed | success    | `2025-04-04T12:28:30` |
    | [`14263575177`](https://github.com/dragoon-rs/komodo/actions/runs/14263575177) | [`f9400e61`](https://github.com/dragoon-rs/komodo/commit/f9400e619a066294714024174dacd4a0501a369c) | completed | success    | `2025-04-04T12:40:44` |
    
    
    
    ## speed
    the performance appears to be around
    - ~ 1min 35sec on GitLab (see
        [8331](https://gitlab.isae-supaero.fr/dragoon/komodo/-/pipelines/8331),
        [8332](https://gitlab.isae-supaero.fr/dragoon/komodo/-/pipelines/8332),
        [8333](https://gitlab.isae-supaero.fr/dragoon/komodo/-/pipelines/8333),
        [8334](https://gitlab.isae-supaero.fr/dragoon/komodo/-/pipelines/8334),
        [8335](https://gitlab.isae-supaero.fr/dragoon/komodo/-/pipelines/8335),
        [8336](https://gitlab.isae-supaero.fr/dragoon/komodo/-/pipelines/8336),
        [8337](https://gitlab.isae-supaero.fr/dragoon/komodo/-/pipelines/8337),
        [8338](https://gitlab.isae-supaero.fr/dragoon/komodo/-/pipelines/8338),
        [8339](https://gitlab.isae-supaero.fr/dragoon/komodo/-/pipelines/8339),
        [8340](https://gitlab.isae-supaero.fr/dragoon/komodo/-/pipelines/8340),
        [8341](https://gitlab.isae-supaero.fr/dragoon/komodo/-/pipelines/8341),
        all after b82e8950)
    - ~ 4min on GitHub (see
        [14263257396](https://github.com/dragoon-rs/komodo/actions/runs/14263257396),
        [14263314072](https://github.com/dragoon-rs/komodo/actions/runs/14263314072),
        [14263368772](https://github.com/dragoon-rs/komodo/actions/runs/14263368772),
        [14263575177](https://github.com/dragoon-rs/komodo/actions/runs/14263575177),
        all after [5bdca8cd](https://github.com/dragoon-rs/komodo/commit/5bdca8cdb96e6ac2c25035513721485bcb08645d))
    34062030
  • STEVAN Antoine's avatar
    add `container list` for Docker containers (!207) · 38fe0ff4
    STEVAN Antoine authored
    ## examples
    ```bash
    ./make.rs container list --json
        | from ndjson
        | into datetime CreatedAt
        | into filesize Size VirtualSize
        | reject CreatedSince
    ```
    or
    ```bash
    ./make.rs container list --json
        | from ndjson
        | into datetime CreatedAt
        | into filesize Size VirtualSize
        | reject CreatedSince
        | select ID Repository Tag CreatedAt VirtualSize
        | update Tag { str substring 0..<7 }
    ```
    
    ## changelog
    - transform options of `container` to sub-subcommands
      - `container` --> `container build`
      - `container --login` --> `container login`
      - `container --push` --> `container push`
    - add `container list` to print the local images for the GitLab and GitHub repositories
      - `container list` will print in a pretty table
      - `container list --json` will print as NDJSON, i.e. one image per line as JSON
    - use wrappers around `nob::run_cmd_as_vec_and_fail!`
      - `extend_and_run` to run a partial command with an extra vector of args
      - `extend_and_run_and_capture_silent` to run a partial command with an extra vector of args and silently capture the stdout into a string
      - this allows to get rid of the `#[rustfmt::skip]` _directive_ on `main` and format the code not too aggressively
    38fe0ff4
  • STEVAN Antoine's avatar
    update the readme (!206) · 6ebc8bbd
    STEVAN Antoine authored
    This MR explains the use of `make.rs` and `nob.rs` in the README for newcomers.
    6ebc8bbd
  • STEVAN Antoine's avatar
    finish the documentation (!198) · 8c61c2ce
    STEVAN Antoine authored
    this is an attempt at finishing the documentation for real.
    
    the convention is
    - start sentences with capital letter, speaks as 3rd person and end with period
    - specify non-trivial cases and returns in the doc, otherwise, leave that to the tests
    - use mathematical formulae to make things more clear
    
    > 💡 **Note**
    >
    > might supersede !184
    
    For now, i completely skipped FRI because i thought we could do that in a later MR, as it was added later and is not even part of a public release yet.
    
    I also went a bit faster on _aPlonK_ as it is so complex and we will likely never use it.
    
    ## changelog
    > - 🗞️ is for documentation changes
    > - ⚙️ is for code changes
    
    - (🗞️) moves the `RUSTDOCFLAGS` for Katex activation to `.cargo/config.toml`
    - (🗞️) adds `simple_mermaid` for Mermaid graphs
    - (🗞️) upgrades Katex from `0.10.0` to `0.16.21` for matrix support
    - documentation
      - [x] (🗞️) (⚙️) `algebra`: check the length for `algebra::powers_of`
      - [x] (🗞️) (⚙️) `algebra::linalg`: use exact matches in the error tests and use struct errors
      - [x] (🗞️) (⚙️) `error`: change some errors to struct errors
      - [x] (🗞️) (⚙️) `fs`: rename some arguments, e.g. `block_hashes` to `hashes` and `dump_dir` to `directory`
      - [x] (🗞️) (⚙️) `zk`: inline `check_degree_is_too_large`
      - [x] (🗞️)          `fec`
      - [x] (🗞️)          `semi_avid`
      - [x] (🗞️)          `kzg`
      - [x] (🗞️) (⚙️) `aplonk`: remove `Commitment` and `VerifierKey`
      - [ ] (🗞️)          `fri`
      - [x] (🗞️)          Komodo (`lib.rs`)
    8c61c2ce
  • STEVAN Antoine's avatar
    Add ci command to make (!208) · 269463da
    STEVAN Antoine authored
    let's fully embrace the rust and use `make.rs` even in the CI with `make ci`
    
    ## changelog
    - move inner logic to functions, e.g. `clippy` and `test`
    - add `ci` command
      - runs all the CI stages by default
      - runs only the "fmt" stage with `--fmt`
      - runs only the "test" stage with `--test`
      - runs all the CI stages with `--fmt` and `--test`
    - remove useless `json` variable in `docker_images_to_table`
    - update the CI files to use `./make.rs ci ...`
    
    ## mirror
    | id                                                                             | head_sha                                 | status    | conclusion | run_started_at      |
    | ------------------------------------------------------------------------------ | ---------------------------------------- | --------- | ---------- | ------------------- |
    | [`14495015473`](https://github.com/dragoon-rs/komodo/actions/runs/14495015473) | b185b5b4 | completed | success    | 2025-04-16T14:18:13 |
    | [`14592505804`](https://github.com/dragoon-rs/komodo/actions/runs/14592505804) | cbce02c7 | completed | success    | 2025-04-22T10:24:17 |
    269463da
[build]
rustdocflags = ["--html-in-header", "katex.html"]
FROM rust:latest
# Suppress prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update --yes && apt upgrade --yes
RUN apt install --yes protobuf-compiler
COPY rust-toolchain.toml /
RUN rustup show && cargo --version
RUN cargo install cargo-script
RUN apt clean && rm -rf /var/lib/apt/lists/*
const MODULES = [
"benchmarks/",
]
def log-load [m: string] {
print $"[(ansi cyan_bold).env.nu(ansi reset)] loading (ansi purple)($m)(ansi reset)"
}
log-load $MODULES.0
use $MODULES.0
name: Rust CI
on: [push, pull_request, workflow_dispatch]
jobs:
fmt:
runs-on: ubuntu-latest
container:
image: "ghcr.io/dragoon-rs/dragoon/komodo:bcb0e6b5f73420762f6208700a43291e0066c2c3"
if: "!contains(github.event.head_commit.message, 'draft:') && !contains(github.event.head_commit.message, 'no-ci:')"
steps:
- uses: actions/checkout@v3
- run: ./make.rs ci --fmt
test:
runs-on: ubuntu-latest
container:
image: "ghcr.io/dragoon-rs/dragoon/komodo:bcb0e6b5f73420762f6208700a43291e0066c2c3"
needs: fmt
if: "!contains(github.event.head_commit.message, 'draft:') && !contains(github.event.head_commit.message, 'no-ci:')"
steps:
- uses: actions/checkout@v3
- run: ./make.rs ci --test
# Rust
target/
Cargo.lock
*.ndjson
*.png
# IDEs
.idea
.vscode
image: "rust:latest"
image: "gitlab-registry.isae-supaero.fr/dragoon/komodo:bcb0e6b5f73420762f6208700a43291e0066c2c3"
stages:
- fmt
- test
variables:
NUSHELL_ARCH: "x86_64-unknown-linux-musl"
NUSHELL_VERSION: "0.93.0"
workflow:
rules:
- if: $CI_COMMIT_MESSAGE =~ /^(draft|no-ci):/
......@@ -19,28 +15,12 @@ workflow:
fmt:
stage: fmt
script:
- make fmt-check
- ./make.rs ci --fmt
test:
stage: test
needs:
- fmt
before_script:
- apt update --yes
- apt upgrade --yes
- apt install protobuf-compiler --yes
- export NUSHELL_BUILD="nu-$NUSHELL_VERSION-$NUSHELL_ARCH"
- export PATH="/tmp/:$PATH"
# install Nushell
- curl -fLo /tmp/nu.tar.gz "https://github.com/nushell/nushell/releases/download/$NUSHELL_VERSION/$NUSHELL_BUILD.tar.gz"
- tar xvf /tmp/nu.tar.gz --directory /tmp
- cp "/tmp/$NUSHELL_BUILD/nu" /tmp/nu
- make show
script:
- make check clippy test example
- ./make.rs ci --test
REVISION: 1aa2ed1947a0b891398558fcf4e4289849cc5a1d
VERSION: 0.102.0
# decode a list of integer bytes into the underlying encoded string
export def "bytes decode" [encoding: string = "utf-8"]: list<int> -> string {
each { into binary | bytes at 0..1 } | bytes collect | decode $encoding
}
# encode an encoded string into the underlying list of integer bytes
export def "bytes encode" [encoding: string = "utf-8"]: string -> list<int> {
let bytes = $in | encode $encoding
seq 1 ($bytes | bytes length) | each {|i|
$bytes | bytes at ($i - 1)..($i) | into int
}
}
export def "bytes from_int" []: [int -> binary, list<int> -> binary] {
each { into binary --compact } | bytes collect
}
export def "bytes to_int" []: binary -> list<int> {
let bytes = $in
seq 1 ($bytes | bytes length) | each {|i|
$bytes | bytes at ($i - 1)..($i) | get 0
}
}
use error.nu "error throw"
export const WHITE = { r: 1.0, g: 1.0, b: 1.0 }
export const BLACK = { r: 0.0, g: 0.0, b: 0.0 }
export const RED = { r: 1.0, g: 0.0, b: 0.0 }
export const GREEN = { r: 0.0, g: 1.0, b: 0.0 }
export const BLUE = { r: 0.0, g: 0.0, b: 1.0 }
export def "color from-floats" [
r: float,
g: float,
b: float
]: nothing -> record<r: float, g: float, b: float> {
if $r < 0.0 or $r > 1.0 {
error throw {
err: "invalid RGB channel",
label: $"should be between 0 and 1, found ($r)",
span: (metadata $r).span,
}
}
if $g < 0.0 or $g > 1.0 {
error throw {
err: "invalid RGB channel",
label: $"should be between 0 and 1, found ($g)",
span: (metadata $g).span,
}
}
if $b < 0.0 or $b > 1.0 {
error throw {
err: "invalid RGB channel",
label: $"should be between 0 and 1, found ($b)",
span: (metadata $b).span,
}
}
{ r: $r, g: $g, b: $b }
}
export def "color from-ints" [
r: int,
g: int,
b: int
]: nothing -> record<r: float, g: float, b: float> {
if $r < 0 or $r > 255 {
error throw {
err: "invalid RGB channel",
label: $"should be between 0 and 255, found ($r)",
span: (metadata $r).span,
}
}
if $g < 0 or $g > 255 {
error throw {
err: "invalid RGB channel",
label: $"should be between 0 and 255, found ($g)",
span: (metadata $g).span,
}
}
if $b < 0 or $b > 255 {
error throw {
err: "invalid RGB channel",
label: $"should be between 0 and 255, found ($b)",
span: (metadata $b).span,
}
}
{ r: ($r / 255 | into float), g: ($g / 255 | into float), b: ($b / 255 | into float) }
}
def try-string-to-int []: string -> int {
let s = $in
try {
$"0x($s)" | into int
} catch { |e|
let err = $e.debug
| parse --regex 'CantConvert { to_type: "(?<to>.*)", from_type: "(?<from>.*)", span: Span { (?<span>.*) }, help: Some\("(?<help>.*)"\) }'
| into record
let msg = $err.help | str replace --all '\"' '"'
error make --unspanned { msg: $"($msg), found ($s)" }
}
}
export def "color from-string" [s: string]: nothing -> record<r: float, g: float, b: float> {
let res = $s
| parse --regex '^#(?<r>..)(?<g>..)(?<b>..)$'
| into record
if $res == {} {
error throw {
err: "invalid HEX color format",
label: $"format should be '#RRGGBB', found ($s)",
span: (metadata $s).span,
}
}
{
r: ($res.r | try-string-to-int | $in / 255),
g: ($res.g | try-string-to-int | $in / 255),
b: ($res.b | try-string-to-int | $in / 255),
}
}
export def "color mix" [
c1: record<r: float, g: float, b: float>,
c2: record<r: float, g: float, b: float>,
c: float,
]: nothing -> record<r: float, g: float, b: float> {
{
r: ($c * $c1.r + (1 - $c) * $c2.r),
g: ($c * $c1.g + (1 - $c) * $c2.g),
b: ($c * $c1.b + (1 - $c) * $c2.b),
}
}
def float-to-u8-hex []: float -> string {
$in * 255
| math round --precision 0
| into int
| fmt
| get lowerhex
| parse "0x{n}"
| into record
| get n
| into string
| fill --alignment "right" --character '0' --width 2
}
export def "color to-hex" []: record<r: float, g: float, b: float> -> string {
$"#($in.r | float-to-u8-hex)($in.g | float-to-u8-hex)($in.b | float-to-u8-hex)"
}
export def "error throw" [err: record<
err: string,
label: string,
span: record<start: int, end: int>,
# help: string?,
>] {
error make {
msg: $"(ansi red_bold)($err.err)(ansi reset)",
label: {
text: $err.label,
span: $err.span,
},
help: $err.help?,
}
}
[package]
name = "komodo"
version = "0.3.0"
version = "1.0.1"
edition = "2021"
description = "Komodo: cryptographically-proven erasure coding for distributed systems"
repository = "https://gitlab.isae-supaero.fr/dragoon/komodo"
readme = "README.md"
license = "MIT"
authors = [
"Antoine Stevan <antoine.stevan@isae-supaero.fr>",
"Jonathan Detchart <jonathan.detchart@isae-supaero.fr>",
]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
......@@ -16,9 +24,9 @@ rs_merkle = "1.4.1"
thiserror = "1.0.50"
tracing = "0.1.40"
tracing-subscriber = "0.3.17"
# `main.rs` dependencies
ark-bls12-381 = "0.4.0"
rand = "0.8.5"
ark-poly-commit = { git = "https://gitlab.isae-supaero.fr/a.stevan/poly-commit", version = "0.4.0", rev = "19fc0d4", optional = true }
dragoonfri = { version = "0.1.0", optional = true}
simple-mermaid = "0.2.0"
[workspace]
members = [
......@@ -27,4 +35,35 @@ members = [
]
[dev-dependencies]
ark-bls12-381 = "0.4.0"
clap = { version = "4.5.17", features = ["derive"] }
itertools = "0.13.0"
rand = "0.8.5"
dragoonfri-test-utils = "0.1.0"
hex = "0.4.3"
[features]
kzg = ["dep:ark-poly-commit"]
aplonk = ["dep:ark-poly-commit"]
fri = ["dep:dragoonfri"]
fs = []
[package.metadata.docs.rs]
features = ["kzg", "aplonk"]
rustdoc-args = [ "--html-in-header", "katex.html" ]
[[example]]
name = "kzg"
required-features = ["kzg"]
[[example]]
name = "aplonk"
required-features = ["aplonk"]
[[example]]
name = "fri"
required-features = ["fri"]
[[example]]
name = "fec"
required-features = ["fri"]
MIT License
Copyright (c) 2024 ISAE-SUPAERO
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
.PHONY: fmt fmt-check check clippy test example show build-examples
DEFAULT_GOAL: fmt-check check clippy test
fmt-check:
cargo fmt --all -- --check
fmt:
cargo fmt --all
check:
cargo check --workspace --all-targets
clippy:
cargo clippy --workspace --all-targets -- -D warnings
test:
cargo test --workspace --verbose
cargo test --examples --verbose
nu tests/cli.nu
nu tests/binary.nu
nu tests/color.nu
example:
nu examples/cli.nu
show:
rustup --version
rustup show --verbose
rustc --version
cargo --version
cargo clippy --version
nu --version
doc:
cargo doc --document-private-items --no-deps --open
build-examples:
cargo build --examples --release
# Komodo: Cryptographically-proven Erasure Coding
## Usage
Komodo can either be used as a library or as a binary application.
[![release](https://gitlab.isae-supaero.fr/dragoon/komodo/-/badges/release.svg)](https://gitlab.isae-supaero.fr/dragoon/komodo/-/releases)
[![crate](https://img.shields.io/crates/v/komodo)](https://crates.io/crates/komodo)
[![docs](https://img.shields.io/docsrs/komodo)](https://docs.rs/komodo/latest/komodo/)
[![source](https://gitlab.isae-supaero.fr/dragoon/komodo/badges/main/pipeline.svg?key_text=GitLab%20CI)](https://gitlab.isae-supaero.fr/dragoon/komodo/-/pipelines)
[![mirror](https://github.com/dragoon-rs/komodo/actions/workflows/ci.yml/badge.svg)](https://github.com/dragoon-rs/komodo/actions)
Komodo uses a build system entirely writen in Rust.
- [`cargo-script`](https://crates.io/crates/cargo-script) to build the script
- [`nob.rs`](https://gitlab.isae-supaero.fr/a.stevan/nob.rs) to run commands
- [`clap`](https://crates.io/crates/clap) to provide a nice and complete build API
First, [install `cargo-script`](https://github.com/DanielKeep/cargo-script#installation).
Then, run the script with `./make.rs --help`
## the library
see `cargo doc`
```shell
./make.rs doc
```
## the binary application
below is an example of how to use the binary application with Nushell:
```bash
./examples/cli.nu
## the tests
```shell
./make.rs check
./make.rs clippy
./make.rs test
```
> **Note**
> requires Nushell 0.93.0 or later
Other examples that showcase the Komodo API are available in [`examples/`](examples/).
tests for the binary application can also be run with
```bash
nu tests/cli.nu
```
## the benchmarks
see [`benchmarks/`](benchmarks/README.md)
the results can be found in [`dragoon/komodo-benchmark-results`](https://gitlab.isae-supaero.fr/dragoon/komodo-benchmark-results).
## development
## other binaries
Komodo provides a bunch of other binaries that might be interesting of useful to use.
Komodo uses a Docker image as the base of the GitLab pipelines.
The easiest is to use the `cargo.nu` Nushell module as follows
```bash
use .nushell cargo "cargo bin"
help cargo bin
That means that there is nothing to build apart from the source code of Komodo itself when running jobs.
When the development environment needs to change, e.g. when the version of Rust is bumped in
[`rust-toolchain.toml`](./rust-toolchain.toml), one shall run the following commands to push the new
Docker image to the [_container registry_][gitlab.isae-supaero.fr:dragoon/komodo@containers].
```shell
./make.rs container --login
```
```shell
./make.rs container
```
```shell
./make.rs container --push
```
## the benchmarks
see [the `README`](benchmarks/README.md)
## contributors
Because the code for this project has been originally extracted from
[`dragoon/pcs-fec-id`][pcs-fec-id] by @a.stevan, some contributors might be
missing from the Git tree.
Please consult the original Git tree from [`dragoon/pcs-fec-id`][pcs-fec-id] or
note that the following people have contributed to this code base:
- @a.stevan
- @j.detchart
[pcs-fec-id]: https://gitlab.isae-supaero.fr/dragoon/pcs-fec-id
[gitlab.isae-supaero.fr:dragoon/komodo@containers]: https://gitlab.isae-supaero.fr/dragoon/komodo/container_registry/42
File added
File added
File moved
File moved
use ../../../.nushell math *
use ../../../.nushell fs check-file
use ../../../.nushell plot [ into-axis-options, COMMON_OPTIONS, gplt ]
export def main [data: path, --save: path] {
check-file $data --span (metadata $data).span
let graphs = open $data
| where name !~ '^SEC'
| ns-to-ms $.times
| compute-stats $.times
| insert degree { get label | parse "degree {d}" | into record | get d | into int }
| rename --column { degree: "x", mean: "y", stddev: "e" }
| select name x y e
| group-by name --to-table
| reject items.name
| rename --column { group: "name", items: "points" }
| sort-by name
let options = [
# --title "time to create trusted setups for certain curves"
--x-label "degree"
--y-label "time (in ms)"
...($graphs.points | flatten | into-axis-options -x "plain" -y "duration")
...$COMMON_OPTIONS
(if $save != null { [ --save $save ] })
]
gplt plot ($graphs | to json) ...($options | flatten | compact)
}
export def main [
--output: path = "./commit.ndjson",
--nb-measurements: int = 10,
--curves: list<string>,
]: list<int> -> nothing {
let input = $in
if ($input | is-empty) or ($curves | is-empty) {
print "nothing to do"
return
}
cargo run --release --package benchmarks --bin commit -- ...[
--nb-measurements $nb_measurements
...$input
--curves ...$curves
] out> $output
print $"results saved to `($output)`"
}