valopers source realm
Package valopers is designed around the permissionless lifecycle of valoper profiles.
Package valopers is designed around the permissionless lifecycle of valoper profiles.
1
1
var ErrValoperExists, ErrValoperMissing, ErrInvalidAddress, ErrInvalidMoniker, ErrInvalidDescription, ErrInvalidServerType, ErrOperatorSquatGuard, ErrSigningKeyTaken, ErrFrontrunValidator, ErrRotationThrottled, ErrRegistryEntryMissing, ErrDisallowedPubKeyType
1var (
2 ErrValoperExists = errors.New("valoper already exists")
3 ErrValoperMissing = errors.New("valoper does not exist")
4 ErrInvalidAddress = errors.New("invalid address")
5 ErrInvalidMoniker = errors.New("moniker is not valid")
6 ErrInvalidDescription = errors.New("description is not valid")
7 ErrInvalidServerType = errors.New("server type is not valid")
8 ErrOperatorSquatGuard = errors.New("post-genesis: caller must equal operator address")
9 ErrSigningKeyTaken = errors.New("signing address already in registry (active or retired)")
10 ErrFrontrunValidator = errors.New("post-genesis: signing address is already an active validator")
11 ErrRotationThrottled = errors.New("rotation throttled: try again later")
12 ErrRegistryEntryMissing = errors.New("signing address has no active registry entry (corrupted state)")
13 ErrDisallowedPubKeyType = errors.New("consensus pubkey type is not allowed for validators")
14)12
func AddToAuthList
crossing Actionfunc Auth
Actionfunc DeleteFromAuthList
crossing Actionfunc NewInstructionsProposalCallback
Actionfunc Register
crossing Action1func Register(cur realm, moniker string, description string, serverType string, addr address, pubKey string)Register registers a new valoper. The `addr` parameter is the operator address (stable identity, profile key); `pubKey` is the consensus signing pubkey, from which the signing address is derived.
Auth shape:
- Post-genesis: OriginCaller must equal addr (operator-slot squat guard). Genesis-mode replay (ChainHeight()==0) bypasses, so migration .jsonl txs and historical Register replays succeed.
- Signing-address uniqueness: derived(pubKey) must not already be in signingRegistry, active or retired.
- Front-running guard: post-genesis, derived(pubKey) must not already be an active validator (a fresh registration cannot squat on the consensus address of an existing validator).
Why OriginCaller==addr is sufficient (no IsUserCall): squatting requires the attacker to be able to satisfy OriginCaller==victim, which requires the victim's signing key. r/sys/namereg/v1.Register also gates on IsUserCall, but that's because IT reads unsafe.OriginSend() for the anti-squatting payment and IsUserCall is needed to ensure the OriginSend envelope reflects what landed at this realm rather than a phantom payment from a previous frame. valopers.Register has no per-call payment-receipt check (fees are validated against banker.OriginSend in a way that's symmetric to IsUserCall via direct comparison), so the IsUserCall tightening would only block legitimate `maketx run` flows (operator-authored scripts that legitimately set OriginCaller==operator) without adding identity-squat protection.
Auth-list seeding: the profile's Authorizable owner is set to addr (NOT OriginCaller). At H>0 the squat guard makes them equal anyway; at H==0 the deployer pattern (one signer registers many operators) requires owner == addr so each operator can manage their own profile post-genesis without needing the deployer's auth.
func Render
Render renders the current valoper set. "/r/gnops/valopers" lists all valopers, paginated. "/r/gnops/valopers:addr" shows the detail for the valoper with the addr.
func UpdateDescription
crossing ActionUpdateDescription updates an existing valoper's description.
func UpdateKeepRunning
crossing ActionUpdateKeepRunning updates an existing valoper's active status. Calls v3.NotifyValoperChanged because the cache stores KeepRunning.
func UpdateMoniker
crossing ActionUpdateMoniker updates an existing valoper's moniker.
func UpdateServerType
crossing ActionUpdateServerType updates an existing valoper's server type.
func UpdateSigningKey
crossing ActionUpdateSigningKey rotates an operator's consensus signing key.
Auth: caller must be on the operator's auth list (defaults to operator at Register time; extendable via AddToAuthList).
Invariants checked at entry:
- throttle: ChainHeight() - v.LastRotationHeight >= rotationPeriodBlocks
- signingRegistry uniqueness: derived(newPubKey) not in registry (active OR retired); permanently blocks key reuse
- fee: unsafe.OriginSend() >= rotationFee (mirrors Register's fee-check pattern)
Effect: profile's SigningPubKey/SigningAddress/LastRotationHeight updated; old registry entry marked retired (retiredAtHeight = ChainHeight()); new entry inserted into signingRegistry; v3 emits remove+add to sysparams via RotateValoperSigningKey; v3 cache refreshed via NotifyValoperChanged. Rotation lands in consensus at H+2.
Atomicity: Gno tx atomicity rolls back all state if any step panics. If v3.RotateValoperSigningKey panics, the registry insert and profile mutation revert with it.
func GetByAddr
ActionGetByAddr fetches the valoper using the operator address, if present.
1
type Valoper
struct 1type Valoper struct {
2 Moniker string // A human-readable name
3 Description string // A description and details about the valoper
4 ServerType string // The type of server (cloud/on-prem/data-center)
5
6 OperatorAddress address // operator identity, profile key, stable across rotations
7 SigningPubKey string // current consensus signing pubkey (bech32 gpub1...)
8 SigningAddress address // = chain.PubKeyAddress(SigningPubKey)
9
10 LastRotationHeight int64 // throttle anchor for UpdateSigningKey
11
12 KeepRunning bool // operator wants this validator running in the active set
13
14 auth *authorizable.Authorizable
15}Valoper represents a validator operator profile.
18
- chain stdlib
- chain/runtime stdlib
- chain/runtime/unsafe stdlib
- crypto/bech32 stdlib
- errors stdlib
- gno.land/p/moul/authz package
- gno.land/p/moul/realmpath package
- gno.land/p/moul/txlink package
- gno.land/p/nt/avl/v0 package
- gno.land/p/nt/avl/v0/pager package
- gno.land/p/nt/bptree/v0 package
- gno.land/p/nt/combinederr/v0 package
- gno.land/p/nt/ownable/v0 package
- gno.land/p/nt/ownable/v0/exts/authorizable package
- gno.land/p/nt/ufmt/v0 package
- gno.land/r/sys/params realm
- gno.land/r/sys/validators/v3 realm
- regexp stdlib