@@ -143,7 +143,7 @@ template is_merge_transition_complete(
143143 stateParam: ForkedHashedBeaconState ): bool =
144144 withState (stateParam):
145145 when stateFork >= BeaconStateFork .Bellatrix :
146- is_merge_transition_complete (state .data)
146+ is_merge_transition_complete (forkyState .data)
147147 else :
148148 false
149149
@@ -366,7 +366,7 @@ func init*(
366366 dependent_epoch =
367367 if epoch < 1 : Epoch (0 ) else : epoch - 1
368368 attester_dependent_root =
369- withState (state): state .dependent_root (dependent_epoch)
369+ withState (state): forkyState .dependent_root (dependent_epoch)
370370
371371 ShufflingRef (
372372 epoch: epoch,
@@ -380,13 +380,15 @@ func init*(
380380 cache: var StateCache ): T =
381381 let
382382 epoch = state.get_current_epoch ()
383- proposer_dependent_root = withState (state): state.proposer_dependent_root
383+ proposer_dependent_root = withState (state):
384+ forkyState.proposer_dependent_root
384385 shufflingRef = dag.findShufflingRef (state.latest_block_id, epoch).valueOr:
385386 let tmp = ShufflingRef .init (state, cache, epoch)
386387 dag.putShufflingRef (tmp)
387388 tmp
388389
389- attester_dependent_root = withState (state): state.attester_dependent_root
390+ attester_dependent_root = withState (state):
391+ forkyState.attester_dependent_root
390392 epochRef = EpochRef (
391393 key: dag.epochAncestor (state.latest_block_id, epoch),
392394
@@ -703,7 +705,7 @@ proc putState(dag: ChainDAGRef, state: ForkedHashedBeaconState, bid: BlockId) =
703705 # transaction to prevent database inconsistencies, but the state loading code
704706 # is resilient against one or the other going missing
705707 withState (state):
706- dag.db.putState (state )
708+ dag.db.putState (forkyState )
707709
708710 debug " Stored state" , putStateDur = Moment .now () - startTick
709711
@@ -733,9 +735,10 @@ proc advanceSlots*(
733735 # in the monitor. This may be inaccurate during a deep reorg (>1 epoch)
734736 # which is an acceptable tradeoff for monitoring.
735737 withState (state):
736- let postEpoch = state .data.slot.epoch
738+ let postEpoch = forkyState .data.slot.epoch
737739 if preEpoch != postEpoch:
738- dag.validatorMonitor[].registerEpochInfo (postEpoch, info, state.data)
740+ dag.validatorMonitor[].registerEpochInfo (
741+ postEpoch, info, forkyState.data)
739742
740743proc applyBlock (
741744 dag: ChainDAGRef , state: var ForkedHashedBeaconState , bid: BlockId ,
@@ -1233,7 +1236,7 @@ proc updateState*(
12331236 let
12341237 startTick = Moment .now ()
12351238 current {.used .} = withState (state):
1236- BlockSlotId .init (state .latest_block_id, state .data.slot)
1239+ BlockSlotId .init (forkyState .latest_block_id, forkyState .data.slot)
12371240
12381241 var
12391242 ancestors: seq [BlockId ]
@@ -1361,7 +1364,7 @@ proc updateState*(
13611364 let
13621365 assignTick = Moment .now ()
13631366 ancestor {.used .} = withState (state):
1364- BlockSlotId .init (state .latest_block_id, state .data.slot)
1367+ BlockSlotId .init (forkyState .latest_block_id, forkyState .data.slot)
13651368 ancestorRoot {.used .} = getStateRoot (state)
13661369
13671370 var info: ForkedEpochInfo
@@ -1576,7 +1579,7 @@ func syncCommitteeParticipants*(dag: ChainDAGRef,
15761579 when stateFork >= BeaconStateFork .Altair :
15771580 let
15781581 period = sync_committee_period (slot)
1579- curPeriod = sync_committee_period (state .data.slot)
1582+ curPeriod = sync_committee_period (forkyState .data.slot)
15801583
15811584 if period == curPeriod:
15821585 @ (dag.headSyncCommittees.current_sync_committee)
@@ -1606,7 +1609,7 @@ func getSubcommitteePositions*(
16061609 when stateFork >= BeaconStateFork .Altair :
16071610 let
16081611 period = sync_committee_period (slot)
1609- curPeriod = sync_committee_period (state .data.slot)
1612+ curPeriod = sync_committee_period (forkyState .data.slot)
16101613
16111614 template search (syncCommittee: openArray [ValidatorIndex ]): seq [uint64 ] =
16121615 dag.getSubcommitteePositionsAux (
@@ -1769,7 +1772,7 @@ proc updateHead*(
17691772
17701773 withState (dag.headState):
17711774 when stateFork >= BeaconStateFork .Altair :
1772- dag.headSyncCommittees = state .data.get_sync_committee_cache (cache)
1775+ dag.headSyncCommittees = forkyState .data.get_sync_committee_cache (cache)
17731776
17741777 let
17751778 finalized_checkpoint =
@@ -1822,8 +1825,9 @@ proc updateHead*(
18221825 if not (isNil (dag.onHeadChanged)):
18231826 let
18241827 currentEpoch = epoch (newHead.slot)
1825- depRoot = withState (dag.headState): state.proposer_dependent_root
1826- prevDepRoot = withState (dag.headState): state.attester_dependent_root
1828+ depRoot = withState (dag.headState): forkyState.proposer_dependent_root
1829+ prevDepRoot = withState (dag.headState):
1830+ forkyState.attester_dependent_root
18271831 epochTransition = (finalizedHead != dag.finalizedHead)
18281832 # TODO (cheatfate): Proper implementation required
18291833 data = HeadChangeInfoObject .init (dag.head.slot, dag.head.root,
@@ -1837,7 +1841,7 @@ proc updateHead*(
18371841 # state-related metrics change - notify the validator monitor.
18381842 # Doing this update during head update ensures there's a reasonable number
18391843 # of such updates happening - at most once per valid block.
1840- dag.validatorMonitor[].registerState (state .data)
1844+ dag.validatorMonitor[].registerState (forkyState .data)
18411845
18421846 if finalizedHead != dag.finalizedHead:
18431847 debug " Reached new finalization checkpoint" ,
@@ -2180,10 +2184,10 @@ proc rebuildIndex*(dag: ChainDAGRef) =
21802184 dag.updateFlags).expect (" process_slots shouldn't fail when state slot is correct" )
21812185
21822186 withState (state[]):
2183- dag.db.putState (state )
2187+ dag.db.putState (forkyState )
21842188 dag.db.checkpoint ()
21852189
2186- state_root = state .root
2190+ state_root = forkyState .root
21872191
21882192 # Now that we have states all the way to genesis, we can adjust the tail
21892193 # and readjust the in-memory indices to what they would look like if we had
0 commit comments