CodeSampleX

Beispiel

r-efi 6.0.0: r_efi

Verifiziertes Beispiel für cargo r-efi 6.0.0: r_efi. Der Vertrag lief auf rust 1 · linux alpine/x64 · docker und bestand: Boolean converts between bool and…

sha256:d47eea2ac5d000d404aef0e23bdae740a36b3d66c0999fadeb57d671749ad6f4

Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen. Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen. MIT-0

Ausführungsbelege

Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.

Beleggrundlage
Signierter Vertrag bestanden
Verifizierungsbelege
1
Signaturschlüssel, die es gebaut haben
1
Deklarierte Umgebung linux · alpine · musl x64 rust cargo

Umgebungen der Verifizierungsläufe

Umgebung Contract Stufen Lauf
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-10-13

Fall

HOW
Ziel
verify r_efi in pkg:cargo/r-efi@6.0.0
Pakete
Symbole
  • r_efi
Erstellt
2026-10-13T20:02:56Z

Contract

  1. Boolean converts between bool and u8 while preserving logical equality and ordering
  2. Status distinguishes success, warning, and error codes and round-trips raw usize values
  3. Guid constructs from fields and raw bytes with lossless as_fields and as_bytes round-tripping
  4. Core UEFI types and TableHeader match the 6.0.0 ABI layout including 4-byte Guid alignment
  5. eficall macro annotates functions and function pointer types with the platform EFI calling convention

Dateien

  • Cargo.lock
  • Cargo.toml
  • PROMPT.md
  • csx.json
  • spec.json
  • src/main.rs
  • test/contract.rs

Quellartefakt herunterladen (tar.gz)

Quelltext

Cargo.lock
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4

[[package]]
name = "r-efi"
version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"

[[package]]
name = "sample-r-efi"
version = "0.1.0"
dependencies = [
 "r-efi",
]
Cargo.toml
[package]
name = "sample-r-efi"
version = "0.1.0"
edition = "2021"

[dependencies]
r-efi = "=6.0.0"
PROMPT.md
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 r_efi in pkg:cargo/r-efi@6.0.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:cargo/r-efi@6.0.0
Demonstrate these symbols/APIs:
  - r_efi

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.
csx.json
{"case":{"caseId":"case:sha256:9e3c3d6b96d0bdb74399d433f9b95665623a0e3f5fb7b8328d94a75a52d79278","contract":["Boolean converts between bool and u8 while preserving logical equality and ordering","Status distinguishes success, warning, and error codes and round-trips raw usize values","Guid constructs from fields and raw bytes with lossless as_fields and as_bytes round-tripping","Core UEFI types and TableHeader match the 6.0.0 ABI layout including 4-byte Guid alignment","eficall macro annotates functions and function pointer types with the platform EFI calling convention"],"goal":"verify r_efi in pkg:cargo/r-efi@6.0.0","kind":"HOW","packages":["pkg:cargo/r-efi@6.0.0"],"schemaVersion":1,"symbols":["r_efi"]},"contractCommand":["cargo","run","--offline"],"environment":{"arch":"x64","distro":"alpine","ecosystem":"cargo","language":"rust","libc":"musl","os":"linux","packageManager":"cargo","schemaVersion":1},"license":"MIT-0","packages":["pkg:cargo/r-efi@6.0.0"],"schemaVersion":1,"subject":"pkg:cargo/r-efi@6.0.0","symbols":["r_efi"],"verifierAdapter":"cargo@1"}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify r_efi in pkg:cargo/r-efi@6.0.0",
  "kind": "HOW",
  "packages": [
    "pkg:cargo/r-efi@6.0.0"
  ],
  "symbols": [
    "r_efi"
  ]
}
src/main.rs
#[path = "../test/contract.rs"]
mod contract;

fn main() {
    contract::run_contract();
}
test/contract.rs
use r_efi::efi::{self, Boolean, Guid, PhysicalAddress, Status, Time, VirtualAddress};
use r_efi::{eficall, eficall_abi};

eficall! {
    fn evaluate_code(code: usize) -> Status {
        if code == 0 {
            Status::SUCCESS
        } else {
            Status::INVALID_PARAMETER
        }
    }
}

type EvaluateFn = eficall! { fn(usize) -> Status };

pub fn run_contract() {
    // 1. Boolean conversion and logical comparison
    let b_false: Boolean = Boolean::FALSE;
    let b_true: Boolean = Boolean::TRUE;
    assert_eq!(bool::from(b_false), false);
    assert_eq!(bool::from(b_true), true);
    assert_eq!(Boolean::from(false), Boolean::FALSE);
    assert_eq!(Boolean::from(true), Boolean::TRUE);
    assert_eq!(Boolean::from(42u8), Boolean::TRUE);
    assert!(b_true > b_false);

    // 2. Status codes, categories (success, warning, error) and bit masks
    let ok = Status::SUCCESS;
    assert!(!ok.is_error());
    assert!(!ok.is_warning());
    assert_eq!(ok.as_usize(), 0);

    let err = Status::NOT_FOUND;
    assert!(err.is_error());
    assert!(!err.is_warning());
    assert_eq!(Status::from_usize(err.as_usize()), err);

    let warn = Status::WARN_UNKNOWN_GLYPH;
    assert!(!warn.is_error());
    assert!(warn.is_warning());
    assert_eq!(Status::from_usize(warn.as_usize()), warn);

    // 3. Guid construction from fields and byte representation round-trip
    let guid = Guid::from_fields(
        0x12345678,
        0x9abc,
        0xdef0,
        0x12,
        0x34,
        &[0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0],
    );
    let bytes = *guid.as_bytes();
    let guid_roundtrip = Guid::from_bytes(&bytes);
    assert_eq!(guid, guid_roundtrip);
    let (f0, f1, f2, f3, f4, f5) = guid.as_fields();
    assert_eq!(f0, 0x12345678);
    assert_eq!(f1, 0x9abc);
    assert_eq!(f2, 0xdef0);
    assert_eq!(f3, 0x12);
    assert_eq!(f4, 0x34);
    assert_eq!(f5, &[0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0]);

    // 4. Core UEFI ABI types and table header structures
    assert_eq!(core::mem::size_of::<PhysicalAddress>(), 8);
    assert_eq!(core::mem::size_of::<VirtualAddress>(), 8);
    assert_eq!(core::mem::size_of::<Guid>(), 16);
    assert_eq!(core::mem::align_of::<Guid>(), 4);
    assert_eq!(core::mem::size_of::<Time>(), 16);

    let hdr = efi::TableHeader {
        signature: efi::SYSTEM_TABLE_SIGNATURE,
        revision: efi::SYSTEM_TABLE_REVISION_2_00,
        header_size: core::mem::size_of::<efi::TableHeader>() as u32,
        crc32: 0,
        reserved: 0,
    };
    assert_eq!(hdr.signature, efi::SYSTEM_TABLE_SIGNATURE);
    assert_eq!(hdr.header_size, 24);

    // 5. EFI calling convention macro on function definitions and pointer types
    let fn_ptr: EvaluateFn = evaluate_code;
    assert_eq!(fn_ptr(0), Status::SUCCESS);
    assert_eq!(fn_ptr(1), Status::INVALID_PARAMETER);
}

Ursprungs-Seeder

anonym