Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/action-tracker-implementation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/rebalancer': minor
---

Implemented ActionTracker for inflight-message-aware rebalancing. The ActionTracker tracked three entity types: user warp transfers (Transfer), rebalance intents (RebalanceIntent), and rebalance actions (RebalanceAction). It provided startup recovery by querying the Explorer for inflight messages, periodic sync operations to check message delivery status on-chain, and a complete API for creating and managing rebalance intents and actions. The implementation included a generic store interface (IStore) with an InMemoryStore implementation, comprehensive unit tests, and integration with ExplorerClient for querying inflight messages.
5 changes: 5 additions & 0 deletions .changeset/collateral-deficit-strategy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/rebalancer': minor
---

Added CollateralDeficitStrategy for just-in-time rebalancing. This strategy detected collateral deficits (negative effective balances from pending user transfers) and proposed fast rebalances using configured bridges. Modified reserveCollateral() to allow negative values for deficit detection.
5 changes: 5 additions & 0 deletions .changeset/composite-strategy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/rebalancer': minor
---

Added CompositeStrategy for chaining multiple rebalancing strategies. Routes from earlier strategies were passed as pending rebalances to later strategies for coordination. Strategy config used array format - single strategy is an array with 1 element. Also unified schema types by making bridgeLockTime optional and added name property to IStrategy interface for better logging.
5 changes: 5 additions & 0 deletions .changeset/inflight-aware-base-strategy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/rebalancer': minor
---

BaseStrategy is extended with inflight-aware rebalancing capabilities and bridge configuration support. RebalancingRoute extended with optional bridge field for bridge selection. Added three protected methods: reserveCollateral() to prevent draining collateral needed for incoming transfers, simulatePendingRebalances() for optional balance simulation, and filterRebalances() to filter routes based on actual balance sufficiency. The getRebalancingRoutes() method updated to accept optional inflightContext and integrate the new methods. getCategorizedBalances() signature updated to accept optional pendingRebalances parameter. BaseStrategy, WeightedStrategy, and MinAmountStrategy constructors extended with optional bridges parameter (ChainMap<Address[]>) to store configured bridge addresses per chain.
25 changes: 25 additions & 0 deletions .changeset/inflight-aware-rebalancing-major.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
'@hyperlane-xyz/rebalancer': major
---

Inflight-aware rebalancing system with ActionTracker, new strategies, and type safety improvements.

Breaking changes:
- IRebalancer.rebalance() returned RebalanceExecutionResult[] instead of void
- IStrategy.getRebalancingRoutes() accepted optional inflightContext parameter
- IStrategy required a name property
- RebalancingRoute renamed to StrategyRoute with required bridge field
- MonitorEvent included confirmedBlockTags for confirmed block queries

New features:
- ActionTracker for tracking pending transfers and rebalance actions with Explorer integration
- CollateralDeficitStrategy for just-in-time rebalancing based on pending inbound transfers
- CompositeStrategy for chaining multiple strategies with coordination
- BaseStrategy inflight-aware methods: reserveCollateral(), getAvailableBalance()
- Query balances at confirmed blocks to sync with Explorer indexing
- Strategy config supports array format for composing multiple strategies (backwards compatible)

Bug fixes:
- Record failure metrics when rebalance results contain failures
- Treat missing Dispatch event as rebalance failure
- Fix CompositeStrategy oscillation by separating proposed from pending rebalances
17 changes: 17 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ catalog:
borsh: ^0.7.0
dotenv: ^10.0.0
asn1.js: ^5.4.1
uuid: ^10.0.0

# Starknet
starknet: ^7.4.0
Expand Down Expand Up @@ -130,6 +131,7 @@ catalog:
'@types/lodash-es': ^4.17.12
'@types/yargs': ^17.0.24
'@types/ws': ^8.5.5
'@types/uuid': ^10.0.0

# Hardhat
hardhat: ^2.22.2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { RebalancerConfig } from '@hyperlane-xyz/rebalancer';
import {
RebalancerConfig,
getStrategyChainNames,
} from '@hyperlane-xyz/rebalancer';
import {
type ChainName,
type DeployedCoreAddresses,
Expand Down Expand Up @@ -138,9 +141,9 @@ async function resolveWarpRebalancerChains(
// Load rebalancer config to get the configured chains
const rebalancerConfig = RebalancerConfig.load(argv.config);

// Extract chain names from the rebalancer config's strategy.chains
// Extract chain names from all strategies in the rebalancer config
// This ensures we only create signers for chains we can actually rebalance
const chains = Object.keys(rebalancerConfig.strategyConfig.chains);
const chains = getStrategyChainNames(rebalancerConfig.strategyConfig);

assert(chains.length !== 0, 'No chains configured in rebalancer config');

Expand Down
Loading
Loading