NethermindEth / near-sffl

https://nffl.nethermind.io/
MIT License
6 stars 3 forks source link

Unsafe `Close` in `SafeEthClient` #199

Closed emlautarom1 closed 1 month ago

emlautarom1 commented 1 month ago

The current SafeEthClient is prone to race conditions:

https://github.com/NethermindEth/near-sffl/blob/4dabcd9eca5a1b3df98957913b93d26914b20c9c/core/safeclient/client.go#L303-L313

It's possible for two threads to run CLose simultaneously while c.close == false. Then, both threads will close the c.closeC channel triggering a panic due to double-closing.