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

permbook_demo package

Overview

Package permbook_demo is the reference consumer for the permbook permission primitive. It exists to make permbook's central claim falsifiable on a live chain.

That claim is: a permission revoked in transaction N is refused in transaction N+1. A pure package cannot demonstrate this — a vm/qeval is a single ephemeral evaluation and nothing it writes survives it. Only a realm, called across several transactions, can show a grant taking effect and then a revoke taking it away. So this realm is not a decoration on the primitive; it is the experiment.

What it does

Two permission-gated actions, deliberately trivial so that the only interesting thing about them is the gate:

  • bump — increments a counter and records who did it
  • notice — replaces a short public notice

Neither action is reachable without the corresponding permission. The deployer is the book's admin and is the only account that may grant or revoke. Holding "bump" confers no authority over the book itself: a holder cannot grant, cannot revoke, and cannot nominate. That separation is the property being demonstrated.

How it wires permbook correctly

This realm is also the worked example of permbook's consumer contract:

  • every permbook mutator is called from a CROSSING entrypoint, passing that entrypoint's own cur, so the principal permbook resolves is this realm's immediate caller (contract 1);
  • the *Book is an unexported package-level var and is never returned across a realm boundary (contract 2);
  • Has is asked about an address this realm derived itself from cur.Previous().Address(), never about a parameter (contract 3);
  • the limits are chosen once, at init, and documented below (contract 4).

This realm holds no coins and imports no banker. Every crossing entrypoint rejects attached coins; the read views are non-crossing, which MsgCall will not dispatch to, so no transaction can attach coins to one.

Function

Render

func Render(path string) string

Render serves three views, selected by path.

Example
1(empty)  summary, the permission table, and the gated state
2holders  every permission with its holders, up to MaxListed each
3about    what this realm is and why it exists

An inert realm (see init) reports that instead of rendering. Every view reads the book, so without this the gnoweb page would abort on a nil dereference — which is exactly the moment an operator needs it to say what is wrong. The typed read functions still abort when inert; Ready is the probe that answers the question without panicking.

Param

Command

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

Result