Пример
wasi 0.11.1+wasi-snapshot-preview1: wasi::ERRNO_BADF
Проверенный пример — cargo wasi 0.11.1+wasi-snapshot-preview1: wasi::ERRNO_BADF. Контракт выполнен на rust 1 · linux alpine/x64 · docker и пройден.
sha256:f2d9ba7a7b68ad2b5c68e315010ca8d01b8920266688cd74f337c70642433fca
Эта сеть предлагает одно: образец, который собирается. Она запустила его в песочнице и сохранила подписанную квитанцию. Она ничего не оценивает и ничего не гарантирует — собирается ли тот же код у вас, она не измеряла.
Сколько различных ключей подписи подали пройденную квитанцию контракта. Один — только автор; больше одного — значит, кто-то ещё тоже собрал. Ключ создаётся сам и не имеет зарегистрированной личности, поэтому считаются ключи, а не люди.
MIT-0
Свидетельства выполнения
Заявленное окружение и подписанные запуски разделены, чтобы вы точно видели, что этот образец запускал и где.
- Основа свидетельства
- Подписанный контракт пройден
- Квитанции проверки
- 1
- Ключи подписи, собравшие его
- 1
Заявленная среда
linux · alpine · musl x64 cargo
Среды запусков проверки
| Окружение | Контракт | Этапы | Запуск |
|---|---|---|---|
| rust 1 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · cargo@1rust:1-alpine@sha256:a10e64dd139b… |
2026-09-19 |
Кейс
HOW- Цель
- verify wasi::ERRNO_BADF in pkg:cargo/wasi@0.11.1+wasi-snapshot-preview1
- Символы
-
- wasi::ERRNO_BADF
- Создан
- 2026-09-17T21:31:48Z
Контракт
- wasi::ERRNO_BADF has raw identifier value 8
- wasi::ERRNO_BADF has name BADF
- wasi::ERRNO_BADF has descriptive message for bad file descriptor
- wasi::ERRNO_BADF implements Copy, Clone, Eq, Ord and Hash
- wasi::ERRNO_BADF is distinct from other Errno variants
Файлы
- Cargo.lock
- Cargo.toml
- PROMPT.md
- csx.json
- spec.json
- src/lib.rs
- test/contract.rs
Исходный код
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "sample-wasi-errno-badf"
version = "1.0.0"
dependencies = [
"wasi",
]
[[package]]
name = "wasi"
version = "0.11.1+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
[package]
name = "sample-wasi-errno-badf"
version = "1.0.0"
edition = "2021"
publish = false
[dependencies]
wasi = "=0.11.1"
[[bin]]
name = "contract"
path = "test/contract.rs"
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 wasi::ERRNO_BADF in pkg:cargo/wasi@0.11.1+wasi-snapshot-preview1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:cargo/wasi@0.11.1+wasi-snapshot-preview1
Demonstrate these symbols/APIs:
- wasi::ERRNO_BADF
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:2e22751cdeb02636039134577aec0bd2e52d203c1a7bf8274d369196ce4d2727","contract":["wasi::ERRNO_BADF has raw identifier value 8","wasi::ERRNO_BADF has name BADF","wasi::ERRNO_BADF has descriptive message for bad file descriptor","wasi::ERRNO_BADF implements Copy, Clone, Eq, Ord and Hash","wasi::ERRNO_BADF is distinct from other Errno variants"],"goal":"verify wasi::ERRNO_BADF in pkg:cargo/wasi@0.11.1+wasi-snapshot-preview1","kind":"HOW","packages":["pkg:cargo/wasi@0.11.1+wasi-snapshot-preview1"],"schemaVersion":1,"symbols":["wasi::ERRNO_BADF"]},"contractCommand":["cargo","run","--offline"],"environment":{"arch":"x64","distro":"alpine","ecosystem":"cargo","libc":"musl","os":"linux","packageManager":"cargo","schemaVersion":1},"license":"MIT-0","packages":["pkg:cargo/wasi@0.11.1+wasi-snapshot-preview1"],"schemaVersion":1,"subject":"pkg:cargo/wasi@0.11.1+wasi-snapshot-preview1","symbols":["wasi::ERRNO_BADF"],"verifierAdapter":"cargo@1"}
{
"schemaVersion": 1,
"goal": "verify wasi::ERRNO_BADF in pkg:cargo/wasi@0.11.1+wasi-snapshot-preview1",
"kind": "HOW",
"packages": [
"pkg:cargo/wasi@0.11.1+wasi-snapshot-preview1"
],
"symbols": [
"wasi::ERRNO_BADF"
]
}
//! Clean-room verification sample for wasi::ERRNO_BADF.
pub use wasi::*;
use std::collections::HashSet;
use wasi::{Errno, ERRNO_2BIG, ERRNO_ACCES, ERRNO_BADF, ERRNO_SUCCESS};
fn main() {
// 1. wasi::ERRNO_BADF has raw identifier value 8
assert_eq!(ERRNO_BADF.raw(), 8);
// 2. wasi::ERRNO_BADF has name BADF
assert_eq!(ERRNO_BADF.name(), "BADF");
// 3. wasi::ERRNO_BADF has descriptive message for bad file descriptor
assert_eq!(ERRNO_BADF.message(), "Bad file descriptor.");
// 4. wasi::ERRNO_BADF implements Copy, Clone, Eq, Ord and Hash
let copied: Errno = ERRNO_BADF;
assert_eq!(copied, ERRNO_BADF);
assert_eq!(copied.cmp(&ERRNO_BADF), std::cmp::Ordering::Equal);
let mut set = HashSet::new();
set.insert(ERRNO_BADF);
assert!(set.contains(&copied));
let debug_str = format!("{:?}", ERRNO_BADF);
assert!(debug_str.contains("code: 8"));
assert!(debug_str.contains("BADF"));
assert!(debug_str.contains("Bad file descriptor."));
let display_str = format!("{}", ERRNO_BADF);
assert_eq!(display_str, "BADF (error 8)");
// 5. wasi::ERRNO_BADF is distinct from other Errno variants
assert_ne!(ERRNO_BADF, ERRNO_SUCCESS);
assert_ne!(ERRNO_BADF, ERRNO_2BIG);
assert_ne!(ERRNO_BADF, ERRNO_ACCES);
assert!(ERRNO_BADF > ERRNO_SUCCESS);
assert!(ERRNO_BADF > ERRNO_ACCES);
println!("All wasi::ERRNO_BADF contract assertions passed.");
}
Исходный сидер
аноним