mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-11-23 23:23:50 +03:00
support n-group notation
This commit is contained in:
parent
4736a8f724
commit
4355e1cd5a
261
Cargo.lock
generated
261
Cargo.lock
generated
@ -1238,13 +1238,13 @@ dependencies = [
|
||||
"rand_xorshift",
|
||||
"serde",
|
||||
"sha2",
|
||||
"snarkos-curves 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-curves",
|
||||
"snarkos-dpc",
|
||||
"snarkos-errors 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-errors",
|
||||
"snarkos-gadgets",
|
||||
"snarkos-models 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-objects 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-utilities 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-models",
|
||||
"snarkos-objects",
|
||||
"snarkos-utilities",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
@ -1254,9 +1254,9 @@ version = "1.0.0"
|
||||
dependencies = [
|
||||
"rand",
|
||||
"rand_xorshift",
|
||||
"snarkos-errors 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-models 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-utilities 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-errors",
|
||||
"snarkos-models",
|
||||
"snarkos-utilities",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
@ -1268,11 +1268,11 @@ dependencies = [
|
||||
"pest",
|
||||
"pest-ast",
|
||||
"pest_derive",
|
||||
"snarkos-algorithms 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-curves 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-errors 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-algorithms",
|
||||
"snarkos-curves",
|
||||
"snarkos-errors",
|
||||
"snarkos-gadgets",
|
||||
"snarkos-models 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-models",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
@ -1303,12 +1303,12 @@ dependencies = [
|
||||
"self_update",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"snarkos-algorithms 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-curves 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-errors 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-algorithms",
|
||||
"snarkos-curves",
|
||||
"snarkos-errors",
|
||||
"snarkos-gadgets",
|
||||
"snarkos-models 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-utilities 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-models",
|
||||
"snarkos-utilities",
|
||||
"thiserror",
|
||||
"toml",
|
||||
"zip",
|
||||
@ -1339,14 +1339,14 @@ dependencies = [
|
||||
"leo-typed",
|
||||
"rand",
|
||||
"rand_xorshift",
|
||||
"snarkos-algorithms 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-curves 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-algorithms",
|
||||
"snarkos-curves",
|
||||
"snarkos-dpc",
|
||||
"snarkos-errors 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-models 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-objects 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-errors",
|
||||
"snarkos-models",
|
||||
"snarkos-objects",
|
||||
"snarkos-storage",
|
||||
"snarkos-utilities 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-utilities",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
@ -1360,8 +1360,8 @@ dependencies = [
|
||||
"pest",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"snarkos-errors 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-models 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-errors",
|
||||
"snarkos-models",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2325,26 +2325,6 @@ version = "1.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252"
|
||||
|
||||
[[package]]
|
||||
name = "snarkos-algorithms"
|
||||
version = "1.0.0"
|
||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#9fda1b628c627bf717556e81dc10bee667f77a52"
|
||||
dependencies = [
|
||||
"blake2",
|
||||
"derivative",
|
||||
"digest 0.8.1",
|
||||
"itertools 0.9.0",
|
||||
"rand",
|
||||
"rand_chacha",
|
||||
"rayon",
|
||||
"sha2",
|
||||
"smallvec",
|
||||
"snarkos-errors 1.0.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)",
|
||||
"snarkos-models 1.0.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)",
|
||||
"snarkos-profiler 1.0.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)",
|
||||
"snarkos-utilities 1.0.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snarkos-algorithms"
|
||||
version = "1.0.0"
|
||||
@ -2360,25 +2340,10 @@ dependencies = [
|
||||
"rayon",
|
||||
"sha2",
|
||||
"smallvec",
|
||||
"snarkos-errors 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-models 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-profiler 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-utilities 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snarkos-curves"
|
||||
version = "1.0.0"
|
||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#9fda1b628c627bf717556e81dc10bee667f77a52"
|
||||
dependencies = [
|
||||
"derivative",
|
||||
"rand",
|
||||
"rand_xorshift",
|
||||
"rustc_version",
|
||||
"serde",
|
||||
"snarkos-errors 1.0.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)",
|
||||
"snarkos-models 1.0.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)",
|
||||
"snarkos-utilities 1.0.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)",
|
||||
"snarkos-errors",
|
||||
"snarkos-models",
|
||||
"snarkos-profiler",
|
||||
"snarkos-utilities",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2392,19 +2357,9 @@ dependencies = [
|
||||
"rand_xorshift",
|
||||
"rustc_version",
|
||||
"serde",
|
||||
"snarkos-errors 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-models 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-utilities 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snarkos-derives"
|
||||
version = "1.0.0"
|
||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#9fda1b628c627bf717556e81dc10bee667f77a52"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.19",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.38",
|
||||
"snarkos-errors",
|
||||
"snarkos-models",
|
||||
"snarkos-utilities",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2429,21 +2384,22 @@ dependencies = [
|
||||
"hex",
|
||||
"itertools 0.9.0",
|
||||
"rand",
|
||||
"snarkos-algorithms 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-curves 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-errors 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-algorithms",
|
||||
"snarkos-curves",
|
||||
"snarkos-errors",
|
||||
"snarkos-gadgets",
|
||||
"snarkos-models 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-objects 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-parameters 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-profiler 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-utilities 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-models",
|
||||
"snarkos-objects",
|
||||
"snarkos-parameters",
|
||||
"snarkos-profiler",
|
||||
"snarkos-utilities",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snarkos-errors"
|
||||
version = "1.0.0"
|
||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#9fda1b628c627bf717556e81dc10bee667f77a52"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "45fbdc0916755cdf9522f6abc20103681f0d23308067b1a53be91fe216392d37"
|
||||
dependencies = [
|
||||
"base58",
|
||||
"bech32",
|
||||
@ -2456,21 +2412,6 @@ dependencies = [
|
||||
"toml",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snarkos-errors"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "45fbdc0916755cdf9522f6abc20103681f0d23308067b1a53be91fe216392d37"
|
||||
dependencies = [
|
||||
"base58",
|
||||
"bech32",
|
||||
"bincode",
|
||||
"hex",
|
||||
"jsonrpc-core",
|
||||
"thiserror",
|
||||
"toml",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snarkos-gadgets"
|
||||
version = "1.0.0"
|
||||
@ -2480,27 +2421,11 @@ dependencies = [
|
||||
"derivative",
|
||||
"digest 0.8.1",
|
||||
"itertools 0.9.0",
|
||||
"snarkos-algorithms 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-curves 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-errors 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-models 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-utilities 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snarkos-models"
|
||||
version = "1.0.0"
|
||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#9fda1b628c627bf717556e81dc10bee667f77a52"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"derivative",
|
||||
"itertools 0.9.0",
|
||||
"rand",
|
||||
"rand_xorshift",
|
||||
"serde",
|
||||
"smallvec",
|
||||
"snarkos-errors 1.0.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)",
|
||||
"snarkos-utilities 1.0.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)",
|
||||
"snarkos-algorithms",
|
||||
"snarkos-curves",
|
||||
"snarkos-errors",
|
||||
"snarkos-models",
|
||||
"snarkos-utilities",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2516,29 +2441,8 @@ dependencies = [
|
||||
"rand_xorshift",
|
||||
"serde",
|
||||
"smallvec",
|
||||
"snarkos-errors 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-utilities 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snarkos-objects"
|
||||
version = "1.0.0"
|
||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#9fda1b628c627bf717556e81dc10bee667f77a52"
|
||||
dependencies = [
|
||||
"base58",
|
||||
"bech32",
|
||||
"chrono",
|
||||
"derivative",
|
||||
"hex",
|
||||
"once_cell",
|
||||
"rand",
|
||||
"serde",
|
||||
"sha2",
|
||||
"snarkos-algorithms 1.0.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)",
|
||||
"snarkos-curves 1.0.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)",
|
||||
"snarkos-errors 1.0.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)",
|
||||
"snarkos-models 1.0.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)",
|
||||
"snarkos-utilities 1.0.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)",
|
||||
"snarkos-errors",
|
||||
"snarkos-utilities",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2556,24 +2460,11 @@ dependencies = [
|
||||
"rand",
|
||||
"serde",
|
||||
"sha2",
|
||||
"snarkos-algorithms 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-curves 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-errors 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-models 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-utilities 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snarkos-parameters"
|
||||
version = "1.0.0"
|
||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#9fda1b628c627bf717556e81dc10bee667f77a52"
|
||||
dependencies = [
|
||||
"curl",
|
||||
"hex",
|
||||
"snarkos-algorithms 1.0.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)",
|
||||
"snarkos-errors 1.0.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)",
|
||||
"snarkos-models 1.0.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)",
|
||||
"snarkos-utilities 1.0.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)",
|
||||
"snarkos-algorithms",
|
||||
"snarkos-curves",
|
||||
"snarkos-errors",
|
||||
"snarkos-models",
|
||||
"snarkos-utilities",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2582,18 +2473,14 @@ version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec4f9d1db48ac8b784d2499af9619c0ee5b3c619ca9467dbf102804aba721873"
|
||||
dependencies = [
|
||||
"curl",
|
||||
"hex",
|
||||
"snarkos-algorithms 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-errors 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-models 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-utilities 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-algorithms",
|
||||
"snarkos-errors",
|
||||
"snarkos-models",
|
||||
"snarkos-utilities",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snarkos-profiler"
|
||||
version = "1.0.0"
|
||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#9fda1b628c627bf717556e81dc10bee667f77a52"
|
||||
|
||||
[[package]]
|
||||
name = "snarkos-profiler"
|
||||
version = "1.0.0"
|
||||
@ -2603,7 +2490,8 @@ checksum = "7cf0f5fd8121285811d5b5f7c61e85e176c2ca55d8009e24e151308a7eaa0db6"
|
||||
[[package]]
|
||||
name = "snarkos-storage"
|
||||
version = "1.0.0"
|
||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#9fda1b628c627bf717556e81dc10bee667f77a52"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6763f78edd89f0694feeaaa51a16ad663ee7bdec17f88bc239ab121507f794f4"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"hex",
|
||||
@ -2611,23 +2499,12 @@ dependencies = [
|
||||
"rand",
|
||||
"rocksdb",
|
||||
"serde",
|
||||
"snarkos-algorithms 1.0.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)",
|
||||
"snarkos-errors 1.0.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)",
|
||||
"snarkos-models 1.0.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)",
|
||||
"snarkos-objects 1.0.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)",
|
||||
"snarkos-parameters 1.0.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)",
|
||||
"snarkos-utilities 1.0.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snarkos-utilities"
|
||||
version = "1.0.0"
|
||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#9fda1b628c627bf717556e81dc10bee667f77a52"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"rand",
|
||||
"snarkos-derives 1.0.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)",
|
||||
"snarkos-errors 1.0.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)",
|
||||
"snarkos-algorithms",
|
||||
"snarkos-errors",
|
||||
"snarkos-models",
|
||||
"snarkos-objects",
|
||||
"snarkos-parameters",
|
||||
"snarkos-utilities",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2638,8 +2515,8 @@ checksum = "21ad2b96414c45c2f90e9344b1420c9db2fbbb9435d6f1da3e2f819da1b08c05"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"rand",
|
||||
"snarkos-derives 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-errors 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"snarkos-derives",
|
||||
"snarkos-errors",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -98,4 +98,10 @@ impl GroupError {
|
||||
|
||||
Self::new_from_span(message, span)
|
||||
}
|
||||
|
||||
pub fn n_group(number: String, span: Span) -> Self {
|
||||
let message = format!("cannot multiply group generator by \"{}\"", number);
|
||||
|
||||
Self::new_from_span(message, span)
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ use snarkos_curves::{
|
||||
use snarkos_errors::gadgets::SynthesisError;
|
||||
use snarkos_gadgets::curves::edwards_bls12::EdwardsBlsGadget;
|
||||
use snarkos_models::{
|
||||
curves::{AffineCurve, One, TEModelParameters, Zero},
|
||||
curves::{AffineCurve, Fp256, One, TEModelParameters, Zero},
|
||||
gadgets::{
|
||||
curves::{FieldGadget, FpGadget, GroupGadget},
|
||||
r1cs::ConstraintSystem,
|
||||
@ -41,7 +41,7 @@ use snarkos_models::{
|
||||
};
|
||||
use std::{
|
||||
borrow::Borrow,
|
||||
ops::{Neg, Sub},
|
||||
ops::{Mul, Neg, Sub},
|
||||
str::FromStr,
|
||||
};
|
||||
|
||||
@ -142,12 +142,14 @@ impl EdwardsGroupType {
|
||||
}
|
||||
|
||||
pub fn edwards_affine_from_single(number: String, span: Span) -> Result<EdwardsAffine, GroupError> {
|
||||
if number.eq("1") {
|
||||
return Ok(edwards_affine_one());
|
||||
} else if number.eq("0") {
|
||||
if number.eq("0") {
|
||||
return Ok(EdwardsAffine::zero());
|
||||
} else {
|
||||
Self::edwards_affine_from_x_str(number, span.clone(), None, span)
|
||||
let one = edwards_affine_one();
|
||||
let number_value = Fp256::from_str(&number).map_err(|_| GroupError::n_group(number, span))?;
|
||||
let result: EdwardsAffine = one.mul(&number_value);
|
||||
|
||||
return Ok(result);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user