Merge branch 'version-pyspec-module' into phase1rebase

This commit is contained in:
protolambda
2020-01-04 18:28:34 +01:00
4 changed files with 87 additions and 17 deletions

View File

@@ -82,8 +82,18 @@ def sign_aggregate_attestation(spec, state, attestation_data, participants: List
def sign_indexed_attestation(spec, state, indexed_attestation):
participants = indexed_attestation.attesting_indices
indexed_attestation.signature = sign_aggregate_attestation(spec, state, indexed_attestation.data, participants)
if spec.version == 'phase0':
participants = indexed_attestation.attesting_indices
data = indexed_attestation.data
indexed_attestation.signature = sign_aggregate_attestation(spec, state, data, participants)
else:
participants = spec.get_indices_from_committee(
indexed_attestation.committee,
indexed_attestation.attestation.aggregation_bits,
)
data = indexed_attestation.attestation.data
indexed_attestation.attestation.signature = sign_aggregate_attestation(spec, state, data, participants)
def sign_attestation(spec, state, attestation):

View File

@@ -169,7 +169,11 @@ def test_same_data(spec, state):
def test_no_double_or_surround(spec, state):
attester_slashing = get_valid_attester_slashing(spec, state, signed_1=False, signed_2=True)
attester_slashing.attestation_1.data.target.epoch += 1
if spec.version == 'phase0':
attester_slashing.attestation_1.data.target.epoch += 1
else:
attester_slashing.attestation_1.attestation.data.target.epoch += 1
sign_indexed_attestation(spec, state, attester_slashing.attestation_1)
yield from run_attester_slashing_processing(spec, state, attester_slashing, False)