Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.75 KB | None | 0 0
  1. $ pytest tests/eth2/core/beacon/test_attestation_helpers.py
  2. ================================================================================== test session starts ===================================================================================
  3. platform darwin -- Python 3.7.0, pytest-3.6.4, py-1.7.0, pluggy-0.7.1
  4. rootdir: /Users/liangcc/projects/EAPL/eth2.0s/trinity, inifile: pytest.ini
  5. 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
  6. collected 11 items
  7.  
  8. tests/eth2/core/beacon/test_attestation_helpers.py FF....F.... [100%]
  9.  
  10. ======================================================================================== FAILURES ========================================================================================
  11. _____________________________________________________________________ test_verify_indexed_attestation_signature[40] ______________________________________________________________________
  12.  
  13. slots_per_epoch = 64, validator_count = 40, genesis_state = <BeaconState #0 7c210f54>
  14. 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)
  15. privkeys = <conftest.privkey_view object at 0x120013470>
  16. 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>, ...), ...}
  17. 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>, ...)
  18. genesis_balances = (32000000000, 32000000000, 32000000000, 32000000000, 32000000000, 32000000000, ...)
  19. 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'................................................................................................'}
  20. sample_fork_params = {'current_version': b'\x00\x00\x00\x00', 'epoch': 4294967296, 'previous_version': b'\x00\x00\x00\x00'}
  21.  
  22. @pytest.mark.parametrize(
  23. (
  24. 'validator_count',
  25. ),
  26. [
  27. (40,),
  28. ]
  29. )
  30. def test_verify_indexed_attestation_signature(
  31. slots_per_epoch,
  32. validator_count,
  33. genesis_state,
  34. config,
  35. privkeys,
  36. sample_beacon_state_params,
  37. genesis_validators,
  38. genesis_balances,
  39. sample_indexed_attestation_params,
  40. sample_fork_params):
  41. state = genesis_state.copy(
  42. fork=Fork(**sample_fork_params),
  43. )
  44.  
  45. # NOTE: we can do this before "correcting" the params as they
  46. # touch disjoint subsets of the provided params
  47. message_hashes = _create_indexed_attestation_messages(sample_indexed_attestation_params)
  48.  
  49. valid_params = _correct_indexed_attestation_params(
  50. validator_count,
  51. message_hashes,
  52. sample_indexed_attestation_params,
  53. privkeys,
  54. state,
  55. config,
  56. )
  57. valid_votes = IndexedAttestation(**valid_params)
  58. > assert verify_indexed_attestation_aggregate_signature(state, valid_votes, slots_per_epoch)
  59. E assert False
  60. 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)
  61.  
  62. 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)
  63. genesis_balances = (32000000000, 32000000000, 32000000000, 32000000000, 32000000000, 32000000000, ...)
  64. genesis_state = <BeaconState #0 7c210f54>
  65. 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>, ...)
  66. 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')
  67. privkeys = <conftest.privkey_view object at 0x120013470>
  68. 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>, ...), ...}
  69. sample_fork_params = {'current_version': b'\x00\x00\x00\x00', 'epoch': 4294967296, 'previous_version': b'\x00\x00\x00\x00'}
  70. 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'................................................................................................'}
  71. slots_per_epoch = 64
  72. state = <BeaconState #0 da9a866d>
  73. 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'}
  74. 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>>
  75. validator_count = 40
  76.  
  77. tests/eth2/core/beacon/test_attestation_helpers.py:66: AssertionError
  78. ____________________________________________________________ test_validate_indexed_attestation[<lambda>-True-False-False-40] _____________________________________________________________
  79.  
  80. slots_per_epoch = 64, validator_count = 40, genesis_state = <BeaconState #0 7c210f54>, param_mapper = <function <lambda> at 0x12004f1e0>, should_succeed = True, needs_fork = False
  81. is_testing_max_length = False, privkeys = <conftest.privkey_view object at 0x120013470>
  82. 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>, ...), ...}
  83. 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>, ...)
  84. genesis_balances = (32000000000, 32000000000, 32000000000, 32000000000, 32000000000, 32000000000, ...)
  85. 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'................................................................................................'}
  86. sample_fork_params = {'current_version': b'\x00\x00\x00\x00', 'epoch': 4294967296, 'previous_version': b'\x00\x00\x00\x00'}, max_indices_per_attestation = 4096
  87. 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)
  88.  
  89. @pytest.mark.parametrize(
  90. (
  91. 'validator_count',
  92. ),
  93. [
  94. (40,),
  95. ]
  96. )
  97. @pytest.mark.parametrize(
  98. (
  99. 'param_mapper',
  100. 'should_succeed',
  101. 'needs_fork',
  102. 'is_testing_max_length',
  103. ),
  104. [
  105. (lambda params: params, True, False, False),
  106. (_corrupt_custody_bit_1_indices_not_empty, False, False, False),
  107. (_corrupt_custody_bit_0_indices, False, False, False),
  108. (_corrupt_custody_bit_0_indices_max, False, False, True),
  109. (_corrupt_signature, False, True, False),
  110. ],
  111. )
  112. def test_validate_indexed_attestation(slots_per_epoch,
  113. validator_count,
  114. genesis_state,
  115. param_mapper,
  116. should_succeed,
  117. needs_fork,
  118. is_testing_max_length,
  119. privkeys,
  120. sample_beacon_state_params,
  121. genesis_validators,
  122. genesis_balances,
  123. sample_indexed_attestation_params,
  124. sample_fork_params,
  125. max_indices_per_attestation,
  126. config):
  127. state = genesis_state.copy(
  128. fork=Fork(**sample_fork_params),
  129. )
  130.  
  131. # NOTE: we can do this before "correcting" the params as they
  132. # touch disjoint subsets of the provided params
  133. message_hashes = _create_indexed_attestation_messages(sample_indexed_attestation_params)
  134.  
  135. params = _correct_indexed_attestation_params(
  136. validator_count,
  137. message_hashes,
  138. sample_indexed_attestation_params,
  139. privkeys,
  140. state,
  141. config,
  142. )
  143. if needs_fork:
  144. params = param_mapper(slots_per_epoch, params, state.fork)
  145. elif is_testing_max_length:
  146. params = param_mapper(max_indices_per_attestation, params)
  147.  
  148. else:
  149. params = param_mapper(params)
  150. _run_verify_indexed_vote(
  151. slots_per_epoch,
  152. params,
  153. state,
  154. max_indices_per_attestation,
  155. > should_succeed,
  156. )
  157.  
  158. 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)
  159. genesis_balances = (32000000000, 32000000000, 32000000000, 32000000000, 32000000000, 32000000000, ...)
  160. genesis_state = <BeaconState #0 7c210f54>
  161. 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>, ...)
  162. is_testing_max_length = False
  163. max_indices_per_attestation = 4096
  164. 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')
  165. needs_fork = False
  166. param_mapper = <function <lambda> at 0x12004f1e0>
  167. 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'}
  168. privkeys = <conftest.privkey_view object at 0x120013470>
  169. 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>, ...), ...}
  170. sample_fork_params = {'current_version': b'\x00\x00\x00\x00', 'epoch': 4294967296, 'previous_version': b'\x00\x00\x00\x00'}
  171. 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'................................................................................................'}
  172. should_succeed = True
  173. slots_per_epoch = 64
  174. state = <BeaconState #0 da9a866d>
  175. validator_count = 40
  176.  
  177. tests/eth2/core/beacon/test_attestation_helpers.py:247:
  178. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  179. tests/eth2/core/beacon/test_attestation_helpers.py:103: in _run_verify_indexed_vote
  180. slots_per_epoch,
  181. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  182.  
  183. state = <BeaconState #0 da9a866d>
  184. 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>>
  185. max_indices_per_attestation = 4096, slots_per_epoch = 64
  186.  
  187. def validate_indexed_attestation(state: BeaconState,
  188. indexed_attestation: IndexedAttestation,
  189. max_indices_per_attestation: int,
  190. slots_per_epoch: int) -> None:
  191. bit_0_indices = indexed_attestation.custody_bit_0_indices
  192. bit_1_indices = indexed_attestation.custody_bit_1_indices
  193.  
  194. if len(bit_1_indices) != 0:
  195. raise ValidationError(
  196. f"Expected no custody bit 1 validators (cf. {bit_1_indices})."
  197. )
  198.  
  199. if len(bit_0_indices) + len(bit_1_indices) > max_indices_per_attestation:
  200. raise ValidationError(
  201. f"Require no more than {max_indices_per_attestation} validators per attestation,"
  202. f" but have {len(bit_0_indices)} 0-bit validators"
  203. f" and {len(bit_1_indices)} 1-bit validators."
  204. )
  205.  
  206. intersection = set(bit_0_indices).intersection(bit_1_indices)
  207. if len(intersection) != 0:
  208. raise ValidationError(
  209. f"Index sets by custody bits must be disjoint but have the following"
  210. f" indices in common: {intersection}."
  211. )
  212.  
  213. if bit_0_indices != tuple(sorted(bit_0_indices)):
  214. raise ValidationError(
  215. f"Indices should be sorted; the 0-bit indices are not: {bit_0_indices}."
  216. )
  217.  
  218. if bit_1_indices != tuple(sorted(bit_1_indices)):
  219. raise ValidationError(
  220. f"Indices should be sorted; the 1-bit indices are not: {bit_1_indices}."
  221. )
  222.  
  223. if not verify_indexed_attestation_aggregate_signature(state,
  224. indexed_attestation,
  225. slots_per_epoch):
  226. raise ValidationError(
  227. > "The aggregate signature on the indexed attestation"
  228. f" {indexed_attestation} was incorrect."
  229. )
  230. 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.
  231.  
  232. bit_0_indices = (10, 15, 22, 35, 38)
  233. bit_1_indices = ()
  234. 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>>
  235. intersection = set()
  236. max_indices_per_attestation = 4096
  237. slots_per_epoch = 64
  238. state = <BeaconState #0 da9a866d>
  239.  
  240. eth2/beacon/attestation_helpers.py:140: ValidationError
  241. _____________________________________________________________________ test_verify_indexed_attestation_after_fork[40] _____________________________________________________________________
  242.  
  243. genesis_state = <BeaconState #0 7c210f54>, slots_per_epoch = 64, validator_count = 40, privkeys = <conftest.privkey_view object at 0x120013470>
  244. 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>, ...), ...}
  245. 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>, ...)
  246. genesis_balances = (32000000000, 32000000000, 32000000000, 32000000000, 32000000000, 32000000000, ...)
  247. 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'................................................................................................'}
  248. sample_fork_params = {'current_version': b'\x00\x00\x00\x00', 'epoch': 4294967296, 'previous_version': b'\x00\x00\x00\x00'}
  249. 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)
  250. max_indices_per_attestation = 4096
  251.  
  252. @pytest.mark.parametrize(
  253. (
  254. 'validator_count',
  255. ),
  256. [
  257. (40,),
  258. ]
  259. )
  260. def test_verify_indexed_attestation_after_fork(genesis_state,
  261. slots_per_epoch,
  262. validator_count,
  263. privkeys,
  264. sample_beacon_state_params,
  265. genesis_validators,
  266. genesis_balances,
  267. sample_indexed_attestation_params,
  268. sample_fork_params,
  269. config,
  270. max_indices_per_attestation):
  271. # Test that indexed data is still valid after fork
  272. # Indexed data slot = 10, fork slot = 15, current slot = 20
  273. past_fork_params = {
  274. 'previous_version': (0).to_bytes(4, 'little'),
  275. 'current_version': (1).to_bytes(4, 'little'),
  276. 'epoch': 15,
  277. }
  278.  
  279. state = genesis_state.copy(
  280. slot=20,
  281. fork=Fork(**past_fork_params),
  282. )
  283.  
  284. message_hashes = _create_indexed_attestation_messages(sample_indexed_attestation_params)
  285.  
  286. valid_params = _correct_indexed_attestation_params(
  287. validator_count,
  288. message_hashes,
  289. sample_indexed_attestation_params,
  290. privkeys,
  291. state,
  292. config,
  293. )
  294. _run_verify_indexed_vote(
  295. slots_per_epoch,
  296. valid_params,
  297. state,
  298. max_indices_per_attestation,
  299. > True,
  300. )
  301.  
  302. 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)
  303. genesis_balances = (32000000000, 32000000000, 32000000000, 32000000000, 32000000000, 32000000000, ...)
  304. genesis_state = <BeaconState #0 7c210f54>
  305. 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>, ...)
  306. max_indices_per_attestation = 4096
  307. 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')
  308. past_fork_params = {'current_version': b'\x01\x00\x00\x00', 'epoch': 15, 'previous_version': b'\x00\x00\x00\x00'}
  309. privkeys = <conftest.privkey_view object at 0x120013470>
  310. 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>, ...), ...}
  311. sample_fork_params = {'current_version': b'\x00\x00\x00\x00', 'epoch': 4294967296, 'previous_version': b'\x00\x00\x00\x00'}
  312. 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'................................................................................................'}
  313. slots_per_epoch = 64
  314. state = <BeaconState #20 c7e2c56c>
  315. 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'}
  316. validator_count = 40
  317.  
  318. tests/eth2/core/beacon/test_attestation_helpers.py:298:
  319. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  320. tests/eth2/core/beacon/test_attestation_helpers.py:103: in _run_verify_indexed_vote
  321. slots_per_epoch,
  322. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  323.  
  324. state = <BeaconState #20 c7e2c56c>
  325. 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>>
  326. max_indices_per_attestation = 4096, slots_per_epoch = 64
  327.  
  328. def validate_indexed_attestation(state: BeaconState,
  329. indexed_attestation: IndexedAttestation,
  330. max_indices_per_attestation: int,
  331. slots_per_epoch: int) -> None:
  332. bit_0_indices = indexed_attestation.custody_bit_0_indices
  333. bit_1_indices = indexed_attestation.custody_bit_1_indices
  334.  
  335. if len(bit_1_indices) != 0:
  336. raise ValidationError(
  337. f"Expected no custody bit 1 validators (cf. {bit_1_indices})."
  338. )
  339.  
  340. if len(bit_0_indices) + len(bit_1_indices) > max_indices_per_attestation:
  341. raise ValidationError(
  342. f"Require no more than {max_indices_per_attestation} validators per attestation,"
  343. f" but have {len(bit_0_indices)} 0-bit validators"
  344. f" and {len(bit_1_indices)} 1-bit validators."
  345. )
  346.  
  347. intersection = set(bit_0_indices).intersection(bit_1_indices)
  348. if len(intersection) != 0:
  349. raise ValidationError(
  350. f"Index sets by custody bits must be disjoint but have the following"
  351. f" indices in common: {intersection}."
  352. )
  353.  
  354. if bit_0_indices != tuple(sorted(bit_0_indices)):
  355. raise ValidationError(
  356. f"Indices should be sorted; the 0-bit indices are not: {bit_0_indices}."
  357. )
  358.  
  359. if bit_1_indices != tuple(sorted(bit_1_indices)):
  360. raise ValidationError(
  361. f"Indices should be sorted; the 1-bit indices are not: {bit_1_indices}."
  362. )
  363.  
  364. if not verify_indexed_attestation_aggregate_signature(state,
  365. indexed_attestation,
  366. slots_per_epoch):
  367. raise ValidationError(
  368. > "The aggregate signature on the indexed attestation"
  369. f" {indexed_attestation} was incorrect."
  370. )
  371. 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.
  372.  
  373. bit_0_indices = (0, 4, 9, 20, 30)
  374. bit_1_indices = ()
  375. 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>>
  376. intersection = set()
  377. max_indices_per_attestation = 4096
  378. slots_per_epoch = 64
  379. state = <BeaconState #20 c7e2c56c>
  380.  
  381. eth2/beacon/attestation_helpers.py:140: ValidationError
  382. =============================================================================== slowest 50 test durations ================================================================================
  383. 4.60s call tests/eth2/core/beacon/test_attestation_helpers.py::test_verify_indexed_attestation_signature[40]
  384. 2.00s call tests/eth2/core/beacon/test_attestation_helpers.py::test_validate_indexed_attestation[_corrupt_signature-False-True-False-40]
  385. 1.95s call tests/eth2/core/beacon/test_attestation_helpers.py::test_verify_indexed_attestation_after_fork[40]
  386. 1.95s call tests/eth2/core/beacon/test_attestation_helpers.py::test_validate_indexed_attestation[<lambda>-True-False-False-40]
  387. 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]
  388. 0.82s call tests/eth2/core/beacon/test_attestation_helpers.py::test_validate_indexed_attestation[_corrupt_custody_bit_0_indices-False-False-False-40]
  389. 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]
  390. 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]
  391. 0.23s setup tests/eth2/core/beacon/test_attestation_helpers.py::test_verify_indexed_attestation_signature[40]
  392. 0.22s setup tests/eth2/core/beacon/test_attestation_helpers.py::test_validate_indexed_attestation[_corrupt_signature-False-True-False-40]
  393. 0.21s setup tests/eth2/core/beacon/test_attestation_helpers.py::test_validate_indexed_attestation[<lambda>-True-False-False-40]
  394. 0.21s setup tests/eth2/core/beacon/test_attestation_helpers.py::test_validate_indexed_attestation[_corrupt_custody_bit_0_indices-False-False-False-40]
  395. 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]
  396. 0.21s setup tests/eth2/core/beacon/test_attestation_helpers.py::test_verify_indexed_attestation_after_fork[40]
  397. 0.01s teardown tests/eth2/core/beacon/test_attestation_helpers.py::test_is_slashable_attestation_data[True-True]
  398. 0.01s teardown tests/eth2/core/beacon/test_attestation_helpers.py::test_validate_indexed_attestation[_corrupt_custody_bit_0_indices-False-False-False-40]
  399. 0.01s teardown tests/eth2/core/beacon/test_attestation_helpers.py::test_validate_indexed_attestation[<lambda>-True-False-False-40]
  400. 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]
  401. 0.01s teardown tests/eth2/core/beacon/test_attestation_helpers.py::test_validate_indexed_attestation[_corrupt_signature-False-True-False-40]
  402. 0.01s teardown tests/eth2/core/beacon/test_attestation_helpers.py::test_verify_indexed_attestation_signature[40]
  403. 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]
  404. 0.01s teardown tests/eth2/core/beacon/test_attestation_helpers.py::test_verify_indexed_attestation_after_fork[40]
  405. 0.00s teardown tests/eth2/core/beacon/test_attestation_helpers.py::test_is_slashable_attestation_data[True-False]
  406. 0.00s teardown tests/eth2/core/beacon/test_attestation_helpers.py::test_is_slashable_attestation_data[False-False]
  407. 0.00s teardown tests/eth2/core/beacon/test_attestation_helpers.py::test_is_slashable_attestation_data[False-True]
  408. 0.00s setup tests/eth2/core/beacon/test_attestation_helpers.py::test_is_slashable_attestation_data[False-False]
  409. 0.00s setup tests/eth2/core/beacon/test_attestation_helpers.py::test_is_slashable_attestation_data[False-True]
  410. 0.00s setup tests/eth2/core/beacon/test_attestation_helpers.py::test_is_slashable_attestation_data[True-True]
  411. 0.00s setup tests/eth2/core/beacon/test_attestation_helpers.py::test_is_slashable_attestation_data[True-False]
  412. 0.00s call tests/eth2/core/beacon/test_attestation_helpers.py::test_is_slashable_attestation_data[True-True]
  413. 0.00s call tests/eth2/core/beacon/test_attestation_helpers.py::test_is_slashable_attestation_data[True-False]
  414. 0.00s call tests/eth2/core/beacon/test_attestation_helpers.py::test_is_slashable_attestation_data[False-True]
  415. 0.00s call tests/eth2/core/beacon/test_attestation_helpers.py::test_is_slashable_attestation_data[False-False]
  416. ========================================================================== 3 failed, 8 passed in 28.43 seconds ===========================================================================
  417. (py-evm) liangcc@Chih-Chengs-MacBook-Pro trinity (pr/ralexstokes/714)$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement