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

upgrade_registry source realm

Constants 1

const MaxNameLen, MaxChainLen, MaxRenderEntries, RenderLatestHops

 1const (
 2	MaxNameLen  = 64
 3	MaxChainLen = 50 // GetMigrationChain traversal/output bound (marked when hit)
 4
 5	// Render bounds (re-audit): rendering is paginated and the per-row
 6	// "latest" annotation walks a bounded number of hops, so an
 7	// attacker-built long chain cannot blow up the realm page.
 8	MaxRenderEntries = 100
 9	RenderLatestHops = 10
10)
source

Functions 8

func AcceptOwnership

crossing Action
1func AcceptOwnership(cur realm, contractAddr address) string
source

AcceptOwnership completes a nominated ownership: only the pending owner can accept, and only acceptance moves the entry (and the ownerContracts index) to them.

func Deprecate

crossing Action
1func Deprecate(cur realm, contractAddr, successorAddr address) string
source

Deprecate marks a contract as deprecated and points to its successor. Only the entry's owner can deprecate. The successor must itself be a REGISTERED entry — registration is self-proving, so a successor can never be a dangling pointer or an address squatted by a third party — and the successor entry must be OWNED BY THE CALLER (re-audit: without consent, an attacker could chain their entry INTO a legitimate contract, forging "official predecessor" provenance). Consent is checked AT CALL TIME: transferring the successor entry away later does not unlink an existing chain — the attestation is that both ends shared an owner when the deprecation was recorded.

func GetInfo

Action
1func GetInfo(contractAddr address) string
source

GetInfo returns a one-line summary for a contract.

func GetMigrationChain

Action
1func GetMigrationChain(contractAddr address) string
source

GetMigrationChain returns the full upgrade path starting from the given address, at most MaxChainLen hops. A chain longer than the bound is explicitly marked as truncated (re-audit: silent truncation presented a mid-chain node as the endpoint).

func GetOwnerContracts

Action
1func GetOwnerContracts(owner address) string
source

GetOwnerContracts returns all contract addresses whose ACCEPTED owner is the given address (nominations don't count until accepted).

func Register

crossing Action
1func Register(cur realm, name string, owner address) string
source

Register adds the CALLING contract to the registry — the entry's address is the caller's own address, which is the proof of control. owner NOMINATES a manager (team EOA or governance realm); it holds no power until it calls AcceptOwnership (nobody can be made an owner without consent — re-audit). Pass "" to manage from the contract itself — but note (audit Y4): entries are permanent, so an entry managed by a contract that has no code path for calling this registry again is FROZEN as active forever: never deprecatable, never transferable. Realms registering from init() should nominate an EOA or governance manager instead.

func Render

1func Render(path string) string
source

Render returns a markdown overview of the most recent entries. Never panics.

func TransferOwnership

crossing Action
1func TransferOwnership(cur realm, contractAddr, newOwner address) string
source

TransferOwnership NOMINATES a new owner for a registry entry; the nominee must AcceptOwnership to take control (two-step — re-audit). Passing "" clears a pending nomination.

Types 1

type ContractEntry

struct
1type ContractEntry struct {
2	Address      address
3	Owner        address // current manager (accepted)
4	PendingOwner address // nominated, not yet accepted; empty if none
5	Name         string
6	Deprecated   bool
7	Successor    address // address of the upgraded contract, empty if current
8}
source

ContractEntry represents a registered contract and its upgrade status.

An entry's Address is ALWAYS the address that called Register — a contract can only register itself. That call is the proof of control: nobody can claim an address they don't command, so a Deprecate redirect on an entry always originates from whoever genuinely controlled the contract. Entries are permanent by design: migration history is what consumers rely on, so it must not be erasable (and a delete would reopen re-registration squatting).

Ownership is two-step (re-audit 2026-09-02): Register/Transfer only NOMINATE an owner; the nominee must AcceptOwnership. Until then the entry is owned by the contract itself, so nobody's address can be attached as "owner" without their consent.

Imports 3

  • chain/runtime/unsafe stdlib
  • strconv stdlib
  • strings stdlib

Source Files 2