v0 source realm
untrusted-render: every string Render echoes is either a verb name validated by parseSchema against \[a-z0-9\_] at ac...
View source
gno.land/r/moul/x/upgrade/schema/facade/v0
The permanent entry point of pattern G. Holds one Call(cur, verb, payload)
signature forever and moves the API into data each handler declares: it parses the
schema, checks arity before dispatch, enumerates verbs without a transaction, and
refuses an upgrade whose schema would break an existing caller.
See the pattern and the exploration.
Part of moul/gno-contracts — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.
Dependency graph:

🧪 Highly experimental — potentially vibe-coded. Not audited; may break, change, or be removed at any time. Do not use with anything of value. Full disclaimer: DISCLAIMER.
untrusted-render: every string Render echoes is either a verb name validated by parseSchema against [a-z0-9_] at accept time, or a package path read off a crossing frame. No caller-typed payload is ever rendered.
Package facade is the permanent entry point of the "API as data" upgrade pattern (pattern G of the exploration; see ../../README.md).
Patterns E and F put a Go interface at the permanent path, which fixes the method set at deploy: adding an operation later needs a whole extra realm. This one puts a single entry point there instead,
Example
1Call(cur realm, verb, payload string) string
and moves the API into DATA that each implementation declares. The signature that can never change is that one line; everything the application does can still grow.
Three things fall out of the API being data, and they are the reason to pay the price below:
- Callers can ENUMERATE it. Verbs, Signature and SchemaText answer without a transaction, so a client discovers the API instead of being compiled against it.
- Payloads are CHECKED before the handler runs, so an arity mistake is one abort with a readable message rather than whatever the handler does with the wrong number of arguments.
- Upgrades can be DIFFED. Accept refuses a handler whose schema would drop or reshape a verb some existing caller depends on, which no amount of Go interface satisfaction can catch: a handler is free to satisfy Handler and answer nothing.
The price is the type system. Arguments are strings a caller encodes, and a misspelled verb is an abort at runtime rather than a compile error. Pattern F is the other side of that trade and both ship here on purpose.
State is deliberately out of scope. These handlers are pure; where an application's data should live is pattern C's question, and the answer does not change because the entry point became a string.
1
10
func Accept
crossing ActionAccept promotes a candidate, and refuses one that would break an existing caller. This is the check a Go interface cannot express.
func AcceptBreaking
crossing ActionAcceptBreaking promotes a candidate that Accept refuses.
It exists because the diff is SYMMETRIC, which is not obvious until it bites: once v1 has added a verb, rolling back to v0 drops that verb and is a regression by exactly the same rule that protects callers going forward. A pattern that can only move forward is worse than one with no diff at all, so the escape hatch is required, and making it a separate function is the point: the owner has to type a different word, and the audit log shows which one.
Use it to roll back, and to retire a verb nobody calls any more. Not to make an upgrade go through.
func Call
crossing ActionCall is the one signature this realm is committed to forever.
func Candidates
ActionCandidates lists every path that has nominated itself, in order.
func Live
ActionLive is the package path currently serving, or "" before the first Accept.
func Propose
crossing ActionPropose nominates the calling realm, exactly as in pattern F. Its schema is parsed here so a malformed one is rejected at proposal rather than at accept.
func Render
func SchemaText
ActionSchemaText is the whole accepted API in the declaration format, so a client can read back exactly what the handler declared.
func Signature
ActionSignature is one verb's shape, as a caller would write it.
func Verbs
ActionVerbs lists the accepted API in DECLARATION order, which is the order the handler wrote it in and the order a reader of the schema expects. Iterating the avl tree instead would list them alphabetically, silently: caught by a test, not by a compiler.
1
type Handler
interfaceHandler is the whole interface an implementation satisfies. It never changes, because everything that would have changed it is in Schema instead.