Back to Home

SchedulerLib

Unclassified
Part of The Piper Merriam Collection
0xe54d323f9ef1...a9718fe5ea34
FrontierContract #7,496Source VerifiedEdit this contract
Deployed January 31, 2016 (10 years ago)Block 930,479

The scheduling half of the Ethereum Alarm Clock, carrying an on chain ordered index so pending calls could be found by block.

Frontier EraVerified Source

Historical Significance

This is one of the earliest serious uses of Solidity libraries as an architecture rather than a convenience. Splitting a service across linked libraries let the parts be deployed, addressed and reasoned about separately at a time when the language had only just gained the feature, and the pattern is now routine.

GroveLib matters on its own. Sorted, queryable data on chain is something contracts want constantly and the EVM offers no help with, and this is an early, complete answer written for a real service rather than as a demonstration.

Context

Deployed at 03:44:22 UTC on 31 January 2016, 34 seconds after CallLib, by Piper Merriam. The two are halves of a single rewrite of the Alarm Clock, which had run since September 2015 as a set of monolithic contracts named Alarm.

The service survived the split. The Ethereum Alarm Clock continued as a project for years afterwards, eventually acquiring a token and a wider network of executors, and the vocabulary it settled on here, scheduling a call and claiming the right to execute it, is roughly the vocabulary automation services still use.

Key Facts
Deployer
Piper Merriam(0xd3cda9...293601)
Deployment Block
930,479
Deployment Date
Jan 31, 2016, 03:44 AM
Code Size
6.4 KB
Gas at Deploy
1,740,060

Description

Where CallLib defines what a scheduled call is and how its executor gets paid, SchedulerLib is the front door: it takes a request to run something at a future block and deploys a FutureBlockCall contract to hold it, funded on the spot. A call must be at least MIN_BLOCKS_IN_FUTURE, ten blocks, ahead of the present, which is a straightforward defence against scheduling something so close that reorganisation or a full block makes it unservable.

The deployed source bundles the whole stack in one file: GroveLib, AccountingLib, CallLib, the FutureCall and FutureBlockCall contracts, and SchedulerLib itself, 2,157 lines in all.

GroveLib is the piece worth pausing on. It is an ordered index, a search tree maintained in contract storage, and it exists because the scheduler needs to answer a question the EVM makes awkward: which calls are due around block N. There is no iteration over storage and no query engine, so ordering has to be built by hand out of nodes and pointers, and paid for at storage prices on every insert.

The economics are explicit in the constants. GAS_OVERHEAD of 100,000 and EXTRA_GAS of 77,000 are the measured cost of the machinery wrapped around the call itself, and they are reimbursed to the executor on top of the call's own gas, so that pressing the button is profitable rather than merely break even.

Heuristic Analysis

The following characteristics were detected through bytecode analysis and may not be accurate.

Detected Type: Unclassified

Bytecode Overview

Opcodes6,532
Unique Opcodes241
Jump Instructions292
Storage Operations121

External Links

Related contracts