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.

render_example_test.gno

3.11 Kb · 97 lines
 1package provable
 2
 3// ExampleRender pins the realm's Render output as a testable example.
 4func ExampleRender() {
 5	seed()
 6	print(Render(""))
 7	// Output:
 8	// # provable
 9	//
10	// What gno.land can and cannot prove about itself, demonstrated rather than asserted.
11	//
12	// ## The log
13	//
14	// An append-only Merkle mountain range. Appending costs O(log n) hashes and never rebuilds.
15	//
16	// | Field | Value |
17	// |---|---|
18	// | Entries | 3 / 512 |
19	// | Stored hashes | 4 |
20	// | Peaks | 2 |
21	// | Root | `c9d22dd237c668944fde619edb56cc1bee0e988b03ac08694f6d3aba440c0776` |
22	//
23	// This root is also the Tendermint simple-tree root over the same entries, so any
24	// Tendermint verifier accepts it. `Verify` and `VerifyFixed` check the two proof
25	// encodings against it.
26	//
27	// ## What the chain can prove
28	//
29	// `gno.land/pkg/gnoland/app.go` mounts exactly two stores. One is IAVL and merkleized,
30	// the other is a plain dbadapter whose `Commit` is documented as *"Always returns a zero
31	// commitID, as dbadapter store doesn't merkleize"*.
32	//
33	// | Data | Store | Provable against the app hash |
34	// |---|---|---|
35	// | Package source | iavl | yes |
36	// | Account balances | iavl | yes |
37	// | Escaped object hashes (cross-realm) | iavl | yes, the hash only |
38	// | Realm objects, types, realm metadata | base | **no** |
39	// | **This log** | base | **no** |
40	//
41	// ## What that means here
42	//
43	// A proof from this realm says *this entry is consistent with the root this realm
44	// published*. It cannot say *this root is the chain's own*, for two independent reasons:
45	//
46	// 1. Realm state is not merkleized, so there is no state proof to produce.
47	// 2. `chain/runtime` exposes `ChainID`, `ChainDomain`, `ChainHeight` and `GetSessionInfo`
48	//    and nothing else. No app hash, no block hash, no header. A realm has no trusted
49	//    root to check anything against.
50	//
51	// Anything built on Merkle proofs in a gno realm is trust-minimised relative to a
52	// committed root, never trustless. Saying otherwise would be the interesting-sounding
53	// half of a true story.
54	//
55	// ## Entries
56	//
57	// | # | Entry |
58	// |---|---|
59	// | [0](/r/nym-moultest123/x/provable/v0:entry/0) | genesis of this log |
60	// | [1](/r/nym-moultest123/x/provable/v0:entry/1) | a second commitment |
61	// | [2](/r/nym-moultest123/x/provable/v0:entry/2) | a third commitment |
62}
63
64// ExampleRenderEntry pins the per-entry page, including a live proof.
65func ExampleRenderEntry() {
66	seed()
67	print(Render("entry/1"))
68	// Output:
69	// # provable: entry 1
70	//
71	// ```
72	// a second commitment
73	// ```
74	//
75	// ## Inclusion proof
76	//
77	// | Field | Value |
78	// |---|---|
79	// | Index | 1 |
80	// | Total | 3 |
81	// | Path | `8f88aaa49b43fc28f266ea6b4f18d865933cad3584b59f162b8ce55edd8263fc` |
82	// | Before | `-` |
83	// | After | `495f0f3042890e970ad8344ae78ff490806c2b8403282d518e8112044bc43827` |
84	// | Root | `c9d22dd237c668944fde619edb56cc1bee0e988b03ac08694f6d3aba440c0776` |
85	//
86	// Valid against that root only. The next `Append` moves it.
87}
88
89// ExampleRenderMissingEntry pins the not-found page.
90func ExampleRenderMissingEntry() {
91	seed()
92	print(Render("entry/99"))
93	// Output:
94	// # provable
95	//
96	// No entry `99`.
97}