herumi / bls

288 stars 132 forks source link

NuGet package of C# binding #90

Closed colibrishin closed 1 year ago

colibrishin commented 1 year ago

https://github.com/planetarium/bls-herumi/tree/master/ffi/cs

After some struggle, have done some modifications in C# binding for cross-platform. Would it be okay to publish in a NuGet package? and could you help me with what Id is used for, and how the Share/Recover[Type]() methods work?

Originally posted by @colibrishin in https://github.com/herumi/bls/issues/86#issuecomment-1217524601

herumi commented 1 year ago

Thank you for the PR, but it contains many modifications, so it will take time to check it.

I'm not familiar with NuGet. It seems that .diea, NativeImprot, and other added files look to be automatically generated. Are they necessary, or can we remove them?

colibrishin commented 1 year ago

Check This document about NuGet. Compiling native runtime and publishing the NuGet package could be automated with Github Action (For like, build and upload them as artifacts, and download artifacts in one action and run Publish NuGet?)

.idea is generated by JetBrain Rider, therefore it can be removed, however, NativeImport is needed for importing the native runtime (i.e., bls384_256, mclbn384_256, mcl). This PR summarizes the modification and why it is needed. And for cross-platform supporting sakes, the project is converted to .Net Core.

herumi commented 1 year ago

I have some questions.

https://github.com/planetarium/bls-herumi/blob/master/ffi/cs/Properties/AssemblyInfo.cs#L8-L12 I think that bls-eth is better than bls256.

herumi commented 1 year ago

could you help me with what Id is used for, and how the Share/Recover[Type]() methods work?

Id is a public identifier to distinguish each user, so they should be different from each other.

Id means the x_i at https://en.wikipedia.org/wiki/Shamir%27s_Secret_Sharing#Mathematical_formulation .

colibrishin commented 1 year ago

How did you build files in runtimes?

The POSIX builds are built with the Github Action. And for Windows, I've used the mklib.bat with MSVC (vcvars64.bat.) The runtimes are added in .csproj for including the runtimes in the build results. The native runtimes will be loaded by NativeImport in runtime.

Are you planning to maintain the GitHub repository and a NuGet package?

Yes.

https://github.com/planetarium/bls-herumi/blob/master/ffi/cs/Properties/AssemblyInfo.cs#L8-L12 I think that bls-eth is better than bls256.

Thanks! I'll fix it.

herumi commented 1 year ago

The POSIX builds are built with the Github Action.

Thank you for the information. I'll study it.

Are you planning to maintain the GitHub repository and a NuGet package? Yes.

I see. Which do you like whether the plan or the other one that I make a repository such as herumi/bls-eth-cs for NuGet and receive your PR?

colibrishin commented 1 year ago

I see. Which do you like whether the plan or the other one that I make a repository such as herumi/bls-eth-cs for NuGet and receive your PR?

I have no insight about which is better. I'm planning to manage it with cherry-picking upstream. What advantage would it offer to have a separate repository?

herumi commented 1 year ago

What advantage would it offer to have a separate repository?

I don't want to put the DLL directly into the herumi/bls repository. If I can only put the DLL into the NuGet package, that's ok.

herumi commented 1 year ago

If you would not like to take the time to these discussions, you can feel free to publish a NuGet package from your repository.

colibrishin commented 1 year ago

I'll stay with publishing NuGet package from forked repository. Thanks for your help!