make BLS test format and output consistent with spec

This commit is contained in:
protolambda 2019-06-30 16:07:54 +02:00
parent bf618f8d28
commit 91f55f55b5
No known key found for this signature in database
GPG Key ID: EC89FDBB2B4C7623
4 changed files with 7 additions and 10 deletions

View File

@ -7,7 +7,7 @@ A BLS compressed-hash to G2.
```yaml ```yaml
input: input:
message: bytes32, message: bytes32,
domain: bytes -- any number domain: uint64 -- the BLS domain
output: List[bytes48] -- length of two output: List[bytes48] -- length of two
``` ```

View File

@ -6,8 +6,8 @@ A BLS uncompressed-hash to G2.
```yaml ```yaml
input: input:
message: bytes32, message: bytes32
domain: bytes -- any number domain: uint64 -- the BLS domain
output: List[List[bytes48]] -- 3 lists, each a length of two output: List[List[bytes48]] -- 3 lists, each a length of two
``` ```

View File

@ -8,7 +8,7 @@ Message signing with BLS should produce a signature.
input: input:
privkey: bytes32 -- the private key used for signing privkey: bytes32 -- the private key used for signing
message: bytes32 -- input message to sign (a hash) message: bytes32 -- input message to sign (a hash)
domain: bytes -- BLS domain domain: uint64 -- the BLS domain
output: bytes96 -- expected signature output: bytes96 -- expected signature
``` ```

View File

@ -27,9 +27,6 @@ def hex_to_int(x: str) -> int:
return int(x, 16) return int(x, 16)
# Note: even though a domain is only an uint64,
# To avoid issues with YAML parsers that are limited to 53-bit (JS language limit)
# It is serialized as an hex string as well.
DOMAINS = [ DOMAINS = [
0, 0,
1, 1,
@ -92,7 +89,7 @@ def case01_message_hash_G2_uncompressed():
yield { yield {
'input': { 'input': {
'message': '0x' + msg.hex(), 'message': '0x' + msg.hex(),
'domain': int_to_hex(domain) 'domain': domain
}, },
'output': hash_message(msg, domain) 'output': hash_message(msg, domain)
} }
@ -104,7 +101,7 @@ def case02_message_hash_G2_compressed():
yield { yield {
'input': { 'input': {
'message': '0x' + msg.hex(), 'message': '0x' + msg.hex(),
'domain': int_to_hex(domain) 'domain': domain
}, },
'output': hash_message_compressed(msg, domain) 'output': hash_message_compressed(msg, domain)
} }
@ -129,7 +126,7 @@ def case04_sign_messages():
'input': { 'input': {
'privkey': int_to_hex(privkey), 'privkey': int_to_hex(privkey),
'message': '0x' + message.hex(), 'message': '0x' + message.hex(),
'domain': int_to_hex(domain) 'domain': domain
}, },
'output': '0x' + sig.hex() 'output': '0x' + sig.hex()
} }