@@ -147,8 +147,10 @@ fn ProcessEth1DataResetBench(comptime fork: ForkSeq) type {
147147 cloned .deinit ();
148148 allocator .destroy (cloned );
149149 }
150+
150151 var cache = EpochTransitionCache .init (allocator , cloned .config , cloned .getEpochCache (), cloned .state ) catch unreachable ;
151152 defer cache .deinit ();
153+
152154 state_transition .processEth1DataReset (
153155 fork ,
154156 cloned .state .castToFork (fork ),
@@ -168,8 +170,10 @@ fn ProcessPendingDepositsBench(comptime fork: ForkSeq) type {
168170 cloned .deinit ();
169171 allocator .destroy (cloned );
170172 }
173+
171174 var cache = EpochTransitionCache .init (allocator , cloned .config , cloned .getEpochCache (), cloned .state ) catch unreachable ;
172175 defer cache .deinit ();
176+
173177 state_transition .processPendingDeposits (
174178 fork ,
175179 allocator ,
@@ -192,8 +196,10 @@ fn ProcessPendingConsolidationsBench(comptime fork: ForkSeq) type {
192196 cloned .deinit ();
193197 allocator .destroy (cloned );
194198 }
199+
195200 var cache = EpochTransitionCache .init (allocator , cloned .config , cloned .getEpochCache (), cloned .state ) catch unreachable ;
196201 defer cache .deinit ();
202+
197203 state_transition .processPendingConsolidations (
198204 fork ,
199205 cloned .getEpochCache (),
@@ -214,8 +220,10 @@ fn ProcessEffectiveBalanceUpdatesBench(comptime fork: ForkSeq) type {
214220 cloned .deinit ();
215221 allocator .destroy (cloned );
216222 }
223+
217224 var cache = EpochTransitionCache .init (allocator , cloned .config , cloned .getEpochCache (), cloned .state ) catch unreachable ;
218225 defer cache .deinit ();
226+
219227 _ = state_transition .processEffectiveBalanceUpdates (
220228 fork ,
221229 allocator ,
@@ -237,8 +245,10 @@ fn ProcessSlashingsResetBench(comptime fork: ForkSeq) type {
237245 cloned .deinit ();
238246 allocator .destroy (cloned );
239247 }
248+
240249 var cache = EpochTransitionCache .init (allocator , cloned .config , cloned .getEpochCache (), cloned .state ) catch unreachable ;
241250 defer cache .deinit ();
251+
242252 state_transition .processSlashingsReset (
243253 fork ,
244254 cloned .getEpochCache (),
@@ -259,8 +269,10 @@ fn ProcessRandaoMixesResetBench(comptime fork: ForkSeq) type {
259269 cloned .deinit ();
260270 allocator .destroy (cloned );
261271 }
272+
262273 var cache = EpochTransitionCache .init (allocator , cloned .config , cloned .getEpochCache (), cloned .state ) catch unreachable ;
263274 defer cache .deinit ();
275+
264276 state_transition .processRandaoMixesReset (
265277 fork ,
266278 cloned .state .castToFork (fork ),
@@ -280,8 +292,10 @@ fn ProcessHistoricalSummariesUpdateBench(comptime fork: ForkSeq) type {
280292 cloned .deinit ();
281293 allocator .destroy (cloned );
282294 }
295+
283296 var cache = EpochTransitionCache .init (allocator , cloned .config , cloned .getEpochCache (), cloned .state ) catch unreachable ;
284297 defer cache .deinit ();
298+
285299 state_transition .processHistoricalSummariesUpdate (
286300 fork ,
287301 cloned .state .castToFork (fork ),
@@ -301,6 +315,7 @@ fn ProcessParticipationFlagUpdatesBench(comptime fork: ForkSeq) type {
301315 cloned .deinit ();
302316 allocator .destroy (cloned );
303317 }
318+
304319 state_transition .processParticipationFlagUpdates (
305320 fork ,
306321 cloned .state .castToFork (fork ),
@@ -319,6 +334,7 @@ fn ProcessSyncCommitteeUpdatesBench(comptime fork: ForkSeq) type {
319334 cloned .deinit ();
320335 allocator .destroy (cloned );
321336 }
337+
322338 state_transition .processSyncCommitteeUpdates (
323339 fork ,
324340 allocator ,
@@ -339,8 +355,10 @@ fn ProcessProposerLookaheadBench(comptime fork: ForkSeq) type {
339355 cloned .deinit ();
340356 allocator .destroy (cloned );
341357 }
358+
342359 var cache = EpochTransitionCache .init (allocator , cloned .config , cloned .getEpochCache (), cloned .state ) catch unreachable ;
343360 defer cache .deinit ();
361+
344362 state_transition .processProposerLookahead (
345363 fork ,
346364 allocator ,
@@ -609,6 +627,7 @@ fn ProcessEpochSegmentedBench(comptime fork: ForkSeq) type {
609627pub fn main () ! void {
610628 var gpa : std .heap .DebugAllocator (.{}) = .init ;
611629 defer std .debug .assert (gpa .deinit () == .ok );
630+
612631 const allocator = gpa .allocator ();
613632 const stdout = std .io .getStdOut ().writer ();
614633 var pool = try Node .Pool .init (allocator , 10_000_000 );
@@ -653,11 +672,13 @@ fn runBenchmark(
653672 chain_config : config.ChainConfig ,
654673) ! void {
655674 defer state_transition .deinitStateTransition ();
675+
656676 var beacon_state : ? * AnyBeaconState = try loadState (fork , allocator , pool , state_bytes );
657677 defer if (beacon_state ) | state | {
658678 state .deinit ();
659679 allocator .destroy (state );
660680 };
681+
661682 try stdout .print ("State deserialized: slot={}, validators={}\n " , .{
662683 try beacon_state .? .slot (),
663684 try beacon_state .? .validatorsCount (),
@@ -667,6 +688,7 @@ fn runBenchmark(
667688
668689 const pubkey_index_map = try PubkeyIndexMap .init (allocator );
669690 defer pubkey_index_map .deinit ();
691+
670692 const index_pubkey_cache = try allocator .create (state_transition .Index2PubkeyCache );
671693 index_pubkey_cache .* = state_transition .Index2PubkeyCache .init (allocator );
672694 defer {
0 commit comments