๐ข Events
pallet-commitment can emit detailed lifecycle events for every commitment operation.
Unlike consumer pallets, however, these events are optional.
Since the pallet acts as shared runtime infrastructure, most protocols already shall emit their own domain-specific events when calling Commitment trait methods.
For this reason, internal commitment events can be disabled in production to avoid unnecessary event duplication.
๐ง EmitEventsโ
Event emission is controlled through the pallet Config trait configuration.
type EmitEvents = ConstBool<false>;
When enabled, the pallet emits events for every major commitment lifecycle operation.
This includes:
- commitment placement and resolution
- digest updates
- index creation
- pool management
- reserve operations
When disabled, these internal lifecycle events are skipped.
The commitment engine still performs exactly the same state transitions. Only event emission changes.
Recommended Configurationโ
| Environment | Configuration |
|---|---|
| Local Development | ConstBool<true> |
| Production | ConstBool<false> |
| Testing | ConstBool<true> |
| Benchmarking | ConstBool<false> |
๐ Why Disable Events?โ
Every commitment operation is normally initiated by a consumer pallet.
For example:
User
-> Staking Pallet
-> Commitment::place_commit()
-> Commitment Engine
The staking pallet already knows:
- who is staking
- which validator
- which era
- which protocol state changed
Therefore it can emit one meaningful protocol event such as:
StakePlaced {
staker,
validator,
amount,
}
instead of:
CommitPlaced
+ DigestUpdated
+ ReasonUpdated
This keeps runtime events concise and protocol-oriented instead of exposing internal commitment implementation details.
๐ Trait Dispatch Remains Observableโ
Disabling EmitEvents does not make commitment operations invisible.
Every commitment action is still initiated through a consumer pallet.
That pallet remains free to emit its own runtime events after each successful trait dispatch.
Example:
{
T::Commitment::place_commit(...)?;
Self::deposit_event(
Event::StakePlaced { ... }
);
}
This gives complete control over what users see while avoiding duplicate semantically-identical lifecycle events.
๐ฆ Reserve Eventsโ
Reserve operations are exposed directly as pallet extrinsics.
Therefore they always emit runtime events regardless of EmitEvents.
| Event | Payload | Description |
|---|---|---|
ReserveDeposited | { amount: Asset, total_reserve: Asset } | Funds moved into the commitment reserve. |
ReserveWithdrawn | { amount: Asset, total_reserve: Asset } | Reserved funds returned to free balance. |
๐งพ Commitment Lifecycle Eventsโ
When EmitEvents = ConstBool<true>, the pallet emits events for direct commitment operations.
| Event | Payload | Description |
|---|---|---|
CommitPlaced | { Proprietor, CommitReason, DigestVariant/Digest, Asset, Position } | A new commitment is created. |
CommitRaised | { Proprietor, CommitReason, DigestVariant/Digest, Asset } | An existing commitment is increased. |
CommitResolved | { Proprietor, CommitReason, DigestVariant/Digest, Asset } | A commitment is resolved and settled. |
DigestInfo | { Digest, CommitReason, Asset, Position } | A digest balance changes. |
DigestReaped | { Digest, CommitReason, Asset } | An empty digest is removed. |
๐งบ Index Eventsโ
These describe index lifecycle changes.
| Event | Payload | Description |
|---|---|---|
IndexInitialized | { IndexDigest, CommitReason, Vec<(EntryDigest, Shares, Position)> } | A new index is registered. |
IndexReaped | { IndexDigest, CommitReason } | An empty index is removed. |
๐ Pool Eventsโ
These describe managed pool operations.
| Event | Payload | Description |
|---|---|---|
PoolInitialized | { PoolDigest, CommitReason, Commission, Vec<(SlotDigest, Shares, Position)> } | A new pool is created. |
PoolManager | { PoolDigest, CommitReason, Proprietor } | Pool manager updated. |
PoolSlot | { PoolDigest, CommitReason, SlotDigest, Position, Shares } | Slot created or updated. |
PoolSlotRemoved | { PoolDigest, CommitReason, SlotDigest, Position } | Slot removed. |
PoolCommission | { PoolDigest, CommitReason, Commission } | Pool commission updated. |
PoolReaped | { PoolDigest, CommitReason } | Empty pool removed. |
๐ Development Inspector Eventsโ
When the pallet is compiled with the development features described in the previous section, inspector extrinsics emit additional read-only events.
These include:
CommitValueDigestModelIndexValueIndexEntryValueIndexEntriesValuePoolValuePoolSlotValuePoolSlotsValueAssetIssuableAssetReapableReasonValuation
These events exist only for debugging and runtime exploration.
๐ In One Sentenceโ
pallet-commitmentcan emit detailed internal lifecycle events during development, while production runtimes typically disable them and emit protocol-specific events from consumer pallets instead.
๐ Next Stepโ
The next section documents the runtime errors emitted by pallet-commitment and their significance.
๐ Core -> Errors