Skip to content

CMv2 + CSMv3 + SRv3 factories#113

Open
vgorkavenko wants to merge 21 commits intodevelopfrom
feat/cmv2-srv3-factories
Open

CMv2 + CSMv3 + SRv3 factories#113
vgorkavenko wants to merge 21 commits intodevelopfrom
feat/cmv2-srv3-factories

Conversation

@vgorkavenko
Copy link
Copy Markdown
Contributor

@vgorkavenko vgorkavenko commented Feb 20, 2026

Fill in test fixtures before deployment

Hoodi Addresses

  • CSM module
  • CM module
  • CM MetaRegistry
  • CSM0x02 module
  • ConsolidationMigrator

Mainnet Addresses

  • CSM module
  • CM module
  • CM MetaRegistry
  • CSM0x02 module
  • ConsolidationMigrator

vgorkavenko and others added 5 commits February 20, 2026 16:13
…e + SubmitWithdrawals factories (#96)

* feat: add `maxValues` for `CSMSettleElStealingPenalty`

* feat: rename factory. introduce curated v2 things

* fix

* feat: add `name` for factory

* fix: name in scripts

* fix: more renames

* feat: add deployment script for CM

* feat: add SubmitWithdrawals factory

* chore: pin solidity 0.8.6

* chore: add name to the factory

* feat: add deploy script for SubmitWithdrawals

* test: add scenario/integration test for SubmitWithdrawals

* feat: rename set vetted gate tree factory

* feat: allowed gates registry

* fix: review

* chore: make allowedGates private variable

* test: few tweaks to allowed gate registry

* fix: use the updated method

* refactor: rename the factory one more time

* fix: `reportWithdrawnValidators` -> `reportSlashedWithdrawnValidators`

* feat: settle general delayed penalty deploy script

* feat: Create\Update MetaRegistry operator group factory

* fix: review

* feat: initial gates for registry, tests

* fix: remove acceptance tests

* fix: create or update group review

* feat: add `name` for AllowedMerkleGateRegistry

* feat: add `txHash` to artifacts

---------

Co-authored-by: madlabman <10616301+madlabman@users.noreply.github.com>
…e share factories (#102)

* feat: allow consolidation factory

* chore: add comment

* fix: review

* fix: add `consolidationManager`

* feat: UpdateStakingModuleShareLimits ET Factory (#99)

* feat: UpdateStakingModuleShareLimits ET Factory

* fixes for review

* feat: add deployment and acceptance tests for UpdateStakingModuleShareLimits

---------

Co-authored-by: Sergey Khomutinin <31664571+skhomuti@users.noreply.github.com>
@vgorkavenko vgorkavenko marked this pull request as ready for review February 24, 2026 18:22
@vgorkavenko vgorkavenko requested a review from a team as a code owner February 24, 2026 18:22
Copy link
Copy Markdown

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

Adds new Easy Track EVMScript factories and supporting infra for CMv2 / CSMv3 / SRv3 motions, plus scenarios/stubs/interfaces needed to test and deploy them across networks.

Changes:

  • Introduces new EVMScript factories for: updating staking module share limits, settling general delayed penalties, reporting slashed-withdrawn validators, creating/updating MetaRegistry operator groups, and allowing consolidation pairs.
  • Adds/updates supporting Solidity interfaces + test stubs (MetaRegistry, ConsolidationMigrator, CSModule node-operator stubs, StakingRouter updates) and expands scenario + unit test coverage.
  • Extends Python utils/fixtures to expose CM/CSM0x02 wiring and adds deployment scripts for the new factories/registry.

Reviewed changes

Copilot reviewed 59 out of 60 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
utils/lido.py Adds optional consolidation_migrator address + optional contract wiring.
utils/dual_governance.py Refactors contract lookup to resolve network dynamically via helper.
utils/csm0x02.py Adds CSM0x02 address/contract helper module.
utils/csm.py Extends CSM wiring with allowed merkle gates registry address/interface.
utils/config.py Hard-fails if Brownie network cannot be resolved.
utils/cm.py Adds CM (curated module) address/contract helper module.
tests/test_allowed_merkle_gates_registry.py Adds unit tests for AllowedMerkleGatesRegistry behavior.
tests/scenario/test_update_staking_module_share_limits_scenario.py Adds scenario test for SR module share limit update motion.
tests/scenario/test_settle_general_delayed_penalty_scenario.py Adds scenario test for settling general delayed penalties via motion.
tests/scenario/test_report_withdrawals_for_slashed_validators_scenario.py Adds scenario test for reporting slashed withdrawn validators via motion.
tests/scenario/test_merkle_gate_scenario.py Adds scenario test for SetMerkleGateTree factory flow.
tests/scenario/test_csm_vetted_gate_scenario.py Removes old vetted-gate scenario.
tests/scenario/test_create_or_update_operator_group_scenario.py Adds scenario test for CMv2 MetaRegistry group create/update via motion.
tests/scenario/test_allow_consolidation_pair_scenario.py Adds scenario test for allowing consolidation pairs via motion.
tests/scenario/conftest.py Adds helpers/fixtures for “use deployed contracts” mode + impersonation utilities.
tests/evm_script_factories/test_update_staking_module_share_limits.py Adds unit tests for UpdateStakingModuleShareLimits factory.
tests/evm_script_factories/test_settle_general_delayed_penalty.py Adds unit tests for SettleGeneralDelayedPenalty factory.
tests/evm_script_factories/test_set_merkle_gate_tree.py Adds unit tests for SetMerkleGateTree factory.
tests/evm_script_factories/test_report_withdrawals_for_slashed_validators.py Adds unit tests for ReportWithdrawalsForSlashedValidators factory.
tests/evm_script_factories/test_csm_settle_el_stealing_penalty.py Removes old EL stealing penalty factory tests.
tests/evm_script_factories/test_csm_set_vetted_gate_tree.py Removes old vetted-gate factory tests.
tests/evm_script_factories/test_create_or_update_operator_group.py Adds unit tests for CreateOrUpdateOperatorGroup factory.
tests/evm_script_factories/test_allow_consolidation_pair.py Adds unit tests for AllowConsolidationPair factory.
tests/conftest.py Adds CM/CSM0x02 fixtures + allowed registry/gate helpers + SR consolidation migrator fixture.
scripts/deploy_update_staking_module_share_limits_factory.py Adds deployment script for UpdateStakingModuleShareLimits factory.
scripts/deploy_settle_general_delayed_penalty_factory.py Adds deployment script for SettleGeneralDelayedPenalty factory.
scripts/deploy_set_merkle_gate_tree_factory.py Adds deployment script for SetMerkleGateTree factory.
scripts/deploy_report_withdrawals_for_slashed_validator_factory.py Adds deployment script for ReportWithdrawalsForSlashedValidators factory.
scripts/deploy_csm_settle_el_stealing_factory.py Removes old EL stealing factory deployment script.
scripts/deploy_csm_set_vetted_gate_tree_factory.py Removes old vetted gate factory deployment script.
scripts/deploy_create_or_update_operator_group_factory.py Adds deployment script for CreateOrUpdateOperatorGroup factory.
scripts/deploy_allowed_merkle_gates_registry.py Adds deployment script for AllowedMerkleGatesRegistry.
scripts/deploy_allow_consolidation_pair_factory.py Adds deployment script for AllowConsolidationPair factory.
scripts/acceptance_test_csm_settle_el_stealing_setup.py Removes old acceptance setup script.
scripts/acceptance_test_csm_set_vetted_gate_tree_setup.py Removes old acceptance setup script.
interfaces/CSModule.json Updates CSModule ABI to CSMv3 surface (node operators, penalties, withdrawals reporting).
contracts/test/StakingRouterStub.sol Adds updateModuleShares + event + test helper setter.
contracts/test/NodeOperatorsRegistryStub.sol Adds canPerform + reward address setter to support consolidation tests.
contracts/test/MetaRegistryStub.sol Adds MetaRegistry stub used by operator-group factory tests.
contracts/test/MerkleGateStub.sol Renames/adjusts stub to represent MerkleGate (not VettedGate).
contracts/test/ConsolidationMigratorStub.sol Adds consolidation migrator stub used by consolidation pair tests.
contracts/test/CSModuleNodeOperatorsStub.sol Adds minimal ICSModule implementation for node-operator activity checks.
contracts/test/CSLikeModuleStub.sol Adds module-like stub supporting accounting + settle/report flows for tests.
contracts/interfaces/IVettedGate.sol Removes old vetted gate interface.
contracts/interfaces/IStakingRouter.sol Extends interface with updateModuleShares.
contracts/interfaces/IMetaRegistry.sol Adds MetaRegistry interface used by CMv2 factory.
contracts/interfaces/IMerkleGate.sol Adds MerkleGate interface used by SetMerkleGateTree factory.
contracts/interfaces/IConsolidationMigrator.sol Adds ConsolidationMigrator interface used by consolidation pair factory/tests.
contracts/interfaces/ICSModule.sol Updates ICSModule interface to “general delayed penalty” + withdrawals reporting + activity checks.
contracts/interfaces/ICSAccounting.sol Adds accounting interface for locked bond reads.
contracts/interfaces/IAllowedMerkleGatesRegistry.sol Adds registry interface for gate allowlist checks.
contracts/EVMScriptFactories/UpdateStakingModuleShareLimits.sol New SR factory that validates deltas/current values and emits update call.
contracts/EVMScriptFactories/SettleGeneralDelayedPenalty.sol New CSM factory to settle delayed penalties with max-amount validation.
contracts/EVMScriptFactories/SetMerkleGateTree.sol Reworks gate-tree factory to support any allowed IMerkleGate via registry allowlist.
contracts/EVMScriptFactories/ReportWithdrawalsForSlashedValidators.sol New CSM factory to report slashed withdrawn validators.
contracts/EVMScriptFactories/CreateOrUpdateOperatorGroup.sol New CMv2 factory validating and encoding MetaRegistry operator group updates.
contracts/EVMScriptFactories/CSMSettleELStealingPenalty.sol Removes old factory.
contracts/EVMScriptFactories/AllowConsolidationPair.sol New SR factory to allow consolidation pairs with NOR permission checks.
contracts/AllowedMerkleGatesRegistry.sol New registry contract to maintain allowed MerkleGate addresses.
.gitignore Ignores typings/, direnv, tags, etc.

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

… _addGate, add tests

Agent-Logs-Url: https://github.com/lidofinance/easy-track/sessions/a18fe8d1-6aff-4870-97df-51bfeacd5895

Co-authored-by: vgorkavenko <32727352+vgorkavenko@users.noreply.github.com>
sourceModuleId = sourceModuleId_;
targetModuleId = targetModuleId_;
consolidationMigrator = IConsolidationMigrator(_consolidationMigrator);
metaRegistry = ICuratedModule(sourceModuleAddress).META_REGISTRY();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@vgorkavenko The source module is legacy NOR module, it does not have META_REGISTRY

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

Comment on lines +141 to +166
function _validateInputData(
address creator,
AllowConsolidationPairInput memory input
) private view {

INodeOperatorsRegistry sourceModule = INodeOperatorsRegistry(stakingRouter.getStakingModule(sourceModuleId).stakingModuleAddress);

uint256 sourceCount = sourceModule.getNodeOperatorsCount();
require(input.sourceOperatorId < sourceCount, ERROR_SOURCE_OPERATOR_ID_DOES_NOT_EXIST);

(bool active, , address rewardAddress, , , , ) = sourceModule.getNodeOperator(
input.sourceOperatorId,
false
);
require(active, ERROR_NODE_OPERATOR_IS_NOT_ACTIVE);

uint256[] memory roleParams = new uint256[](1);
roleParams[0] = input.sourceOperatorId;
require(
creator == rewardAddress ||
sourceModule.canPerform(creator, MANAGE_SIGNING_KEYS_ROLE, roleParams),
ERROR_CALLER_IS_NOT_SOURCE_OPERATOR_OWNER_OR_MANAGER
);

_validateOperatorIds(input.sourceOperatorId, input.targetOperatorIds);
}
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.

8 participants