Skip to content

first draft of article on automation for dev - #5

Open
sjoshisupra wants to merge 3 commits into
mainfrom
automation-article
Open

first draft of article on automation for dev#5
sjoshisupra wants to merge 3 commits into
mainfrom
automation-article

Conversation

@sjoshisupra

Copy link
Copy Markdown

No description provided.

Comment thread automation/automation_article.md Outdated

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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have not implemented validation to restrict configuration of task_id to the task owner.
Currently, it is left to the user's discretion.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nizam-supraoracles , I didn't understand, please elaborate.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants