-
-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: implement EIP-7691 increase blob throughput #7309
base: devnet-5
Are you sure you want to change the base?
Changes from 20 commits
13d6448
a8d9f73
e6984f4
6b48588
1722971
f031dc3
a8f34b8
d3361b4
ebc2aae
7a51d37
13ad885
2c68274
c22f78b
aa8a218
41be261
1c2b5ed
a267c34
e813294
744c0be
760fbb8
8a49542
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -207,7 +207,8 @@ export class ReqRespBeaconNode extends ReqResp { | |
versions: number[], | ||
request: Req | ||
): AsyncIterable<ResponseIncoming> { | ||
const requestType = requestSszTypeByMethod(this.config)[method]; | ||
const fork = ForkName[ForkSeq[this.currentRegisteredFork] as keyof typeof ForkName]; | ||
const requestType = requestSszTypeByMethod(this.config, fork)[method]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we need this for v1/v2? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, request type for BlobSidecarsByRootV2 has changed. But |
||
const requestData = requestType ? requestType.serialize(request as never) : new Uint8Array(); | ||
return this.sendRequestWithoutEncoding(peerId, method, versions, requestData); | ||
} | ||
|
@@ -251,12 +252,20 @@ export class ReqRespBeaconNode extends ReqResp { | |
} | ||
|
||
if (ForkSeq[fork] >= ForkSeq.deneb) { | ||
// TODO Electra: Consider deprecating BlobSidecarsByRootV1 and BlobSidecarsByRangeV1 at fork boundary or after Electra is stable | ||
protocolsAtFork.push( | ||
[protocols.BlobSidecarsByRoot(this.config), this.getHandler(ReqRespMethod.BlobSidecarsByRoot)], | ||
[protocols.BlobSidecarsByRange(this.config), this.getHandler(ReqRespMethod.BlobSidecarsByRange)] | ||
); | ||
} | ||
|
||
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; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import {ForkName} from "@lodestar/params"; | ||
import {ProtocolHandler} from "@lodestar/reqresp"; | ||
import {ssz} from "@lodestar/types"; | ||
import {IBeaconChain} from "../../../chain/index.js"; | ||
import {IBeaconDb} from "../../../db/index.js"; | ||
import {BlobSidecarsByRootRequestType} from "../../../util/types.js"; | ||
import {GetReqRespHandlerFn, ReqRespMethod} from "../types.js"; | ||
import {GetReqRespHandlerFn, ReqRespMethod, Version} from "../types.js"; | ||
import {onBeaconBlocksByRange} from "./beaconBlocksByRange.js"; | ||
import {onBeaconBlocksByRoot} from "./beaconBlocksByRoot.js"; | ||
import {onBlobSidecarsByRange} from "./blobSidecarsByRange.js"; | ||
|
@@ -38,7 +39,8 @@ export function getReqRespHandlers({db, chain}: {db: IBeaconDb; chain: IBeaconCh | |
return onBeaconBlocksByRoot(body, chain, db); | ||
}, | ||
[ReqRespMethod.BlobSidecarsByRoot]: (req) => { | ||
const body = BlobSidecarsByRootRequestType(chain.config).deserialize(req.data); | ||
const fork = req.version === Version.V2 ? ForkName.electra : ForkName.deneb; | ||
const body = BlobSidecarsByRootRequestType(fork, chain.config).deserialize(req.data); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wouldn't type be the same just that v2 will have context bytes/fork type? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. V2 accepts higher number of blob requests so the ssz container is different. |
||
return onBlobSidecarsByRoot(body, chain, db); | ||
}, | ||
[ReqRespMethod.BlobSidecarsByRange]: (req) => { | ||
|
nflaig marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import {ForkName, isForkPostElectra} from "@lodestar/params"; | ||
import {ChainConfig} from "./index.js"; | ||
/** | ||
* A collection of functions that retrieve the correct config/preset constants from the given hard fork | ||
*/ | ||
|
||
export function getMaxBlobsPerBlock(fork: ForkName, config: ChainConfig): number { | ||
return isForkPostElectra(fork) ? config.MAX_BLOBS_PER_BLOCK_ELECTRA : config.MAX_BLOBS_PER_BLOCK; | ||
} | ||
|
||
export function getBlobSidecarSubnetCount(fork: ForkName, config: ChainConfig): number { | ||
nflaig marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return isForkPostElectra(fork) ? config.BLOB_SIDECAR_SUBNET_COUNT_ELECTRA : config.BLOB_SIDECAR_SUBNET_COUNT; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whats different in v2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Max size of the param in V1 is
MAX_REQUEST_BLOB_SIDECARS
(768) , V2 isMAX_REQUEST_BLOB_SIDECARS_ELECTRA
(1152)