MaxFields

Constant v140 → v265, v273 → current u32

Limits commitment data structure complexity.

Current Value

3
Relevant 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

VersionBlockChangeValue
v140#1,929,216Added1
v273#5,659,032Changed1 → 3

Code Examples

import { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443

const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);

// Query MaxFields constant
const value = await api.constants.Commitments.MaxFields();
console.log("MaxFields:", value);

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 Shape modified Current

Runtime Info

Pallet
Commitments
First Version
v140
Latest Version
v140
Current Runtime
v411