ā¹ļøScenarios
Different aspects of PowerAgent network operation
User operations
Scenarios related to users interacting with PowerAgent.
Keeper registration
This scenario covers the registration and activation of a keeper.
The noderunner allows spending and stakes CVP, registering a Worker address in the Agent contract.
The noderunner configures and launches the node software.
The noderunner sends activation transaction into the Agent contract, enabling the node to execute tasks.
Job submission
This scenario covers the submission of automated task into the PowerAgent network.
0. (optional) The job owner deploys a smart-contract (which may contain a resolver function, which may also be in a separate contract).
The job owner selects the implementation of the Agent contract.
The job owner configures and registers the task in the Agent contract, accompanied by native token deposit.
The job owner provides the address and the function of the target smart contract.
The job owner sets the stake range.
The job owner sets the execution interval.
The job owner provides the native token to be used as rewards for execution.
The job owner submits the job into the Agent contract.
The Agent contract randomly assigns a keeper to the job.
The job is available for execution immediately.
Staking and withdrawing
TBA
Node operations
Scenarios which are related to the operation of the PowerAgent node and do not include user interactions.
Keeper selection
Keeper selection occurs immediately after the job submission, as well as after every job execution.
The job is submitted or executed.
In the same transaction, the Agent contract randomly assigns a keeper from a set of viable keepers.
The node updates the information about the job.
All keeper nodes set up a timer (for interval tasks) or immediately start static calls to the resolver function in each block (resolver tasks).
The set of viable keepers is determined by the keepers' stake and the job-specific stake range. The range is set by the job owner. See more about job configuration.
Interval task execution
The interval task is an automation task which requires execution once in a given period of time.
Time comes for the task to be executed.
The timer set by every node also expires.
The node assigned to this task sends execution transaction to the Agent contract.
If the node does not send the execution transaction in time, slashing occurs (if there is at least one non-malicious node in operation).
If the node sends the execution transaction in time, the Agent contract checks:
The sender is the assigned keeper OR both the sender is the current slasher AND the grace period is over.
Whether the keeper has sufficient CVP stake globally and for this particular job.
Whether the time is correct, and the task should be executed.
The block base fee is not greater than the maximal base fee set by the job owner (OR exceeding the max base fee is permitted by the job owner).
And several more checks.
In case all checks pass, the Agent relays the execution transaction to the target contract address.
In case checks do not pass, the Agent reverts the transaction.
In case the execution is successful, the reward is calculated and paid out to the keeeper.
In case the execution is unsuccessful, the gas compensation is paid out to the keeper and the keeper is released.
The job information inside the Agent contract is updated. The job is disabled IF there is insufficient job balance.
Keeper selection is performed.
Resolver task execution
The resolver task requires a special (resolver) function to return (executabilityFlag, calldata)
in order to determine whether the task should be executed. executabilityFlag
can be either true
(the task SHOULD be executed THIS BLOCK) or false
(the task SHOULD NOT be executed THIS BLOCK).
All PowerAgent nodes virtually execute the resolver function related to this task.
When the resolver function returns
(executabilityFlag, calldata)
, the assigned keeper sends the execution transaction to the Agent, passing the calldata received from the resolver execution.The Agent relays the transaction to the target function of the target contract, passing the calldata.
The following steps are 7., 8., and 9. from Interval Task Execution.
Reward Calculation
TBA
Slashing
Slashing is the process of partial keeper stake alienation in benefit of a slasher keeper.
Each keeper is given a certain time window, during which ONLY he can safely send an execution transaction. If a keeper fails to do so, another keeper (named slasher) will send its own transaction. In this transaction:
The task is executed by the slasher (see Interval task execution or Resolver task execution).
The negligent keeper is slashed for a following amount:
Where:
- Slashed Amount, dynamic Slashed Amount, fixed Slashed Amount
- keeper's stake.
- slashing fee (bps).
- fixed slashing fee.
The slashed amount is immediately added to the slasher keeper's stake.
Resolver Guidelines
TBA
Last updated