This guide explains how to decode and understand various events that may occur after a Clearing Transaction (CT).
Clearing Transactions are a special type of unsigned transaction, this means that seeing this popup after execution does not mean that the CT was successful
Events
CTs provide events at every step of execution for easier debugging. Below are the list of most common events.
CTProcessingStarted
This event denotes that the CT has started processing
/// Clearing transaction execution startedCTProcessingStarted {/// Involved app agent id.pool_id:T::AppAgentId,/// App agent admin - author of the CT.admin:T::AccountId,},
CTAtomicProcessingStarted
This event denotes that an atomic within the CT has started execution
// The processing of an atomic has startedCTAtomicProcessingStarted {/// Involved app agent id.pool_id:T::AppAgentId,/// App agent admin - author of the CT.admin:T::AccountId,/// Index of failed atomic group.atomic_index:u32,/// Length of failed atomic group.atomic_actions_number:u32,}
CTAtomicProcessingCompleted
This event denotes that an atomic within the CT has completed execution
/// The processing of an atomic has completedCTAtomicProcessingCompleted {/// Involved app agent id.pool_id:T::AppAgentId,/// App agent admin - author of the CT.admin:T::AccountId,/// Index of failed atomic group.atomic_index:u32,/// Length of failed atomic group.atomic_actions_number:u32,}
CTAtomicProcessingFailed
This event denotes that an atomic failed to process
/// Failed to process atomicsCTAtomicProcessingFailed {/// Involved app agent id.pool_id:T::AppAgentId,/// App agent admin - author of the CT.admin:T::AccountId,/// Index of failed atomic group.atomic_index:u32,/// Length of failed atomic group.atomic_actions_number:u32,}
CTActionFailed
This event denotes that an action within the CT failed to process
/// Clearing transaction action failed.CTActionFailed {/// Involved app agent id.pool_id:T::AppAgentId,/// App agent admin - author of the CT.admin:T::AccountId,/// Index of failed atomic group.atomic_index:u32,/// Index of failed action inside atomic group.action_index:u32,/// Error that led to action failure.error:DispatchError,/// origin for processing of the actionsource_address:T::AccountId,/// the module called in the actiontarget_module_name:Vec<u8>,/// the call of the module called in the actiontarget_call_name:Vec<u8>,}
CTProcessingCompleted
This event denotes that a CT has completed processing
/// Clearing transaction successfully completed.CTProcessingCompleted {/// Involved app agent id.pool_id:T::AppAgentId,/// App agent admin - author of the CT.admin:T::AccountId,// Number of successfully processed atomicssuccessful_atomics_number:u32,// Number of successfully processed actionssuccessful_actions_number:u32,// Number of atomics that were cancelled and no-opcancelled_atomics_number:u32,// Number of actions that were cancelled and no-opcancelled_actions_number:u32,}
Example:
Lets analyse the execution of a Clearing Transaction. This CT has one atomic with one action:
From this events we can see that
-> The CT processing started (CTProcessingStarted)
-> The Atomic processing started (CTAtomicProcessingStarted)
-> The action failed to process (CTActionFailed)
-> The atomic failed to process (CTAtomicProcessingFailed)
-> Points were burned to execute the CT (ClearingPointsBurned)
-> CT processing was completed (CTProcessingCompleted)
Now lets analyse individual events to figure out why the transaction failed:
-> The CTActionFailed tells us the details of the failed action and the cause of error
-> The CTAtomicProcessingFailed gives us info about the atomic, since this atomic had only one action, it says actionsNumber=1
-> The CTProcessingCompleted gives us a summary of CT
We can see that one atomic failed and one action failed
You can view the full list of events here (TODO : link to rust docs)