@@ -4,38 +4,29 @@ pragma solidity >=0.8.0;
44// ============ Internal Imports ============
55import {DomainRoutingIsm} from "./DomainRoutingIsm.sol " ;
66import {DomainRoutingIsmFactory} from "./DomainRoutingIsmFactory.sol " ;
7- import {StaticAggregationIsmFactory} from "../aggregation/StaticAggregationIsmFactory.sol " ;
8- import {StaticMessageIdMultisigIsmFactory} from "../multisig/StaticMultisigIsm.sol " ;
9- import {StaticMerkleRootMultisigIsmFactory} from "../multisig/StaticMultisigIsm.sol " ;
7+ import {StaticMultisigAggregationIsmFactory} from "../aggregation/StaticMultisigAggregationIsmFactory.sol " ;
108import {IInterchainSecurityModule} from "../../interfaces/IInterchainSecurityModule.sol " ;
119import {PackageVersioned} from "../../PackageVersioned.sol " ;
1210
1311/**
1412 * @title RoutingMultisigIsmFactory
15- * @notice Factory that deploys the complete routing[agg(messageId, merkleRoot)] ISM structure
16- * using existing audited ISM contracts. This factory simplifies deployment by:
17- * 1. Deploying MessageId and MerkleRoot multisig ISMs for each domain
18- * 2. Deploying an AggregationIsm (threshold 1) for each domain containing both multisig ISMs
19- * 3. Deploying a DomainRoutingIsm that routes messages to the appropriate AggregationIsm
13+ * @notice Factory that deploys the complete routing[agg(messageId, merkleRoot)] ISM structure.
2014 *
21- * This creates the same structure as the current core deployments but as a single factory call,
22- * making ISM reads and updates much simpler (similar to Solana's approach).
15+ * This factory orchestrates:
16+ * 1. Deploying an AggregationIsm (containing MessageId + MerkleRoot multisig ISMs) for each domain
17+ * 2. Deploying a DomainRoutingIsm that routes messages to the appropriate AggregationIsm
2318 *
24- * @dev This factory creates a fresh ISM tree on each deploy(). To update domains, deploy a new
25- * routing ISM rather than modifying an existing one. The underlying DomainRoutingIsm supports
26- * owner-controlled set() for adding domains, but this factory doesn't expose that pattern.
19+ * For incremental domain additions, use StaticMultisigAggregationIsmFactory directly to deploy
20+ * new aggregation ISMs, then call routingIsm.set(domain, newAggIsm) on the existing routing ISM.
2721 *
2822 * @dev Gas considerations: Deploying for many domains in one transaction may hit block gas limits.
2923 * For large deployments (>10 domains), consider batching or deploying in multiple transactions.
3024 */
3125contract RoutingMultisigIsmFactory is PackageVersioned {
3226 // ============ Immutables ============
3327 DomainRoutingIsmFactory public immutable routingIsmFactory;
34- StaticAggregationIsmFactory public immutable aggregationIsmFactory;
35- StaticMessageIdMultisigIsmFactory
36- public immutable messageIdMultisigIsmFactory;
37- StaticMerkleRootMultisigIsmFactory
38- public immutable merkleRootMultisigIsmFactory;
28+ StaticMultisigAggregationIsmFactory
29+ public immutable multisigAggregationIsmFactory;
3930
4031 // ============ Events ============
4132 event RoutingMultisigIsmDeployed (
@@ -47,14 +38,10 @@ contract RoutingMultisigIsmFactory is PackageVersioned {
4738 // ============ Constructor ============
4839 constructor (
4940 DomainRoutingIsmFactory _routingIsmFactory ,
50- StaticAggregationIsmFactory _aggregationIsmFactory ,
51- StaticMessageIdMultisigIsmFactory _messageIdMultisigIsmFactory ,
52- StaticMerkleRootMultisigIsmFactory _merkleRootMultisigIsmFactory
41+ StaticMultisigAggregationIsmFactory _multisigAggregationIsmFactory
5342 ) {
5443 routingIsmFactory = _routingIsmFactory;
55- aggregationIsmFactory = _aggregationIsmFactory;
56- messageIdMultisigIsmFactory = _messageIdMultisigIsmFactory;
57- merkleRootMultisigIsmFactory = _merkleRootMultisigIsmFactory;
44+ multisigAggregationIsmFactory = _multisigAggregationIsmFactory;
5845 }
5946
6047 // ============ External Functions ============
@@ -99,23 +86,10 @@ contract RoutingMultisigIsmFactory is PackageVersioned {
9986
10087 // Deploy AggregationIsm for each domain
10188 for (uint256 i = 0 ; i < _domainCount; ++ i) {
102- // Deploy MessageIdMultisigIsm for this domain
103- address _messageIdIsm = messageIdMultisigIsmFactory.deploy (
89+ address _aggregationIsm = multisigAggregationIsmFactory.deploy (
10490 _validators[i],
10591 _thresholds[i]
10692 );
107-
108- // Deploy MerkleRootMultisigIsm for this domain
109- address _merkleRootIsm = merkleRootMultisigIsmFactory.deploy (
110- _validators[i],
111- _thresholds[i]
112- );
113-
114- // Deploy AggregationIsm with threshold 1 (either MessageId OR MerkleRoot)
115- address [] memory _modules = new address [](2 );
116- _modules[0 ] = _messageIdIsm;
117- _modules[1 ] = _merkleRootIsm;
118- address _aggregationIsm = aggregationIsmFactory.deploy (_modules, 1 );
11993 _aggregationIsms[i] = IInterchainSecurityModule (_aggregationIsm);
12094 aggregationIsmAddresses[i] = _aggregationIsm;
12195 }
@@ -160,25 +134,11 @@ contract RoutingMultisigIsmFactory is PackageVersioned {
160134 uint256 _domainCount = _domains.length ;
161135 aggregationIsms = new address [](_domainCount);
162136
163- // Compute AggregationIsm addresses for each domain
164137 for (uint256 i = 0 ; i < _domainCount; ++ i) {
165- // Compute MessageIdMultisigIsm address
166- address _messageIdIsm = messageIdMultisigIsmFactory.getAddress (
138+ aggregationIsms[i] = multisigAggregationIsmFactory.getAddress (
167139 _validators[i],
168140 _thresholds[i]
169141 );
170-
171- // Compute MerkleRootMultisigIsm address
172- address _merkleRootIsm = merkleRootMultisigIsmFactory.getAddress (
173- _validators[i],
174- _thresholds[i]
175- );
176-
177- // Compute AggregationIsm address
178- address [] memory _modules = new address [](2 );
179- _modules[0 ] = _messageIdIsm;
180- _modules[1 ] = _merkleRootIsm;
181- aggregationIsms[i] = aggregationIsmFactory.getAddress (_modules, 1 );
182142 }
183143 }
184144}
0 commit comments