Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ejection policy change #313

Merged
merged 2 commits into from
Nov 13, 2024
Merged

feat: ejection policy change #313

merged 2 commits into from
Nov 13, 2024

Conversation

0x0aa0
Copy link
Contributor

@0x0aa0 0x0aa0 commented Oct 23, 2024

Changes the EjectionManager behavior to eject the operator that trips the ratelimit but no further

@0x0aa0 0x0aa0 requested a review from mooselumph October 29, 2024 16:22
@0x0aa0 0x0aa0 changed the title feat: ejection stake capping feat: ejection policy change Nov 7, 2024
@0x0aa0 0x0aa0 requested a review from stevennevins November 7, 2024 21:29
ratelimitHit = true;

Copy link
Collaborator

Choose a reason for hiding this comment

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

In the above, if statement, it feels like we could simplify the logic flow by inverting the condition and pulling out the rateLimitWindow check to a guard clause

`

        uint32 numEjectedOperators;

        bool ratelimitHit;
        for(uint8 j = 0; j < _operatorIds[i].length; ++j) {
            uint256 operatorStake = stakeRegistry.getCurrentStake(_operatorIds[i][j], quorumNumber);
            if(quorumEjectionParams[quorumNumber].rateLimitWindow == 0) {
                break;
            }
            if (isEjector[msg.sender] && !ratelimitHit) {
                stakeForEjection += operatorStake;
                ++numEjectedOperators;
                registryCoordinator.ejectOperator(
                    registryCoordinator.getOperatorFromId(_operatorIds[i][j]),
                    abi.encodePacked(quorumNumber)
                );

                emit OperatorEjected(_operatorIds[i][j], quorumNumber);

                if (stakeForEjection > amountEjectable) {
                    stakeEjectedForQuorum[quorumNumber].push(StakeEjection({
                        timestamp: block.timestamp,
                        stakeEjected: stakeForEjection
                    }));
                    break;
                }
            }
        }

        emit QuorumEjection(numEjectedOperators, ratelimitHit);
    }

`

@0x0aa0 0x0aa0 merged commit 67ae0ef into dev Nov 13, 2024
3 checks passed
@0x0aa0 0x0aa0 deleted the ejector-update branch November 13, 2024 17:25
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