-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[OIP] Solve TaskScheduled and TaskRescheduled duplicate problem #387
Comments
With this design, we ensure that
|
Yeah, I agree with this proposal. Also I just check the even we emit and we already emit these 2 events: Example: Should we consolidate and sunset one? |
Hmm, I see your point. After reviewing the code below, I understand that To maintain consistency with other event names, I propose renaming
|
Two new types:
Now the full flow will be, During task creation,
After task creation,
During task cancellation,
|
OAK Improvement Proposal
Motivation
Looking at the task history on Turing Network, specifically the task with the hash 0xcae095bc2b84249e4ca65671759808e0bb10680fb4fedd1ad9e358e4e084de39 shown in the screenshot below, it is evident that after each execution, both TaskScheduled and TaskRescheduled events contain identical data.
Another issue is that the event of task triggering is intertwined with execution and has no indication of whether to reschedule for the next execution. To address this, I propose the following standard for task events.
For all tasks,
After the creation extrinsic, a
TaskScheduled
needs to be fired. ✅During task execution,
A
TaskTriggered
event should be fired to indicate the successful triggering of a task.Event Name: TaskTriggered
Attributes:
time
, value:1689903366
}{ "errorCode": true or false}, for example, {"InsufficientBalance": false}
Next, the actual logic should run and generate an event for its result, such as , parachainStake.delegationIncreased. This event should resemble the ones triggered by manual signing and should not be related to task events. The event can indicate success or failure, marking the execution result of the task. The execution event index should always be equal to the event index of the above TaskTrigger + 1. Currently, events have different names like XcmpTaskSucceeded and SuccessfullyAutoCompoundedDelegatorStake. We do not need to create special events like these; instead, we can rely on the existing events in the underlying pallets.
If the task is a recurring schedule, a TaskRescheduled event should subsequently be fired, indicating that a new task has been paid for and scheduled for the next run. If the user's wallet does not have sufficient fees to pay for the next execution, an error will occur at this step, but it will not stop the execution mentioned above.
These changes offer several benefits:
TaskRescheduled
will not fire, while for recurring tasks,TaskRescheduled
will fire upon successful events and may or may not fire upon errors. For example, if the AutoCompoundDelegationStake fails due to insufficient balance to pay for the next execution fee, theTaskRescheduled
event should still be fired.Implementing these changes will enhance the clarity and separation of task-related events, providing a more structured and meaningful representation of task execution and rescheduling.
The text was updated successfully, but these errors were encountered: