Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

Quick way to apply Chia BLS #764

Closed
wants to merge 25 commits into from

Conversation

ChihChengLiang
Copy link
Contributor

What was wrong?

Before properly addressing #746, this is a minimal way to get Chia BLS after #714 is merged.

How was it fixed?

  • Add BaseBLSBackend and ChiaBackend
  • Fix invalid private key issue

Cute Animal Picture

image

@ChihChengLiang ChihChengLiang changed the title Quick way to apply Chia BLS [WIP] Quick way to apply Chia BLS Jul 3, 2019
@ChihChengLiang
Copy link
Contributor Author

Some odd bugs summarized at #767

@ChihChengLiang ChihChengLiang changed the title [WIP] Quick way to apply Chia BLS Quick way to apply Chia BLS Jul 4, 2019
pubkey_chia = bls_chia.PublicKey.from_bytes(pubkey)
signature_chia = bls_chia.Signature.from_bytes(signature)
pubkey_chia = _pubkey_from_bytes(pubkey)
signature_chia = _signature_from_bytes(signature)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we want the verify to return False or raise ValidationError for the invalid inputs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I prefer ValidationError, since the caller cannot distinguish whether it is invalid inputs or just the incorrect signatures/wrong private keys if verify returns False.


def test_empty_aggregation():
assert aggregate_pubkeys([]) == EMPTY_PUBKEY
assert aggregate_signatures([]) == EMPTY_SIGNATURE
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note py_ecc has this behavior.

@ChihChengLiang ChihChengLiang requested a review from mhchia July 4, 2019 17:10
pubkey_chia = bls_chia.PublicKey.from_bytes(pubkey)
signature_chia = bls_chia.Signature.from_bytes(signature)
pubkey_chia = _pubkey_from_bytes(pubkey)
signature_chia = _signature_from_bytes(signature)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I prefer ValidationError, since the caller cannot distinguish whether it is invalid inputs or just the incorrect signatures/wrong private keys if verify returns False.

eth2/_utils/bls_bindings/chia_network/api.py Show resolved Hide resolved
eth2/_utils/bls_bindings/chia_network/api.py Outdated Show resolved Hide resolved
eth2/_utils/bls_bindings/chia_network/api.py Outdated Show resolved Hide resolved
eth2/_utils/bls_bindings/chia_network/api.py Outdated Show resolved Hide resolved
eth2/_utils/bls_bindings/chia_network/api.py Outdated Show resolved Hide resolved
Copy link
Contributor

@mhchia mhchia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me:)

@ChihChengLiang
Copy link
Contributor Author

Plan to rebase and merge this after #714. And will request another round of review after adding these features to this PR.

  • Some tests for empty aggregation
  • Raise Validation error for failing validation instead of simply returning False.

@ChihChengLiang
Copy link
Contributor Author

close in favor of #787

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants