Skip to content

Commit 88189c8

Browse files
rate limits updates with updater script (#115)
* wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip
1 parent 605fac7 commit 88189c8

File tree

10 files changed

+232
-78
lines changed

10 files changed

+232
-78
lines changed

docs/evm-tutorials/subnet-precompile.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ Registers a new subnet with comprehensive identity metadata that helps users und
7474

7575
### Rate Limiting
7676

77+
See [Rate Limits in Bittensor](../learn/chain-rate-limits.md).
78+
7779
#### `getServingRateLimit`
7880

7981
Gets the serving rate limit for a subnet.

docs/learn/announcements.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ For detailed information, see: [Multiple Incentive Mechanisms Within Subnets](..
2929
- **Purpose**: Prevent exploitation where subnet owners kick off root validators to take full incentives
3030
- **Implementation**: Applies 7,200-block rate limit to prevent subnet owner exploitation
3131

32+
See [Rate Limits in Bittensor](../learn/chain-rate-limits.md).
33+
3234
## Child Key Fee
3335

3436
A percentage fee will be deducted from emissions bound to validator hotkeys through a *child hotkey* relationship. This is designed to more highly incentivize validators who perform validation work, over child-key-only validators. It is being gradually rolled out to reduce surprise for the community and allow validators to adjust.
@@ -46,7 +48,7 @@ A percentage fee will be deducted from emissions bound to validator hotkeys thro
4648
- **Key Changes**:
4749
- Subnet limit remains at 128 initially with no new registrations available immediately
4850
- Immunity period reduced from 6 months to 4 months from registration block
49-
- Network rate limit increased to 3 days (from 2 days) between registrations
51+
- Network rate limit increased to 4 days between registrations
5052
- Initial lock cost set at 1,000 TAO with standard linear decay mechanism
5153
- First deregistrations available approximately September 23 (one week after deployment)
5254

docs/learn/chain-rate-limits.md

Lines changed: 86 additions & 74 deletions
Large diffs are not rendered by default.

docs/scripts/check-rate-limits.js

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
/*
2+
SIMPLE BITENSOR RATE LIMITS CHECKER
3+
===================================
4+
Queries the specific rate limit state variables mentioned in the documentation.
5+
6+
Usage: node simple-rate-limits.js
7+
*/
8+
9+
const { ApiPromise, WsProvider } = require("@polkadot/api");
10+
11+
async function checkRateLimits() {
12+
try {
13+
console.log("Connecting to Bittensor network...");
14+
const wsProvider = new WsProvider("wss://entrypoint-finney.opentensor.ai:443");
15+
const api = await ApiPromise.create({ provider: wsProvider });
16+
17+
console.log("✓ Connected successfully!\n");
18+
19+
const blockTimeSeconds = 12; // Bittensor blocks are ~12 seconds
20+
21+
// Global rate limits
22+
console.log("GLOBAL RATE LIMITS:");
23+
console.log("==================");
24+
25+
try {
26+
const txRateLimit = await api.query.subtensorModule.txRateLimit();
27+
console.log(`TxRateLimit: ${txRateLimit.toNumber()} blocks (~${Math.round(txRateLimit.toNumber() * blockTimeSeconds / 3600 * 10) / 10}h)`);
28+
} catch (e) {
29+
console.log("TxRateLimit: Unable to query");
30+
}
31+
32+
try {
33+
const txDelegateTakeRateLimit = await api.query.subtensorModule.txDelegateTakeRateLimit();
34+
console.log(`TxDelegateTakeRateLimit: ${txDelegateTakeRateLimit.toNumber()} blocks (~${Math.round(txDelegateTakeRateLimit.toNumber() * blockTimeSeconds / 3600 * 10) / 10}h)`);
35+
} catch (e) {
36+
console.log("TxDelegateTakeRateLimit: Unable to query");
37+
}
38+
39+
try {
40+
const txChildkeyTakeRateLimit = await api.query.subtensorModule.txChildkeyTakeRateLimit();
41+
console.log(`TxChildkeyTakeRateLimit: ${txChildkeyTakeRateLimit.toNumber()} blocks (~${Math.round(txChildkeyTakeRateLimit.toNumber() * blockTimeSeconds / 3600 * 10) / 10}h)`);
42+
} catch (e) {
43+
console.log("TxChildkeyTakeRateLimit: Unable to query");
44+
}
45+
46+
try {
47+
const networkRateLimit = await api.query.subtensorModule.networkRateLimit();
48+
console.log(`NetworkRateLimit: ${networkRateLimit.toNumber()} blocks (~${Math.round(networkRateLimit.toNumber() * blockTimeSeconds / 3600 * 10) / 10}h)`);
49+
} catch (e) {
50+
console.log("NetworkRateLimit: Unable to query");
51+
}
52+
53+
try {
54+
const ownerHyperparamRateLimit = await api.query.subtensorModule.ownerHyperparamRateLimit();
55+
console.log(`OwnerHyperparamRateLimit: ${ownerHyperparamRateLimit.toNumber()} tempos`);
56+
} catch (e) {
57+
console.log("OwnerHyperparamRateLimit: Unable to query");
58+
}
59+
60+
try {
61+
const weightsVersionKeyRateLimit = await api.query.subtensorModule.weightsVersionKeyRateLimit();
62+
console.log(`WeightsVersionKeyRateLimit: ${weightsVersionKeyRateLimit.toNumber()} blocks (~${Math.round(weightsVersionKeyRateLimit.toNumber() * blockTimeSeconds / 3600 * 10) / 10}h)`);
63+
} catch (e) {
64+
console.log("WeightsVersionKeyRateLimit: Unable to query");
65+
}
66+
67+
try {
68+
const adminFreezeWindow = await api.query.subtensorModule.adminFreezeWindow();
69+
console.log(`AdminFreezeWindow: ${adminFreezeWindow.toNumber()} blocks (~${Math.round(adminFreezeWindow.toNumber() * blockTimeSeconds / 3600 * 10) / 10}h)`);
70+
} catch (e) {
71+
console.log("AdminFreezeWindow: Unable to query");
72+
}
73+
74+
// Subnet-specific rate limits (check subnet 1 as example)
75+
console.log("\nSUBNET-SPECIFIC RATE LIMITS (Subnet 1):");
76+
console.log("=======================================");
77+
78+
try {
79+
const servingRateLimit = await api.query.subtensorModule.servingRateLimit(1);
80+
console.log(`ServingRateLimit: ${servingRateLimit.toNumber()} blocks (~${Math.round(servingRateLimit.toNumber() * blockTimeSeconds / 3600 * 10) / 10}h)`);
81+
} catch (e) {
82+
console.log("ServingRateLimit: Unable to query");
83+
}
84+
85+
try {
86+
const adjustmentInterval = await api.query.subtensorModule.adjustmentInterval(1);
87+
console.log(`AdjustmentInterval: ${adjustmentInterval.toNumber()} blocks (~${Math.round(adjustmentInterval.toNumber() * blockTimeSeconds / 3600 * 10) / 10}h)`);
88+
} catch (e) {
89+
console.log("AdjustmentInterval: Unable to query");
90+
}
91+
92+
try {
93+
const immunityPeriod = await api.query.subtensorModule.immunityPeriod(1);
94+
console.log(`ImmunityPeriod: ${immunityPeriod.toNumber()} blocks (~${Math.round(immunityPeriod.toNumber() * blockTimeSeconds / 3600 * 10) / 10}h)`);
95+
} catch (e) {
96+
console.log("ImmunityPeriod: Unable to query");
97+
}
98+
99+
try {
100+
const weightsSetRateLimit = await api.query.subtensorModule.weightsSetRateLimit(1);
101+
console.log(`WeightsSetRateLimit: ${weightsSetRateLimit.toNumber()} blocks (~${Math.round(weightsSetRateLimit.toNumber() * blockTimeSeconds / 3600 * 10) / 10}h)`);
102+
} catch (e) {
103+
console.log("WeightsSetRateLimit: Unable to query");
104+
}
105+
106+
try {
107+
const maxRegistrationsPerBlock = await api.query.subtensorModule.maxRegistrationsPerBlock(1);
108+
console.log(`MaxRegistrationsPerBlock: ${maxRegistrationsPerBlock.toNumber()} registrations`);
109+
} catch (e) {
110+
console.log("MaxRegistrationsPerBlock: Unable to query");
111+
}
112+
113+
try {
114+
const targetRegistrationsPerInterval = await api.query.subtensorModule.targetRegistrationsPerInterval(1);
115+
console.log(`TargetRegistrationsPerInterval: ${targetRegistrationsPerInterval.toNumber()} registrations`);
116+
} catch (e) {
117+
console.log("TargetRegistrationsPerInterval: Unable to query");
118+
}
119+
120+
console.log("\n✓ Complete");
121+
122+
} catch (error) {
123+
console.error("Error:", error.message);
124+
process.exit(1);
125+
}
126+
}
127+
128+
// Run the script
129+
checkRateLimits().catch(console.error);
130+
131+
// Suppress warning messages
132+
console.warn = () => {};

docs/subnets/managing-mechanisms-btcli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,6 @@ Totals are expressed as a fraction of 65535 (U16_MAX).
151151

152152
## Troubleshooting
153153

154-
- Rate limiting: mechanism count changes are restricted (on mainnet) to once per ~24 hours (7200 blocks).
154+
- Rate limiting: mechanism count changes are restricted (on mainnet) to once per ~24 hours (7200 blocks). See [Rate Limits in Bittensor](../learn/chain-rate-limits.md).
155155
- Permissions: emission split and count updates require the subnet owner wallet.
156156
- Local chain connectivity: ensure your local chain is running and the `network` parameter in your BTCLI config is set to `local`.

docs/subnets/managing-mechanisms-with-sdk.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,6 @@ split:
160160

161161
## Troubleshooting
162162

163-
- Rate limiting: mechanism count changes are restricted (on mainnet) to once per ~24 hours (7200 blocks).
163+
- Rate limiting: mechanism count changes are restricted (on mainnet) to once per ~24 hours (7200 blocks). See [Rate Limits in Bittensor](../learn/chain-rate-limits.md).
164164
- Permissions: emission split and count updates require the subnet owner wallet.
165165
- Local chain connectivity: ensure your local chain is running and your SDK points to `network="local"`.

docs/subnets/subnet-deregistration.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ Deregistration can occur at most every once every 4 days (coordinated with regis
6767
- Block-based timing: 28800 blocks ≈ 4 days at 12s/block
6868
- [Source code](https://github.com/opentensor/subtensor/blob/main/pallets/subtensor/src/utils/rate_limiting.rs#L27)
6969

70+
See [Rate Limits in Bittensor](../learn/chain-rate-limits.md).
71+
7072
## Special Cases and Edge Conditions
7173

7274
### All Subnets Immune

docs/subnets/uid-trimming.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ UID trimming is a subnet management feature that allows subnet owners to reduce
88

99
:::info UID trimming rate limit
1010
The chain's trim UID rate limit is 216,000 blocks (~30 days). Therefore, subnet owners can only make changes to their UID count every 30 days.
11+
12+
See [Rate Limits in Bittensor](../learn/chain-rate-limits.md).
1113
:::
1214

1315
- **Preserves Immune UIDs**: Both temporally immune UIDs and owner-owned UIDs are protected from trimming

docs/subnets/understanding-multiple-mech-subnets.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ As of the current Subtensor runtime, a subnet can have a maximum of 2 mechanisms
109109
- **Transparent configuration**: All mechanism settings are visible on-chain for community oversight
110110
- **Single subnet slot**: No need to register multiple subnets for multiple competitions
111111
- **Immediate mechanism number setting**: The number of mechanisms is set immediately when changed. <!-- See: subtensor/pallets/subtensor/src/subnets/subsubnet.rs:91-116 -->
112-
- **Rate limiting**: Subnet owners can set the number of mechanisms once per 7200 blocks (24 hours) on mainnet. <!-- See: subtensor/pallets/subtensor/src/lib.rs:1842-1844 -->
112+
- **Rate limiting**: Subnet owners can set the number of mechanisms once per 7200 blocks (24 hours) on mainnet. See [Rate Limits in Bittensor](../learn/chain-rate-limits.md). <!-- See: subtensor/pallets/subtensor/src/lib.rs:1842-1844 -->
113113

114114
:::tip
115115
Ensure proportions sum to 100% when setting them, or the request will be rejected.

docs/validators/child-hotkeys.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ The following rate limits apply for child hotkeys:
6969
- A child hotkey's take rate can only be adjusted once per 30 days.
7070
- One successful execution of `set_children` or `revoke_children` is allowed for every 720 blocks.
7171

72+
See [Rate Limits in Bittensor](../learn/chain-rate-limits.md).
73+
7274
## Minimum stake
7375

7476
The minimum stake you can redelegate to a child hotkey is as follows:

0 commit comments

Comments
 (0)