Limits commitment data structure complexity.
Current Value
3Relevant for: validatorsminersdevelopers
The Big Picture
Commitments can include multiple data fields (like identity fields, endpoints, timelocked data). This constant caps how many fields a single commitment can have to prevent unbounded storage.
Why This Matters
When building commitment data, you need to know the maximum fields allowed. Exceeding this limit causes the set_commitment call to fail.
Example
MaxFields is 3. Your commitment can have up to 3 Data fields. If you try to submit 5 fields, you'll get TooManyFieldsInCommitmentInfo error.
Common Questions
- What counts as a field?
- Each Data entry in the commitment's fields array counts as one field.
From Chain Metadata
The maximum number of additional fields that can be added to a commitment
Use Cases
- Validate commitment structure before submission
- Plan commitment data layout
Value History
| Version | Block | Change | Value |
|---|---|---|---|
| v140 | #1,929,216 | Added | 1 |
| v273 | #5,659,032 | Changed | 1 → 3 |
Code Examples
import { ApiPromise, WsProvider } from "@polkadot/api";
import { stringCamelCase } from "@polkadot/util";
const provider = new WsProvider("wss://entrypoint-finney.opentensor.ai:443");
const api = await ApiPromise.create({ provider });
// Query MaxFields constant
const value = api.consts[stringCamelCase("Commitments")][stringCamelCase("MaxFields")];
console.log("MaxFields:", value.toHuman());Type Information
- Type
- u32
- Byte Size
- 4 bytes
- Encoding
- fixed
- Raw Hex
- 0x03000000
Version History
v140 block 1,929,216 Added
v273 block 5,659,032 Re-added Current
Runtime Info
- Pallet
- Commitments
- First Version
- v140
- Latest Version
- v140
- Current Runtime
- v393