-
Notifications
You must be signed in to change notification settings - Fork 145
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
Expose some types and gadgets #1860
Conversation
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.
some unused imports and an unused method purged here
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.
exposing the uint32 / bytes converters that we already use internally for sha2
function sha256Compression(H: UInt32[], W: UInt32[]) { | ||
function sha256Compression([...H]: UInt32[], W: UInt32[]) { |
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.
this fixes a bug, the compression function mutated its input, which bit me because in dynamic sha2 you don't necessarily want to use the output
function mapValue< | ||
A extends ProvableHashable<any>, | ||
V extends InferValue<A>, | ||
W, | ||
T extends InferProvable<A> | ||
>( |
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.
method to take one provable and modify its "value" type
|
||
// expore base class so that we can detect Bytes with `instanceof` | ||
Bytes.Base = InternalBytes; |
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.
we should always expose base classes somewhere for type factories, so that users can detect what class they have using instanceof
.
putting base classes on .Base
of the factory function seems like a nice, non-intrusive pattern to me.
Several additions that were handy when implementing dynamic-length SHA2 and general-purpose array types in zksecurity/mina-attestations#25
InferValue
,From
,TupleN
arrayGet()
and UInt32 to/from bytesPacked
class much better typedCI run here: zksecurity#2