NethermindEth / NethermindEth/pluto
Deduplicate domain types across crates
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 8
- Forks
- 5
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 37
Description
Summary
Follow-up evidence for #127 ("Centralize helper at core") — the concrete duplicates:
AttesterDuty: 4 near-identical structs —core/signeddata.rs#L1200-L1213(no pubkey),testutil/validatormock/attest.rs(same + pubkey),eth2api/validator_duty.rs(3-field subset),tracker/inclusion.rs(2-field subset) — plusAttesterDutyDefinition, which exists only because the core struct dropped the pubkey.ProposerDuty/SyncCommitteeDuty: same fields defined ineth2apiandcorewith different newtypes and a field rename (validator_index→v_idx), bridged byFroms.- Validator pubkey: 3 representations (
crypto::PublicKey = [u8;48],eth2api::BLSPubKey = [u8;48],core::PubKey([u8;48])), plus bareVec<u8>pubkeys in 6cluster::distvalidatorfields. Signature: 2 aliases for[u8;96]bridged by no-op converters. - Slot: 3 shapes —
phase0::Slot = u64,core::SlotNumber(u64), and acore::Slotcontext struct sharing the name. - Selections:
BeaconCommitteeSelection/SyncCommitteeSelectionexist in three layers (eth2api canonical, core#[serde(transparent)]newtypes, and independent testutil redefinitions with identical fields). - Duplicate trait names across crates: two unrelated
Consensustraits (consensus::wrappervspriority::consensus) and two unrelatedClocktraits (core::clockvstestutil::validatormock::clock— different time types; relates #306).
Deliberate non-duplicates to leave alone: the cluster wire-version struct families (DistValidatorV1x..., LockV1x...) encode real format versions, and the generated-vs-spec split in eth2api is the eth2api replacement issue's territory (#611).
Proposed change
Pick the canonical home per concept (core for domain types, eth2api spec types at the API boundary), collapse the copies, and give the survivors the fields their consumers actually need (e.g. put pubkey back on AttesterDuty, deleting AttesterDutyDefinition). Rename one of the Consensus/Clock trait pairs.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the cited definitions in core/signeddata.rs, core/types.rs, eth2api/validator_duty.rs, tracker/inclusion.rs, and testutil/validatormock/attest.rs, then trace the From conversions and duplicate trait definitions. Done means each listed concept has a canonical home, duplicate representations and no-op bridges are removed, and the deliberate wire-version and generated-vs-spec families remain unchanged.
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
- 28/100