Skip to content

Commit

Permalink
Merged main
Browse files Browse the repository at this point in the history
  • Loading branch information
sauliusgrigaitis committed Nov 23, 2023
2 parents a1ad8b1 + d448540 commit 8ce6db4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
17 changes: 2 additions & 15 deletions blst/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ version = "0.1.0"
edition = "2021"

[dependencies]
# TODO: Use `std` feature once https://github.com/supranational/blst/pull/150 or similar upstreamed
blst = { git = 'https://github.com/supranational/blst.git' }
kzg = { path = "../kzg", default-features = false }
libc = { version = "0.2.148", default-features = false }
once_cell = { version = "1.18.0", features = ["critical-section"], default-features = false }
rand = { version = "0.8.5", optional = true }
rayon = { version = "1.8.0", optional = true }
smallvec = { version = "1.11.1", features = ["const_generics"] }
hex = "0.4.3"
hex = { version = "0.4.3", default-features = false, features = ["alloc"] }

[dev-dependencies]
criterion = "0.5.1"
Expand All @@ -23,9 +22,9 @@ rand = "0.8.5"
default = [
"std",
"rand",
"blst-default"
]
std = [
"hex/std",
"kzg/std",
"libc/std",
"once_cell/std",
Expand All @@ -39,18 +38,6 @@ parallel = [
"kzg/parallel"
]

# By default, compile with ADX extension if the host supports it.
# Binary can be executed on systems similar to the host.
blst-default = ["blst/default"]

# Compile in portable mode, without ISA extensions.
# Binary can be executed on all systems.
blst-portable = ["blst/portable"]

# Enable ADX even if the host CPU doesn't support it.
# Binary can be executed on Broadwell+ and Ryzen+ systems.
blst-force-adx = ["blst/force-adx"]

[[bench]]
name = "das"
harness = false
Expand Down
24 changes: 24 additions & 0 deletions tasks/II.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Task II - Optimise MSM

* The codebase needs to be updated to the latest [c-kzg-4844](https://github.com/ethereum/c-kzg-4844), dependencies also needs to be upgraded;
* KZG10 does a heavy MSM computation when calculating commitment and opening. `rust-kzg` with `blst` backend uses Pippenger method (including the parallel version of it) and produces decent results, however, `go-kzg-4844` is faster here, so there is a place for improvements. Possible optimisation directions:
- BGMW algoritm ([this dissertation](https://uwspace.uwaterloo.ca/bitstream/handle/10012/19626/Luo_Guiwen.pdf?sequence=3) is an easy to read source). We will likely benefit from it because our trusted setup is not very large, we can store precomputations in the memory. C++ implementation can be found [here](https://github.com/LuoGuiwen/MSM_blst/blob/2e098f09f07969ac3191406976be6d1c197100f2/main_p1.cpp#L294). However, we need a parallelized Rust version, so it could be that the best way is to build on top of [blst parallel implementation](https://github.com/supranational/blst/blob/master/bindings/rust/src/pippenger.rs#L116). Feel free to explore other code bases and use it if there is actually a more convenient parallel Pippenger implementation in Rust.
- Other optimisations proposed in that [this dissertation](https://uwspace.uwaterloo.ca/bitstream/handle/10012/19626/Luo_Guiwen.pdf?sequence=3);
- Optimisations implemented in [arkmsm](https://github.com/snarkify/arkmsm), they also have an [explanation](https://hackmd.io/@drouyang/msm);
- Cuda GPU parallel algorithms, some examples [here](https://github.com/z-prize/2022-entries/tree/main/open-division/prize1-msm/prize1a-msm-gpu), but very likely there are faster versions now;
- Discuss other ideas with the supervisor.
* Teams will need to try to figure out a way to get their algorithms useful for other ECC backends, if this is not possible for some reason - MSM optimistations will be needed to be implemented for `blst` backend;
* The build must pass on Github CI.

Points: 2

Deadline 2023-11-09

----------------------------------------------------------------

Each task has its deadline specified in the task that allows getting 100% of the points if done correctly. However, each late week significantly reduces the points:

1 week -25%
2 week -50%
3 week -75%
4 week -100%

0 comments on commit 8ce6db4

Please sign in to comment.