CodeSampleX

Beispiel

r-efi 5.3.0: r_efi

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

sha256:b8d7b50648f04332193fc6b9f310d6a762e621cf5e93190d857b3ba37a6b2294

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 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-11

Fall

HOW
Ziel
verify r_efi in pkg:cargo/r-efi@5.3.0
Pakete
Symbole
  • r_efi
Erstellt
2026-10-11T14:23:33Z

Contract

  1. Boolean converts between bool/u8 and supports logical equality and ordering
  2. Status differentiates success, warning, and error codes with correct masking
  3. Guid initializes from fields and raw byte representations with consistent round-trip conversion
  4. Core UEFI types maintain standard ABI sizes and alignments
  5. eficall macro annotates function pointers with the platform EFI calling convention

Dateien

  • Cargo.lock
  • Cargo.toml
  • PROMPT.md
  • csx.json
  • spec.json
  • src/lib.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 = "5.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"

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

[dependencies]
r-efi = "=5.3.0"

[[bin]]
name = "contract"
path = "test/contract.rs"
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@5.3.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:cargo/r-efi@5.3.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:18e523af90a87f9c74a6d9b7981ebbedea7b87eb0ab421d13c894a3dfc63eac2","contract":["Boolean converts between bool/u8 and supports logical equality and ordering","Status differentiates success, warning, and error codes with correct masking","Guid initializes from fields and raw byte representations with consistent round-trip conversion","Core UEFI types maintain standard ABI sizes and alignments","eficall macro annotates function pointers with the platform EFI calling convention"],"goal":"verify r_efi in pkg:cargo/r-efi@5.3.0","kind":"HOW","packages":["pkg:cargo/r-efi@5.3.0"],"schemaVersion":1,"symbols":["r_efi"]},"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/r-efi@5.3.0"],"schemaVersion":1,"subject":"pkg:cargo/r-efi@5.3.0","symbols":["r_efi"],"verifierAdapter":"cargo@1"}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify r_efi in pkg:cargo/r-efi@5.3.0",
  "kind": "HOW",
  "packages": [
    "pkg:cargo/r-efi@5.3.0"
  ],
  "symbols": [
    "r_efi"
  ]
}
src/lib.rs
//! Clean-room verification sample for r-efi.

pub use r_efi::*;
test/contract.rs
use r_efi::base::{Boolean, Char8, Char16, Guid, Handle, Status};
use r_efi::system::Time;
use r_efi::{eficall, eficall_abi};
use std::mem::{align_of, size_of};

fn main() {
    // 1. Boolean converts between bool/u8 and supports logical equality and ordering
    let b_true = Boolean::TRUE;
    let b_false = Boolean::FALSE;
    assert_ne!(b_true, b_false);
    assert_eq!(b_true, true);
    assert_eq!(b_false, false);

    let from_bool_t = Boolean::from(true);
    let from_bool_f = Boolean::from(false);
    assert_eq!(from_bool_t, b_true);
    assert_eq!(from_bool_f, b_false);

    let from_u8_zero = Boolean::from(0u8);
    let from_u8_nonzero = Boolean::from(42u8);
    assert_eq!(from_u8_zero, b_false);
    assert_eq!(from_u8_nonzero, b_true);

    let to_bool: bool = b_true.into();
    assert!(to_bool);
    let to_u8: u8 = b_false.into();
    assert_eq!(to_u8, 0);

    // 2. Status differentiates success, warning, and error codes with correct masking
    let success = Status::SUCCESS;
    assert!(!success.is_error());
    assert!(!success.is_warning());
    assert_eq!(success.as_usize(), 0);

    let err = Status::LOAD_ERROR;
    assert!(err.is_error());
    assert!(!err.is_warning());

    let invalid_param = Status::INVALID_PARAMETER;
    assert!(invalid_param.is_error());

    let warn = Status::WARN_UNKNOWN_GLYPH;
    assert!(!warn.is_error());
    assert!(warn.is_warning());

    let ok_res: Result<Status, Status> = success.into();
    assert_eq!(ok_res, Ok(success));

    let err_res: Result<Status, Status> = err.into();
    assert_eq!(err_res, Err(err));

    // 3. Guid initializes from fields and raw byte representations with consistent round-trip conversion
    let fields = (
        0x550e8400u32,
        0xe29bu16,
        0x41d4u16,
        0xa7u8,
        0x16u8,
        &[0x44, 0x66, 0x55, 0x44, 0x00, 0x00],
    );
    let raw_bytes = [
        0x00, 0x84, 0x0e, 0x55,
        0x9b, 0xe2,
        0xd4, 0x41,
        0xa7,
        0x16,
        0x44, 0x66, 0x55, 0x44, 0x00, 0x00,
    ];

    let g_from_fields = Guid::from_fields(fields.0, fields.1, fields.2, fields.3, fields.4, fields.5);
    let g_from_bytes = Guid::from_bytes(&raw_bytes);
    assert_eq!(g_from_fields, g_from_bytes);
    assert_eq!(g_from_fields.as_bytes(), &raw_bytes);
    assert_eq!(g_from_bytes.as_fields(), fields);

    // 4. Core UEFI types maintain standard ABI sizes and alignments
    assert_eq!(size_of::<Boolean>(), 1);
    assert_eq!(align_of::<Boolean>(), 1);

    assert_eq!(size_of::<Char8>(), 1);
    assert_eq!(align_of::<Char8>(), 1);
    assert_eq!(size_of::<Char16>(), 2);
    assert_eq!(align_of::<Char16>(), 2);

    assert_eq!(size_of::<Status>(), size_of::<usize>());
    assert_eq!(align_of::<Status>(), align_of::<usize>());

    assert_eq!(size_of::<Handle>(), size_of::<*mut ()>());
    assert_eq!(align_of::<Handle>(), align_of::<*mut ()>());

    assert_eq!(size_of::<Guid>(), 16);
    assert_eq!(align_of::<Guid>(), 4);

    assert_eq!(size_of::<Time>(), 16);

    // 5. eficall macro annotates function pointers with the platform EFI calling convention
    type Callback = eficall! { fn(u32) -> u32 };
    let f: Callback = my_callback;
    assert_eq!(f(41), 42);

    println!("All r_efi contract assertions passed successfully.");
}

eficall! {
    fn my_callback(val: u32) -> u32 {
        val + 1
    }
}

Ursprungs-Seeder

anonym