Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

duebook_demo package

Overview

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.

Function

Render

func Render(path string) string

Render serves three views, selected by path. Anyone may Schedule, so the default view must not be something a stranger can inflate: it shows only what is publishable right now, capped at MaxListed. The full scheduled table lives behind :open and is capped too, so no view is unbounded and none of them is the landing page by default.

Example
1(empty)  summary + publishable now + recent publications
2open     every scheduled announcement, up to MaxListed rows
3about    what this realm is and why it exists

Param

Command

gnokey query vm/qeval -remote "https://rpc.pearl.testnets.gno.land" -data "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/duebook_demo.Render()"

Result