TheDocumentation Index
Fetch the complete documentation index at: https://docs.hyperlane.xyz/llms.txt
Use this file to discover all available pages before exploring further.
RateLimitedIsm is an ISM for warp routes that caps the token volume transferable to a destination chain within a configurable window. It pairs with a RateLimitedHook on the origin side, giving warp route deployers bidirectional control over transfer throughput.
How it works
Both contracts inherit fromRateLimited, which implements a token bucket algorithm:
- The bucket starts full at deployment (
filledLevel = maxCapacity). - It refills continuously at
refillRate = maxCapacity / DURATIONtokens per second. - Each transfer consumes capacity equal to the token amount in the message.
- If a transfer would exceed the current available capacity, it reverts with
RateLimitExceeded. - After a full
DURATIONof inactivity the bucket is fully restored.
DURATION, set to 1 day. The capacity — maxCapacity, expressed in the token’s base unit (e.g. 1_000_000e6 for 1M USDC) — is set at deployment and can be updated by the warp route owner at any time.
Contracts
| Contract | Chain side | Role |
|---|---|---|
RateLimitedHook | Origin | Enforces the limit at dispatch time (outbound) |
RateLimitedIsm | Destination | Enforces the limit at delivery time (inbound) |
RateLimitedIsm
Theverify() function:
- Requires the message recipient matches the configured
recipientaddress (onlyRecipient). - Requires the message has not already been validated — tracked via
messageValidated[messageId](replay protection). - Confirms the message was delivered by the Mailbox (
_isDelivered). - Extracts the token amount and calls
_validateAndConsumeFilledLevel.
RateLimitedHook
The_postDispatch() function:
- Requires the message sender matches the configured
senderaddress (onlySender). - Requires the message has not already been processed (replay protection).
- Confirms this is the most recently dispatched message (
_isLatestDispatched). - Extracts the token amount and calls
_validateAndConsumeFilledLevel.
Properties
Blast radius containment
Rate limits directly bound the maximum loss from a compromised bridge. If an attacker finds an exploit in the token contract or a validator key is leaked, they can drain at mostmaxCapacity tokens before the bucket empties and all transfers revert with RateLimitExceeded. This gives warp route owners time to detect the incident and pause or upgrade the route before a full treasury loss.
Replay protection
Both contracts maintain amessageValidated[messageId] mapping. A message that has already consumed capacity cannot be re-submitted, preventing double-spend attacks via message replay.
Recipient and sender binding
RateLimitedIsm is constructed with a fixed recipient address and rejects any message bound for a different contract. RateLimitedHook is constructed with a fixed sender address and rejects messages from unauthorized callers. This prevents the contracts from being used to validate or throttle transfers for unintended warp routes.
Owner-controlled capacity
setRefillRate(uint256 _capacity) is onlyOwner, allowing warp route owners to adjust the cap without redeploying:
Aggregation ISM compatibility
RateLimitedIsm can be nested inside an AggregationIsm to layer rate limiting on top of other security checks — for example, requiring both a MultisigIsm and a RateLimitedIsm to pass before a message is delivered. This requires relayer version agents-v2.2.0 or later.
For defense in depth, pair RateLimitedIsm with a PausableIsm inside an AggregationIsm. The rate limit caps the damage during an active exploit while the owner detects the incident and pauses the route to fully close it.
SDK configuration
The TypeScript SDK and CLI supportIsmType.RATE_LIMITED, enabling warp route configs to specify a RateLimitedIsm directly. The SDK type string is 'rateLimitedIsm'. See typescript/sdk/src/ism/types.ts.
The config schema accepts:
| Field | Type | Required | Notes |
|---|---|---|---|
type | 'rateLimitedIsm' | Yes | — |
maxCapacity | string (bigint) | Yes | Must be ≥ 86400; rounded down to nearest multiple of 86400 |
recipient | address | No | Defaults to the warp route address |
owner | address | No | Defaults to the deployer; receives onlyOwner rights (e.g. setRefillRate) |