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

v0 state

Back to all declarations

regNames

[32]string

regNames are the ABI names, because nobody reading a register dump thinks in x-numbers and every compiler's output is annotated with these.

Open
OID
0b9af5…7796:4
regNames details

Inspect array

Render

func(path string) string

Render is the realm's gnoweb view. - "/" the samples, the instance list, and what the numbers mean. - "/\<id>" one instance: its status, fuel, output and register file.

Open
OID
0b9af5…7796:5
Render details

Inspect func

renderInstance

func(id string) string
Open
OID
0b9af5…7796:8
renderInstance details

Inspect func

renderRegisters

func(inst *v0.Instance) string

renderRegisters restores the snapshot to read the register file out of it. The hart is not kept between transactions, only its snapshot is, so this is the only place the state is legible, and it is the thing worth seeing: a program that wrote nothing still computed something.

Open
OID
0b9af5…7796:9
renderRegisters details

Inspect func

hexDigits

untyped string

Value

"0123456789abcdef"

hexDump

func(b []uint8, max int) string

hexDump shows the image as words, which is how anyone reading RV32 reads it.

Open
OID
0b9af5…7796:11
hexDump details

Inspect func

printable

func(b []uint8, max int) string

printable renders guest output for a code fence: printable ASCII as itself, everything else as an escape. A guest writes arbitrary bytes, so this is the only form of it that is safe to show.

Open
OID
0b9af5…7796:12
printable details

Inspect func

MaxInstances

untyped bigint

Caps. Everything a caller can grow is bounded, because all of it is storage somebody pays a deposit on.

Value

(64 <untyped> bigint)

MaxImage

untyped bigint

Caps. Everything a caller can grow is bounded, because all of it is storage somebody pays a deposit on.

Value

(8192 <untyped> bigint)

MaxOutput

untyped bigint

Caps. Everything a caller can grow is bounded, because all of it is storage somebody pays a deposit on.

Value

(4096 <untyped> bigint)

MaxInput

untyped bigint

Caps. Everything a caller can grow is bounded, because all of it is storage somebody pays a deposit on.

Value

(1024 <untyped> bigint)

DefaultFuel

untyped bigint

Caps. Everything a caller can grow is bounded, because all of it is storage somebody pays a deposit on.

Value

(100000 <untyped> bigint)

MaxSliceFuel

untyped bigint

Caps. Everything a caller can grow is bounded, because all of it is storage somebody pays a deposit on.

Value

(100000 <untyped> bigint)

idgen

v0.ID

Value

<zero>

count

int

Value

3

host

type

host is the realm-backed [vmkit.Host](/gno.land/p/moul/x/vm/vmkit/v0#Host). One is built per call, wrapping the instance being stepped, so a guest's output and authority are scoped to it and nothing ambient leaks in.

Value

v0.host

Upload

func(hexImage string, input string, budget int64) string

Upload stores a hex-encoded text image as a new instance and returns its id. The image is loaded here rather than at the first Step, so a misaligned or oversized one is rejected by the transaction that submitted it instead of costing somebody else the gas later.

Open
OID
0b9af5…7796:23
Upload details

Inspect func

UploadSample

func(name string, input string, budget int64) string

UploadSample stores one of the programs the front page offers. Writing RV32IM by hand is not the point of this realm, and without this nobody without a cross compiler could press a button.

Open
OID
0b9af5…7796:25
UploadSample details

Inspect func

upload

func(img []uint8, input string, budget int64) string
Open
OID
0b9af5…7796:26
upload details

Inspect func

Step

func(id string, fuel int64) string

Step runs one slice of the instance: up to \`fuel\` guest instructions, then stop and keep the snapshot. Anyone may pay for a slice, not only the owner: a paused program that only its owner can advance is a worse demo and no safer, since the program and its budget were both fixed at upload.

Open
OID
0b9af5…7796:27
Step details

Inspect func

Remove

func(id string)

Remove deletes an instance. Owner only.

Open
OID
0b9af5…7796:28
Remove details

Inspect func

decodeHex

func(s string) ([]uint8, bool)

decodeHex accepts the output of any hexdump: an even number of hex digits, with an optional 0x prefix, and whitespace anywhere. Whitespace is allowed because that is what a pasted hexdump has in it; anything else is refused, because a silently mangled image would trap somewhere unrelated later.

Open
OID
0b9af5…7796:30
decodeHex details

Inspect func

hexVal

func(c uint8) (uint8, bool)
Open
OID
0b9af5…7796:31
hexVal details

Inspect func

sample

type

The programs the front page offers, as the machine words a cross compiler would have emitted. They are assembled outside this repo and pinned here, and riscvdemo\_test.gno runs every one of them to the expected answer, so a wrong word is a failing test rather than a page that traps when clicked.

Value

v0.sample

sampleByName

func(slug string) *v0.sample
Open
OID
0b9af5…7796:44
sampleByName details

Inspect func
regNames : [32]string Inspect
Render : func(path string) string Inspect
renderHome : func() string Inspect
renderInstance : func(id string) string Inspect
renderRegisters : func(inst *v0.Instance) string Inspect
fuelText : func(n int64) string Inspect
hexDigits : untyped string ="0123456789abcdef"
hexDump : func(b []uint8, max int) string Inspect
printable : func(b []uint8, max int) string Inspect
MaxInstances : untyped bigint =(64 <untyped> bigint)
MaxImage : untyped bigint =(8192 <untyped> bigint)
MaxOutput : untyped bigint =(4096 <untyped> bigint)
MaxInput : untyped bigint =(1024 <untyped> bigint)
DefaultFuel : untyped bigint =(100000 <untyped> bigint)
MaxSliceFuel : untyped bigint =(100000 <untyped> bigint)
store : *v0.Store Inspect
inputs : *v0.Tree Inspect
idgen : v0.ID =<zero>
count : int =3
host : type =v0.host
Upload : func(hexImage string, input string, budget int64) string Inspect
UploadSample : func(name string, input string, budget int64) string Inspect
upload : func(img []uint8, input string, budget int64) string Inspect
Step : func(id string, fuel int64) string Inspect
Remove : func(id string) Inspect
inputOf : func(id string) string Inspect
decodeHex : func(s string) ([]uint8, bool) Inspect
hexVal : func(c uint8) (uint8, bool) Inspect
sample : type =v0.sample
samples : []v0.sample (len=6) Inspect
sampleByName : func(slug string) *v0.sample Inspect