first draft of article on automation for dev - #5
Conversation
|
|
||
| let automation_state = borrow_global_mut<AutomaionState>(signer::address_of(user)); | ||
| automation_state.execution_counter = exec_counter; | ||
| automation_state.task_id = option::some(task_id); |
There was a problem hiding this comment.
We have not implemented validation to restrict configuration of task_id to the task owner.
Currently, it is left to the user's discretion.
There was a problem hiding this comment.
@nizam-supraoracles , I didn't understand, please elaborate.
There was a problem hiding this comment.
The reason a user sets task_id here is to enable auto-cancellation once the execution limit is reached. This auto-cancel functionality is not directly available in the automation registry, so it require the user to provide the task_id when configuring the task in their contract.
Internally, we use this task_id to stop the task via: automation_registry::stop_tasks(...).
However, this call will fail if the provided task_id does not belong to the caller (i.e., the task owner).
Currently, we have not implemented validation to enforce that the provided task_id is actually owned by the sender. Ideally, we should validate this during configuration to prevent misuse or misconfiguration.
For example:
assert!(
automation_registry::has_sender_active_task_with_id(user_addr, task_id),
ETASK_INACTIVE_OR_UNAUTHORIZED
);
…y::has_sender_active_task_with_id` function
No description provided.