Skip to content

Commit

Permalink
Elliptic curves utilities refactory (#2068)
Browse files Browse the repository at this point in the history
- Usage the new published
[arkworks-extensions](https://github.com/paritytech/arkworks-extensions)
crates.
  Hooks are internally defined to jump into the proper host functions.
- Conditional compilation of each curve (gated by feature with curve
name)
- Separation in smaller host functions sets, divided by curve (fits
nicely with prev point)
  • Loading branch information
davxy authored Oct 31, 2023
1 parent 3ae86ae commit c38aae6
Show file tree
Hide file tree
Showing 9 changed files with 1,059 additions and 362 deletions.
85 changes: 85 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 45 additions & 18 deletions substrate/primitives/crypto/ec-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,53 @@ repository.workspace = true
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
ark-ec = { version = "0.4.2", default-features = false }
ark-bls12-377 = { version = "0.4.0", features = ["curve"], default-features = false }
ark-bls12-381 = { version = "0.4.0", features = ["curve"], default-features = false }
ark-bw6-761 = { version = "0.4.0", default-features = false }
ark-ed-on-bls12-381-bandersnatch = { version = "0.4.0", default-features = false }
ark-ed-on-bls12-377 = { version = "0.4.0", default-features = false }
ark-scale = { version = "0.0.11", features = ["hazmat"], default-features = false }
sp-runtime-interface = { path = "../../runtime-interface", default-features = false}
sp-std = { path = "../../std", default-features = false }
ark-ec = { version = "0.4.2", default-features = false, optional = true }
ark-bls12-377-ext = { version = "0.4.1", default-features = false, optional = true }
ark-bls12-377 = { version = "0.4.0", default-features = false, features = ["curve"], optional = true }
ark-bls12-381-ext = { version = "0.4.1", default-features = false, optional = true }
ark-bls12-381 = { version = "0.4.0", default-features = false, features = ["curve"], optional = true }
ark-bw6-761-ext = { version = "0.4.1", default-features = false, optional = true }
ark-bw6-761 = { version = "0.4.0", default-features = false, optional = true }
ark-ed-on-bls12-381-bandersnatch-ext = { version = "0.4.1", default-features = false, optional = true }
ark-ed-on-bls12-381-bandersnatch = { version = "0.4.0", default-features = false, optional = true }
ark-ed-on-bls12-377-ext = { version = "0.4.1", default-features = false, optional = true }
ark-ed-on-bls12-377 = { version = "0.4.0", default-features = false, optional = true }
ark-scale = { version = "0.0.11", default-features = false, features = ["hazmat"], optional = true }
sp-runtime-interface = { path = "../../runtime-interface", default-features = false, optional = true }
sp-std = { path = "../../std", default-features = false, optional = true }

[features]
default = [ "std" ]
std = [
"ark-bls12-377/std",
"ark-bls12-381/std",
"ark-bw6-761/std",
"ark-ec/std",
"ark-ed-on-bls12-377/std",
"ark-ed-on-bls12-381-bandersnatch/std",
"ark-scale/std",
"sp-runtime-interface/std",
"sp-std/std",
"ark-bls12-377-ext?/std",
"ark-bls12-377?/std",
"ark-bls12-381-ext?/std",
"ark-bls12-381?/std",
"ark-bw6-761-ext?/std",
"ark-bw6-761?/std",
"ark-ec?/parallel",
"ark-ed-on-bls12-377-ext?/std",
"ark-ed-on-bls12-377?/std",
"ark-ed-on-bls12-381-bandersnatch-ext?/std",
"ark-ed-on-bls12-381-bandersnatch?/std",
"ark-scale?/std",
"sp-runtime-interface?/std",
"sp-std?/std",
]
common = [ "ark-ec", "ark-scale", "sp-runtime-interface", "sp-std" ]
bls12-377 = [ "ark-bls12-377", "ark-bls12-377-ext", "common" ]
bls12-381 = [ "ark-bls12-381", "ark-bls12-381-ext", "common" ]
bw6-761 = [ "ark-bw6-761", "ark-bw6-761-ext", "common" ]
ed-on-bls12-377 = [ "ark-ed-on-bls12-377", "ark-ed-on-bls12-377-ext", "common" ]
ed-on-bls12-381-bandersnatch = [
"ark-ed-on-bls12-381-bandersnatch",
"ark-ed-on-bls12-381-bandersnatch-ext",
"common",
]
all-curves = [
"bls12-377",
"bls12-381",
"bw6-761",
"ed-on-bls12-377",
"ed-on-bls12-381-bandersnatch",
]
Loading

0 comments on commit c38aae6

Please sign in to comment.