Package duebook_demo is the reference consumer for the duebook scheduling primitive. It exists to make duebook's central claim falsifiable on a live chain.
That claim is: a deferral claimed in transaction N is refused in transaction N+1, forever. A pure package cannot demonstrate this — a vm/qeval is a single ephemeral evaluation with no state that survives it. Only a realm, called twice, can show it. So this realm is not a decoration on the primitive; it is the experiment.
What it does
Anyone schedules an announcement to be published no earlier than delayBlocks from now. Once due, ANYONE may publish it — publication is deliberately permissionless, so that what protects the announcement from being published twice is duebook's exactly-once Claim and nothing else. If an access-control list were guarding Publish, the experiment would prove nothing about duebook.
The scheduler may cancel at any time before publication. Once the optional time-to-live elapses, the announcement can never be published and anyone may clear it to free a slot.
How it wires duebook correctly
This realm is also the worked example of duebook's consumer contract:
- the clock is runtime.ChainHeight(), never a call argument (contract 1);
- heights are the only unit used (contract 2);
- the *Book is an unexported package-level var and is never returned across a realm boundary (contract 3);
- the owner is cur.Previous().Address(), never a parameter (contract 4);
- Publish performs its effect immediately after a successful Claim, in the same transaction (contract 5).
This realm holds no coins and has no admin. Every entrypoint rejects attached coins.