-
-
Notifications
You must be signed in to change notification settings - Fork 411
feat: mix in blob schedule when calculating fork digest #7954
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
Conversation
Performance Report✔️ no performance regression detected Full benchmark results
|
| unsubscribeSubnetsFromPrevFork(prevFork: ForkName): void { | ||
| this.logger.info("Unsubscribing to random attnets from prev fork", {prevFork}); | ||
| unsubscribeSubnetsBeforeBoundary(boundary: SubscribeBoundary): void { | ||
| this.logger.info("Unsubscribing to random attnets from prev fork", boundary); |
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.logger.info("Unsubscribing to random attnets from prev fork", boundary); | |
| this.logger.info("Unsubscribing to random attnets from prev boundary", boundary); |
|
|
||
| export type MultiaddrStr = string; | ||
| // Boundary of network subscription. We subscribe/unsubscribe during fork and blob schedule transitions | ||
| export type SubscribeBoundary = {fork: ForkName; epoch?: Epoch} | ({fork: ForkName} & BlobScheduleEntry); |
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.
suggest to make it more specific
| export type SubscribeBoundary = {fork: ForkName; epoch?: Epoch} | ({fork: ForkName} & BlobScheduleEntry); | |
| export type SubscribeBoundary = {fork: ForkPreFulu; epoch: Epoch} | ({fork: ForkPostFulu} & BlobScheduleEntry); |
then in both cases we have epoch, then for a lot of interfaces we only need epoch like forkName2ForkDigestHex(epoch): ForkDigestHex
here I suppose we only need to cache by epoch in out config as commented here
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.
here I suppose we only need to cache by epoch in out config as commented #7954 (comment)
We can cache epoch in genesis config but not here.
Reason being SubscribeBoundary resides in GossipTopic, and we need fork info to do something like getGossipSSZType. Sometimes it is hard to get fork info from epoch because a lot of places don't have access to config. It would need some non-trivial refactoring for some places to have access to config
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.
here I suppose we only need to cache by epoch in out config as commented #7954 (comment)
We can cache epoch in genesis config but not here.
Reason being
SubscribeBoundaryresides inGossipTopic, and we need fork info to do something likegetGossipSSZType. Sometimes it is hard to get fork info from epoch because a lot of places don't have access toconfig. It would need some non-trivial refactoring for some places to have access toconfig
There is also one issue with SubscribeBoundary being epoch only, is that when we are in the fulu fork, but before the first BPO fork, fork digest is calculated using ELECTRA_FORK_EPOCH here, but the ssz types still use fulu's. So we need fork info to indicate which fork we are in to derive the ssz type, and epoch to indicate 1) where the boundary is 2) calculate fork digest
packages/reqresp/src/types.ts
Outdated
| | { | ||
| type: ContextBytesType.ForkDigest; | ||
| forkDigestContext: ForkDigestContext; | ||
| fork: ForkName; |
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.
same to the other comment, we only need to add an epoch here to simplify, no need fork and blobSchedule
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 has been moved to ResponseOutgoing
| forkName2ForkDigest(forkName: ForkName): ForkDigest; | ||
| forkName2ForkDigestHex(forkName: ForkName): ForkDigestHex; | ||
| forkName2ForkDigest(forkName: ForkName, blobSchedule: BlobScheduleEntry | null): ForkDigest; | ||
| forkName2ForkDigestHex(forkName: ForkName, blobSchedule: BlobScheduleEntry | null): ForkDigestHex; |
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.
with this enhancement this name is not suitable anymore, maybe just go with getForkDigest(epoch: Epoch): ForkDigest; instead
|
|
||
| function computeForkDigest(currentVersion: Version, genesisValidatorsRoot: Root): ForkDigest { | ||
| return computeForkDataRoot(currentVersion, genesisValidatorsRoot).slice(0, 4); | ||
| function computeForkDigest( |
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.
there are tests for this on the spec test_compute_fork_digest.py, but does not look like we have wired up the spec iterator for those yet
Co-authored-by: Nico Flaig <[email protected]>
Co-authored-by: Nico Flaig <[email protected]>
|
Superseded by #8022 |
ResponseOutgoingto calculate context bytesContext bytes calculation is now based on fork and blob schedule fromProtocolinstead of from chunkSpec: ethereum/consensus-specs#4354