Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ pytest tests/eth2/core/beacon/test_attestation_helpers.py
- ================================================================================== test session starts ===================================================================================
- platform darwin -- Python 3.7.0, pytest-3.6.4, py-1.7.0, pluggy-0.7.1
- rootdir: /Users/liangcc/projects/EAPL/eth2.0s/trinity, inifile: pytest.ini
- plugins: xdist-1.18.1, trio-0.5.2, timeout-1.3.3, profiling-1.6.0, osxnotify-0.1.7, mock-1.10.4, forked-1.0.2, deadfixtures-2.1.0, cov-2.5.1, asyncio-0.9.0, asyncio-network-simulator-0.1.0a2, hypothesis-3.69.5
- collected 11 items
- tests/eth2/core/beacon/test_attestation_helpers.py FF....F.... [100%]
- ======================================================================================== FAILURES ========================================================================================
- _____________________________________________________________________ test_verify_indexed_attestation_signature[40] ______________________________________________________________________
- slots_per_epoch = 64, validator_count = 40, genesis_state = <BeaconState #0 7c210f54>
- config = Eth2Config(SHARD_COUNT=1024, TARGET_COMMITTEE_SIZE=128, MAX_INDICES_PER_ATTESTATION=4096, MIN_PER_EPOCH_CHURN_LIMIT=4,..., MAX_ATTESTATIONS=128, MAX_DEPOSITS=16, MAX_VOLUNTARY_EXITS=16, MAX_TRANSFERS=0, GENESIS_ACTIVE_VALIDATOR_COUNT=65536)
- privkeys = <conftest.privkey_view object at 0x120013470>
- sample_beacon_state_params = {'active_index_roots': (b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...43434343434343434343434343434 data_root=0x4343434343434343434343434343434343434343434343434343434343434343>, ...), ...}
- genesis_validators = (<eth2.beacon.types.validators.Validator object at 0x120013fd0>, <eth2.beacon.types.validators.Validator object at 0x1...types.validators.Validator object at 0x120013e48>, <eth2.beacon.types.validators.Validator object at 0x120013c18>, ...)
- genesis_balances = (32000000000, 32000000000, 32000000000, 32000000000, 32000000000, 32000000000, ...)
- sample_indexed_attestation_params = {'custody_bit_0_indices': (10, 11, 12, 15, 28), 'custody_bit_1_indices': (), 'data': <eth2.beacon.types.attestation_da...2e8>, 'signature': b'................................................................................................'}
- sample_fork_params = {'current_version': b'\x00\x00\x00\x00', 'epoch': 4294967296, 'previous_version': b'\x00\x00\x00\x00'}
- @pytest.mark.parametrize(
- (
- 'validator_count',
- ),
- [
- (40,),
- ]
- )
- def test_verify_indexed_attestation_signature(
- slots_per_epoch,
- validator_count,
- genesis_state,
- config,
- privkeys,
- sample_beacon_state_params,
- genesis_validators,
- genesis_balances,
- sample_indexed_attestation_params,
- sample_fork_params):
- state = genesis_state.copy(
- fork=Fork(**sample_fork_params),
- )
- # NOTE: we can do this before "correcting" the params as they
- # touch disjoint subsets of the provided params
- message_hashes = _create_indexed_attestation_messages(sample_indexed_attestation_params)
- valid_params = _correct_indexed_attestation_params(
- validator_count,
- message_hashes,
- sample_indexed_attestation_params,
- privkeys,
- state,
- config,
- )
- valid_votes = IndexedAttestation(**valid_params)
- > assert verify_indexed_attestation_aggregate_signature(state, valid_votes, slots_per_epoch)
- E assert False
- E + where False = verify_indexed_attestation_aggregate_signature(<BeaconState #0 da9a866d>, <IndexedAttestation beacon_block_root=11..1111 source_epoch=11 target_epoch=12 | CL=<Crosslink shard=0 start_epoch=0 end_epoch=1 parent_root=3434..3434 data_root=4343..4343>>, 64)
- config = Eth2Config(SHARD_COUNT=1024, TARGET_COMMITTEE_SIZE=128, MAX_INDICES_PER_ATTESTATION=4096, MIN_PER_EPOCH_CHURN_LIMIT=4,..., MAX_ATTESTATIONS=128, MAX_DEPOSITS=16, MAX_VOLUNTARY_EXITS=16, MAX_TRANSFERS=0, GENESIS_ACTIVE_VALIDATOR_COUNT=65536)
- genesis_balances = (32000000000, 32000000000, 32000000000, 32000000000, 32000000000, 32000000000, ...)
- genesis_state = <BeaconState #0 7c210f54>
- genesis_validators = (<eth2.beacon.types.validators.Validator object at 0x120013fd0>, <eth2.beacon.types.validators.Validator object at 0x1...types.validators.Validator object at 0x120013e48>, <eth2.beacon.types.validators.Validator object at 0x120013c18>, ...)
- message_hashes = (b'q\xec;\x9a\x08b\xd8I6\xae\xe6\xed\x06\xb2v\xe6\xb2\xdc\xe4d\t\x87\x8ab\x0fG\x08\xb5\x964H\xb5', b'Q\xdf\xa4\xa3\x18\xef\xd0\xb1\xceQ3kV\xfd\xd7\xe0>D\xf1\xfd\xf5W\xc1\xaf\x19\xd3\x88\xac\\\xc0\x19G')
- privkeys = <conftest.privkey_view object at 0x120013470>
- sample_beacon_state_params = {'active_index_roots': (b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...43434343434343434343434343434 data_root=0x4343434343434343434343434343434343434343434343434343434343434343>, ...), ...}
- sample_fork_params = {'current_version': b'\x00\x00\x00\x00', 'epoch': 4294967296, 'previous_version': b'\x00\x00\x00\x00'}
- sample_indexed_attestation_params = {'custody_bit_0_indices': (10, 11, 12, 15, 28), 'custody_bit_1_indices': (), 'data': <eth2.beacon.types.attestation_da...2e8>, 'signature': b'................................................................................................'}
- slots_per_epoch = 64
- state = <BeaconState #0 da9a866d>
- valid_params = {'custody_bit_0_indices': [5, 18, 22, 31, 32], 'custody_bit_1_indices': (), 'data': <eth2.beacon.types.attestation_dat...ae,\xfd\x83\xd7\r,\xa0\x90\x0e\x80\x80GG\x7f\xf0\x1e\x88\xdd\xb7\x82\xe1\x87{\x9a\x00r\x1d \xf5\x19\x0e\xc4`\xf7\xd0m'}
- valid_votes = <IndexedAttestation beacon_block_root=11..1111 source_epoch=11 target_epoch=12 | CL=<Crosslink shard=0 start_epoch=0 end_epoch=1 parent_root=3434..3434 data_root=4343..4343>>
- validator_count = 40
- tests/eth2/core/beacon/test_attestation_helpers.py:66: AssertionError
- ____________________________________________________________ test_validate_indexed_attestation[<lambda>-True-False-False-40] _____________________________________________________________
- slots_per_epoch = 64, validator_count = 40, genesis_state = <BeaconState #0 7c210f54>, param_mapper = <function <lambda> at 0x12004f1e0>, should_succeed = True, needs_fork = False
- is_testing_max_length = False, privkeys = <conftest.privkey_view object at 0x120013470>
- sample_beacon_state_params = {'active_index_roots': (b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...43434343434343434343434343434 data_root=0x4343434343434343434343434343434343434343434343434343434343434343>, ...), ...}
- genesis_validators = (<eth2.beacon.types.validators.Validator object at 0x120471748>, <eth2.beacon.types.validators.Validator object at 0x1...types.validators.Validator object at 0x120471828>, <eth2.beacon.types.validators.Validator object at 0x1204714a8>, ...)
- genesis_balances = (32000000000, 32000000000, 32000000000, 32000000000, 32000000000, 32000000000, ...)
- sample_indexed_attestation_params = {'custody_bit_0_indices': (10, 11, 12, 15, 28), 'custody_bit_1_indices': (), 'data': <eth2.beacon.types.attestation_da...e48>, 'signature': b'................................................................................................'}
- sample_fork_params = {'current_version': b'\x00\x00\x00\x00', 'epoch': 4294967296, 'previous_version': b'\x00\x00\x00\x00'}, max_indices_per_attestation = 4096
- config = Eth2Config(SHARD_COUNT=1024, TARGET_COMMITTEE_SIZE=128, MAX_INDICES_PER_ATTESTATION=4096, MIN_PER_EPOCH_CHURN_LIMIT=4,..., MAX_ATTESTATIONS=128, MAX_DEPOSITS=16, MAX_VOLUNTARY_EXITS=16, MAX_TRANSFERS=0, GENESIS_ACTIVE_VALIDATOR_COUNT=65536)
- @pytest.mark.parametrize(
- (
- 'validator_count',
- ),
- [
- (40,),
- ]
- )
- @pytest.mark.parametrize(
- (
- 'param_mapper',
- 'should_succeed',
- 'needs_fork',
- 'is_testing_max_length',
- ),
- [
- (lambda params: params, True, False, False),
- (_corrupt_custody_bit_1_indices_not_empty, False, False, False),
- (_corrupt_custody_bit_0_indices, False, False, False),
- (_corrupt_custody_bit_0_indices_max, False, False, True),
- (_corrupt_signature, False, True, False),
- ],
- )
- def test_validate_indexed_attestation(slots_per_epoch,
- validator_count,
- genesis_state,
- param_mapper,
- should_succeed,
- needs_fork,
- is_testing_max_length,
- privkeys,
- sample_beacon_state_params,
- genesis_validators,
- genesis_balances,
- sample_indexed_attestation_params,
- sample_fork_params,
- max_indices_per_attestation,
- config):
- state = genesis_state.copy(
- fork=Fork(**sample_fork_params),
- )
- # NOTE: we can do this before "correcting" the params as they
- # touch disjoint subsets of the provided params
- message_hashes = _create_indexed_attestation_messages(sample_indexed_attestation_params)
- params = _correct_indexed_attestation_params(
- validator_count,
- message_hashes,
- sample_indexed_attestation_params,
- privkeys,
- state,
- config,
- )
- if needs_fork:
- params = param_mapper(slots_per_epoch, params, state.fork)
- elif is_testing_max_length:
- params = param_mapper(max_indices_per_attestation, params)
- else:
- params = param_mapper(params)
- _run_verify_indexed_vote(
- slots_per_epoch,
- params,
- state,
- max_indices_per_attestation,
- > should_succeed,
- )
- config = Eth2Config(SHARD_COUNT=1024, TARGET_COMMITTEE_SIZE=128, MAX_INDICES_PER_ATTESTATION=4096, MIN_PER_EPOCH_CHURN_LIMIT=4,..., MAX_ATTESTATIONS=128, MAX_DEPOSITS=16, MAX_VOLUNTARY_EXITS=16, MAX_TRANSFERS=0, GENESIS_ACTIVE_VALIDATOR_COUNT=65536)
- genesis_balances = (32000000000, 32000000000, 32000000000, 32000000000, 32000000000, 32000000000, ...)
- genesis_state = <BeaconState #0 7c210f54>
- genesis_validators = (<eth2.beacon.types.validators.Validator object at 0x120471748>, <eth2.beacon.types.validators.Validator object at 0x1...types.validators.Validator object at 0x120471828>, <eth2.beacon.types.validators.Validator object at 0x1204714a8>, ...)
- is_testing_max_length = False
- max_indices_per_attestation = 4096
- message_hashes = (b'q\xec;\x9a\x08b\xd8I6\xae\xe6\xed\x06\xb2v\xe6\xb2\xdc\xe4d\t\x87\x8ab\x0fG\x08\xb5\x964H\xb5', b'Q\xdf\xa4\xa3\x18\xef\xd0\xb1\xceQ3kV\xfd\xd7\xe0>D\xf1\xfd\xf5W\xc1\xaf\x19\xd3\x88\xac\\\xc0\x19G')
- needs_fork = False
- param_mapper = <function <lambda> at 0x12004f1e0>
- params = {'custody_bit_0_indices': [10, 15, 22, 35, 38], 'custody_bit_1_indices': (), 'data': <eth2.beacon.types.attestation_da...f1HX\x8cW\x9a\xbe_\xec<\xf9\x1a\xebg\x1a\xe3d\x00\xe1\xae\x10W9\x9b\xcf[7\xb1\xe3"\xa8^)$\xe20Rs\xf2]D&\xce\xd5h\xe4g'}
- privkeys = <conftest.privkey_view object at 0x120013470>
- sample_beacon_state_params = {'active_index_roots': (b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...43434343434343434343434343434 data_root=0x4343434343434343434343434343434343434343434343434343434343434343>, ...), ...}
- sample_fork_params = {'current_version': b'\x00\x00\x00\x00', 'epoch': 4294967296, 'previous_version': b'\x00\x00\x00\x00'}
- sample_indexed_attestation_params = {'custody_bit_0_indices': (10, 11, 12, 15, 28), 'custody_bit_1_indices': (), 'data': <eth2.beacon.types.attestation_da...e48>, 'signature': b'................................................................................................'}
- should_succeed = True
- slots_per_epoch = 64
- state = <BeaconState #0 da9a866d>
- validator_count = 40
- tests/eth2/core/beacon/test_attestation_helpers.py:247:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- tests/eth2/core/beacon/test_attestation_helpers.py:103: in _run_verify_indexed_vote
- slots_per_epoch,
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- state = <BeaconState #0 da9a866d>
- indexed_attestation = <IndexedAttestation beacon_block_root=11..1111 source_epoch=11 target_epoch=12 | CL=<Crosslink shard=0 start_epoch=0 end_epoch=1 parent_root=3434..3434 data_root=4343..4343>>
- max_indices_per_attestation = 4096, slots_per_epoch = 64
- def validate_indexed_attestation(state: BeaconState,
- indexed_attestation: IndexedAttestation,
- max_indices_per_attestation: int,
- slots_per_epoch: int) -> None:
- bit_0_indices = indexed_attestation.custody_bit_0_indices
- bit_1_indices = indexed_attestation.custody_bit_1_indices
- if len(bit_1_indices) != 0:
- raise ValidationError(
- f"Expected no custody bit 1 validators (cf. {bit_1_indices})."
- )
- if len(bit_0_indices) + len(bit_1_indices) > max_indices_per_attestation:
- raise ValidationError(
- f"Require no more than {max_indices_per_attestation} validators per attestation,"
- f" but have {len(bit_0_indices)} 0-bit validators"
- f" and {len(bit_1_indices)} 1-bit validators."
- )
- intersection = set(bit_0_indices).intersection(bit_1_indices)
- if len(intersection) != 0:
- raise ValidationError(
- f"Index sets by custody bits must be disjoint but have the following"
- f" indices in common: {intersection}."
- )
- if bit_0_indices != tuple(sorted(bit_0_indices)):
- raise ValidationError(
- f"Indices should be sorted; the 0-bit indices are not: {bit_0_indices}."
- )
- if bit_1_indices != tuple(sorted(bit_1_indices)):
- raise ValidationError(
- f"Indices should be sorted; the 1-bit indices are not: {bit_1_indices}."
- )
- if not verify_indexed_attestation_aggregate_signature(state,
- indexed_attestation,
- slots_per_epoch):
- raise ValidationError(
- > "The aggregate signature on the indexed attestation"
- f" {indexed_attestation} was incorrect."
- )
- E eth_utils.exceptions.ValidationError: The aggregate signature on the indexed attestation <IndexedAttestation beacon_block_root=11..1111 source_epoch=11 target_epoch=12 | CL=<Crosslink shard=0 start_epoch=0 end_epoch=1 parent_root=3434..3434 data_root=4343..4343>> was incorrect.
- bit_0_indices = (10, 15, 22, 35, 38)
- bit_1_indices = ()
- indexed_attestation = <IndexedAttestation beacon_block_root=11..1111 source_epoch=11 target_epoch=12 | CL=<Crosslink shard=0 start_epoch=0 end_epoch=1 parent_root=3434..3434 data_root=4343..4343>>
- intersection = set()
- max_indices_per_attestation = 4096
- slots_per_epoch = 64
- state = <BeaconState #0 da9a866d>
- eth2/beacon/attestation_helpers.py:140: ValidationError
- _____________________________________________________________________ test_verify_indexed_attestation_after_fork[40] _____________________________________________________________________
- genesis_state = <BeaconState #0 7c210f54>, slots_per_epoch = 64, validator_count = 40, privkeys = <conftest.privkey_view object at 0x120013470>
- sample_beacon_state_params = {'active_index_roots': (b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...43434343434343434343434343434 data_root=0x4343434343434343434343434343434343434343434343434343434343434343>, ...), ...}
- genesis_validators = (<eth2.beacon.types.validators.Validator object at 0x12046fd68>, <eth2.beacon.types.validators.Validator object at 0x1...types.validators.Validator object at 0x12046fb70>, <eth2.beacon.types.validators.Validator object at 0x12046f2b0>, ...)
- genesis_balances = (32000000000, 32000000000, 32000000000, 32000000000, 32000000000, 32000000000, ...)
- sample_indexed_attestation_params = {'custody_bit_0_indices': (10, 11, 12, 15, 28), 'custody_bit_1_indices': (), 'data': <eth2.beacon.types.attestation_da...898>, 'signature': b'................................................................................................'}
- sample_fork_params = {'current_version': b'\x00\x00\x00\x00', 'epoch': 4294967296, 'previous_version': b'\x00\x00\x00\x00'}
- config = Eth2Config(SHARD_COUNT=1024, TARGET_COMMITTEE_SIZE=128, MAX_INDICES_PER_ATTESTATION=4096, MIN_PER_EPOCH_CHURN_LIMIT=4,..., MAX_ATTESTATIONS=128, MAX_DEPOSITS=16, MAX_VOLUNTARY_EXITS=16, MAX_TRANSFERS=0, GENESIS_ACTIVE_VALIDATOR_COUNT=65536)
- max_indices_per_attestation = 4096
- @pytest.mark.parametrize(
- (
- 'validator_count',
- ),
- [
- (40,),
- ]
- )
- def test_verify_indexed_attestation_after_fork(genesis_state,
- slots_per_epoch,
- validator_count,
- privkeys,
- sample_beacon_state_params,
- genesis_validators,
- genesis_balances,
- sample_indexed_attestation_params,
- sample_fork_params,
- config,
- max_indices_per_attestation):
- # Test that indexed data is still valid after fork
- # Indexed data slot = 10, fork slot = 15, current slot = 20
- past_fork_params = {
- 'previous_version': (0).to_bytes(4, 'little'),
- 'current_version': (1).to_bytes(4, 'little'),
- 'epoch': 15,
- }
- state = genesis_state.copy(
- slot=20,
- fork=Fork(**past_fork_params),
- )
- message_hashes = _create_indexed_attestation_messages(sample_indexed_attestation_params)
- valid_params = _correct_indexed_attestation_params(
- validator_count,
- message_hashes,
- sample_indexed_attestation_params,
- privkeys,
- state,
- config,
- )
- _run_verify_indexed_vote(
- slots_per_epoch,
- valid_params,
- state,
- max_indices_per_attestation,
- > True,
- )
- config = Eth2Config(SHARD_COUNT=1024, TARGET_COMMITTEE_SIZE=128, MAX_INDICES_PER_ATTESTATION=4096, MIN_PER_EPOCH_CHURN_LIMIT=4,..., MAX_ATTESTATIONS=128, MAX_DEPOSITS=16, MAX_VOLUNTARY_EXITS=16, MAX_TRANSFERS=0, GENESIS_ACTIVE_VALIDATOR_COUNT=65536)
- genesis_balances = (32000000000, 32000000000, 32000000000, 32000000000, 32000000000, 32000000000, ...)
- genesis_state = <BeaconState #0 7c210f54>
- genesis_validators = (<eth2.beacon.types.validators.Validator object at 0x12046fd68>, <eth2.beacon.types.validators.Validator object at 0x1...types.validators.Validator object at 0x12046fb70>, <eth2.beacon.types.validators.Validator object at 0x12046f2b0>, ...)
- max_indices_per_attestation = 4096
- message_hashes = (b'q\xec;\x9a\x08b\xd8I6\xae\xe6\xed\x06\xb2v\xe6\xb2\xdc\xe4d\t\x87\x8ab\x0fG\x08\xb5\x964H\xb5', b'Q\xdf\xa4\xa3\x18\xef\xd0\xb1\xceQ3kV\xfd\xd7\xe0>D\xf1\xfd\xf5W\xc1\xaf\x19\xd3\x88\xac\\\xc0\x19G')
- past_fork_params = {'current_version': b'\x01\x00\x00\x00', 'epoch': 15, 'previous_version': b'\x00\x00\x00\x00'}
- privkeys = <conftest.privkey_view object at 0x120013470>
- sample_beacon_state_params = {'active_index_roots': (b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...43434343434343434343434343434 data_root=0x4343434343434343434343434343434343434343434343434343434343434343>, ...), ...}
- sample_fork_params = {'current_version': b'\x00\x00\x00\x00', 'epoch': 4294967296, 'previous_version': b'\x00\x00\x00\x00'}
- sample_indexed_attestation_params = {'custody_bit_0_indices': (10, 11, 12, 15, 28), 'custody_bit_1_indices': (), 'data': <eth2.beacon.types.attestation_da...898>, 'signature': b'................................................................................................'}
- slots_per_epoch = 64
- state = <BeaconState #20 c7e2c56c>
- valid_params = {'custody_bit_0_indices': [0, 4, 9, 20, 30], 'custody_bit_1_indices': (), 'data': <eth2.beacon.types.attestation_data....b3\xdc\x93\xdd\x0e\xad\xe7G\xa5\xaa\xf6\xb7\xa5\xaeM{\x1e\xef\xe7\x95\xec\x96\\\xe3\x06\x00\xcd/\xcbO\xc5\x93\x1a\xe0'}
- validator_count = 40
- tests/eth2/core/beacon/test_attestation_helpers.py:298:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- tests/eth2/core/beacon/test_attestation_helpers.py:103: in _run_verify_indexed_vote
- slots_per_epoch,
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- state = <BeaconState #20 c7e2c56c>
- indexed_attestation = <IndexedAttestation beacon_block_root=11..1111 source_epoch=11 target_epoch=12 | CL=<Crosslink shard=0 start_epoch=0 end_epoch=1 parent_root=3434..3434 data_root=4343..4343>>
- max_indices_per_attestation = 4096, slots_per_epoch = 64
- def validate_indexed_attestation(state: BeaconState,
- indexed_attestation: IndexedAttestation,
- max_indices_per_attestation: int,
- slots_per_epoch: int) -> None:
- bit_0_indices = indexed_attestation.custody_bit_0_indices
- bit_1_indices = indexed_attestation.custody_bit_1_indices
- if len(bit_1_indices) != 0:
- raise ValidationError(
- f"Expected no custody bit 1 validators (cf. {bit_1_indices})."
- )
- if len(bit_0_indices) + len(bit_1_indices) > max_indices_per_attestation:
- raise ValidationError(
- f"Require no more than {max_indices_per_attestation} validators per attestation,"
- f" but have {len(bit_0_indices)} 0-bit validators"
- f" and {len(bit_1_indices)} 1-bit validators."
- )
- intersection = set(bit_0_indices).intersection(bit_1_indices)
- if len(intersection) != 0:
- raise ValidationError(
- f"Index sets by custody bits must be disjoint but have the following"
- f" indices in common: {intersection}."
- )
- if bit_0_indices != tuple(sorted(bit_0_indices)):
- raise ValidationError(
- f"Indices should be sorted; the 0-bit indices are not: {bit_0_indices}."
- )
- if bit_1_indices != tuple(sorted(bit_1_indices)):
- raise ValidationError(
- f"Indices should be sorted; the 1-bit indices are not: {bit_1_indices}."
- )
- if not verify_indexed_attestation_aggregate_signature(state,
- indexed_attestation,
- slots_per_epoch):
- raise ValidationError(
- > "The aggregate signature on the indexed attestation"
- f" {indexed_attestation} was incorrect."
- )
- E eth_utils.exceptions.ValidationError: The aggregate signature on the indexed attestation <IndexedAttestation beacon_block_root=11..1111 source_epoch=11 target_epoch=12 | CL=<Crosslink shard=0 start_epoch=0 end_epoch=1 parent_root=3434..3434 data_root=4343..4343>> was incorrect.
- bit_0_indices = (0, 4, 9, 20, 30)
- bit_1_indices = ()
- indexed_attestation = <IndexedAttestation beacon_block_root=11..1111 source_epoch=11 target_epoch=12 | CL=<Crosslink shard=0 start_epoch=0 end_epoch=1 parent_root=3434..3434 data_root=4343..4343>>
- intersection = set()
- max_indices_per_attestation = 4096
- slots_per_epoch = 64
- state = <BeaconState #20 c7e2c56c>
- eth2/beacon/attestation_helpers.py:140: ValidationError
- =============================================================================== slowest 50 test durations ================================================================================
- 4.60s call tests/eth2/core/beacon/test_attestation_helpers.py::test_verify_indexed_attestation_signature[40]
- 2.00s call tests/eth2/core/beacon/test_attestation_helpers.py::test_validate_indexed_attestation[_corrupt_signature-False-True-False-40]
- 1.95s call tests/eth2/core/beacon/test_attestation_helpers.py::test_verify_indexed_attestation_after_fork[40]
- 1.95s call tests/eth2/core/beacon/test_attestation_helpers.py::test_validate_indexed_attestation[<lambda>-True-False-False-40]
- 0.92s call tests/eth2/core/beacon/test_attestation_helpers.py::test_validate_indexed_attestation[_corrupt_custody_bit_0_indices_max-False-False-True-40]
- 0.82s call tests/eth2/core/beacon/test_attestation_helpers.py::test_validate_indexed_attestation[_corrupt_custody_bit_0_indices-False-False-False-40]
- 0.82s call tests/eth2/core/beacon/test_attestation_helpers.py::test_validate_indexed_attestation[_corrupt_custody_bit_1_indices_not_empty-False-False-False-40]
- 0.24s setup tests/eth2/core/beacon/test_attestation_helpers.py::test_validate_indexed_attestation[_corrupt_custody_bit_1_indices_not_empty-False-False-False-40]
- 0.23s setup tests/eth2/core/beacon/test_attestation_helpers.py::test_verify_indexed_attestation_signature[40]
- 0.22s setup tests/eth2/core/beacon/test_attestation_helpers.py::test_validate_indexed_attestation[_corrupt_signature-False-True-False-40]
- 0.21s setup tests/eth2/core/beacon/test_attestation_helpers.py::test_validate_indexed_attestation[<lambda>-True-False-False-40]
- 0.21s setup tests/eth2/core/beacon/test_attestation_helpers.py::test_validate_indexed_attestation[_corrupt_custody_bit_0_indices-False-False-False-40]
- 0.21s setup tests/eth2/core/beacon/test_attestation_helpers.py::test_validate_indexed_attestation[_corrupt_custody_bit_0_indices_max-False-False-True-40]
- 0.21s setup tests/eth2/core/beacon/test_attestation_helpers.py::test_verify_indexed_attestation_after_fork[40]
- 0.01s teardown tests/eth2/core/beacon/test_attestation_helpers.py::test_is_slashable_attestation_data[True-True]
- 0.01s teardown tests/eth2/core/beacon/test_attestation_helpers.py::test_validate_indexed_attestation[_corrupt_custody_bit_0_indices-False-False-False-40]
- 0.01s teardown tests/eth2/core/beacon/test_attestation_helpers.py::test_validate_indexed_attestation[<lambda>-True-False-False-40]
- 0.01s teardown tests/eth2/core/beacon/test_attestation_helpers.py::test_validate_indexed_attestation[_corrupt_custody_bit_1_indices_not_empty-False-False-False-40]
- 0.01s teardown tests/eth2/core/beacon/test_attestation_helpers.py::test_validate_indexed_attestation[_corrupt_signature-False-True-False-40]
- 0.01s teardown tests/eth2/core/beacon/test_attestation_helpers.py::test_verify_indexed_attestation_signature[40]
- 0.01s teardown tests/eth2/core/beacon/test_attestation_helpers.py::test_validate_indexed_attestation[_corrupt_custody_bit_0_indices_max-False-False-True-40]
- 0.01s teardown tests/eth2/core/beacon/test_attestation_helpers.py::test_verify_indexed_attestation_after_fork[40]
- 0.00s teardown tests/eth2/core/beacon/test_attestation_helpers.py::test_is_slashable_attestation_data[True-False]
- 0.00s teardown tests/eth2/core/beacon/test_attestation_helpers.py::test_is_slashable_attestation_data[False-False]
- 0.00s teardown tests/eth2/core/beacon/test_attestation_helpers.py::test_is_slashable_attestation_data[False-True]
- 0.00s setup tests/eth2/core/beacon/test_attestation_helpers.py::test_is_slashable_attestation_data[False-False]
- 0.00s setup tests/eth2/core/beacon/test_attestation_helpers.py::test_is_slashable_attestation_data[False-True]
- 0.00s setup tests/eth2/core/beacon/test_attestation_helpers.py::test_is_slashable_attestation_data[True-True]
- 0.00s setup tests/eth2/core/beacon/test_attestation_helpers.py::test_is_slashable_attestation_data[True-False]
- 0.00s call tests/eth2/core/beacon/test_attestation_helpers.py::test_is_slashable_attestation_data[True-True]
- 0.00s call tests/eth2/core/beacon/test_attestation_helpers.py::test_is_slashable_attestation_data[True-False]
- 0.00s call tests/eth2/core/beacon/test_attestation_helpers.py::test_is_slashable_attestation_data[False-True]
- 0.00s call tests/eth2/core/beacon/test_attestation_helpers.py::test_is_slashable_attestation_data[False-False]
- ========================================================================== 3 failed, 8 passed in 28.43 seconds ===========================================================================
- (py-evm) liangcc@Chih-Chengs-MacBook-Pro trinity (pr/ralexstokes/714)$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement