Exemple
modernc.org/memory v1.11.0
Échantillon vérifié pour golang modernc.org/memory v1.11.0. Le contrat s'est exécuté sur go 1.26 · linux alpine/x64 · docker et a réussi.
sha256:029cb77b24a6edea4c8091ed6cf7682f9872c0de61e6c883bd3b2471cb7550af
Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré.
Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes.
MIT-0
Preuves d'exécution
L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.
- Base de preuve
- Contrat signé réussi
- Reçus de vérification
- 1
- Clés de signature qui l’ont compilé
- 1
Environnement déclaré
windows 11 x64 go
Environnements des exécutions de vérification
| Environnement | Contrat | Étapes | Exécution |
|---|---|---|---|
| go 1.26 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · golang@1 |
2026-08-19 |
Cas
HOW- Objectif
- verify pkg:golang/modernc.org/memory@v1.11.0
- Paquets
- Créé
- 2026-08-18T17:41:26Z
Contrat
- memory.Allocator zero value is ready to allocate and free memory
- alloc.Malloc allocates a byte slice of the requested size without errors
- alloc.Realloc resizes an allocated memory block preserving existing contents
- alloc.Calloc allocates a zero-initialized byte slice of the requested size
- alloc.Free deallocates memory blocks without errors
- alloc.Close closes the allocator and releases OS memory resources
Fichiers
- PROMPT.md
- csx.json
- go.mod
- go.sum
- spec.json
- test/contract.go
Code source
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify pkg:golang/modernc.org/memory@v1.11.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/modernc.org/memory@v1.11.0
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:5347e44876c17ec489aa74b079a0435e08e9f88f084765f58023f45fdfe147f5","contract":["memory.Allocator zero value is ready to allocate and free memory","alloc.Malloc allocates a byte slice of the requested size without errors","alloc.Realloc resizes an allocated memory block preserving existing contents","alloc.Calloc allocates a zero-initialized byte slice of the requested size","alloc.Free deallocates memory blocks without errors","alloc.Close closes the allocator and releases OS memory resources"],"goal":"verify pkg:golang/modernc.org/memory@v1.11.0","kind":"HOW","packages":["pkg:golang/modernc.org/memory@v1.11.0"],"schemaVersion":1},"contractCommand":["go","run","./test"],"environment":{"arch":"x64","ecosystem":"golang","os":"windows","osVersionBucket":"11","packageManager":"go","schemaVersion":1},"license":"MIT-0","packages":["pkg:golang/modernc.org/memory@v1.11.0"],"schemaVersion":1,"verifierAdapter":"golang@1"}
module sample
go 1.23.0
require modernc.org/memory v1.11.0
require golang.org/x/sys v0.31.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU=
modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg=
modernc.org/memory v1.11.0 h1:o4QC8aMQzmcwCK3t3Ux/ZHmwFPzE6hf2Y5LbkRs+hbI=
modernc.org/memory v1.11.0/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw=
{
"schemaVersion": 1,
"goal": "verify pkg:golang/modernc.org/memory@v1.11.0",
"kind": "HOW",
"packages": [
"pkg:golang/modernc.org/memory@v1.11.0"
]
}
package main
import (
"bytes"
"fmt"
"os"
"modernc.org/memory"
)
func main() {
var alloc memory.Allocator
defer func() {
if err := alloc.Close(); err != nil {
fmt.Fprintf(os.Stderr, "alloc.Close failed: %v\n", err)
os.Exit(1)
}
}()
// 1. Test Malloc
buf, err := alloc.Malloc(128)
if err != nil {
fmt.Fprintf(os.Stderr, "alloc.Malloc(128) failed: %v\n", err)
os.Exit(1)
}
if len(buf) != 128 {
fmt.Fprintf(os.Stderr, "expected len 128, got %d\n", len(buf))
os.Exit(1)
}
// Write pattern to allocated buffer
for i := 0; i < len(buf); i++ {
buf[i] = byte(i % 256)
}
// 2. Test Realloc (expanding buffer)
buf, err = alloc.Realloc(buf, 256)
if err != nil {
fmt.Fprintf(os.Stderr, "alloc.Realloc(buf, 256) failed: %v\n", err)
os.Exit(1)
}
if len(buf) != 256 {
fmt.Fprintf(os.Stderr, "expected len 256 after Realloc, got %d\n", len(buf))
os.Exit(1)
}
// Verify original contents preserved
for i := 0; i < 128; i++ {
if buf[i] != byte(i%256) {
fmt.Fprintf(os.Stderr, "data mismatch at index %d after Realloc: expected %d, got %d\n", i, byte(i%256), buf[i])
os.Exit(1)
}
}
// 3. Test Free
if err := alloc.Free(buf); err != nil {
fmt.Fprintf(os.Stderr, "alloc.Free failed: %v\n", err)
os.Exit(1)
}
// 4. Test Calloc (zero-initialized allocation)
zeroBuf, err := alloc.Calloc(64)
if err != nil {
fmt.Fprintf(os.Stderr, "alloc.Calloc(64) failed: %v\n", err)
os.Exit(1)
}
if len(zeroBuf) != 64 {
fmt.Fprintf(os.Stderr, "expected len 64 from Calloc, got %d\n", len(zeroBuf))
os.Exit(1)
}
expectedZeros := make([]byte, 64)
if !bytes.Equal(zeroBuf, expectedZeros) {
fmt.Fprintf(os.Stderr, "expected Calloc buffer to be zero-filled\n")
os.Exit(1)
}
if err := alloc.Free(zeroBuf); err != nil {
fmt.Fprintf(os.Stderr, "alloc.Free(zeroBuf) failed: %v\n", err)
os.Exit(1)
}
fmt.Println("modernc.org/memory allocator contract verified successfully")
}
Seeder d'origine
anonyme