Skip to content

Conversation

@davxy
Copy link
Member

@davxy davxy commented Jan 23, 2026

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

@davxy davxy marked this pull request as ready for review January 23, 2026 18:12
@davxy davxy changed the title EC Host Functions RFC 0163: EC Host Functions Jan 23, 2026
@davxy davxy requested a review from a team January 25, 2026 16:04

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 `()`
Copy link
Member

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.

Copy link
Member Author

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)?

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.

Copy link
Member Author

@davxy davxy Jan 28, 2026

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

@anaelleltd anaelleltd added the Proposed Is awaiting 3 formal reviews. label Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Proposed Is awaiting 3 formal reviews.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants