feat: add arkworks wrapper for bn128 operations#9
feat: add arkworks wrapper for bn128 operations#9AllFi wants to merge 4 commits intotronprotocol:masterfrom
Conversation
1. add rust crate with functions required for bn128 precompiles 2. make the necessary adjustments to include this crate in libsnarkjni 3. implement LibarkworksWrapper 4. add tests
|
3.10.0-1160.36.2.el7.x86_64 # 1 SMP Wed Jul 21 11:57:15 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux "Could not load library. Reasons: [java.lang.LinkageError: Unable to load library zksnarkjni, java.lang.LinkageError: Unable to load library from /tmp/libzksnarkjni-7289434056439766101.so, java.lang.LinkageError: Unable to load library from /home/java-tron/.hawtjni/zksnarkjni/libzksnarkjni-8327699144273145661.so]" type="java.lang.UnsatisfiedLinkError">java.lang.UnsatisfiedLinkError: Could not load library. Reasons: [java.lang.LinkageError: Unable to load library zksnarkjni, java.lang.LinkageError: Unable to load library from /tmp/libzksnarkjni-7289434056439766101.so, java.lang.LinkageError: Unable to load library from /home/java-tron/.hawtjni/zksnarkjni/libzksnarkjni-8327699144273145661.so] |
|
@AllFi By the way, can you provide a version for arm64? |
|
Hello, @halibobo1205! Is it necessary to use a specific version of glibc for the arm64 build? |
@AllFi The error occurs on an x86 server. |
@AllFi , not required, because java-tron doesn't support arm64 currently. |
1. strip linux64/libzksnarkjni.so 2. fix memcpy.c for aarch64 target 3. update linux64/aarch64/libsnarkjni.so
1. build libzksnarkjni.so on CentOS 7 2. update linux64/libzksnarkjni.so
I rebuilt
I applied a workaround from Could you please confirm if the issue has been resolved? |
|
@AllFi Hi, re-check on CentOS 7 x86_64, it works well. |
Do you expect any more fixes? It seems that everything works |
|
@r0wdy1 Hi, Then ,i rebuild it, there's still an error. |
|
Hello, @halibobo1205! I managed to solve this by adding But I don't know if this solution is ok. I tried to build So it seems the fix in the What do you think the best way is to build it? |
Sorry, I also tried again with |
1. add -pthread flag to fix link error on arm 2. rebuild linux libs
|
@AllFi Sorry, I found the previous build log that shows |
No problem, this solution also works for me with |
This PR introduces
LibarkworksWrapperthat uses rust implementation from arkworks to provide necessary functions for BN128Addition, BN128Multiplication, and BN128Pairing precompiles.This PR is the first step to resolve this issue. A preliminary discussion of this PR can be found here.