@@ -547,47 +547,19 @@ proc installNimbusApiHandlers*(router: var RestRouter, node: BeaconNode) =
547
547
548
548
node.withStateForBlockSlotId(bslot):
549
549
return withState(state):
550
- when consensusFork >= ConsensusFork.Electra:
551
- var proof: HistoricalSummariesProofElectra
552
- if forkyState.data.build_proof(HISTORICAL_SUMMARIES_GINDEX_ELECTRA, proof).isErr:
553
- return RestApiResponse.jsonError(Http500, InvalidMerkleProofIndexError)
554
-
555
- let response = GetHistoricalSummariesV1ResponseElectra(
556
- historical_summaries: forkyState.data.historical_summaries,
557
- proof: proof,
558
- slot: bslot.slot,
559
- )
560
-
561
- if contentType == jsonMediaType:
562
- RestApiResponse.jsonResponseFinalizedWVersion(
563
- response,
564
- node.getStateOptimistic(state),
565
- node.dag.isFinalized(bslot.bid),
566
- consensusFork,
567
- )
568
- elif contentType == sszMediaType:
569
- let headers = [(" eth-consensus-version" , consensusFork.toString())]
570
- RestApiResponse.sszResponse(response, headers)
571
- else :
572
- RestApiResponse.jsonError(Http500, InvalidAcceptError)
573
- elif consensusFork >= ConsensusFork.Capella:
574
- var proof: HistoricalSummariesProof
575
- if forkyState.data.build_proof(HISTORICAL_SUMMARIES_GINDEX, proof).isErr:
576
- return RestApiResponse.jsonError(Http500, InvalidMerkleProofIndexError)
577
-
578
- let response = GetHistoricalSummariesV1Response(
550
+ when consensusFork >= ConsensusFork.Capella:
551
+ let response = consensusFork.GetHistoricalSummariesResponse(
579
552
historical_summaries: forkyState.data.historical_summaries,
580
- proof: proof,
581
- slot: bslot.slot ,
582
- )
553
+ proof: forkyState.data.build_proof(
554
+ consensusFork.historical_summaries_gindex).expect( " Valid gindex " ) ,
555
+ slot: bslot.slot )
583
556
584
557
if contentType == jsonMediaType:
585
558
RestApiResponse.jsonResponseFinalizedWVersion(
586
559
response,
587
560
node.getStateOptimistic(state),
588
561
node.dag.isFinalized(bslot.bid),
589
- consensusFork,
590
- )
562
+ consensusFork)
591
563
elif contentType == sszMediaType:
592
564
let headers = [(" eth-consensus-version" , consensusFork.toString())]
593
565
RestApiResponse.sszResponse(response, headers)
0 commit comments