vm/qrender output, sanitized (docs/render-security.md) and displayed in an empty-sandbox iframe — scripts, forms and popups cannot run. Links stay inert in-preview; right-click to open.
"chain"
9
10"gno.land/p/nt/ufmt/v0"
11"gno.land/p/sys/validators/v0"
12"gno.land/r/gov/dao"
13 sysparams "gno.land/r/sys/params"
14)
15
16// ValoperChange is the operator-keyed input shape for the v0 valset
17// proposal builder. Power=0 removes; Power>0 adds (or upserts the
18// power on an op already in the active set — Tendermint's natural
19// ValidatorUpdate semantics).
20//
21// Each operator may appear AT MOST ONCE per proposal; duplicates are
22// rejected at create-time.
23type ValoperChange struct {
24 OperatorAddress address
25 Power uint64
26}
27
28func NewValoperChange(operatorAddress address, power uint64) ValoperChange {
29return ValoperChange{
30 OperatorAddress: operatorAddress,
31 Power: power,
32 }
33}
34
35const errNoValoperChanges = "no valoper changes proposed"
36
37// NewValidatorProposalRequest builds a GovDAO proposal that, when
38// executed, applies the deltas to the chain's effective valset and
39// publishes the new full set via SetValsetProposal.
40//
41// NON-CROSSING (no `cur realm`). Direct MsgCall is unsupported;
42// proposers route through r/gnops/valopers/proposal's facade
43// (which IS crossing and accepts user txs).
44//
45// Validation at creation time:
46// - Each operator may appear AT MOST ONCE in changes; duplicates
47// panic. Power changes for an op already in the active set use
48// a single {op, newPower} entry (upsert), not the legacy
49// remove/re-add pair.
50// - Every ValoperChange's OperatorAddress must exist in
51// valoperCache. Unknown operators panic.
52// - Adds (Power > 0) require KeepRunning=true. An op that has
53// called UpdateKeepRunning(false) signals opt-out; no proposal
54// can keep them in the active set, period.
55//
56// Pubkey resolution at execution time: the executor callback
57// re-reads valoperCache for each entry to capture the CURRENT
58// signing pubkey/address — not the creation-time one. Defends
59// against a stale (now-retired) key publication if the operator
60// rotated while the proposal sat in GovDAO. Also re-checks
61// KeepRunning so an operator flipping to KeepRunning=false between
62// propose-create and propose-execute is honored. Removes are
63// unaffected (operator address is the lookup key, not signing
64// address).
65//
66// Emits ValidatorAdded / ValidatorRemoved events per entry on
67// successful execution. (Power-upsert on an existing op also emits