-
Notifications
You must be signed in to change notification settings - Fork 293
optimize slashing protection interchange import #7312
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
base: unstable
Are you sure you want to change the base?
Conversation
a0510ce
to
aa88cd4
Compare
Quick reminder about PR #7312 (“optimize slashing protection interchange import”):
All tests in |
The core idea of replacing O(n log n) sorting with O(n) selection is sound, but this particular PR has lots of other unwarranted comment changes. It's true that not using |
@tersec
I also restored the chronicles.formatIt PubKey0x for log parity; Please let me know if you’d like any other comments tweaked. |
6c84d01
to
b118196
Compare
This PR addresses a TODO in
slashing_protection_common.nim
related to the interchange import logic.Changes
O(n log n)
sort ofsigned_blocks
with a linearO(n)
scan to select the block with the highest slot.signed_attestations
. The following loop already determines the max epochs.algorithm
) to reduce compile scope.Rationale
These changes improve performance and reduce complexity with no changes to functionality.
Testing
All slashing protection tests pass:
tests/slashing_protection/test_slashing_protection_db.nim