Othentic
  • Introduction
    • Introducing Othentic Stack
    • Use Cases
  • AVS Framework
    • Abstract
    • Quick Start
    • Othentic CLI
      • Key Management
      • Contracts Deployment
      • Operator Registration
      • AVS Logic Implementation
      • Operator Deposit
      • Node Operators
      • Rewards Distribution
      • P2P Config
        • Custom P2P Messaging
        • P2P Auth Layer
        • Metrics and Monitoring
        • Logging
        • Persistent storage
        • Latency
      • CLI Command Reference
    • Smart Contracts
      • AVS Governance
      • Attestation Center
      • Hooks
        • Task Logic
        • Operator Management
        • Rewards Fee Calculator
      • OBLS
      • Othentic Registry
      • Message Handlers
    • Othentic Consensus
      • Abstract
      • Task & Task Definitions
      • Leader Election
      • Proof of Task
      • Execution Service
      • Validation Service
      • Voting Power
      • Rewards and Penalties
      • Internal Tasks
    • FAQ
    • Supported Networks
    • Explainers
      • Networking
      • Multichain
      • Production Guidelines
      • Operator Allowlisting
      • Governance Multisig
  • External
    • AVS Examples
  • GitHub
  • Othentic Hub
Powered by GitBook
On this page
  • Task
  • Lifecycle of a Task
  • Task Definition
  • Creating Task Definition
  • Using CLI
  • Define Minimum Voting Power For a task
  • Using CLI
  • Set Restricted Operator Set for a Task
  • Using CLI
  • Set Maximum number of Attesters for a Task
  • Task Execution
  • Triggering a Task
  1. AVS Framework
  2. Othentic Consensus

Task & Task Definitions

PreviousAbstractNextLeader Election

Last updated 1 month ago

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 ⇒ Task is executed off-chain.

  • Task validation using ⇒ Task is validated by the .

  • Task submission by ⇒ 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:

Parameter
Type
Description

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

const attestationCenter = new ethers.Contract(
  ATTESTATION_CENTER_ADDRESS,
  ['function createNewTaskDefinition(string,(uint256,uint256,uint256,uint256,uint256,uint256,uint256[])) external']
);

const tx = await attestationCenter.createNewTaskDefinition(
  "Example Task",             // Human-readable name
  {             
  ethers.MaxUint256,          // Never expires
  ethers.parseEther('0.01'),  // Reward for attestation
  ethers.parseEther('0.1'),   // Reward for performer
  ethers.parseEther('0.005'), // Reward for aggregation
  0,                          // Disable disputes
  0,                          // Minimum Voting Power
  []                          // Restricted Operator Set 
  }                          
);

await tx.wait();
import { Script, console } from 'forge-std/Script.sol';

interface IAttestationCenter {
    struct TaskDefinitionParams {
        uint256 blockExpiry;
        uint256 baseRewardFeeForAttesters;
        uint256 baseRewardFeeForPerformer;
        uint256 baseRewardFeeForAggregator;
        uint256 disputePeriodBlocks;
        uint256 minimumVotingPower;
        uint256[] restrictedOperatorIndexes;
    }
    function createNewTaskDefinition(
        string memory _name,
        uint256 _blockExpiry,
        uint256 _baseRewardFeeForAttesters,
        uint256 _baseRewardFeeForPerformer,
        uint256 _baseRewardFeeForAggregator,
        uint256 _disputePeriodBlocks,
        uint256 _minimumVotingPower,
        uint256[] _restrictedOperatorIndexes
    ) external returns (uint16 _id);
}

contract CreateNewTask is Script {
    function run () external {
        IAttestationCenter attestationCenter = IAttestationCenter(ATTESTATION_CENTER_ADDRESS);

        uint16 taskId = attestationCenter.createNewTaskDefinition({
            _name: "Example Task",                           // Human-readable name
            _params: TaskDefinitionParams(
               blockExpiry: type(uint256).max,               // Never expires
               baseRewardFeeForAttesters: 0.01 ether,        // Reward for attestation
               baseRewardFeeForPerformer: 0.1 ether,         // Reward for task
               baseRewardFeeForAggregator: 0.005 ether,      // Reward for aggregation
               disputePeriodBlocks: 0                        // Disable disputes
               minimumVotingPower: 0                         // Minimum Voting Power
               restrictedOperatorIndexes: new uint256[](0)   // Restricted Operator Set
            )
        });

        console.log('New task ID: %s', taskId);
    }
}

Using CLI

To create a task definition, execute the following command:

othentic-cli network create-task-definition --l1-chain <l1_chain_name> --l2-chain <l2_chain_name>

Follow these steps when prompted:

  1. Provide the private key of the multi-sig address.

  2. Enter the Attestation Center contract address.

  3. Specify all the task parameters as specified above.


Define Minimum Voting Power For a task

Parameter
Type
Description

_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:

othentic-cli network set-min-voting-power-per-taskid

Follow these steps when prompted:

  1. Provide the private key of the multi-sig address.

  2. Enter the Attestation Center contract address.

  3. 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.

Parameter
Type
Description

_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 a InvalidRestrictedOperator(taskDefinitionId, attesterId) error.

Using CLI

To configure the restricted operator set for a specific Task ID, execute the following command:

othentic-cli network set-restricted-attesters

Follow these steps when prompted:

  1. Provide the private key of the multi-sig address.

  2. Enter the Attestation Center contract address.

  3. Specify the Task ID and restricted attester Ids.

Set Maximum number of Attesters for a Task

setTaskDefinitionMaximumNumberOfAttesters

Parameter
Type
Description

_taskDefinitionId

uint16

Task Definition ID

_maximumNumberOfAttesters

uint256

Maximum number of Attesters


Task Execution

Triggering a Task

Manual

Tasks can be triggered manually via an API call. This can be done using curl or any HTTP client to send a request to the execution service.

curl -X POST http://localhost:4003/task/execute

Event-based

Tasks can be automatically 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. The system listens for specific events and executes tasks when conditions are met.

  • Implementation

    • Monitor specific contract addresses for predefined event signatures

    • Parse and decode emitted events from transaction logs

    • Trigger task execution when qualifying events occur

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.


The for the Attester rewards function

The for the Performer rewards function

The for the Aggregator rewards function

for any operator

New Task Definitions are created on-chain via the smart contract. To create a task definition, call as shown in the example below:

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 .

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 .

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

To execute a specific task, Performer node invokes the using taskDefinitionId. Othentic framework allows you to customize the logic to trigger a task based on the different use cases.

AttestationCenter
createNewTaskDefinition
setTaskDefinitionMinVotingPower
AVSGovernance
setTaskDefinitionRestrictedOperators
AVSGovernance
Execution Service
Smart Contract Events Based Trigger Implementation
RRR
RRR
RRR
Execution Service
Validation Service
here
Minimum voting power
Attesters
Aggregator
base reward
base reward
base reward