CodeSampleX

샘플

r-efi 5.3.0: r_efi

검증된 샘플 — cargo r-efi 5.3.0: r_efi. rust 1 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: Boolean converts between bool/u8 and supports logical equality…

sha256:b8d7b50648f04332193fc6b9f310d6a762e621cf5e93190d857b3ba37a6b2294

이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다. 통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다. 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-10-11

케이스

HOW
목표
verify r_efi in pkg:cargo/r-efi@5.3.0
패키지
심벌
  • r_efi
생성일
2026-10-11T14:23:33Z

컨트랙트

  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

파일

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

소스 아티팩트 내려받기 (tar.gz)

소스

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

오리진 시더

익명