ethereum / beacon_chain

MIT License
211 stars 65 forks source link

Handle block triggering multiple state recalcs #67

Closed djrtwo closed 6 years ago

djrtwo commented 6 years ago

Issue

Repo currently doesn't handle the case in which a block's parent spans multiple state recalc points. For example if the parent of slot 258 was at slot 65. Then processing block at 258 would trigger a state recalc for 128, 192, and 256. The mechanism to solve this is described in the spec:

Repeat while slot - last_state_recalc >= CYCLE_LENGTH:

Proposed implementation

Add a while loop around the initialize_new_cycle part of compute_state_transition instead of the current if

See here: https://github.com/ethereum/beacon_chain/blob/master/beacon_chain/state/state_transition.py#L333