Skip to content

Commit

Permalink
Move to arkworks BLS implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
aumetra committed Apr 16, 2024
1 parent 903bea1 commit fc84471
Show file tree
Hide file tree
Showing 23 changed files with 2,909 additions and 1,546 deletions.
252 changes: 170 additions & 82 deletions Cargo.lock

Large diffs are not rendered by default.

331 changes: 217 additions & 114 deletions contracts/burner/Cargo.lock

Large diffs are not rendered by default.

339 changes: 222 additions & 117 deletions contracts/crypto-verify/Cargo.lock

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion contracts/crypto-verify/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ cranelift = ["cosmwasm-vm/cranelift"]

[dependencies]
base64 = "0.22.0"
bls12_381 = { version = "0.8.0", default-features = false }
ark-bls12-381 = { version = "0.4.0", default-features = false }
cosmwasm-schema = { path = "../../packages/schema" }
cosmwasm-std = { path = "../../packages/std", features = ["cosmwasm_2_1", "iterator"] }
hex = "0.4"
Expand All @@ -42,5 +42,7 @@ sha2 = "0.10"
sha3 = "0.10"

[dev-dependencies]
ark-ec = "0.4.2"
ark-serialize = { version = "0.4.2", default-features = false }
cosmwasm-vm = { path = "../../packages/vm", default-features = false, features = ["iterator"] }
hex-literal = "0.4.1"
18 changes: 15 additions & 3 deletions contracts/crypto-verify/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
//! 5. Anywhere you see query(deps.as_ref(), ...) you must replace it with query(&mut deps, ...)
//! (Use cosmwasm_vm::testing::{init, execute, query}, instead of the contract variants).
use bls12_381::G1Affine;
use ark_bls12_381::G1Affine;
use ark_ec::AffineRepr;
use ark_serialize::CanonicalSerialize;
use cosmwasm_std::{Binary, Response, Uint128};
use cosmwasm_vm::testing::{
instantiate, mock_env, mock_info, mock_instance, query, MockApi, MockQuerier, MockStorage,
Expand Down Expand Up @@ -116,8 +118,13 @@ fn bls12_381_verifies() {

let msg = build_bls_message(round, &previous_signature);

let mut serialized = [0; 48];
G1Affine::generator()
.serialize_compressed(&mut serialized[..])
.unwrap();

let verify_msg = QueryMsg::VerifyBls12PairingEquality {
p: G1Affine::generator().to_compressed().into(),
p: serialized.into(),
q: signature.into(),
r: PK_LEO_MAINNET.into(),
msg: msg.into(),
Expand All @@ -142,8 +149,13 @@ fn bls12_381_errors() {

let msg = build_bls_message(round, &previous_signature);

let mut serialized = [0; 48];
G1Affine::generator()
.serialize_compressed(&mut serialized[..])
.unwrap();

let verify_msg = QueryMsg::VerifyBls12PairingEquality {
p: G1Affine::generator().to_compressed().into(),
p: serialized.into(),
q: signature.into(),
r: PK_LEO_MAINNET.into(),
msg: msg.into(),
Expand Down
Loading

0 comments on commit fc84471

Please sign in to comment.