Closed tkstanczak closed 3 years ago
We are using the mcl-wasm
implementation at EthereumJS-VM.
What values do you get for the Fp
0e885bb33996e12f07da69073e2c0cc880bc8eff26d2a724299eb12d54f4bcf26f4748bb020e80a7e3794a7b0e47a641
point?
We get the G1
point:
5c2c27c2c7d9717c363bacb2546f96d9eae5b7e964fe01719e95e0df006a7d281b14cc25afa31329c7f7dc487c9b323 187193f8df8ba8618b2b7b06704ab7e33c49fc8916a47935f57f9330c351827a107187d0233d9421adf1a08f12265c7d
Which does not match the test case (this is test 2 of the MapG1 test file which you linked).
I have not implemented MapG1 compatible with IEFT spec.
MapG2 is compatible with IEFT spec. Do you need MapG1?
Hi @herumi, yes for Ethereum 1 Berlin hard fork -> MapG1 is the only thing missing -> everyhting else is passing tests nicely (amazing work from you!). Is that much work - would you be able to implement it? Is there anything that you would need from us to support it? I have created a simple CSharp binding pull request but I could polish it a bit more for you to show that we care :)
We have the herumi/mcl supporting both our Eth1 and Eth2 implementations.
I see. I'll implement maptoG1, but it will take a while because I have many tasks.
I've implemented mclBnG1_hashAndMapTo
to support hash-to-curve-09 with dst="BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_POP_"
.
Hey @herumi, thanks a lot so far 😄 ! We'd need the mclBnFp_mapToG1
function for the Ethereum EIP so we can implement the final precompile using this library. Could you implement this as well?
I see. Now mcl::bn::mapToG1
(so mclBnFp_mapToG1
) is compatible to eip2537/fp_to_g1.csv .
https://github.com/herumi/mcl/commit/7909bd297bd6b9652e9d89ce19b04feb4edfabf6#diff-dda4c369b6f5cbb9b85d5e18eb7948eb
Thanks a lot! Could you also expose this in mcl-wasm? 😄
We implemented it - thanks again! 😄
TL;DR MapToG2, MulVec, Add, Pairing, Mode <- I am getting correct number here MapToG1 <- I am getting unexpected numbers
===
I was able to implement all of these with herumi/mcl except for MapToG1 https://eips.ethereum.org/EIPS/eip-2537
I was taking test cases from here (and they were verified with two other libraries) https://github.com/matter-labs/eip1962/blob/master/src/test/test_vectors/eip2537/fp_to_g1.csv
Code that I use: