NethermindEth / NethermindEth/pluto

Unify lock usage; prefer actor ownership over shared locks

Open
#607 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

rust
Dominant language
Rust
Stars
8
Forks
5
Avg merge
4d 16h
Merged PRs (30d)
37

Description

Summary

Lock usage is split with no documented rule: std::sync::{Mutex,RwLock} in 41 files, tokio::sync in 22 (parking_lot is not a dependency — the backlog can drop that option). 52 call sites deal with poison (PoisonError::into_inner / expect("... poisoned")).

Several locks guard data with a single logical owner, where a channel/actor removes the lock entirely:

Proposed change

This is a design task first: pick a general rule (the standard one works: std::sync for short, non-await-crossing critical sections; tokio::sync when a guard is held across .await; actor + channels when data has one logical owner), document it and enforce it. Later, convert the listed actor candidates. Finally:

  • Stop returning guards from P2PContext
  • Make SUPPORTED_NETWORKS immutable-after-init or explicitly injected.

Acceptance

A written rule in the style docs, and the flagged sites either converted or annotated with why the lock is the right shape.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the listed lock sites in crates/consensus/src/qbft/component.rs, crates/core/src/parsigdb/memory.rs, crates/dkg/src/sync/client.rs, crates/p2p/src/p2p_context.rs, and crates/eth2util/src/network.rs, then review the existing style documentation. Done means the lock-ownership rule is documented and the flagged sites are converted or annotated with why their current lock shape is appropriate.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
distributed-systems
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.