-
Notifications
You must be signed in to change notification settings - Fork 71
RFC 0163: EC Host Functions #163
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
base: main
Are you sure you want to change the base?
Conversation
|
|
||
| All host functions return `Result<Vec<u8>, ()>`, where: | ||
| - On success, the `Ok` variant contains the result encoded using the ArkScale codec as described above | ||
| - On error, the `Err` variant contains an empty unit type `()` |
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.
Why not define an error enum? I assume there could be some error like decoding.
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.
Yeah. There are currently 3 possible error variants:
- decode
- msm args length mismatch
- multi miller loop args length mismatch
I'll add the error enum
| - **BLS12-381**: Pairing-friendly curve widely used for BLS signatures and zkSNARKs | ||
| - **Ed-on-BLS12-381-Bandersnatch**: Twisted Edwards curve for in-circuit operations within BLS12-381 zkSNARKs | ||
|
|
||
| **TODO**: Which additional curves should be included in this first iteration (e.g. Ed25519, BLS12-377, etc)? |
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.
Quoting @@AlistairStewart we need Pastas curves for variety of reasons in order to use Curve Tree for RingProof in order to scale ring size to O(10^6). It also open us to use a considerable amount of well implemented audited zk code from Zcash. I think @coax1d has already implemented those host call for both curves. I'm not sure where they are.
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.
They've been added to arkworks-extensions crate. I can add these to the hostcalls
Proposal for a set of host functions for performing computationally intensive elliptic curve operations in Polkadot runtimes. These host functions enable efficient execution of cryptographic primitives that would otherwise be significantly expensive when executed in the runtime.
Rendered
CC @drskalman @burdges