Skip to content

Straus algorithm implementation#312

Open
Eimantoshis wants to merge 1 commit intograndinetech:mainfrom
Eimantoshis:straus
Open

Straus algorithm implementation#312
Eimantoshis wants to merge 1 commit intograndinetech:mainfrom
Eimantoshis:straus

Conversation

@Eimantoshis
Copy link

No description provided.

@ArtiomTr
Copy link
Contributor

ArtiomTr commented Dec 9, 2025

Also please squash your commits & fix pipeline

@BenasKc
Copy link

BenasKc commented Dec 16, 2025

Just a note - obviously we'll squash, the commit history is a mess

Copy link
Contributor

@ArtiomTr ArtiomTr left a comment

Choose a reason for hiding this comment

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

Tests still fail:

  1. Parallel tests:
cargo test -p rust-kzg-blst --no-default-features --features strauss,std,rand,parallel

Fail with:

error[E0599]: no method named `multiply_parallel` found for reference `&StraussTable<TFr, TG1, TG1Fp, TG1Affine, TProjAddAffine>` in the current scope
  --> kzg/src/msm/msm_impls.rs:26:24
   |
26 |         precomputation.multiply_parallel(scalars)
   |                        ^^^^^^^^^^^^^^^^^ method not found in `&StraussTable<TFr, TG1, TG1Fp, TG1Affine, TProjAddAffine>`

NOTE: No need to implement parallel MSM version. You can just call sequential version now.

  1. Mcl backend MSM:
cargo test -p rust-kzg-mcl --no-default-features --features std,rand,strauss

Fail with:

test tests::g1_make_linear_combination_ ... FAILED
test tests::g1_small_linear_combination_ ... FAILED
test tests::g1_random_linear_combination_ ... FAILED

failures:

---- tests::g1_make_linear_combination_ stdout ----

thread 'tests::g1_make_linear_combination_' panicked at mcl/src/types/g1.rs:494:9:
not yet implemented
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- tests::g1_small_linear_combination_ stdout ----

thread 'tests::g1_small_linear_combination_' panicked at mcl/src/types/g1.rs:494:9:
not yet implemented

---- tests::g1_random_linear_combination_ stdout ----

thread 'tests::g1_random_linear_combination_' panicked at mcl/src/types/g1.rs:494:9:
not yet implemented


failures:
    tests::g1_make_linear_combination_
    tests::g1_random_linear_combination_
    tests::g1_small_linear_combination_

Comment on lines +387 to +390
scalars
.iter()
.map(|s| self.multiply_sequential(s))
.collect()
Copy link
Contributor

Choose a reason for hiding this comment

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

For the third time, this code is wrong. It doesn't matter how many times you resolve this comment, your code won't magically fix itself.

You're using wrong table here. If ever this code path gets hit, you'll get incorrect result. And you can easily check other implementations - bgmw and wbits - and you'll see, that those implementations don't do this.

I still have no idea why you keep this code branch here. Why if check is needed here at all? You can replace your code with panic!, and not even single test will fail - this code is unreachable, only else { branch gets triggered.

@@ -1 +1,4 @@
pub mod local_tests;

#[cfg(test)]
Copy link
Contributor

Choose a reason for hiding this comment

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

no need to put #[cfg(test)] twice


// Test generator
let ct_gen = CtG1::generator();
let blst_gen = rust_kzg_blst::types::g1::FsG1::generator();
Copy link
Contributor

Choose a reason for hiding this comment

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

all good, just don't overcomplicate this test so much: no need to bring rust-kzg-blst as dependency - you can just hardcode bytes here. For convenience you can use hex crate, then it will look like so:

let point = CtG1::generator().mul(&CtFr::from_u64(5));
let bytes = point.to_bytes_uncompressed();
assert_eq!(bytes, hex::decode("<hex value>"));
assert!(point.equals(&CtG1::from_bytes_uncompressed(bytes).unwrap()));

And that's all, no need for any other checks. Then you can copy-paste this few times, to test with few more points (e.g., g * 5, g * 7, g * 1235, ...).

Copy link
Contributor

@ArtiomTr ArtiomTr left a comment

Choose a reason for hiding this comment

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

looks good 👍 commits need to be squashed tho

@Eimantoshis
Copy link
Author

looks good 👍 commits need to be squashed tho

none of us can merge, we don't have write/push access, can you squash merge?

Copy link

@BenasKc BenasKc left a comment

Choose a reason for hiding this comment

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

Since I am added as a reviewer, I guess I still have to approve?

@ArtiomTr
Copy link
Contributor

none of us can merge, we don't have write/push access, can you squash merge?

you don't need push access to rebase your own branch, and squash commits into one.

@BenasKc
Copy link

BenasKc commented Jan 22, 2026

The build fails because the dependency URLs in github return 500, will investigate. No additional changes have been made

    Updating crates.io index
    Updating git repository `[https://github.com/herumi/mcl-rust.git`](https://github.com/herumi/mcl-rust.git%60)
    Updating git submodule `[https://github.com/herumi/mcl`](https://github.com/herumi/mcl%60)
    Updating git repository `[https://github.com/mratsim/constantine.git`](https://github.com/mratsim/constantine.git%60)
    Updating git repository `[https://github.com/crate-crypto/rust-eth-kzg.git`](https://github.com/crate-crypto/rust-eth-kzg.git%60)
warning: spurious network error (3 tries remaining): unexpected http status code: 500; class=Http (34)
Warning: warning: spurious network error (2 tries remaining): unexpected http status code: 500; class=Http (34)
warning: spurious network error (1 try remaining): unexpected http status code: 500; class=Http (34)
Warning: error: failed to get `ekzg-bls12-381` as a dependency of package `msm-benches v0.1.0 (/home/runner/work/rust-kzg/rust-kzg/msm-benches)`

Caused by:
  failed to load source for dependency `ekzg-bls12-381`

Caused by:
  Unable to update https://github.com/crate-crypto/rust-eth-kzg.git#acf3a5e8

Caused by:
  failed to clone into: /home/runner/.cargo/git/db/rust-eth-kzg-03e5035eb78c4408

Caused by:
  revision acf3a5e8062e9a67c184c77ebff9c55223f9e034 not found

Caused by:
  network failure seems to have happened
  if a proxy or similar is necessary `net.git-fetch-with-cli` may help here
  https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli

Caused by:
  unexpected http status code: 500; class=Http (34)
Error: The process '/home/runner/.cargo/bin/cargo' failed with exit code 101```

@BenasKc
Copy link

BenasKc commented Jan 22, 2026

image The pipelines are again not working, this time for a different reason - some package has networking issues, will repush to restart workflow

@ArtiomTr
Copy link
Contributor

Co-authored-by: Eimantoshis <eimantas.labzentis@mif.stud.vu.lt>
Co-authored-by: Cartelis <deividas.sapalas@mif.stud.vu.lt>
@BenasKc
Copy link

BenasKc commented Jan 23, 2026

Added all the authors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants