use from y coordinate from snarkos

This commit is contained in:
collin 2020-08-15 22:59:26 -07:00
parent ba6cc019b6
commit ced738f852
3 changed files with 83 additions and 83 deletions

75
Cargo.lock generated
View File

@ -128,7 +128,7 @@ version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"
dependencies = [ dependencies = [
"generic-array 0.14.3", "generic-array 0.14.4",
] ]
[[package]] [[package]]
@ -220,9 +220,9 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
[[package]] [[package]]
name = "chrono" name = "chrono"
version = "0.4.13" version = "0.4.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c74d84029116787153e02106bf53e66828452a4b325cc8652b788b5967c0a0b6" checksum = "942f72db697d8767c22d46a598e01f2d3b475501ea43d0db4f16d90259182d0b"
dependencies = [ dependencies = [
"num-integer", "num-integer",
"num-traits", "num-traits",
@ -420,7 +420,7 @@ checksum = "cb582b60359da160a9477ee80f15c8d784c477e69c217ef2cdd4169c24ea380f"
dependencies = [ dependencies = [
"proc-macro2 1.0.19", "proc-macro2 1.0.19",
"quote 1.0.7", "quote 1.0.7",
"syn 1.0.36", "syn 1.0.38",
] ]
[[package]] [[package]]
@ -438,7 +438,7 @@ version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"
dependencies = [ dependencies = [
"generic-array 0.14.3", "generic-array 0.14.4",
] ]
[[package]] [[package]]
@ -449,9 +449,9 @@ checksum = "134951f4028bdadb9b84baf4232681efbf277da25144b9b0ad65df75946c422b"
[[package]] [[package]]
name = "either" name = "either"
version = "1.5.3" version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" checksum = "cd56b59865bce947ac5958779cfa508f6c3b9497cc762b7e24a12d11ccde2c4f"
[[package]] [[package]]
name = "encoding_rs" name = "encoding_rs"
@ -503,7 +503,7 @@ checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4"
dependencies = [ dependencies = [
"proc-macro2 1.0.19", "proc-macro2 1.0.19",
"quote 1.0.7", "quote 1.0.7",
"syn 1.0.36", "syn 1.0.38",
"synstructure", "synstructure",
] ]
@ -677,9 +677,9 @@ dependencies = [
[[package]] [[package]]
name = "generic-array" name = "generic-array"
version = "0.14.3" version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60fb4bb6bba52f78a471264d9a3b7d026cc0af47b22cd2cffbc0b787ca003e63" checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817"
dependencies = [ dependencies = [
"typenum", "typenum",
"version_check", "version_check",
@ -738,9 +738,9 @@ checksum = "d36fab90f82edc3c747f9d438e06cf0a491055896f2a279638bb5beed6c40177"
[[package]] [[package]]
name = "hashbrown" name = "hashbrown"
version = "0.8.1" version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34f595585f103464d8d2f6e9864682d74c1601fed5e07d62b1c9058dba8246fb" checksum = "e91b62f79061a0bc2e046024cb7ba44b08419ed238ecbd9adbd787434b9e8c25"
dependencies = [ dependencies = [
"autocfg", "autocfg",
] ]
@ -846,9 +846,9 @@ dependencies = [
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "1.5.0" version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b88cd59ee5f71fea89a62248fc8f387d44400cefe05ef548466d61ced9029a7" checksum = "86b45e59b16c76b11bf9738fd5d38879d3bd28ad292d7b313608becb17ae2df9"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"hashbrown", "hashbrown",
@ -1411,7 +1411,7 @@ dependencies = [
"pest_meta", "pest_meta",
"proc-macro2 1.0.19", "proc-macro2 1.0.19",
"quote 1.0.7", "quote 1.0.7",
"syn 1.0.36", "syn 1.0.38",
] ]
[[package]] [[package]]
@ -1442,7 +1442,7 @@ checksum = "2c0e815c3ee9a031fdf5af21c10aa17c573c9c6a566328d99e3936c34e36461f"
dependencies = [ dependencies = [
"proc-macro2 1.0.19", "proc-macro2 1.0.19",
"quote 1.0.7", "quote 1.0.7",
"syn 1.0.36", "syn 1.0.38",
] ]
[[package]] [[package]]
@ -1805,7 +1805,7 @@ checksum = "609feed1d0a73cc36a0182a840a9b37b4a82f0b1150369f0536a9e3f2a31dc48"
dependencies = [ dependencies = [
"proc-macro2 1.0.19", "proc-macro2 1.0.19",
"quote 1.0.7", "quote 1.0.7",
"syn 1.0.36", "syn 1.0.38",
] ]
[[package]] [[package]]
@ -1873,14 +1873,14 @@ checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
[[package]] [[package]]
name = "smallvec" name = "smallvec"
version = "1.4.1" version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3757cb9d89161a2f24e1cf78efa0c1fcff485d18e3f55e0aa3480824ddaa0f3f" checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252"
[[package]] [[package]]
name = "snarkos-algorithms" name = "snarkos-algorithms"
version = "0.8.0" version = "0.8.0"
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#a0d7afb4398abc9b2eb7980811b8b9b808df4019" source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#4d2465933876f6cd2a55ed122292b33dbabe9228"
dependencies = [ dependencies = [
"blake2", "blake2",
"derivative", "derivative",
@ -1900,7 +1900,7 @@ dependencies = [
[[package]] [[package]]
name = "snarkos-curves" name = "snarkos-curves"
version = "0.8.0" version = "0.8.0"
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#a0d7afb4398abc9b2eb7980811b8b9b808df4019" source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#4d2465933876f6cd2a55ed122292b33dbabe9228"
dependencies = [ dependencies = [
"derivative", "derivative",
"rand", "rand",
@ -1915,17 +1915,17 @@ dependencies = [
[[package]] [[package]]
name = "snarkos-derives" name = "snarkos-derives"
version = "0.1.0" version = "0.1.0"
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#a0d7afb4398abc9b2eb7980811b8b9b808df4019" source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#4d2465933876f6cd2a55ed122292b33dbabe9228"
dependencies = [ dependencies = [
"proc-macro2 1.0.19", "proc-macro2 1.0.19",
"quote 1.0.7", "quote 1.0.7",
"syn 1.0.36", "syn 1.0.38",
] ]
[[package]] [[package]]
name = "snarkos-dpc" name = "snarkos-dpc"
version = "0.8.0" version = "0.8.0"
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#a0d7afb4398abc9b2eb7980811b8b9b808df4019" source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#4d2465933876f6cd2a55ed122292b33dbabe9228"
dependencies = [ dependencies = [
"blake2", "blake2",
"derivative", "derivative",
@ -1946,7 +1946,7 @@ dependencies = [
[[package]] [[package]]
name = "snarkos-errors" name = "snarkos-errors"
version = "0.8.0" version = "0.8.0"
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#a0d7afb4398abc9b2eb7980811b8b9b808df4019" source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#4d2465933876f6cd2a55ed122292b33dbabe9228"
dependencies = [ dependencies = [
"base58", "base58",
"bech32", "bech32",
@ -1954,12 +1954,13 @@ dependencies = [
"hex", "hex",
"jsonrpc-core", "jsonrpc-core",
"thiserror", "thiserror",
"toml",
] ]
[[package]] [[package]]
name = "snarkos-gadgets" name = "snarkos-gadgets"
version = "0.8.0" version = "0.8.0"
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#a0d7afb4398abc9b2eb7980811b8b9b808df4019" source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#4d2465933876f6cd2a55ed122292b33dbabe9228"
dependencies = [ dependencies = [
"derivative", "derivative",
"digest 0.8.1", "digest 0.8.1",
@ -1974,7 +1975,7 @@ dependencies = [
[[package]] [[package]]
name = "snarkos-models" name = "snarkos-models"
version = "0.8.0" version = "0.8.0"
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#a0d7afb4398abc9b2eb7980811b8b9b808df4019" source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#4d2465933876f6cd2a55ed122292b33dbabe9228"
dependencies = [ dependencies = [
"bincode", "bincode",
"derivative", "derivative",
@ -1990,7 +1991,7 @@ dependencies = [
[[package]] [[package]]
name = "snarkos-objects" name = "snarkos-objects"
version = "0.8.0" version = "0.8.0"
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#a0d7afb4398abc9b2eb7980811b8b9b808df4019" source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#4d2465933876f6cd2a55ed122292b33dbabe9228"
dependencies = [ dependencies = [
"base58", "base58",
"bech32", "bech32",
@ -2011,7 +2012,7 @@ dependencies = [
[[package]] [[package]]
name = "snarkos-parameters" name = "snarkos-parameters"
version = "0.8.0" version = "0.8.0"
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#a0d7afb4398abc9b2eb7980811b8b9b808df4019" source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#4d2465933876f6cd2a55ed122292b33dbabe9228"
dependencies = [ dependencies = [
"hex", "hex",
"snarkos-algorithms", "snarkos-algorithms",
@ -2023,12 +2024,12 @@ dependencies = [
[[package]] [[package]]
name = "snarkos-profiler" name = "snarkos-profiler"
version = "0.8.0" version = "0.8.0"
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#a0d7afb4398abc9b2eb7980811b8b9b808df4019" source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#4d2465933876f6cd2a55ed122292b33dbabe9228"
[[package]] [[package]]
name = "snarkos-utilities" name = "snarkos-utilities"
version = "0.8.0" version = "0.8.0"
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#a0d7afb4398abc9b2eb7980811b8b9b808df4019" source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#4d2465933876f6cd2a55ed122292b33dbabe9228"
dependencies = [ dependencies = [
"bincode", "bincode",
"rand", "rand",
@ -2073,9 +2074,9 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.36" version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cdb98bcb1f9d81d07b536179c269ea15999b5d14ea958196413869445bb5250" checksum = "e69abc24912995b3038597a7a593be5053eb0fb44f3cc5beec0deb421790c1f4"
dependencies = [ dependencies = [
"proc-macro2 1.0.19", "proc-macro2 1.0.19",
"quote 1.0.7", "quote 1.0.7",
@ -2090,7 +2091,7 @@ checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701"
dependencies = [ dependencies = [
"proc-macro2 1.0.19", "proc-macro2 1.0.19",
"quote 1.0.7", "quote 1.0.7",
"syn 1.0.36", "syn 1.0.38",
"unicode-xid 0.2.1", "unicode-xid 0.2.1",
] ]
@ -2143,7 +2144,7 @@ checksum = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793"
dependencies = [ dependencies = [
"proc-macro2 1.0.19", "proc-macro2 1.0.19",
"quote 1.0.7", "quote 1.0.7",
"syn 1.0.36", "syn 1.0.38",
] ]
[[package]] [[package]]
@ -2406,7 +2407,7 @@ dependencies = [
"log", "log",
"proc-macro2 1.0.19", "proc-macro2 1.0.19",
"quote 1.0.7", "quote 1.0.7",
"syn 1.0.36", "syn 1.0.38",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@ -2440,7 +2441,7 @@ checksum = "841a6d1c35c6f596ccea1f82504a192a60378f64b3bb0261904ad8f2f5657556"
dependencies = [ dependencies = [
"proc-macro2 1.0.19", "proc-macro2 1.0.19",
"quote 1.0.7", "quote 1.0.7",
"syn 1.0.36", "syn 1.0.38",
"wasm-bindgen-backend", "wasm-bindgen-backend",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]

View File

@ -188,31 +188,30 @@ impl EdwardsGroupType {
pub fn edwards_affine_from_y_str( pub fn edwards_affine_from_y_str(
y_string: String, y_string: String,
y_span: Span, y_span: Span,
_greatest: Option<bool>, greatest: Option<bool>,
_element_span: Span, element_span: Span,
) -> Result<EdwardsAffine, GroupError> { ) -> Result<EdwardsAffine, GroupError> {
let _y = Fq::from_str(&y_string).map_err(|_| GroupError::y_invalid(y_string, y_span))?; let y = Fq::from_str(&y_string).map_err(|_| GroupError::y_invalid(y_string, y_span))?;
unimplemented!("recover from_y_coordinate not implemented for Edwards Affine") match greatest {
// match greatest { // Sign provided
// // Sign provided Some(greatest) => EdwardsAffine::from_y_coordinate(y, greatest).ok_or(GroupError::y_recover(element_span)),
// Some(greatest) => EdwardsAffine::from_y_coordinate(y, greatest).ok_or(GroupError::y_recover(element_span)), // Sign inferred
// // Sign inferred None => {
// None => { // Attempt to recover with a sign_low bit.
// // Attempt to recover with a sign_low bit. if let Some(element) = EdwardsAffine::from_y_coordinate(y.clone(), false) {
// if let Some(element) = EdwardsAffine::from_y_coordinate(y.clone(), false) { return Ok(element);
// return Ok(element); }
// }
// // Attempt to recover with a sign_high bit.
// // Attempt to recover with a sign_high bit. if let Some(element) = EdwardsAffine::from_y_coordinate(y, true) {
// if let Some(element) = EdwardsAffine::from_y_coordinate(y, true) { return Ok(element);
// return Ok(element); }
// }
// // Otherwise return error.
// // Otherwise return error. Err(GroupError::y_recover(element_span))
// Err(GroupError::y_recover(element_span)) }
// } }
// }
} }
pub fn edwards_affine_from_pair( pub fn edwards_affine_from_pair(

View File

@ -66,29 +66,29 @@ fn test_x_sign_inferred() {
assert_satisfied(program); assert_satisfied(program);
} }
// #[test] #[test]
// fn test_y_sign_high() { fn test_y_sign_high() {
// let bytes = include_bytes!("y_sign_high.leo"); let bytes = include_bytes!("y_sign_high.leo");
// let program = parse_program(bytes).unwrap(); let program = parse_program(bytes).unwrap();
//
// assert_satisfied(program); assert_satisfied(program);
// } }
//
// #[test] #[test]
// fn test_y_sign_low() { fn test_y_sign_low() {
// let bytes = include_bytes!("y_sign_low.leo"); let bytes = include_bytes!("y_sign_low.leo");
// let program = parse_program(bytes).unwrap(); let program = parse_program(bytes).unwrap();
//
// assert_satisfied(program); assert_satisfied(program);
// } }
//
// #[test] #[test]
// fn test_y_sign_inferred() { fn test_y_sign_inferred() {
// let bytes = include_bytes!("y_sign_inferred.leo"); let bytes = include_bytes!("y_sign_inferred.leo");
// let program = parse_program(bytes).unwrap(); let program = parse_program(bytes).unwrap();
//
// assert_satisfied(program); assert_satisfied(program);
// } }
#[test] #[test]
fn test_double_high() { fn test_double_high() {