-
Notifications
You must be signed in to change notification settings - Fork 890
Batch attestation slashibility checking #6219
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?
Batch attestation slashibility checking #6219
Conversation
/// The AttestationDataService is responsible for downloading and caching attestation data at a given slot | ||
/// for a range of committee indexes. It also helps prevent us from re-downloading identical attestation data. | ||
pub struct AttestationDataService<T: SlotClock, E: EthSpec> { | ||
attestation_data_by_committee: HashMap<CommitteeIndex, AttestationData>, |
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.
Note that all attestations votes are the same on each committee, the only change is in the index
field which equals the key of this hashmap CommitteeIndex
. If you are refactoring the flow you can consider an optimization to only get a single AttestationData
for all committees.
However, some DVT solution relies on a call for each CommitteeIndex
being made. I'm not sure if this is the case but it was ~1.5 years ago.
…tch-attestation-slashibility-checking
This one should be ready for a review. I still need to add some more granular metrics though. |
This pull request has merge conflicts. Could you please resolve them @eserilev? 🙏 |
…tch-attestation-slashibility-checking
Some required checks have failed. Could you please take a look @eserilev? 🙏 |
This pull request has merge conflicts. Could you please resolve them @eserilev? 🙏 |
Hi @eserilev, this pull request has been closed automatically due to 30 days of inactivity. If you’d like to continue working on it, feel free to reopen at any time. |
Issue Addressed
Closes #1914
Proposed Changes
The attestation service spawns a thread for each validator duty for a given slot. Within that thread the service checks if the attestation is safe, and if safe signs and publishes it. The attestation safety check requires reading and writing to a Sqlite db instance. Sqlite only allows for one open write transaction at any given time, and that transaction cannot be shared across threads. Opening a write transaction on one thread will block all other threads. This PR aims to refactor the attestation service so that database read/writes are not causing performance bottlenecks. These performance issues only become evident when large numbers of validators are involved.
Threads are still spawned per validator duty. However, within each thread we immediately sign the attestation. We collect the signed attestations and then perform the attestation safety checks. The db related tasks all happen in a single thread. The attestations that are deemed safe are all broadcasted at once and then the service continues with its normal flow.
I've also introduced an attestation data serivce. Its a simple service that downloads attestations by slot/committee index from the BN and caches them for later. It also prevents us from trying to download duplicate attestation data and helps abstract away the differences between how we handle attestation data pre and post electra.
Additionally, i've also parallelized producing and publishing attestation aggregates.