Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
djrtwo committed Mar 8, 2019
1 parent 9ffb19c commit 53676b5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions spec_pythonizer/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -1680,7 +1680,7 @@ _Note_: If there are skipped slots between a block and its parent block, run the
At every `slot > GENESIS_SLOT` run the following function:

```python
def store_state_root(state: BeaconState) -> None:
def cache_state_root(state: BeaconState) -> None:
state.latest_state_roots[state.slot % SLOTS_PER_HISTORICAL_ROOT] = hash_tree_root(state)
```

Expand Down Expand Up @@ -2146,9 +2146,9 @@ def process_slashings(state: BeaconState) -> None:
total_balance = get_total_balance(state, active_validator_indices)

# Compute `total_penalties`
epoch_index = current_epoch % LATEST_SLASHED_EXIT_LENGTH
total_at_start = state.latest_slashed_balances[(epoch_index + 1) % LATEST_SLASHED_EXIT_LENGTH]
total_at_end = state.latest_slashed_balances[epoch_index]
total_at_start = state.latest_slashed_balances[(current_epoch + 1) % LATEST_SLASHED_EXIT_LENGTH]
total_at_end = state.latest_slashed_balances[current_epoch % LATEST_SLASHED_EXIT_LENGTH]

total_penalties = total_at_end - total_at_start

for index, validator in enumerate(state.validator_registry):
Expand Down
2 changes: 1 addition & 1 deletion spec_pythonizer/state_transition.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def state_transition(state: BeaconState,
block: BeaconBlock,
verify_state_root: bool=False) -> BeaconState:
while state.slot < block.slot:
store_state_root(state)
cache_state_root(state)
if (state.slot + 1) % SLOTS_PER_EPOCH == 0:
process_epoch_transition(state)
advance_slot(state)
Expand Down

0 comments on commit 53676b5

Please sign in to comment.