Skip to content

Commit 511e02b

Browse files
committed
fix(rebalancer): validate inventory address protocol coverage at startup
1 parent 0ae88cc commit 511e02b

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

typescript/rebalancer/src/e2e/mixed-weighted.e2e-test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,10 @@ describe('Mixed WeightedStrategy E2E', function () {
211211
);
212212

213213
expect(inventoryConfig).to.exist;
214-
expect(inventoryConfig!.chains).to.deep.equal([MIXED_INVENTORY_CHAIN]);
214+
expect(inventoryConfig!.chains).to.have.members([
215+
MIXED_INVENTORY_CHAIN,
216+
...MIXED_MOVABLE_CHAINS,
217+
]);
215218
expect(rebalancers.map((r) => r.rebalancerType).sort()).to.deep.equal([
216219
'inventory',
217220
'movableCollateral',

typescript/rebalancer/src/factories/RebalancerContextFactory.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,19 @@ export class RebalancerContextFactory {
480480
);
481481
}
482482

483+
// Validate inventory address coverage for all required protocols
484+
for (const protocol of requiredProtocols) {
485+
const chainsForProtocol = allRelevantChains.filter(
486+
(chain) =>
487+
this.warpCore.multiProvider.getChainMetadata(chain).protocol ===
488+
protocol,
489+
);
490+
assert(
491+
inventorySigners[protocol]?.address,
492+
`Missing inventory address for protocol ${protocol} (required by inventory chains: ${chainsForProtocol.join(', ')})`,
493+
);
494+
}
495+
483496
const externalBridgeRegistry: Partial<ExternalBridgeRegistry> =
484497
externalBridgeRegistryOverride ?? this.buildExternalBridgeRegistry();
485498

0 commit comments

Comments
 (0)