Skip to content

Commit 8e423e7

Browse files
authored
fix: revert BlobSidecarsByRoot/Range version bump (#7347)
* fix: revert BlobSidecarsByRoot/Range version bump * Remove version check from handler * Remove unused imports
1 parent 4d271ff commit 8e423e7

File tree

4 files changed

+5
-37
lines changed

4 files changed

+5
-37
lines changed

packages/beacon-node/src/network/network.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {PeerId} from "@libp2p/interface";
44
import {routes} from "@lodestar/api";
55
import {BeaconConfig} from "@lodestar/config";
66
import {LoggerNode} from "@lodestar/logger/node";
7-
import {ForkSeq, isForkPostElectra} from "@lodestar/params";
7+
import {ForkSeq} from "@lodestar/params";
88
import {ResponseIncoming} from "@lodestar/reqresp";
99
import {computeStartSlotAtEpoch, computeTimeAtSlot} from "@lodestar/state-transition";
1010
import {
@@ -504,27 +504,16 @@ export class Network implements INetwork {
504504
): Promise<deneb.BlobSidecar[]> {
505505
const fork = this.config.getForkName(request.startSlot);
506506
return collectMaxResponseTyped(
507-
this.sendReqRespRequest(
508-
peerId,
509-
ReqRespMethod.BlobSidecarsByRange,
510-
[isForkPostElectra(fork) ? Version.V2 : Version.V1],
511-
request
512-
),
507+
this.sendReqRespRequest(peerId, ReqRespMethod.BlobSidecarsByRange, [Version.V1], request),
513508
// request's count represent the slots, so the actual max count received could be slots * blobs per slot
514509
request.count * this.config.getMaxBlobsPerBlock(fork),
515510
responseSszTypeByMethod[ReqRespMethod.BlobSidecarsByRange]
516511
);
517512
}
518513

519514
async sendBlobSidecarsByRoot(peerId: PeerIdStr, request: BlobSidecarsByRootRequest): Promise<deneb.BlobSidecar[]> {
520-
const fork = this.config.getForkName(this.clock.currentSlot);
521515
return collectMaxResponseTyped(
522-
this.sendReqRespRequest(
523-
peerId,
524-
ReqRespMethod.BlobSidecarsByRoot,
525-
[isForkPostElectra(fork) ? Version.V2 : Version.V1],
526-
request
527-
),
516+
this.sendReqRespRequest(peerId, ReqRespMethod.BlobSidecarsByRoot, [Version.V1], request),
528517
request.length,
529518
responseSszTypeByMethod[ReqRespMethod.BlobSidecarsByRoot]
530519
);

packages/beacon-node/src/network/reqresp/ReqRespBeaconNode.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -252,20 +252,12 @@ export class ReqRespBeaconNode extends ReqResp {
252252
}
253253

254254
if (ForkSeq[fork] >= ForkSeq.deneb) {
255-
// TODO Electra: Consider deprecating BlobSidecarsByRootV1 and BlobSidecarsByRangeV1 at fork boundary or after Electra is stable
256255
protocolsAtFork.push(
257256
[protocols.BlobSidecarsByRoot(this.config), this.getHandler(ReqRespMethod.BlobSidecarsByRoot)],
258257
[protocols.BlobSidecarsByRange(this.config), this.getHandler(ReqRespMethod.BlobSidecarsByRange)]
259258
);
260259
}
261260

262-
if (ForkSeq[fork] >= ForkSeq.electra) {
263-
protocolsAtFork.push(
264-
[protocols.BlobSidecarsByRootV2(this.config), this.getHandler(ReqRespMethod.BlobSidecarsByRoot)],
265-
[protocols.BlobSidecarsByRangeV2(this.config), this.getHandler(ReqRespMethod.BlobSidecarsByRange)]
266-
);
267-
}
268-
269261
return protocolsAtFork;
270262
}
271263

packages/beacon-node/src/network/reqresp/handlers/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import {ForkName} from "@lodestar/params";
21
import {ProtocolHandler} from "@lodestar/reqresp";
32
import {ssz} from "@lodestar/types";
43
import {IBeaconChain} from "../../../chain/index.js";
54
import {IBeaconDb} from "../../../db/index.js";
65
import {BlobSidecarsByRootRequestType} from "../../../util/types.js";
7-
import {GetReqRespHandlerFn, ReqRespMethod, Version} from "../types.js";
6+
import {GetReqRespHandlerFn, ReqRespMethod} from "../types.js";
87
import {onBeaconBlocksByRange} from "./beaconBlocksByRange.js";
98
import {onBeaconBlocksByRoot} from "./beaconBlocksByRoot.js";
109
import {onBlobSidecarsByRange} from "./blobSidecarsByRange.js";
@@ -39,7 +38,7 @@ export function getReqRespHandlers({db, chain}: {db: IBeaconDb; chain: IBeaconCh
3938
return onBeaconBlocksByRoot(body, chain, db);
4039
},
4140
[ReqRespMethod.BlobSidecarsByRoot]: (req) => {
42-
const fork = req.version === Version.V2 ? ForkName.electra : ForkName.deneb;
41+
const fork = chain.config.getForkName(chain.clock.currentSlot);
4342
const body = BlobSidecarsByRootRequestType(fork, chain.config).deserialize(req.data);
4443
return onBlobSidecarsByRoot(body, chain, db);
4544
},

packages/beacon-node/src/network/reqresp/protocols.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,24 +63,12 @@ export const BlobSidecarsByRange = toProtocol({
6363
contextBytesType: ContextBytesType.ForkDigest,
6464
});
6565

66-
export const BlobSidecarsByRangeV2 = toProtocol({
67-
method: ReqRespMethod.BlobSidecarsByRange,
68-
version: Version.V2,
69-
contextBytesType: ContextBytesType.ForkDigest,
70-
});
71-
7266
export const BlobSidecarsByRoot = toProtocol({
7367
method: ReqRespMethod.BlobSidecarsByRoot,
7468
version: Version.V1,
7569
contextBytesType: ContextBytesType.ForkDigest,
7670
});
7771

78-
export const BlobSidecarsByRootV2 = toProtocol({
79-
method: ReqRespMethod.BlobSidecarsByRoot,
80-
version: Version.V2,
81-
contextBytesType: ContextBytesType.ForkDigest,
82-
});
83-
8472
export const LightClientBootstrap = toProtocol({
8573
method: ReqRespMethod.LightClientBootstrap,
8674
version: Version.V1,

0 commit comments

Comments
 (0)