1package governor23// What a consumer can ask that the pages already say.4//5// Render publishes most of this — the slot count, a proposal's epoch, why one6// ended — and a caller that has to scrape a markdown page for a number the7// engine holds is an engine with an incomplete API. These are the reads that
Functions
not supported for pure packages by the node (vm/qfuncs)
Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.
8
// close that gap.
9//
10// None of them hands back a pointer. That is the rule the whole package is
11// built to (gno-security-guide.md §3(B)): a /p/-declared type can be named by
12// another /p/ package, so an exported *proposal or a live tree handle would let
13// a stranger declare a mutator over it and have the storage-realm borrow run it
14// under the CONSUMING realm's authority. Counts, copies and strings only.
15
16// The board's dimensions, which the front page prints and a caller may want to
17// reason about before proposing.
18const (
19// MaxLive is how many proposals may stand at once.
20 MaxLive = maxLive
21
22// MaxOpen is how many of those an ordinary kind may fill. The difference
23// is kept for the governor's own kinds, so a flood of one thing cannot
24// stop the holders changing the rules.
25 MaxOpen = maxOpen
26
27// GovLanes is that difference.
28 GovLanes = govLanes
29
30// The bounds on a proposal's three strings, which doc.gno publishes as a
31// table because they decide what a proposer can say before finding out by
32// transaction.
33 MaxTitle = maxTitle
34 MaxPayload = maxPayload
35 MaxKindName = maxKindName
36
37// MaxBatch is how many members one govern:batch may carry.
38 MaxBatch = maxBatch
39
40// Bps is the basis-point scale every bar here is expressed in.
41 Bps = bps
42
43// MaxReason is the longest failure message a kind can put on the record.
44// A kind returns the string and the governor keeps it for the life of the
45// realm, so it is clipped rather than trusted.
46 MaxReason = maxReason
47
48// Reserved is the prefix the governor's own kinds carry, which Offer
49// refuses so that nothing published can render as a built-in.
50 Reserved = reserved
51)
52
53// OpenSlots is how many proposals are holding a slot, decided-and-unrun
54// included. The number the front page prints beside MaxLive.
55func (g *Governor) OpenSlots() int { return g.openIdx.Size() }
56
57// Proposals is how many questions have ever been asked here.
58func (g *Governor) Proposals() int { return g.proposals.Size() }
59
60// StoredState is the state that has been WRITTEN DOWN, which is not always the
61// state a reader is shown.
62//
63// State computes the outcome from the rules and the clock, because a proposal
64// whose deadline passed is decided whether or not anybody has poked it. Only a
65// transaction records that, so between the deadline and the next Settle the two
66// differ — and the difference is the whole reason reading is free: a read works
67// out the answer and stores nothing.
68//
69// A caller wanting to know whether the slot has actually been given back, or
70// whether there is anything left for Settle to do, wants this one.