bounties icon indicating copy to clipboard operation
bounties copied to clipboard

[Bounty] Integrate VDF Rust implementation in harmony Go client

Open rlan35 opened this issue 3 years ago • 16 comments

Description

VDF is one of the key component for Harmony's randomness generation. For more details about the use of VDF in randomness, read https://docs.harmony.one/home/general/technology/randomness. Harmony's current client implementation is in Golang and we've implemented a VDF in Golang here: https://github.com/harmony-one/vdf. The Golang VDF is functional but not performance-optimized. We would like to have the fastest VDF implementation so the security of the randomness generation can be high.

Specifically, we've identified this Rust version of VDF to be a lot faster than the Go version: https://docs.rs/vdf/0.1.0/vdf/, and this bounty is on the integration of this VDF implementation in our Go client.

Time Estimation

2-4 weeks

Acceptance Criteria

  • [ ] Wrap the Rust VDF into a Go library which expose the key functions such as Compute() and Verify().
  • [ ] Benchmark comparison between the Rust and Go version of the VDF and shows the performance advantage of the Rust Version. Compare CPU/memory usage, speed etc.
  • [ ] Integrate the Wrapper Go library for Rust VDF into our main Harmony client that successfully builds.

Bounty

$5000 USD equivalent in ONE tokens.

rlan35 avatar Mar 09 '21 02:03 rlan35

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 25164.7447 ONE (4970.34 USD @ $0.2/ONE) attached to it.

gitcoinbot avatar Mar 25 '21 05:03 gitcoinbot

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work has been started.

These users each claimed they can complete the work by 4 days, 7 hours from now. Please review their action plans below:

1) kevinkelley has started work.

I'm comfortable in both Rust and Go, and have done lots of library wrapper integrations over the years. I'm interested and have been involved on crypto projects for years. I really want to do this, and I think it suits my skillset.

I'm reviewing and planning now, will update as progress happens 2) alexiachen has started work.

dev a rust wrapper(https://github.com/poanetwork/vdf) for go

Learn more on the Gitcoin Issue Details page.

gitcoinbot avatar Mar 30 '21 01:03 gitcoinbot

Progress update, I now have a working FFI from Go calling the Rust VDF functions execute() and verify().

Will proceed with integrating to the as described.

...I'm not too familiar with the bounty program here. Do I need approval to work? How does the acceptance happen, if several are working on this?

KevinKelley avatar Apr 01 '21 08:04 KevinKelley

I think you just do and document your work, then mark it complete when you finish, and the author of the bounty will select the winner(s) this is just a guess tho. im also new and still looking into this stuff

mognify avatar Apr 01 '21 08:04 mognify

thanks @mognify ...I'm proceeding like that, hopefully it's right lol

KevinKelley avatar Apr 01 '21 11:04 KevinKelley

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 25164.7447 ONE (4498.10 USD @ $0.17/ONE) has been submitted by:


gitcoinbot avatar Apr 03 '21 13:04 gitcoinbot

Thanks @KevinKelley for your interest and progress. Since it is a bounty, everyone can work on it. Once you finished, you just submit. The bounty owner will pick the winner(s) then. You may also work in group if you would like to.

A regular progress and ask for feedback would be helpful so that you won't waste time working on some wrong direction though.

LeoHChen avatar Apr 06 '21 22:04 LeoHChen

Hi, My name is Mearaj Bhagad and I am interested in working on this task.

I have a question regarding Rust VDF into a Go library. (Just for clarification) My question is that if an equally good implementation of VDF in pure golang is done, will it be acceptable or it's a hard requirement of Rust's VDF implementation to be binded/interfaced to golang's wrapper/library. I hope you got me. Thanks :)

mearaj avatar Apr 14 '21 01:04 mearaj

@mearaj hi... I'm not the owner. I'm just working it too...

My understanding is that, the purpose is to get Rust FFI implementation for the speed improvement.

There is already a Go implementation, but owner wants faster, and the Rust seems to win.

I have made progress. I have Rust-FFI working fine, and timings seem to track exactly with those of the Rust version...

For me... I'm working now to integrate the Rust-FFI into the Go project, not just the test app (already done) but the project itself.

KevinKelley avatar Apr 14 '21 02:04 KevinKelley

I'll say that I don't have much in the way of profiling and timing though. I would think that's important, to document the speedup and decide whether it's worth the trouble...

Gut feeling and based on the results so far,, I think it is.

KevinKelley avatar Apr 14 '21 02:04 KevinKelley

Thanks @KevinKelley for the reply :)

mearaj avatar Apr 14 '21 12:04 mearaj

@rlan35 I'm expecting to have ready to review, in a few days, likely by early to mid-week.

I'm sure there will be comments or requests or further work, before final acceptance..

KevinKelley avatar Apr 16 '21 22:04 KevinKelley

Hi I have a submission here https://github.com/harjas27/vdf-wrapper. Please review

harjas27 avatar May 03 '21 19:05 harjas27

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 25164.7447 ONE (3692.83 USD @ $0.14/ONE) has been submitted by:

  1. @harjas27

@papiofficial please take a look at the submitted work:

  • PR by @harjas27

gitcoinbot avatar May 03 '21 20:05 gitcoinbot

I've submitted as well; I have to admit that mine is not as cleanly finished as I wish. Eye infection kept me offline for a while. @harjas27 submission looks cleanly and well done... ...honestly, I have nothing to add, and he seems to be complete, where I haven't integrated yet.

KevinKelley avatar May 03 '21 21:05 KevinKelley

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


The funding of 25164.7447 ONE (3072.46 USD @ $0.12/ONE) attached to this issue has been approved & issued to @harjas27.

gitcoinbot avatar May 11 '21 18:05 gitcoinbot