def test_max_reveal_lateness_2(spec, state): next_epoch(spec, state) apply_empty_block(spec, state) attestation = get_valid_attestation(spec, state, signed=True) test_vector = get_custody_test_vector( spec.get_custody_chunk_count(attestation.data.crosslink) * spec.BYTES_PER_CUSTODY_CHUNK) shard_root = get_custody_merkle_root(test_vector) attestation.data.crosslink.data_root = shard_root attestation.custody_bits[0] = 0 next_epoch(spec, state) apply_empty_block(spec, state) _, _, _ = run_attestation_processing(spec, state, attestation) challenge = get_valid_bit_challenge(spec, state, attestation) responder_index = challenge.responder_index state.validators[responder_index].max_reveal_lateness = 3 for i in range(spec.get_randao_epoch_for_custody_period( spec.get_custody_period_for_validator(state, responder_index), responder_index ) + 2 * spec.EPOCHS_PER_CUSTODY_PERIOD + state.validators[responder_index].max_reveal_lateness - 1): next_epoch(spec, state) apply_empty_block(spec, state) yield from run_bit_challenge_processing(spec, state, challenge, False)
def test_custody_response_many_epochs(spec, state): state.slot = spec.SLOTS_PER_EPOCH * 100 attestation = get_valid_attestation(spec, state, signed=True) test_vector = get_custody_test_vector( spec.get_custody_chunk_count(attestation.data.crosslink) * spec.BYTES_PER_CUSTODY_CHUNK) shard_root = get_custody_merkle_root(test_vector) attestation.data.crosslink.data_root = shard_root attestation.custody_bits[0] = 0 state.slot += spec.MIN_ATTESTATION_INCLUSION_DELAY _, _, _ = run_attestation_processing(spec, state, attestation) state.slot += spec.SLOTS_PER_EPOCH * spec.EPOCHS_PER_CUSTODY_PERIOD challenge = get_valid_bit_challenge(spec, state, attestation) _, _, _ = run_bit_challenge_processing(spec, state, challenge) bit_challenge_index = state.custody_challenge_index - 1 custody_response = get_valid_custody_response(spec, state, challenge, test_vector, bit_challenge_index) yield from run_custody_response_processing(spec, state, custody_response)
def test_off_chain_attestation(spec, state): state.slot = spec.SLOTS_PER_EPOCH attestation = get_valid_attestation(spec, state, signed=True) test_vector = get_custody_test_vector( spec.get_custody_chunk_count(attestation.data.crosslink) * spec.BYTES_PER_CUSTODY_CHUNK) shard_root = get_custody_merkle_root(test_vector) attestation.data.crosslink.data_root = shard_root attestation.custody_bits[0] = 0 state.slot += spec.MIN_ATTESTATION_INCLUSION_DELAY state.slot += spec.SLOTS_PER_EPOCH * spec.EPOCHS_PER_CUSTODY_PERIOD challenge = get_valid_bit_challenge(spec, state, attestation) yield from run_bit_challenge_processing(spec, state, challenge)