Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

registry source realm

Package registry is spike (a) of tasarim-v6 §5.5: can a realm store an interface value handed over by ANOTHER realm a...

Overview

Package registry is spike (a) of tasarim-v6 §5.5: can a realm store an interface value handed over by ANOTHER realm and call it later, and what can that foreign code do to the registry while it runs?

It is deliberately tiny and is never part of the product. Two exports are intentionally unsafe probes and are marked as such: SharedBoard (returns a pointer into registry state) and UnsafeBump (a non-crossing exported mutator). Production core has neither; this spike measures why.

Constants 1

const SampleSeed

1const SampleSeed = "spike-sample"
source

SampleSeed is rendered once at registration; its hash is the fingerprint.

Functions 11

func Register

crossing Action
1func Register(cur realm, e Engine) string
source

Register stores the caller realm's engine. The id is the caller's pkgpath, so a realm can only ever register itself.

func RenderInTx

crossing Action
1func RenderInTx(cur realm, id, seed string) string
source

RenderInTx runs an engine inside a transaction. UNSAFE PROBE: a qeval discards writes, so this is how the spike observes on chain what engine code can do from a write path — the thing core never does (I-12).

func RenderWith

Action
1func RenderWith(id, seed string) string
source

RenderWith runs a registered engine. Read-only: reached through qeval.

func UnsafeBump

Action
1func UnsafeBump()
source

UnsafeBump is a non-crossing exported function that mutates registry state. UNSAFE PROBE: interrealm v2 §4.1 says a non-crossing call into /r/registry borrows /r/registry's storage, so a foreign engine calling it SHOULD succeed. That is exactly why production core exports no state-changing non-crossing function (invariant I-12).

func VerifyFingerprint

Action
1func VerifyFingerprint(id string) bool
source

VerifyFingerprint re-renders the sample and compares it with the hash stored at registration; false means the engine's output changed.

func SharedBoard

Action
1func SharedBoard() *Board
source

SharedBoard returns a pointer into registry state. UNSAFE PROBE: the spike checks that a foreign engine writing through it is refused by the VM (interrealm v2 §3.2 readonly check).

Types 2

type Board

struct
1type Board struct {
2	Count int
3}
source

Board is registry-owned state that a foreign engine can get a pointer to.

type Engine

interface
1type Engine interface {
2	Name() string
3	Render(seed string) string
4}
source

Engine is the contract a registered engine satisfies. Methods take and return plain values only, so the engine never receives a reference into registry state (tasarim-v6 §5.4 defence (a)).

Dependencies

Source Files 3