Weight class
Represents the computational weight parameters for executing a blockchain call.
Weight is Substrate's mechanism for measuring and limiting the computational resources required to execute extrinsics. It has two components:
- Reference Time: The actual computational time required
- Proof Size: The size of the proof data (Proof of Validity) for parachains
When submitting multisig approvals, you must specify the maximum weight the final call execution might consume. This prevents unbounded execution and ensures fair resource allocation on the blockchain.
Example:
// Default weight (1 second execution, 10KB proof)
final weight = Weight(
refTime: BigInt.from(1000000000), // 1 second in picoseconds
proofSize: BigInt.from(10000), // 10KB
);
// For heavy operations, increase the weight
final heavyWeight = Weight(
refTime: BigInt.from(2000000000), // 2 seconds
proofSize: BigInt.from(50000), // 50KB
);
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- proofSize → BigInt
-
Proof size: the size of the proof data required.
final
-
props
→ List<
Object> -
The list of properties that will be used to determine whether
two instances are equal.
no setter
- refTime → BigInt
-
Reference time: the computational time required for execution.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stringify → bool?
-
If set to
true, thetoStringmethod will be overridden to output this instance'sprops.no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toEncodableObject(
) → Map< String, BigInt> - Converts to an encodable object for SCALE encoding.
-
toJson(
) → Map< String, dynamic> - Converts this Weight to a JSON representation.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited