stellar / rs-soroban-env

Rust environment for Soroban contracts.
Apache License 2.0
60 stars 40 forks source link

BL12-381 Integration #1310

Open PlamenHristov opened 8 months ago

PlamenHristov commented 8 months ago

What

Added:

Missing:

Why

Because of issue #779

Known limitations

jayz22 commented 8 months ago

Some general comments. I'm not too familiar with the implementation details yet.

None of these functions can use existing metering cost types, for each of these functions {p1, p2}_{add, mul, serialize}, a new cost types need to be added, calibrated and charged. (I also remember @graydon mentioned something we need to be careful about when it comes to FFI, but I can't recall exactly) These functions need to be exposed via the env, via env.json entry and a corresponding implementation in host.rs. It would be nice to have some tests, not comprehensive coverage but for sanity checks, to make sure they are doing what's expected and there are no obvious issues.

dmkozh commented 8 months ago

Besides the points that @jayz22 has mentioned, there are important high-level issues:

I suppose this PR could be used as a starting point for the future work, but we can't really merge it until these issues have been resolved.

PlamenHristov commented 8 months ago

Ok I think I know what needs to be done to the PR to make it review ready. Will convert to draft in the meantime

PlamenHristov commented 5 months ago
  1. Implemented the missing:

    • BLS12_PAIRING
    • BLS12_MAP_FP_TO_G1
    • BLS12_MAP_FP2_TO_G2
    • BLS12_HASH_TO_G1
    • BLS12_HASH_TO_G2
  2. Added tests

Ready for review in terms of the implementation.

Still requires adding budgeting of individual operations and charging them in stellar-xdr