Skip to content

Commit

Permalink
Removes old tests & fixes phase1 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlBeek committed May 31, 2019
1 parent 0c57cfc commit 9e8a969
Show file tree
Hide file tree
Showing 24 changed files with 27 additions and 2,353 deletions.
9 changes: 1 addition & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ test: $(PY_SPEC_ALL_TARGETS)

citest: $(PY_SPEC_ALL_TARGETS)
cd $(PY_SPEC_DIR); mkdir -p test-reports/eth2spec; . venv/bin/activate; \
python -m pytest --junitxml=test-reports/eth2spec/test_results_phase0.xml tests/phase0; \
python -m pytest --junitxml=test-reports/eth2spec/test_results_phase0.xml tests/phase1
python -m pytest --junitxml=test-reports/eth2spec/test_results_phase0.xml eth2spec

install_lint:
cd $(PY_SPEC_DIR); python3 -m venv venv; . venv/bin/activate; pip3 install flake8==3.5.0
Expand All @@ -57,12 +56,6 @@ lint: $(PY_SPEC_ALL_TARGETS)
# "make pyspec" to create the pyspec for all phases.
pyspec: $(PY_SPEC_ALL_TARGETS)

# "make phase0" to create pyspec for phase0
phase0: $(PY_SPEC_PHASE_0_TARGETS)

# "make phase1" to create pyspec for phase1
phase1: $(PY_SPEC_PHASE_1_TARGETS)

$(PY_SPEC_PHASE_0_TARGETS): $(PY_SPEC_PHASE_0_DEPS)
python3 $(SCRIPT_DIR)/build_spec.py -p0 $(SPEC_DIR)/core/0_beacon-chain.md $@

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ def run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal, v
assert slashed_validator.withdrawable_epoch < spec.FAR_FUTURE_EPOCH
# lost whistleblower reward
# FIXME: Currently broken because get_base_reward in genesis epoch is 0
assert (
state.balances[randao_key_reveal.revealed_index] <
state.balances[randao_key_reveal.revealed_index]
)
# assert (
# state.balances[randao_key_reveal.revealed_index] <
# state.balances[randao_key_reveal.revealed_index]
# )
yield 'post', state


Expand Down Expand Up @@ -81,24 +81,27 @@ def test_reveal_with_custody_padding_minus_one(spec, state):
yield from run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal, True)


# @with_phase1
# @spec_state_test
# def test_double_reveal(spec, state):
# randao_key_reveal1 = get_valid_early_derived_secret_reveal(
# spec,
# state,
# spec.get_current_epoch(state) + spec.RANDAO_PENALTY_EPOCHS + 1,
# )
# pre_state, intermediate_state = run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal1)

# randao_key_reveal2 = get_valid_early_derived_secret_reveal(
# spec,
# intermediate_state,
# spec.get_current_epoch(pre_state) + spec.RANDAO_PENALTY_EPOCHS + 1,
# )
# _, post_state = run_early_derived_secret_reveal_processing(spec, intermediate_state, randao_key_reveal2, False)

# return pre_state, [randao_key_reveal1, randao_key_reveal2], post_state
@with_phase1
@spec_state_test
def test_double_reveal(spec, state):
randao_key_reveal1 = get_valid_early_derived_secret_reveal(
spec,
state,
spec.get_current_epoch(state) + spec.RANDAO_PENALTY_EPOCHS + 1,
)
res = dict(run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal1))
pre_state = res['pre']
yield 'pre', pre_state
intermediate_state = res['post']

randao_key_reveal2 = get_valid_early_derived_secret_reveal(
spec,
intermediate_state,
spec.get_current_epoch(pre_state) + spec.RANDAO_PENALTY_EPOCHS + 1,
)
post_state = dict(run_early_derived_secret_reveal_processing(spec, intermediate_state, randao_key_reveal2, False))['post']
yield 'randao_key_reveal', [randao_key_reveal1, randao_key_reveal2]
yield 'post', post_state


@with_phase1
Expand Down
2 changes: 1 addition & 1 deletion test_libs/pyspec/eth2spec/test/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from eth2spec.phase0 import spec as spec_phase0
from eth2spec.phase0 import spec as spec_phase1
from eth2spec.phase1 import spec as spec_phase1

# We import pytest only when it's present, i.e. when we are running tests.
# The test-cases themselves can be generated without installing pytest.
Expand Down
Empty file.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 9e8a969

Please sign in to comment.