mirror of
https://github.com/fluencelabs/examples
synced 2024-12-04 19:20:17 +00:00
cleanup
This commit is contained in:
parent
569f21034e
commit
0f9b9576aa
@ -3,7 +3,7 @@ name = "drand"
|
||||
version = "0.1.0"
|
||||
authors = ["boneyard93501 <4523011+boneyard93501@users.noreply.github.com>"]
|
||||
edition = "2018"
|
||||
description = "drand, a Marine wasi module"
|
||||
description = "Drand, a Marine wasi module"
|
||||
license = "Apache-2.0"
|
||||
|
||||
[[bin]]
|
||||
@ -12,8 +12,6 @@ path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
marine-rs-sdk = { version = "0.7.1", features = ["logger"] }
|
||||
# log = "0.4.14"
|
||||
# drand-verify = { version = "0.3.0", js = false, optional = false }
|
||||
drand-verify = { version = "0.3.0", js = false, optional = false }
|
||||
hex = "0.4.3"
|
||||
serde = "1.0.148"
|
||||
|
@ -207,12 +207,11 @@ pub fn round(url: String, chain_hash: String, round: u64) -> RResult {
|
||||
}
|
||||
|
||||
#[marine]
|
||||
// from: https://github.com/noislabs/drand-verify/blob/main/examples/drand_verify.rs
|
||||
pub fn verify_bls(pk: String, round: u64, prev_signature: String, signature: String) -> VResult {
|
||||
let hex_pk: [u8; 48] = hex::decode(&pk).unwrap().as_slice().try_into().unwrap();
|
||||
let pk = g1_from_fixed(hex_pk).unwrap();
|
||||
|
||||
println!("about to match verify");
|
||||
|
||||
let hex_sig = hex::decode(signature).unwrap();
|
||||
let hex_psig = hex::decode(prev_signature).unwrap();
|
||||
|
||||
@ -223,11 +222,8 @@ pub fn verify_bls(pk: String, round: u64, prev_signature: String, signature: Str
|
||||
randomness: "".to_string(),
|
||||
},
|
||||
Ok(valid) => {
|
||||
println!("ok verify");
|
||||
if valid {
|
||||
// println!("Verification succeeded");
|
||||
let randomness = derive_randomness(&hex_sig);
|
||||
// println!("Randomness: {}", hex::encode(&randomness));
|
||||
VResult {
|
||||
verified: valid,
|
||||
randomness: hex::encode(&randomness),
|
||||
|
Loading…
Reference in New Issue
Block a user