-
Notifications
You must be signed in to change notification settings - Fork 1k
Eliminate AbstractRLPOutput abstraction to reduce technical debt #8889
Description
Problem
Brittleness Signal: Unnecessary abstraction layer between RLPOutput interface and its single implementation
Frequency: Low impact on development velocity, but increases code complexity
Investigation Time: Developers need to understand abstract/concrete relationship for simple RLP encoding
Root Cause
Hidden Coupling: AbstractRLPOutput exists with only one concrete implementation (BytesValueRLPOutput)
Files Involved:
ethereum/rlp/src/main/java/org/hyperledger/besu/ethereum/rlp/AbstractRLPOutput.javaethereum/rlp/src/main/java/org/hyperledger/besu/ethereum/rlp/BytesValueRLPOutput.java
Why It Exists: Premature abstraction - designed for multiple implementations that never materialized
Proposed Solution
Approach: Direct class consolidation - merge AbstractRLPOutput logic into BytesValueRLPOutput
Scope: 2 files, ~150+ usage sites (no changes needed to usage sites)
Success Criteria:
- Single concrete RLPOutput implementation class
- All existing tests pass unchanged
- No import statement changes required across codebase
- Same public API surface maintained
Implementation Plan
Step 1: Consolidate classes (max 1 hour)
- Move all methods from AbstractRLPOutput into BytesValueRLPOutput
- Change BytesValueRLPOutput from
extends AbstractRLPOutputtoimplements RLPOutput - Remove abstract keywords, make class concrete
- Delete AbstractRLPOutput.java
- Verify with
./gradlew :ethereum:rlp:test
Safety Checks
- Can revert each step independently
- Tests exist to verify functionality (RLP module tests)
- No changes to public APIs
- Change only affects RLP module
Definition of Done
- AbstractRLPOutput.java file deleted
- BytesValueRLPOutput directly implements RLPOutput interface
- All RLP module tests pass
- No compilation errors across entire codebase
- Code reviewer confirms abstraction layer eliminated
Additional Context
This follows the same pattern as the recent AbstractRLPInput elimination. The RLP module had premature abstractions on both input and output sides that provide no value with single implementations.