Last updated
Last updated
The most important part of the PowerAgent operation. This section describes all steps performed by a Keeper and the Agent contract to execute the Job at a given time (or upon satisfying given conditions).
Whenever execution conditions are met, a Keeper is chosen to execute the task. Alternatively, a Keeper can be pre-selected for the next execution when a number of events happen (e.g. the job parameters or credits values change).
For more information on Keeper selection, see <page>.
The chosen Keeper calls the function execute_44g58pv
of the Agent contract, passing required dependent on the type of the Job and the config for the execution.
The function is heavily optimized for gas savings; inline assembly is used alongside with binary operations.
This config is constructed by the Keeper for each execution separately. Setting the flags allows the keeper to override reversion when the block base gas fee exceeds the limit set by the job owner; the second boolean flag determines whether to accrue the reward for the execution on the PowerAgent contract or transfer it to the keeper worker address immediately.
The hook functions are used to process execution calls by slashers (INSERT LINK TO SLASHING).
Their implementation varies depending on the realisation of the PowerAgent.
This hook is called at the very beginning of the execute
function. It executes only if the caller is a slasher.
The purpose of this hook is to ensure that by the time the slasher called this function, the slashing has been initiated and the task has been failed by the assigned keeper. If so, after the hook the execution continues, and the slasher becomes the executor of the task. Otherwise, a corresponding error is thrown, and the slasher is reverted.
Called at the end if the execution was successful.
Called at the end if the transaction was reverted by the Job contract.
At the current state of PPagentV2, the keeper to execute the task is selected by the Flashbots: the one offering the highest gas price is chosen, others are reverted with no cost.
In the RanDAO version, the choice is made by the following algorithm:
Keeper assignment only takes place at either a corresponding external call by a job owner, after a successful job execution, after a job is registered; if a job changes its activity status or credit amount deposited, the keeper is assigned conditionally if the job has at least the minimal admissible amount of credits (specified by the RanDAO realisation config parameter rdConfig.jobMinCreditsFinney
).
Calldata passed by the keeper for the target function execution. Read for information on execution calldata.
Choosing a keeper by random seems like a .