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

Cancel

func Cancel(cur realm, id int64) string

Cancel withdraws a scheduled announcement before it is published. Only the account that scheduled it may cancel, and only while it is still open — a cancellation that arrives after publication aborts.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/duebook_demo" -func "Cancel" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "pearl-1" -remote "https://rpc.pearl.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.pearl.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/duebook_demo" -func "Cancel" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "pearl-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.pearl.testnets.gno.land" call.tx