Skip to content

chore(Distributor): remove pre-Pectra permissionless distributeFor path#26

Open
sailorpepe wants to merge 1 commit intoberachain:mainfrom
sailorpepe:chore/remove-pre-pectra-dead-code
Open

chore(Distributor): remove pre-Pectra permissionless distributeFor path#26
sailorpepe wants to merge 1 commit intoberachain:mainfrom
sailorpepe:chore/remove-pre-pectra-dead-code

Conversation

@sailorpepe
Copy link
Copy Markdown

Closes #25

What

Removes dead code from the pre-Pectra permissionless reward distribution path. The Pectra11 hard fork made distributeFor(uint64, uint64, bytes, bytes32[], bytes32[]) permanently unreachable — only the system-call distributeFor(bytes pubkey) path remains active.

Changes

Source (-48 lines)

  • Distributor.sol: Remove MANAGER_ROLE, PECTRA11_HARD_FORK_TIMESTAMP, 5-arg distributeFor, admin functions. Add revert overrides for setZeroValidatorPubkeyGIndex/setProposerIndexGIndex to lock down unprotected base BeaconRootsHelper setters.
  • IDistributor.sol: Remove 5-arg distributeFor declaration.

Tests (-523 lines, +128 lines)

  • Migrate all tests to system-call path via vm.prank(SYSTEM_ADDRESS)
  • Remove tests that exclusively tested the dead path
  • Preserve all active-path coverage (system-call distribution, admin functions, upgradeability, reentrancy, dedicated emission streams, gas benchmarks, e2e fuzz)

Scripts / Mocks (-30 lines)

  • Remove distributorManagerRole grants from deployment and ownership transfer scripts
  • Simplify ReentrantERC20 mock to use system-call path

What was NOT removed (by design)

  • BeaconRootsHelper.sol — retained because Distributor_V0.sol depends on it. Removing would break UUPS proxy storage layout.
  • Storage variables — must remain at exact slots for proxy compatibility.

Security note

Removing the onlyRole(MANAGER_ROLE) overrides for setZeroValidatorPubkeyGIndex/setProposerIndexGIndex would have exposed these as unprotected public functions on the Distributor proxy (the base BeaconRootsHelper has no access control). While these values are only used by the removed verification functions (no direct impact on the active path), revert overrides were added to lock them down.

Verification

  • forge build ✅ (clean)
  • forge test ✅ (291 tests pass, 0 failures — includes 192 downstream RewardVault tests)

Diff stats

12 files changed, 153 insertions(+), 601 deletions(-)

The Pectra11 hard fork (Sept 3, 2025) made the 5-argument
distributeFor(timestamp, proofs...) function permanently unreachable.
Only the system-call distributeFor(pubkey) path remains active.

Changes:
- Remove 5-arg distributeFor, PECTRA11_HARD_FORK_TIMESTAMP, MANAGER_ROLE,
  setZeroValidatorPubkeyGIndex/setProposerIndexGIndex admin overrides
- Add revert overrides for setZeroValidatorPubkeyGIndex/setProposerIndexGIndex
  to lock down unprotected base BeaconRootsHelper setters
- Remove 5-arg distributeFor declaration from IDistributor
- Migrate all tests to system-call path (vm.prank(SYSTEM_ADDRESS))
- Remove distributor MANAGER_ROLE from deployment scripts
- Preserve BeaconRootsHelper inheritance and storage layout for UUPS
  proxy compatibility with Distributor_V0
@sailorpepe sailorpepe requested a review from a team as a code owner February 25, 2026 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore(Distributor): Dead code — pre-Pectra permissionless distributeFor path

1 participant