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.

lazy/v1 package

Overview

untrusted-render: records are seeded in init or derived from lazy/v0's own init; this realm exposes no setter, so no caller string ever reaches Render.

Package lazy is version 1 of the "lazy migration" upgrade pattern (pattern D of the exploration; see ../README.md).

v1 changes the stored shape (Score widens, Active is new) and migrates one record at a time, on first touch, paid for by whoever touched it. There is no migration transaction and no pause.

The catch on today's gno: migrating on read MUTATES, so the read path has to be a crossing function. Get therefore costs a transaction and is invisible to vm/qeval and to Render. Peek is the honest read-only half, and it reports the pre-migration answer for records that have not been touched yet.

Functions

Migrated

func Migrated() int
Ask AI Claude ChatGPT

Migrated is how many records have actually moved over.

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/nym-moultest123/x/upgrade/lazy/v1.Migrated()"

Result

Pending

func Pending() int
Ask AI Claude ChatGPT

Pending is how many v0 records have never been touched. It is only a bound: v0 keeps every record it ever had, migrated or not.

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/nym-moultest123/x/upgrade/lazy/v1.Pending()"

Result

Render

func Render(_ string) string
Ask AI Claude ChatGPT

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/nym-moultest123/x/upgrade/lazy/v1.Render()"

Result

Get

func Get(cur realm, key string) *Record
Ask AI Claude ChatGPT

Get returns a record, migrating it from v0 on first touch.

Crossing, because the migration writes. That is the cost of the pattern: the cheapest possible read is now a transaction.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/nym-moultest123/x/upgrade/lazy/v1" -func "Get" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "onyx-1" -remote "https://rpc.onyx.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.onyx.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/nym-moultest123/x/upgrade/lazy/v1" -func "Get" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "onyx-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.onyx.testnets.gno.land" call.tx
  

Peek

func Peek(key string) *Record
Ask AI Claude ChatGPT

Peek is the read-only half: it never migrates, so a record that has not been touched yet reads as its v0 self converted on the fly and NOT stored.

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/nym-moultest123/x/upgrade/lazy/v1.Peek()"

Result