Deduplicate AggregationBits type alias and remove redundant getters#146
Deduplicate AggregationBits type alias and remove redundant getters#146pablodeymo wants to merge 1 commit intomainfrom
Conversation
AggregationBits was defined identically in both attestation.rs and block.rs. Keep the single definition in attestation.rs and import it in block.rs. Update blockchain/store.rs and signature_types.rs to import from attestation instead of block, removing the now-unnecessary EthAggregationBitsSig alias. Also remove participants() and proof_data() getters on AggregatedSignatureProof since both fields are already public and no code calls the getters.
🤖 Kimi Code ReviewReview SummaryThe PR consolidates the Issues Found1. Breaking API Change (High Priority)File:
2. Incomplete Import Fix (Medium Priority)File:
3. Missing Method Migration (Low Priority)File:
Positive Changes
RecommendationBefore merging, ensure the public API compatibility issue (Point 1) is addressed with a proper re-export to prevent breaking downstream consumers. Automated review by Kimi (Moonshot AI) · custom prompt |
🤖 Codex Code ReviewSummary Findings
Consensus-layer checklist
If the API churn is intentional, this looks good to me. Automated review by OpenAI Codex · custom prompt |
🤖 Claude Code ReviewThe diff is small and I have enough context now. Let me write up the review. PR #146 Review — Deduplicate
|
Greptile SummaryThis PR eliminates code duplication by consolidating the Key changes:
Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| crates/common/types/src/block.rs | Removed duplicate AggregationBits type alias and redundant getter methods. Import now comes from attestation module. |
| crates/blockchain/src/store.rs | Updated import to use AggregationBits from attestation module instead of block module. |
| crates/blockchain/tests/signature_types.rs | Removed redundant EthAggregationBitsSig alias. Now uses EthAggregationBits from attestation module directly. |
Last reviewed commit: 4259856
Motivation
Two cleanup items from the code simplification audit:
Duplicate
AggregationBits: The type aliaspub type AggregationBits = ssz_types::BitList<ValidatorRegistryLimit>was defined identically in bothattestation.rsandblock.rs, with the same doc comment. This creates confusion about which is the canonical definition.Redundant getters on
AggregatedSignatureProof: Theparticipants()andproof_data()methods return references to fields that are alreadypub. No code calls these getters — all access goes through the fields directly.Description
AggregationBits dedup
crates/common/types/src/attestation.rs(where it semantically belongs)crates/common/types/src/block.rs, import fromattestationinsteadcrates/blockchain/src/store.rsto importAggregationBitsfromattestationinstead ofblockcrates/blockchain/tests/signature_types.rsto drop the redundantEthAggregationBitsSigalias (was identical toEthAggregationBitsfrom attestation)Redundant getters removal
AggregatedSignatureProof::participants()andAggregatedSignatureProof::proof_data()— both fields arepuband all code accesses them directlyFiles changed
crates/common/types/src/block.rscrates/blockchain/src/store.rsAggregationBitsimport fromblocktoattestationcrates/blockchain/tests/signature_types.rsEthAggregationBitsHow to test
make fmt make lint make test