Skip to content

Instantly share code, notes, and snippets.

@ralexstokes
Created March 31, 2019 03:26
Show Gist options
  • Save ralexstokes/37f6c3779038705c7795962fd0147c1d to your computer and use it in GitHub Desktop.
Save ralexstokes/37f6c3779038705c7795962fd0147c1d to your computer and use it in GitHub Desktop.
change-sequence-of-epoch-processing.patch
From c47d7ce48eaadf0faf45ec53fc0e8adf0017db7b Mon Sep 17 00:00:00 2001
From: Alex Stokes <[email protected]>
Date: Wed, 20 Mar 2019 16:50:03 -0700
Subject: [PATCH] Reorder the per-epoch transition to occur at the start of the
state transition
---
.../beacon/state_machines/forks/serenity/state_transitions.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/eth2/beacon/state_machines/forks/serenity/state_transitions.py b/eth2/beacon/state_machines/forks/serenity/state_transitions.py
index 77c3f128..a529d48d 100644
--- a/eth2/beacon/state_machines/forks/serenity/state_transitions.py
+++ b/eth2/beacon/state_machines/forks/serenity/state_transitions.py
@@ -45,11 +45,11 @@ class SerenityStateTransition(BaseStateTransition):
check_proposer_signature: bool=True) -> BeaconState:
while state.slot != block.slot:
state = self.cache_state(state)
+ if (state.slot + 1) % self.config.SLOTS_PER_EPOCH == 0:
+ state = self.per_epoch_transition(state)
state = self.per_slot_transition(state)
if state.slot == block.slot:
state = self.per_block_transition(state, block, check_proposer_signature)
- if (state.slot + 1) % self.config.SLOTS_PER_EPOCH == 0:
- state = self.per_epoch_transition(state)
return state
--
2.19.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment