Skip to content

Commit 789b99b

Browse files
committed
code updates
1 parent 23c01f2 commit 789b99b

File tree

3 files changed

+47
-19
lines changed

3 files changed

+47
-19
lines changed

src/content/ccip/concepts/rate-limit-management/emergency-actions.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@ This configuration allows only a negligible transfer before the bucket is deplet
3333

3434
Conceptually, a lane can be locked down by calling `setChainRateLimiterConfig` with the following values:
3535

36-
- outboundConfig: `[true, "1", "1"]`
37-
- inboundConfig: `[true, "1", "1"]`
36+
```solidity
37+
outboundConfig = [true, 1, 1];
38+
inboundConfig = [true, 1, 1];
39+
```
3840

3941
Both inbound and outbound limits should be set to ensure transfers are blocked in both directions.
4042

src/content/ccip/concepts/rate-limit-management/inspect-current-rate-limits.mdx

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,16 @@ Chain selectors are represented as `uint64` values. You can find the correct sel
3434

3535
Most token pool contracts expose public getter functions similar to:
3636

37-
- `getCurrentInboundRateLimiterState`
38-
- `getCurrentOutboundRateLimiterState`
37+
```solidity
38+
function getCurrentInboundRateLimiterState(
39+
uint64 remoteChainSelector
40+
) external view returns (TokenBucket memory);
41+
42+
function getCurrentOutboundRateLimiterState(
43+
uint64 remoteChainSelector
44+
) external view returns (TokenBucket memory);
45+
46+
```
3947

4048
These functions take a remote chain selector as input and return the current **TokenBucket** state for that lane.
4149

@@ -48,13 +56,24 @@ You can call these functions using:
4856

4957
A typical rate limiter state includes the following fields:
5058

51-
- **tokens**: the current number of tokens available in the bucket
52-
- **lastUpdated**: the timestamp of the last refill
53-
- **isEnabled**: whether the rate limit is active
54-
- **capacity**: the maximum bucket size
55-
- **rate**: the refill rate in tokens per second
56-
57-
All numeric values are expressed in the token’s **smallest unit**, not in whole tokens.
59+
```solidity
60+
struct TokenBucket {
61+
uint128 tokens;
62+
uint32 lastUpdated;
63+
bool isEnabled;
64+
uint128 capacity;
65+
uint128 rate;
66+
}
67+
```
68+
69+
Where:
70+
71+
- tokens (uint128): the current number of tokens available in the bucket
72+
- lastUpdated (uint32): the timestamp of the last refill
73+
- isEnabled (bool): whether the rate limit is active
74+
- capacity (uint128): the maximum bucket size
75+
- rate (uint128): the refill rate in tokens per second
76+
- All numeric values are expressed in the token’s **smallest unit**, not in whole tokens.
5877

5978
## Inbound vs outbound inspection
6079

src/content/ccip/concepts/rate-limit-management/update-rate-limits.mdx

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,24 @@ This function updates both the inbound and outbound rate limit configuration for
1818

1919
The `setChainRateLimiterConfig` function takes three parameters:
2020

21-
1. **remoteChainSelector (uint64)**
22-
Identifies the remote chain for the lane being configured.
23-
24-
2. **outboundConfig (tuple)**
25-
Configuration for transfers leaving the current chain.
26-
27-
3. **inboundConfig (tuple)**
28-
Configuration for transfers entering the current chain.
21+
```solidity
22+
function setChainRateLimiterConfig(
23+
uint64 remoteChainSelector,
24+
RateLimiter.Config outboundConfig,
25+
RateLimiter.Config inboundConfig
26+
) external;
27+
```
2928

3029
Each configuration tuple contains:
3130

31+
```solidity
32+
struct Config {
33+
bool isEnabled;
34+
uint128 capacity;
35+
uint128 rate;
36+
}
37+
```
38+
3239
- **isEnabled**: whether the rate limit is active
3340
- **capacity**: maximum bucket size (in base units)
3441
- **rate**: refill rate in tokens per second (in base units)

0 commit comments

Comments
 (0)