From c37157ead1a97fd3fb2fccdda4f0b67ea258a1ea Mon Sep 17 00:00:00 2001 From: Justin Drake Date: Wed, 8 May 2019 19:15:23 +0100 Subject: [PATCH] Revert exception handling --- specs/core/0_beacon-chain.md | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index 3470459e1..bf210c60c 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -1216,19 +1216,15 @@ Let `genesis_block = BeaconBlock(state_root=hash_tree_root(genesis_state))`. ## Beacon chain state transition function -The post-state corresponding to a pre-state `state` and a block `block` is defined as `state_transition(state, block)`. +The post-state corresponding to a pre-state `state` and a block `block` is defined as `state_transition(state, block)`. State transitions that trigger an unhandled excpetion (e.g. a failed `assert` or an out-of-range list access) are considered invalid. ```python def state_transition(state: BeaconState, block: BeaconBlock) -> BeaconState: - pre_state = copy.deepcopy(state) - try: - # Process slots (including those with no blocks) since block - process_slots(state, block.slot) - # Process block - process_block(state, block) - except Exception: - # State is not advanced on exceptions (e.g. a failed `assert` or an out-of-range list access) - return pre_state + # Process slots (including those with no blocks) since block + process_slots(state, block.slot) + # Process block + process_block(state, block) + # Return post-state return state ```