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

/subhost package

Overview

Package subhost is a test fixture for realm.Sub sub-identity presentation across a real package boundary. It plays two roles:

  • Host: ActAsSub mints a sub of its OWN live cur and crosses into an observer with it.
  • Observer: Observe reads the presented identity (cur.Previous) that a caller crossed in with, and asserts unsafe.PreviousRealm parity.

Consumers:

  • gnovm/tests/files/zrealm_sub_foreign_present.gno crosses into Observe directly with a sub minted in the caller's own realm, to check cross-realm identity presentation + Subpath() through a cross.
  • gno.land/pkg/integration/testdata/subrealm_run_parity.txtar enters via MsgRun, crosses into ActAsSub, which mints a sub and crosses into Observe — the MsgRun-entry counterpart to the MsgCall-entry parity filetest zrealm_sub1.gno.

Functions

ActAsSub

func ActAsSub(cur realm, subpath string)

ActAsSub mints a sub-identity of subhost's OWN live cur and crosses with it into Observe. Used by the MsgRun-entry parity test: the outermost entry is a `/e/<addr>/run` ephemeral, but subhost's cur is a first-class primary here, so cur.Sub is legal and the sub presents to Observe exactly as in the MsgCall path.

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/tests/vm/subhost" -func "ActAsSub" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "dev" -remote "https://api.gno.berty.io:443" ADDRESSgnokey query -remote "https://api.gno.berty.io:443" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/tests/vm/subhost" -func "ActAsSub" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "dev" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://api.gno.berty.io:443" call.tx
  

Observe

func Observe(cur realm)

Observe reports what the immediate caller presented as its identity. The three cur.Previous() views (address, synthesized pkgpath, subpath) are the callee-side surface a sub-token must present; the two parity booleans assert unsafe.PreviousRealm() reads the SAME identity (v2 §5.4: unsafe.* must agree with cur.Previous()). prevParity is the load-bearing assertion for the identity-chain walk; curParity guards height 0.

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/tests/vm/subhost" -func "Observe" -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "dev" -remote "https://api.gno.berty.io:443" ADDRESSgnokey query -remote "https://api.gno.berty.io:443" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/tests/vm/subhost" -func "Observe" -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "dev" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://api.gno.berty.io:443" call.tx