Skip to content
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

Bump Milagro BLS to v1.3.0 #21

Merged
merged 5 commits into from Oct 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "milagro-bls-binding"
version = "1.4.0"
version = "1.5.0"
edition = "2018"
authors = ["chihchengliang@gmail.com"]

Expand All @@ -23,4 +23,4 @@ crate-type = ["cdylib"]

[dependencies]
pyo3 = { version = "0.10.1", features = ["extension-module"] }
milagro_bls = {git = "https://github.com/sigp/milagro_bls", tag= "v1.2.0" }
milagro_bls = {git = "https://github.com/sigp/milagro_bls", tag= "v1.3.0" }
19 changes: 8 additions & 11 deletions test.py
Expand Up @@ -59,14 +59,6 @@ def test_sign_verify(privkey_int):
assert bls.Verify(pub, msg, sig)


def test_sign_verify_zero():
privkey = to_bytes(0)
msg = "foooooo".encode('utf-8')
pub = bls.SkToPk(privkey)
sig = bls.Sign(privkey, msg)
assert not bls.Verify(pub, msg, sig)


@pytest.mark.parametrize(
'signature_points,result_point',
[
Expand Down Expand Up @@ -94,6 +86,11 @@ def test_fast_aggregate_verify(SKs, message):


def test_weird_cases():
bad_signature = b'\x00' * 96
assert not bls.AggregateVerify([], [], bad_signature)
assert bls.Aggregate([]) == b'\xc0' + b'\x00' * 95
Z1_PUBKEY = b'\xc0' + b'\x00' * 47
Z2_SIGNATURE = b'\xc0' + b'\x00' * 95
assert not bls.AggregateVerify([], [], Z2_SIGNATURE)
assert bls.Aggregate([]) == Z2_SIGNATURE
with pytest.raises(ValueError):
bls.Sign(to_bytes(0), b'abcd')
assert not bls.Verify(Z1_PUBKEY, b'abcd', Z2_SIGNATURE)
assert not bls.FastAggregateVerify([Z1_PUBKEY], b'abcd', Z2_SIGNATURE)