Merge pull request #1405 from ethereum/bls_tests_name_length

fix BLS tests name length
This commit is contained in:
Danny Ryan 2019-09-10 12:08:37 -06:00 committed by GitHub
commit d0c6b6719f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -11,6 +11,12 @@ from eth_utils import (
from gen_base import gen_runner, gen_typing from gen_base import gen_runner, gen_typing
from py_ecc import bls from py_ecc import bls
from hashlib import sha256
def hash(x):
return sha256(x).digest()
F2Q_COEFF_LEN = 48 F2Q_COEFF_LEN = 48
G2_COMPRESSED_Z_LEN = 48 G2_COMPRESSED_Z_LEN = 48
@ -122,7 +128,8 @@ def case04_sign_messages():
for message in MESSAGES: for message in MESSAGES:
for domain in DOMAINS: for domain in DOMAINS:
sig = bls.sign(message, privkey, domain) sig = bls.sign(message, privkey, domain)
yield f'sign_msg_{int_to_hex(privkey)}_{encode_hex(message)}_{encode_hex(domain)}', { full_name = f'{int_to_hex(privkey)}_{encode_hex(message)}_{encode_hex(domain)}'
yield f'sign_msg_case_{(hash(bytes(full_name, "utf-8"))[:8]).hex()}', {
'input': { 'input': {
'privkey': int_to_hex(privkey), 'privkey': int_to_hex(privkey),
'message': encode_hex(message), 'message': encode_hex(message),