Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions .github/workflows/vendored-provenance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,15 @@ jobs:
exit 1
fi

# The gate that actually keeps a green build meaningful for topaz-1.
# Keeps the two avl roles from being confused.
#
# GNOVERSION is NOT topaz-1's ref, so ~15 vendored packages differ from what
# the chain hosts — including p/nt/avl/v0, whose on-chain Get is SINGLE-value
# while the vendored copy is two-value. That is safe today for exactly one
# reason: gnodaokit crosses that boundary only via ntavl.NewTree(), whose
# signature is identical in both. Nothing else enforced that, so a single new
# ntavl.Get() call would compile green here and fail AddPackage on-chain.
# The stdlib p/nt/avl/v0 is here only because svg.Canvas.Style is a
# *nt/avl/v0.Tree; the data-structure role belongs to the p/samcrew/avl fork,
# whose Get is two-value. GNOVERSION is now topaz-1's own ref, so the vendored
# stdlib copy matches the chain and a misuse fails the build directly — this
# gate exists to say WHY it failed, and to keep the boundary from widening by
# accident. When the pin was older than the chain, this was the only thing
# standing between a green build and a failed AddPackage.
- name: The stdlib-avl boundary must stay limited to NewTree
run: |
set -euo pipefail
Expand All @@ -153,9 +154,9 @@ jobs:
if [[ -n "$unexpected" ]]; then
echo "ERROR: gnodaokit uses the stdlib avl beyond NewTree:"
printf '%s\n' "$unexpected"
echo "topaz-1's p/nt/avl/v0 Get is SINGLE-value while the vendored copy is"
echo "two-value, so this would compile here and fail AddPackage on-chain."
echo "Use gno.land/p/samcrew/avl instead, or re-verify against topaz-1."
echo "The stdlib avl is vendored only for the svg.Canvas.Style ABI; its Get"
echo "is single-value on topaz-1 and here. Use gno.land/p/samcrew/avl for"
echo "data structures — that is the fork with the two-value Get."
exit 1
fi
echo "stdlib avl boundary is limited to NewTree, as required"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GNOVERSION=2c7f1abe324e8fa6fac6dc71a36635cc4e92a0be
GNOVERSION=fc40526511474e40b8a66419f5ba28255085bc08
GNO=go run github.com/gnolang/gno/gnovm/cmd/gno@${GNOVERSION}

.PHONY: dev
Expand Down
41 changes: 24 additions & 17 deletions vendored/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,30 @@ topaz-1's stdlib `p/nt/avl/v0` exposes a **single-value** `Get`, while this code
**green build compiled against an ABI the target chain does not have** — a false green in exactly
the place the gate exists to prevent one. So the fork is vendored for that role.

### ⚠️ A green build here does not by itself prove "publishable on topaz-1"

`GNOVERSION` is **not** topaz-1's ref. The chain runs `fc4052651`; the `Makefile` pins `2c7f1abe`.
Roughly 15 vendored packages therefore differ from what the chain actually hosts — **including
`p/nt/avl/v0`, whose on-chain `Get` is single-value while the vendored copy is two-value.**

Do not read the vendored tree as a mirror of topaz-1. It is version-matched to the **compiler**, and
that is all the provenance job proves.

What makes it safe today is narrower and worth stating exactly: gnodaokit crosses the stdlib-avl
boundary in exactly one place — `ntavl` in `gno/p/basedao/utils.gno`, because `svg.Canvas.Style` is
a `*nt/avl/v0.Tree` — and it calls only `NewTree()`, whose signature is identical in both. A single
new `ntavl.Get()` call would compile green here and fail `AddPackage` on-chain.

CI enforces precisely that invariant (`vendored-provenance.yml`, "The stdlib-avl boundary must stay
limited to NewTree"). Widening the boundary, or bumping `GNOVERSION`, means re-checking the exported
surface of every skewed package against the chain — not just re-running the build.
### `GNOVERSION` is topaz-1's own ref

`GNOVERSION` is `fc4052651`, which is what topaz-1 runs. The vendored tree is therefore
version-matched to the compiler **and** to the chain at the same time, so a green build here does
correspond to what `AddPackage` will see — for the stdlib dependencies. It still says nothing about
`p/samcrew/*`, which no chain hosts until the ceremony publishes it (see Sequencing).

It was not always so. The pin used to be `2c7f1abe`, six weeks older, and roughly 15 vendored
packages differed from what the chain hosted — **including `p/nt/avl/v0`, whose on-chain `Get` is
single-value while the vendored copy at that ref was two-value.** A green build genuinely did not
prove publishability, and the gap was held open only by a narrow argument about which symbols
gnodaokit actually touched. Two concrete costs, both paid: the old toolchain had **no sub-realm
support at all** — `cur.Sub()` failed preprocessing — so nothing could test the semantics the
identity work reasons about; and the divergence had to be re-argued by hand on every change.

gnodaokit still crosses the stdlib-avl boundary in exactly one place — `ntavl` in
`gno/p/basedao/utils.gno`, because `svg.Canvas.Style` is a `*nt/avl/v0.Tree` — and calls only
`NewTree()`. CI keeps enforcing that (`vendored-provenance.yml`, "The stdlib-avl boundary must stay
limited to NewTree"), but the invariant is now belt-and-braces rather than load-bearing: with the
vendored copy matching the chain, an `ntavl.Get()` two-value call fails **locally**, at build time,
instead of surviving to `AddPackage`.

Bumping `GNOVERSION` again re-opens all of this. Whoever does it must re-run the regeneration below
and re-check that the new ref is still what the target chain runs.

### Sequencing

Expand Down
207 changes: 207 additions & 0 deletions vendored/gno.land/p/moul/md/example_test.gno
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
package md

import "strings"

func ExampleHeaders() {
println(H1("Header 1"))
println(H2("Header 2"))
println(H3("Header 3"))
println(H4("Header 4"))
println(H5("Header 5"))
println(H6("Header 6"))

// Output:
// # Header 1
//
// ## Header 2
//
// ### Header 3
//
// #### Header 4
//
// ##### Header 5
//
// ###### Header 6
}

func ExampleStyles() {
println(Bold("bold"))
println(Italic("italic"))
println(Strikethrough("strikethrough"))

// Output:
// **bold**
// *italic*
// ~~strikethrough~~
}

func ExampleLists() {
println(BulletList([]string{
"Item 1",
"Item 2\nMore details for item 2",
}))
println(OrderedList([]string{"Step 1", "Step 2"}))
println(TodoList([]string{"Task 1", "Task 2\nSubtask 2"}, []bool{true, false}))
println(Nested(BulletList([]string{"Parent Item", OrderedList([]string{"Child 1", "Child 2"})}), " "))

// Output:
// - Item 1
// - Item 2
// More details for item 2
//
// 1. Step 1
// 2. Step 2
//
// - [x] Task 1
// - [ ] Task 2
// Subtask 2
//
// - Parent Item
// - 1. Child 1
// 2. Child 2
}

func ExampleBlocks() {
print(Paragraph("This is a paragraph."))
// Blockquote adds multiple newlines which Output doesn't allow, so trim
println(strings.TrimSpace(Blockquote("This is a blockquote\nSpanning multiple lines")))

// Output:
// This is a paragraph.
//
// > This is a blockquote
// > Spanning multiple lines
}

func ExampleCode() {
println(InlineCode("inline `code`"))
println(CodeBlock("line1\nline2"))
println(LanguageCodeBlock("go", "func main() {\nprintln(\"Hello, world!\")\n}"))
println(HorizontalRule())

// Output:
// `` inline `code` ``
// ```
// line1
// line2
// ```
//
// ```go
// func main() {
// println("Hello, world!")
// }
// ```
//
// ---
}

func ExampleReferences() {
println(Link("Gno", "http://gno.land"))
println(Image("Alt Text", "http://example.com/image.png"))
println(InlineImageWithLink("Alt Text", "http://example.com/image.png", "http://example.com"))
println(FootnoteDefinition("ref", "This is a footnote"))
// LinkReferenceDefinition adds multiple newlines which Output doesn't allow, so trim
println(strings.TrimSpace(LinkReferenceDefinition("r-example", "/r/example", "")))

// Output:
//
// [Gno](http://gno.land)
// ![Alt Text](http://example.com/image.png)
// [![Alt Text](http://example.com/image.png)](http://example.com)
// [^ref]:
// This is a footnote
//
// [r-example]: /r/example
}

func ExampleColumns() {
println("4 columns in one gno-columns tag:")
println(Columns([]string{
"Column1\ncontent1",
"Column2\ncontent2",
"Column3\ncontent3",
"Column4\ncontent4",
}, true))

// Should be automatically placed in multiple column tags
println("3 cols per row without padding:")
println(ColumnsN([]string{
"Row1Column1\ncontent1",
"Row1Column2\ncontent2",
"Row1Column3\ncontent3",
"Row2Column1\ncontent1",
"Row2Column2\ncontent2",
"Row2Column3\ncontent3",
"Row3Column1\ncontent1",
"Row3Column2\ncontent2",
"Row3Column3\ncontent3",
}, 3, false))

// Should be padded, up to 4 cols
println("2 padded to 4:")
println(ColumnsN([]string{
"Column1\ncontent1",
"Column2\ncontent2",
}, 4, true))

// Output:
// 4 columns in one gno-columns tag:
// <gno-columns>
// Column1
// content1
// <gno-columns-sep>
// Column2
// content2
// <gno-columns-sep>
// Column3
// content3
// <gno-columns-sep>
// Column4
// content4
// </gno-columns>
//
// 3 cols per row without padding:
// <gno-columns>
// Row1Column1
// content1
// <gno-columns-sep>
// Row1Column2
// content2
// <gno-columns-sep>
// Row1Column3
// content3
// </gno-columns>
// <gno-columns>
// Row2Column1
// content1
// <gno-columns-sep>
// Row2Column2
// content2
// <gno-columns-sep>
// Row2Column3
// content3
// </gno-columns>
// <gno-columns>
// Row3Column1
// content1
// <gno-columns-sep>
// Row3Column2
// content2
// <gno-columns-sep>
// Row3Column3
// content3
// </gno-columns>
//
// 2 padded to 4:
// <gno-columns>
// Column1
// content1
// <gno-columns-sep>
// Column2
// content2
// <gno-columns-sep>
//
// <gno-columns-sep>
//
// </gno-columns>
}
Loading
Loading