fix attester slahsing test

This commit is contained in:
Danny Ryan 2020-02-26 11:20:19 -06:00
parent 721f605a91
commit 9718d206a7
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
3 changed files with 10 additions and 9 deletions

View File

@ -540,8 +540,12 @@ def is_valid_indexed_attestation(state: BeaconState, indexed_attestation: Indexe
if abit: if abit:
all_pubkeys.append(state.validators[participant].pubkey) all_pubkeys.append(state.validators[participant].pubkey)
# Note: only 2N distinct message hashes # Note: only 2N distinct message hashes
all_signing_roots.append(compute_signing_root( attestation_wrapper = AttestationCustodyBitWrapper(
AttestationCustodyBitWrapper(hash_tree_root(attestation.data), i, cbit), domain)) attestation_data_root=hash_tree_root(attestation.data),
block_index=i,
bit=cbit
)
all_signing_roots.append(compute_signing_root(attestation_wrapper, domain))
else: else:
assert not cbit assert not cbit
return bls.AggregateVerify(zip(all_pubkeys, all_signing_roots), signature=attestation.signature) return bls.AggregateVerify(zip(all_pubkeys, all_signing_roots), signature=attestation.signature)
@ -801,6 +805,7 @@ def get_indices_from_committee(
def process_attester_slashing(state: BeaconState, attester_slashing: AttesterSlashing) -> None: def process_attester_slashing(state: BeaconState, attester_slashing: AttesterSlashing) -> None:
indexed_attestation_1 = attester_slashing.attestation_1 indexed_attestation_1 = attester_slashing.attestation_1
indexed_attestation_2 = attester_slashing.attestation_2 indexed_attestation_2 = attester_slashing.attestation_2
assert is_slashable_attestation_data( assert is_slashable_attestation_data(
indexed_attestation_1.attestation.data, indexed_attestation_1.attestation.data,
indexed_attestation_2.attestation.data, indexed_attestation_2.attestation.data,

View File

@ -202,9 +202,9 @@ def get_attestation_custody_signature(spec, state, attestation_data, block_index
domain = spec.get_domain(state, spec.DOMAIN_BEACON_ATTESTER, attestation_data.target.epoch) domain = spec.get_domain(state, spec.DOMAIN_BEACON_ATTESTER, attestation_data.target.epoch)
signing_root = spec.compute_signing_root( signing_root = spec.compute_signing_root(
spec.AttestationCustodyBitWrapper( spec.AttestationCustodyBitWrapper(
attestation_data.hash_tree_root(), attestation_data_root=attestation_data.hash_tree_root(),
block_index, block_index=block_index,
bit, bit=bit,
), ),
domain, domain,
) )

View File

@ -143,10 +143,6 @@ def test_invalid_sig_1(spec, state):
@always_bls @always_bls
def test_invalid_sig_2(spec, state): def test_invalid_sig_2(spec, state):
attester_slashing = get_valid_attester_slashing(spec, state, signed_1=True, signed_2=False) attester_slashing = get_valid_attester_slashing(spec, state, signed_1=True, signed_2=False)
"""
SOMETHING WRONG WITH HASH CACHE OF SEPARATE ATTESTATIONS MAKING SIGS
LOOK CORRECT
"""
yield from run_attester_slashing_processing(spec, state, attester_slashing, False) yield from run_attester_slashing_processing(spec, state, attester_slashing, False)