Executors and coordination

Automation in EES comes from incentivicing external parties to perform on-chain transactions at the right time in exchange for a fee. These parties are called executors and are typically automated programs scanning for jobs which are profitable to execute. Participation as an executor is permissionless, but requires registering via the Coordinator contract by staking an amount of tokens. The Coordinator contract keeps track of all executors but more importantly coordinates who can execute jobs at what time as well as regulating incentivization.

ARCADE

EES uses a new coordination mechanism named ARCADE (Alternating Round-based Competitive And Designated Decentralized Execution). As the name suggests, ARCADE alternates between phases of open competition and designation.

Open competition

During open competition, any executor can execute any job which is executable in that period. However, executing during open competition costs a flat tax which covers both executor tax and protocol tax. Thus, for the job to be profitable to execute, the associated fee must be sufficient to cover both the tax and gas fee for performing the on-chain transaction.

Designated round

During a designated round, one of the executors are randomly selected to have the exclusive ability to execute jobs for the whole duration of that period. However, the designated executor is slashed some of their stake if they fail to check-in via the executeBatch of the Coordinator contract at some point during the round. If they check-in, they are rewarded with the accumulated executor tax from the last open competition. Furthermore, designated executors do not have to pay executor tax, only protocol tax.

Properties

The ARCADE mechanism has a set of properties making it suitable for a smart ocntract automation system:

  • Anyone can participate given they have the resources to stake.

  • Coordination happens exclusively on-chain - there are no dependencies on external mechanisms. Executors can run their own software completely independant of other executors.

  • Single honest actor - even if one or more bad actors try to stall the system by not executing any jobs during designated rounds, a single honest actor can always take the reward and execute those jobs during open competition. This makes the system censorship resistant.

  • Fair incentivization - while open competition can lead to low profit margin, the executor tax ensures stable profit for designated executors, incentivizing non competitive executors to participate and execute as many jobs as they can during their designated round.

  • Harsh punishment - Being offline incurs slashing of the executor's stake and eventually deactivates them. This makes the current number of staked executors a good proxy for measuring honest participants.

Read more about the properties and design choices of ARCADE in this post.

Implementation in EES

The ARCADE model is implemented in the EES Coordinator contract. However, picking an executor for each round requires a state change which cannot be completely time-based automated since this would be self referencing the problem. Thus in EES, alternation rounds of designation and open competition are packed together in epochs. Each epoch contains a fixed number of rounds and has to be initiated. Anyone, even non-executors, can initiate a new epoch if the last one has passed by calling the initiateEpoch function on the Coordinator contract. There is open competition in-between epochs.

Once a new epoch has been initiated, there is a time with open competition before the first round starts. During this time, the executors selected for this epoch are found. The designated executors are derived pseudo-randomly from a seed stored on-chain. Upon initiation of a new epoch, the seed is pseudo-randomly reset based on the epoch. The first part of an epoch is the commit phase. Here, each executor can choose to commit to a secret on-chain. Then, in the second part of the epoch, the reveal phase, each executor must reveal their secret on-chain which is used to shuffle the seed. At the end of the reveal phase, the current seed is the one used to derive the designated executors. Becasue each committing executor cannot know the secret of the other executors' commitment, it is impossible to construct a commitment which favors oneself. If an executor commits without revealing, they can be slashed. Read more about the commit/reveal scheme and its security properties here.

After the reveal phase, the rounds begin, alternating between designated execution and open competition as speficied in the pure ARCADE model. If an executor is inactive during their designated round, they can be slashed by another executor during the slashing phase at the end of the epoch. It is also during this phase executors who committed without revealing gets slashed. Read more about this phase here.

Note: Initiating a new epoch requires an on-chain transaction and therefore has a gas cost associated with the call. No-one initiating a new epoch is equivalent of having endless open competition. Executors who are out competed in open competition are incentivized to initiate epochs since it enforces random designation and gives them a chance to profit. Furthermore, at some point the pool of executor tax will grow so large that it is worth paying the gas fee for a chance to get it.

Note: An epoch can be initiated immediately after the previous one ends. That is right after the slashing period.

Note: Multiple rounds are packed together in epochs to reduce the time and gas cost associated with the initiating, committing, reveaing and slashing.

Careful: The system parameters such as rounds per epoch and time per round can vary from deployment to deployment. Please check details about the specific deployment here.

Last updated