@@ -40,6 +40,7 @@ import {
40
40
VersionMeta ,
41
41
VersionType ,
42
42
} from "../../utils/metadata.js" ;
43
+ import { fromHeaders } from "../../utils/headers.js" ;
43
44
44
45
// See /packages/api/src/routes/index.ts for reasoning and instructions to add new routes
45
46
@@ -856,7 +857,7 @@ export function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoi
856
857
parseReq : ( { query} ) => ( {
857
858
attestationDataRoot : fromHexString ( query . attestation_data_root ) ,
858
859
slot : query . slot ,
859
- committeeIndex : query . slot ,
860
+ committeeIndex : query . committeeIndex ,
860
861
} ) ,
861
862
schema : {
862
863
query : {
@@ -878,7 +879,7 @@ export function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoi
878
879
method : "POST" ,
879
880
req : {
880
881
writeReqJson : ( { signedAggregateAndProofs} ) => {
881
- const fork = config . getForkName ( signedAggregateAndProofs [ 0 ] . message . aggregate . data . slot ) ;
882
+ const fork = config . getForkName ( signedAggregateAndProofs [ 0 ] ? .message . aggregate . data . slot ?? 0 ) ;
882
883
return {
883
884
body :
884
885
ForkSeq [ fork ] >= ForkSeq . electra
@@ -892,7 +893,16 @@ export function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoi
892
893
} ;
893
894
} ,
894
895
parseReqJson : ( { body, headers} ) => {
895
- const fork = toForkName ( headers [ MetaHeader . Version ] ) ;
896
+ const versionHeader = fromHeaders ( headers , MetaHeader . Version , false ) ;
897
+ const fork =
898
+ versionHeader !== undefined
899
+ ? toForkName ( versionHeader )
900
+ : config . getForkName (
901
+ Number (
902
+ ( body as { message : { aggregate : { data : { slot : string } } } } [ ] ) [ 0 ] ?. message . aggregate . data . slot ?? 0
903
+ )
904
+ ) ;
905
+
896
906
return {
897
907
signedAggregateAndProofs :
898
908
ForkSeq [ fork ] >= ForkSeq . electra
@@ -901,7 +911,7 @@ export function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoi
901
911
} ;
902
912
} ,
903
913
writeReqSsz : ( { signedAggregateAndProofs} ) => {
904
- const fork = config . getForkName ( signedAggregateAndProofs [ 0 ] . message . aggregate . data . slot ) ;
914
+ const fork = config . getForkName ( signedAggregateAndProofs [ 0 ] ? .message . aggregate . data . slot ?? 0 ) ;
905
915
return {
906
916
body :
907
917
ForkSeq [ fork ] >= ForkSeq . electra
@@ -915,7 +925,8 @@ export function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoi
915
925
} ;
916
926
} ,
917
927
parseReqSsz : ( { body, headers} ) => {
918
- const fork = toForkName ( headers [ MetaHeader . Version ] ) ;
928
+ const versionHeader = fromHeaders ( headers , MetaHeader . Version , true ) ;
929
+ const fork = toForkName ( versionHeader ) ;
919
930
return {
920
931
signedAggregateAndProofs :
921
932
ForkSeq [ fork ] >= ForkSeq . electra
0 commit comments