EIP-7833 Scheduled function calls
No call decision · EVM & execution · EIP status Stagnant · created 2024-12-06
Adds the OFFERCALL opcode, which lets a contract offer ETH so that its own function is automatically executed in the next block. Scheduled calls execute before ordinary transactions.
Why it is needed
Ethereum smart contracts let code manage funds, but they cannot act on their own. They only execute when someone outside sends a transaction to wake them up. This is a problem when timing matters. If there is network delay, or if the block producer building the block acts maliciously, as in an MEV attack, the contract may fail to execute at the exact moment it needs to. This proposal presents a way for a contract to reserve a function call to be executed in the next block, offering ETH in exchange. If a function schedules itself repeatedly, it behaves like a bot that runs every block without any human intervention. The idea is that if execution of scheduled calls is enforced as a condition for a block to be valid, block producers cannot refuse to execute bots that neutralize market manipulation, which could help mitigate MEV attacks.
What changes
Today
- Contracts only execute when an external transaction arrives
- They may fail to execute in time due to network delay or a block producer's MEV attack
- There is no protocol-level way to execute a function at a specific time
After EIP-7833
- A contract offers ETH via OFFERCALL to schedule a function call for the next block
- Scheduled calls execute before user transactions, ranked by offer amount
- If a function reschedules itself, it keeps running like a bot
- If the offer fails, the bot stops and the owner must manually revive it
Who is affected
- Contract developer: Bot-like contracts can be created that automatically execute functions without an external trigger. In exchange, the bot must be managed so it does not die if the offer amount becomes insufficient.
- Block producers and validators: Scheduled calls must be aggregated, ranked, and executed at the very front of the block. Since this execution becomes a condition of block validity, it cannot be refused.
- Client teams: A new opcode must be added, along with logic to aggregate, sort, and execute scheduled calls, requiring a network upgrade.
- Users: If bots that neutralize market manipulation execute in a guaranteed order, the damage from MEV attacks could be mitigated.
In depth
How the OFFERCALL opcode works
OFFERCALL is a new EVM opcode that asks the next block's block producer to call a specific function, offering ETH to be burned in exchange. Nodes aggregate incoming offers, rank them, keep only the top N, and discard the rest. Scheduled calls must execute before all user transactions, and the execution order is determined by rank in the sorted list. The source text does not specify concrete parameters such as the value of N or gas costs.
The bot pattern created through self-scheduling
In the Solidity example in the source text, the constructor ignites the bot by calling offercall(update, offerPerCall), and each time the update() function runs, it reschedules itself the same way. If a function recursively schedules the next block's call, it becomes a bot that runs every block without any external trigger. The example also includes a setOffer(_offer) function for adjusting the offer amount, letting the owner change the amount and revive the bot if it dies.
Failure conditions and restart
OFFERCALL fails in two cases: when the contract does not hold enough ETH to cover the offered amount, and when the offered amount does not rank within the top N. If OFFERCALL fails once inside a self-scheduling function, the bot becomes inactive. The only way to revive it is for the contract owner to manually call the function again, and the source text notes that this will likely require offering a higher amount.
Why the offered amount is burned
The offered ETH is not paid to the block producer; it is burned. This is to prevent the system from being abused, such as a block producer scheduling a call that pays the amount back to itself. The security considerations section also flags, as a major concern, that wealthy users could monopolize execution priority and lead to centralization, and explains that burning unfulfilled offers partially addresses this problem by preventing endless escalating offers.
Block validity requirements and MEV mitigation
This proposal suggests enforcing execution of scheduled calls as a requirement for block validity. Under this structure, if a block producer builds a block while omitting a scheduled call, the block itself becomes invalid. The source text explains that this would force block producers to always execute bots that neutralize market manipulation within the chain, which could help mitigate MEV attacks.
Backward compatibility and adoption requirements
OFFERCALL is a feature that does not exist in the current EVM, so introducing it requires a network upgrade (hard fork). It creates a new mechanism by which contracts schedule function calls and incentivize their execution, and block producers must change their behavior to accommodate it. There is no Reference Implementation yet.
Current status: Stagnant
This EIP is a Standards Track Core proposal, and its current status is Stagnant. Discussion has stalled, and it has not been finalized as a standard; if reactivated, its specification could change. There is also no record of a decision on fork inclusion from core developer calls.