-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make verify-bls-signatures no_std compatible #137
Make verify-bls-signatures no_std compatible #137
Conversation
jimmychu0807
commented
Jun 7, 2023
- Fixed a warning and compile
- Adding verify-bls-signatures in utils
- Replace Rand lib with getrandom to make it no_std compatible
- Adding verify-bls-signatures in utils - Replace Rand lib with getrandom to make it no_std compatible
@ytqaljn In this PR, I added verify-bls-signatures in |
# rand = { version = "0.8.5", default-features = false, features = ["getrandom"] } | ||
|
||
# Check references: | ||
# - https://docs.rs/getrandom/latest/getrandom/index.html | ||
# - https://rust-random.github.io/book/crates.html | ||
# - https://github.com/rust-random/getrandom/pull/109 // This one explains why "custom" feature | ||
# is added, and we will need to call `register_custom_getrandom` in future. | ||
# - https://docs.rs/getrandom/latest/getrandom/index.html#custom-implementations | ||
getrandom = { version = "0.2.10", default-features = false, features = ["custom"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the key change, using getrandom
lib instead of rand lib. Compare it with dfinity original line:
https://github.com/dfinity/verify-bls-signatures/blob/master/Cargo.toml#L12
I added references on the above on using getrandom
and caveat of it. We may need to register our own randomize() function in future.
// let mut rng = rand::thread_rng(); | ||
loop { | ||
let mut buf = [0u8; 32]; | ||
// rng.fill_bytes(&mut buf); | ||
// note: Handle the `Result` below | ||
getrandom::getrandom(&mut buf); | ||
let s: Option<Scalar> = Scalar::from_bytes(&buf).into(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, instead of using rand
, we use getrandom
* fix: renewal space unfreeze * feat: add some root extrisic * feat: add some root function for test * style: 0.5.4 add new field * style: for distinguish chain * feat: some root function for test * feat: for test * test: migration test * fix: fix random bug * fix: index from 1 start * fix: random seed * fix: random seed * config: string limit 50000 -> 60000 * feat: batch delete files * style: clear warning * merge: frame-upgrade * fix: fix merge bug * refactor: add storage-handler pallet * fix: fix recursing * refactor: file-bank pallet adapt * refactor: adapt storage handle * refactor: rename file-map -> tee-worker * refactor: rename file-map -> tee-worker * fix: bug * refactor: segment-book -> audit * feat: upload_deal * feat: upload_deal * feat: upload_deal * feat: upload_deal * feat: upload deal * feat: tranfser_report * feat: time task deal_reassign_miner * feat: unlock space for miner * feat: calculate time task * feat: delete file * style: add Event * style: fix warning * refactor: idle space and service space change when segment add or delete * feat: some func for test * style: framework optimization * fix: update FragmentCount const * fix: fragment repeat causing BoundedVecError * refactor: tuple to struct for go-substrate-sdk * fix: update lock space, miner and user * feat: add two new package * feat: tee register * feat: add report verify * feat: generate challeng(40%) * tests: ed25519 verify sig * feat: generate challenge * feat: submit prove * feat: challenge clear * feat: miner reward * feat: clear and prove punish * feat: three punish * feat: lock miner * feat: miner exit * feat: filter for lock miner * feat: update increase_collateral for debt * feat: force miner exit * feat: use force exit miner * feat: clear expire file * feat: delete file * fix: transfer file delete file * feat: test rsa verify * style: fix warning * style: peer id types update * feat: unlock offchain * feat: add punish tee worker * fix: challenge select miner when miner number < 10 * fix: fix challengesnapshot bug * fix: miner exit bug * style: add withdraw event * style: update type * test: add some test function * test: add update_peer_id and exit * test: purchase in mib units * feat: random 0.046 chunks and random random number * feat: add new filed * fix: fix bug in reassigning validation tasks * style: delete methods that are no longer in use * feat: add methods for deleting fillers * style: some related modifications made for testing purposes * fix: miner exit prep error * feat: restoral file * fix: fix compile error * fix: fix random select miner * style: add restoral event * refactor: optimize space expiration functionality * test: some for test function * feat: add stake_score in validator election (#125) * feat: add stake_score in election * fix: merge conflics * fix: paritytech/substrate#13804 * test: test for bls * style: merge * test: test bls * feat: restoral order storage * feat: restoral order storage key * test: update data for test * fix: fix space expire bug * fix: fix upload file user hold slice list * fix: fix random select miner * test: for test add some function * Make verify-bls-signatures no_std compatible (#137) * - Fixed a warning and compile - Adding verify-bls-signatures in utils - Replace Rand lib with getrandom to make it no_std compatible * uncomment BLS and using dummy rand * Using getrandom custom * fix: cancel schedule mission * fix: file upload update UserBucketList * style: streamline code * fix: space expired user bucket list kill * Update README.md --------- Co-authored-by: ytqaljn <2716693942@qq.com> Co-authored-by: Shaka Lavigne <shakawwq@gmail.com> Co-authored-by: Jimmy Chu <jimmychu0807@gmail.com> Co-authored-by: Dean Clark <32699199+thirteenggh@users.noreply.github.com>
* fix: renewal space unfreeze * feat: add some root extrisic * feat: add some root function for test * style: 0.5.4 add new field * style: for distinguish chain * feat: some root function for test * feat: for test * test: migration test * fix: fix random bug * fix: index from 1 start * fix: random seed * fix: random seed * config: string limit 50000 -> 60000 * feat: batch delete files * style: clear warning * merge: frame-upgrade * fix: fix merge bug * refactor: add storage-handler pallet * fix: fix recursing * refactor: file-bank pallet adapt * refactor: adapt storage handle * refactor: rename file-map -> tee-worker * refactor: rename file-map -> tee-worker * fix: bug * refactor: segment-book -> audit * feat: upload_deal * feat: upload_deal * feat: upload_deal * feat: upload_deal * feat: upload deal * feat: tranfser_report * feat: time task deal_reassign_miner * feat: unlock space for miner * feat: calculate time task * feat: delete file * style: add Event * style: fix warning * refactor: idle space and service space change when segment add or delete * feat: some func for test * style: framework optimization * fix: update FragmentCount const * fix: fragment repeat causing BoundedVecError * refactor: tuple to struct for go-substrate-sdk * fix: update lock space, miner and user * feat: add two new package * feat: tee register * feat: add report verify * feat: generate challeng(40%) * tests: ed25519 verify sig * feat: generate challenge * feat: submit prove * feat: challenge clear * feat: miner reward * feat: clear and prove punish * feat: three punish * feat: lock miner * feat: miner exit * feat: filter for lock miner * feat: update increase_collateral for debt * feat: force miner exit * feat: use force exit miner * feat: clear expire file * feat: delete file * fix: transfer file delete file * feat: test rsa verify * style: fix warning * style: peer id types update * feat: unlock offchain * feat: add punish tee worker * fix: challenge select miner when miner number < 10 * fix: fix challengesnapshot bug * fix: miner exit bug * style: add withdraw event * style: update type * test: add some test function * test: add update_peer_id and exit * test: purchase in mib units * feat: random 0.046 chunks and random random number * feat: add new filed * fix: fix bug in reassigning validation tasks * style: delete methods that are no longer in use * feat: add methods for deleting fillers * style: some related modifications made for testing purposes * fix: miner exit prep error * feat: restoral file * fix: fix compile error * fix: fix random select miner * style: add restoral event * refactor: optimize space expiration functionality * test: some for test function * feat: add stake_score in validator election (#125) * feat: add stake_score in election * fix: merge conflics * fix: paritytech/substrate#13804 * test: test for bls * style: merge * test: test bls * feat: restoral order storage * feat: restoral order storage key * test: update data for test * fix: fix space expire bug * fix: fix upload file user hold slice list * fix: fix random select miner * test: for test add some function * Make verify-bls-signatures no_std compatible (#137) * - Fixed a warning and compile - Adding verify-bls-signatures in utils - Replace Rand lib with getrandom to make it no_std compatible * uncomment BLS and using dummy rand * Using getrandom custom * fix: cancel schedule mission * fix: file upload update UserBucketList * style: streamline code * fix: space expired user bucket list kill --------- Co-authored-by: ytqaljn <2716693942@qq.com> Co-authored-by: Shaka Lavigne <shakawwq@gmail.com> Co-authored-by: Jimmy Chu <jimmychu0807@gmail.com> Co-authored-by: Dean Clark <32699199+thirteenggh@users.noreply.github.com>