Skip to content

Commit

Permalink
Add reqresp v2 definition
Browse files Browse the repository at this point in the history
  • Loading branch information
ensi321 committed Dec 17, 2024
1 parent 13d6448 commit a8d9f73
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/beacon-node/src/network/reqresp/ReqRespBeaconNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,13 @@ export class ReqRespBeaconNode extends ReqResp {
);
}

if (ForkSeq[fork] >= ForkSeq.electra) {
protocolsAtFork.push(
[protocols.BlobSidecarsByRootV2(this.config), this.getHandler(ReqRespMethod.BlobSidecarsByRoot)],
[protocols.BlobSidecarsByRangeV2(this.config), this.getHandler(ReqRespMethod.BlobSidecarsByRange)]
);
}

return protocolsAtFork;
}

Expand Down
12 changes: 12 additions & 0 deletions packages/beacon-node/src/network/reqresp/protocols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,24 @@ export const BlobSidecarsByRange = toProtocol({
contextBytesType: ContextBytesType.ForkDigest,
});

export const BlobSidecarsByRangeV2 = toProtocol({
method: ReqRespMethod.BlobSidecarsByRange,
version: Version.V2,
contextBytesType: ContextBytesType.ForkDigest,
});

export const BlobSidecarsByRoot = toProtocol({
method: ReqRespMethod.BlobSidecarsByRoot,
version: Version.V1,
contextBytesType: ContextBytesType.ForkDigest,
});

export const BlobSidecarsByRootV2 = toProtocol({
method: ReqRespMethod.BlobSidecarsByRoot,
version: Version.V2,
contextBytesType: ContextBytesType.ForkDigest,
});

export const LightClientBootstrap = toProtocol({
method: ReqRespMethod.LightClientBootstrap,
version: Version.V1,
Expand Down

0 comments on commit a8d9f73

Please sign in to comment.