This repository was archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
arkworks integration #13031
Merged
Merged
arkworks integration #13031
Changes from 250 commits
Commits
Show all changes
432 commits
Select commit
Hold shift + click to select a range
5a8e08a
fix
975e8e7
fix
8330c7a
fix
c1d4487
fix
8eb12b5
fix
5b4ed3f
fix
f1db0e5
fix
ef71a21
fix
345b565
fix
1c82d5c
fix
e1776eb
fix
a15345b
fix
37ede02
fix
a3371a1
fix
8240460
fix compression
82acb85
fix compression
731b042
fix compression
4e93862
Merge branch 'master' into no-compression
81f0881
fix compression
f0a95d3
fix compression
10b050f
fix std leak
80c606f
Merge branch 'master' into no-compression
ada044c
fix std leak
3c8d315
fix std leak
0f581bf
merge master
24d18f8
merge master
7301014
Merge branch 'master' into achimcc/arkworks-integration
7f1a96b
Merge branch 'no-compression' into achimcc/arkworks-integration
55f245a
Merge branch 'master' into achimcc/arkworks-integration
21e609e
Merge branch 'master' into achimcc/arkworks-integration
2564fed
cargo update
914c5d4
Merge branch 'master' into achimcc/arkworks-integration
5f2a075
cargo update
50b0341
Merge branch 'master' into achimcc/arkworks-integration
684ae64
cargo update
800b28e
Merge branch 'master' into achimcc/arkworks-integration
8dc3ee3
cargo update
df89262
Merge branch 'master' into achimcc/arkworks-integration
2ddc471
cargo update
43aba0d
Merge branch 'master' into achimcc/arkworks-integration
16840ab
use serialize_result
1c808d7
Merge branch 'master' into achimcc/arkworks-integration
4efe3af
Merge branch 'master' into achimcc/arkworks-integration
7dda160
cargo update
2e436d8
Merge branch 'master' into achimcc/arkworks-integration
acff5f8
cargo update
3deecae
Merge branch 'master' into achimcc/arkworks-integration
3f95117
cargo update
417dfa4
Merge branch 'master' into achimcc/arkworks-integration
e895c73
cargo update
d1d5d74
reduce boilerplate code
6ed1383
Merge branch 'master' into achimcc/arkworks-integration
6de9638
remove host function muls
f4dfa2a
reduce boilerplate code
d830e86
remove patches
698dcb9
uuse correct ark-substrate branch
abbfb1c
reduce boilerplate code
ddf5181
Merge branch 'master' into achimcc/arkworks-integration
39c7f4a
cleanup
4bb0653
cleanup
235022a
proper error handling
80635ee
derive serialize for error
03dc219
proper error handling
c4b2f04
proper error handling
2160e93
proper error handling
7c183e9
derive Debug for PairingError
86dd3fd
sp-arkworks path
3dabce2
Merge branch 'master' into achimcc/arkworks-integration
4807505
cargo update
1e6c178
adopt tests to error handling
b69de4d
fix tests
4e49a4f
cargo update
6bd1338
remove results
08c9521
deserialize as G2Affine
6e49a08
cargo update
ab35a7a
add codex index to PairingError
4389714
replace Vec<Vec<u8>>
4d3b13c
replace Vec<Vec<u8>>
1ddd6b8
use into_iter for chunks
67987ae
use chunks for scalars
c6a7609
fix ersialized_size
344cfff
use into
9167d59
collect as vec
dd3f809
collect as vec
db18dca
no collect Vec
2e31d91
use into_iter
5a103ac
import AffineRepr
c89e963
fix typo
15898da
cargo update
e56a088
new serialization
c12045d
fix typo
de3cfbd
unwrap results
b0df1e1
unwrap results
9eacba9
use correct deserialization
eef4c77
fix bugs, cleanup
b85de86
correct len
2b1cd00
vec without capacity
fce6686
Revert "vec without capacity"
ab4d2b8
Revert "correct len"
435dab5
Revert "fix bugs, cleanup"
59f25fb
Revert "use correct deserialization"
b011681
Revert "unwrap results"
6a571d0
Revert "unwrap results"
f1eecf9
Revert "fix typo"
5999e11
Revert "new serialization"
531eacb
Revert "cargo update"
bac66ab
Revert "fix typo"
4ad8e32
Revert "import AffineRepr"
03e95bb
Revert "use into_iter"
8649035
Revert "no collect Vec"
af14139
Revert "collect as vec"
e299101
Revert "collect as vec"
eec08b5
Revert "use into"
43a689d
Revert "fix ersialized_size"
757868e
Revert "use chunks for scalars"
24a11d7
Revert "use into_iter for chunks"
b516562
Revert "replace Vec<Vec<u8>>"
573cd48
cargo update
9551b75
cargo update
f417849
Revert "replace Vec<Vec<u8>>"
9138da1
cargo update
db922ca
add error
b35fb25
add error
868d4ac
add error
9fe204e
fix typo
0aa20df
fix imports
3f8dd79
import coded
72c52ff
import codec
c282f62
import PairingError
d4eb534
fix patches
bb8b3d0
sp-arkworks
031485b
sp-arkworks
3ebd14d
Merge branch 'master' into arkworks-host-function-mul
2a5a45d
use random values for multiplications
4231dee
Merge branch 'arkworks-host-function-mul' into achimcc/arkworks-integ…
30b3900
Merge branch 'master' into achimcc/arkworks-integration
7a0e6a1
cargo update
5077864
fix imports
1544a0a
fix imports
1670d62
add host functions
7b92f2f
re-add mul impls
525b1e0
cargo update
9c044bb
cargo update
b70cb73
Merge branch 'master' into achimcc/arkworks-integration
f1a6f60
cargo update
dc3bb4f
cargo update
00ae8b9
cargo update
e3acad2
cargo update
1e09985
cargo update
54c6965
PairingError -> ()
cdc6869
remove PairingError
5a7843b
Merge branch 'master' into achimcc/arkworks-integration
b08e465
cargo update
cb95d98
Merge branch 'master' into achimcc/arkworks-integration
9da264a
cargo update
3806b04
Merge branch 'master' into achimcc/arkworks-integration
db96f33
cargo update
e81c093
reduce boilerplate code
834a314
Merge branch 'master' into achimcc/arkworks-integration
7ef2caa
cargo update
1501c51
update comments
8f0fcb6
Merge branch 'master' into achimcc/arkworks-integration
9b3c36d
cargo update
ca487ec
optimize code quality
a2b185f
Merge branch 'master' into achimcc/arkworks-integration
70bcea0
use ark_scale (#13954)
achimcc 2f8579e
hazmat
8aada1d
ed curves, use ArkScaleProjective
5e86d97
Achimcc/arkworks integration remove affine hostcalls (#13971)
achimcc 828245b
Merge branch 'master' into achimcc/arkworks-integration
ee0f2be
ark-substrate: use main branch
89b4e59
cargo update
9d3e6fc
Achimcc/arkworks integration bandersnatch (#13977)
achimcc b78109c
cargo update
f27bcf9
Merge branch 'master' into achimcc/arkworks-integration
5023e15
cargo update
fad84e0
fix tests
e0e3a5a
cleanup
1c9e8b1
cleanup
1f5ded9
fix tests
fbca295
refactor tests
b23d63f
cargo update
61fc500
Merge branch 'master' into achimcc/arkworks-integration
a7f7bde
cargo update
763c617
Merge branch 'master' into achimcc/arkworks-integration
ab3a111
cargo update
909df35
refactor tests
9fdee99
Merge branch 'master' into achimcc/arkworks-integration
e4c507d
cleanup & update tests
bc27817
Merge branch 'master' into achimcc/arkworks-integration
c00b5ce
upgrade arkworks/algebra
b529096
Merge branch 'master' into achimcc/arkworks-integration
73e4f64
cargo update
706361a
Merge branch 'master' into achimcc/arkworks-integration
e974cc8
adopt tests
d0802ce
versioning ark-substrate
731a254
Merge branch 'master' into achimcc/arkworks-integration
454ef84
Merge branch 'master' into achimcc/arkworks-integration
5fb318d
cargo update
a9d85bf
Merge branch 'master' into achimcc/arkworks-integration
945ba00
remove patched deps
ba068d3
bump ark-scale
4ea6621
Merge branch 'master' into achimcc/arkworks-integration
57e4def
use crates-io deps
eb65ffc
Merge branch 'master' into achimcc/arkworks-integration
047b297
fix doc comments
03f5d13
Cargo.toml, linebreaks at end
69e1d94
reorgainze tests
fdd5cde
sp-arkworks -> sp-crypto-ec-utils
39dc3ba
move host functions to crypto-ec-utils
ce271ba
fmt
01ae9d5
Merge branch 'master' into achimcc/arkworks-integration
cacc216
remove sp-ec-crypto-utils from io
7199d1f
remove unwrap from te msm
058614d
remove elliptic_curves references in test
f07d8d4
elliptic_curves references in test
162b190
update doc comments
965e520
remove warn missing docs
88dd4a3
fmt
8f00f2f
Merge branch 'master' into achimcc/arkworks-integration
3dcacc9
cargo update
25f863f
update doc comments
fa408ad
Merge branch 'master' into achimcc/arkworks-integration
6f23cae
cargo update
e0d4fba
Merge branch 'master' into achimcc/arkworks-integration
eba8b32
cargo update, bump arkworks, codec versions
19e67f9
Merge branch 'master' into achimcc/arkworks-integration
9988dcc
bump runtime version in sp-crypto-ec-utils
f906c5e
remove feature flag ec-utils-experimental
b7caa18
crypto-ec-utils -> crypto/ec-utils
99dd1d2
tests/ -> test-data/
3521242
update doc comments for signatures
e8c3056
Merge branch 'master' into achimcc/arkworks-integration
2d8334f
update comments
a0b375c
update doc comments for signatures
3e99300
fix doc comments
4d37a43
fix doc comments
ae6ce88
fix doc comments
d648ecf
fix doc comments
b189c00
fix doc comments
36cde85
Merge branch 'master' into achimcc/arkworks-integration
6fc40b9
cleanup
6161e64
fix doc comments
34402a4
cargo update
8ff1712
Merge branch 'master' into achimcc/arkworks-integration
36e11b6
Merge branch 'master' into achimcc/arkworks-integration
200df29
fix doc comments
fc68b51
Merge branch 'master' into achimcc/arkworks-integration
665dce2
Merge branch 'master' into achimcc/arkworks-integration
ba03141
cargo update
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| [package] | ||
| name = "sp-arkworks" | ||
| version = "0.4.0" | ||
| authors = ["Parity Technologies <[email protected]>"] | ||
| edition = "2021" | ||
| license = "Apache-2.0" | ||
| homepage = "https://substrate.io" | ||
| repository = "https://github.com/paritytech/substrate/" | ||
|
|
||
| [package.metadata.docs.rs] | ||
| targets = ["x86_64-unknown-linux-gnu"] | ||
|
|
||
| [dependencies] | ||
| ark-serialize = { version = "0.4.0", default-features = false } | ||
| ark-ff = { version = "0.4.0", default-features = false } | ||
| ark-ec = { version = "0.4.0", default-features = false } | ||
| ark-std = { version = "0.4.0", 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 = { version = "0.4.0", default-features = false } | ||
| ark-ed-on-bls12-377 = { version = "0.4.0", default-features = false } | ||
| sp-std = { version = "5.0.0", path = "../std", default-features = false } | ||
| codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false } | ||
|
|
||
| [features] | ||
| default = [ "std" ] | ||
| std = [ | ||
| "ark-serialize/std", | ||
| "ark-ff/std", | ||
| "ark-ec/std", | ||
| "ark-std/std", | ||
| "ark-bls12-377/std", | ||
| "ark-bls12-381/std", | ||
| "ark-bw6-761/std", | ||
| "ark-ed-on-bls12-381/std", | ||
| "ark-ed-on-bls12-377/std", | ||
| "sp-std/std", | ||
| "codec/std", | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| // This file is part of Substrate. | ||
|
|
||
| // Copyright (C) 2017-2022 Parity Technologies (UK) Ltd. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| //! Hashing Functions. | ||
achimcc marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| #![warn(missing_docs)] | ||
|
|
||
| use crate::utils::{ | ||
| final_exponentiation_generic, msm_sw_generic, mul_affine_generic, mul_projective_generic, | ||
| multi_miller_loop_generic, | ||
| }; | ||
| use ark_bls12_377::{g1, g2, Bls12_377}; | ||
| use sp_std::vec::Vec; | ||
|
|
||
| pub fn multi_miller_loop(a: Vec<Vec<u8>>, b: Vec<Vec<u8>>) -> Result<Vec<u8>, ()> { | ||
| multi_miller_loop_generic::<Bls12_377>(a, b) | ||
| } | ||
|
|
||
| pub fn final_exponentiation(target: Vec<u8>) -> Result<Vec<u8>, ()> { | ||
| final_exponentiation_generic::<Bls12_377>(target) | ||
| } | ||
|
|
||
| pub fn msm_g1(bases: Vec<Vec<u8>>, scalars: Vec<Vec<u8>>) -> Vec<u8> { | ||
| msm_sw_generic::<g1::Config>(bases, scalars) | ||
| } | ||
|
|
||
| pub fn msm_g2(bases: Vec<Vec<u8>>, scalars: Vec<Vec<u8>>) -> Vec<u8> { | ||
| msm_sw_generic::<g2::Config>(bases, scalars) | ||
| } | ||
|
|
||
| pub fn mul_projective_g1(base: Vec<u8>, scalar: Vec<u8>) -> Vec<u8> { | ||
| mul_projective_generic::<g1::Config>(base, scalar) | ||
| } | ||
|
|
||
| pub fn mul_projective_g2(base: Vec<u8>, scalar: Vec<u8>) -> Vec<u8> { | ||
| mul_projective_generic::<g2::Config>(base, scalar) | ||
| } | ||
|
|
||
| pub fn mul_affine_g1(base: Vec<u8>, scalar: Vec<u8>) -> Vec<u8> { | ||
| mul_affine_generic::<g1::Config>(base, scalar) | ||
| } | ||
|
|
||
| pub fn mul_affine_g2(base: Vec<u8>, scalar: Vec<u8>) -> Vec<u8> { | ||
| mul_affine_generic::<g2::Config>(base, scalar) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| // This file is part of Substrate. | ||
|
|
||
| // Copyright (C) 2017-2022 Parity Technologies (UK) Ltd. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| //! Hashing Functions. | ||
|
|
||
| #![warn(missing_docs)] | ||
|
|
||
| use crate::utils::{ | ||
| final_exponentiation_generic, msm_sw_generic, mul_affine_generic, mul_projective_generic, | ||
| multi_miller_loop_generic, | ||
| }; | ||
| use ark_bls12_381::{g1, g2, Bls12_381}; | ||
| use sp_std::vec::Vec; | ||
|
|
||
| pub fn multi_miller_loop(a: Vec<Vec<u8>>, b: Vec<Vec<u8>>) -> Result<Vec<u8>, ()> { | ||
| multi_miller_loop_generic::<Bls12_381>(a, b) | ||
| } | ||
|
|
||
| pub fn final_exponentiation(target: Vec<u8>) -> Result<Vec<u8>, ()> { | ||
| final_exponentiation_generic::<Bls12_381>(target) | ||
| } | ||
|
|
||
| pub fn msm_g1(bases: Vec<Vec<u8>>, scalars: Vec<Vec<u8>>) -> Vec<u8> { | ||
| msm_sw_generic::<g1::Config>(bases, scalars) | ||
| } | ||
|
|
||
| pub fn msm_g2(bases: Vec<Vec<u8>>, scalars: Vec<Vec<u8>>) -> Vec<u8> { | ||
| msm_sw_generic::<g2::Config>(bases, scalars) | ||
| } | ||
|
|
||
| pub fn mul_projective_g1(base: Vec<u8>, scalar: Vec<u8>) -> Vec<u8> { | ||
| mul_projective_generic::<g1::Config>(base, scalar) | ||
| } | ||
|
|
||
| pub fn mul_projective_g2(base: Vec<u8>, scalar: Vec<u8>) -> Vec<u8> { | ||
| mul_projective_generic::<g2::Config>(base, scalar) | ||
| } | ||
|
|
||
| pub fn mul_affine_g1(base: Vec<u8>, scalar: Vec<u8>) -> Vec<u8> { | ||
| mul_affine_generic::<g1::Config>(base, scalar) | ||
| } | ||
|
|
||
| pub fn mul_affine_g2(base: Vec<u8>, scalar: Vec<u8>) -> Vec<u8> { | ||
| mul_affine_generic::<g2::Config>(base, scalar) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| // This file is part of Substrate. | ||
|
|
||
| // Copyright (C) 2017-2022 Parity Technologies (UK) Ltd. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| //! Hashing Functions. | ||
|
|
||
| #![warn(missing_docs)] | ||
|
|
||
| use crate::utils::{ | ||
| final_exponentiation_generic, msm_sw_generic, mul_affine_generic, mul_projective_generic, | ||
| multi_miller_loop_generic, | ||
| }; | ||
| use ark_bw6_761::{g1, g2, BW6_761}; | ||
| use sp_std::vec::Vec; | ||
|
|
||
| pub fn multi_miller_loop(a: Vec<Vec<u8>>, b: Vec<Vec<u8>>) -> Result<Vec<u8>, ()> { | ||
| multi_miller_loop_generic::<BW6_761>(a, b) | ||
| } | ||
|
|
||
| pub fn final_exponentiation(target: Vec<u8>) -> Result<Vec<u8>, ()> { | ||
| final_exponentiation_generic::<BW6_761>(target) | ||
| } | ||
|
|
||
| pub fn msm_g1(bases: Vec<Vec<u8>>, scalars: Vec<Vec<u8>>) -> Vec<u8> { | ||
| msm_sw_generic::<g1::Config>(bases, scalars) | ||
| } | ||
|
|
||
| pub fn msm_g2(bases: Vec<Vec<u8>>, scalars: Vec<Vec<u8>>) -> Vec<u8> { | ||
| msm_sw_generic::<g2::Config>(bases, scalars) | ||
| } | ||
|
|
||
| pub fn mul_projective_g1(base: Vec<u8>, scalar: Vec<u8>) -> Vec<u8> { | ||
| mul_projective_generic::<g1::Config>(base, scalar) | ||
| } | ||
|
|
||
| pub fn mul_projective_g2(base: Vec<u8>, scalar: Vec<u8>) -> Vec<u8> { | ||
| mul_projective_generic::<g2::Config>(base, scalar) | ||
| } | ||
|
|
||
| pub fn mul_affine_g1(base: Vec<u8>, scalar: Vec<u8>) -> Vec<u8> { | ||
| mul_affine_generic::<g1::Config>(base, scalar) | ||
| } | ||
|
|
||
| pub fn mul_affine_g2(base: Vec<u8>, scalar: Vec<u8>) -> Vec<u8> { | ||
| mul_affine_generic::<g2::Config>(base, scalar) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| // This file is part of Substrate. | ||
|
|
||
| // Copyright (C) 2017-2022 Parity Technologies (UK) Ltd. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| //! Hashing Functions. | ||
|
|
||
| #![warn(missing_docs)] | ||
|
|
||
| use crate::utils::{msm_te_generic, mul_affine_te_generic, mul_projective_te_generic}; | ||
| use ark_ed_on_bls12_377::EdwardsConfig; | ||
| use sp_std::vec::Vec; | ||
|
|
||
| pub fn mul_projective(base: Vec<u8>, scalar: Vec<u8>) -> Vec<u8> { | ||
| mul_projective_te_generic::<EdwardsConfig>(base, scalar) | ||
| } | ||
|
|
||
| pub fn mul_affine(base: Vec<u8>, scalar: Vec<u8>) -> Vec<u8> { | ||
| mul_affine_te_generic::<EdwardsConfig>(base, scalar) | ||
| } | ||
|
|
||
| pub fn msm(bases: Vec<Vec<u8>>, scalars: Vec<Vec<u8>>) -> Vec<u8> { | ||
| msm_te_generic::<EdwardsConfig>(bases, scalars) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| // This file is part of Substrate. | ||
|
|
||
| // Copyright (C) 2017-2022 Parity Technologies (UK) Ltd. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| //! Hashing Functions. | ||
|
|
||
| #![warn(missing_docs)] | ||
|
|
||
| use crate::utils::{ | ||
| msm_sw_generic, msm_te_generic, mul_affine_generic, mul_affine_te_generic, | ||
| mul_projective_generic, mul_projective_te_generic, | ||
| }; | ||
| use ark_ed_on_bls12_381::JubjubConfig; | ||
| use sp_std::vec::Vec; | ||
|
|
||
| pub fn sw_mul_projective(base: Vec<u8>, scalar: Vec<u8>) -> Vec<u8> { | ||
| mul_projective_generic::<JubjubConfig>(base, scalar) | ||
| } | ||
|
|
||
| pub fn sw_mul_affine(base: Vec<u8>, scalar: Vec<u8>) -> Vec<u8> { | ||
| mul_affine_generic::<JubjubConfig>(base, scalar) | ||
| } | ||
|
|
||
| pub fn te_mul_projective(base: Vec<u8>, scalar: Vec<u8>) -> Vec<u8> { | ||
| mul_projective_te_generic::<JubjubConfig>(base, scalar) | ||
| } | ||
|
|
||
| pub fn te_mul_affine(base: Vec<u8>, scalar: Vec<u8>) -> Vec<u8> { | ||
| mul_affine_te_generic::<JubjubConfig>(base, scalar) | ||
| } | ||
|
|
||
| pub fn te_msm(bases: Vec<Vec<u8>>, scalars: Vec<Vec<u8>>) -> Vec<u8> { | ||
| msm_te_generic::<JubjubConfig>(bases, scalars) | ||
| } | ||
|
|
||
| pub fn sw_msm(bases: Vec<Vec<u8>>, scalars: Vec<Vec<u8>>) -> Vec<u8> { | ||
| msm_sw_generic::<JubjubConfig>(bases, scalars) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #![cfg_attr(not(feature = "std"), no_std)] | ||
|
|
||
| pub mod bls12_377; | ||
| pub mod bls12_381; | ||
| pub mod bw6_761; | ||
| pub mod ed_on_bls12_377; | ||
| pub mod ed_on_bls12_381; | ||
| mod utils; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.