Task & Task Definitions
Task
AVS Protocol core service can be broken down into “Tasks", each representing a unit of work to be carried out by the Operators. A Task is any off-chain computation the AVS network performs, from fetching price feeds to training ML models.
Othentic Stack enables AVS developers to configure multiple tasks for operators to execute, each with customizable parameters, rewards, and operator clusters. Through Task Definitions, you can specify the required security levels, number of operators, and other operational criteria necessary for task execution. This flexibility ensures that tasks requiring consensus can be precisely tailored to meet your security and operational needs.
Lifecycle of a Task
Task definition creation ⇒ A one-time transaction defines the task parameters.
Task execution using Execution Service ⇒ Task is executed off-chain.
Task validation using Validation Service ⇒ Task is validated by the Attesters.
Task submission by Aggregator ⇒ Finally, the Task is submitted on-chain.
Task Definition
Task definition specifies the task parameters including required security levels, number of operators, and other operational criteria for task execution. These parameters ensure that the Tasks requiring consensus can be clearly defined as per the security and operational needs.
Othentic Stack enables you to configure Tasks with the following parameters:
taskDefinitionId
uint16
Auto-generated incremental ID
name
string
A human-readable name for the task
blockExpiry
uint256
The block after which tasks of this type are no longer valid and will be rejected by the AttestationCenter
baseRewardFeeForAttesters
uint256
baseRewardFeeForPerformer
uint256
baseRewardFeeForAggregator
uint256
minimumVotingPower
uint256
_restrictedOperatorIndexes
uint256[]
An array of operators allowed to execute the task
Each task defines the base rewards for all entities participating in consensus: the Performer, the Attesters, and the Aggregators.
Creating Task Definition
New Task Definitions are created on-chain via the AttestationCenter
smart contract. To create a task definition, call createNewTaskDefinition
as shown in the example below:
Using CLI
To create a task definition, execute the following command:
Follow these steps when prompted:
Provide the private key of the multi-sig address.
Enter the Attestation Center contract address.
Specify all the task parameters as specified above.
Define Minimum Voting Power For a task
You can set a minimum voting power per task definition. By default, the minimum voting power is zero, which means that any active operator can participate in any consensus role and task execution. You can restrict this to having only operators with minimum shares. Learn more about voting power here.
_taskDefinitionId
uint16
Task Definition ID
_minimumVotingPower
uint256
Minimum Voting Power (in wei)
If an operator attests to a task and has less than the minimum voting power, the task would fail with a
OperatorDoesNotHaveMinimumVotingPower(operatorIndex)
error.The AVS Governance Multisig should not set this value too high so that no attester passes the threshold.
Using CLI
To configure the minimum voting power for a specific Task ID, execute the following command:
Follow these steps when prompted:
Provide the private key of the multi-sig address.
Enter the Attestation Center contract address.
Specify the Task ID and its corresponding minimum voting power.
Set Restricted Operator Set for a Task
AVS can have an unlimited number of tasks, and each task can be executed by different Operator clusters. For certain tasks, you may want to restrict execution to a specific group of operators.
You can define a restricted operator set—an "allowlist" of operators—who are eligible to execute a particular task. This can be specified within the task definition or set as registration criteria in the AVSGovernance
.
_taskDefinitionId
uint16
Task Definition ID
_restrictedOperatorIndexes
uint256[]
Restricted Operator Set
If a task that has restricted operators is submitted, the system checks that the Operators are part of the
restrictedOperatorIndexes
list. If an unrestricted operator attests to this task, then it will revert with aInvalidRestrictedOperator(taskDefinitionId, attesterId)
error.
Using CLI
To configure the restricted operator set for a specific Task ID, execute the following command:
Follow these steps when prompted:
Provide the private key of the multi-sig address.
Enter the Attestation Center contract address.
Specify the Task ID and restricted attester Ids.
Set Maximum number of Attesters for a Task
You can define a maximum number of Attesters—who are eligible to validate a particular task. This can be specified within the task definition or set as registration criteria in the AVSGovernance
setTaskDefinitionMaximumNumberOfAttesters
_taskDefinitionId
uint16
Task Definition ID
_maximumNumberOfAttesters
uint256
Maximum number of Attesters
Task Execution
Triggering a Task
To execute a specific task, Performer node invokes the Execution Service using taskDefinitionId. Othentic framework allows you to customize the logic to trigger a task based on the different use cases.
Manual Tasks can be manually triggered through an API call using curl.
Event-based
Tasks can be triggered based on external events or conditions. This includes factors like data changes, user actions, or events from external systems that indicate the task should be executed. For example, a smart contract event can initiate a task execution as shown in the PRNG AVS example.
Time-based Tasks can be scheduled to trigger at specific times or after certain time intervals.
Queue-based Tasks can be queued and executed in order of arrival or priority. A task enters a queue and is executed when its turn comes, or when resources become available.
Custom Triggers may include specific conditions or thresholds that must be met before the task is executed. For example, a task might be triggered when a user reaches a specific condition in an application or when a predefined error threshold is exceeded.
Last updated