attestantio / dirk

Apache License 2.0
75 stars 22 forks source link

Wrap batch account locking with a parent mutex. #5

Closed mcdee closed 3 years ago

mcdee commented 3 years ago

Dirk's internal rules system only allows a single request against a given public key at a time. However, with the introduction of the SignBeaconAttestations RPC call it is possible for multiple keys to be attached to a single call.

In the situation where there are multiple clients simultaneously calling SignBeaconAttestations it is possible for client 1 to request for keys [a,b] and client 2 to request for keys [b,a], and this creates a situation where a deadlock is possible.

This change avoids this situation by only allowing a single call across all active requests to lock keys at a time, ensuring that even if keys are presented out of order with multiple simultaneous calls a potential deadlock situation is avoided.