-
-
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?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## devnet-5 #7309 +/- ##
============================================
- Coverage 48.61% 48.60% -0.01%
============================================
Files 603 604 +1
Lines 40457 40516 +59
Branches 2065 2065
============================================
+ Hits 19667 19694 +27
- Misses 20752 20784 +32
Partials 38 38 |
Please ignore E2E Tests and spec tests as they will be addressed in the next PR. |
@@ -501,17 +501,30 @@ export class Network implements INetwork { | |||
peerId: PeerIdStr, | |||
request: deneb.BlobSidecarsByRangeRequest | |||
): Promise<deneb.BlobSidecar[]> { | |||
const fork = this.config.getForkName(this.clock.currentSlot); |
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.
need to check if it's correct to use clock slot here, what if we range sync and wanna get deneb blob sidecars but clock slot is already electra?
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.
Good catch. I think we should use request.startSlot
here. And if the request start slot is in deneb but the end slot is in electra, we still want to send out V1.
): Promise<void> { | ||
const blobSlot = blobSidecar.signedBlockHeader.message.slot; | ||
|
||
// [REJECT] The sidecar's index is consistent with `MAX_BLOBS_PER_BLOCK` -- i.e. `blob_sidecar.index < MAX_BLOBS_PER_BLOCK`. | ||
if (blobSidecar.index >= chain.config.MAX_BLOBS_PER_BLOCK) { | ||
const maxBlobsPerBlock = isForkPostElectra(fork) |
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.
Assigning maxBlobsPerBlock
is done in multiple places, we could think about adding a helper for that as there will be likely more values in the future since we intend to bump the blob count further (likely in the next hard fork)
Maybe something similar to what the CL spec uses in their tests get_max_blob_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.
Added constantsHelper.ts
for the purpose of reducing number of conditional assignments in the codebase.
Can expand the scope of constantsHelper
to outside of blobs in another PR
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.
I wonder if those could just be part of ChainForkConfig
, like config.getForkName()
and only take in the fork
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.
- refactor: move helper to get max blobs per block to fork config #7322 (to see comparison in terms of semantics)
return isForkPostElectra(fork) ? config.MAX_BLOBS_PER_BLOCK_ELECTRA : config.MAX_BLOBS_PER_BLOCK; | ||
} | ||
|
||
export function getBlobSidecarSubnetCount(fork: ForkName, config: ChainConfig): number { |
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.
This isn't really used much compared to max blob per blob, also will likely go away with peerdas, might get away with not adding a helper
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.
I removed this in my PR #7322 as it's already pretty encapsulated where it is used
this.sendReqRespRequest( | ||
peerId, | ||
ReqRespMethod.BlobSidecarsByRoot, | ||
[isForkPostElectra(fork) ? Version.V2 : Version.V1], |
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?
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
we need this for v1/v2?
@@ -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 comment
The 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?
@@ -255,11 +255,11 @@ export const BLOB_TX_TYPE = 0x03; | |||
export const VERSIONED_HASH_VERSION_KZG = 0x01; | |||
|
|||
// ssz.deneb.BeaconBlockBody.getPathInfo(['blobKzgCommitments',0]).gindex | |||
export const KZG_COMMITMENT_GINDEX0 = ACTIVE_PRESET === PresetName.minimal ? 864 : 221184; | |||
export const KZG_COMMITMENT_GINDEX0 = ACTIVE_PRESET === PresetName.minimal ? 1728 : 221184; |
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.
this changed for electra or was the value incorrect? then gindex0 constant needs to be forkaware
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.
in the spec PR the minimal preset values for deneb were changed here, I thought you have to add new constants for that but apparently not
but agree the gindex should be fork aware
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.
then this will break the current deneb minimal devnets
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.
ahh because we retrospectively changed deneb max vals, sounds very random to me to do (in spec)
Implement EIP-7691.
Outstanding items that is not covered in this PR:
requestSszTypeByMethod
to provide fork infoInboundRateLimitQuota
fork-aware sobyPeer
limit can be correctly set forBlobSidecarsByRange
andBlobSidecarsByRoot
.ReqRespRateLimiter
to re-set the rate limit on fork activation