@@ -24,15 +24,14 @@ import
2424 chronicles, metrics,
2525 ../ extras,
2626 ./ datatypes/ [phase0, altair, merge],
27- " ." / [beaconstate, eth2_merkleization, helpers, validator, signatures],
28- ../../ nbench/ bench_lab
27+ " ." / [beaconstate, eth2_merkleization, helpers, validator, signatures]
2928
3029export extras, phase0, altair
3130
3231# https://github.com/ethereum/consensus-specs/blob/v1.1.5/specs/phase0/beacon-chain.md#block-header
3332func process_block_header * (
3433 state: var ForkyBeaconState , blck: SomeSomeBeaconBlock , flags: UpdateFlags ,
35- cache: var StateCache ): Result [void , cstring ] {. nbench .} =
34+ cache: var StateCache ): Result [void , cstring ] =
3635 # Verify that the slots match
3736 if not (blck.slot == state.slot):
3837 return err (" process_block_header: slot mismatch" )
@@ -75,7 +74,7 @@ func `xor`[T: array](a, b: T): T =
7574# https://github.com/ethereum/consensus-specs/blob/v1.1.5/specs/phase0/beacon-chain.md#randao
7675proc process_randao (
7776 state: var ForkyBeaconState , body: SomeSomeBeaconBlockBody , flags: UpdateFlags ,
78- cache: var StateCache ): Result [void , cstring ] {. nbench .} =
77+ cache: var StateCache ): Result [void , cstring ] =
7978 let
8079 proposer_index = get_beacon_proposer_index (state, cache)
8180
@@ -106,7 +105,7 @@ proc process_randao(
106105 ok ()
107106
108107# https://github.com/ethereum/consensus-specs/blob/v1.1.5/specs/phase0/beacon-chain.md#eth1-data
109- func process_eth1_data (state: var ForkyBeaconState , body: SomeSomeBeaconBlockBody ): Result [void , cstring ] {. nbench .} =
108+ func process_eth1_data (state: var ForkyBeaconState , body: SomeSomeBeaconBlockBody ): Result [void , cstring ]=
110109 if not state.eth1_data_votes.add body.eth1_data:
111110 # Count is reset in process_final_updates, so this should never happen
112111 return err (" process_eth1_data: no more room for eth1 data" )
@@ -127,7 +126,7 @@ func is_slashable_validator(validator: Validator, epoch: Epoch): bool =
127126proc check_proposer_slashing * (
128127 state: var ForkyBeaconState , proposer_slashing: SomeProposerSlashing ,
129128 flags: UpdateFlags ):
130- Result [void , cstring ] {. nbench .} =
129+ Result [void , cstring ] =
131130
132131 let
133132 header_1 = proposer_slashing.signed_header_1.message
@@ -177,7 +176,7 @@ proc process_proposer_slashing*(
177176 cfg: RuntimeConfig , state: var ForkyBeaconState ,
178177 proposer_slashing: SomeProposerSlashing , flags: UpdateFlags ,
179178 cache: var StateCache ):
180- Result [void , cstring ] {. nbench .} =
179+ Result [void , cstring ] =
181180 ? check_proposer_slashing (state, proposer_slashing, flags)
182181 slash_validator (
183182 cfg, state,
@@ -202,7 +201,7 @@ proc check_attester_slashing*(
202201 state: var ForkyBeaconState ,
203202 attester_slashing: SomeAttesterSlashing ,
204203 flags: UpdateFlags
205- ): Result [seq [ValidatorIndex ], cstring ] {. nbench .} =
204+ ): Result [seq [ValidatorIndex ], cstring ] =
206205 let
207206 attestation_1 = attester_slashing.attestation_1
208207 attestation_2 = attester_slashing.attestation_2
@@ -244,7 +243,7 @@ proc process_attester_slashing*(
244243 attester_slashing: SomeAttesterSlashing ,
245244 flags: UpdateFlags ,
246245 cache: var StateCache
247- ): Result [void , cstring ] {. nbench .} =
246+ ): Result [void , cstring ] =
248247 let attester_slashing_validity =
249248 check_attester_slashing (state, attester_slashing, flags)
250249
@@ -259,7 +258,7 @@ proc process_attester_slashing*(
259258proc process_deposit * (cfg: RuntimeConfig ,
260259 state: var ForkyBeaconState ,
261260 deposit: Deposit ,
262- flags: UpdateFlags ): Result [void , cstring ] {. nbench .} =
261+ flags: UpdateFlags ): Result [void , cstring ] =
263262 # # Process an Eth1 deposit, registering a validator or increasing its balance.
264263
265264 # Verify the Merkle branch
@@ -328,7 +327,7 @@ proc check_voluntary_exit*(
328327 cfg: RuntimeConfig ,
329328 state: ForkyBeaconState ,
330329 signed_voluntary_exit: SomeSignedVoluntaryExit ,
331- flags: UpdateFlags ): Result [void , cstring ] {. nbench .} =
330+ flags: UpdateFlags ): Result [void , cstring ] =
332331
333332 let voluntary_exit = signed_voluntary_exit.message
334333
@@ -389,7 +388,7 @@ proc process_voluntary_exit*(
389388 state: var ForkyBeaconState ,
390389 signed_voluntary_exit: SomeSignedVoluntaryExit ,
391390 flags: UpdateFlags ,
392- cache: var StateCache ): Result [void , cstring ] {. nbench .} =
391+ cache: var StateCache ): Result [void , cstring ] =
393392 ? check_voluntary_exit (cfg, state, signed_voluntary_exit, flags)
394393 initiate_validator_exit (
395394 cfg, state, signed_voluntary_exit.message.validator_index.ValidatorIndex ,
@@ -402,7 +401,7 @@ proc process_operations(cfg: RuntimeConfig,
402401 body: SomeSomeBeaconBlockBody ,
403402 base_reward_per_increment: Gwei ,
404403 flags: UpdateFlags ,
405- cache: var StateCache ): Result [void , cstring ] {. nbench .} =
404+ cache: var StateCache ): Result [void , cstring ] =
406405 # Verify that outstanding deposits are processed up to the maximum number of
407406 # deposits
408407 let
@@ -430,7 +429,7 @@ proc process_operations(cfg: RuntimeConfig,
430429proc process_sync_aggregate * (
431430 state: var (altair.BeaconState | merge.BeaconState ),
432431 aggregate: SomeSyncAggregate , total_active_balance: Gwei , cache: var StateCache ):
433- Result [void , cstring ] {. nbench .} =
432+ Result [void , cstring ] =
434433 # Verify sync committee aggregate signature signing over the previous slot
435434 # block root
436435 let
@@ -491,7 +490,7 @@ proc process_sync_aggregate*(
491490# https://github.com/ethereum/consensus-specs/blob/v1.1.4/specs/merge/beacon-chain.md#process_execution_payload
492491proc process_execution_payload * (
493492 state: var merge.BeaconState , payload: ExecutionPayload ,
494- execute_payload: ExecutePayload ): Result [void , cstring ] {. nbench .} =
493+ execute_payload: ExecutePayload ): Result [void , cstring ] =
495494 # # Verify consistency of the parent hash with respect to the previous
496495 # # execution payload header
497496 if is_merge_complete (state):
@@ -537,7 +536,7 @@ type SomePhase0Block =
537536proc process_block * (
538537 cfg: RuntimeConfig ,
539538 state: var phase0.BeaconState , blck: SomePhase0Block , flags: UpdateFlags ,
540- cache: var StateCache ): Result [void , cstring ] {. nbench .} =
539+ cache: var StateCache ): Result [void , cstring ]=
541540 # # When there's a new block, we need to verify that the block is sane and
542541 # # update the state accordingly - the state is left in an unknown state when
543542 # # block application fails (!)
@@ -552,13 +551,13 @@ proc process_block*(
552551proc process_block * (
553552 cfg: RuntimeConfig ,
554553 state: var altair.BeaconState , blck: SomePhase0Block , flags: UpdateFlags ,
555- cache: var StateCache ): Result [void , cstring ] {. nbench .} =
554+ cache: var StateCache ): Result [void , cstring ] =
556555 err (" process_block: Altair state with Phase 0 block" )
557556
558557proc process_block * (
559558 cfg: RuntimeConfig ,
560559 state: var merge.BeaconState , blck: SomePhase0Block , flags: UpdateFlags ,
561- cache: var StateCache ): Result [void , cstring ] {. nbench .} =
560+ cache: var StateCache ): Result [void , cstring ] =
562561 err (" process_block: Merge state with Phase 0 block" )
563562
564563# https://github.com/ethereum/consensus-specs/blob/v1.1.5/specs/altair/beacon-chain.md#block-processing
@@ -569,7 +568,7 @@ type SomeAltairBlock =
569568proc process_block * (
570569 cfg: RuntimeConfig ,
571570 state: var altair.BeaconState , blck: SomeAltairBlock , flags: UpdateFlags ,
572- cache: var StateCache ): Result [void , cstring ] {. nbench .} =
571+ cache: var StateCache ): Result [void , cstring ]=
573572 # # When there's a new block, we need to verify that the block is sane and
574573 # # update the state accordingly - the state is left in an unknown state when
575574 # # block application fails (!)
@@ -596,7 +595,7 @@ type SomeMergeBlock =
596595proc process_block * (
597596 cfg: RuntimeConfig ,
598597 state: var merge.BeaconState , blck: SomeMergeBlock , flags: UpdateFlags ,
599- cache: var StateCache ): Result [void , cstring ] {. nbench .} =
598+ cache: var StateCache ): Result [void , cstring ]=
600599 # # When there's a new block, we need to verify that the block is sane and
601600 # # update the state accordingly - the state is left in an unknown state when
602601 # # block application fails (!)
@@ -624,23 +623,23 @@ proc process_block*(
624623proc process_block * (
625624 cfg: RuntimeConfig ,
626625 state: var phase0.BeaconState , blck: SomeAltairBlock , flags: UpdateFlags ,
627- cache: var StateCache ): Result [void , cstring ] {. nbench .} =
626+ cache: var StateCache ): Result [void , cstring ]=
628627 err (" process_block: Phase 0 state with Altair block" )
629628
630629proc process_block * (
631630 cfg: RuntimeConfig ,
632631 state: var phase0.BeaconState , blck: SomeMergeBlock , flags: UpdateFlags ,
633- cache: var StateCache ): Result [void , cstring ] {. nbench .} =
632+ cache: var StateCache ): Result [void , cstring ]=
634633 err (" process_block: Phase 0 state with Merge block" )
635634
636635proc process_block * (
637636 cfg: RuntimeConfig ,
638637 state: var altair.BeaconState , blck: SomeMergeBlock , flags: UpdateFlags ,
639- cache: var StateCache ): Result [void , cstring ] {. nbench .} =
638+ cache: var StateCache ): Result [void , cstring ]=
640639 err (" process_block: Altair state with Merge block" )
641640
642641proc process_block * (
643642 cfg: RuntimeConfig ,
644643 state: var merge.BeaconState , blck: SomeAltairBlock , flags: UpdateFlags ,
645- cache: var StateCache ): Result [void , cstring ] {. nbench .} =
644+ cache: var StateCache ): Result [void , cstring ]=
646645 err (" process_block: Merge state with Altair block" )
0 commit comments