Fix linting

This commit is contained in:
Caspar Schwarz-Schilling 2021-12-08 18:31:14 +01:00
parent 79e1d5e021
commit 9f614fca83
1 changed files with 13 additions and 8 deletions

View File

@ -60,7 +60,7 @@ def test_ex_ante_scenario_1_with_boost(spec, state):
state_b = state_a.copy() state_b = state_a.copy()
block = build_empty_block(spec, state_a, slot=state_a.slot + 1) block = build_empty_block(spec, state_a, slot=state_a.slot + 1)
signed_block_b = state_transition_and_sign_block(spec, state_b, block) signed_block_b = state_transition_and_sign_block(spec, state_b, block)
# Block C at slot `N + 2`, parent is A # Block C at slot `N + 2`, parent is A
state_c = state_a.copy() state_c = state_a.copy()
block = build_empty_block(spec, state_c, slot=state_a.slot + 2) block = build_empty_block(spec, state_c, slot=state_a.slot + 2)
@ -89,7 +89,7 @@ def test_ex_ante_scenario_1_with_boost(spec, state):
# Attestation_1 received at N+2 — C is head # Attestation_1 received at N+2 — C is head
yield from add_attestation(spec, store, attestation, test_steps) yield from add_attestation(spec, store, attestation, test_steps)
assert spec.get_head(store) == signed_block_c.message.hash_tree_root() assert spec.get_head(store) == signed_block_c.message.hash_tree_root()
yield 'steps', test_steps yield 'steps', test_steps
@ -328,6 +328,7 @@ def test_ex_ante_attestations_is_greater_than_proposer_boost_without_boost(spec,
yield 'steps', test_steps yield 'steps', test_steps
@with_all_phases @with_all_phases
@spec_state_test @spec_state_test
def test_ex_ante_sandwich_without_attestations_with_boost(spec, state): def test_ex_ante_sandwich_without_attestations_with_boost(spec, state):
@ -371,7 +372,7 @@ def test_ex_ante_sandwich_without_attestations_with_boost(spec, state):
state_d = state_b.copy() state_d = state_b.copy()
block = build_empty_block(spec, state_d, slot=state_a.slot + 3) block = build_empty_block(spec, state_d, slot=state_a.slot + 3)
signed_block_d = state_transition_and_sign_block(spec, state_d, block) signed_block_d = state_transition_and_sign_block(spec, state_d, block)
# Block C received at N+2 — C is head # Block C received at N+2 — C is head
time = state_c.slot * spec.config.SECONDS_PER_SLOT + store.genesis_time time = state_c.slot * spec.config.SECONDS_PER_SLOT + store.genesis_time
on_tick_and_append_step(spec, store, time, test_steps) on_tick_and_append_step(spec, store, time, test_steps)
@ -390,6 +391,7 @@ def test_ex_ante_sandwich_without_attestations_with_boost(spec, state):
yield 'steps', test_steps yield 'steps', test_steps
@with_all_phases @with_all_phases
@spec_configured_state_test({ @spec_configured_state_test({
'PROPOSER_SCORE_BOOST': 0, 'PROPOSER_SCORE_BOOST': 0,
@ -435,7 +437,7 @@ def test_ex_ante_sandwich_without_attestations_without_boost(spec, state):
state_d = state_b.copy() state_d = state_b.copy()
block = build_empty_block(spec, state_d, slot=state_a.slot + 3) block = build_empty_block(spec, state_d, slot=state_a.slot + 3)
signed_block_d = state_transition_and_sign_block(spec, state_d, block) signed_block_d = state_transition_and_sign_block(spec, state_d, block)
# Block C received at N+2 — C is head # Block C received at N+2 — C is head
time = state_c.slot * spec.config.SECONDS_PER_SLOT + store.genesis_time time = state_c.slot * spec.config.SECONDS_PER_SLOT + store.genesis_time
on_tick_and_append_step(spec, store, time, test_steps) on_tick_and_append_step(spec, store, time, test_steps)
@ -462,6 +464,7 @@ def test_ex_ante_sandwich_without_attestations_without_boost(spec, state):
yield 'steps', test_steps yield 'steps', test_steps
@with_all_phases @with_all_phases
@spec_state_test @spec_state_test
def test_ex_ante_sandwich_with_honest_attestation_with_boost(spec, state): def test_ex_ante_sandwich_with_honest_attestation_with_boost(spec, state):
@ -519,7 +522,7 @@ def test_ex_ante_sandwich_with_honest_attestation_with_boost(spec, state):
state_d = state_b.copy() state_d = state_b.copy()
block = build_empty_block(spec, state_d, slot=state_a.slot + 3) block = build_empty_block(spec, state_d, slot=state_a.slot + 3)
signed_block_d = state_transition_and_sign_block(spec, state_d, block) signed_block_d = state_transition_and_sign_block(spec, state_d, block)
# Block C received at N+2 — C is head # Block C received at N+2 — C is head
time = state_c.slot * spec.config.SECONDS_PER_SLOT + store.genesis_time time = state_c.slot * spec.config.SECONDS_PER_SLOT + store.genesis_time
on_tick_and_append_step(spec, store, time, test_steps) on_tick_and_append_step(spec, store, time, test_steps)
@ -542,6 +545,7 @@ def test_ex_ante_sandwich_with_honest_attestation_with_boost(spec, state):
yield 'steps', test_steps yield 'steps', test_steps
@with_all_phases @with_all_phases
@spec_configured_state_test({ @spec_configured_state_test({
'PROPOSER_SCORE_BOOST': 0, 'PROPOSER_SCORE_BOOST': 0,
@ -589,7 +593,7 @@ def test_ex_ante_sandwich_with_honest_attestation_without_boost(spec, state):
state_d = state_b.copy() state_d = state_b.copy()
block = build_empty_block(spec, state_d, slot=state_a.slot + 3) block = build_empty_block(spec, state_d, slot=state_a.slot + 3)
signed_block_d = state_transition_and_sign_block(spec, state_d, block) signed_block_d = state_transition_and_sign_block(spec, state_d, block)
# Block C received at N+2 — C is head # Block C received at N+2 — C is head
time = state_c.slot * spec.config.SECONDS_PER_SLOT + store.genesis_time time = state_c.slot * spec.config.SECONDS_PER_SLOT + store.genesis_time
on_tick_and_append_step(spec, store, time, test_steps) on_tick_and_append_step(spec, store, time, test_steps)
@ -614,7 +618,7 @@ def test_ex_ante_sandwich_with_honest_attestation_without_boost(spec, state):
attestation.data.beacon_block_root = signed_block_c.message.hash_tree_root() attestation.data.beacon_block_root = signed_block_c.message.hash_tree_root()
assert len([i for i in attestation.aggregation_bits if i == 1]) == 1 assert len([i for i in attestation.aggregation_bits if i == 1]) == 1
sign_attestation(spec, state_c, attestation) sign_attestation(spec, state_c, attestation)
# Attestation_1 received at N+3 - C is head # Attestation_1 received at N+3 - C is head
time = state_d.slot * spec.config.SECONDS_PER_SLOT + store.genesis_time time = state_d.slot * spec.config.SECONDS_PER_SLOT + store.genesis_time
on_tick_and_append_step(spec, store, time, test_steps) on_tick_and_append_step(spec, store, time, test_steps)
@ -627,6 +631,7 @@ def test_ex_ante_sandwich_with_honest_attestation_without_boost(spec, state):
yield 'steps', test_steps yield 'steps', test_steps
@with_all_phases @with_all_phases
@with_presets([MAINNET], reason="to create non-duplicate committee") @with_presets([MAINNET], reason="to create non-duplicate committee")
@spec_state_test @spec_state_test
@ -673,7 +678,7 @@ def test_ex_ante_sandwich_with_boost_not_sufficient(spec, state):
state_d = state_b.copy() state_d = state_b.copy()
block = build_empty_block(spec, state_d, slot=state_a.slot + 3) block = build_empty_block(spec, state_d, slot=state_a.slot + 3)
signed_block_d = state_transition_and_sign_block(spec, state_d, block) signed_block_d = state_transition_and_sign_block(spec, state_d, block)
# Block C received at N+2 — C is head # Block C received at N+2 — C is head
time = state_c.slot * spec.config.SECONDS_PER_SLOT + store.genesis_time time = state_c.slot * spec.config.SECONDS_PER_SLOT + store.genesis_time
on_tick_and_append_step(spec, store, time, test_steps) on_tick_and_append_step(spec, store, time, test_steps)