-
-
Notifications
You must be signed in to change notification settings - Fork 331
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
Replace findAttesterDependentRoot with getDependantRoot #4555
Conversation
Performance Report✔️ no performance regression detected Full benchmark results
|
|
||
// Special case close to genesis block, return the genesis block root | ||
if (beforeSlot <= 0) { | ||
const genesisBlock = this.protoArray.nodes[0]; |
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.
If that's the usage may be we make the getNodeFromIndex function public and then use it 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.
Yes, but getNodeFromIndex
would throw PROTO_ARRAY_ERROR_INVALID_NODE_INDEX
, while this implementation would throw Genesis block not available
, which would be much easier to debug if a user reports. Would prefer to stick to this one-line re-implementation, as it's quite peculiar use of the nodes array
dependant -> dependent |
@wemeetagain @dapplion Interesting information. Seems both are valid spellings. |
Motivation
Generalize logic from
findAttesterDependentRoot
to work for both proposer and attester dependant root computation. To be used latter in API implDescription