Contract reference
The functions and events of Sillu's contracts. None of them can be upgraded, so these are their interfaces for good.
The source is in packages/contracts/src in the repository, and verified on Sourcify for every
address in Contracts and addresses.
LessonBook
struct Lesson {
uint32 nIn; // input pins
uint32 nOut; // output pins
bool stateful; // false: no memory, each run is one row. true: stepped through each run
uint32 runs; // runs stored in the test data
uint32 tests; // runs checked per grading; 0 means every run, inside the tape-out
uint32 fixedTests; // how many of those are the lesson's chosen cases, checked first
uint32 beats; // rows per run
uint32 maxParts; // most NAND + LATCH parts the chip itself may burn
uint32 maxGates; // most gates, counted through reuse (a memory bit is a gate)
uint32 maxStateBits; // most memory bits, counted through reuse; 0 for a lesson without memory
uint32 maxReuses; // most reused chips inside, at every level
uint32 maxNetlistBytes; // longest netlist accepted
uint32 gasPerBeat; // gas the chip is given for one beat, the same whoever calls
bool retired;
}
function lessonCount() external view returns (uint256) // lesson ids run from 1
function lessonExists(uint256 lessonId) external view returns (bool)
function lesson(uint256 lessonId) external view returns (Lesson memory)
function nameOf(uint256 lessonId) external view returns (string memory)
function requiredLessons(uint256 lessonId) external view returns (uint256[] memory)
function rowsOf(uint256 lessonId) external view returns (bytes memory) // the whole test table
function expected(uint256 lessonId, uint256 run, uint256 beat) external view returns (bytes memory inputs, bytes memory outputs)
function addLesson(string name, Lesson spec, bytes tests, uint256[] required) external returns (uint256 lessonId) // operator
function retire(uint256 lessonId) external // operatorTest data is a table of rows. A row is the input bits, least significant bit first in
ceil(nIn / 8) bytes, then the expected output bits packed the same way. A run is beats rows in
order.
To list the course, read lessonCount, then lesson(id).retired, nameOf and requiredLessons for
each id. The first lesson is the live one that requires nothing, and each next one is the live lesson
that requires the one before. Do not assume the ids are consecutive.
Fab
struct Design { address learner; uint256 lessonId; bytes32 netlistHash; uint32 nIn; uint32 nOut; uint256 nonce; uint256 deadline; }
function tapeOut(uint256 lessonId, bytes netlist, uint32 nIn, uint32 nOut) external payable returns (uint256 circuitId)
function tapeOutSponsored(Design design, bytes signature, bytes netlist) external returns (uint256 circuitId) // relay only
function designDigest(Design design) external view returns (bytes32) // what the learner signs (EIP-712, "Sillu Fab", version 1)
function chipOf(uint256 circuitId) external view returns (address maker, uint256 lessonId)
function makerOf(uint256 circuitId) external view returns (address)
function lessonOf(uint256 circuitId) external view returns (uint256)
function priceOf(uint256 lessonId) external view returns (uint256) // OKB, what a learner pays; 0 = not for sale
function isFree(uint256 lessonId) external view returns (bool)
function freeTriesPerLesson() external view returns (uint256) // fixed at deploy
function freeTriesLeft(address learner, uint256 lessonId) external view returns (uint256)
function freeTriesUsed(address learner, uint256 lessonId) external view returns (uint256) // also the nonce the next signature must carry
function dailyFreeCap() external view returns (uint64)
function freeChipsToday() external view returns (uint64)
event ChipTapedOut(address indexed maker, uint256 indexed lessonId, uint256 indexed circuitId, bool sponsored, uint256 nandParts, uint256 latchParts);tapeOut is the paid path: send the lesson's price with the call. The site sends it with the
estimated gas plus a fifth.
Grader
A chip is known to the Grader by its circuit id on the Sillu processor.
enum Status { None, Waiting, Running, Passed, Failed, Expired }
struct Chip { address learner; uint256 lessonId; Status status; uint64 seedBlock; uint32 testsDone; uint32 testsTotal; uint32 beatsDone; uint32 gates; uint32 reuses; }
struct Pass { uint256 lessonId; uint256 circuitId; uint64 seedBlock; uint32 testsRun; uint32 gates; uint256 sameDesignAs; }
struct Record { uint256 circuitId; address holder; uint32 gates; }
function grade(uint256 circuitId) external returns (Status) // anyone; runs as many tests as the gas allows, stores its place
function gasToFinish(uint256 circuitId) external view returns (uint256) // upper bound for one call to finish
function statusOf(uint256 circuitId) external view returns (Status status, uint32 testsDone, uint32 testsTotal)
function chip(uint256 circuitId) external view returns (Chip memory)
function passedBy(uint256 circuitId) external view returns (address learner) // zero if the chip has not passed
function passOf(address learner, uint256 lessonId) external view returns (uint256 circuitId)
function passesOf(address learner) external view returns (Pass[] memory)
function sameDesignAs(uint256 circuitId) external view returns (uint256 earlierCircuitId) // zero if it is the first of its design
function recordOf(uint256 lessonId) external view returns (Record memory)
event Submitted(uint256 indexed circuitId, address indexed learner, uint256 indexed lessonId, uint256 sameDesignAs);
event Graded(uint256 indexed circuitId, address indexed learner, uint256 indexed lessonId, Status status, uint32 testsRun, uint32 failedRun, uint32 failedBeat);
event GradingPaused(uint256 indexed circuitId, uint32 testsDone, uint32 beatsDone);
event RecordSet(uint256 indexed lessonId, uint256 indexed circuitId, address indexed holder, uint32 gates);grade does not revert when it only gets part of the way: it stores its place and can be called
again. So set its gas limit yourself: a wallet's own estimate finds the least gas at which a call
does not revert, which for grade is far too little. gasToFinish is a loose upper bound, because it counts every beat at its full allowance. The
site grades the computer with a gas limit of 60 million and the other sampled lessons with 20
million, and calls again if the grading pauses.
Credential
function tokenOf(address learner, uint256 lessonId) external view returns (uint256 tokenId)
function passOf(uint256 tokenId) external view returns (Pass memory) // lesson and chip
function locked(uint256 tokenId) external view returns (bool) // ERC-5192: always true
function tokenURI(uint256 tokenId) external view returns (string memory) // JSON and SVG built on chainA standard ERC-721 token, except that every transfer and approval reverts.
TapeOut, as Sillu uses it
function eval(uint256 circuitId, bytes inputs) external view returns (bytes memory outputs)
function step(uint256 circuitId, bytes state, bytes inputs) external view returns (bytes memory newState, bytes memory outputs)
function circuitInfo(uint256 circuitId) external view returns (uint32 nIn, uint32 nOut, uint32 nState, uint32 gateCount)
function netlist(uint256 circuitId) external view returns (bytes memory)Bits are packed least significant first. eval is for a chip with no memory and reverts on one that
has any; use step for those, with a state of all zero bytes for a cleared chip.