Skip to content
This repository has been archived by the owner on Jan 6, 2025. It is now read-only.

WIP: Update to latest SSZ with SOS and add Boolean test generators #35

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
cd eth2.0-tests

git config user.name 'eth2TestGenBot'
git config user.email '<>'
git config user.email '[email protected]'

for filename in /tmp/workspace/tests/*; do
rm -rf $(basename $filename)
Expand Down
270 changes: 0 additions & 270 deletions bls/bls.py

This file was deleted.

7 changes: 0 additions & 7 deletions bls/eth2_typing.py

This file was deleted.

15 changes: 0 additions & 15 deletions bls/hash.py

This file was deleted.

2 changes: 1 addition & 1 deletion bls/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
py-ecc==1.4.7
py-ecc==1.6.0
PyYAML==4.2b1
22 changes: 12 additions & 10 deletions bls/tgen_bls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
from eth_utils import int_to_big_endian, big_endian_to_int

# Local imports
import bls
from hash import hash_eth2
from py_ecc import bls


def int_to_hex(n: int) -> str:
return '0x' + int_to_big_endian(n).hex()


def hex_to_int(x: str) -> int:
return int(x, 16)

Expand Down Expand Up @@ -66,7 +67,7 @@ def hash_message(msg: bytes,
int_to_hex(fq2.coeffs[0]),
int_to_hex(fq2.coeffs[1]),
]
for fq2 in bls.hash_to_G2(msg, domain)
for fq2 in bls.utils.hash_to_G2(msg, domain)
]


Expand All @@ -79,7 +80,7 @@ def hash_message_compressed(msg: bytes, domain: int) -> Tuple[str, str]:
Output:
- Message hash as a compressed G2 point
"""
z1, z2 = bls.compress_G2(bls.hash_to_G2(msg, domain))
z1, z2 = bls.utils.compress_G2(bls.utils.hash_to_G2(msg, domain))
return [int_to_hex(z1), int_to_hex(z2)]


Expand All @@ -90,8 +91,7 @@ def hash_message_compressed(msg: bytes, domain: int) -> Tuple[str, str]:
'title': 'BLS signature and aggregation tests',
'summary': 'Test vectors for BLS signature',
'test_suite': 'bls',
'fork': 'tchaikovsky',
'version': 1.0
'fork': 'phase0-0.5.0',
}

case01_message_hash_G2_uncompressed = []
Expand Down Expand Up @@ -154,10 +154,12 @@ def hash_message_compressed(msg: bytes, domain: int) -> Tuple[str, str]:
'output': '0x' + bls.aggregate_signatures(sigs).hex(),
})

case07_aggregate_pubkeys = {
'input': pubkeys_serial,
'output': '0x' + bls.aggregate_pubkeys(pubkeys).hex(),
}
case07_aggregate_pubkeys = [
{
'input': pubkeys_serial,
'output': '0x' + bls.aggregate_pubkeys(pubkeys).hex(),
}
]

# TODO
# Aggregate verify
Expand Down
5 changes: 0 additions & 5 deletions shuffling/core_helpers.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
"""
Compatible with v0.4:
https://github.com/ethereum/eth2.0-specs/releases/tag/v0.4
"""

from typing import Any, List, NewType

from constants import SLOTS_PER_EPOCH, SHARD_COUNT, TARGET_COMMITTEE_SIZE, SHUFFLE_ROUND_COUNT
Expand Down
3 changes: 1 addition & 2 deletions shuffling/tgen_shuffling.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ def active_exited_validators_generator():
'summary': 'Test vectors for validator shuffling with different validator\'s activity status.'
' Note: only relevant validator fields are defined.',
'test_suite': 'shuffle',
'fork': 'tchaikovsky',
'version': 1.0
'fork': 'phase0-0.5.0',
}

# Config
Expand Down
Loading