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

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

hlgov source realm

Package hlgov carries GovDAO's decisions to Solana (bridge/PLAN.md §5.3, §6.5, §13): a proposal made with one of the ...

Overview

Package hlgov carries GovDAO's decisions to Solana (bridge/PLAN.md §5.3, §6.5, §13): a proposal made with one of the builders below, when it executes, dispatches a message through r/hlmailbox to the admin program — the decision's kind, its parameters and its sequence number (this realm's own counter, taken at execution) — and the admin program records it by that number and executes it after its clock. Anyone may re-dispatch an executed decision (the same number and parameters) until the admin program has recorded it. The builders check the parameters with the admin program's own rules, so a proposal that would fail on Solana is refused when it is made. Kind 4 is reserved and its builder refuses every call (§13); a cancel's body starts with an 8-byte salt drawn in the executing transaction, so two cancels of one list differ; kind 12 names a token's mint limits on the pausable ISM (the per-message maximum and the day cap, in base units), one of the 7-day group.

Two decisions change this realm alone: `set decision recipient` (the program id decisions go to, a 7-day change, how a successor admin program ever receives one) and `sync sequence` (at once: the counter is raised — never lowered — to the number the admin program expects next, when a foreign decision has taken one, §6.5). The counter starts at a compiled number (launchSequence: 0 for a chain's first r/hlgov, the predecessor's last number for a successor), so no number the admin program recorded is ever reused. Before the Launch decision every builder but the cancel of a queued change here is refused. Who decides is the governor's (M1k): the compiled launchGovernor through Govern until it yields on r/hlmailbox, GovDAO's proposals after. Every launch value is compiled in below.

Constants 1

const namespace, pkgPath, KindCancel, KindUnpause, KindTokenISM, KindReserved, KindGuardians, KindRouter, KindProtocolFee, KindUpgrade, KindSuccessor, KindMintLimits, maxCancel, maxProtocolFee, MaxDecisionBody, syncReach, seatCount, guardianSeats, maxSeatChanges, launchRecipient, launchPausableISM, launchClient, launchSolSeat1, launchSolSeat2, launchSolSeat3, launchSolSeat4, launchSolSeat5, launchSolSeat6, launchSequence

 1const (
 2	namespace = "gno.land/r/g1zdaz6sypk5tdsjc2fzsqrrn4ttn8qzmnl4waqp/"
 3	pkgPath   = namespace + "hlgov" // must match gnomod.toml
 4
 5	// The kinds (§13).
 6	KindCancel      = uint8(1)
 7	KindUnpause     = uint8(2)
 8	KindTokenISM    = uint8(3)
 9	KindReserved    = uint8(4) // reserved (§13): the client's state layout is fixed for the deployment's life; refused
10	KindGuardians   = uint8(5)
11	KindRouter      = uint8(6)
12	KindProtocolFee = uint8(7)
13	KindUpgrade     = uint8(8)
14	KindSuccessor   = uint8(9)
15	KindMintLimits  = uint8(12) // set mint limits (§13): a token's per-message maximum and day cap on the pausable ISM; the 7-day group
16
17	maxCancel      = 16         // numbers one cancel names
18	maxProtocolFee = 50_000_000 // lamports: the mailbox's max_protocol_fee, 0.05 SOL, fixed at its init (§5.5)
19	// MaxDecisionBody bounds a decision's body (kind ‖ number ‖ params) at what Solana can ever deliver (the
20	// assumptions audit's F18, M1g part 2): a legacy delivery of a decision carries at most 538 bytes of body — 529
21	// of parameters, what 14 account keys and 127 bytes of fixed instruction data leave of the 1,232-byte packet —
22	// and Hyperlane's mainnet mailbox dies on its own 32 KB heap past about 2,250 parameter bytes anyway (M2-NOTES
23	// M2f), so a body no one can deliver would stick this realm's sequence with its number untaken, in a form no
24	// program of ours cures. Every builder's body is far below (a cancel at most 163 bytes with its salt, kind 5 at
25	// most 4 entries); the bound stands where this realm dispatches, checked when a proposal is made and in its
26	// closure.
27	MaxDecisionBody = 512
28	syncReach       = uint64(1) << 32 // a sync sequence raises the counter by at most this (the realm's own bound, §13; kind 10 is reserved since v35)
29	seatCount       = 6
30	guardianSeats   = 4
31	maxSeatChanges  = 4 // kind 5: two guardian seats plus either watch slot
32
33	// The launch values (§5.3, §6.5): the admin program (the first decision recipient), the pausable ISM (the only
34	// id kind 3 may name), the light client (the pausable ISM's target, whose state layout is fixed for the
35	// deployment's life — kind 4 is reserved — shown on the page for a member's check), and the four guardians' and
36	// two watch keys' Solana pubkeys as the admin program's init data carries them. PLACEHOLDERS until the Solana
37	// programs are deployed and the people have keys; bridge/local/e2e.sh swaps the program ids for its run's.
38	launchRecipient   = "38885bd746ab9dc9b6175331a61842d0ad8e0c4c2532f72e286ef7dac82b0358" // the admin program 4ogRnw9iPGa4dY8qqCs1aBWxHQvKSzHh5ttz53sLFTM9
39	launchPausableISM = "564eab462a321148f88d548996d0fd5e84c66ab630f0f4da63331592d7dce221" // the pausable ISM 6oudxto59ktYrpvqEVXTb5Tuo7vzBpkgnsPWoPXVF5Fv
40	launchClient      = "1a572d156787a62750999f343e5af6f7394f91c11f75a2949e9aefd8914e07ad" // the light client 2mphYtLZ7HnCfrFhGH2c4Do9C9UoysevkmkDb8UkbAu2
41	launchSolSeat1    = "05a1af200cfddc3b3ace76353505098855c9994913f7282f2e45ce6e473dcd6e" // Nz2u3N3RAMwq9pjw1Vv7ktN7nX4rNe4Uw5rdL9o9c3o
42	launchSolSeat2    = "028b184c1fe43ac501409db4eb45a47bc2cd280226cca57345b802d27175e5b4" // AvqEe2hdx3HH87NU9CR5GSarCD1sR6PQ2H5AjwSnC4b
43	launchSolSeat3    = "95b3b44e5adc9a0e849285e59cf6e7b0dab53e3a8772f680990f73a6111f494c" // B5NgM4oD1vYKTEGSe33RaSsHbyGzxKvoaycGqhjbyEV1
44	launchSolSeat4    = "05ec99dd32dbee307eb064892f68581b9da9ee928df5a00d7f491f0f1b4fc3d2" // Q8HoML8efSufEhvYsSffmHAGJ6YnYb2QwyMVwQYt9Ds
45	launchSolSeat5    = "195a00fb58ce0d7f762cc2b3d72017100724768fa2ae828c055d57530b34077a" // 2hxnxGiPf6cuuYXjThehyDnkXpUKjQai8fp14zkcgzjB
46	launchSolSeat6    = "24551f378d8bbdc915fd4497aa9bf73a5eb5f99447755eb9f7c751aed3d558e2" // 3SpxeQf1JTfErvkpd3Kq33Q72H4yhLynKPVECdj9ckmf
47
48	// launchSequence is the number of the last decision this realm's predecessor dispatched — 0 for a chain's
49	// first r/hlgov. A successor r/hlgov for a new chain is deployed with its predecessor's last number here
50	// (§5.3), so its counter starts where the admin program's stands and never restarts below a recorded number.
51	// Written by init; the page shows it beside the counter.
52	launchSequence = uint64(0)
53)
source

Functions 25

func Body

Action
1func Body(n uint64) string
source

Body is a dispatched decision's body in hex, by number ("" if none).

func Execute

crossing Action
1func Execute(cur realm, id int64)
source

Execute applies a queued change (a recipient swap) whose 7 days have passed; anyone may call it. A swap decided while its target was nobody applies only while that holds (R29): one that finds its target the recipient already (a second swap to the same program) or a former recipient (replaced since) is refused and stays pending for GovDAO's cancel; the recipient it replaces joins the former ones.

func Former

Action
1func Former() []string
source

Former lists every decision recipient a swap replaced, in hex, oldest first (R29): retired admin programs.

func Govern

crossing Action
1func Govern(cur realm, r Request)
source

Govern is the governor's way in before the yield (M1k): the same closure GovDAO's proxy runs after it, called non-crossing in this frame so it reads the governor from cur.Previous() — and dispatches through the mailbox under this realm's own authority, as the proxy's execution does; refused for anyone else and for everyone once the governor yielded on r/hlmailbox (or when none was compiled); see hlgnot's.

func Last

Action
1func Last() uint64
source

Last is the number of the last decision dispatched; Next the number the next one takes; Start the compiled number the counter began at (the predecessor's last number; 0 for a chain's first r/hlgov).

func Recipient

Action
1func Recipient() string
source

Recipient is the program decisions are addressed to, in hex.

func Redispatch

crossing Action
1func Redispatch(cur realm, n uint64)
source

Redispatch sends an executed decision again — the same number and parameters, a new message — by anyone, until the admin program has recorded it (a copy it has recorded is accepted and ignored there).

func Render

1func Render(path string) string
source

Render: "" the page; "json"; "decisions" and "decisions.json" the ledger; "decision/<n>" one dispatched decision.

func SolSeat

Action
1func SolSeat(n int) string
source

SolSeat is the Solana pubkey this realm last set for a seat (1–4 guardians, 5–6 watch keys), in hex.

func NewCancelQueuedRequest

crossing Action
1func NewCancelQueuedRequest(cur realm, id int64) Request
source

NewCancelQueuedRequest cancels a queued change of this realm (a recipient swap), at once; it is proposed before Launch too.

func NewCancelRequest

crossing Action
1func NewCancelRequest(cur realm, numbers string) Request
source

NewCancelRequest is kind 1: cancel pending decisions of the mailbox channel on Solana (channel 0, the only one this realm writes), by a list of numbers (comma separated, at most 16: form 0) or by a range "from-to", inclusive (form 1); each number one this realm dispatched. It executes at once there. The body is `salt u64 ‖ form u8 ‖ …` (§13), the salt drawn when the proposal executes, so the description names the numbers and the ledger's note and the decision's page carry the salt.

func NewEnrollRouterRequest

crossing Action
1func NewEnrollRouterRequest(cur realm, token uint8, domain uint32, router string) Request
source

NewEnrollRouterRequest is kind 6: enroll a token's remote router for a domain. For gno.land's own domain the router must be a route realm registered with hlmailbox — the launch routes, and the successors their migrations named — as 32 bytes: the synthetic program takes every Dispatch from the router it enrolls as a mint order, and hlmailbox's Dispatch is open to any realm, so any other address would mint synthetic that no lock backs; the token's own route (R36), unmigrated, and — a successor — one that pulled page 0 (R35). The rules are checked when the proposal is made and again when it executes. The closure then notes with the mailbox the route it enrolled and the height (hlmailbox.NoteEnrolled, AR1): that route's refund builder waits 14 days after the note (R37: a week for the delivery, a week for Solana's clock), since a refunded send stays deliverable on Solana until the predecessor's router is replaced; a cancel of the kind 6 clears the note (NewCancelRequest).

func NewSetClientLayoutRequest

crossing Action
1func NewSetClientLayoutRequest(cur realm, target string, version uint8) Request
source

NewSetClientLayoutRequest is kind 4, which §13 reserves (v27, AM7): the client's state layout the pausable ISM and the immutable admin program read is fixed for the deployment's life (version 1), a client upgrade keeps it, and a new layout is a successor admin program and pausable ISM by kind 9. The builder refuses every call, so no kind-4 message ever leaves here; the admin program refuses one at execution too.

func NewSetDecisionRecipientRequest

crossing Action
1func NewSetDecisionRecipientRequest(cur realm, program string) Request
source

NewSetDecisionRecipientRequest changes the program decisions are addressed to, 7 days after the proposal executes: how a successor admin program receives them. Never the current recipient, and never a former one (R29: a retired program answers Retired to every decision) — checked when the proposal is made, in its closure and when the queued change would apply.

func NewSetGuardiansRequest

crossing Action
1func NewSetGuardiansRequest(cur realm, changes string) Request
source

NewSetGuardiansRequest is kind 5: replace guardian seats (1–4, two at most) and watch slots (5–6) on Solana, four entries at most. A key that holds a seat as this realm last set it is warned about in the description, not refused: the admin program's own check spends a decision naming a seat's current key, and this realm's mirror of the seats can drift from the truth. It lands 7 days after delivery through any flag or hold.

func NewSetMintLimitsRequest

crossing Action
1func NewSetMintLimitsRequest(cur realm, token uint8, maximum, dayCap uint64) Request
source

NewSetMintLimitsRequest is kind 12: a token's (0 GNOT, 1 BUBBLE) per-message maximum and rolling day cap on the pausable ISM, in base units (§13: token u8 ‖ maximum u64 ‖ day cap u64; compiled there at launch as 25,000 a message and 100,000 a day of each token). A maximum of 0 (every mint refused) and a day cap below the maximum (a message at the maximum could never pass) are refused when the proposal is made: the admin program and the pausable ISM take any values, so the nonsense is caught here, as every builder catches it early. The maximum is never below the token's route's per-message maximum on gno.land (R15), checked when the proposal is made and when it executes: a send between the two would leave gno.land and be refused at delivery for good, stranded until a refund by id — so a raise is the Solana limit first (this), the route's maximum after, and a lowering the other way round. It lands 7 days after delivery.

func NewSetProtocolFeeRequest

crossing Action
1func NewSetProtocolFeeRequest(cur realm, lamports uint64, beneficiary string) Request
source

NewSetProtocolFeeRequest is kind 7: the mailbox's protocol fee (lamports, at most its 0.05 SOL maximum) and its beneficiary (the treasurer's Solana key).

func NewSetTokenISMRequest

crossing Action
1func NewSetTokenISMRequest(cur realm, token uint8, ism string) Request
source

NewSetTokenISMRequest is kind 3: point a token (0 GNOT, 1 BUBBLE) at the pausable ISM, or at none (all zeros).

func NewSyncSequenceRequest

crossing Action
1func NewSyncSequenceRequest(cur realm, n uint64) Request
source

NewSyncSequenceRequest raises this realm's counter so that the next decision takes number n — the number the admin program expects next after a foreign decision took one — at once; nothing moves on Solana. It only ever raises: a number at or below the next one is refused when the proposal is made and again when it executes (the counter may have moved in between), so a number the admin program recorded is never reused.

func NewTransferToSuccessorRequest

crossing Action
1func NewTransferToSuccessorRequest(cur realm, program string) Request
source

NewTransferToSuccessorRequest is kind 9: hand every authority to an immutable successor admin program — never the admin program itself, the decision recipient this realm knows, checked when the proposal is made and again when it executes (a recipient swap landing in between would otherwise turn a pre-armed transfer into one the admin program only spends: it re-points every authority to itself and dies on its own SuccessorInit, the programs lane's S-15), as kind 8 refuses its self-upgrade; and never a former recipient (R29), a retired program whose successor_init answers NotInherited. The admin program refuses a successor whose programdata shows an upgrade authority; the builder cannot read Solana, so a member checks that by RPC before proposing.

func NewUnpauseRequest

crossing Action
1func NewUnpauseRequest(cur realm, object uint8) Request
source

NewUnpauseRequest is kind 2: clear the flags set before its delivery on the pausable ISM (object 0) or the admin program (object 1), 24 hours after it arrives, unless two guardians' flags hold.

func NewUpgradeRequest

crossing Action
1func NewUpgradeRequest(cur realm, program, buffer, elfHash string) Request
source

NewUpgradeRequest is kind 8: upgrade a program from a staged buffer whose ELF hashes to elfHash (sha256, hex) — never the admin program's own id (§13: its upgrade authority is burned, so the decision could only be spent; a new admin program is a successor by kind 9), checked when the proposal is made and when it executes.

Types 1

type Request

struct
1type Request struct {
2	proposal dao.ProposalRequest
3	text     string
4	decide   func(cur realm) error
5}
source

Request is what a builder returns (M1k): the proposal GovDAO's proxy executes after the yield (Proposal), and the same decision the governor runs directly before it (Govern); see hlgnot's.

Methods on Request

func Description

method on Request
1func (r Request) Description() string
source

Description is the proposal's: the parameters as the builder wrote them.

func Proposal

method on Request
1func (r Request) Proposal() dao.ProposalRequest
source

Proposal is the request as a GovDAO proposal: `dao.MustCreateProposal(cross(cur), req.Proposal())`.

Dependencies

Source Files 2