# Internal Task Handler

## Overview

The `InternalTaskHandler` contract on **L2** is one of the core component of the Othentic AVS framework handling [Internal Tasks](https://docs.othentic.xyz/main/learn/advanced-concepts/internal-tasks). It is responsible for processing and executing system-level tasks that are delegated by the `AttestationCenter`.&#x20;

These tasks include:

* [Voting power synchronization](https://docs.othentic.xyz/main/learn/advanced-concepts/internal-tasks#sync-voting-power)
* Voting power sync per task definition

***

## Core Functions

#### getLastCommitBlockL1

```
function getLastCommitBlockL1() external view returns (uint256);
```

Returns the block number of the last committed update from L1.

#### getLastCommitBlockL2

```
function getLastCommitBlockL2() external view returns (uint256);
```

Returns the block number of the last committed update from L2.

#### attestationCenter

```
function attestationCenter() external view returns (IAttestationCenter);
```

Returns the address of the current `AttestationCenter` contract.

#### processTask

```
function processTask(IAttestationCenter.TaskInfo calldata _task) external;
```

Processes a task from the `AttestationCenter`. Based on the [taskDefinitionId](https://docs.othentic.xyz/main/learn/core-concepts/tasks/task-definitions), the appropriate internal function is triggered:

* [Voting Power Sync](https://docs.othentic.xyz/main/learn/advanced-concepts/internal-tasks#sync-voting-power) 10001
* [Voting Power Sync Per Task](https://docs.othentic.xyz/main/learn/advanced-concepts/internal-tasks#id-2.-voting-power-sync-per-task-definition) 10002

Access is restricted to the `ATTESTATION_CENTER` role.

***

### Task Handlers

#### votingPowerUpdate

```
function _votingPowerUpdate(IAttestationCenter.TaskInfo memory _task) internal;
```

Handles voting power sync tasks. Decodes a `VotingPowerUpdate` struct and updates voting power for Operators using the OBLS contract. It also includes checks against duplicate or future block submissions.

#### triggerInternalTransactionsTask

```
function _triggerInternalTransactionsTask(IAttestationCenter.TaskInfo memory _task) private;
```

Processes internal OBLS-specific administrative transactions to update voting power per task for restricted operators. This is restricted only to certain method selectors on the OBLS contract.
