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