-
Notifications
You must be signed in to change notification settings - Fork 656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement additional features to the "group" element type #2394
Conversation
Codecov Report
@@ Coverage Diff @@
## testnet3 #2394 +/- ##
============================================
+ Coverage 78.57% 78.65% +0.07%
============================================
Files 154 154
Lines 4691 4708 +17
Branches 4690 4707 +17
============================================
+ Hits 3686 3703 +17
Misses 1005 1005
... and 5 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
let scalar_value: scalar = 1scalar; | ||
// let string_value: string = "helloworld"; | ||
|
||
// BHP256 hash_to_group tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like these should be BHP1024
let scalar_value: scalar = 1scalar; | ||
// let string_value: string = "helloworld"; | ||
|
||
// BHP256 hash_to_group tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like these should be BHP512
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There were 3 BHP test files that look like they need some find/replace attention. (Added direct comments on them already.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
// BHP256 hash_to_group tests | ||
let a: group = BHP256::hash_to_group(addr_value); | ||
let b: group = BHP256::hash_to_group(bool_value); | ||
let c: group = BHP256::hash_to_group(field_value); | ||
// let d: group = BHP256::hash_to_group(group_value); | ||
let e: group = BHP256::hash_to_group(i8_value); | ||
let f: group = BHP256::hash_to_group(i16_value); | ||
let g: group = BHP256::hash_to_group(i32_value); | ||
let h: group = BHP256::hash_to_group(i64_value); | ||
let i: group = BHP256::hash_to_group(i128_value); | ||
let j: group = BHP256::hash_to_group(u8_value); | ||
let k: group = BHP256::hash_to_group(u16_value); | ||
let l: group = BHP256::hash_to_group(u32_value); | ||
let m: group = BHP256::hash_to_group(u64_value); | ||
let n: group = BHP256::hash_to_group(u128_value); | ||
let o: group = BHP256::hash_to_group(scalar_value); | ||
// let p: group = BHP256::hash_to_group(string_value); | ||
let q: group = BHP256::hash_to_group(Foo { a: 1u128, b: 1u128 }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// BHP256 hash_to_group tests | |
let a: group = BHP256::hash_to_group(addr_value); | |
let b: group = BHP256::hash_to_group(bool_value); | |
let c: group = BHP256::hash_to_group(field_value); | |
// let d: group = BHP256::hash_to_group(group_value); | |
let e: group = BHP256::hash_to_group(i8_value); | |
let f: group = BHP256::hash_to_group(i16_value); | |
let g: group = BHP256::hash_to_group(i32_value); | |
let h: group = BHP256::hash_to_group(i64_value); | |
let i: group = BHP256::hash_to_group(i128_value); | |
let j: group = BHP256::hash_to_group(u8_value); | |
let k: group = BHP256::hash_to_group(u16_value); | |
let l: group = BHP256::hash_to_group(u32_value); | |
let m: group = BHP256::hash_to_group(u64_value); | |
let n: group = BHP256::hash_to_group(u128_value); | |
let o: group = BHP256::hash_to_group(scalar_value); | |
// let p: group = BHP256::hash_to_group(string_value); | |
let q: group = BHP256::hash_to_group(Foo { a: 1u128, b: 1u128 }); | |
// BHP512 hash_to_group tests | |
let a: group = BHP512::hash_to_group(addr_value); | |
let b: group = BHP512::hash_to_group(bool_value); | |
let c: group = BHP512::hash_to_group(field_value); | |
// let d: group = BHP512::hash_to_group(group_value); | |
let e: group = BHP512::hash_to_group(i8_value); | |
let f: group = BHP512::hash_to_group(i16_value); | |
let g: group = BHP512::hash_to_group(i32_value); | |
let h: group = BHP512::hash_to_group(i64_value); | |
let i: group = BHP512::hash_to_group(i128_value); | |
let j: group = BHP512::hash_to_group(u8_value); | |
let k: group = BHP512::hash_to_group(u16_value); | |
let l: group = BHP512::hash_to_group(u32_value); | |
let m: group = BHP512::hash_to_group(u64_value); | |
let n: group = BHP512::hash_to_group(u128_value); | |
let o: group = BHP512::hash_to_group(scalar_value); | |
// let p: group = BHP512::hash_to_group(string_value); | |
let q: group = BHP512::hash_to_group(Foo { a: 1u128, b: 1u128 }); |
// BHP256 hash_to_group tests | ||
let a: group = BHP256::hash_to_group(addr_value); | ||
let b: group = BHP256::hash_to_group(bool_value); | ||
let c: group = BHP256::hash_to_group(field_value); | ||
// let d: group = BHP256::hash_to_group(group_value); | ||
let e: group = BHP256::hash_to_group(i8_value); | ||
let f: group = BHP256::hash_to_group(i16_value); | ||
let g: group = BHP256::hash_to_group(i32_value); | ||
let h: group = BHP256::hash_to_group(i64_value); | ||
let i: group = BHP256::hash_to_group(i128_value); | ||
let j: group = BHP256::hash_to_group(u8_value); | ||
let k: group = BHP256::hash_to_group(u16_value); | ||
let l: group = BHP256::hash_to_group(u32_value); | ||
let m: group = BHP256::hash_to_group(u64_value); | ||
let n: group = BHP256::hash_to_group(u128_value); | ||
let o: group = BHP256::hash_to_group(scalar_value); | ||
// let p: group = BHP256::hash_to_group(string_value); | ||
let q: group = BHP256::hash_to_group(Foo { a: 1u128, b: 1u128 }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// BHP256 hash_to_group tests | |
let a: group = BHP256::hash_to_group(addr_value); | |
let b: group = BHP256::hash_to_group(bool_value); | |
let c: group = BHP256::hash_to_group(field_value); | |
// let d: group = BHP256::hash_to_group(group_value); | |
let e: group = BHP256::hash_to_group(i8_value); | |
let f: group = BHP256::hash_to_group(i16_value); | |
let g: group = BHP256::hash_to_group(i32_value); | |
let h: group = BHP256::hash_to_group(i64_value); | |
let i: group = BHP256::hash_to_group(i128_value); | |
let j: group = BHP256::hash_to_group(u8_value); | |
let k: group = BHP256::hash_to_group(u16_value); | |
let l: group = BHP256::hash_to_group(u32_value); | |
let m: group = BHP256::hash_to_group(u64_value); | |
let n: group = BHP256::hash_to_group(u128_value); | |
let o: group = BHP256::hash_to_group(scalar_value); | |
// let p: group = BHP256::hash_to_group(string_value); | |
let q: group = BHP256::hash_to_group(Foo { a: 1u128, b: 1u128 }); | |
// BHP1024 hash_to_group tests | |
let a: group = BHP1024::hash_to_group(addr_value); | |
let b: group = BHP1024::hash_to_group(bool_value); | |
let c: group = BHP1024::hash_to_group(field_value); | |
// let d: group = BHP1024::hash_to_group(group_value); | |
let e: group = BHP1024::hash_to_group(i8_value); | |
let f: group = BHP1024::hash_to_group(i16_value); | |
let g: group = BHP1024::hash_to_group(i32_value); | |
let h: group = BHP1024::hash_to_group(i64_value); | |
let i: group = BHP1024::hash_to_group(i128_value); | |
let j: group = BHP1024::hash_to_group(u8_value); | |
let k: group = BHP1024::hash_to_group(u16_value); | |
let l: group = BHP1024::hash_to_group(u32_value); | |
let m: group = BHP1024::hash_to_group(u64_value); | |
let n: group = BHP1024::hash_to_group(u128_value); | |
let o: group = BHP1024::hash_to_group(scalar_value); | |
// let p: group = BHP1024::hash_to_group(string_value); | |
let q: group = BHP1024::hash_to_group(Foo { a: 1u128, b: 1u128 }); |
// BHP256 hash_to_group tests | ||
let a: group = BHP256::hash_to_group(addr_value); | ||
let b: group = BHP256::hash_to_group(bool_value); | ||
let c: group = BHP256::hash_to_group(field_value); | ||
// let d: group = BHP256::hash_to_group(group_value); | ||
let e: group = BHP256::hash_to_group(i8_value); | ||
let f: group = BHP256::hash_to_group(i16_value); | ||
let g: group = BHP256::hash_to_group(i32_value); | ||
let h: group = BHP256::hash_to_group(i64_value); | ||
let i: group = BHP256::hash_to_group(i128_value); | ||
let j: group = BHP256::hash_to_group(u8_value); | ||
let k: group = BHP256::hash_to_group(u16_value); | ||
let l: group = BHP256::hash_to_group(u32_value); | ||
let m: group = BHP256::hash_to_group(u64_value); | ||
let n: group = BHP256::hash_to_group(u128_value); | ||
let o: group = BHP256::hash_to_group(scalar_value); | ||
// let p: group = BHP256::hash_to_group(string_value); | ||
let q: group = BHP256::hash_to_group(Foo { a: 1u128, b: 1u128 }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// BHP256 hash_to_group tests | |
let a: group = BHP256::hash_to_group(addr_value); | |
let b: group = BHP256::hash_to_group(bool_value); | |
let c: group = BHP256::hash_to_group(field_value); | |
// let d: group = BHP256::hash_to_group(group_value); | |
let e: group = BHP256::hash_to_group(i8_value); | |
let f: group = BHP256::hash_to_group(i16_value); | |
let g: group = BHP256::hash_to_group(i32_value); | |
let h: group = BHP256::hash_to_group(i64_value); | |
let i: group = BHP256::hash_to_group(i128_value); | |
let j: group = BHP256::hash_to_group(u8_value); | |
let k: group = BHP256::hash_to_group(u16_value); | |
let l: group = BHP256::hash_to_group(u32_value); | |
let m: group = BHP256::hash_to_group(u64_value); | |
let n: group = BHP256::hash_to_group(u128_value); | |
let o: group = BHP256::hash_to_group(scalar_value); | |
// let p: group = BHP256::hash_to_group(string_value); | |
let q: group = BHP256::hash_to_group(Foo { a: 1u128, b: 1u128 }); | |
// BHP768 hash_to_group tests | |
let a: group = BHP768::hash_to_group(addr_value); | |
let b: group = BHP768::hash_to_group(bool_value); | |
let c: group = BHP768::hash_to_group(field_value); | |
// let d: group = BHP768::hash_to_group(group_value); | |
let e: group = BHP768::hash_to_group(i8_value); | |
let f: group = BHP768::hash_to_group(i16_value); | |
let g: group = BHP768::hash_to_group(i32_value); | |
let h: group = BHP768::hash_to_group(i64_value); | |
let i: group = BHP768::hash_to_group(i128_value); | |
let j: group = BHP768::hash_to_group(u8_value); | |
let k: group = BHP768::hash_to_group(u16_value); | |
let l: group = BHP768::hash_to_group(u32_value); | |
let m: group = BHP768::hash_to_group(u64_value); | |
let n: group = BHP768::hash_to_group(u128_value); | |
let o: group = BHP768::hash_to_group(scalar_value); | |
// let p: group = BHP768::hash_to_group(string_value); | |
let q: group = BHP768::hash_to_group(Foo { a: 1u128, b: 1u128 }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added ```suggestion comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Changes implemented to be compatible with https://github.com/AleoHQ/snarkVM/pull/1576
Motivation
This PR introduces new
commit_to_group
,hash_many
(placeholder),hash_to_group
, andhash_to_scalar
opcodes.partially addresses #2386
Changelog
As part of this PR, all
hash.*
andcommit.*
opcodes now return afield
type as the default, and we introducecommit_to_group
,hash_to_group
, andhash_to_scalar
for other return types (that are cryptographically safe).The existing opcodes
commit.ped64
andcommit.ped128
have had their return type changed fromgroup
tofield
, to adhere to the updated design.Aleo instructions commit opcodes
Leo commit methods
Aleo instructions hash opcodes
Leo hash methods