From 9f2d06b2e7e74f977f20c35dbda7617d44511bda Mon Sep 17 00:00:00 2001 From: Carl Beekhuizen Date: Sun, 16 Jun 2019 16:02:56 -0400 Subject: [PATCH] Somehow I had indented with 5 spaces everywhere. --- specs/core/0_fork-choice.md | 4 +- .../pyspec/eth2spec/test/test_fork_choice.py | 78 +++++++++---------- .../pyspec/eth2spec/utils/ssz/ssz_typing.py | 2 +- 3 files changed, 42 insertions(+), 42 deletions(-) diff --git a/specs/core/0_fork-choice.md b/specs/core/0_fork-choice.md index 9a0657081..f3d57feaa 100644 --- a/specs/core/0_fork-choice.md +++ b/specs/core/0_fork-choice.md @@ -164,7 +164,7 @@ def on_attestation(store: Store, attestation: Attestation) -> None: for i in indexed_attestation.custody_bit_0_indices + indexed_attestation.custody_bit_1_indices: if i not in store.latest_targets or attestation.data.target_epoch > store.latest_targets[i].epoch: store.latest_targets[i] = Target( - epoch = attestation.data.target_epoch, - root = attestation.data.target_root, + epoch=attestation.data.target_epoch, + root=attestation.data.target_root, ) ``` diff --git a/test_libs/pyspec/eth2spec/test/test_fork_choice.py b/test_libs/pyspec/eth2spec/test/test_fork_choice.py index 6f054fc52..ab1728251 100644 --- a/test_libs/pyspec/eth2spec/test/test_fork_choice.py +++ b/test_libs/pyspec/eth2spec/test/test_fork_choice.py @@ -12,57 +12,57 @@ from eth2spec.test.helpers.state import next_slot @with_all_phases @spec_state_test def test_basic(spec, state): - state.latest_block_header = spec.BeaconBlockHeader(body_root=hash_tree_root(spec.BeaconBlockBody())) - yield 'pre', state + state.latest_block_header = spec.BeaconBlockHeader(body_root=hash_tree_root(spec.BeaconBlockBody())) + yield 'pre', state # Initialization - store = spec.get_genesis_store(state) - blocks = [] - time = 100 - spec.on_tick(store, time) - assert store.time == time + store = spec.get_genesis_store(state) + blocks = [] + time = 100 + spec.on_tick(store, time) + assert store.time == time - # On receiving a block of `GENESIS_SLOT + 1` slot - block = build_empty_block_for_next_slot(spec, state) - blocks.append(block) - spec.on_block(store, block) - assert store.blocks[signing_root(block)] == block + # On receiving a block of `GENESIS_SLOT + 1` slot + block = build_empty_block_for_next_slot(spec, state) + blocks.append(block) + spec.on_block(store, block) + assert store.blocks[signing_root(block)] == block - # On receiving a block of next epoch - store.time = time + spec.SECONDS_PER_SLOT * spec.SLOTS_PER_EPOCH - block = build_empty_block_for_next_slot(spec, state) - block.slot += spec.SLOTS_PER_EPOCH - blocks.append(block) + # On receiving a block of next epoch + store.time = time + spec.SECONDS_PER_SLOT * spec.SLOTS_PER_EPOCH + block = build_empty_block_for_next_slot(spec, state) + block.slot += spec.SLOTS_PER_EPOCH + blocks.append(block) - spec.on_block(store, block) - assert store.blocks[signing_root(block)] == block - yield 'blocks', blocks, List[spec.BeaconBlock] + spec.on_block(store, block) + assert store.blocks[signing_root(block)] == block + yield 'blocks', blocks, List[spec.BeaconBlock] - # TODO: add tests for justified_root and finalized_root - yield 'post', state + # TODO: add tests for justified_root and finalized_root + yield 'post', state @with_all_phases @spec_state_test def test_on_attestation(spec, state): - yield 'pre', state + yield 'pre', state - store = spec.get_genesis_store(state) - time = 100 - spec.on_tick(store, time) + store = spec.get_genesis_store(state) + time = 100 + spec.on_tick(store, time) - next_slot(spec, state) + next_slot(spec, state) - attestation = get_valid_attestation(spec, state, slot=1) - yield 'attestation', attestation - indexed_attestation = spec.convert_to_indexed(state, attestation) - spec.on_attestation(store, attestation) - assert ( - store.latest_targets[indexed_attestation.custody_bit_0_indices[0]] == - spec.Target( - epoch = attestation.data.target_epoch, - root = attestation.data.target_root, - ) - ) + attestation = get_valid_attestation(spec, state, slot=1) + yield 'attestation', attestation + indexed_attestation = spec.convert_to_indexed(state, attestation) + spec.on_attestation(store, attestation) + assert ( + store.latest_targets[indexed_attestation.custody_bit_0_indices[0]] == + spec.Target( + epoch=attestation.data.target_epoch, + root=attestation.data.target_root, + ) + ) - yield 'post', state \ No newline at end of file + yield 'post', state diff --git a/test_libs/pyspec/eth2spec/utils/ssz/ssz_typing.py b/test_libs/pyspec/eth2spec/utils/ssz/ssz_typing.py index 7df95d119..3bd7dd062 100644 --- a/test_libs/pyspec/eth2spec/utils/ssz/ssz_typing.py +++ b/test_libs/pyspec/eth2spec/utils/ssz/ssz_typing.py @@ -131,7 +131,7 @@ class Container(object): def get_field_values(self): cls = self.__class__ return [getattr(self, field) for field in cls.get_field_names()] - + def copy(self): return copy.deepcopy(self)