Skip to main content

๐Ÿ“ข 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.

EnvironmentConfiguration
Local DevelopmentConstBool<true>
ProductionConstBool<false>
TestingConstBool<true>
BenchmarkingConstBool<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.

EventPayloadDescription
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.

EventPayloadDescription
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.

EventPayloadDescription
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.

EventPayloadDescription
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:

  • CommitValue
  • DigestModel
  • IndexValue
  • IndexEntryValue
  • IndexEntriesValue
  • PoolValue
  • PoolSlotValue
  • PoolSlotsValue
  • AssetIssuable
  • AssetReapable
  • ReasonValuation

These events exist only for debugging and runtime exploration.


๐Ÿ“Œ In One Sentenceโ€‹

pallet-commitment can 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