From a10aba4bb9009e6c82f59491e0eb057f48c40d25 Mon Sep 17 00:00:00 2001 From: protolambda Date: Fri, 17 May 2019 21:36:17 +0200 Subject: [PATCH] make valid attest creation fill aggregate bitfield --- test_libs/pyspec/eth2spec/test/helpers/attestations.py | 1 + test_libs/pyspec/eth2spec/test/test_finality.py | 2 -- test_libs/pyspec/eth2spec/test/test_sanity.py | 3 ++- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test_libs/pyspec/eth2spec/test/helpers/attestations.py b/test_libs/pyspec/eth2spec/test/helpers/attestations.py index 7164cf160..b541e610f 100644 --- a/test_libs/pyspec/eth2spec/test/helpers/attestations.py +++ b/test_libs/pyspec/eth2spec/test/helpers/attestations.py @@ -78,6 +78,7 @@ def get_valid_attestation(state, slot=None, signed=False): data=attestation_data, custody_bitfield=custody_bitfield, ) + fill_aggregate_attestation(state, attestation) if signed: sign_attestation(state, attestation) return attestation diff --git a/test_libs/pyspec/eth2spec/test/test_finality.py b/test_libs/pyspec/eth2spec/test/test_finality.py index f47ee5f77..26900340d 100644 --- a/test_libs/pyspec/eth2spec/test/test_finality.py +++ b/test_libs/pyspec/eth2spec/test/test_finality.py @@ -53,13 +53,11 @@ def next_epoch_with_attestations(state, slot_to_attest = post_state.slot - spec.MIN_ATTESTATION_INCLUSION_DELAY + 1 if slot_to_attest >= get_epoch_start_slot(get_current_epoch(post_state)): cur_attestation = get_valid_attestation(post_state, slot_to_attest) - fill_aggregate_attestation(post_state, cur_attestation) block.body.attestations.append(cur_attestation) if fill_prev_epoch: slot_to_attest = post_state.slot - spec.SLOTS_PER_EPOCH + 1 prev_attestation = get_valid_attestation(post_state, slot_to_attest) - fill_aggregate_attestation(post_state, prev_attestation) block.body.attestations.append(prev_attestation) state_transition(post_state, block) diff --git a/test_libs/pyspec/eth2spec/test/test_sanity.py b/test_libs/pyspec/eth2spec/test/test_sanity.py index 1509a9843..5e3b32416 100644 --- a/test_libs/pyspec/eth2spec/test/test_sanity.py +++ b/test_libs/pyspec/eth2spec/test/test_sanity.py @@ -157,7 +157,8 @@ def test_attester_slashing(state): pre_state = deepcopy(state) attester_slashing = get_valid_attester_slashing(state) - validator_index = attester_slashing.attestation_1.custody_bit_0_indices[0] + validator_index = (attester_slashing.attestation_1.custody_bit_0_indices + + attester_slashing.attestation_1.custody_bit_1_indices)[0] assert not state.validator_registry[validator_index].slashed