AleoNet / snarkOS

A Decentralized Operating System for ZK Applications
http://snarkos.org
Apache License 2.0
4.24k stars 2.59k forks source link

[Fix] Clear cached validator requests on disconnect #3254

Closed niklaslong closed 2 months ago

niklaslong commented 2 months ago

This PR clears the validator requests cache map for a particular peer on disconnect. This ensures the collection is periodically cleaned up despite not having a time-based expiry and is sufficient to avoid infinite growth as the committee size is bounded (but the IP may change).

A small aside for future discussion: when time permits, we may want to revisit our approach to cache invalidation both in the gateway and the router. One option would be to use an LRU with a fixed size that we clear on specific state transitions (e.g. on round increment).