Skip to content
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

Add Aggregated Public Key Method #14178

Merged
merged 5 commits into from
Jul 8, 2024
Merged

Add Aggregated Public Key Method #14178

merged 5 commits into from
Jul 8, 2024

Conversation

nisdas
Copy link
Member

@nisdas nisdas commented Jul 3, 2024

What type of PR is this?

Optimization

What does this PR do? Why is it needed?

Currently for each attestation aggregate we allocate memory for each individual public key when trying to derive the aggregated key. To optimize this process we simply collect all the keys in the state's receiver and aggregate it there itself. The main benefit of this is to completely avoid memory-allocation in a known hot-path in gossip.

Which issues(s) does this PR fix?

N.A

Other notes for review

@nisdas nisdas added the Ready For Review A pull request ready for code review label Jul 3, 2024
@nisdas nisdas requested a review from a team as a code owner July 3, 2024 08:49
pubKeys := make([][]byte, len(idxs))
for i, idx := range idxs {
var v *ethpb.Validator
if features.Get().EnableExperimentalState {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This case is not tested at all, is it expected?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its fine in this particular case as its simply for the experimental state, we don't do the same for a few other methods too. Also the experimental state has been tested in e2e, so these paths are tested, just not in the current unit tests. Once we flip the flag, it will get tested as it becomes the default path

pubkeys[i] = pubkeyAtIdx[:]
}
aggP, err := bls.AggregatePublicKeys(pubkeys)
aggP, err := beaconState.AggregatedKeyFromIndices(indices)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: The previous function is AggregatePublicKeys. Should'nt this function name AggregateKeyFromIndices?

@nisdas nisdas added this pull request to the merge queue Jul 8, 2024
Merged via the queue into develop with commit 74b5f6e Jul 8, 2024
17 checks passed
@nisdas nisdas deleted the aggKeyMethod branch July 8, 2024 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready For Review A pull request ready for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants