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

valopers source realm

Package valopers is designed around the permissionless lifecycle of valoper profiles.

Overview

Package valopers is designed around the permissionless lifecycle of valoper profiles.

Constants 1

Variables 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)
source

Functions 12

func Register

crossing Action
1func Register(cur realm, moniker string, description string, serverType string, addr address, pubKey string)
source

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

1func Render(fullPath string) string
source

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 Action
1func UpdateDescription(cur realm, addr address, description string)
source

UpdateDescription updates an existing valoper's description.

func UpdateKeepRunning

crossing Action
1func UpdateKeepRunning(cur realm, addr address, keepRunning bool)
source

UpdateKeepRunning updates an existing valoper's active status. Calls v3.NotifyValoperChanged because the cache stores KeepRunning.

func UpdateMoniker

crossing Action
1func UpdateMoniker(cur realm, addr address, moniker string)
source

UpdateMoniker updates an existing valoper's moniker.

func UpdateServerType

crossing Action
1func UpdateServerType(cur realm, addr address, serverType string)
source

UpdateServerType updates an existing valoper's server type.

func UpdateSigningKey

crossing Action
1func UpdateSigningKey(cur realm, addr address, newPubKey string)
source

UpdateSigningKey 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

Action
1func GetByAddr(addr address) Valoper
source

GetByAddr fetches the valoper using the operator address, if present.

Types 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}
source

Valoper represents a validator operator profile.

Methods on Valoper

func Auth

method on Valoper
1func (v Valoper) Auth() *authorizable.Authorizable
source

func Render

method on Valoper
1func (v Valoper) Render() string
source

Render renders a single valoper with their information.

func Validate

method on Valoper
1func (v *Valoper) Validate() error
source

Validate checks if the fields of the Valoper are valid.

Imports 18

Source Files 10