Skip to content

fix(contracts): Disallow ejectors from cancelling other ejectors' ejections#2424

Open
ethenotethan wants to merge 1 commit intomasterfrom
ethenotethan--fix-contracts-ejector-trust-assumption
Open

fix(contracts): Disallow ejectors from cancelling other ejectors' ejections#2424
ethenotethan wants to merge 1 commit intomasterfrom
ethenotethan--fix-contracts-ejector-trust-assumption

Conversation

@ethenotethan
Copy link
Contributor

Bug identified by llm analysis - see thread here

Why are these changes needed?

This change ensures that only the ejector that initiated an ejection can cancel it. - otherwise there is a trust assumption on the ejector. In the current implementation an ejector can cancel ejections made by other ejectors.

Changes

  • require stmt invariant
  • unit test

Checks

  • I've made sure the tests are passing. Note that there might be a few flaky tests, in that case, please comment that they are not relevant.
  • I've checked the new test coverage and the coverage percentage didn't drop.
  • Testing Strategy
    • Unit tests
    • Integration tests
    • This PR is not tested :(

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a security vulnerability in the EigenDA ejection system where any ejector could cancel ejections initiated by other ejectors, creating an unwanted trust assumption. The fix adds a validation check to ensure only the ejector who initiated an ejection can cancel it.

Key Changes:

  • Added require statement validating that msg.sender matches the ejector who initiated the ejection
  • Added comprehensive unit test to verify the new security constraint

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
contracts/src/periphery/ejection/EigenDAEjectionManager.sol Added ejector ownership validation in cancelEjectionByEjector to prevent cross-ejector cancellations
contracts/test/unit/EigenDAEjectionManager.t.sol Added test case verifying that different ejectors cannot cancel each other's ejections

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +195 to +217
function testCancelEjectionByEjectorRevertsWhenCalledByDifferentEjector() public {
// 0) create a second ejector and grant access for ejection role
address ejector2 = makeAddr("ejector2");
accessControl.grantRole(AccessControlConstants.EJECTOR_ROLE, ejector);
accessControl.grantRole(AccessControlConstants.EJECTOR_ROLE, ejector2);
accessControl.grantRole(AccessControlConstants.OWNER_ROLE, ejector);

// 1) first ejector starts an ejection
vm.startPrank(ejector);
ejectionManager.setCooldown(0);
ejectionManager.setDelay(0);
ejectionManager.startEjection(ejectee, "0x");
vm.stopPrank();

// 2) verify the ejection was created with the first ejector
assertEq(ejectionManager.getEjector(ejectee), ejector);

// 3) attempting to cancel the ejection from a different ejector should revert
vm.startPrank(ejector2);
vm.expectRevert("only ejector that issued ejection can cancel");
ejectionManager.cancelEjectionByEjector(ejectee);
vm.stopPrank();
}
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a test case that verifies the original ejector can still successfully cancel their own ejection after the fix. This would provide more comprehensive coverage and confirm the fix doesn't break the intended behavior.

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Dec 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 39.12%. Comparing base (90b9651) to head (e24f877).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2424      +/-   ##
==========================================
- Coverage   39.15%   39.12%   -0.03%     
==========================================
  Files         550      550              
  Lines       50734    50734              
==========================================
- Hits        19864    19852      -12     
- Misses      28376    28385       +9     
- Partials     2494     2497       +3     
Flag Coverage Δ
litt-tests 32.99% <ø> (ø)
unit-tests 39.94% <ø> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

2 participants