Skip to content

Commit

Permalink
reduce stack space usage in process_final_updates(...) to avoid fuzze…
Browse files Browse the repository at this point in the history
…d segfault in #921
  • Loading branch information
tersec committed Apr 23, 2020
1 parent ae9ca33 commit 60dfc15
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions beacon_chain/spec/state_transition_epoch.nim
Original file line number Diff line number Diff line change
Expand Up @@ -410,11 +410,8 @@ func process_final_updates*(state: var BeaconState) {.nbench.}=

# Set historical root accumulator
if next_epoch mod (SLOTS_PER_HISTORICAL_ROOT div SLOTS_PER_EPOCH).uint64 == 0:
let historical_batch = HistoricalBatch(
block_roots: state.block_roots,
state_roots: state.state_roots,
)
state.historical_roots.add (hash_tree_root(historical_batch))
state.historical_roots.add hash_tree_root(
[hash_tree_root(state.block_roots), hash_tree_root(state.state_roots)])

# Rotate current/previous epoch attestations
state.previous_epoch_attestations = state.current_epoch_attestations
Expand Down

0 comments on commit 60dfc15

Please sign in to comment.